From: Michal Orzel <michal.orzel@amd.com>
To: <xen-devel@lists.xenproject.org>
Cc: Michal Orzel <michal.orzel@amd.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: [PATCH 2/4] device-tree: Move domain_fdt_begin_node() to common
Date: Tue, 3 Jun 2025 12:03:27 +0200 [thread overview]
Message-ID: <20250603100329.149851-3-michal.orzel@amd.com> (raw)
In-Reply-To: <20250603100329.149851-1-michal.orzel@amd.com>
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@amd.com>
---
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
next prev parent reply other threads:[~2025-06-03 10:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 10:03 [PATCH 0/4] device-tree: Move static features to common Michal Orzel
2025-06-03 10:03 ` [PATCH 1/4] common: Drop unneeded Arm dependency for static-evtchn Michal Orzel
2025-06-03 10:55 ` Jan Beulich
2025-06-03 10:03 ` Michal Orzel [this message]
2025-06-03 13:23 ` [PATCH 2/4] device-tree: Move domain_fdt_begin_node() to common Julien Grall
2025-06-03 10:03 ` [PATCH 3/4] device-tree: Move Arm's static-memory feature " Michal Orzel
2025-06-03 13:28 ` Julien Grall
2025-06-03 14:58 ` Orzel, Michal
2025-06-03 10:03 ` [PATCH 4/4] device-tree: Move Arm's static-shmem " Michal Orzel
2025-06-03 13:29 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250603100329.149851-3-michal.orzel@amd.com \
--to=michal.orzel@amd.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.