From nobody Fri Oct 31 23:23:02 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=1745100712; cv=pass; d=zohomail.com; s=zohoarc; b=RHYiPa6zVEWsUoREhYrrNCgywbfMaYnhFcFiNfC/1+aHiUXT7o9wWbIkbOa6QjBLFSkirkuX5WwIm0ZONXMfchu+5se1Ku9+iMA6/SQXMSGEZi3DfgKTsNZjd8iPijXLOkPDCkWZKf1VNehla3x6IEwJE0vnks4VNACzAFfE0o4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745100712; 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=hhloariy0ivPaFgv7gJ7fUQsj5qmnZtQNfUz7swuU5o=; b=VDmZX4IzW6E/164gA95DPC6RC3g4utMxhmHzJlQEnlL4ECa0txe6BfukMHxz2s9OagO5BlMxOwLSNQFtl9fxqT25QPPZevWgVU9Xz2TZm55saTlou7k+5MTtojvUBUkEFPdSVwPRFjYTKMjO/lXKjeQlmRR6R6EITcxbj4vPdAM= 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 1745100712824696.2908028279526; Sat, 19 Apr 2025 15:11:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.960064.1352172 (Exim 4.92) (envelope-from ) id 1u6GOf-0001k7-FB; Sat, 19 Apr 2025 22:10:49 +0000 Received: by outflank-mailman (output) from mailman id 960064.1352172; Sat, 19 Apr 2025 22:10:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u6GOf-0001jz-C6; Sat, 19 Apr 2025 22:10:49 +0000 Received: by outflank-mailman (input) for mailman id 960064; Sat, 19 Apr 2025 22:10:48 +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 1u6GNu-0004yY-Fs for xen-devel@lists.xenproject.org; Sat, 19 Apr 2025 22:10:02 +0000 Received: from sender4-of-o50.zoho.com (sender4-of-o50.zoho.com [136.143.188.50]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0930067e-1d6b-11f0-9eb0-5ba50f476ded; Sun, 20 Apr 2025 00:10:01 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1745100516695805.3400796738428; Sat, 19 Apr 2025 15:08:36 -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: 0930067e-1d6b-11f0-9eb0-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; t=1745100518; cv=none; d=zohomail.com; s=zohoarc; b=jCHtlTNbPugI4QsIOfMCSshNjkzTlnMLqAQ2vP1auU+C/EtHyN66loQ5UPnOLGrRs2fxULuzzTtaPiTNAkXIPy8FyenMkPZU2XsxZN286tyLGA/tjJnDHw1hL9XZZCgaI1B6knomTSeo60eLPRfS8SZoNuJF+DGR8NlrmN23xYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745100518; 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=hhloariy0ivPaFgv7gJ7fUQsj5qmnZtQNfUz7swuU5o=; b=dVWyCjoB36UUU+HPhr6g+dBMs7jIwim3s9O8c6XL8xOsoSSTARH3fK2aSancJeTn6c7fmvkRBw808Vhx2VoY6BquCbaqA1jh9rC47uWigznmrGbo26468PpzRqlA2hOjtasXa6vAePgcGzWY8qfJLjmfmHCxnVLw1tWqz7lp1J4= 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=1745100518; 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=hhloariy0ivPaFgv7gJ7fUQsj5qmnZtQNfUz7swuU5o=; b=Tdje/yajFWQNPQTzSYZLWr76M0NBIGJoB30uF9T8XUCB6fNMtxoDbWIXhQnPolJV +gBDPbBaXqzd+ONGwKI/A5rYrYyOrOwFP11GrY59pg6ryeOhFFmeFGDbx8MycfgyKic t+wmv7xTJm/eqI9dDJUzklKL9xn6yON+If3tpbow= 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 08/38] x86/hyperlaunch: move initial hwdom setup to dom_construct_pvh Date: Sat, 19 Apr 2025 18:07:50 -0400 Message-Id: <20250419220820.4234-9-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: 1745100713539019000 Content-Type: text/plain; charset="utf-8" Relocate the initial block of hwdom setup code from dom0_construct_pvh() ov= er to dom_construct_pvh(). No functional change. Signed-off-by: Daniel P. Smith --- xen/arch/x86/hvm/dom0_build.c | 44 ------------------------------ xen/arch/x86/hvm/dom_build.c | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index 176b253d3c61..b4ffebdde00e 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -1312,56 +1312,12 @@ static int __init pvh_setup_acpi(struct domain *d, = paddr_t start_info) return 0; } =20 -static void __hwdom_init pvh_setup_mmcfg(struct domain *d) -{ - unsigned int i; - int rc; - - for ( i =3D 0; i < pci_mmcfg_config_num; i++ ) - { - rc =3D register_vpci_mmcfg_handler(d, pci_mmcfg_config[i].address, - pci_mmcfg_config[i].start_bus_num= ber, - pci_mmcfg_config[i].end_bus_numbe= r, - pci_mmcfg_config[i].pci_segment); - if ( rc ) - printk("Unable to setup MMCFG handler at %#lx for segment %u\n= ", - pci_mmcfg_config[i].address, - pci_mmcfg_config[i].pci_segment); - } -} - int __init dom0_construct_pvh(const struct boot_domain *bd) { paddr_t entry, start_info; struct domain *d =3D bd->d; int rc; =20 - printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", d->domain_id); - - if ( bd->kernel =3D=3D NULL ) - panic("Missing kernel boot module for %pd construction\n", d); - - if ( is_hardware_domain(d) ) - { - /* - * MMCFG initialization must be performed before setting domain - * permissions, as the MCFG areas must not be part of the domain I= OMEM - * accessible regions. - */ - pvh_setup_mmcfg(d); - - /* - * Setup permissions early so that calls to add MMIO regions to the - * p2m as part of vPCI setup don't fail due to permission checks. - */ - rc =3D dom0_setup_permissions(d); - if ( rc ) - { - printk("%pd unable to setup permissions: %d\n", d, rc); - return rc; - } - } - /* * Craft dom0 physical memory map and set the paging allocation. This = must * be done before the iommu initializion, since iommu initialization c= ode diff --git a/xen/arch/x86/hvm/dom_build.c b/xen/arch/x86/hvm/dom_build.c index 7206815d64a9..b6e534226434 100644 --- a/xen/arch/x86/hvm/dom_build.c +++ b/xen/arch/x86/hvm/dom_build.c @@ -8,15 +8,65 @@ * Copyright (C) 2024 Apertus Solutions, LLC */ =20 +#include #include +#include + +#include =20 #include #include +#include +#include + +static void __hwdom_init pvh_setup_mmcfg(struct domain *d) +{ + unsigned int i; + int rc; + + for ( i =3D 0; i < pci_mmcfg_config_num; i++ ) + { + rc =3D register_vpci_mmcfg_handler(d, pci_mmcfg_config[i].address, + pci_mmcfg_config[i].start_bus_num= ber, + pci_mmcfg_config[i].end_bus_numbe= r, + pci_mmcfg_config[i].pci_segment); + if ( rc ) + printk("Unable to setup MMCFG handler at %#lx for segment %u\n= ", + pci_mmcfg_config[i].address, + pci_mmcfg_config[i].pci_segment); + } +} =20 int __init dom_construct_pvh(struct boot_domain *bd) { + int rc; + printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", bd->domid); =20 + if ( bd->kernel =3D=3D NULL ) + panic("Missing kernel boot module for %pd construction\n", bd->d); + + if ( is_hardware_domain(bd->d) ) + { + /* + * MMCFG initialization must be performed before setting domain + * permissions, as the MCFG areas must not be part of the domain I= OMEM + * accessible regions. + */ + pvh_setup_mmcfg(bd->d); + + /* + * Setup permissions early so that calls to add MMIO regions to the + * p2m as part of vPCI setup don't fail due to permission checks. + */ + rc =3D dom0_setup_permissions(bd->d); + if ( rc ) + { + printk("%pd unable to setup permissions: %d\n", bd->d, rc); + return rc; + } + } + return dom0_construct_pvh(bd); } =20 --=20 2.30.2