* [PATCH 1/4] common: Drop unneeded Arm dependency for static-evtchn
2025-06-03 10:03 [PATCH 0/4] device-tree: Move static features to common Michal Orzel
@ 2025-06-03 10:03 ` Michal Orzel
2025-06-03 10:55 ` Jan Beulich
2025-06-03 10:03 ` [PATCH 2/4] device-tree: Move domain_fdt_begin_node() to common Michal Orzel
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Michal Orzel @ 2025-06-03 10:03 UTC (permalink / raw)
To: xen-devel
Cc: Michal Orzel, Andrew Cooper, Anthony PERARD, Jan Beulich,
Julien Grall, Roger Pau Monné, Stefano Stabellini
DOM0LESS_BOOT is sufficient (only Arm selects it today). If needed,
proper arch dependency can be introduced while adding support for it for
another architecture.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
xen/common/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 0951d4c2f286..7ecf5a80315d 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -164,7 +164,7 @@ config STATIC_MEMORY
config STATIC_EVTCHN
bool "Static event channel support on a dom0less system"
- depends on DOM0LESS_BOOT && ARM
+ depends on DOM0LESS_BOOT
default y
help
This option enables establishing static event channel communication
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 2/4] device-tree: Move domain_fdt_begin_node() to common
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:03 ` Michal Orzel
2025-06-03 13:23 ` Julien Grall
2025-06-03 10:03 ` [PATCH 3/4] device-tree: Move Arm's static-memory feature " Michal Orzel
2025-06-03 10:03 ` [PATCH 4/4] device-tree: Move Arm's static-shmem " Michal Orzel
3 siblings, 1 reply; 10+ messages in thread
From: Michal Orzel @ 2025-06-03 10:03 UTC (permalink / raw)
To: xen-devel
Cc: Michal Orzel, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk
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
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/4] device-tree: Move Arm's static-memory feature to common
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:03 ` [PATCH 2/4] device-tree: Move domain_fdt_begin_node() to common Michal Orzel
@ 2025-06-03 10:03 ` Michal Orzel
2025-06-03 13:28 ` Julien Grall
2025-06-03 10:03 ` [PATCH 4/4] device-tree: Move Arm's static-shmem " Michal Orzel
3 siblings, 1 reply; 10+ messages in thread
From: Michal Orzel @ 2025-06-03 10:03 UTC (permalink / raw)
To: xen-devel
Cc: Michal Orzel, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD, Jan Beulich,
Roger Pau Monné
This feature is arch agnostic, thus move it to common.
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
xen/arch/arm/Makefile | 1 -
xen/arch/arm/arm32/mmu/mm.c | 2 +-
xen/arch/arm/arm64/mmu/mm.c | 2 +-
xen/arch/arm/dom0less-build.c | 2 +-
xen/arch/arm/static-shmem.c | 2 +-
xen/common/device-tree/Makefile | 1 +
xen/common/device-tree/dom0less-build.c | 6 +-----
xen/{arch/arm => common/device-tree}/static-memory.c | 2 +-
.../arm/include/asm => include/xen}/static-memory.h | 9 +++++----
9 files changed, 12 insertions(+), 15 deletions(-)
rename xen/{arch/arm => common/device-tree}/static-memory.c (99%)
rename xen/{arch/arm/include/asm => include/xen}/static-memory.h (93%)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index eeeac4e653ec..4f080145478d 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -51,7 +51,6 @@ obj-y += setup.o
obj-y += shutdown.o
obj-y += smp.o
obj-y += smpboot.o
-obj-$(CONFIG_STATIC_MEMORY) += static-memory.init.o
obj-$(CONFIG_STATIC_SHM) += static-shmem.init.o
obj-y += sysctl.o
obj-y += time.o
diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index 956693232a1b..f3305e28e9df 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -6,9 +6,9 @@
#include <xen/mm.h>
#include <xen/param.h>
#include <xen/pfn.h>
+#include <xen/static-memory.h>
#include <asm/fixmap.h>
#include <asm/setup.h>
-#include <asm/static-memory.h>
#include <asm/static-shmem.h>
static unsigned long opt_xenheap_megabytes __initdata;
diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index c1efa1348aee..cded8f2787f9 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -4,9 +4,9 @@
#include <xen/llc-coloring.h>
#include <xen/mm.h>
#include <xen/pfn.h>
+#include <xen/static-memory.h>
#include <asm/setup.h>
-#include <asm/static-memory.h>
#include <asm/static-shmem.h>
/* Override macros from asm/page.h to make them work with mfn_t */
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index a49764f0add9..bcfd686a8b7f 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -12,6 +12,7 @@
#include <xen/sched.h>
#include <xen/serial.h>
#include <xen/sizes.h>
+#include <xen/static-memory.h>
#include <xen/vmap.h>
#include <public/bootfdt.h>
@@ -22,7 +23,6 @@
#include <asm/domain_build.h>
#include <asm/grant_table.h>
#include <asm/setup.h>
-#include <asm/static-memory.h>
#include <asm/static-shmem.h>
#ifdef CONFIG_VGICV2
diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
index 21fd2c3cd4fd..2055b7be0f3f 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/arch/arm/static-shmem.c
@@ -5,9 +5,9 @@
#include <xen/libfdt/libfdt.h>
#include <xen/rangeset.h>
#include <xen/sched.h>
+#include <xen/static-memory.h>
#include <asm/setup.h>
-#include <asm/static-memory.h>
#include <asm/static-shmem.h>
typedef struct {
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index 57b9e6ca008f..ed11f2c3b42c 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_OVERLAY_DTB) += dt-overlay.o
obj-y += intc.o
obj-$(CONFIG_DOMAIN_BUILD_HELPERS) += kernel.o
obj-$(CONFIG_STATIC_EVTCHN) += static-evtchn.init.o
+obj-$(CONFIG_STATIC_MEMORY) += static-memory.init.o
diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index 39cb2cd5c70e..c8c5a04f24cb 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -28,9 +28,7 @@
#include <asm/dom0less-build.h>
#include <asm/setup.h>
-#if __has_include(<asm/static-memory.h>)
-# include <asm/static-memory.h>
-#endif
+#include <xen/static-memory.h>
#if __has_include(<asm/static-shmem.h>)
# include <asm/static-shmem.h>
@@ -799,12 +797,10 @@ static int __init construct_domU(struct domain *d,
{
if ( !dt_find_property(node, "xen,static-mem", NULL) )
allocate_memory(d, &kinfo);
-#ifdef CONFIG_STATIC_MEMORY
else if ( !is_domain_direct_mapped(d) )
allocate_static_memory(d, &kinfo, node);
else
assign_static_memory_11(d, &kinfo, node);
-#endif
#ifdef CONFIG_STATIC_SHM
rc = process_shm(d, &kinfo, node);
diff --git a/xen/arch/arm/static-memory.c b/xen/common/device-tree/static-memory.c
similarity index 99%
rename from xen/arch/arm/static-memory.c
rename to xen/common/device-tree/static-memory.c
index e0f76afcd8eb..0774d0680604 100644
--- a/xen/arch/arm/static-memory.c
+++ b/xen/common/device-tree/static-memory.c
@@ -1,9 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <xen/sched.h>
+#include <xen/static-memory.h>
#include <asm/setup.h>
-#include <asm/static-memory.h>
static bool __init append_static_memory_to_bank(struct domain *d,
struct membank *bank,
diff --git a/xen/arch/arm/include/asm/static-memory.h b/xen/include/xen/static-memory.h
similarity index 93%
rename from xen/arch/arm/include/asm/static-memory.h
rename to xen/include/xen/static-memory.h
index a32a3c6553bc..e445aa80578c 100644
--- a/xen/arch/arm/include/asm/static-memory.h
+++ b/xen/include/xen/static-memory.h
@@ -1,13 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_STATIC_MEMORY_H_
-#define __ASM_STATIC_MEMORY_H_
+#ifndef XEN_STATIC_MEMORY_H
+#define XEN_STATIC_MEMORY_H
#include <xen/fdt-kernel.h>
-#include <xen/pfn.h>
#ifdef CONFIG_STATIC_MEMORY
+#include <xen/pfn.h>
+
static inline void init_staticmem_bank(const struct membank *bank)
{
mfn_t bank_start = _mfn(PFN_UP(bank->start));
@@ -46,7 +47,7 @@ static inline void init_staticmem_pages(void) {};
#endif /* CONFIG_STATIC_MEMORY */
-#endif /* __ASM_STATIC_MEMORY_H_ */
+#endif /* XEN_STATIC_MEMORY_H */
/*
* Local variables:
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 3/4] device-tree: Move Arm's static-memory feature to common
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
0 siblings, 1 reply; 10+ messages in thread
From: Julien Grall @ 2025-06-03 13:28 UTC (permalink / raw)
To: Michal Orzel, xen-devel
Cc: Stefano Stabellini, Bertrand Marquis, Volodymyr Babchuk,
Andrew Cooper, Anthony PERARD, Jan Beulich, Roger Pau Monné
Hi Michal,
On 03/06/2025 11:03, Michal Orzel wrote:
> This feature is arch agnostic, thus move it to common.
>
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
With one remark below:
Acked-by: Julien Grall <jgrall@amazon.com>
[...]
> diff --git a/xen/arch/arm/include/asm/static-memory.h b/xen/include/xen/static-memory.h
> similarity index 93%
> rename from xen/arch/arm/include/asm/static-memory.h
> rename to xen/include/xen/static-memory.h
> index a32a3c6553bc..e445aa80578c 100644
> --- a/xen/arch/arm/include/asm/static-memory.h
> +++ b/xen/include/xen/static-memory.h
> @@ -1,13 +1,14 @@
> /* SPDX-License-Identifier: GPL-2.0-only */
>
> -#ifndef __ASM_STATIC_MEMORY_H_
> -#define __ASM_STATIC_MEMORY_H_
> +#ifndef XEN_STATIC_MEMORY_H
> +#define XEN_STATIC_MEMORY_H
>
> #include <xen/fdt-kernel.h>
> -#include <xen/pfn.h>
>
> #ifdef CONFIG_STATIC_MEMORY
>
> +#include <xen/pfn.h>
This change looks a bit odd in the context of the patch. I guess this is
moved because the include should not be used if !CONFIG_STATIC_MEMORY? I
am fine if you want to keep it here. But it would be worth mentioning in
the commit message.
> +
> static inline void init_staticmem_bank(const struct membank *bank)
> {
> mfn_t bank_start = _mfn(PFN_UP(bank->start));
> @@ -46,7 +47,7 @@ static inline void init_staticmem_pages(void) {};
>
> #endif /* CONFIG_STATIC_MEMORY */
>
> -#endif /* __ASM_STATIC_MEMORY_H_ */
> +#endif /* XEN_STATIC_MEMORY_H */
>
> /*
> * Local variables:
Cheers,
--
Julien Grall
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 3/4] device-tree: Move Arm's static-memory feature to common
2025-06-03 13:28 ` Julien Grall
@ 2025-06-03 14:58 ` Orzel, Michal
0 siblings, 0 replies; 10+ messages in thread
From: Orzel, Michal @ 2025-06-03 14:58 UTC (permalink / raw)
To: Julien Grall, xen-devel
Cc: Stefano Stabellini, Bertrand Marquis, Volodymyr Babchuk,
Andrew Cooper, Anthony PERARD, Jan Beulich, Roger Pau Monné
On 03/06/2025 15:28, Julien Grall wrote:
> Hi Michal,
>
> On 03/06/2025 11:03, Michal Orzel wrote:
>> This feature is arch agnostic, thus move it to common.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
>
> With one remark below:
>
> Acked-by: Julien Grall <jgrall@amazon.com>
>
> [...]
>
>> diff --git a/xen/arch/arm/include/asm/static-memory.h b/xen/include/xen/static-memory.h
>> similarity index 93%
>> rename from xen/arch/arm/include/asm/static-memory.h
>> rename to xen/include/xen/static-memory.h
>> index a32a3c6553bc..e445aa80578c 100644
>> --- a/xen/arch/arm/include/asm/static-memory.h
>> +++ b/xen/include/xen/static-memory.h
>> @@ -1,13 +1,14 @@
>> /* SPDX-License-Identifier: GPL-2.0-only */
>>
>> -#ifndef __ASM_STATIC_MEMORY_H_
>> -#define __ASM_STATIC_MEMORY_H_
>> +#ifndef XEN_STATIC_MEMORY_H
>> +#define XEN_STATIC_MEMORY_H
>>
>> #include <xen/fdt-kernel.h>
>> -#include <xen/pfn.h>
>>
>> #ifdef CONFIG_STATIC_MEMORY
>>
>> +#include <xen/pfn.h>
>
> This change looks a bit odd in the context of the patch. I guess this is
> moved because the include should not be used if !CONFIG_STATIC_MEMORY? I
> am fine if you want to keep it here. But it would be worth mentioning in
> the commit message.
Yes, I did want to mention this change but clearly forgot. Will add (on commit).
~Michal
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] device-tree: Move Arm's static-shmem feature to common
2025-06-03 10:03 [PATCH 0/4] device-tree: Move static features to common Michal Orzel
` (2 preceding siblings ...)
2025-06-03 10:03 ` [PATCH 3/4] device-tree: Move Arm's static-memory feature " Michal Orzel
@ 2025-06-03 10:03 ` Michal Orzel
2025-06-03 13:29 ` Julien Grall
3 siblings, 1 reply; 10+ messages in thread
From: Michal Orzel @ 2025-06-03 10:03 UTC (permalink / raw)
To: xen-devel
Cc: Michal Orzel, Stefano Stabellini, Julien Grall, Bertrand Marquis,
Volodymyr Babchuk, Andrew Cooper, Anthony PERARD, Jan Beulich,
Roger Pau Monné
This feature is arch agnostic, thus move it to common.
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
xen/arch/arm/Kconfig | 6 ------
xen/arch/arm/Makefile | 1 -
xen/arch/arm/arm32/mmu/mm.c | 2 +-
xen/arch/arm/arm64/mmu/mm.c | 2 +-
xen/arch/arm/dom0less-build.c | 2 +-
xen/arch/arm/domain_build.c | 2 +-
xen/common/Kconfig | 6 ++++++
xen/common/device-tree/Makefile | 1 +
xen/common/device-tree/bootfdt.c | 4 +---
xen/common/device-tree/dom0less-build.c | 9 +--------
xen/{arch/arm => common/device-tree}/static-shmem.c | 2 +-
xen/{arch/arm/include/asm => include/xen}/static-shmem.h | 6 +++---
12 files changed, 17 insertions(+), 26 deletions(-)
rename xen/{arch/arm => common/device-tree}/static-shmem.c (99%)
rename xen/{arch/arm/include/asm => include/xen}/static-shmem.h (96%)
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 57919d8b3ac8..3f25da3ca5fd 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -247,12 +247,6 @@ config ARM64_BTI
source "arch/arm/tee/Kconfig"
-config STATIC_SHM
- bool "Statically shared memory on a dom0less system" if UNSUPPORTED
- depends on STATIC_MEMORY
- help
- This option enables statically shared memory on a dom0less system.
-
config PARTIAL_EMULATION
bool "Enable partial emulation of system/coprocessor registers"
default y
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 4f080145478d..ab0a0c2be6d8 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -51,7 +51,6 @@ obj-y += setup.o
obj-y += shutdown.o
obj-y += smp.o
obj-y += smpboot.o
-obj-$(CONFIG_STATIC_SHM) += static-shmem.init.o
obj-y += sysctl.o
obj-y += time.o
obj-y += traps.o
diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index f3305e28e9df..4d22f35618aa 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -7,9 +7,9 @@
#include <xen/param.h>
#include <xen/pfn.h>
#include <xen/static-memory.h>
+#include <xen/static-shmem.h>
#include <asm/fixmap.h>
#include <asm/setup.h>
-#include <asm/static-shmem.h>
static unsigned long opt_xenheap_megabytes __initdata;
integer_param("xenheap_megabytes", opt_xenheap_megabytes);
diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index cded8f2787f9..a0a2dd8cc762 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -5,9 +5,9 @@
#include <xen/mm.h>
#include <xen/pfn.h>
#include <xen/static-memory.h>
+#include <xen/static-shmem.h>
#include <asm/setup.h>
-#include <asm/static-shmem.h>
/* Override macros from asm/page.h to make them work with mfn_t */
#undef virt_to_mfn
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index bcfd686a8b7f..20aabf6be5c7 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -13,6 +13,7 @@
#include <xen/serial.h>
#include <xen/sizes.h>
#include <xen/static-memory.h>
+#include <xen/static-shmem.h>
#include <xen/vmap.h>
#include <public/bootfdt.h>
@@ -23,7 +24,6 @@
#include <asm/domain_build.h>
#include <asm/grant_table.h>
#include <asm/setup.h>
-#include <asm/static-shmem.h>
#ifdef CONFIG_VGICV2
static int __init make_gicv2_domU_node(struct kernel_info *kinfo)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 068af31a62db..590f38e52053 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -21,6 +21,7 @@
#include <xen/acpi.h>
#include <xen/vmap.h>
#include <xen/warning.h>
+#include <xen/static-shmem.h>
#include <asm/device.h>
#include <asm/setup.h>
#include <asm/tee/tee.h>
@@ -32,7 +33,6 @@
#include <asm/cpufeature.h>
#include <asm/dom0less-build.h>
#include <asm/domain_build.h>
-#include <asm/static-shmem.h>
#include <xen/event.h>
#include <xen/irq.h>
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 7ecf5a80315d..eece1370a3cc 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -162,6 +162,12 @@ config STATIC_MEMORY
If unsure, say N.
+config STATIC_SHM
+ bool "Statically shared memory on a dom0less system" if UNSUPPORTED
+ depends on STATIC_MEMORY
+ help
+ This option enables statically shared memory on a dom0less system.
+
config STATIC_EVTCHN
bool "Static event channel support on a dom0less system"
depends on DOM0LESS_BOOT
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index ed11f2c3b42c..13127296cb50 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -8,3 +8,4 @@ obj-y += intc.o
obj-$(CONFIG_DOMAIN_BUILD_HELPERS) += kernel.o
obj-$(CONFIG_STATIC_EVTCHN) += static-evtchn.init.o
obj-$(CONFIG_STATIC_MEMORY) += static-memory.init.o
+obj-$(CONFIG_STATIC_SHM) += static-shmem.init.o
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
index aa44f5a67c34..9df80291b159 100644
--- a/xen/common/device-tree/bootfdt.c
+++ b/xen/common/device-tree/bootfdt.c
@@ -13,11 +13,9 @@
#include <xen/lib.h>
#include <xen/libfdt/libfdt-xen.h>
#include <xen/sort.h>
+#include <xen/static-shmem.h>
#include <xsm/xsm.h>
#include <asm/setup.h>
-#ifdef CONFIG_STATIC_SHM
-#include <asm/static-shmem.h>
-#endif
static void __init __maybe_unused build_assertions(void)
{
diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index c8c5a04f24cb..3d503c697337 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -29,10 +29,7 @@
#include <asm/setup.h>
#include <xen/static-memory.h>
-
-#if __has_include(<asm/static-shmem.h>)
-# include <asm/static-shmem.h>
-#endif
+#include <xen/static-shmem.h>
#define XENSTORE_PFN_LATE_ALLOC UINT64_MAX
@@ -505,11 +502,9 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo)
if ( ret )
goto err;
-#ifdef CONFIG_STATIC_SHM
ret = make_resv_memory_node(kinfo, addrcells, sizecells);
if ( ret )
goto err;
-#endif
/*
* domain_handle_dtb_bootmodule has to be called before the rest of
@@ -802,11 +797,9 @@ static int __init construct_domU(struct domain *d,
else
assign_static_memory_11(d, &kinfo, node);
-#ifdef CONFIG_STATIC_SHM
rc = process_shm(d, &kinfo, node);
if ( rc < 0 )
return rc;
-#endif
rc = init_vuart(d, &kinfo, node);
if ( rc < 0 )
diff --git a/xen/arch/arm/static-shmem.c b/xen/common/device-tree/static-shmem.c
similarity index 99%
rename from xen/arch/arm/static-shmem.c
rename to xen/common/device-tree/static-shmem.c
index 2055b7be0f3f..8023c0a484c1 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/common/device-tree/static-shmem.c
@@ -6,9 +6,9 @@
#include <xen/rangeset.h>
#include <xen/sched.h>
#include <xen/static-memory.h>
+#include <xen/static-shmem.h>
#include <asm/setup.h>
-#include <asm/static-shmem.h>
typedef struct {
struct domain *d;
diff --git a/xen/arch/arm/include/asm/static-shmem.h b/xen/include/xen/static-shmem.h
similarity index 96%
rename from xen/arch/arm/include/asm/static-shmem.h
rename to xen/include/xen/static-shmem.h
index 6a4c33cca8c2..76a49869126c 100644
--- a/xen/arch/arm/include/asm/static-shmem.h
+++ b/xen/include/xen/static-shmem.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_STATIC_SHMEM_H_
-#define __ASM_STATIC_SHMEM_H_
+#ifndef XEN_STATIC_SHMEM_H
+#define XEN_STATIC_SHMEM_H
#include <xen/fdt-kernel.h>
#include <xen/types.h>
@@ -82,7 +82,7 @@ static inline void shm_mem_node_fill_reg_range(const struct kernel_info *kinfo,
#endif /* CONFIG_STATIC_SHM */
-#endif /* __ASM_STATIC_SHMEM_H_ */
+#endif /* XEN_STATIC_SHMEM_H */
/*
* Local variables:
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 4/4] device-tree: Move Arm's static-shmem feature to common
2025-06-03 10:03 ` [PATCH 4/4] device-tree: Move Arm's static-shmem " Michal Orzel
@ 2025-06-03 13:29 ` Julien Grall
0 siblings, 0 replies; 10+ messages in thread
From: Julien Grall @ 2025-06-03 13:29 UTC (permalink / raw)
To: Michal Orzel, xen-devel
Cc: Stefano Stabellini, Bertrand Marquis, Volodymyr Babchuk,
Andrew Cooper, Anthony PERARD, Jan Beulich, Roger Pau Monné
Hi Michal,
On 03/06/2025 11:03, Michal Orzel wrote:
> This feature is arch agnostic, thus move it to common.
>
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Cheers,
--
Julien Grall
^ permalink raw reply [flat|nested] 10+ messages in thread