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

Signed-off-by: Michal Orzel <michal.or...@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


Reply via email to