diff mbox series

[v5,44/44] x86/boot: convert dom0_construct_pvh to struct boot_domain

Message ID 20241006214956.24339-45-dpsmith@apertussolutions.com (mailing list archive)
State Superseded
Headers show
Series Boot modules for Hyperlaunch | expand

Commit Message

Daniel P. Smith Oct. 6, 2024, 9:49 p.m. UTC
With construct_dom0 consuming struct boot_domain, continue passing the
structure down to dom0_construct_pvh.

Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/dom0_build.c             |  2 +-
 xen/arch/x86/hvm/dom0_build.c         | 31 +++++++++++++--------------
 xen/arch/x86/include/asm/dom0_build.h |  4 +---
 3 files changed, 17 insertions(+), 20 deletions(-)

Comments

Jason Andryuk Oct. 8, 2024, 7:56 p.m. UTC | #1
On 2024-10-06 17:49, Daniel P. Smith wrote:
> With construct_dom0 consuming struct boot_domain, continue passing the
> structure down to dom0_construct_pvh.
> 
> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>

> diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
> index a3fd5e762dc4..755e257cdf30 100644
> --- a/xen/arch/x86/hvm/dom0_build.c
> +++ b/xen/arch/x86/hvm/dom0_build.c
> @@ -1299,25 +1299,23 @@ static void __hwdom_init pvh_setup_mmcfg(struct domain *d)
>       }
>   }
>   
> -int __init dom0_construct_pvh(
> -    struct domain *d, const struct boot_module *image,
> -    struct boot_module *initrd, const char *cmdline)
> +int __init dom0_construct_pvh(const struct boot_domain *bd)
>   {
>       paddr_t entry, start_info;
>       int rc;

Again, I recommend using a local struct domain *d to cut down on the churn.

Regards,
Jason

>   
> -    printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", d->domain_id);
> +    printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", bd->domid);
>   
> -    if ( is_hardware_domain(d) )
> +    if ( is_hardware_domain(bd->d) )
Daniel P. Smith Oct. 10, 2024, 12:51 a.m. UTC | #2
On 10/8/24 15:56, Jason Andryuk wrote:
> On 2024-10-06 17:49, Daniel P. Smith wrote:
>> With construct_dom0 consuming struct boot_domain, continue passing the
>> structure down to dom0_construct_pvh.
>>
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
> 
>> diff --git a/xen/arch/x86/hvm/dom0_build.c 
>> b/xen/arch/x86/hvm/dom0_build.c
>> index a3fd5e762dc4..755e257cdf30 100644
>> --- a/xen/arch/x86/hvm/dom0_build.c
>> +++ b/xen/arch/x86/hvm/dom0_build.c
>> @@ -1299,25 +1299,23 @@ static void __hwdom_init 
>> pvh_setup_mmcfg(struct domain *d)
>>       }
>>   }
>> -int __init dom0_construct_pvh(
>> -    struct domain *d, const struct boot_module *image,
>> -    struct boot_module *initrd, const char *cmdline)
>> +int __init dom0_construct_pvh(const struct boot_domain *bd)
>>   {
>>       paddr_t entry, start_info;
>>       int rc;
> 
> Again, I recommend using a local struct domain *d to cut down on the churn.

Ack.

v/r,
dps
diff mbox series

Patch

diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 8beb33032940..6a21fd46d5a3 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -609,7 +609,7 @@  int __init construct_dom0(struct boot_domain *bd)
     process_pending_softirqs();
 
     if ( is_hvm_domain(bd->d) )
-        rc = dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdline);
+        rc = dom0_construct_pvh(bd);
     else if ( is_pv_domain(bd->d) )
         rc = dom0_construct_pv(bd);
     else
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index a3fd5e762dc4..755e257cdf30 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -1299,25 +1299,23 @@  static void __hwdom_init pvh_setup_mmcfg(struct domain *d)
     }
 }
 
