]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: arm64: Use CAST instruction for swapping guest descriptor
authorYeoreum Yun <yeoreum.yun@arm.com>
Sat, 14 Mar 2026 17:51:32 +0000 (17:51 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 27 Mar 2026 12:52:45 +0000 (12:52 +0000)
commit16dbe77a5be2defe5797cc33da87e33f72ef150c
tree704f000c2a14df5cb7834222d90e039395728e80
parent44adf2bf40efe56c68c1563779ab2047eb0a57ea
KVM: arm64: Use CAST instruction for swapping guest descriptor

Use the CAST instruction to swap the guest descriptor when FEAT_LSUI
is enabled, avoiding the need to clear the PAN bit.

FEAT_LSUI is introduced in Armv9.6, where FEAT_PAN is mandatory. However,
this assumption may not always hold:

 - Some CPUs may advertise FEAT_LSUI but lack FEAT_PAN.
 - Virtualization or ID register overrides may expose invalid feature
   combinations.

Therefore, instead of disabling FEAT_LSUI when FEAT_PAN is absent, wrap
LSUI instructions with uaccess_ttbr0_enable()/disable() when
ARM64_SW_TTBR0_PAN is enabled.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kvm/at.c