Skip to content

Commit f5e6ebf

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Clarify the check for reset callback in check_sysreg_table()
check_sysreg_table() has a wonky 'is_32" parameter, which is really an indication that we should enforce the presence of a reset helper. Clean this up by naming the variable accordingly and inverting the condition. Contrary to popular belief, system instructions don't have a reset value (duh!), and therefore do not need to be checked for reset (they escaped the check through luck...). Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Sebastian Ott <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 0f3046c commit f5e6ebf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4304,12 +4304,12 @@ static const struct sys_reg_desc cp15_64_regs[] = {
43044304
};
43054305

43064306
static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,
4307-
bool is_32)
4307+
bool reset_check)
43084308
{
43094309
unsigned int i;
43104310

43114311
for (i = 0; i < n; i++) {
4312-
if (!is_32 && table[i].reg && !table[i].reset) {
4312+
if (reset_check && table[i].reg && !table[i].reset) {
43134313
kvm_err("sys_reg table %pS entry %d (%s) lacks reset\n",
43144314
&table[i], i, table[i].name);
43154315
return false;
@@ -5303,11 +5303,11 @@ int __init kvm_sys_reg_table_init(void)
53035303
int ret = 0;
53045304

53055305
/* Make sure tables are unique and in order. */
5306-
valid &= check_sysreg_table(sys_reg_descs, ARRAY_SIZE(sys_reg_descs), false);
5307-
valid &= check_sysreg_table(cp14_regs, ARRAY_SIZE(cp14_regs), true);
5308-
valid &= check_sysreg_table(cp14_64_regs, ARRAY_SIZE(cp14_64_regs), true);
5309-
valid &= check_sysreg_table(cp15_regs, ARRAY_SIZE(cp15_regs), true);
5310-
valid &= check_sysreg_table(cp15_64_regs, ARRAY_SIZE(cp15_64_regs), true);
5306+
valid &= check_sysreg_table(sys_reg_descs, ARRAY_SIZE(sys_reg_descs), true);
5307+
valid &= check_sysreg_table(cp14_regs, ARRAY_SIZE(cp14_regs), false);
5308+
valid &= check_sysreg_table(cp14_64_regs, ARRAY_SIZE(cp14_64_regs), false);
5309+
valid &= check_sysreg_table(cp15_regs, ARRAY_SIZE(cp15_regs), false);
5310+
valid &= check_sysreg_table(cp15_64_regs, ARRAY_SIZE(cp15_64_regs), false);
53115311
valid &= check_sysreg_table(sys_insn_descs, ARRAY_SIZE(sys_insn_descs), false);
53125312

53135313
if (!valid)

0 commit comments

Comments
 (0)