Skip to contentSkip to conversation

device-tree: Move static features to common

PATCH In review Michal Orzel 3 participants 10 messages Jun 3, 2025

lore
Share & tools
lore
#0 lore raw

cover device-tree: Move static features to common

Finish the work to move static features that are arch agnostic to common.

Michal Orzel (4):
common: Drop unneeded Arm dependency for static-evtchn
device-tree: Move domain_fdt_begin_node() to common
device-tree: Move Arm's static-memory feature to common
device-tree: Move Arm's static-shmem feature to common

 xen/arch/arm/Kconfig                          |  6 ----
 xen/arch/arm/Makefile                         |  2 --
 xen/arch/arm/arm32/mmu/mm.c                   |  4 +--
 xen/arch/arm/arm64/mmu/mm.c                   |  4 +--
 xen/arch/arm/dom0less-build.c                 |  4 +--
 xen/arch/arm/domain_build.c                   | 34 +-----------------
 xen/arch/arm/include/asm/domain_build.h       |  1 -
 xen/common/Kconfig                            |  8 ++++-
 xen/common/device-tree/Makefile               |  2 ++
 xen/common/device-tree/bootfdt.c              | 36 +++++++++++++++++--
 xen/common/device-tree/dom0less-build.c       | 15 ++------
 .../device-tree}/static-memory.c              |  2 +-
 .../arm => common/device-tree}/static-shmem.c |  5 ++-
 xen/include/xen/bootfdt.h                     |  1 +
 .../asm => include/xen}/static-memory.h       |  9 ++---
 .../asm => include/xen}/static-shmem.h        |  6 ++--
 16 files changed, 63 insertions(+), 76 deletions(-)
 rename xen/{arch/arm => common/device-tree}/static-memory.c (99%)
 rename xen/{arch/arm => common/device-tree}/static-shmem.c (99%)
 rename xen/{arch/arm/include/asm => include/xen}/static-memory.h (93%)
 rename xen/{arch/arm/include/asm => include/xen}/static-shmem.h (96%)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 common: Drop unneeded Arm dependency for static-evtchn

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.

---
 xen/common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/Kconfig +1 -1
index 0951d4c2f286..7ecf5a80315d 100644
@@ -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
Signature · 1 line
2.25.1
#3 lore raw

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

In reply to Michal Orzel

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

---
 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(-)
xen/arch/arm/domain_build.c +0 -32
index b189a7cfae9f..068af31a62db 100644
@@ -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)
 {
xen/arch/arm/include/asm/domain_build.h +0 -1
index 9655e9d453fb..c6fec3168cdb 100644
@@ -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);
 
xen/arch/arm/static-shmem.c +0 -1
index 32ec6d4bc69f..21fd2c3cd4fd 100644
@@ -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>
xen/common/device-tree/bootfdt.c +32 -0
index 529c91e603ab..aa44f5a67c34 100644
@@ -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
xen/include/xen/bootfdt.h +1 -0
index 847f01955982..64db48f4fe4e 100644
@@ -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)
 {
Signature · 1 line
2.25.1
#5 lore raw

PATCH 3/4 device-tree: Move Arm's static-memory feature to common

In reply to Michal Orzel

This feature is arch agnostic, thus move it to common.

---
 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%)
xen/arch/arm/Makefile +0 -1
index eeeac4e653ec..4f080145478d 100644
@@ -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
xen/arch/arm/arm32/mmu/mm.c +1 -1
index 956693232a1b..f3305e28e9df 100644
@@ -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;
xen/arch/arm/arm64/mmu/mm.c +1 -1
index c1efa1348aee..cded8f2787f9 100644
@@ -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 */
xen/arch/arm/dom0less-build.c +1 -1
index a49764f0add9..bcfd686a8b7f 100644
@@ -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
xen/arch/arm/static-shmem.c +1 -1
index 21fd2c3cd4fd..2055b7be0f3f 100644
@@ -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 {
xen/common/device-tree/Makefile +1 -0
index 57b9e6ca008f..ed11f2c3b42c 100644
@@ -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
xen/common/device-tree/dom0less-build.c +1 -5
index 39cb2cd5c70e..c8c5a04f24cb 100644
@@ -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);
xen/common/device-tree/static-memory.c renamed from xen/arch/arm/static-memory.c +1 -1
similarity index 99%
rename from xen/arch/arm/static-memory.c
rename to xen/common/device-tree/static-memory.c
index e0f76afcd8eb..0774d0680604 100644
@@ -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,
xen/include/xen/static-memory.h renamed from xen/arch/arm/include/asm/static-memory.h +5 -4
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
@@ -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:
Signature · 1 line
2.25.1
Acked-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] device-tree: Move Arm's static-memory feature to common

