[PATCH] arm64: Fix early handling of FEAT_E2H0 not being implemented

Catalin Marinas catalin.marinas at arm.com
Thu Mar 21 13:16:15 PDT 2024


On Thu, Mar 21, 2024 at 11:54:14AM +0000, Marc Zyngier wrote:
> Commit 3944382fa6f2 introduced checks for the FEAT_E2H0 not being
> implemented. However, the check is absolutely wrong and makes a
> point it testing a bit that is guaranteed to be zero.
> 
> On top of that, the detection happens way too late, after the
> init_el2_state has done its job.
> 
> This went undetected because the HW this was tested on has E2H being
> RAO/WI, and not RES1. However, the bug shows up when run as a nested
> guest, where HCR_EL2.E2H is not necessarily set to 1. As a result,
> booting the kernel in hVHE mode fails with timer accesses being
> cought in a trap loop (which was fun to debug).
> 
> Fix the check for ID_AA64MMFR4_EL1.E2H0, and set the HCR_EL2.E2H bit
> early so that it can be checked by the rest of the init sequence.
> 
> With this, hVHE works again in a NV environment that doesn't have
> FEAT_E2H0.
> 
> Fixes: 3944382fa6f2 ("arm64: Treat HCR_EL2.E2H as RES1 when ID_AA64MMFR4_EL1.E2H0 is negative")
> Signed-off-by: Marc Zyngier <maz at kernel.org>

Acked-by: Catalin Marinas <catalin.marinas at arm.com>

I assume Oliver will take it, otherwise I can pick it up after -rc1
since I don't have the fixed commit in my tree.

-- 
Catalin



More information about the linux-arm-kernel mailing list