From nobody Sat Sep 21 05:55:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1699520813287115.87995292888411; Thu, 9 Nov 2023 01:06:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.629509.981824 (Exim 4.92) (envelope-from ) id 1r10zh-00066N-El; Thu, 09 Nov 2023 09:06:33 +0000 Received: by outflank-mailman (output) from mailman id 629509.981824; Thu, 09 Nov 2023 09:06:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r10zh-000665-8I; Thu, 09 Nov 2023 09:06:33 +0000 Received: by outflank-mailman (input) for mailman id 629509; Thu, 09 Nov 2023 09:06:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r10zg-0005ED-07 for xen-devel@lists.xenproject.org; Thu, 09 Nov 2023 09:06:32 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 45d56ead-7edf-11ee-98da-6d05b1d4d9a1; Thu, 09 Nov 2023 10:06:31 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 25E951477; Thu, 9 Nov 2023 01:07:15 -0800 (PST) Received: from e125770.cambridge.arm.com (e125770.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C23FC3F703; Thu, 9 Nov 2023 01:06:29 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 45d56ead-7edf-11ee-98da-6d05b1d4d9a1 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH v3 5/5] arm/dom0less: introduce Kconfig for dom0less feature Date: Thu, 9 Nov 2023 09:06:15 +0000 Message-Id: <20231109090615.3878767-6-luca.fancellu@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109090615.3878767-1-luca.fancellu@arm.com> References: <20231109090615.3878767-1-luca.fancellu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1699520815329100005 Content-Type: text/plain; charset="utf-8" Introduce 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. Signed-off-by: Luca Fancellu --- Changes from v2: - protect allocate_bank_memory with the new Kconfig --- xen/arch/arm/Kconfig | 9 +++++++++ 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/arch/arm/include/asm/domain_build.h | 2 ++ 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 0045a3762d86..0399f2faf734 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -88,6 +88,15 @@ config GICV2 Driver for the ARM Generic Interrupt Controller v2. If unsure, say Y =20 +config DOM0LESS_BOOT + bool "Dom0less boot support" if EXPERT + depends on ARM + 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 diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 89ef0c9075b5..5daf8f10114d 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -15,7 +15,7 @@ obj-y +=3D cpufeature.o obj-y +=3D decode.o obj-y +=3D device.o obj-$(CONFIG_IOREQ_SERVER) +=3D dm.o -obj-y +=3D dom0less-build.init.o +obj-$(CONFIG_DOM0LESS_BOOT) +=3D dom0less-build.init.o obj-y +=3D domain.o obj-y +=3D domain_build.init.o obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) +=3D domain_page.o diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index c2c17f075450..87eade449006 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -415,6 +415,7 @@ static void __init allocate_memory_11(struct domain *d, } } =20 +#ifdef CONFIG_DOM0LESS_BOOT bool __init allocate_bank_memory(struct domain *d, struct kernel_info *kin= fo, gfn_t sgfn, paddr_t tot_size) { @@ -476,6 +477,7 @@ bool __init allocate_bank_memory(struct domain *d, stru= ct kernel_info *kinfo, =20 return true; } +#endif =20 /* * When PCI passthrough is available we want to keep the diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 1c3640bb65fd..689dc016d081 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -802,6 +802,7 @@ static int __init handle_module_node(const EFI_LOADED_I= MAGE *loaded_image, return 1; } =20 +#ifdef CONFIG_DOM0LESS_BOOT /* * This function checks for boot modules under the domU guest domain node * in the DT. @@ -849,6 +850,7 @@ static int __init handle_dom0less_domain_node(const EFI= _LOADED_IMAGE *loaded_ima =20 return mb_modules_found; } +#endif =20 /* * This function checks for xen domain nodes under the /chosen node for po= ssible @@ -876,6 +878,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IM= AGE *loaded_image) { int ret; =20 +#ifdef CONFIG_DOM0LESS_BOOT if ( !fdt_node_check_compatible(fdt_efi, node, "xen,domain") ) { /* Found a node with compatible xen,domain; handle this node. = */ @@ -884,6 +887,7 @@ static int __init efi_check_dt_boot(const EFI_LOADED_IM= AGE *loaded_image) return ERROR_DT_MODULE_DOMU; } else +#endif { ret =3D handle_module_node(loaded_image, &dir_handle, node, ad= dr_len, size_len, false); diff --git a/xen/arch/arm/include/asm/dom0less-build.h b/xen/arch/arm/inclu= de/asm/dom0less-build.h index d95cb6234b62..859944eece16 100644 --- a/xen/arch/arm/include/asm/dom0less-build.h +++ b/xen/arch/arm/include/asm/dom0less-build.h @@ -8,9 +8,21 @@ #ifndef __ARM_DOM0LESS_BUILD_H_ #define __ARM_DOM0LESS_BUILD_H_ =20 +#ifdef CONFIG_DOM0LESS_BOOT + void create_domUs(void); bool is_dom0less_mode(void); =20 +#else /* !CONFIG_DOM0LESS_BOOT */ + +static inline void create_domUs(void) {} +static inline bool is_dom0less_mode(void) +{ + return false; +} + +#endif /* CONFIG_DOM0LESS_BOOT */ + #endif /* __ARM_DOM0LESS_BUILD_H_ */ =20 /* diff --git a/xen/arch/arm/include/asm/domain_build.h b/xen/arch/arm/include= /asm/domain_build.h index 13118b5ff956..3950f0276e55 100644 --- a/xen/arch/arm/include/asm/domain_build.h +++ b/xen/arch/arm/include/asm/domain_build.h @@ -6,8 +6,10 @@ =20 typedef __be32 gic_interrupt_t[3]; =20 +#ifdef CONFIG_DOM0LESS_BOOT bool allocate_bank_memory(struct domain *d, struct kernel_info *kinfo, gfn_t sgfn, paddr_t tot_size); +#endif 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, --=20 2.34.1