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

[PATCH] xen: Add support to passthrough reserved memory carveouts to DomU


  • To: <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, <bertrand.marquis@xxxxxxx>, <michal.orzel@xxxxxxx>
  • From: Beleswar Padhi <b-padhi@xxxxxx>
  • Date: Tue, 15 Sep 2026 13:58:24 +0530
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.194) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nP2oa/Upr36nO3JVb2wzWNMKED0TaUB8y8sRyK+QJcU=; b=bfR0EZsVksRYaADy2uJFabYnBSL5DuTvVNNFSYQXchyiIPKtO3iPHVDX86h0Ld9w+ZPJPAxyU/fdDuzxrw8AYAEuefIZ5+Ecbm6en4JZTLLT7mqvpZeFyhPIhjB8LWFrqgwLE/AsFA+ZfhdM3D5j6+BdfiQ1PxIHoXbQHFIv+cAhCk8qgrEcYkZvqJvONCb8j01FqjMA+n6C6RCRqk/QrVLzQJG5gpQEgNhyWijikjzAcyPCwx2+RgID+65cG+ue0B5tbGdV4BdZ+cyC2LKIx9/lt9Cb7SIAfFm5DXQYCQo/edkjGUDJESm0W0NeGvV9XWZyEiCjcA5RjtgI/1QBoQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NxnRDGjQnPaOD0zDNezjctQSoESmei0R2TQRdkkDLgcDRKZWlUl/vrzdPER5l05aCPjFUfsgcWUxP15LXHKfnzup/+CQFh5qspynzZ6Oeds3JniZtF0SYMQPK/4fG9hFh+yKjUiWZ28qIgfvYXMwjFpjGrNFctJkkVLi/8ba96CejLVhm4UwHtKY3EUpcs2mPkEstUzAfZ0X0lP6lQUy0UiLVbkKcvu5nW+h6R8ZlOSP7sfVdXAf8tHO/35dgdMcz6f0YlH1PIEZdtdN3E4FjKt52w43cpyvkIYEKwYf7Qz3WuMeW4Y2zJcs7AiBg5WxkrOu30wpS5q07hv9EEdidA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=proofpoint-05-2026 header.d=ti.com header.i="@ti.com" header.h="CC:Content-Transfer-Encoding:Content-Type:Date:From:Message-ID:MIME-Version:Subject:To"; dkim=pass header.s=selector1 header.d=ti.com header.i="@ti.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: <u-kumar1@xxxxxx>, <detheridge@xxxxxx>, <jbergsagel@xxxxxx>, <b-padhi@xxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 15 Sep 2026 08:29:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Currently Xen only looks for /passthrough and /aliases nodes. Add
support to parse the /reserved-memory node and pass it through as
requested to DomUs. This is useful to enable many usecases in DomUs
like Remoteproc firmware carveouts, CMA carveouts etc.

If Xen's static shared memory carveout is found, it is placed as child
nodes under the top level /reserved-memory node as also done in commit
51a2b3f10918 ("xen/arm: fix duplicate /reserved-memory node in Dom0").

Signed-off-by: Beleswar Padhi <b-padhi@xxxxxx>
---
Hello all,

Sending this patch as discussed in:
https://lore.kernel.org/all/0e556bb5-269d-47d7-9ae8-68f06eee9fc0@xxxxxx/

Test Configurations & Logs:
https://gist.github.com/3V3RYONE/bef3bb51459f8b823605261b35494a7e

Thanks,
Beleswar

 xen/common/device-tree/dom0less-build.c | 45 +++++++++++++++++++------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/xen/common/device-tree/dom0less-build.c 
