[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] arm/mpu: Implement copy_from_paddr for MPU systems



commit 38bd76197ce655adb590478fc576a1674c3f19fe
Author:     Luca Fancellu <luca.fancellu@xxxxxxx>
AuthorDate: Wed Jan 14 14:27:29 2026 +0000
Commit:     Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Fri Jan 16 09:38:30 2026 +0100

    arm/mpu: Implement copy_from_paddr for MPU systems
    
    Implement the function copy_from_paddr variant for MPU systems, using
    the map_pages_to_xen/destroy_xen_mappings to temporarily map the memory
    range to be copied.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
    Signed-off-by: Hari Limaye <hari.limaye@xxxxxxx>
    Signed-off-by: Harry Ramsey <harry.ramsey@xxxxxxx>
    Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/mpu/setup.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/mpu/setup.c b/xen/arch/arm/mpu/setup.c
index 163573b932..ec264f54f2 100644
--- a/xen/arch/arm/mpu/setup.c
+++ b/xen/arch/arm/mpu/setup.c
@@ -91,7 +91,19 @@ void * __init early_fdt_map(paddr_t fdt_paddr)
  */
 void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
 {
-    BUG_ON("unimplemented");
+    paddr_t start_pg = round_pgdown(paddr);
+    paddr_t end_pg   = round_pgup(paddr + len);
+    unsigned long nr_mfns = (end_pg - start_pg) >> PAGE_SHIFT;
+    mfn_t mfn = maddr_to_mfn(start_pg);
+
+    if ( map_pages_to_xen(start_pg, mfn, nr_mfns, PAGE_HYPERVISOR_WC) )
+        panic("Unable to map range for copy_from_paddr\n");
+
+    memcpy(dst, maddr_to_virt(paddr), len);
+    clean_dcache_va_range(dst, len);
+
+    if ( destroy_xen_mappings(start_pg, end_pg) )
+        panic("Unable to unmap range for copy_from_paddr\n");
 }
 
 void __init remove_early_mappings(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.