]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
arm64: vgic-v2: Fix guest endianness check in hVHE mode
authorFuad Tabba <tabba@google.com>
Thu, 7 Aug 2025 12:01:33 +0000 (13:01 +0100)
committerOliver Upton <oliver.upton@linux.dev>
Fri, 8 Aug 2025 08:29:32 +0000 (01:29 -0700)
In hVHE when running at the hypervisor, SCTLR_EL1 refers to the
hypervisor's System Control Register rather than the guest's. Make sure
to access the guest's register to determine its endianness.

Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Fuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20250807120133.871892-4-tabba@google.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c

index 87a54375bd6edcc1d167af389706ca36df5e53c0..78579b31a4205fe1e8877f3da172faddacb4b42f 100644 (file)
@@ -20,7 +20,7 @@ static bool __is_be(struct kvm_vcpu *vcpu)
        if (vcpu_mode_is_32bit(vcpu))
                return !!(read_sysreg_el2(SYS_SPSR) & PSR_AA32_E_BIT);
 
-       return !!(read_sysreg(SCTLR_EL1) & SCTLR_ELx_EE);
+       return !!(read_sysreg_el1(SYS_SCTLR) & SCTLR_ELx_EE);
 }
 
 /*