[PATCH 2/2] KVM/arm64: Print emulated register table name when it is unsorted
Alexandru Elisei
alexandru.elisei at arm.com
Mon Apr 25 09:39:03 PDT 2022
When a sysreg table entry is out-of-order, KVM attempts to print the
address of the table:
[ 0.143881] kvm [1]: sys_reg table (____ptrval____) out of order (0)
Printing the name of the table instead of a pointer is more helpful in this
case:
[ 0.143881] kvm [1]: sys_reg table sys_reg_descs out of order (0)
Signed-off-by: Alexandru Elisei <alexandru.elisei at arm.com>
---
arch/arm64/kvm/sys_regs.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index 57302048afd0..7b62a2daf056 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -2188,18 +2188,18 @@ static const struct sys_reg_desc cp15_64_regs[] = {
};
static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,
- bool is_32)
+ const char *table_name, bool is_32)
{
unsigned int i;
for (i = 0; i < n; i++) {
if (!is_32 && table[i].reg && !table[i].reset) {
- kvm_err("sys_reg table %p entry %d lacks reset\n", table, i);
+ kvm_err("sys_reg table %s entry %d lacks reset\n", table_name, i);
return false;
}
if (i && cmp_sys_reg(&table[i-1], &table[i]) >= 0) {
- kvm_err("sys_reg table %p out of order (%d)\n", table, i - 1);
+ kvm_err("sys_reg table %s out of order (%d)\n", table_name, i - 1);
return false;
}
}
@@ -2866,12 +2866,14 @@ int kvm_sys_reg_table_init(void)
struct sys_reg_desc clidr;
/* Make sure tables are unique and in order. */
- valid &= check_sysreg_table(sys_reg_descs, ARRAY_SIZE(sys_reg_descs), false);
- valid &= check_sysreg_table(cp14_regs, ARRAY_SIZE(cp14_regs), true);
- valid &= check_sysreg_table(cp14_64_regs, ARRAY_SIZE(cp14_64_regs), true);
- valid &= check_sysreg_table(cp15_regs, ARRAY_SIZE(cp15_regs), true);
- valid &= check_sysreg_table(cp15_64_regs, ARRAY_SIZE(cp15_64_regs), true);
- valid &= check_sysreg_table(invariant_sys_regs, ARRAY_SIZE(invariant_sys_regs), false);
+ valid &= check_sysreg_table(sys_reg_descs, ARRAY_SIZE(sys_reg_descs),
+ "sys_reg_descs", false);
+ valid &= check_sysreg_table(cp14_regs, ARRAY_SIZE(cp14_regs), "cp14_regs", true);
+ valid &= check_sysreg_table(cp14_64_regs, ARRAY_SIZE(cp14_64_regs), "cp14_64_regs", true);
+ valid &= check_sysreg_table(cp15_regs, ARRAY_SIZE(cp15_regs), "cp15_regs", true);
+ valid &= check_sysreg_table(cp15_64_regs, ARRAY_SIZE(cp15_64_regs), "cp15_64_regs", true);
+ valid &= check_sysreg_table(invariant_sys_regs, ARRAY_SIZE(invariant_sys_regs),
+ "invariant_sys_regs", false);
if (!valid)
return -EINVAL;
--
2.36.0
More information about the linux-arm-kernel
mailing list