summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorPranavkumar Sawargaonkar <pranavkumar@linaro.org>2014-07-31 12:23:23 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-05 14:52:10 -0700
commit0a7c89f6c76c264fb8ff9492421cf279f2bc085c (patch)
tree80ca201a92dd71cea35fa9a271cf7607e8d5adff /arch
parent6487706b8ab6a4b737d2b0019b4bcacdbf3db73b (diff)
downloadlinux-stable-0a7c89f6c76c264fb8ff9492421cf279f2bc085c.tar.gz
linux-stable-0a7c89f6c76c264fb8ff9492421cf279f2bc085c.tar.bz2
linux-stable-0a7c89f6c76c264fb8ff9492421cf279f2bc085c.zip
ARM/ARM64: KVM: Nuke Hyp-mode tlbs before enabling MMU
commit f6edbbf36da3a27b298b66c7955fc84e1dcca305 upstream. X-Gene u-boot runs in EL2 mode with MMU enabled hence we might have stale EL2 tlb enteris when we enable EL2 MMU on each host CPU. This can happen on any ARM/ARM64 board running bootloader in Hyp-mode (or EL2-mode) with MMU enabled. This patch ensures that we flush all Hyp-mode (or EL2-mode) TLBs on each host CPU before enabling Hyp-mode (or EL2-mode) MMU. Tested-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> Signed-off-by: Anup Patel <anup.patel@linaro.org> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kvm/init.S4
-rw-r--r--arch/arm64/kvm/hyp-init.S4
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S
index 1b9844d369cc..ee4f7447a1d3 100644
--- a/arch/arm/kvm/init.S
+++ b/arch/arm/kvm/init.S
@@ -98,6 +98,10 @@ __do_hyp_init:
mrc p15, 0, r0, c10, c2, 1
mcr p15, 4, r0, c10, c2, 1
+ @ Invalidate the stale TLBs from Bootloader
+ mcr p15, 4, r0, c8, c7, 0 @ TLBIALLH
+ dsb ish
+
@ Set the HSCTLR to:
@ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel)
@ - Endianness: Kernel config
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index 2b0244d65c16..12e26f358c31 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -74,6 +74,10 @@ __do_hyp_init:
msr mair_el2, x4
isb
+ /* Invalidate the stale TLBs from Bootloader */
+ tlbi alle2
+ dsb sy
+
mrs x4, sctlr_el2
and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2
ldr x5, =SCTLR_EL2_FLAGS