Hi Michal,

Quoted 3 lines · Michal Orzel

This feature is arch agnostic, thus move it to common.

With one remark below:

[...]

Quoted 11 lines
xen/include/xen/static-memory.h renamed from xen/arch/arm/include/asm/static-memory.h +0 -1
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
@@ -1,13 +1,14 @@
  /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_STATIC_MEMORY_H_

xen/include/xen/static-memory.h line 10

Quoted 10 lines
xen/include/xen/static-memory.h renamed from xen/arch/arm/include/asm/static-memory.h +3 -2
-#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.

xen/include/xen/static-memory.h static inline void init_staticmem_pages(void) {}; · line 53

Quoted 13 lines
xen/include/xen/static-memory.h renamed from xen/arch/arm/include/asm/static-memory.h +2 -1
+
  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,

Signature · 1 line
Julien Grall
#7 lore raw

Re: [PATCH 3/4] device-tree: Move Arm's static-memory feature to common

Quoted 31 lines · Julien Grall

Hi Michal,

Quoted 3 lines · Michal Orzel

This feature is arch agnostic, thus move it to common.

With one remark below:

[...]

Quoted 18 lines
xen/include/xen/static-memory.h renamed from xen/arch/arm/include/asm/static-memory.h +2 -3
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
@@ -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>
 
Quoted 8 lines

xen/include/xen/static-memory.h line 10

Quoted 3 lines
xen/include/xen/static-memory.h renamed from xen/arch/arm/include/asm/static-memory.h +1 -0
  #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

#8 lore raw

PATCH 4/4 device-tree: Move Arm's static-shmem feature to common

In reply to Michal Orzel

This feature is arch agnostic, thus move it to common.

---
 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%)
xen/arch/arm/Kconfig +0 -6
index 57919d8b3ac8..3f25da3ca5fd 100644
@@ -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
xen/arch/arm/Makefile +0 -1
index 4f080145478d..ab0a0c2be6d8 100644
@@ -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
xen/arch/arm/arm32/mmu/mm.c +1 -1
index f3305e28e9df..4d22f35618aa 100644
@@ -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);
xen/arch/arm/arm64/mmu/mm.c +1 -1
index cded8f2787f9..a0a2dd8cc762 100644
@@ -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
xen/arch/arm/dom0less-build.c +1 -1
index bcfd686a8b7f..20aabf6be5c7 100644
@@ -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)
xen/arch/arm/domain_build.c +1 -1
index 068af31a62db..590f38e52053 100644
@@ -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>
xen/common/Kconfig +6 -0
index 7ecf5a80315d..eece1370a3cc 100644
@@ -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
xen/common/device-tree/Makefile +1 -0
index ed11f2c3b42c..13127296cb50 100644
@@ -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
xen/common/device-tree/bootfdt.c +1 -3
index aa44f5a67c34..9df80291b159 100644
@@ -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)
 {
xen/common/device-tree/dom0less-build.c +1 -8
index c8c5a04f24cb..3d503c697337 100644
@@ -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 )
xen/common/device-tree/static-shmem.c renamed from xen/arch/arm/static-shmem.c +1 -1
similarity index 99%
rename from xen/arch/arm/static-shmem.c
rename to xen/common/device-tree/static-shmem.c
index 2055b7be0f3f..8023c0a484c1 100644
@@ -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;
xen/include/xen/static-shmem.h renamed from xen/arch/arm/include/asm/static-shmem.h +3 -3
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
@@ -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:
Signature · 1 line
2.25.1