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

[PATCH 2/4] device-tree: Move domain_fdt_begin_node() to common


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Tue, 3 Jun 2025 12:03:27 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.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=tV5QO82penY1TDFtT13aO09+0kxr4wh/OT9jYuqWgqY=; b=wWF2WBeGkDlNU/uQ8uJoQYA+/W3cSnRmLKaZGvR0/5pYxSF3p6NrabV8sb6LRzsWzsrGNuFUyvrh7NFrzHktYPT2NFOV74yE9zUJqSRUnDQ+zD+puYChxrKUjWJ2Xx04G9TsotgJtFaHitLMSt1VQPulWtE/tEbvhZwwtfE1TKhLMSQkQnTsGeu+QSW3VYR15XEhhYiv/KZKDoSAaG0ZsIK1LP60HWXI/g8vWd+gMf1N5MIheWGECnsOdjKXD2qT3WeTCYR+FcCzBRahp+qLWNZL96IyUaBAOqHEO+mdi3HTkk+YRMnDCcgrkbVDoRle7SHKxmUIH0BWjhp6QZskag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kdYyGzjOpL/GOq+U9oY28gHlzxgvbgbrZOfnjnO034K+enlcBrTXPKPzA+h+MykFJ4SY9oZN+2dE+Mp4sOBPRVN86DnesnLQ7RLDmB8FssHsFlNZZGOVLVSnYgv63G8bGF+VzCFTfGr0jYgbq9ylxre2TSs7GnBb1PC6TEtz9hVTE9K4GhAtwGIuoqjQMcq7rxud1l3AdocxLl/024RqES+LE7gLiwM+nX4LVygw1yLer0KdRP9g7p+olAzPk3DFlirQMbhVLEj+LJmju/xPq0o4bbInw1c/y9gNDQQwRwewTB0m1QtjzhKNrJ+WeoIa8rEehNHpJoXHNgWPqvFqTw==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 03 Jun 2025 10:03:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This is just a wrapper around fdt_begin_node(). Move it to common and
remove asm/domain_build.h inclusion from static-shmem.c.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/domain_build.c             | 32 -------------------------
 xen/arch/arm/include/asm/domain_build.h |  1 -
 xen/arch/arm/static-shmem.c             |  1 -
 xen/common/device-tree/bootfdt.c        | 32 +++++++++++++++++++++++++
 xen/include/xen/bootfdt.h               |  1 +
 5 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b189a7cfae9f..068af31a62db 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -649,38 +649,6 @@ static int __init fdt_property_interrupts(const struct 
kernel_info *kinfo,
     return res;
 }
 
-/*
- * Wrapper to convert physical address from paddr_t to uint64_t and
- * invoke fdt_begin_node(). This is required as the physical address
- * provided as part of node name should not contain any leading
- * zeroes. Thus, one should use PRIx64 (instead of PRIpaddr) to append
- * unit (which contains the physical address) with name to generate a
- * node name.
- */
-int __init domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit)
-{
-    /*
-     * The size of the buffer to hold the longest possible string (i.e.
-     * interrupt-controller@ + a 64-bit number + \0).
-     */
-    char buf[38];
-    int ret;
-
-    /* ePAPR 3.4 */
-    ret = snprintf(buf, sizeof(buf), "%s@%"PRIx64, name, unit);
-
-    if ( ret >= sizeof(buf) )
-    {
-        printk(XENLOG_ERR
-               "Insufficient buffer. Minimum size required is %d\n",
-               (ret + 1));
-
-        return -FDT_ERR_TRUNCATED;
-    }
-
-    return fdt_begin_node(fdt, buf);
-}
-
 int __init make_memory_node(const struct kernel_info *kinfo, int addrcells,
                             int sizecells, const struct membanks *mem)
 {
diff --git a/xen/arch/arm/include/asm/domain_build.h 
b/xen/arch/arm/include/asm/domain_build.h
index 9655e9d453fb..c6fec3168cdb 100644
--- a/xen/arch/arm/include/asm/domain_build.h
+++ b/xen/arch/arm/include/asm/domain_build.h
@@ -5,7 +5,6 @@
 #include <xen/sched.h>
 
 typedef __be32 gic_interrupt_t[3];
-int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
 int make_psci_node(void *fdt);
 void evtchn_allocate(struct domain *d);
 
diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
index 32ec6d4bc69f..21fd2c3cd4fd 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/arch/arm/static-shmem.c
@@ -6,7 +6,6 @@
 #include <xen/rangeset.h>
 #include <xen/sched.h>
 
-#include <asm/domain_build.h>
 #include <asm/setup.h>
 #include <asm/static-memory.h>
 #include <asm/static-shmem.h>
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
index 529c91e603ab..aa44f5a67c34 100644
--- a/xen/common/device-tree/bootfdt.c
+++ b/xen/common/device-tree/bootfdt.c
@@ -659,6 +659,38 @@ const __init char *boot_fdt_cmdline(const void *fdt)
     return prop->data;
 }
 
+/*
+ * Wrapper to convert physical address from paddr_t to uint64_t and
+ * invoke fdt_begin_node(). This is required as the physical address
+ * provided as part of node name should not contain any leading
+ * zeroes. Thus, one should use PRIx64 (instead of PRIpaddr) to append
+ * unit (which contains the physical address) with name to generate a
+ * node name.
+ */
+int __init domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit)
+{
+    /*
+     * The size of the buffer to hold the longest possible string (i.e.
+     * interrupt-controller@ + a 64-bit number + \0).
+     */
+    char buf[38];
+    int ret;
+
+    /* ePAPR 3.4 */
+    ret = snprintf(buf, sizeof(buf), "%s@%"PRIx64, name, unit);
+
+    if ( ret >= sizeof(buf) )
+    {
+        printk(XENLOG_ERR
+               "Insufficient buffer. Minimum size required is %d\n",
+               (ret + 1));
+
+        return -FDT_ERR_TRUNCATED;
+    }
+
+    return fdt_begin_node(fdt, buf);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index 847f01955982..64db48f4fe4e 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -191,6 +191,7 @@ void populate_boot_allocator(void);
 size_t boot_fdt_info(const void *fdt, paddr_t paddr);
 
 const char *boot_fdt_cmdline(const void *fdt);
+int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
 
 static inline struct membanks *bootinfo_get_reserved_mem(void)
 {
-- 
2.25.1




 


Rackspace

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