diff options
author | Marc Zyngier <maz@kernel.org> | 2024-02-14 16:18:26 +0300 |
---|---|---|
committer | Oliver Upton <oliver.upton@linux.dev> | 2024-02-19 20:13:02 +0300 |
commit | b80b701d5a67d07f4df4a21e09cb31f6bc1feeca (patch) | |
tree | de9c7b7d0939f1356bbc61c27c103ca680500192 /arch/arm64/kvm/sys_regs.c | |
parent | 84de212d739ecd16c6289ec4ed47e27b0080bac6 (diff) | |
download | linux-b80b701d5a67d07f4df4a21e09cb31f6bc1feeca.tar.xz |
KVM: arm64: Snapshot all non-zero RES0/RES1 sysreg fields for later checking
As KVM now strongly relies on accurately handling the RES0/RES1 bits
on a number of paths, add a compile-time checker that will blow in
the face of the innocent bystander, should they try to sneak in an
update that changes any of these RES0/RES1 fields.
It is expected that such an update will come with the relevant
KVM update if needed.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20240214131827.2856277-26-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Diffstat (limited to 'arch/arm64/kvm/sys_regs.c')
-rw-r--r-- | arch/arm64/kvm/sys_regs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 2cb69efac1dc..b5335e5a6e6e 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -31,6 +31,7 @@ #include <trace/events/kvm.h> +#include "check-res-bits.h" #include "sys_regs.h" #include "trace.h" @@ -4021,6 +4022,8 @@ int __init kvm_sys_reg_table_init(void) unsigned int i; int ret = 0; + check_res_bits(); + /* 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); |