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: [RFC 08/38] x86/hyperlaunch: move initial hwdom setup to dom_construct_pvh
Date: Sat, 19 Apr 2025 18:07:50 -0400 [thread overview]
Message-ID: <20250419220820.4234-9-dpsmith@apertussolutions.com> (raw)
In-Reply-To: <20250419220820.4234-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 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;
}
-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 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
*/
+#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-04-19 22:10 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-19 22:07 [RFC 00/38] Hyperlaunch domain builder Daniel P. Smith
2025-04-19 22:07 ` [RFC 01/38] maintainers: add new section for hyperlaunch Daniel P. Smith
2025-04-19 22:07 ` [RFC 02/38] x86/hyperlaunch: correct the naming of domain ramdisk field Daniel P. Smith
2025-04-19 22:07 ` [RFC 03/38] x86/hyperlaunch: convert max vcpu determination to domain builder Daniel P. Smith
2025-04-22 20:36 ` Jason Andryuk
2025-04-25 15:05 ` Alejandro Vallejo
2025-04-25 22:03 ` Daniel P. Smith
2025-04-19 22:07 ` [RFC 04/38] x86/hyperlaunch: convert vcpu0 creation " Daniel P. Smith
2025-04-25 15:22 ` Alejandro Vallejo
2025-04-25 22:04 ` Daniel P. Smith
2025-04-28 10:33 ` Alejandro Vallejo
2025-04-28 11:01 ` Jan Beulich
2025-04-19 22:07 ` [RFC 05/38] x86/hyperlaunch: move dom0 cpuid policy behind capability check Daniel P. Smith
2025-04-19 22:07 ` [RFC 06/38] x86/hyperlaunch: add hardware domain capability support Daniel P. Smith
2025-04-19 22:07 ` [RFC 07/38] x86/hyperlaunch: introduce pvh domain builder Daniel P. Smith
2025-04-19 22:07 ` Daniel P. Smith [this message]
2025-04-19 22:07 ` [RFC 09/38] x86/boot: convert dom0 page calculation to use boot domain Daniel P. Smith
2025-04-19 22:07 ` [RFC 10/38] x86/boot: refactor dom0 page calculation Daniel P. Smith
2025-04-19 22:07 ` [RFC 11/38] x86/boot: generalize paging pages calculation Daniel P. Smith
2025-04-19 22:07 ` [RFC 12/38] x86/boot: generalize compute number of domain pages Daniel P. Smith
2025-04-19 22:07 ` [RFC 13/38] x86/hyperlaunch: move page computation to domain builder Daniel P. Smith
2025-04-19 22:07 ` [RFC 14/38] x86/hyperlaunch: move pvh p2m init " Daniel P. Smith
2025-04-19 22:07 ` [RFC 15/38] x86/hyperlaunch: move iommu " Daniel P. Smith
2025-04-19 22:07 ` [RFC 16/38] x86/boot: move and rename sched_setup_dom0_vcpus Daniel P. Smith
2025-04-20 9:36 ` Jürgen Groß
2025-04-22 12:38 ` Daniel P. Smith
2025-04-25 22:05 ` Daniel P. Smith
2025-04-19 22:07 ` [RFC 17/38] x86/hyperlaunch: move pvh_setup_cpus to domain builder Daniel P. Smith
2025-04-19 22:08 ` [RFC 18/38] x86/boot: rename pvh acpi setup function Daniel P. Smith
2025-04-19 22:08 ` [RFC 19/38] x86/hyperlaunch: add domu memory map construction Daniel P. Smith
2025-04-19 22:08 ` [RFC 20/38] x86/hyperlaunch: move populating p2m under domain builder Daniel P. Smith
2025-04-19 22:08 ` [RFC 21/38] x86/hyperlaunch: move remaining pvh dom0 construction Daniel P. Smith
2025-04-19 22:08 ` [RFC 22/38] x86/hyperlaunch: relocate pvh_steal_ram to domain builder Daniel P. Smith
2025-04-19 22:08 ` [RFC 23/38] x86/hyperlaunch: add domu acpi construction Daniel P. Smith
2025-04-19 22:08 ` [RFC 24/38] x86/boot: export command line processing Daniel P. Smith
2025-04-19 22:08 ` [RFC 25/38] x86/hyperlaunch: convert create_dom0 to arch_create_dom Daniel P. Smith
2025-04-19 22:08 ` [RFC 26/38] x86/hyperlaunch: remove dom0-isms from arch_create_dom Daniel P. Smith
2025-04-19 22:08 ` [RFC 27/38] x86/hyperlaunch: introduce domain builder general dom creation Daniel P. Smith
2025-04-19 22:08 ` [RFC 28/38] x86/hyperlaunch: add xenstore boot capabilities flag Daniel P. Smith
2025-04-19 22:08 ` [RFC 29/38] x86/hyperlaunch: allocate console for domu Daniel P. Smith
2025-04-19 22:08 ` [RFC 30/38] x86/hyperlaunch: allocate xenstore " Daniel P. Smith
2025-04-19 22:08 ` [RFC 31/38] x86/hyperlaunch: move boot module discard to domain builder Daniel P. Smith
2025-04-19 22:08 ` [RFC 32/38] x86/hyperlaunch: introduce concept of core domains Daniel P. Smith
2025-04-23 19:50 ` Jason Andryuk
2025-04-25 22:06 ` Daniel P. Smith
2025-04-19 22:08 ` [RFC 33/38] x86/boot: refactor bzimage parser to be re-enterant Daniel P. Smith
2025-04-23 19:27 ` Jason Andryuk
2025-04-25 22:16 ` Daniel P. Smith
2025-04-26 1:53 ` Daniel P. Smith
2025-04-28 6:41 ` Jan Beulich
2025-04-28 14:16 ` Jason Andryuk
2025-04-19 22:08 ` [RFC 34/38] x86/hyperlaunch: introduce multidomain kconfig option Daniel P. Smith
2025-04-19 22:08 ` [RFC 35/38] x86/hyperlaunch: add multidomain construction logic Daniel P. Smith
2025-04-19 22:08 ` [RFC 36/38] x86/hyperlaunch: enable unpausing mulitple domains Daniel P. Smith
2025-04-19 22:08 ` [RFC 37/38] x86/hyperlaunch: generalize domid assignment Daniel P. Smith
2025-04-19 22:08 ` [RFC 38/38] tools: introduce hyperlaunch domain late init 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=20250419220820.4234-9-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.