From nobody Fri Oct 31 23:30:42 2025 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; dkim=pass header.i=dpsmith@apertussolutions.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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1745100819; cv=pass; d=zohomail.com; s=zohoarc; b=fQ+GHOOYV1ud7Om5kCcTWfM4JaSMEijieLmEKzh2oHoXQtIMpLWUD4x3wljc05LkWnGc3e1j47INpCieX4KDD6xleueNpp1q1Ms0H8OOOH83POFay+q5tBR8xGI7KRliSmX2ncB9M9J3I+9hbG85XygKHYd1B/EJHz0ZOB/zmaw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745100819; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9J5GpuQpFoOEieUW2L0AylJvJrVRYTI0FgGOBBazw64=; b=mKrRvJonLd9bneXkIPVEvVS3zCTsqumT6gZaV4tlkCRB7w/U6OOq7UIFZ9W6uDymjmM0WuHFUWxllJ0hD1y0xpWOA2ghTiQBlijvOssav8Wo/fCkKi74NBOQ97Zhp1i5hT3S8tE3VtzHxr0sPrzW0bZsGIA0K7YhyVpuEifYXhw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1745100819278682.6277909231756; Sat, 19 Apr 2025 15:13:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.960119.1352222 (Exim 4.92) (envelope-from ) id 1u6GRG-0005XE-Ao; Sat, 19 Apr 2025 22:13:30 +0000 Received: by outflank-mailman (output) from mailman id 960119.1352222; Sat, 19 Apr 2025 22:13:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u6GRG-0005X2-7R; Sat, 19 Apr 2025 22:13:30 +0000 Received: by outflank-mailman (input) for mailman id 960119; Sat, 19 Apr 2025 22:13:28 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u6GRE-0004oZ-G7 for xen-devel@lists.xenproject.org; Sat, 19 Apr 2025 22:13:28 +0000 Received: from sender4-of-o50.zoho.com (sender4-of-o50.zoho.com [136.143.188.50]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 83493424-1d6b-11f0-9ffb-bf95429c2676; Sun, 20 Apr 2025 00:13:26 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 174510056489920.502879948931422; Sat, 19 Apr 2025 15:09:24 -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: 83493424-1d6b-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; t=1745100568; cv=none; d=zohomail.com; s=zohoarc; b=fQHCS4QPnpOILamjvaebZDeR8BHGW0ULo0rQJo3rxIqb4MkyDCZ+n3iUIxxuiH/e/7E/62Qf9G5SQ1RlEFjnbJdMOphQQyexKUiL0u7boabOHPsT2RAufl/xXKDAuFxCoZJNbqNxkm3jYkDekGQOl2wcP07FiHDWHoF69cf687s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745100568; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=9J5GpuQpFoOEieUW2L0AylJvJrVRYTI0FgGOBBazw64=; b=mZgHBox8c7XDqYwt+pOI+4q6yiZO1cIuQh86w89fhSNAmU3Gqta0CXccH+hzK7dx/4o02HpOMpXKPqt90HDearHeTdHULzAXiF92tnuqhpi54ZU0kCHOxl/ehDA6YXtD+4oNOI0U/BQ59gUXlJQaCvF3oCm7Nx74BtxRSpF8kxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1745100568; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=9J5GpuQpFoOEieUW2L0AylJvJrVRYTI0FgGOBBazw64=; b=SyqHYQcvV0xRaOfXBsErvSiGPB+ge32s7BbiKW0b9/hC7YytSM+Js9VNS6BSjLvB Yem6rP0Ym/oX2qUdqLH7KuungAjcHwGR5DTrEOrEJpTVGW4aEiuMUZeSvzoc6lybPZD X8eqZouVTojr+QsglPPWUcg7BZoQkmMWfaiJCpqU= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, stefano.stabellini@amd.com, agarciav@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [RFC 32/38] x86/hyperlaunch: introduce concept of core domains Date: Sat, 19 Apr 2025 18:08:14 -0400 Message-Id: <20250419220820.4234-33-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20250419220820.4234-1-dpsmith@apertussolutions.com> References: <20250419220820.4234-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1745100819892019000 Content-Type: text/plain; charset="utf-8" When constructing domU, and specifically the event channels for their conso= le and xenstore event channels, the domid for the backing domain must be known. Therefore, the control, hardware, and xenstore domains are deemed as core domains, and must be constructed before any of the other domains. This commit introduces the build_core_domains() function that will ensure t= he core domains are constructed first. Signed-off-by: Daniel P. Smith --- xen/arch/x86/domain-builder/core.c | 68 ++++++++++++++++++++++++-- xen/arch/x86/include/asm/boot-domain.h | 2 + 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/domain-builder/core.c b/xen/arch/x86/domain-build= er/core.c index 901efce62a61..f693aa46d278 100644 --- a/xen/arch/x86/domain-builder/core.c +++ b/xen/arch/x86/domain-builder/core.c @@ -103,18 +103,78 @@ void __init builder_init(struct boot_info *bi) } } =20 +static int __init build_core_domains(struct boot_info *bi) +{ + int count =3D 0; + struct boot_domain *bd; + int hw, cd, xs; + + cd =3D first_boot_domain_index(bi, BUILD_CAPS_CONTROL); + if ( cd > MAX_NR_BOOTDOMS ) + printk(XENLOG_WARNING "No control domain was defined\n"); + else + { + bd =3D &bi->domains[cd]; + + arch_create_dom(bi, bd); + if ( bd->d ) + { + bd->constructed =3D true; + count++; + } + } + + hw =3D first_boot_domain_index(bi, BUILD_CAPS_HARDWARE); + if ( hw > MAX_NR_BOOTDOMS ) + printk(XENLOG_WARNING "No hardware domain was defined\n"); + else + { + if ( hw !=3D cd ) + { + bd =3D &bi->domains[hw]; + + arch_create_dom(bi, bd); + if ( bd->d ) + { + bd->constructed =3D true; + count++; + } + } + } + + xs =3D first_boot_domain_index(bi, BUILD_CAPS_XENSTORE); + if ( xs > MAX_NR_BOOTDOMS ) + printk(XENLOG_WARNING "No xenstore domain was defined\n"); + else + { + if ( xs !=3D cd && xs !=3D hw ) + { + bd =3D &bi->domains[xs]; + + arch_create_dom(bi, bd); + if ( bd->d ) + { + bd->constructed =3D true; + count++; + } + } + } + + return count; +} + unsigned int __init builder_create_domains(struct boot_info *bi) { unsigned int build_count =3D 0; struct boot_domain *bd =3D &bi->domains[0]; =20 + if ( bi->nr_domains =3D=3D 0 ) + panic("%s: no domains defined\n", __func__); + if ( bd->kernel =3D=3D NULL && bd->capabilities & BUILD_CAPS_CONTROL ) panic("%s: control domain missing kernel\n", __func__); =20 - - arch_create_dom(bi, bd); - if ( bd->d ) - build_count++; + build_count =3D build_core_domains(bi); =20 /* Free temporary buffers. */ free_boot_modules(); diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/= asm/boot-domain.h index df2bfa0c94fa..a574f4941ed3 100644 --- a/xen/arch/x86/include/asm/boot-domain.h +++ b/xen/arch/x86/include/asm/boot-domain.h @@ -42,6 +42,8 @@ struct boot_domain { xen_pfn_t gfn; evtchn_port_t evtchn; } console, store; + + bool constructed; }; =20 #endif --=20 2.30.2