]> www.infradead.org Git - users/hch/misc.git/commit
KVM: arm64: Set HCR_EL2.TID1 unconditionally
authorOliver Upton <oliver.upton@linux.dev>
Tue, 25 Feb 2025 00:53:57 +0000 (16:53 -0800)
committerOliver Upton <oliver.upton@linux.dev>
Wed, 26 Feb 2025 09:31:52 +0000 (01:31 -0800)
commit4cd48565b0e5df398e7253c0d2d8c0403d69e7bf
tree3f13231de274a450d46e2d3661847aa6a8d6dfe1
parent0ad2507d5d93f39619fc42372c347d6006b64319
KVM: arm64: Set HCR_EL2.TID1 unconditionally

commit 90807748ca3a ("KVM: arm64: Hide SME system registers from
guests") added trap handling for SMIDR_EL1, treating it as UNDEFINED as
KVM does not support SME. This is right for the most part, however KVM
needs to set HCR_EL2.TID1 to _actually_ trap the register.

Unfortunately, this comes with some collateral damage as TID1 forces
REVIDR_EL1 and AIDR_EL1 to trap as well. KVM has long treated these
registers as "invariant" which is an awful term for the following:

 - Userspace sees the boot CPU values on all vCPUs

 - The guest sees the hardware values of the CPU on which a vCPU is
   scheduled

Keep the plates spinning by adding trap handling for the affected
registers and repaint all of the "invariant" crud into terms of
identifying an implementation. Yes, at this point we only need to
set TID1 on SME hardware, but REVIDR_EL1 and AIDR_EL1 are about to
become mutable anyway.

Cc: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 90807748ca3a ("KVM: arm64: Hide SME system registers from guests")
[maz: handle traps from 32bit]
Co-developed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250225005401.679536-2-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/kvm_arm.h
arch/arm64/kvm/sys_regs.c