[PATCH] KVM: arm64: Force HCR_EL2.xMO to 1 at all times in VHE mode

D Scott Phillips scott at os.amperecomputing.com
Thu Apr 24 15:24:59 PDT 2025


Marc Zyngier <maz at kernel.org> writes:

> We keep setting and clearing these bits depending on the role of
> the host kernel, mimicking what we do for nVHE. But that's actually
> pretty pointless, as we always want physical interrupts to make it
> to the host, at EL2.
>
> This has also two problems:
>
> - it prevents IRQs from being taken when these bits are cleared
>   if the implementation has chosen to implement these bits as
>   masks when HCR_EL2.{TGE,xMO}=={0,0}
>
> - it triggers a bad erratum on the AmpereOne HW, which catches
>   fire on clearing these bits while an interrupt is being taken
>   (AC03_CPU_36).
>
> Let's kill these two birds with a single stone.
>
> Reported-by: D Scott Phillips <scott at os.amperecomputing.com>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
>  arch/arm64/include/asm/kvm_arm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
> index 974d72b5905b8..bba4b0e930915 100644
> --- a/arch/arm64/include/asm/kvm_arm.h
> +++ b/arch/arm64/include/asm/kvm_arm.h
> @@ -100,7 +100,7 @@
>  			 HCR_FMO | HCR_IMO | HCR_PTW | HCR_TID3 | HCR_TID1)
>  #define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK | HCR_ATA)
>  #define HCR_HOST_NVHE_PROTECTED_FLAGS (HCR_HOST_NVHE_FLAGS | HCR_TSC)
> -#define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H)
> +#define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H | HCR_AMO | HCR_IMO | HCR_FMO)
>  
>  #define HCRX_HOST_FLAGS (HCRX_EL2_MSCEn | HCRX_EL2_TCR2En | HCRX_EL2_EnFPM)
>  #define MPAMHCR_HOST_FLAGS	0

Should the xMO twiddling in __vgic_v3_get_gic_config() also get dropped
here?



More information about the linux-arm-kernel mailing list