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

[PATCH v3 16/22] xen/arm: Use dedicated function for Static SHM Device Tree creation


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Fri, 19 Jun 2026 16:50:04 +0900
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=valinux.co.jp; dmarc=pass action=none header.from=valinux.co.jp; dkim=pass header.d=valinux.co.jp; arc=none
  • 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=3EUdtkaW4UdmfPYk5bJ/HzEBP4a7cC3lP5IBYmpCtIg=; b=C2lq/6iwTRplQOi4X9AXCtoZK0Zts2cEMwElkKxpUi/dnLnk9ZjmW9ftpK4tO5ntNJ4GX5ySpL1dB2/sKeoN4SYWXNFfttw4DxMJ7kUuLctQusgcXx+39lOXPtA3x92BczTV74f8St5YMz5qZQtYpWQYzg1adHFBv9mnuD6BgY2+vvUUK/dPM9llWxr9LNTFLl6Uy5ID/3mG9tV49BmoPo4ilb7ChU+RKqEWEHAlu5AUJoQtbBkbc2CQUsiL1LFi0mp1JkiBIs5Zv+825F8vA2X8rUqvzjKKL4MSgxRGbL/wICgUF281D5zLi8Ql+naANnCX6f7mWy2y6tEYuCgSig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Gp8JA4+kxIF32ysJQ8pj0FBqzgfOJxHMTpPvzuhbcMH/xALe41hDFfdN3T8RjvQoSq61rFdEZkWNurhU2kB0TPFbTDCeOdw6h6Y6x5RYYKuGs6g1soraNLtyZhkOsX4Ypl9Ukzj/p3m6iOzXfSzcvFrEY1RaU4kEEq+nJ9PnelDIsDsoz4+4tR0GFg4S5yMM+oV/3uZE11gsCrJF2qFKz3GSpemIFbvttFXO7qqWR5GF3NNbWzphXDrlFCI3y4HxAjjny8HGqpHwxU57/y5mwO2Zj3jKMIjQtm1ohGy2/8zd85Q+a8FdP+g/rmgxPA2DGEATAhtE9eDOXhxTMss/XA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=valinux.co.jp header.i="@valinux.co.jp" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=valinux.co.jp;
  • Cc: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 19 Jun 2026 07:50:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Use a dedicated function to create Static SHM Device Tree nodes instead
of reusing the generic memory node function.

Since the memory banks managing Static SHM repurpose the 'type' field
for a different purpose via a union, separating this creation logic
keeps the implementation clean and significantly improves maintainability.

Signed-off-by: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
---
 xen/arch/arm/domain_build.c           |  6 ++++++
 xen/common/device-tree/domain-build.c | 21 +++++++++++++++++++++
 xen/include/xen/fdt-domain-build.h    |  2 ++
 3 files changed, 29 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 6828cfc46a..7d32249826 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1815,6 +1815,12 @@ static int __init handle_node(struct domain *d, struct 
kernel_info *kinfo,
         if ( res )
             return res;
 
+#ifdef CONFIG_STATIC_SHM
+        res = make_raw_memory_node(kinfo, addrcells, sizecells, 
kernel_info_get_shm_mem_const(kinfo));
+        if ( res )
+            return res;
+#endif /* CONFIG_STATIC_SHM */
+
         res = make_distance_map_node(d, kinfo->fdt);
         if ( res )
             return res;
diff --git a/xen/common/device-tree/domain-build.c 
b/xen/common/device-tree/domain-build.c
index c3452a4037..16924b9645 100644
--- a/xen/common/device-tree/domain-build.c
+++ b/xen/common/device-tree/domain-build.c
@@ -576,6 +576,27 @@ int __init make_memory_node(const struct kernel_info 
*kinfo, int addrcells,
     return res;
 }
 
+int __init make_raw_memory_node(const struct kernel_info *kinfo, int addrcells,
+                            int sizecells, const struct membanks *mem)
+{
+    unsigned int i;
+    int res = 0;
+
+    if ( mem->nr_banks == 0 )
+        return 0;
+
+    dt_dprintk("Create raw memory nodes\n");
+
+    for ( i = 0 ; i < mem->nr_banks; i++ )
+    {
+        res = make_memory_sibling_node(kinfo, addrcells, sizecells, 
&mem->bank[i]);
+        if ( res )
+            return res;
+    }
+
+    return res;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/fdt-domain-build.h 
b/xen/include/xen/fdt-domain-build.h
index 671486c1c8..6a809f3f86 100644
--- a/xen/include/xen/fdt-domain-build.h
+++ b/xen/include/xen/fdt-domain-build.h
@@ -31,6 +31,8 @@ int make_hypervisor_node(struct domain *d, const struct 
kernel_info *kinfo,
                          int addrcells, int sizecells);
 int make_memory_node(const struct kernel_info *kinfo, int addrcells,
                      int sizecells, const struct membanks *mem);
+int make_raw_memory_node(const struct kernel_info *kinfo, int addrcells,
+                         int sizecells, const struct membanks *mem);
 int make_timer_node(const struct kernel_info *kinfo);
 
 static inline int get_allocation_size(paddr_t size)
-- 
2.43.0




 


Rackspace

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