From nobody Sat Nov 30 03:46:02 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 ARC-Seal: i=1; a=rsa-sha256; t=1618224812; cv=none; d=zohomail.com; s=zohoarc; b=Qd1QHk50iGv9PEjiju9M3b3PoRXiS0ojzz2g8cROlNzyS/oVScrcamBRSvn+2lJ51Sk2J7h+mgTLp7FF+8+vMUBB3qk+JYRJXazOUZEDG90HnnFIH9wW07PQTEXStwd67aFmFZOJzOSa2gcxUS0GWSiQNR1J6goyNySNaDdtQvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618224812; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=B1XCkR7UOwjkTSldK6+uGOpmBvG9c/wNMCJ3hA8xYrY=; b=YeONJgroKpObC/mHYZ+TGX2xql1i1JY1RGLW2Z2IKYjvz2gNClvJghqFpz3FyFJDqq7HM4eGWHr6KPkh3FATdAlsRGg4csp7o+dPG9Uw9znm9cVrQEQq1uPgr5TZFuDLZ/tjZ1HgkSI0clSGZD+kqji3DEHDuC+5SnN+PpA8qug= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1618224812595161.5637692733942; Mon, 12 Apr 2021 03:53:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.108963.207987 (Exim 4.92) (envelope-from ) id 1lVuBw-0000uQ-8I; Mon, 12 Apr 2021 10:53:16 +0000 Received: by outflank-mailman (output) from mailman id 108963.207987; Mon, 12 Apr 2021 10:53:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lVuBw-0000uH-4D; Mon, 12 Apr 2021 10:53:16 +0000 Received: by outflank-mailman (input) for mailman id 108963; Mon, 12 Apr 2021 10:53:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lVuBv-0000jA-LE for xen-devel@lists.xenproject.org; Mon, 12 Apr 2021 10:53:15 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 6d573b1c-907d-4ce0-8086-115865ba9ac3; Mon, 12 Apr 2021 10:53:07 +0000 (UTC) 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 B9C07101E; Mon, 12 Apr 2021 03:53:06 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.cambridge.arm.com [10.1.197.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4DC8C3F694; Mon, 12 Apr 2021 03:53:05 -0700 (PDT) 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: 6d573b1c-907d-4ce0-8086-115865ba9ac3 From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Volodymyr Babchuk Subject: [PATCH v3 4/4] xen/arm: Prevent Dom0 to be loaded when using dom0less Date: Mon, 12 Apr 2021 11:52:43 +0100 Message-Id: <20210412105243.23354-5-luca.fancellu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210412105243.23354-1-luca.fancellu@arm.com> References: <20210412105243.23354-1-luca.fancellu@arm.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch prevents the dom0 to be loaded skipping its building and going forward to build domUs when the dom0 kernel is not found and at least one domU is present. Signed-off-by: Luca Fancellu Reviewed-by: Julien Grall --- v3 changes: - Rephrase documentation --- docs/features/dom0less.pandoc | 7 +++--- xen/arch/arm/setup.c | 42 ++++++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/docs/features/dom0less.pandoc b/docs/features/dom0less.pandoc index d798596cdf..c9edb529e1 100644 --- a/docs/features/dom0less.pandoc +++ b/docs/features/dom0less.pandoc @@ -16,9 +16,10 @@ Multiboot specification has been extended to allow for m= ultiple domains to be passed to Xen. See docs/misc/arm/device-tree/booting.txt for more information about the Multiboot specification and how to use it. =20 -Currently, a control domain ("dom0") is still required, but in the -future it will become unnecessary when all domains are created -directly from Xen. Instead of waiting for the control domain to be fully +Currently, a control domain ("dom0") is still required to manage the DomU +domains, but the system can start also without dom0 if the Device Tree +doesn't specify the dom0 kernel and it declares one or more domUs. +Instead of waiting for the control domain (when declared) to be fully booted and the Xen tools to become available, domains created by Xen this way are started right away in parallel. Hence, their boot time is typically much shorter. diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index b405f58996..ecc4f0ae98 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -793,6 +793,38 @@ static void __init setup_mm(void) } #endif =20 +static bool __init is_dom0less_mode(void) +{ + struct bootmodules *mods =3D &bootinfo.modules; + struct bootmodule *mod; + unsigned int i; + bool dom0found =3D false; + bool domUfound =3D false; + + /* Look into the bootmodules */ + for ( i =3D 0 ; i < mods->nr_mods ; i++ ) + { + mod =3D &mods->module[i]; + /* Find if dom0 and domU kernels are present */ + if ( mod->kind =3D=3D BOOTMOD_KERNEL ) + { + if ( mod->domU =3D=3D false ) + { + dom0found =3D true; + break; + } + else + domUfound =3D 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; =20 /* C entry point for boot CPU */ @@ -803,7 +835,7 @@ void __init start_xen(unsigned long boot_phys_offset, int cpus, i; const char *cmdline; struct bootmodule *xen_bootmodule; - struct domain *dom0; + struct domain *dom0 =3D NULL; int rc; =20 dcache_line_bytes =3D read_dcache_line_bytes(); @@ -958,7 +990,10 @@ void __init start_xen(unsigned long boot_phys_offset, enable_errata_workarounds(); =20 /* Create initial domain 0. */ - dom0 =3D create_dom0(); + if ( !is_dom0less_mode() ) + dom0 =3D create_dom0(); + else + printk(XENLOG_INFO "Xen dom0less mode detected\n"); =20 heap_init_late(); =20 @@ -976,7 +1011,8 @@ void __init start_xen(unsigned long boot_phys_offset, if ( acpi_disabled ) create_domUs(); =20 - domain_unpause_by_systemcontroller(dom0); + if ( dom0 ) + domain_unpause_by_systemcontroller(dom0); =20 /* Switch on to the dynamically allocated stack for the idle vcpu * since the static one we're running on is about to be freed. */ --=20 2.17.1