|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v6 08/13] xen/arm: Fold mmu_init_secondary_cpu() to head.S
Hi Henry, On 28/08/2023 02:32, Henry Wang wrote:
It would be preferable if we can set the flag right when the MMU is initialized enabled configured. This would avoid the extra TLB flush and SCTLR dance. How about the following (not compiled/cleaned) code:
diff --git a/xen/arch/arm/arm64/mmu/head.S b/xen/arch/arm/arm64/mmu/head.S
index a5271e388071..6b19d15ff89f 100644
--- a/xen/arch/arm/arm64/mmu/head.S
+++ b/xen/arch/arm/arm64/mmu/head.S
@@ -264,10 +264,11 @@ ENDPROC(create_page_tables)
* Inputs:
* x0 : Physical address of the page tables.
*
- * Clobbers x0 - x4
+ * Clobbers x0 - x6
*/
enable_mmu:
mov x4, x0
+ mov x5, x1
PRINT("- Turning on paging -\r\n")
/*
@@ -283,6 +284,7 @@ enable_mmu:
mrs x0, SCTLR_EL2
orr x0, x0, #SCTLR_Axx_ELx_M /* Enable MMU */
orr x0, x0, #SCTLR_Axx_ELx_C /* Enable D-cache */
+ orr x0, x0, x5 /* Enable extra flags */
dsb sy /* Flush PTE writes and finish
reads */
msr SCTLR_EL2, x0 /* now paging is enabled */
isb /* Now, flush the icache */
@@ -297,16 +299,17 @@ ENDPROC(enable_mmu)
* Inputs:
* lr : Virtual address to return to.
*
- * Clobbers x0 - x5
+ * Clobbers x0 - x6
*/
ENTRY(enable_secondary_cpu_mm)
- mov x5, lr
+ mov x6, lr
load_paddr x0, init_ttbr
ldr x0, [x0]
+ mov x1, #SCTLR_Axx_ELx_WXN /* Enable WxN from the start */
bl enable_mmu
- mov lr, x5
+ mov lr, x6
/* Return to the virtual address requested by the caller. */
ret
@@ -320,16 +323,17 @@ ENDPROC(enable_secondary_cpu_mm)
* Inputs:
* lr : Virtual address to return to.
*
- * Clobbers x0 - x5
+ * Clobbers x0 - x6
*/
ENTRY(enable_boot_cpu_mm)
- mov x5, lr
+ mov x6, lr
bl create_page_tables
load_paddr x0, boot_pgtable
+ mov x1, #0 /* No extra SCTLR flags */
bl enable_mmu
- mov lr, x5
+ mov lr, x6
/*
* The MMU is turned on and we are in the 1:1 mapping. Switch
The same logic could be used for arm32.
Cheers,
--
Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |