The construct_dom0 function is converted to consume struct boot_module
instances for the kernel and ramdisk. With this change, it is no longer
necessary for the internal use of struct mod by create_dom0, so they are
changed to struct boot_module.
Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
xen/arch/x86/dom0_build.c | 10 +++++-----
xen/arch/x86/include/asm/setup.h | 6 ++----
xen/arch/x86/setup.c | 17 ++++++++---------
3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 8d56705a0861..fb1b7e5d11cf 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -13,6 +13,7 @@
#include <xen/softirq.h>
#include <asm/amd.h>
+#include <asm/bootinfo.h>
#include <asm/dom0_build.h>
#include <asm/guest.h>
#include <asm/hpet.h>
@@ -596,9 +597,8 @@ int __init dom0_setup_permissions(struct domain *d)
return rc;
}
-int __init construct_dom0(struct domain *d, const module_t *image,
- unsigned long image_headroom, module_t *initrd,
- const char *cmdline)
+int __init construct_dom0(struct domain *d, const struct boot_module *image,
+ struct boot_module *initrd, const char *cmdline)
{
int rc;
@@ -610,9 +610,9 @@ int __init construct_dom0(struct domain *d, const module_t *image,
process_pending_softirqs();
if ( is_hvm_domain(d) )
- rc = dom0_construct_pvh(d, image, image_headroom, initrd, cmdline);
+ rc = dom0_construct_pvh(d, image->early_mod, image->headroom, initrd->early_mod, cmdline);
else if ( is_pv_domain(d) )
- rc = dom0_construct_pv(d, image, image_headroom, initrd, cmdline);
+ rc = dom0_construct_pv(d, image->early_mod, image->headroom, initrd->early_mod, cmdline);
else
panic("Cannot construct Dom0. No guest interface available\n");
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 165ca744ba34..19e2ad95b523 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -27,10 +27,8 @@ void subarch_init_memory(void);
void init_IRQ(void);
int construct_dom0(
- struct domain *d,
- const module_t *image, unsigned long image_headroom,
- module_t *initrd,
- const char *cmdline);
+ struct domain *d, const struct boot_module *image,
+ struct boot_module *initrd, const char *cmdline);
void setup_io_bitmap(struct domain *d);
unsigned long initial_images_nrpages(nodeid_t node);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6a613c4847b0..f58eb21d00d7 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -962,20 +962,19 @@ static struct domain *__init create_dom0(const struct boot_info *bi,
.misc_flags = opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0,
},
};
- int headroom, mod_idx = first_boot_module_index(bi, BOOTMOD_RAMDISK);
- module_t *image, *initrd;
+ int mod_idx = first_boot_module_index(bi, BOOTMOD_RAMDISK);
+ struct boot_module *image, *initrd;
struct domain *d;
domid_t domid;
/* Map boot_module to mb1 module for dom0 */
- image = bi->mods[0].early_mod;
- headroom = bi->mods[0].headroom;
+ image = &bi->mods[0];
/* Map boot_module to mb1 module for initrd */
if ( mod_idx < 0 )
initrd = NULL;
else
- initrd = bi->mods[mod_idx].early_mod;
+ initrd = &bi->mods[mod_idx];
if ( opt_dom0_pvh )
{
@@ -1002,10 +1001,10 @@ static struct domain *__init create_dom0(const struct boot_info *bi,
panic("Error creating d%uv0\n", domid);
/* Grab the DOM0 command line. */
- if ( image->string || kextra )
+ if ( image->early_mod->string || kextra )
{
- if ( image->string )
- safe_strcpy(cmdline, cmdline_cook(__va(image->string),
+ if ( image->early_mod->string )
+ safe_strcpy(cmdline, cmdline_cook(__va(image->early_mod->string),
bi->boot_loader_name));
if ( kextra )
@@ -1040,7 +1039,7 @@ static struct domain *__init create_dom0(const struct boot_info *bi,
write_cr4(read_cr4() & ~X86_CR4_SMAP);
}
- if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
+ if ( construct_dom0(d, image, initrd, cmdline) != 0 )
panic("Could not construct domain 0\n");
if ( cpu_has_smap )
--
2.30.2