Re: [PATCH v17 7/8] KVM: arm64: use CAST instruction for swapping guest descriptor

From: Marc Zyngier

Date: Tue Mar 17 2026 - 07:04:46 EST


On Sat, 14 Mar 2026 17:51:32 +0000,
Yeoreum Yun <yeoreum.yun@xxxxxxx> wrote:
>
> 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@xxxxxxx>

Reviewed-by: Marc Zyngier <maz@xxxxxxxxxx>

M.

--
Without deviation from the norm, progress is not possible.