|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 8/8] x86/setup: lift dom0 creation out into create_dom0() function
On 01.02.2020 01:33, David Woodhouse wrote:
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -678,6 +678,92 @@ static unsigned int __init copy_bios_e820(struct
> e820entry *map, unsigned int li
> return n;
> }
>
> +static struct domain * __init create_dom0(const module_t *image,
> + unsigned long headroom,
> + module_t *initrd, char *kextra,
> + char *loader)
Can any of these last three be pointer-to-const?
> +{
> + struct xen_domctl_createdomain dom0_cfg = {
> + .flags = IS_ENABLED(CONFIG_TBOOT) ? XEN_DOMCTL_CDF_s3_integrity : 0,
> + .max_evtchn_port = -1,
> + .max_grant_frames = -1,
> + .max_maptrack_frames = -1,
> + };
> + struct domain *d;
> + char *cmdline;
> +
> + if ( opt_dom0_pvh )
> + {
> + dom0_cfg.flags |= (XEN_DOMCTL_CDF_hvm |
> + ((hvm_hap_supported() && !opt_dom0_shadow) ?
> + XEN_DOMCTL_CDF_hap : 0));
> +
> + dom0_cfg.arch.emulation_flags |=
> + XEN_X86_EMU_LAPIC | XEN_X86_EMU_IOAPIC | XEN_X86_EMU_VPCI;
> + }
> + dom0_cfg.max_vcpus = dom0_max_vcpus();
Can this not be part of the initializer now?
> + if ( iommu_enabled )
> + dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
> +
> + /* Create initial domain 0. */
> + d = domain_create(get_initial_domain_id(), &dom0_cfg, !pv_shim);
> + if ( IS_ERR(d) || (alloc_dom0_vcpu0(d) == NULL) )
> + panic("Error creating domain 0\n");
> +
> + /* Grab the DOM0 command line. */
> + cmdline = (char *)(image->string ? __va(image->string) : NULL);
Is this cast needed? (I know you're only moving the code, but some
easy cleanup would be nice anyway.)
> + if ( (cmdline != NULL) || (kextra != NULL) )
Similarly here you may want to consider shortening to
if ( cmdline || kextra )
At least one more similar case further down.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |