Skip to content

Commit cff3b5c

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Disable TTBR1_EL2 when using ARM64_KVM_HVHE
When using hVHE, we end-up with two TTBRs at EL2. That's great, but we're not quite ready for this just yet. Disable TTBR1_EL2 by setting TCR_EL2.EPD1 so that we only translate via TTBR0_EL2. Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230609162200.2024064-12-maz@kernel.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent d0daf5a commit cff3b5c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

arch/arm64/kvm/arm.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,13 @@ static void __init cpu_prepare_hyp_mode(int cpu, u32 hyp_va_bits)
16661666

16671667
params->mair_el2 = read_sysreg(mair_el1);
16681668

1669-
tcr = (read_sysreg(tcr_el1) & TCR_EL2_MASK) | TCR_EL2_RES1;
1669+
tcr = read_sysreg(tcr_el1);
1670+
if (cpus_have_final_cap(ARM64_KVM_HVHE)) {
1671+
tcr |= TCR_EPD1_MASK;
1672+
} else {
1673+
tcr &= TCR_EL2_MASK;
1674+
tcr |= TCR_EL2_RES1;
1675+
}
16701676
tcr &= ~TCR_T0SZ_MASK;
16711677
tcr |= TCR_T0SZ(hyp_va_bits);
16721678
params->tcr_el2 = tcr;

0 commit comments

Comments
 (0)