Skip to contentSkip to conversation

xen/arm: mmu: avoid transient mapping of page tables when a directmap is available

PATCH In review mixx86 2 participants 2 messages Jul 6 – Jul 7

lore
Share & tools
lore

mixx86

author
#0 lore raw

PATCH 1/1 xen/arm: mmu: avoid transient mapping of page tables when a directmap is available

---
 xen/arch/arm/mmu/pt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
xen/arch/arm/mmu/pt.c +11 -2
index 621b47d..735847e 100644
@@ -42,7 +42,11 @@ static lpae_t *xen_map_table(mfn_t mfn)
     if ( system_state == SYS_STATE_early_boot )
         return pmap_map(mfn);
 
+#if defined(CONFIG_ARM_64)
+    return __va((mfn_to_maddr(mfn)));
+#else
     return map_domain_page(mfn);
+#endif
 }
 
 static void xen_unmap_table(const lpae_t *table)
@@ -52,9 +56,14 @@ static void xen_unmap_table(const lpae_t *table)
      * but the PMAP.
      */
     if ( system_state == SYS_STATE_early_boot )
+    {
         pmap_unmap(table);
-    else
-        unmap_domain_page(table);
+        return;
+    }
+
+#if !defined(CONFIG_ARM_64)
+    unmap_domain_page(table);
+#endif
 }
 
 void dump_pt_walk(paddr_t ttbr, paddr_t addr,
Signature · 1 line
2.54.0
#1 lore raw
Quoted 3 lines · On 07.07.2026 00:29, mixx86 wrote:
---
 xen/arch/arm/mmu/pt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

First two formal things: There's no S-o-b of yours, and a change like this hardly can come with an empty description.

xen/arch/arm/mmu/pt.c static lpae_t *xen_map_table(mfn_t mfn) · line 50

Quoted 12 lines
xen/arch/arm/mmu/pt.c +4 -0
@@ -42,7 +42,11 @@ static lpae_t *xen_map_table(mfn_t mfn)
     if ( system_state == SYS_STATE_early_boot )
         return pmap_map(mfn);
 
+#if defined(CONFIG_ARM_64)
+    return __va((mfn_to_maddr(mfn)));
+#else
     return map_domain_page(mfn);
+#endif
 }

The abstraction exists for a reason. If anything CONFIG_ARCH_MAP_DOMAIN_PAGE would be the correct dependency here (or else the pattern, if copied elsewhere, would break the MPU=y case), yet that already is what controls whether map_domain_page() is a mapping operation in the first place.

Plus - why would only this call site benefit? Any improvement should be done in map_domain_page() itself.

Jan