KVM: arm64: Fix RAS trapping and MTE_frac validation
cover KVM: arm64: Fix RAS trapping and MTE_frac validation
From: Minhang Zhang <[email protected]>
This series fixes two independent issues in arm64 KVM.
Patch 1 enables trapping of RAS error record accesses whenever the host's sanitised ID registers report RAS, including when CONFIG_ARM64_RAS_EXTN is disabled. Update both the host and hyp HCR initialisation paths so that this also applies in protected mode, where hyp rebuilds HCR_EL2. This keeps guest accesses under KVM's emulation, including when userspace hides RAS from the guest.
Patch 2 uses KVM's sanitised MTE field to decide whether to apply the MTE_frac compatibility rewrite. This avoids changing the zero MTE_frac reported for VMs where MTE is hidden, including nested virtualisation, while preserving compatibility with older KVM versions for MTE guests.
The patches are independent.
Build-checked arch/arm64/kvm/sys_regs.o and the nVHE aggregate object arch/arm64/kvm/hyp/nvhe/kvm_nvhe.o with arm64 defconfig, CONFIG_KVM=y, and CONFIG_ARM64_RAS_EXTN both enabled and disabled, based on v7.4-rc5 (fe6ff8d5d675). No KVM runtime testing or hardware reproduction was performed for either issue.
Minhang Zhang (2):
KVM: arm64: Trap RAS error records whenever the host has RAS
KVM: arm64: Only clamp MTE_frac when the VM has MTE
arch/arm64/kvm/hyp/nvhe/pkvm.c | 8 +++++--- arch/arm64/kvm/sys_regs.c | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1