Skip to contentSkip to conversation

device-tree: Move Arm's static-evtchn feature to common

PATCH In review Michal Orzel 3 participants 8 messages May 27, 2025 – Jun 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device-tree: Move Arm's static-evtchn feature to common

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

---
Other candidates: static memory, shared memory

---
 xen/arch/arm/Kconfig                                      | 8 --------
 xen/arch/arm/Makefile                                     | 1 -
 xen/arch/arm/setup.c                                      | 2 +-
 xen/common/Kconfig                                        | 8 ++++++++
 xen/common/device-tree/Makefile                           | 1 +
 xen/{arch/arm => common/device-tree}/static-evtchn.c      | 3 +--
 xen/{arch/arm/include/asm => include/xen}/static-evtchn.h | 6 +++---
 7 files changed, 14 insertions(+), 15 deletions(-)
 rename xen/{arch/arm => common/device-tree}/static-evtchn.c (99%)
 rename xen/{arch/arm/include/asm => include/xen}/static-evtchn.h (77%)
xen/arch/arm/Kconfig +0 -8
index a5aad97a688e..57919d8b3ac8 100644
@@ -253,14 +253,6 @@ config STATIC_SHM
 	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
-	default y
-	help
-	  This option enables establishing static event channel communication
-	  between domains on a dom0less system (domU-domU as well as domU-dom0).
-
 config PARTIAL_EMULATION
 	bool "Enable partial emulation of system/coprocessor registers"
 	default y
xen/arch/arm/Makefile +0 -1
index 129a109d6ec5..eeeac4e653ec 100644
@@ -51,7 +51,6 @@ obj-y += setup.o
 obj-y += shutdown.o
 obj-y += smp.o
 obj-y += smpboot.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
 obj-y += sysctl.o
xen/arch/arm/setup.c +1 -1
index 10b46d068405..734e23da4408 100644
@@ -31,6 +31,7 @@
 #include <xen/version.h>
 #include <xen/vmap.h>
 #include <xen/stack-protector.h>
+#include <xen/static-evtchn.h>
 #include <xen/trace.h>
 #include <xen/libfdt/libfdt-xen.h>
 #include <xen/acpi.h>
@@ -39,7 +40,6 @@
 #include <asm/alternative.h>
 #include <asm/dom0less-build.h>
 #include <asm/page.h>
-#include <asm/static-evtchn.h>
 #include <asm/current.h>
 #include <asm/setup.h>
 #include <asm/gic.h>
xen/common/Kconfig +8 -0
index 3d66d0939738..0951d4c2f286 100644
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM
+	default y
+	help
+	  This option enables establishing static event channel communication
+	  between domains on a dom0less system (domU-domU as well as domU-dom0).
+
 menu "Speculative hardening"
 
 config INDIRECT_THUNK
xen/common/device-tree/Makefile +1 -0
index 831b91399b74..2df7eb27222e 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.o
 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
xen/common/device-tree/static-evtchn.c renamed from xen/arch/arm/static-evtchn.c +1 -2
similarity index 99%
rename from xen/arch/arm/static-evtchn.c
rename to xen/common/device-tree/static-evtchn.c
index 49db08d5c6fc..8b82e6b3d8a6 100644
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/event.h>
-
-#include <asm/static-evtchn.h>
+#include <xen/static-evtchn.h>
 
 #define STATIC_EVTCHN_NODE_SIZE_CELLS 2
 
xen/include/xen/static-evtchn.h renamed from xen/arch/arm/include/asm/static-evtchn.h +3 -3
similarity index 77%
rename from xen/arch/arm/include/asm/static-evtchn.h
rename to xen/include/xen/static-evtchn.h
index f964522f6a62..31ae92741aad 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_STATIC_EVTCHN_H_
-#define __ASM_STATIC_EVTCHN_H_
+#ifndef XEN_STATIC_EVTCHN_H
+#define XEN_STATIC_EVTCHN_H
 
 #ifdef CONFIG_STATIC_EVTCHN
 
@@ -13,7 +13,7 @@ static inline void alloc_static_evtchn(void) {};
 
 #endif /* CONFIG_STATIC_EVTCHN */
 
