Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: arm64: Use the in-context stage-1 in __kvm_find_s1_desc_level()

Running the external_aborts selftest at EL2 leads to an ugly splat due
to the stage-1 MMU being disabled for the walked context, owing to the
fact that __kvm_find_s1_desc_level() is hardcoded to the EL1&0 regime.

Select the appropriate translation regime for the stage-1 walk based on
the current vCPU context.

Fixes: b8e625167a32 ("KVM: arm64: Add S1 IPA to page table level walker")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>

authored by

Oliver Upton and committed by
Marc Zyngier
a46c09b3 9a1950f9

+5 -1
+5 -1
arch/arm64/kvm/at.c
··· 1602 1602 .fn = match_s1_desc, 1603 1603 .priv = &dm, 1604 1604 }, 1605 - .regime = TR_EL10, 1606 1605 .as_el0 = false, 1607 1606 .pan = false, 1608 1607 }; 1609 1608 struct s1_walk_result wr = {}; 1610 1609 int ret; 1610 + 1611 + if (is_hyp_ctxt(vcpu)) 1612 + wi.regime = vcpu_el2_e2h_is_set(vcpu) ? TR_EL20 : TR_EL2; 1613 + else 1614 + wi.regime = TR_EL10; 1611 1615 1612 1616 ret = setup_s1_walk(vcpu, &wi, &wr, va); 1613 1617 if (ret)