diff options
| author | Marc Zyngier <maz@kernel.org> | 2026-02-02 18:43:14 +0000 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-02-05 08:59:28 +0000 |
| commit | f9d58956423844237e18a758dc0f1b2cf6480042 (patch) | |
| tree | 5793e365c9341eeac780aa6fb54927cc18ca3e6b /arch/arm64/include/asm | |
| parent | 0879478913dd671b0aed1e3960c4b35fb8546ab4 (diff) | |
KVM: arm64: Extend unified RESx handling to runtime sanitisation
Add a new helper to retrieve the RESx values for a given system
register, and use it for the runtime sanitisation.
This results in slightly better code generation for a fairly hot
path in the hypervisor, and additionally covers all sanitised
registers in all conditions, not just the VNCR-based ones.
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260202184329.2724080-6-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm')
| -rw-r--r-- | arch/arm64/include/asm/kvm_host.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 799f494a1349..20ebc1610ac8 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -635,6 +635,21 @@ struct kvm_sysreg_masks { struct resx mask[NR_SYS_REGS - __SANITISED_REG_START__]; }; +static inline struct resx __kvm_get_sysreg_resx(struct kvm_arch *arch, + enum vcpu_sysreg sr) +{ + struct kvm_sysreg_masks *masks; + + masks = arch->sysreg_masks; + if (likely(masks && + sr >= __SANITISED_REG_START__ && sr < NR_SYS_REGS)) + return masks->mask[sr - __SANITISED_REG_START__]; + + return (struct resx){}; +} + +#define kvm_get_sysreg_resx(k, sr) __kvm_get_sysreg_resx(&(k)->arch, (sr)) + static inline void __kvm_set_sysreg_resx(struct kvm_arch *arch, enum vcpu_sysreg sr, struct resx resx) { |
