mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/arm: Flush TLBs before turning on the MMU to avoid stale entries
We don't know what is the state of the TLBs when booting Xen. To avoid
stale entries, it is necessary to flush the TLBs before turning on the
MMU.
Reported-by: Iain Hunter <iain@hunterembedded.co.uk>
Signed-off-by: Julien Grall <julien.gralL@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 1c473c4219)
This commit is contained in:
1 parent
525c3816e2
commit
cf03d32726
2 files changed
+14
No files matched your search
@@ -349,6 +349,13 @@ virtphys_clash:
|
||||
1:
|
||||
PRINT("- Turning on paging -\r\n")
|
||||
|
||||
/*
|
||||
* The state of the TLBs is unknown before turning on the MMU.
|
||||
* Flush them to avoid stale one.
|
||||
*/
|
||||
mcr CP32(r0, TLBIALLH) /* Flush hypervisor TLBs */
|
||||
dsb nsh
|
||||
|
||||
ldr r1, =paging /* Explicit vaddr, not RIP-relative */
|
||||
mrc CP32(r0, HSCTLR)
|
||||
orr r0, r0, #(SCTLR_M|SCTLR_C) /* Enable MMU and D-cache */
|
||||
|
||||
@@ -505,6 +505,13 @@ virtphys_clash:
|
||||
1:
|
||||
PRINT("- Turning on paging -\r\n")
|
||||
|
||||
/*
|
||||
* The state of the TLBs is unknown before turning on the MMU.
|
||||
* Flush them to avoid stale one.
|
||||
*/
|
||||
tlbi alle2 /* Flush hypervisor TLBs */
|
||||
dsb nsh
|
||||
|
||||
ldr x1, =paging /* Explicit vaddr, not RIP-relative */
|
||||
mrs x0, SCTLR_EL2
|
||||
orr x0, x0, #SCTLR_M /* Enable MMU */
|
||||
|
||||