Fine granular configuration
v6 cover Fine granular configuration
This serie aims to add more modularity to some feature that can be excluded without issues from the build.
The first patch is already reviewed.
v2 update: So I've tried to see how to put the dom0less code in the common code, but the amount of modifications are not trivial, even putting only the common part and protecting them with ARM, leaving the ARM specific stuff under arch/ like gic etc... will leave a status that is not very nice, so I've decided for now to keep everything on the arm architecture so that who is going to work on unifying the code in common can just take from there and do the proper rework.
Luca Fancellu (5):
arm/gicv2: make GICv2 driver and vGICv2 optional xen/arm: Add asm/domain.h include to kernel.h arm/dom0less: put dom0less feature code in a separate module xen/arm: Move static memory build code in separate modules arm/dom0less: introduce Kconfig for dom0less feature
xen/arch/arm/Kconfig | 27 + xen/arch/arm/Makefile | 7 +- xen/arch/arm/arm32/mmu/mm.c | 1 + xen/arch/arm/arm64/mmu/mm.c | 1 + xen/arch/arm/bootfdt.c | 161 +- xen/arch/arm/dom0less-build.c | 1018 ++++++ xen/arch/arm/domain_build.c | 3591 ++++++--------------- xen/arch/arm/efi/efi-boot.h | 4 + xen/arch/arm/gic-v3.c | 4 + xen/arch/arm/include/asm/dom0less-build.h | 30 + xen/arch/arm/include/asm/domain_build.h | 34 + xen/arch/arm/include/asm/kernel.h | 1 + xen/arch/arm/include/asm/setup.h | 2 - xen/arch/arm/include/asm/static-memory.h | 45 + xen/arch/arm/include/asm/static-shmem.h | 66 + xen/arch/arm/setup.c | 57 +- xen/arch/arm/static-memory.c | 287 ++ xen/arch/arm/static-shmem.c | 547 ++++ xen/arch/arm/vgic.c | 2 + xen/arch/arm/vgic/Makefile | 4 +- xen/common/Kconfig | 2 +- 21 files changed, 3058 insertions(+), 2833 deletions(-) create mode 100644 xen/arch/arm/dom0less-build.c create mode 100644 xen/arch/arm/include/asm/dom0less-build.h create mode 100644 xen/arch/arm/include/asm/static-memory.h create mode 100644 xen/arch/arm/include/asm/static-shmem.h create mode 100644 xen/arch/arm/static-memory.c create mode 100644 xen/arch/arm/static-shmem.c
Signature · 1 line
2.34.1
PATCH v6 1/5 arm/gicv2: make GICv2 driver and vGICv2 optional
Introduce Kconfig GICV2 to be able to compile the GICv2 driver only when needed, the option is active by default.
Introduce Kconfig VGICV2 that compiles the Generic Interrupt Controller v2 emulation for domains, it is required only when using GICv2 driver, otherwise using the GICv3 driver it is optional and can be deselected if the user doesn't want to offer the v2 emulation to domains or maybe its GICv3 hardware can't offer the GICv2 compatible mode.
---
Changes from v2:
- No changes
--- xen/arch/arm/Kconfig | 19 +++++++++++++++++++ xen/arch/arm/Makefile | 4 ++-- xen/arch/arm/domain_build.c | 4 ++++ xen/arch/arm/gic-v3.c | 4 ++++ xen/arch/arm/vgic.c | 2 ++ xen/arch/arm/vgic/Makefile | 4 ++-- 6 files changed, 33 insertions(+), 4 deletions(-)
xen/arch/arm/Kconfig +19 -0
@@ -80,6 +80,14 @@ config ARM_EFI UEFI firmware. A UEFI stub is provided to allow Xen to be booted as an EFI application. +config GICV2 + bool "GICv2 driver" + default y + select VGICV2 + help + Driver for the ARM Generic Interrupt Controller v2. + If unsure, say Y + config GICV3 bool "GICv3 driver" depends on !NEW_VGIC
@@ -99,11 +107,22 @@ config OVERLAY_DTB help Dynamic addition/removal of Xen device tree nodes using a dtbo. +config VGICV2 + bool "vGICv2 interface for domains" + default y + help + Allow Xen to expose a Generic Interrupt Controller version 2 like to Xen + domains. This can be configured at the domain creation. + This option is mandatory when using GICv2. + For GICv3, this allows domain to use GICv2 when the hardware supports it. + If unsure say Y. + config HVM def_bool y config NEW_VGIC bool "Use new VGIC implementation" + select GICV2 ---help--- This is an alternative implementation of the ARM GIC interrupt
xen/arch/arm/Makefile +2 -2
@@ -23,7 +23,7 @@ obj-y += domctl.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-y += efi/ obj-y += gic.o -obj-y += gic-v2.o +obj-$(CONFIG_GICV2) += gic-v2.o obj-$(CONFIG_GICV3) += gic-v3.o obj-$(CONFIG_HAS_ITS) += gic-v3-its.o obj-$(CONFIG_HAS_ITS) += gic-v3-lpi.o
@@ -58,7 +58,7 @@ obj-$(CONFIG_NEW_VGIC) += vgic/ ifneq ($(CONFIG_NEW_VGIC),y) obj-y += gic-vgic.o obj-y += vgic.o -obj-y += vgic-v2.o +obj-$(CONFIG_VGICV2) += vgic-v2.o obj-$(CONFIG_GICV3) += vgic-v3.o obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o endif
xen/arch/arm/domain_build.c +4 -0
@@ -2491,6 +2491,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,return res; } +#ifdef CONFIG_VGICV2 static int __init make_gicv2_domU_node (struct kernel_info *kinfo) {void *fdt = kinfo->fdt;
@@ -2542,6 +2543,7 @@ static int __init make_gicv2_domU_node(struct kernel_info *kinfo) return res; } +#endif #ifdef CONFIG_GICV3 static int __init make_gicv3_domU_node (struct kernel_info *kinfo)
@@ -2617,8 +2619,10 @@ static int __init make_gic_domU_node(struct kernel_info *kinfo)case GIC_V3 :return make_gicv3_domU_node (kinfo);#endif +#ifdef CONFIG_VGICV2 case GIC_V2 :return make_gicv2_domU_node (kinfo); +#endif default :panic ("Unsupported GIC version\n" ); }
xen/arch/arm/gic-v3.c +4 -0
@@ -1334,6 +1334,7 @@ static paddr_t __initdata dbase = INVALID_PADDR;static paddr_t __initdata vbase =INVALID_PADDR , vsize =0 ;static paddr_t __initdata cbase =INVALID_PADDR , csize =0 ; +#ifdef CONFIG_VGICV2 /* If the GICv3 supports GICv2, initialize it */ static void __init gicv3_init_v2 (void ) {
@@ -1359,6 +1360,9 @@ static void __init gicv3_init_v2(void) vgic_v2_setup_hw(dbase, cbase, csize, vbase, 0); } +#else +static inline void gicv3_init_v2 (void ) { } +#endif static void __init gicv3_ioremap_distributor (paddr_t dist_paddr) {
xen/arch/arm/vgic.c +2 -0
@@ -96,10 +96,12 @@ int domain_vgic_register(struct domain *d, unsigned int *mmio_count)return -ENODEV ;break ;#endif +#ifdef CONFIG_VGICV2 case GIC_V2 :if (vgic_v2_init (d, mmio_count) )return -ENODEV ;break ; +#endif default :printk (XENLOG_G_ERR "d%d: Unknown vGIC version %u\n" , d->domain_id, d->arch.vgic.version);
xen/arch/arm/vgic/Makefile +2 -2
@@ -1,5 +1,5 @@ obj-y += vgic.o -obj-y += vgic-v2.o +obj-$(CONFIG_VGICV2) += vgic-v2.o obj-y += vgic-mmio.o -obj-y += vgic-mmio-v2.o +obj-$(CONFIG_VGICV2) += vgic-mmio-v2.o obj-y += vgic-init.o
Signature · 1 line
2.34.1
PATCH v6 2/5 xen/arm: Add asm/domain.h include to kernel.h
In reply to Luca FancelluThe 'enum domain_type' is defined by 'asm/domain.h' which is not included (directly or indirectly) by 'asm/kernel.h'.
This currently doesn't break the compilation because asm/domain.h will included by the user of 'kernel.h'. But it would be better to avoid relying on it. So add the include in 'asm/domain.h'.
---
Changes from v2:
- add Ack-by Julien
Changes from v1:
- Rephrased commit message (Julien)
--- xen/arch/arm/include/asm/kernel.h | 1 + 1 file changed, 1 insertion(+)
xen/arch/arm/include/asm/kernel.h +1 -0
@@ -7,6 +7,7 @@#define __ARCH_ARM_KERNEL_H__#include <xen/device_tree.h> +#include <asm/domain.h> #include <asm/setup.h> /*
Signature · 1 line
2.34.1
PATCH v6 3/5 arm/dom0less: put dom0less feature code in a separate module
In reply to Luca FancelluCurrently the dom0less feature code is mostly inside domain_build.c and setup.c, it is a feature that may not be useful to everyone so put the code in a different compilation module in order to make it easier to disable the feature in the future.
Move gic_interrupt_t in domain_build.h to use it with the function declaration, move its comment above the declaration.
The following functions are now visible externally from domain_build because they are used also from the dom0less-build module:
- get_allocation_size
- set_interrupt
- domain_fdt_begin_node
- make_memory_node
- make_resv_memory_node
- make_hypervisor_node
- make_psci_node
- make_cpus_node
- make_timer_node
- handle_device_interrupts
- construct_domain
- process_shm
- allocate_bank_memory
The functions allocate_static_memory and assign_static_memory_11 are now externally visible, so put their declarations into domain_build.h and move the #else and stub definition in the header as well.
Move is_dom0less_mode from setup.c to dom0less-build.c and make it externally visible.
The function allocate_bank_memory is used only by dom0less code at the moment, but it's been decided to leave it in domain_build.c in case that in the future the dom0 code can use it.
Where spotted, fix code style issues.
No functional change is intended.
---
Changes from v5:
- remove unneeded include (Michal)
- rebase on staging
Changes from v4:
- fixed name in inclusion macro __ASM_* instead of __ARM_*, fixed emacs local variable 'end:', style fix (Michal)
Changes from v3:
- remove header in dom0less-build.c (Michal)
Changes from v2:
- move allocate_bank_memory back in domain_build.c, remove header from dom0less-build.c.
--- xen/arch/arm/Makefile | 1 + xen/arch/arm/dom0less-build.c | 1018 +++++++++++++++++ xen/arch/arm/domain_build.c | 1265 +++------------------ xen/arch/arm/include/asm/dom0less-build.h | 18 + xen/arch/arm/include/asm/domain_build.h | 60 + xen/arch/arm/include/asm/setup.h | 1 - xen/arch/arm/setup.c | 33 +- 7 files changed, 1238 insertions(+), 1158 deletions(-) create mode 100644 xen/arch/arm/dom0less-build.c create mode 100644 xen/arch/arm/include/asm/dom0less-build.h
xen/arch/arm/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-y += cpufeature.o obj-y += decode.o obj-y += device.o obj-$(CONFIG_IOREQ_SERVER) += dm.o +obj-y += dom0less-build.init.o obj-y += domain.o obj-y += domain_build.init.o obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
xen/arch/arm/dom0less-build.c new file +1018 -0
1,018 lines not on this page · raw message
xen/arch/arm/domain_build.c +140 -1125
1,424 lines not on this page · raw message
xen/arch/arm/include/asm/dom0less-build.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_DOM0LESS_BUILD_H_ +#define __ASM_DOM0LESS_BUILD_H_ + +void create_domUs (void ); +bool is_dom0less_mode (void ); + +#endif /* __ASM_DOM0LESS_BUILD_H_ */ + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
xen/arch/arm/include/asm/domain_build.h +60 -0
75 lines not on this page · raw message
xen/arch/arm/include/asm/setup.h +0 -1
@@ -135,7 +135,6 @@ void acpi_create_efi_mmap_table(struct domain *d,int acpi_make_efi_nodes (void *fdt,struct membank tbl_add[]); -void create_domUs (void );void create_dom0 (void );void alloc_static_evtchn (void );
xen/arch/arm/setup.c +1 -32
@@ -34,6 +34,7 @@#include <xen/warning.h> #include <xen/hypercall.h> #include <asm/alternative.h> +#include <asm/dom0less-build.h> #include <asm/page.h> #include <asm/current.h> #include <asm/setup.h>
@@ -724,38 +725,6 @@ void __init populate_boot_allocator(void) } } -static bool __init is_dom0less_mode (void ) -{ -struct bootmodules *mods = &bootinfo.modules; -struct bootmodule *mod; -unsigned int i; -bool dom0found = false; -bool domUfound = false; - -/* Look into the bootmodules */ -for ( i =0 ; i < mods->nr_mods ; i++ ) - { - mod = &mods->module[i]; -/* Find if dom0 and domU kernels are present */ -if ( mod->kind ==BOOTMOD_KERNEL ) - { -if ( mod->domU == false ) - { - dom0found = true; -break ; - } -else - domUfound = true; - } - } - -/* -* If there is no dom0 kernel but at least one domU, then we are in -* dom0less mode -*/ -return ( !dom0found && domUfound ); -} -size_t __read_mostly dcache_line_bytes;/* C entry point for boot CPU */
Signature · 1 line
2.34.1
Re: [PATCH v6 3/5] arm/dom0less: put dom0less feature code in a separate module
Hi Luca,
+ CC others
Quoted 40 lines · Luca Fancellu
Currently the dom0less feature code is mostly inside
domain_build.candsetup.c, it is a feature that may not be useful to everyone so put the code in a different compilation module in order to make it easier to disable the feature in the future.Move
gic_interrupt_tindomain_build.hto use it with the function declaration, move its comment above the declaration.The following functions are now visible externally from
domain_buildbecause they are used also from the dom0less-build module:
-get_allocation_size
-set_interrupt
-domain_fdt_begin_node
-make_memory_node
-make_resv_memory_node
-make_hypervisor_node
-make_psci_node
-make_cpus_node
-make_timer_node
-handle_device_interrupts
-construct_domain
-process_shm
-allocate_bank_memoryThe functions
allocate_static_memoryandassign_static_memory_11are now externally visible, so put their declarations intodomain_build.hand move the #else and stub definition in the header as well.Move
is_dom0less_modefromsetup.ctodom0less-build.cand make it externally visible.The function
allocate_bank_memoryis used only by dom0less code at the moment, but it's been decided to leave it indomain_build.cin case that in the future the dom0 code can use it.Where spotted, fix code style issues.
Quoted 7 lines
No functional change is intended.
Signed-off-by Luca Fancellu <[email protected]>Reviewed-by Michal Orzel <[email protected]>---
Changes from v5:
- remove unneeded include (Michal)
Including asm/kernel.h was indeed not required. However, I'm thinking that if we want the header to be self-contained and given that ...
[...]
xen/arch/arm/include/asm/dom0less-build.h line 7
Quoted 13 lines
xen/arch/arm/include/asm/dom0less-build.h new file +7
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_DOM0LESS_BUILD_H_ +#define __ASM_DOM0LESS_BUILD_H_ + +void create_domUs (void ); +bool is_dom0less_mode (void );
here we use bool, I think we should include <xen/stdbool.h>
I think this change could be done on commit provided no remarks from other maintainers.
~Michal
Re: [PATCH v6 3/5] arm/dom0less: put dom0less feature code in a separate module
Hi,
Quoted 53 lines · Michal Orzel
Quoted 40 lines · Luca Fancellu
Currently the dom0less feature code is mostly inside
domain_build.candsetup.c, it is a feature that may not be useful to everyone so put the code in a different compilation module in order to make it easier to disable the feature in the future.Move
gic_interrupt_tindomain_build.hto use it with the function declaration, move its comment above the declaration.The following functions are now visible externally from
domain_buildbecause they are used also from the dom0less-build module:
-get_allocation_size
-set_interrupt
-domain_fdt_begin_node
-make_memory_node
-make_resv_memory_node
-make_hypervisor_node
-make_psci_node
-make_cpus_node
-make_timer_node
-handle_device_interrupts
-construct_domain
-process_shm
-allocate_bank_memoryThe functions
allocate_static_memoryandassign_static_memory_11are now externally visible, so put their declarations intodomain_build.hand move the #else and stub definition in the header as well.Move
is_dom0less_modefromsetup.ctodom0less-build.cand make it externally visible.The function
allocate_bank_memoryis used only by dom0less code at the moment, but it's been decided to leave it indomain_build.cin case that in the future the dom0 code can use it.Where spotted, fix code style issues.
Quoted 7 lines
No functional change is intended.
Signed-off-by Luca Fancellu <[email protected]>Reviewed-by Michal Orzel <[email protected]>---
Changes from v5:
- remove unneeded include (Michal)Including
asm/kernel.hwas indeed not required. However, I'm thinking that if we want the header to be self-contained and given that ...[...]
Quoted 14 lines
xen/arch/arm/include/asm/dom0less-build.h line 7
Quoted 13 lines
xen/arch/arm/include/asm/dom0less-build.h new file +7
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_DOM0LESS_BUILD_H_ +#define __ASM_DOM0LESS_BUILD_H_ + +void create_domUs (void ); +bool is_dom0less_mode (void );here we use bool, I think we should include <
xen/stdbool.h>
I have done the change on commit. However, this introduced a clash in the next patch.
I have done it this time because it is minor.
Cheers,
Signature · 1 line
Julien Grall
Re: [PATCH v6 3/5] arm/dom0less: put dom0less feature code in a separate module
Quoted 73 lines · Julien Grall
Hi,
Quoted 51 lines · Michal Orzel
Quoted 40 lines · Luca Fancellu
Currently the dom0less feature code is mostly inside
domain_build.candsetup.c, it is a feature that may not be useful to everyone so put the code in a different compilation module in order to make it easier to disable the feature in the future.Move
gic_interrupt_tindomain_build.hto use it with the function declaration, move its comment above the declaration.The following functions are now visible externally from
domain_buildbecause they are used also from the dom0less-build module:
-get_allocation_size
-set_interrupt
-domain_fdt_begin_node
-make_memory_node
-make_resv_memory_node
-make_hypervisor_node
-make_psci_node
-make_cpus_node
-make_timer_node
-handle_device_interrupts
-construct_domain
-process_shm
-allocate_bank_memoryThe functions
allocate_static_memoryandassign_static_memory_11are now externally visible, so put their declarations intodomain_build.hand move the #else and stub definition in the header as well.Move
is_dom0less_modefromsetup.ctodom0less-build.cand make it externally visible.The function
allocate_bank_memoryis used only by dom0less code at the moment, but it's been decided to leave it indomain_build.cin case that in the future the dom0 code can use it.Where spotted, fix code style issues.
Quoted 7 lines
No functional change is intended.
Signed-off-by Luca Fancellu <[email protected]>Reviewed-by Michal Orzel <[email protected]>---
Changes from v5:
- remove unneeded include (Michal)Including
asm/kernel.hwas indeed not required. However, I'm thinking that if we want the header to be self-contained and given that ...
[...]Quoted 14 lines
xen/arch/arm/include/asm/dom0less-build.h line 7
Quoted 13 lines
xen/arch/arm/include/asm/dom0less-build.h new file +7
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_DOM0LESS_BUILD_H_ +#define __ASM_DOM0LESS_BUILD_H_ + +void create_domUs (void ); +bool is_dom0less_mode (void );here we use bool, I think we should include <
xen/stdbool.h>
Quoted 3 lines
I have done the change on commit. However, this introduced a clash in the next patch.
I have done it this time because it is minor.
Thank you for that Julien, I didn’t realise there would have been a clash, sorry for the Inconvenience.
Cheers,
Luca
Quoted 5 lines
Cheers,
Signature · 1 line
Julien Grall
PATCH v6 4/5 xen/arm: Move static memory build code in separate modules
In reply to Luca FancelluMove static memory and static shared memory code in separate modules so that they are included only when the corresponding feature is enabled, doing that we modularise the features and we remove some ifdefs from the code to improve readability.
Move process_shm_node function from bootfdt module and make it externally visible.
A static inline helper called process_shm_chosen is introduced, it will call the process_shm function for the '/chosen' node, and will be used by the function construct_dom0 instead of using directly process_shm, allowing some #ifdef to be removed.
No functional changes are intended.
---
Changes from v5:
- removed init_staticmem_pages prototype from setup.h, add static-memory.h include in arm{32,64}/mmu/mm.c, dropped Michal R-by given the changes
Changes from v4:
- Removed header from static-*.{c,h} files, fixed style issue, renamed inclusion define __ARM_* to __ASM_*, fixed emacs local variables. (Michal)
Changes from v3:
- Moved make_resv_memory_node from domain_build to static-shmem, make make_shm_memory_node static.
Changes from v2:
- no changes
--- xen/arch/arm/Makefile | 2 + xen/arch/arm/arm32/mmu/mm.c | 1 + xen/arch/arm/arm64/mmu/mm.c | 1 + xen/arch/arm/bootfdt.c | 161 +----- xen/arch/arm/dom0less-build.c | 4 +- xen/arch/arm/domain_build.c | 654 +---------------------- xen/arch/arm/include/asm/domain_build.h | 26 - xen/arch/arm/include/asm/setup.h | 1 - xen/arch/arm/include/asm/static-memory.h | 45 ++ xen/arch/arm/include/asm/static-shmem.h | 66 +++ xen/arch/arm/setup.c | 24 - xen/arch/arm/static-memory.c | 287 ++++++++++ xen/arch/arm/static-shmem.c | 547 +++++++++++++++++++ 13 files changed, 954 insertions(+), 865 deletions(-) create mode 100644 xen/arch/arm/include/asm/static-memory.h create mode 100644 xen/arch/arm/include/asm/static-shmem.h create mode 100644 xen/arch/arm/static-memory.c create mode 100644 xen/arch/arm/static-shmem.c
xen/arch/arm/Makefile +2 -0
@@ -51,6 +51,8 @@ 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 obj-y += traps.o
xen/arch/arm/arm32/mmu/mm.c +1 -0
@@ -6,6 +6,7 @@#include <xen/param.h> #include <xen/pfn.h> #include <asm/fixmap.h> +#include <asm/static-memory.h> static unsigned long opt_xenheap_megabytes__initdata ;integer_param ("xenheap_megabytes" , opt_xenheap_megabytes);
xen/arch/arm/arm64/mmu/mm.c +1 -0
@@ -5,6 +5,7 @@#include <xen/pfn.h> #include <asm/setup.h> +#include <asm/static-memory.h> /* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn
xen/arch/arm/bootfdt.c +1 -160
173 lines not on this page · raw message
xen/arch/arm/dom0less-build.c +2 -2
@@ -13,6 +13,8 @@#include <asm/arm64/sve.h> #include <asm/dom0less-build.h> #include <asm/domain_build.h> +#include <asm/static-memory.h> +#include <asm/static-shmem.h> bool __init is_dom0less_mode (void ) {
@@ -806,11 +808,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 /* * Base address and irq number are needed when creating vpl011 device
xen/arch/arm/domain_build.c +2 -652
686 lines not on this page · raw message
xen/arch/arm/include/asm/domain_build.h +0 -26
@@ -10,8 +10,6 @@ bool allocate_bank_memory(struct domain *d, struct kernel_info *kinfo, gfn_t sgfn, paddr_t tot_size);int construct_domain (struct domain *d,struct kernel_info *kinfo);int domain_fdt_begin_node (void *fdt,const char *name,uint64_t unit); -int make_resv_memory_node (const struct domain *d,void *fdt,int addrcells, -int sizecells,const struct meminfo *mem);int make_chosen_node (const struct kernel_info *kinfo);int make_cpus_node (const struct domain *d,void *fdt); int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo,
@@ -42,9 +40,6 @@ int handle_device_interrupts(struct domain *d, struct dt_device_node *dev,void set_interrupt (gic_interrupt_t interrupt,unsigned int irq,unsigned int cpumask,unsigned int level); -int process_shm (struct domain *d,struct kernel_info *kinfo, -const struct dt_device_node *node); -#ifndef CONFIG_ACPI static inline int prepare_acpi (struct domain *d,struct kernel_info *kinfo) {
@@ -56,27 +51,6 @@ static inline int prepare_acpi(struct domain *d, struct kernel_info *kinfo)int prepare_acpi (struct domain *d,struct kernel_info *kinfo);#endif -#ifdef CONFIG_STATIC_MEMORY -void allocate_static_memory (struct domain *d,struct kernel_info *kinfo, -const struct dt_device_node *node); -void assign_static_memory_11 (struct domain *d,struct kernel_info *kinfo, -const struct dt_device_node *node); -#else -static inline void allocate_static_memory (struct domain *d, -struct kernel_info *kinfo, -const struct dt_device_node *node) -{ -ASSERT_UNREACHABLE (); -} - -static inline void assign_static_memory_11 (struct domain *d, -struct kernel_info *kinfo, -const struct dt_device_node *node) -{ -ASSERT_UNREACHABLE (); -} -#endif -#endif /*
xen/arch/arm/include/asm/setup.h +0 -1
@@ -160,7 +160,6 @@ struct bootcmdline * boot_cmdline_find_by_name(const char *name);const char *boot_module_kind_as_string (bootmodule_kind kind);void init_pdx (void ); -void init_staticmem_pages (void );void populate_boot_allocator (void );void setup_mm (void );
xen/arch/arm/include/asm/static-memory.h new file +45 -0
45 lines not on this page · raw message
xen/arch/arm/include/asm/static-shmem.h new file +66 -0
66 lines not on this page · raw message
xen/arch/arm/setup.c +0 -24
@@ -621,30 +621,6 @@ void __init init_pdx(void) } } -/* Static memory initialization */ -void __init init_staticmem_pages (void ) -{ -#ifdef CONFIG_STATIC_MEMORY -unsigned int bank; - -for ( bank =0 ; bank < bootinfo.reserved_mem.nr_banks; bank++ ) - { -if ( bootinfo.reserved_mem.bank[bank].type ==MEMBANK_STATIC_DOMAIN ) - { -mfn_t bank_start =_mfn (PFN_UP (bootinfo.reserved_mem.bank[bank].start)); -unsigned long bank_pages =PFN_DOWN (bootinfo.reserved_mem.bank[bank].size); -mfn_t bank_end =mfn_add (bank_start, bank_pages); - -if (mfn_x (bank_end) <=mfn_x (bank_start) ) -return ; - -unprepare_staticmem_pages (mfn_to_page (bank_start), - bank_pages, false); - } - } -#endif -} -/* * Populate the boot allocator. * If a static heap was not provided by the admin, all the RAM but the
xen/arch/arm/static-memory.c new file +287 -0
287 lines not on this page · raw message
xen/arch/arm/static-shmem.c new file +547 -0
547 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v6 4/5] xen/arm: Move static memory build code in separate modules
Hi Luca,
+ CC others
Quoted 10 lines · Luca Fancellu
Move static memory and static shared memory code in separate modules so that they are included only when the corresponding feature is enabled, doing that we modularise the features and we remove some ifdefs from the code to improve readability.
Move
process_shm_nodefunction from bootfdt module and make it externally visible.
Quoted 8 lines
A static inline helper called
process_shm_chosenis introduced, it will call theprocess_shmfunction for the '/chosen' node, and will be used by the functionconstruct_dom0instead of using directlyprocess_shm, allowing some #ifdef to be removed.No functional changes are intended.
Signed-off-by Luca Fancellu <[email protected]>
~Michal
PATCH v6 5/5 arm/dom0less: introduce Kconfig for dom0less feature
In reply to Luca FancelluIntroduce a Kconfig for the dom0less feature, enabled by default, to be able to choose if the feature should be compiled or not.
Provide static inline stubs when the option is disabled for the functions externally visible.
Use the new Kconfig to remove dom0less DT binding from the efi-boot.h code when the Kconfig is not enabled, do the same for allocate_bank_memory inside domain_build.c that currently is used only by dom0less-build.c module, but it's kept there provisioning its usage by dom0 code.
---
Changes from v5:
- style fix, don't protect prototype (Michal), add R-by Michal since there are no rebase changes
Changes from v4:
- No changes
Changes from v3:
- Update Kconfig
Changes from v2:
- protect allocate_bank_memory with the new Kconfig
--- xen/arch/arm/Kconfig | 8 ++++++++ xen/arch/arm/Makefile | 2 +- xen/arch/arm/domain_build.c | 2 ++ xen/arch/arm/efi/efi-boot.h | 4 ++++ xen/arch/arm/include/asm/dom0less-build.h | 12 ++++++++++++ xen/common/Kconfig | 2 +- 6 files changed, 28 insertions(+), 2 deletions(-)
xen/arch/arm/Kconfig +8 -0
@@ -88,6 +88,14 @@ config GICV2 Driver for the ARM Generic Interrupt Controller v2. If unsure, say Y +config DOM0LESS_BOOT + bool "Dom0less boot support" if EXPERT + default y + help + Dom0less boot support enables Xen to create and start domU guests during + Xen boot without the need of a control domain (Dom0), which could be + present anyway. + config GICV3 bool "GICv3 driver" depends on !NEW_VGIC
xen/arch/arm/Makefile +1 -1
@@ -16,7 +16,7 @@ obj-y += cpufeature.o obj-y += decode.o obj-y += device.o obj-$(CONFIG_IOREQ_SERVER) += dm.o -obj-y += dom0less-build.init.o +obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o obj-y += domain.o obj-y += domain_build.init.o obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
xen/arch/arm/domain_build.c +2 -0
@@ -416,6 +416,7 @@ static void __init allocate_memory_11(struct domain *d, } } +#ifdef CONFIG_DOM0LESS_BOOT bool __init allocate_bank_memory (struct domain *d,struct kernel_info *kinfo,gfn_t sgfn,paddr_t tot_size) {
@@ -477,6 +478,7 @@ bool __init allocate_bank_memory(struct domain *d, struct kernel_info *kinfo, return true; } +#endif /* * When PCI passthrough is available we want to keep the
xen/arch/arm/efi/efi-boot.h +4 -0
@@ -787,6 +787,7 @@ static int __init handle_module_node(const EFI_LOADED_IMAGE *loaded_image,return 1 ; } +#ifdef CONFIG_DOM0LESS_BOOT /* * This function checks for boot modules under the domU guest domain node * in the DT.
@@ -834,6 +835,7 @@ static int __init handle_dom0less_domain_node(const EFI_LOADED_IMAGE *loaded_ima return mb_modules_found; } +#endif /* * This function checks for xen domain nodes under the /chosen node for possible
@@ -861,6 +863,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IMAGE *loaded_image) {int ret; +#ifdef CONFIG_DOM0LESS_BOOT if ( !fdt_node_check_compatible (fdt_efi, node,"xen,domain" ) ) {/* Found a node with compatible xen,domain; handle this node. */
@@ -869,6 +872,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IMAGE *loaded_image) return ERROR_DT_MODULE_DOMU; } else +#endif { ret =handle_module_node (loaded_image, &dir_handle, node, addr_len, size_len, false);
xen/arch/arm/include/asm/dom0less-build.h +12 -0
@@ -3,9 +3,21 @@#ifndef __ASM_DOM0LESS_BUILD_H_#define __ASM_DOM0LESS_BUILD_H_ +#ifdef CONFIG_DOM0LESS_BOOT +void create_domUs (void );bool is_dom0less_mode (void ); +#else /* !CONFIG_DOM0LESS_BOOT */ + +static inline void create_domUs (void ) {} +static inline bool is_dom0less_mode (void ) +{ +return false; +} + +#endif /* CONFIG_DOM0LESS_BOOT */ +#endif /* __ASM_DOM0LESS_BUILD_H_ */ /*
xen/common/Kconfig +1 -1
@@ -100,7 +100,7 @@ config NUMA config STATIC_MEMORY bool "Static Allocation Support (UNSUPPORTED)" if UNSUPPORTED - depends on ARM + depends on DOM0LESS_BOOT help Static Allocation refers to system or sub-system(domains) for which memory areas are pre-defined by configuration using physical
Signature · 1 line
2.34.1
+ CC Maintainers
Quoted 44 lines · Luca Fancellu
This serie aims to add more modularity to some feature that can be excluded without issues from the build.
The first patch is already reviewed.
v2 update: So I've tried to see how to put the dom0less code in the common code, but the amount of modifications are not trivial, even putting only the common part and protecting them with ARM, leaving the ARM specific stuff under
arch/like gic etc... will leave a status that is not very nice, so I've decided for now to keep everything on the arm architecture so that who is going to work on unifying the code in common can just take from there and do the proper rework.Luca Fancellu (5):
arm/gicv2: make GICv2 driver and vGICv2 optional xen/arm: Addasm/domain.hinclude tokernel.harm/dom0less: put dom0less feature code in a separate module xen/arm: Move static memory build code in separate modules arm/dom0less: introduceKconfigfor dom0less featurexen/arch/arm/Kconfig | 27 + xen/arch/arm/Makefile | 7 +- xen/arch/arm/arm32/mmu/mm.c | 1 + xen/arch/arm/arm64/mmu/mm.c | 1 + xen/arch/arm/bootfdt.c | 161 +- xen/arch/arm/dom0less-build.c | 1018 ++++++ xen/arch/arm/domain_build.c | 3591 ++++++--------------- xen/arch/arm/efi/efi-boot.h | 4 + xen/arch/arm/gic-v3.c | 4 + xen/arch/arm/include/asm/dom0less-build.h | 30 + xen/arch/arm/include/asm/domain_build.h | 34 + xen/arch/arm/include/asm/kernel.h | 1 + xen/arch/arm/include/asm/setup.h | 2 - xen/arch/arm/include/asm/static-memory.h | 45 + xen/arch/arm/include/asm/static-shmem.h | 66 + xen/arch/arm/setup.c | 57 +- xen/arch/arm/static-memory.c | 287 ++ xen/arch/arm/static-shmem.c | 547 ++++ xen/arch/arm/vgic.c | 2 + xen/arch/arm/vgic/Makefile | 4 +- xen/common/Kconfig | 2 +- 21 files changed, 3058 insertions(+), 2833 deletions(-)
Quoted 6 lines
create mode 100644
xen/arch/arm/dom0less-build.ccreate mode 100644xen/arch/arm/include/asm/dom0less-build.hcreate mode 100644xen/arch/arm/include/asm/static-memory.hcreate mode 100644xen/arch/arm/include/asm/static-shmem.hcreate mode 100644xen/arch/arm/static-memory.ccreate mode 100644xen/arch/arm/static-shmem.c
I sent this serie forgetting about adding the maintainers, CC them now.
Cheers,
Luca
Quoted 57 lines · Luca Fancellu
+ CC Maintainers
Quoted 44 lines · Luca Fancellu
This serie aims to add more modularity to some feature that can be excluded without issues from the build.
The first patch is already reviewed.
v2 update: So I've tried to see how to put the dom0less code in the common code, but the amount of modifications are not trivial, even putting only the common part and protecting them with ARM, leaving the ARM specific stuff under
arch/like gic etc... will leave a status that is not very nice, so I've decided for now to keep everything on the arm architecture so that who is going to work on unifying the code in common can just take from there and do the proper rework.Luca Fancellu (5):
arm/gicv2: make GICv2 driver and vGICv2 optional xen/arm: Addasm/domain.hinclude tokernel.harm/dom0less: put dom0less feature code in a separate module xen/arm: Move static memory build code in separate modules arm/dom0less: introduceKconfigfor dom0less featurexen/arch/arm/Kconfig | 27 + xen/arch/arm/Makefile | 7 +- xen/arch/arm/arm32/mmu/mm.c | 1 + xen/arch/arm/arm64/mmu/mm.c | 1 + xen/arch/arm/bootfdt.c | 161 +- xen/arch/arm/dom0less-build.c | 1018 ++++++ xen/arch/arm/domain_build.c | 3591 ++++++--------------- xen/arch/arm/efi/efi-boot.h | 4 + xen/arch/arm/gic-v3.c | 4 + xen/arch/arm/include/asm/dom0less-build.h | 30 + xen/arch/arm/include/asm/domain_build.h | 34 + xen/arch/arm/include/asm/kernel.h | 1 + xen/arch/arm/include/asm/setup.h | 2 - xen/arch/arm/include/asm/static-memory.h | 45 + xen/arch/arm/include/asm/static-shmem.h | 66 + xen/arch/arm/setup.c | 57 +- xen/arch/arm/static-memory.c | 287 ++ xen/arch/arm/static-shmem.c | 547 ++++ xen/arch/arm/vgic.c | 2 + xen/arch/arm/vgic/Makefile | 4 +- xen/common/Kconfig | 2 +- 21 files changed, 3058 insertions(+), 2833 deletions(-)Quoted 6 lines
create mode 100644
xen/arch/arm/dom0less-build.ccreate mode 100644xen/arch/arm/include/asm/dom0less-build.hcreate mode 100644xen/arch/arm/include/asm/static-memory.hcreate mode 100644xen/arch/arm/include/asm/static-shmem.hcreate mode 100644xen/arch/arm/static-memory.ccreate mode 100644xen/arch/arm/static-shmem.c
Quoted 2 lines
I sent this serie forgetting about adding the maintainers, CC them now.
Hi all,
I think all the patches here are Ack-ed by a maintainer, is there any issue to merge them?
Quoted 4 lines
Cheers,
Luca
Hi Luca,
Quoted 57 lines · Luca Fancellu
Quoted 57 lines · Luca Fancellu
+ CC Maintainers
Quoted 50 lines · Luca Fancellu
This serie aims to add more modularity to some feature that can be excluded without issues from the build.
The first patch is already reviewed.
v2 update: So I've tried to see how to put the dom0less code in the common code, but the amount of modifications are not trivial, even putting only the common part and protecting them with ARM, leaving the ARM specific stuff under
arch/like gic etc... will leave a status that is not very nice, so I've decided for now to keep everything on the arm architecture so that who is going to work on unifying the code in common can just take from there and do the proper rework.Luca Fancellu (5):
arm/gicv2: make GICv2 driver and vGICv2 optional xen/arm: Addasm/domain.hinclude tokernel.harm/dom0less: put dom0less feature code in a separate module xen/arm: Move static memory build code in separate modules arm/dom0less: introduceKconfigfor dom0less featurexen/arch/arm/Kconfig | 27 + xen/arch/arm/Makefile | 7 +- xen/arch/arm/arm32/mmu/mm.c | 1 + xen/arch/arm/arm64/mmu/mm.c | 1 + xen/arch/arm/bootfdt.c | 161 +- xen/arch/arm/dom0less-build.c | 1018 ++++++ xen/arch/arm/domain_build.c | 3591 ++++++--------------- xen/arch/arm/efi/efi-boot.h | 4 + xen/arch/arm/gic-v3.c | 4 + xen/arch/arm/include/asm/dom0less-build.h | 30 + xen/arch/arm/include/asm/domain_build.h | 34 + xen/arch/arm/include/asm/kernel.h | 1 + xen/arch/arm/include/asm/setup.h | 2 - xen/arch/arm/include/asm/static-memory.h | 45 + xen/arch/arm/include/asm/static-shmem.h | 66 + xen/arch/arm/setup.c | 57 +- xen/arch/arm/static-memory.c | 287 ++ xen/arch/arm/static-shmem.c | 547 ++++ xen/arch/arm/vgic.c | 2 + xen/arch/arm/vgic/Makefile | 4 +- xen/common/Kconfig | 2 +- 21 files changed, 3058 insertions(+), 2833 deletions(-)create mode 100644
xen/arch/arm/dom0less-build.ccreate mode 100644xen/arch/arm/include/asm/dom0less-build.hcreate mode 100644xen/arch/arm/include/asm/static-memory.hcreate mode 100644xen/arch/arm/include/asm/static-shmem.hcreate mode 100644xen/arch/arm/static-memory.ccreate mode 100644xen/arch/arm/static-shmem.c
Quoted 7 lines
Quoted 2 lines
I sent this serie forgetting about adding the maintainers, CC them now.
Hi all,
I think all the patches here are Ack-ed by a maintainer, is there any issue to merge them?
We discussed this on Matrix and Julien will take care of committing this week.
~Michal
Quoted 64 lines · Michal Orzel
Hi Luca,
Quoted 57 lines · Luca Fancellu
Quoted 57 lines · Luca Fancellu
+ CC Maintainers
Quoted 50 lines · Luca Fancellu
This serie aims to add more modularity to some feature that can be excluded without issues from the build.
The first patch is already reviewed.
v2 update: So I've tried to see how to put the dom0less code in the common code, but the amount of modifications are not trivial, even putting only the common part and protecting them with ARM, leaving the ARM specific stuff under
arch/like gic etc... will leave a status that is not very nice, so I've decided for now to keep everything on the arm architecture so that who is going to work on unifying the code in common can just take from there and do the proper rework.Luca Fancellu (5):
arm/gicv2: make GICv2 driver and vGICv2 optional xen/arm: Addasm/domain.hinclude tokernel.harm/dom0less: put dom0less feature code in a separate module xen/arm: Move static memory build code in separate modules arm/dom0less: introduceKconfigfor dom0less featurexen/arch/arm/Kconfig | 27 + xen/arch/arm/Makefile | 7 +- xen/arch/arm/arm32/mmu/mm.c | 1 + xen/arch/arm/arm64/mmu/mm.c | 1 + xen/arch/arm/bootfdt.c | 161 +- xen/arch/arm/dom0less-build.c | 1018 ++++++ xen/arch/arm/domain_build.c | 3591 ++++++--------------- xen/arch/arm/efi/efi-boot.h | 4 + xen/arch/arm/gic-v3.c | 4 + xen/arch/arm/include/asm/dom0less-build.h | 30 + xen/arch/arm/include/asm/domain_build.h | 34 + xen/arch/arm/include/asm/kernel.h | 1 + xen/arch/arm/include/asm/setup.h | 2 - xen/arch/arm/include/asm/static-memory.h | 45 + xen/arch/arm/include/asm/static-shmem.h | 66 + xen/arch/arm/setup.c | 57 +- xen/arch/arm/static-memory.c | 287 ++ xen/arch/arm/static-shmem.c | 547 ++++ xen/arch/arm/vgic.c | 2 + xen/arch/arm/vgic/Makefile | 4 +- xen/common/Kconfig | 2 +- 21 files changed, 3058 insertions(+), 2833 deletions(-)create mode 100644
xen/arch/arm/dom0less-build.ccreate mode 100644xen/arch/arm/include/asm/dom0less-build.hcreate mode 100644xen/arch/arm/include/asm/static-memory.hcreate mode 100644xen/arch/arm/include/asm/static-shmem.hcreate mode 100644xen/arch/arm/static-memory.ccreate mode 100644xen/arch/arm/static-shmem.c
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
I sent this serie forgetting about adding the maintainers, CC them now.
Hi all,
I think all the patches here are Ack-ed by a maintainer, is there any issue to merge them?
We discussed this on Matrix and Julien will take care of committing this week.
Ok understood, thanks
Quoted 3 lines
~Michal