Message ID | 20241006214956.24339-43-dpsmith@apertussolutions.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Boot modules for Hyperlaunch | expand |
On 2024-10-06 17:49, Daniel P. Smith wrote: > A struct boot_domain now encapsulates the domain reference, kernel, ramdisk, > and command line for the domain being constructed. As a result of this > encapsulation, construct_dom0 can now take a single struct boot_domain instead > of these four parameters. > > Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com> > --- > xen/arch/x86/dom0_build.c | 19 +++++++++---------- > xen/arch/x86/include/asm/setup.h | 4 +--- > xen/arch/x86/setup.c | 2 +- > 3 files changed, 11 insertions(+), 14 deletions(-) > > diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c > index 71b2e3afc1a1..e552f2e9abef 100644 > --- a/xen/arch/x86/dom0_build.c > +++ b/xen/arch/x86/dom0_build.c > @@ -597,22 +597,21 @@ int __init dom0_setup_permissions(struct domain *d) > return rc; > } > > -int __init construct_dom0(struct domain *d, const struct boot_module *image, > - struct boot_module *initrd, const char *cmdline) > +int __init construct_dom0(struct boot_domain *bd) > { > int rc; I think a local variable would be better: struct domain *d = bd->d; The patch is smaller, and using just d is common in the hypervisor. Regards, Jason > > /* Sanity! */ > - BUG_ON(!pv_shim && d->domain_id != 0); > - BUG_ON(d->vcpu[0] == NULL); > - BUG_ON(d->vcpu[0]->is_initialised); > + BUG_ON(!pv_shim && bd->d->domain_id != 0); > + BUG_ON(bd->d->vcpu[0] == NULL); > + BUG_ON(bd->d->vcpu[0]->is_initialised); > > process_pending_softirqs(); > > - if ( is_hvm_domain(d) ) > - rc = dom0_construct_pvh(d, image, initrd, cmdline); > - else if ( is_pv_domain(d) ) > - rc = dom0_construct_pv(d, image, initrd, cmdline); > + if ( is_hvm_domain(bd->d) ) > + rc = dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdline); > + else if ( is_pv_domain(bd->d) ) > + rc = dom0_construct_pv(bd->d, bd->kernel, bd->ramdisk, bd->cmdline); > else > panic("Cannot construct Dom0. No guest interface available\n"); >
On 10/8/24 15:47, Jason Andryuk wrote: > On 2024-10-06 17:49, Daniel P. Smith wrote: >> A struct boot_domain now encapsulates the domain reference, kernel, >> ramdisk, >> and command line for the domain being constructed. As a result of this >> encapsulation, construct_dom0 can now take a single struct boot_domain >> instead >> of these four parameters. >> >> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com> >> --- >> xen/arch/x86/dom0_build.c | 19 +++++++++---------- >> xen/arch/x86/include/asm/setup.h | 4 +--- >> xen/arch/x86/setup.c | 2 +- >> 3 files changed, 11 insertions(+), 14 deletions(-) >> >> diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c >> index 71b2e3afc1a1..e552f2e9abef 100644 >> --- a/xen/arch/x86/dom0_build.c >> +++ b/xen/arch/x86/dom0_build.c >> @@ -597,22 +597,21 @@ int __init dom0_setup_permissions(struct domain *d) >> return rc; >> } >> -int __init construct_dom0(struct domain *d, const struct boot_module >> *image, >> - struct boot_module *initrd, const char >> *cmdline) >> +int __init construct_dom0(struct boot_domain *bd) >> { >> int rc; > > I think a local variable would be better: > > struct domain *d = bd->d; > > The patch is smaller, and using just d is common in the hypervisor. Ack. v/r, dps
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 71b2e3afc1a1..e552f2e9abef 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -597,22 +597,21 @@ int __init dom0_setup_permissions(struct domain *d) return rc; } -int __init construct_dom0(struct domain *d, const struct boot_module *image, - struct boot_module *initrd, const char *cmdline) +int __init construct_dom0(struct boot_domain *bd) { int rc; /* Sanity! */ - BUG_ON(!pv_shim && d->domain_id != 0); - BUG_ON(d->vcpu[0] == NULL); - BUG_ON(d->vcpu[0]->is_initialised); + BUG_ON(!pv_shim && bd->d->domain_id != 0); + BUG_ON(bd->d->vcpu[0] == NULL); + BUG_ON(bd->d->vcpu[0]->is_initialised); process_pending_softirqs(); - if ( is_hvm_domain(d) ) - rc = dom0_construct_pvh(d, image, initrd, cmdline); - else if ( is_pv_domain(d) ) - rc = dom0_construct_pv(d, image, initrd, cmdline); + if ( is_hvm_domain(bd->d) ) + rc = dom0_construct_pvh(bd->d, bd->kernel, bd->ramdisk, bd->cmdline); + else if ( is_pv_domain(bd->d) ) + rc = dom0_construct_pv(bd->d, bd->kernel, bd->ramdisk, bd->cmdline); else panic("Cannot construct Dom0. No guest interface available\n"); @@ -620,7 +619,7 @@ int __init construct_dom0(struct domain *d, const struct boot_module *image, return rc; /* Sanity! */ - BUG_ON(!d->vcpu[0]->is_initialised); + BUG_ON(!bd->d->vcpu[0]->is_initialised); return 0; } diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h index 04bf0e62a9d7..6fdb392432ad 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -26,9 +26,7 @@ void subarch_init_memory(void); void init_IRQ(void); -int construct_dom0( - struct domain *d, const struct boot_module *image, - struct boot_module *initrd, const char *cmdline); +int construct_dom0(struct boot_domain *d); void setup_io_bitmap(struct domain *d); extern struct boot_info xen_boot_info; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index e6a231bd2d42..6ea825b64541 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1013,7 +1013,7 @@ static struct domain *__init create_dom0(struct boot_info *bi) } } - if ( construct_dom0(bd->d, bd->kernel, bd->ramdisk, bd->cmdline) != 0 ) + if ( construct_dom0(bd) != 0 ) panic("Could not construct domain 0\n"); return bd->d;
A struct boot_domain now encapsulates the domain reference, kernel, ramdisk, and command line for the domain being constructed. As a result of this encapsulation, construct_dom0 can now take a single struct boot_domain instead of these four parameters. Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com> --- xen/arch/x86/dom0_build.c | 19 +++++++++---------- xen/arch/x86/include/asm/setup.h | 4 +--- xen/arch/x86/setup.c | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-)