Commit e88d60c0 authored by Alexandru Elisei's avatar Alexandru Elisei Committed by Oliver Upton
Browse files

KVM: arm64: at: Use correct HA bit in TCR_EL2 when regime is EL2



According to ARM DDI 0487L.b, the HA bit in TCR_EL2 when the translation
regime is EL2 (or !ELIsInHost(EL2)) is bit 21, not 39.

Fixes: c59ca4b5b0c3 ("KVM: arm64: Implement HW access flag management in stage-1 SW PTW")
Signed-off-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
Link: https://msgid.link/20251128100946.74210-3-alexandru.elisei@arm.com


Signed-off-by: default avatarOliver Upton <oupton@kernel.org>
parent 93e8d997
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@
#define TCR_EL2_DS		(1UL << 32)
#define TCR_EL2_RES1		((1U << 31) | (1 << 23))
#define TCR_EL2_HPD		(1 << 24)
#define TCR_EL2_HA		(1 << 21)
#define TCR_EL2_TBI		(1 << 20)
#define TCR_EL2_PS_SHIFT	16
#define TCR_EL2_PS_MASK		(7 << TCR_EL2_PS_SHIFT)
+3 −1
Original line number Diff line number Diff line
@@ -346,7 +346,9 @@ static int setup_s1_walk(struct kvm_vcpu *vcpu, struct s1_walk_info *wi,

	wi->baddr &= GENMASK_ULL(wi->max_oa_bits - 1, x);

	wi->ha = tcr & TCR_HA;
	wi->ha = (wi->regime == TR_EL2 ?
		  FIELD_GET(TCR_EL2_HA, tcr) :
		  FIELD_GET(TCR_HA, tcr));

	return 0;