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

mixx86 posted 1 patch 2 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260706222934.221182-1-gabi.qs.mail@gmail.com
xen/arch/arm/mmu/pt.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
[PATCH] xen/arm: mmu: avoid transient mapping of page tables when a directmap is available
Posted by mixx86 2 weeks, 2 days ago
---
 xen/arch/arm/mmu/pt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/mmu/pt.c b/xen/arch/arm/mmu/pt.c
index 621b47d..735847e 100644
--- a/xen/arch/arm/mmu/pt.c
+++ b/xen/arch/arm/mmu/pt.c
@@ -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,
-- 
2.54.0
Re: [PATCH] xen/arm: mmu: avoid transient mapping of page tables when a directmap is available
Posted by Jan Beulich 2 weeks, 2 days ago
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.

> --- a/xen/arch/arm/mmu/pt.c
> +++ b/xen/arch/arm/mmu/pt.c
> @@ -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