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

[PATCH 20/21] xen/arm: Use dedicated function for Static SHM Device Tree creation


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Date: Sun, 24 May 2026 09:02:08 +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=ZIMyeMl9qEVCA5sGzBca+pRibnJkXfuBoWxVr4f1TOY=; b=Cq1NCCG35u0VI4Q7BpRlGaSjr+eesPp2IY9LE+L8o00lVTCfvwWK3QNp0aMBnRXeXyjhRq+bxQQhF4ZDDYYANs53B+SMUi5EZYWKWK87aK6glI5l51T9bDaQpISFtlNB6Xrw7gAKNn5kis87cIZT0ULH/bWVH0HvTv6vSNvOO4DyyXFWpkDYZpUDVjAI2geURlNurJ5cbAkpscUxHzsIF9najcclg9v9IPKvbAPTAuacxqpivt5DwzV/0hKpicuY1N2WTbE9l4xd3cS8eKfirkBHX6qp7ZfQiV7d4YsGUurTsnarvhi79Y0payc9yreWdWt8ONSAZ0nLyw8xLKDmkg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fm55Sird5tDdAO1dIPvaBSKgYY5VEkXytGLmdosGj137DdK6s0u0jCTY8MMVCZUYBJAm0YwBELH8cWim/yUIM5I6PvI1klkmXXuS6azH1KF3UTpxbIMPlMLlsLKu1IuVFWf1L2FmAT9GqF71dJH4gHWa28iIkUV7buM+q5HE9lY+JEBnQW+p5CHntdh/MUFEY9HrajzI3QDKaua1TmLt2Wj9rFOooyTKytihCs/Sj+xaU0oy8kAuKXbc9vjnhO7p8fCiQKwGfSNxDu96GJ7DzW5t382l7W0z/TTXxKT88CnLyp69/C8eGcT+wFBsjYHzxGYZz++LtznEhRnYoL6BXw==
  • 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: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, michal.orzel@xxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, roger.pau@xxxxxxxxxx, sstabellini@xxxxxxxxxx, jgross@xxxxxxxx, bertrand.marquis@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, dfaggioli@xxxxxxxx, gwd@xxxxxxxxxxxxxx, Hirokazu Takahashi <taka@xxxxxxxxxxxxx>
  • Delivery-date: Sun, 24 May 2026 00:03:17 +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.
---
 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 7960dcd33a..1cd66c9911 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1805,6 +1805,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 61e2e50062..f846ca0471 100644
--- a/xen/common/device-tree/domain-build.c
+++ b/xen/common/device-tree/domain-build.c
@@ -565,6 +565,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®.