b/xen/common/device-tree/dom0less-build.c
index fcbeb8adbd..e9581327ee 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -334,7 +334,7 @@ static int __init handle_prop_pfdt(struct kernel_info 
*kinfo,
 static int __init scan_pfdt_node(struct kernel_info *kinfo, const void *pfdt,
                                  int nodeoff,
                                  uint32_t address_cells, uint32_t size_cells,
-                                 bool scan_passthrough_prop)
+                                 bool scan_passthrough_prop, bool 
resv_mem_node)
 {
     int rc = 0;
     void *fdt = kinfo->fdt;
@@ -358,13 +358,20 @@ static int __init scan_pfdt_node(struct kernel_info 
*kinfo, const void *pfdt,
     while ( node_next > 0 )
     {
         rc = scan_pfdt_node(kinfo, pfdt, node_next, address_cells, size_cells,
-                            scan_passthrough_prop);
+                            scan_passthrough_prop, false);
         if ( rc )
             return rc;
 
         node_next = fdt_next_subnode(pfdt, node_next);
     }
 
+    if ( resv_mem_node )
+    {
+        rc = make_shm_resv_memory_node(kinfo, address_cells, size_cells);
+        if ( rc )
+            return rc;
+    }
+
     return fdt_end_node(fdt);
 }
 
@@ -389,7 +396,8 @@ static int __init check_partial_fdt(void *pfdt, size_t size)
 }
 
 static int __init domain_handle_dtb_boot_module(struct domain *d,
-                                                struct kernel_info *kinfo)
+                                                struct kernel_info *kinfo,
+                                                bool *found_reserved_mem_node)
 {
     void *pfdt;
     int res, node_next;
@@ -430,8 +438,8 @@ static int __init domain_handle_dtb_boot_module(struct 
domain *d,
             continue;
 
         /*
-         * Only scan /$(interrupt_controller) /aliases /passthrough,
-         * ignore the rest.
+         * Only scan /$(interrupt_controller) /aliases /passthrough
+         * /reserved-memory, ignore the rest.
          * They don't have to be parsed in order.
          *
          * Take the interrupt controller phandle value from the special
@@ -445,7 +453,7 @@ static int __init domain_handle_dtb_boot_module(struct 
domain *d,
             res = scan_pfdt_node(kinfo, pfdt, node_next,
                                  DT_ROOT_NODE_ADDR_CELLS_DEFAULT,
                                  DT_ROOT_NODE_SIZE_CELLS_DEFAULT,
-                                 false);
+                                 false, false);
             if ( res )
                 goto out;
             continue;
@@ -455,11 +463,22 @@ static int __init domain_handle_dtb_boot_module(struct 
domain *d,
             res = scan_pfdt_node(kinfo, pfdt, node_next,
                                  DT_ROOT_NODE_ADDR_CELLS_DEFAULT,
                                  DT_ROOT_NODE_SIZE_CELLS_DEFAULT,
-                                 true);
+                                 true, false);
             if ( res )
                 goto out;
             continue;
         }
+        if ( dt_node_cmp(name, "reserved-memory") == 0 )
+        {
+            res = scan_pfdt_node(kinfo, pfdt, node_next,
+                                 DT_ROOT_NODE_ADDR_CELLS_DEFAULT,
+                                 DT_ROOT_NODE_SIZE_CELLS_DEFAULT,
+                                 false, true);
+            if ( res )
+                goto out;
+            *found_reserved_mem_node = true;
+            continue;
+        }
     }
 
  out:
@@ -486,6 +505,7 @@ static int __init prepare_dtb_domU(struct domain *d, struct 
kernel_info *kinfo)
 {
     int addrcells, sizecells;
     int ret, fdt_size = DOMU_DTB_SIZE;
+    bool found_reserved_mem_node = false;
 
     BUILD_BUG_ON(DOMU_DTB_SIZE > SZ_2M);
 
@@ -538,7 +558,7 @@ static int __init prepare_dtb_domU(struct domain *d, struct 
kernel_info *kinfo)
      */
     if ( kinfo->dtb )
     {
-        ret = domain_handle_dtb_boot_module(d, kinfo);
+        ret = domain_handle_dtb_boot_module(d, kinfo, 
&found_reserved_mem_node);
         if ( ret )
             goto err;
     }
@@ -556,9 +576,12 @@ static int __init prepare_dtb_domU(struct domain *d, 
struct kernel_info *kinfo)
     if ( ret )
         goto err;
 
-    ret = make_resv_memory_node(kinfo, addrcells, sizecells);
-    if ( ret )
-        goto err;
+    if ( !found_reserved_mem_node )
+    {
+        ret = make_resv_memory_node(kinfo, addrcells, sizecells);
+        if ( ret )
+            goto err;
+    }
 
     ret = make_intc_domU_node(kinfo);
     if ( ret )
-- 
2.34.1




 


Rackspace

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