-#endif /* __ASM_STATIC_EVTCHN_H_ */
+#endif /* XEN_STATIC_EVTCHN_H */
 
 /*
  * Local variables:
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Michal Orzel

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

Quoted 139 lines

---
Other candidates: static memory, shared memory

---
 xen/arch/arm/Kconfig                                      | 8 --------
 xen/arch/arm/Makefile                                     | 1 -
 xen/arch/arm/setup.c                                      | 2 +-
 xen/common/Kconfig                                        | 8 ++++++++
 xen/common/device-tree/Makefile                           | 1 +
 xen/{arch/arm => common/device-tree}/static-evtchn.c      | 3 +--
 xen/{arch/arm/include/asm => include/xen}/static-evtchn.h | 6 +++---
 7 files changed, 14 insertions(+), 15 deletions(-)
 rename xen/{arch/arm => common/device-tree}/static-evtchn.c (99%)
 rename xen/{arch/arm/include/asm => include/xen}/static-evtchn.h (77%)
xen/arch/arm/Kconfig +0 -8
index a5aad97a688e..57919d8b3ac8 100644
@@ -253,14 +253,6 @@ config STATIC_SHM
 	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
-	default y
-	help
-	  This option enables establishing static event channel communication
-	  between domains on a dom0less system (domU-domU as well as domU-dom0).
-
 config PARTIAL_EMULATION
 	bool "Enable partial emulation of system/coprocessor registers"
 	default y
xen/arch/arm/Makefile +0 -1
index 129a109d6ec5..eeeac4e653ec 100644
@@ -51,7 +51,6 @@ obj-y += setup.o
 obj-y += shutdown.o
 obj-y += smp.o
 obj-y += smpboot.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
 obj-y += sysctl.o
xen/arch/arm/setup.c +1 -1
index 10b46d068405..734e23da4408 100644
@@ -31,6 +31,7 @@
 #include <xen/version.h>
 #include <xen/vmap.h>
 #include <xen/stack-protector.h>
+#include <xen/static-evtchn.h>
 #include <xen/trace.h>
 #include <xen/libfdt/libfdt-xen.h>
 #include <xen/acpi.h>
@@ -39,7 +40,6 @@
 #include <asm/alternative.h>
 #include <asm/dom0less-build.h>
 #include <asm/page.h>
-#include <asm/static-evtchn.h>
 #include <asm/current.h>
 #include <asm/setup.h>
 #include <asm/gic.h>
xen/common/Kconfig +8 -0
index 3d66d0939738..0951d4c2f286 100644
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM
+	default y
+	help
+	  This option enables establishing static event channel communication
+	  between domains on a dom0less system (domU-domU as well as domU-dom0).
+
 menu "Speculative hardening"
 
 config INDIRECT_THUNK
xen/common/device-tree/Makefile +1 -0
index 831b91399b74..2df7eb27222e 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.o
 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
xen/common/device-tree/static-evtchn.c renamed from xen/arch/arm/static-evtchn.c +1 -2
similarity index 99%
rename from xen/arch/arm/static-evtchn.c
rename to xen/common/device-tree/static-evtchn.c
index 49db08d5c6fc..8b82e6b3d8a6 100644
@@ -1,8 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/event.h>
-
-#include <asm/static-evtchn.h>
+#include <xen/static-evtchn.h>
 
 #define STATIC_EVTCHN_NODE_SIZE_CELLS 2
 
xen/include/xen/static-evtchn.h renamed from xen/arch/arm/include/asm/static-evtchn.h +3 -3
similarity index 77%
rename from xen/arch/arm/include/asm/static-evtchn.h
rename to xen/include/xen/static-evtchn.h
index f964522f6a62..31ae92741aad 100644
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_STATIC_EVTCHN_H_
-#define __ASM_STATIC_EVTCHN_H_
+#ifndef XEN_STATIC_EVTCHN_H
+#define XEN_STATIC_EVTCHN_H
 
 #ifdef CONFIG_STATIC_EVTCHN
 
@@ -13,7 +13,7 @@ static inline void alloc_static_evtchn(void) {};
 
 #endif /* CONFIG_STATIC_EVTCHN */
 
