From: "Daniel P. Smith" <dpsmith@apertussolutions.com>
To: xen-devel@lists.xenproject.org
Cc: "Daniel P. Smith" <dpsmith@apertussolutions.com>,
jason.andryuk@amd.com, stefano.stabellini@amd.com,
agarciav@amd.com, "Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [RFCv2 07/38] x86/hyperlaunch: move initial hwdom setup to dom_construct_pvh
Date: Thu, 15 May 2025 09:17:13 -0400 [thread overview]
Message-ID: <20250515131744.3843-8-dpsmith@apertussolutions.com> (raw)
In-Reply-To: <20250515131744.3843-1-dpsmith@apertussolutions.com>
Relocate the initial block of hwdom setup code from dom0_construct_pvh() over
to dom_construct_pvh().
No functional change.
Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
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 0664f0543fd6..4f2eb0f97aba 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1311,56 +1311,12 @@ static int __init pvh_setup_acpi(struct domain *d, paddr_t start_info)
return 0;
}
-static void __hwdom_init pvh_setup_mmcfg(struct domain *d)
-{
- unsigned int i;
- int rc;
-
- for ( i = 0; i < pci_mmcfg_config_num; i++ )
- {
- rc = register_vpci_mmcfg_handler(d, pci_mmcfg_config[i].address,
- pci_mmcfg_config[i].start_bus_number,
- pci_mmcfg_config[i].end_bus_number,
- 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 = bd->d;
int rc;
- printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", d->domain_id);
-
- if ( bd->kernel == 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 IOMEM
- * 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 = 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 code
diff --git a/xen/arch/x86/hvm/dom_build.c b/xen/arch/x86/hvm/dom_build.c
index 8546cfff1fbf..a5f259b6352d 100644
--- a/xen/arch/x86/hvm/dom_build.c
+++ b/xen/arch/x86/hvm/dom_build.c
@@ -8,15 +8,65 @@
* Copyright (C) 2025 Apertus Solutions, LLC
*/
+#include <xen/acpi.h>
#include <xen/init.h>
+#include <xen/types.h>
+
+#include <acpi/actables.h>
#include <asm/bootinfo.h>
#include <asm/dom0_build.h>
+#include <asm/hvm/io.h>
+#include <asm/pci.h>
+
+static void __hwdom_init pvh_setup_mmcfg(struct domain *d)
+{
+ unsigned int i;
+ int rc;
+
+ for ( i = 0; i < pci_mmcfg_config_num; i++ )
+ {
+ rc = register_vpci_mmcfg_handler(d, pci_mmcfg_config[i].address,
+ pci_mmcfg_config[i].start_bus_number,
+ pci_mmcfg_config[i].end_bus_number,
+ 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 dom_construct_pvh(struct boot_domain *bd)
{
+ int rc;
+
printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", bd->domid);
+ if ( bd->kernel == 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 IOMEM
+ * 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 = 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);
}
--
2.30.2
next prev parent reply other threads:[~2025-05-15 13:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 13:17 [RFCv2 00/38] Hyperlaunch domain builder Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 01/38] maintainers: add new section for hyperlaunch Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 02/38] x86/hyperlaunch: correct the naming of domain ramdisk field Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 03/38] x86/hyperlaunch: convert max vcpu determination to domain builder Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 04/38] x86/hyperlaunch: convert vcpu0 creation " Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 05/38] x86/hyperlaunch: move dom0 cpuid policy behind capability check Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 06/38] x86/hyperlaunch: introduce pvh domain builder Daniel P. Smith
2025-05-15 13:17 ` Daniel P. Smith [this message]
2025-05-15 13:17 ` [RFCv2 08/38] x86/boot: convert dom0 page calculation to use boot domain Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 09/38] x86/boot: refactor dom0 page calculation Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 10/38] x86/boot: generalize paging pages calculation Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 11/38] x86/boot: generalize compute number of domain pages Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 12/38] x86/hyperlaunch: move page computation to domain builder Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 13/38] x86/hyperlaunch: move pvh p2m init " Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 14/38] x86/hyperlaunch: move iommu " Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 15/38] x86/boot: move and rename sched_setup_dom0_vcpus Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 16/38] x86/hyperlaunch: move pvh_setup_cpus to domain builder Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 17/38] x86/boot: rename pvh acpi setup function Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 18/38] x86/hyperlaunch: add domu memory map construction Daniel P. Smith
2025-05-15 13:17 ` [RFCv2 19/38] x86/hyperlaunch: move populating p2m under domain builder Daniel P. Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250515131744.3843-8-dpsmith@apertussolutions.com \
--to=dpsmith@apertussolutions.com \
--cc=agarciav@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=jason.andryuk@amd.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=stefano.stabellini@amd.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.