Skip to content

Commit a88a9ec

Browse files
author
Marc Zyngier
committed
KVM: arm64: Improve out-of-order sysreg table diagnostics
Adding new entries to our system register tables is a painful exercise, as we require them to be ordered by Op0,Op1,CRn,CRm,Op2. If an entry is misordered, we output an error that indicates the pointer to the entry and the number *of the last valid one*. That's not very helpful, and would be much better if we printed the number of the *offending* entry as well as its name (which is present in the vast majority of the cases). This makes debugging new additions to the tables much easier. Reviewed-by: Zenghui Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 4cece76 commit a88a9ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,12 +3069,14 @@ static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,
30693069

30703070
for (i = 0; i < n; i++) {
30713071
if (!is_32 && table[i].reg && !table[i].reset) {
3072-
kvm_err("sys_reg table %pS entry %d lacks reset\n", &table[i], i);
3072+
kvm_err("sys_reg table %pS entry %d (%s) lacks reset\n",
3073+
&table[i], i, table[i].name);
30733074
return false;
30743075
}
30753076

30763077
if (i && cmp_sys_reg(&table[i-1], &table[i]) >= 0) {
3077-
kvm_err("sys_reg table %pS entry %d out of order\n", &table[i - 1], i - 1);
3078+
kvm_err("sys_reg table %pS entry %d (%s -> %s) out of order\n",
3079+
&table[i], i, table[i - 1].name, table[i].name);
30783080
return false;
30793081
}
30803082
}

0 commit comments

Comments
 (0)