]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ARM/ARM64: KVM: Nuke Hyp-mode tlbs before enabling MMU
authorPranavkumar Sawargaonkar <pranavkumar@linaro.org>
Thu, 31 Jul 2014 06:53:23 +0000 (12:23 +0530)
committerJiri Slaby <jslaby@suse.cz>
Thu, 30 Apr 2015 09:15:09 +0000 (11:15 +0200)
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.

Cc: <stable@vger.kernel.org>
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: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/arm/kvm/init.S
arch/arm64/kvm/hyp-init.S

index 1b9844d369cc08e6e1a88fc60b6f3fd6db0b6965..ee4f7447a1d35c320b0f03280114f0876c4a1805 100644 (file)
@@ -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
index ba84e6705e200a063ee40e05d0ff3bc5cb1bf35d..e9c87e5402c7b5fc29fb679e4e9b28b4ab69d172 100644 (file)
@@ -74,6 +74,10 @@ __do_hyp_init:
        msr     mair_el2, x4
        isb
 
+       /* Invalidate the stale TLBs from Bootloader */
+       tlbi    alle2
+       dsb     sy
+
        mov     x4, #SCTLR_EL2_FLAGS
        msr     sctlr_el2, x4
        isb