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

From: Marc Zyngier <[email-masked]>
Date: Tue, 17 Mar 2026 11:04:23 +0000

On Sat, 14 Mar 2026 17:51:32 +0000,
Yeoreum Yun <[email-masked]> 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 <[email-masked]>

Reviewed-by: Marc Zyngier <[email-masked]>

	M.

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