-#endif /* __ASM_STATIC_EVTCHN_H_ */
+#endif /* XEN_STATIC_EVTCHN_H */
 
 /*
  * Local variables:
Signature · 1 line
2.25.1
#2 lore raw
In reply to Michal Orzel
Quoted 6 lines · Michal Orzel

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

I realize this was already committed, but ...

xen/common/Kconfig config STATIC_MEMORY · line 167

Quoted 9 lines
xen/common/Kconfig +3 -0
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM

... I think we should strive to avoid such arch dependencies; they simply don't scale very well. Instead (if needed) HAS_* should be introduced, which each interested arch can select. In the case here, however, perhaps DOM0LESS_BOOT alone would have been sufficient as a dependency?

Jan

#3 lore raw
Quoted 16 lines · Jan Beulich
Quoted 6 lines · Michal Orzel

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

I realize this was already committed, but ...

Quoted 6 lines
xen/common/Kconfig +0 -0
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
Quoted 8 lines

xen/common/Kconfig config STATIC_MEMORY · line 167

Quoted 3 lines
xen/common/Kconfig +3 -0
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM

... I think we should strive to avoid such arch dependencies; they simply don't scale very well. Instead (if needed) HAS_* should be introduced, which each interested arch can select. In the case here, however, perhaps DOM0LESS_BOOT alone would have been sufficient as a dependency?

What if e.g. RISC-V wants to enable dom0less but not static evtchn/memory/shmem because there are some functions to be implemented and they don't want to do it now? Protecting with just DOM0LESS_BOOT would not be sufficient here. I understand we could define HAS_*. I did not think about it.

~Michal

#4 lore raw
Quoted 27 lines · Michal
Quoted 16 lines · Jan Beulich
Quoted 6 lines · Michal Orzel

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

I realize this was already committed, but ...

Quoted 6 lines
xen/common/Kconfig +0 -0
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
Quoted 8 lines

xen/common/Kconfig config STATIC_MEMORY · line 167

Quoted 3 lines
xen/common/Kconfig +3 -0
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM

... I think we should strive to avoid such arch dependencies; they simply don't scale very well. Instead (if needed) HAS_* should be introduced, which each interested arch can select. In the case here, however, perhaps DOM0LESS_BOOT alone would have been sufficient as a dependency?

Quoted 3 lines

What if e.g. RISC-V wants to enable dom0less but not static evtchn/memory/shmem because there are some functions to be implemented and they don't want to do it now? Protecting with just DOM0LESS_BOOT would not be sufficient here.

Imo a transient(!) "depends on !RISCV" would in principle be fine, if ...

Quoted 1 line

I understand we could define HAS_*. I did not think about it.

... we don't want to go this route.

Jan

#5 lore raw
Quoted 28 lines · Jan Beulich
Quoted 27 lines · Michal
Quoted 24 lines · Jan Beulich
Quoted 6 lines · Michal Orzel

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

I realize this was already committed, but ...

xen/common/Kconfig config STATIC_MEMORY · line 167

Quoted 9 lines
xen/common/Kconfig +3 -0
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM

... I think we should strive to avoid such arch dependencies; they simply don't scale very well. Instead (if needed) HAS_* should be introduced, which each interested arch can select. In the case here, however, perhaps DOM0LESS_BOOT alone would have been sufficient as a dependency?

Quoted 5 lines
Quoted 3 lines

What if e.g. RISC-V wants to enable dom0less but not static evtchn/memory/shmem because there are some functions to be implemented and they don't want to do it now? Protecting with just DOM0LESS_BOOT would not be sufficient here.

Imo a transient(!) "depends on !RISCV" would in principle be fine, if ...

In this case, how can I know that upfront? When moving a feature I need to put some dependencies. At that point I don't know RISCV, PPC plans. The only thing I know is that I tested this feature on Arm. So the only meaningful dependency is & ARM.

~Michal

#6 lore raw
Quoted 31 lines · Michal
Quoted 28 lines · Jan Beulich
Quoted 27 lines · Michal
Quoted 24 lines · Jan Beulich
Quoted 6 lines · Michal Orzel

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

I realize this was already committed, but ...

xen/common/Kconfig config STATIC_MEMORY · line 167

Quoted 9 lines
xen/common/Kconfig +3 -0
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM

... I think we should strive to avoid such arch dependencies; they simply don't scale very well. Instead (if needed) HAS_* should be introduced, which each interested arch can select. In the case here, however, perhaps DOM0LESS_BOOT alone would have been sufficient as a dependency?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

What if e.g. RISC-V wants to enable dom0less but not static evtchn/memory/shmem because there are some functions to be implemented and they don't want to do it now? Protecting with just DOM0LESS_BOOT would not be sufficient here.

Imo a transient(!) "depends on !RISCV" would in principle be fine, if ...

In this case, how can I know that upfront? When moving a feature I need to put some dependencies. At that point I don't know RISCV, PPC plans.

You don't need to know this up front, do you? Neither of the two presently selects DOM0LESS_BOOT afaict, and hence such a transient negative dependency would (if necessary in the first place) be added when adding such a select.

Jan

#7 lore raw
Quoted 36 lines · Jan Beulich
Quoted 35 lines · Michal
Quoted 32 lines · Jan Beulich
Quoted 30 lines · Michal
Quoted 16 lines · Jan Beulich
Quoted 6 lines · Michal Orzel

There's nothing Arm specific about this feature. Move it to common as part of a larger activity to commonalize device tree related features. For now, select it only for ARM until others (e.g. RISC-V) verify it works for them too.

I realize this was already committed, but ...

Quoted 6 lines
xen/common/Kconfig +0 -0
@@ -162,6 +162,14 @@ config STATIC_MEMORY
 
 	  If unsure, say N.
 
Quoted 8 lines

xen/common/Kconfig config STATIC_MEMORY · line 167

Quoted 3 lines
xen/common/Kconfig +3 -0
+config STATIC_EVTCHN
+	bool "Static event channel support on a dom0less system"
+	depends on DOM0LESS_BOOT && ARM

... I think we should strive to avoid such arch dependencies; they simply don't scale very well. Instead (if needed) HAS_* should be introduced, which each interested arch can select. In the case here, however, perhaps DOM0LESS_BOOT alone would have been sufficient as a dependency?

What if e.g. RISC-V wants to enable dom0less but not static evtchn/memory/shmem because there are some functions to be implemented and they don't want to do it now? Protecting with just DOM0LESS_BOOT would not be sufficient here.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Imo a transient(!) "depends on !RISCV" would in principle be fine, if ...

In this case, how can I know that upfront? When moving a feature I need to put some dependencies. At that point I don't know RISCV, PPC plans.

You don't need to know this up front, do you? Neither of the two presently selects DOM0LESS_BOOT afaict, and hence such a transient negative dependency would (if necessary in the first place) be added when adding such a select.

Ok, so basically this should be left to people adding support for DOM0LESS_BOOT for other arches in the future.

There is static mem and shmem left to be moved. I think we can squeeze in a patch removing && ARM in this case.

~Michal