-int __init dom0_construct_pvh(
-    struct domain *d, const struct boot_module *image,
-    struct boot_module *initrd, const char *cmdline)
+int __init dom0_construct_pvh(const struct boot_domain *bd)
 {
     paddr_t entry, start_info;
     int rc;
 
-    printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", d->domain_id);
+    printk(XENLOG_INFO "*** Building a PVH Dom%d ***\n", bd->domid);
 
-    if ( is_hardware_domain(d) )
+    if ( is_hardware_domain(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(d);
+        rc = dom0_setup_permissions(bd->d);
         if ( rc )
         {
-            printk("%pd unable to setup permissions: %d\n", d, rc);
+            printk("%pd unable to setup permissions: %d\n", bd->d, rc);
             return rc;
         }
     }
@@ -1327,25 +1325,26 @@  int __init dom0_construct_pvh(
      * initialization so the iommu code can fetch the MMCFG regions used by the
      * domain.
      */
-    pvh_setup_mmcfg(d);
+    pvh_setup_mmcfg(bd->d);
 
     /*
      * Craft dom0 physical memory map and set the paging allocation. This must
      * be done before the iommu initializion, since iommu initialization code
      * will likely add mappings required by devices to the p2m (ie: RMRRs).
      */
-    pvh_init_p2m(d);
+    pvh_init_p2m(bd->d);
 
-    iommu_hwdom_init(d);
+    iommu_hwdom_init(bd->d);
 
-    rc = pvh_populate_p2m(d);
+    rc = pvh_populate_p2m(bd->d);
     if ( rc )
     {
         printk("Failed to setup Dom0 physical memory map\n");
         return rc;
     }
 
-    rc = pvh_load_kernel(d, image, initrd, bootstrap_map_bm(image), cmdline,
+    rc = pvh_load_kernel(bd->d, bd->kernel, bd->ramdisk,
+                         bootstrap_map_bm(bd->kernel), bd->cmdline,
                          &entry, &start_info);
     if ( rc )
     {
@@ -1353,14 +1352,14 @@  int __init dom0_construct_pvh(
         return rc;
     }
 
-    rc = pvh_setup_cpus(d, entry, start_info);
+    rc = pvh_setup_cpus(bd->d, entry, start_info);
     if ( rc )
     {
         printk("Failed to setup Dom0 CPUs: %d\n", rc);
         return rc;
     }
 
-    rc = pvh_setup_acpi(d, start_info);
+    rc = pvh_setup_acpi(bd->d, start_info);
     if ( rc )
     {
         printk("Failed to setup Dom0 ACPI tables: %d\n", rc);
@@ -1369,8 +1368,8 @@  int __init dom0_construct_pvh(
 
     if ( opt_dom0_verbose )
     {
-        printk("Dom%u memory map:\n", d->domain_id);
-        print_e820_memory_map(d->arch.e820, d->arch.nr_e820);
+        printk("Dom%u memory map:\n", bd->domid);
+        print_e820_memory_map(bd->d->arch.e820, bd->d->arch.nr_e820);
     }
 
     return 0;
diff --git a/xen/arch/x86/include/asm/dom0_build.h b/xen/arch/x86/include/asm/dom0_build.h
index 60e9cb21f14d..adbe90bfd034 100644
--- a/xen/arch/x86/include/asm/dom0_build.h
+++ b/xen/arch/x86/include/asm/dom0_build.h
@@ -16,9 +16,7 @@  int dom0_setup_permissions(struct domain *d);
 
 int dom0_construct_pv(struct boot_domain *bd);
 
-int dom0_construct_pvh(
-    struct domain *d, const struct boot_module *image,
-    struct boot_module *initrd, const char *cmdline);
+int dom0_construct_pvh(const struct boot_domain *bd);
 
 unsigned long dom0_paging_pages(const struct domain *d,
                                 unsigned long nr_pages);