]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: arm64: Extend masking facility to arbitrary registers
authorMarc Zyngier <maz@kernel.org>
Wed, 23 Oct 2024 14:53:17 +0000 (15:53 +0100)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 31 Oct 2024 02:42:30 +0000 (02:42 +0000)
commita0162020095e2a34a59fc64c07183cc039e759f6
tree01946d03508b578635a2de2325968ac460fe9c2b
parent14ca930d828b6bd0538a0c7e101b52319ae7ad35
KVM: arm64: Extend masking facility to arbitrary registers

We currently only use the masking (RES0/RES1) facility for VNCR
registers, as they are memory-based and thus easy to sanitise.

But we could apply the same thing to other registers if we:

- split the sanitisation from __VNCR_START__
- apply the sanitisation when reading from a HW register

This involves a new "marker" in the vcpu_sysreg enum, which
defines the point at which the sanitisation applies (the VNCR
registers being of course after this marker).

Whle we are at it, rename kvm_vcpu_sanitise_vncr_reg() to
kvm_vcpu_apply_reg_masks(), which is vaguely more explicit,
and harden set_sysreg_masks() against setting masks for
random registers...

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Link: https://lore.kernel.org/r/20241023145345.1613824-10-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/nested.c
arch/arm64/kvm/sys_regs.c