xen/arm: Move static event channel feature to a separate module
PATCH v2 1/1 xen/arm: Move static event channel feature to a separate module
Move static event channel feature related code to a separate module (static-evtchn.{c,h}) in the spirit of fine granular configuration, so that the feature can be disabled if not needed.
Introduce Kconfig option CONFIG_STATIC_EVTCHN, enabled by default (to keep the current behavior) dependent on CONFIG_DOM0LESS. While it could be possible to create a loopback connection for dom0 only, this use case does not really need this feature and all the docs and commit messages refer explicitly to the use in dom0less system.
The only function visible externally is alloc_static_evtchn(), so move the prototype to static-evtchn.h and provide a stub in case a feature is disabled. Guard static_evtchn_created in struct dt_device_node as well as its helpers.
---
This is a follow up to Luca's dom0less features modularization.
Changes in v2:
- keep static_evtchn_created helpers in device_tree.h, move macro to *.c
--- xen/arch/arm/Kconfig | 8 ++ xen/arch/arm/Makefile | 1 + xen/arch/arm/domain_build.c | 146 -------------------- xen/arch/arm/include/asm/setup.h | 1 - xen/arch/arm/include/asm/static-evtchn.h | 25 ++++ xen/arch/arm/setup.c | 1 + xen/arch/arm/static-evtchn.c | 161 +++++++++++++++++++++++ xen/include/xen/device_tree.h | 4 + 8 files changed, 200 insertions(+), 147 deletions(-) create mode 100644 xen/arch/arm/include/asm/static-evtchn.h create mode 100644 xen/arch/arm/static-evtchn.c
xen/arch/arm/Kconfig +8 -0
@@ -217,6 +217,14 @@ 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). + endmenu menu "ARM errata workaround via the alternative framework"
xen/arch/arm/Makefile +1 -0
@@ -51,6 +51,7 @@ 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/domain_build.c +0 -146
158 lines not on this page · raw message
xen/arch/arm/include/asm/setup.h +0 -1
@@ -136,7 +136,6 @@ void acpi_create_efi_mmap_table(struct domain *d,int acpi_make_efi_nodes (void *fdt,struct membank tbl_add[]);void create_dom0 (void ); -void alloc_static_evtchn (void );void discard_initial_modules (void ); void fw_unreserved_regions(paddr_t s, paddr_t e,
xen/arch/arm/include/asm/static-evtchn.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_STATIC_EVTCHN_H_ +#define __ASM_STATIC_EVTCHN_H_ + +#ifdef CONFIG_STATIC_EVTCHN + +void alloc_static_evtchn (void ); + +#else /* !CONFIG_STATIC_EVTCHN */ + +static inline void alloc_static_evtchn (void ) {}; + +#endif /* CONFIG_STATIC_EVTCHN */ + +#endif /* __ASM_STATIC_EVTCHN_H_ */ + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/setup.c +1 -0
@@ -36,6 +36,7 @@#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/arch/arm/static-evtchn.c new file +161 -0
161 lines not on this page · raw message
xen/include/xen/device_tree.h +4 -0
@@ -94,8 +94,10 @@ struct dt_device_node {/* IOMMU specific fields */ bool is_protected; +#ifdef CONFIG_STATIC_EVTCHN /* HACK: Remove this if there is a need of space */ bool static_evtchn_created; +#endif /* * The main purpose of this list is to link the structure in the list
@@ -366,6 +368,7 @@ static inline bool dt_property_name_is_equal(const struct dt_property *pp,return !dt_prop_cmp (pp->name, name); } +#ifdef CONFIG_STATIC_EVTCHN static inline void dt_device_set_static_evtchn_created (struct dt_device_node *device) {
@@ -377,6 +380,7 @@ dt_device_static_evtchn_created(const struct dt_device_node *device) {return device->static_evtchn_created; } +#endif /* CONFIG_STATIC_EVTCHN */ /** * dt_find_compatible_node - Find a node based on type and one of the
Signature · 1 line
2.25.1
Hi Michal,
Quoted 10 lines · Michal Orzel
Move static event channel feature related code to a separate module (static-evtchn.{c,h}) in the spirit of fine granular configuration, so that the feature can be disabled if not needed.
Introduce
KconfigoptionCONFIG_STATIC_EVTCHN, enabled by default (to keep the current behavior) dependent onCONFIG_DOM0LESS. While it could be possible to create a loopback connection for dom0 only, this use case does not really need this feature and all the docs and commit messages refer explicitly to the use in dom0less system.
Quoted 6 lines
The only function visible externally is
alloc_static_evtchn(), so move the prototype tostatic-evtchn.hand provide a stub in case a feature is disabled. Guardstatic_evtchn_createdin structdt_device_nodeas well as its helpers.Signed-off-by Michal Orzel <[email protected]>
Cheers,
Signature · 1 line
Julien Grall
Quoted 14 lines · Michal Orzel
Move static event channel feature related code to a separate module (static-evtchn.{c,h}) in the spirit of fine granular configuration, so that the feature can be disabled if not needed.
Introduce
KconfigoptionCONFIG_STATIC_EVTCHN, enabled by default (to keep the current behavior) dependent onCONFIG_DOM0LESS. While it could be possible to create a loopback connection for dom0 only, this use case does not really need this feature and all the docs and commit messages refer explicitly to the use in dom0less system.
Quoted 7 lines
The only function visible externally is
alloc_static_evtchn(), so move the prototype tostatic-evtchn.hand provide a stub in case a feature is disabled. Guardstatic_evtchn_createdin structdt_device_nodeas well as its helpers.Signed-off-by Michal Orzel <[email protected]>---
Hi Michal,
FWIW because it is already Ack-ed.
Hi Luca,
Quoted 17 lines · Luca Fancellu
Quoted 17 lines · Michal Orzel
Move static event channel feature related code to a separate module (static-evtchn.{c,h}) in the spirit of fine granular configuration, so that the feature can be disabled if not needed.
Introduce
KconfigoptionCONFIG_STATIC_EVTCHN, enabled by default (to keep the current behavior) dependent onCONFIG_DOM0LESS. While it could be possible to create a loopback connection for dom0 only, this use case does not really need this feature and all the docs and commit messages refer explicitly to the use in dom0less system.The only function visible externally is
alloc_static_evtchn(), so move the prototype tostatic-evtchn.hand provide a stub in case a feature is disabled. Guardstatic_evtchn_createdin structdt_device_nodeas well as its helpers.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Michal Orzel <[email protected]>---
Hi Michal,
FWIW because it is already Ack-ed.
Reviewed-by Luca Fancellu <[email protected]>
Usually when I provide an Acked-by, it means I went through the code and generally happy with the patch, but I didn't review throroughly. Even if I provide a reviewed-by, it is always useful to have extra pair of eyes :). So thanks for looking at it!
It is now committed.
Cheers,
Quoted 3 lines
Signature · 1 line
Julien Grall