Message ID | 20231102195938.1254489-3-stewart.hildebrand@amd.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Kconfig for PCI passthrough on ARM | expand |
On 02.11.2023 20:59, Stewart Hildebrand wrote: > --- a/tools/libs/light/libxl_x86.c > +++ b/tools/libs/light/libxl_x86.c > @@ -8,13 +8,16 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, > { > switch(d_config->c_info.type) { > case LIBXL_DOMAIN_TYPE_HVM: > - config->arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI); > + config->arch.emulation_flags = XEN_X86_EMU_ALL; > + config->flags &= ~XEN_DOMCTL_CDF_vpci; > break; > case LIBXL_DOMAIN_TYPE_PVH: > config->arch.emulation_flags = XEN_X86_EMU_LAPIC; > + config->flags &= ~XEN_DOMCTL_CDF_vpci; > break; > case LIBXL_DOMAIN_TYPE_PV: > config->arch.emulation_flags = 0; > + config->flags &= ~XEN_DOMCTL_CDF_vpci; > break; Why all this explicit clearing of XEN_DOMCTL_CDF_vpci? I can't even spot where the bit would be set. > --- a/tools/python/xen/lowlevel/xc/xc.c > +++ b/tools/python/xen/lowlevel/xc/xc.c > @@ -159,7 +159,10 @@ static PyObject *pyxc_domain_create(XcObject *self, > > #if defined (__i386) || defined(__x86_64__) > if ( config.flags & XEN_DOMCTL_CDF_hvm ) > - config.arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI); > + { > + config.arch.emulation_flags = XEN_X86_EMU_ALL; > + config.flags &= ~XEN_DOMCTL_CDF_vpci; > + } Same question here then. > @@ -575,6 +577,18 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config) > return -EINVAL; > } > > + if ( vpci && !hvm ) > + { > + dprintk(XENLOG_INFO, "vPCI requested for non-HVM guest\n"); > + return -EINVAL; > + } > + > + if ( vpci && !IS_ENABLED(CONFIG_HAS_VPCI) ) > + { > + dprintk(XENLOG_INFO, "vPCI requested but not enabled\n"); > + return -EINVAL; > + } Maybe flip the order of these checks? But I'm uncertain about the first one anyway: Isn't this something that needs deciding per-arch? > --- a/xen/include/public/arch-x86/xen.h > +++ b/xen/include/public/arch-x86/xen.h > @@ -283,15 +283,12 @@ struct xen_arch_domainconfig { > #define XEN_X86_EMU_PIT (1U<<_XEN_X86_EMU_PIT) > #define _XEN_X86_EMU_USE_PIRQ 9 > #define XEN_X86_EMU_USE_PIRQ (1U<<_XEN_X86_EMU_USE_PIRQ) > -#define _XEN_X86_EMU_VPCI 10 > -#define XEN_X86_EMU_VPCI (1U<<_XEN_X86_EMU_VPCI) This, aiui, being the reason for ... > --- a/xen/include/public/domctl.h > +++ b/xen/include/public/domctl.h > @@ -21,7 +21,7 @@ > #include "hvm/save.h" > #include "memory.h" > > -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000016 > +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017 ... this bump, I wonder whether nevertheless we wouldn't better leave a comment there to indicate that bit 10 better wouldn't be used again any time soon. > @@ -55,9 +55,12 @@ struct xen_domctl_createdomain { > #define XEN_DOMCTL_CDF_nested_virt (1U << _XEN_DOMCTL_CDF_nested_virt) > /* Should we expose the vPMU to the guest? */ > #define XEN_DOMCTL_CDF_vpmu (1U << 7) > +/* Should vPCI be enabled for the guest? */ > +#define _XEN_DOMCTL_CDF_vpci 8 What is this needed for besides ... > +#define XEN_DOMCTL_CDF_vpci (1U<<_XEN_DOMCTL_CDF_vpci) ... its use here? Imo like was done for vpmu, there should be only one new identifier. As an aside, there are blanks missing around <<. > --- a/xen/include/xen/domain.h > +++ b/xen/include/xen/domain.h > @@ -51,6 +51,9 @@ void arch_get_domain_info(const struct domain *d, > > #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) > > +#define has_vpci(d) (((d)->options & XEN_DOMCTL_CDF_vpci) && \ > + IS_ENABLED(CONFIG_HAS_VPCI)) Aiui the IS_ENABLED() is wanted so where suitable code conditional upon this predicate can be eliminated by the compiler. Question is whether we can't achieve this by, say, overriding XEN_DOMCTL_CDF_vpci to 0 in such cases (without touching what you add to the public header, i.e. not as easy as what we do in xen/arch/x86/include/asm/domain.h for X86_EMU_*). Jan
On 11/13/23 08:26, Jan Beulich wrote: > On 02.11.2023 20:59, Stewart Hildebrand wrote: >> --- a/tools/libs/light/libxl_x86.c >> +++ b/tools/libs/light/libxl_x86.c >> @@ -8,13 +8,16 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, >> { >> switch(d_config->c_info.type) { >> case LIBXL_DOMAIN_TYPE_HVM: >> - config->arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI); >> + config->arch.emulation_flags = XEN_X86_EMU_ALL; >> + config->flags &= ~XEN_DOMCTL_CDF_vpci; >> break; >> case LIBXL_DOMAIN_TYPE_PVH: >> config->arch.emulation_flags = XEN_X86_EMU_LAPIC; >> + config->flags &= ~XEN_DOMCTL_CDF_vpci; >> break; >> case LIBXL_DOMAIN_TYPE_PV: >> config->arch.emulation_flags = 0; >> + config->flags &= ~XEN_DOMCTL_CDF_vpci; >> break; > > Why all this explicit clearing of XEN_DOMCTL_CDF_vpci? I can't even spot > where the bit would be set. You're right, it's not being set currently, so no need to explicitly clear the bit here. I'll remove. > >> --- a/tools/python/xen/lowlevel/xc/xc.c >> +++ b/tools/python/xen/lowlevel/xc/xc.c >> @@ -159,7 +159,10 @@ static PyObject *pyxc_domain_create(XcObject *self, >> >> #if defined (__i386) || defined(__x86_64__) >> if ( config.flags & XEN_DOMCTL_CDF_hvm ) >> - config.arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI); >> + { >> + config.arch.emulation_flags = XEN_X86_EMU_ALL; >> + config.flags &= ~XEN_DOMCTL_CDF_vpci; >> + } > > Same question here then. Same answer here. > >> @@ -575,6 +577,18 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config) >> return -EINVAL; >> } >> >> + if ( vpci && !hvm ) >> + { >> + dprintk(XENLOG_INFO, "vPCI requested for non-HVM guest\n"); >> + return -EINVAL; >> + } >> + >> + if ( vpci && !IS_ENABLED(CONFIG_HAS_VPCI) ) >> + { >> + dprintk(XENLOG_INFO, "vPCI requested but not enabled\n"); >> + return -EINVAL; >> + } > > Maybe flip the order of these checks? But I'm uncertain about the first > one anyway: Isn't this something that needs deciding per-arch? In v4, the equivalent of the ( vpci && !hvm ) check was indeed in xen/arch/x86/domain.c:emulation_flags_ok(), but it seemed there was a suggestion that it be moved to common code... See discussion at [1]. How about putting it back into xen/arch/x86/domain.c, in arch_sanitise_domain_config(), not emulation_flags_ok()? [1] https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg02345.html > >> --- a/xen/include/public/arch-x86/xen.h >> +++ b/xen/include/public/arch-x86/xen.h >> @@ -283,15 +283,12 @@ struct xen_arch_domainconfig { >> #define XEN_X86_EMU_PIT (1U<<_XEN_X86_EMU_PIT) >> #define _XEN_X86_EMU_USE_PIRQ 9 >> #define XEN_X86_EMU_USE_PIRQ (1U<<_XEN_X86_EMU_USE_PIRQ) >> -#define _XEN_X86_EMU_VPCI 10 >> -#define XEN_X86_EMU_VPCI (1U<<_XEN_X86_EMU_VPCI) > > This, aiui, being the reason for ... > >> --- a/xen/include/public/domctl.h >> +++ b/xen/include/public/domctl.h >> @@ -21,7 +21,7 @@ >> #include "hvm/save.h" >> #include "memory.h" >> >> -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000016 >> +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017 > > ... this bump, I wonder whether nevertheless we wouldn't better leave a > comment there to indicate that bit 10 better wouldn't be used again any > time soon. I'll add a comment (above, in arch-x86/xen.h) > >> @@ -55,9 +55,12 @@ struct xen_domctl_createdomain { >> #define XEN_DOMCTL_CDF_nested_virt (1U << _XEN_DOMCTL_CDF_nested_virt) >> /* Should we expose the vPMU to the guest? */ >> #define XEN_DOMCTL_CDF_vpmu (1U << 7) >> +/* Should vPCI be enabled for the guest? */ >> +#define _XEN_DOMCTL_CDF_vpci 8 > > What is this needed for besides ... > >> +#define XEN_DOMCTL_CDF_vpci (1U<<_XEN_DOMCTL_CDF_vpci) > > ... its use here? Imo like was done for vpmu, there should be only one > new identifier. As an aside, there are blanks missing around <<. OK, I'll fix this > >> --- a/xen/include/xen/domain.h >> +++ b/xen/include/xen/domain.h >> @@ -51,6 +51,9 @@ void arch_get_domain_info(const struct domain *d, >> >> #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) >> >> +#define has_vpci(d) (((d)->options & XEN_DOMCTL_CDF_vpci) && \ >> + IS_ENABLED(CONFIG_HAS_VPCI)) > > Aiui the IS_ENABLED() is wanted so where suitable code conditional upon > this predicate can be eliminated by the compiler. Question is whether > we can't achieve this by, say, overriding XEN_DOMCTL_CDF_vpci to 0 in > such cases (without touching what you add to the public header, i.e. > not as easy as what we do in xen/arch/x86/include/asm/domain.h for > X86_EMU_*). I had only added the IS_ENABLED() here due to some (unnecessary) related changes in the later patch ("xen/arm: enable vPCI for domUs"). I hadn't considered the compiler optimization aspect. I can understand the potential benefit, but I'm not ready to introduce such complexity at this time. I'm in favor of "simpler is better" in this case, so I'll change it back to how it was in v4: #define has_vpci(d) (!!((d)->options & XEN_DOMCTL_CDF_vpci)) > > Jan
On 13.11.2023 20:05, Stewart Hildebrand wrote: > On 11/13/23 08:26, Jan Beulich wrote: >> On 02.11.2023 20:59, Stewart Hildebrand wrote: >>> @@ -575,6 +577,18 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config) >>> return -EINVAL; >>> } >>> >>> + if ( vpci && !hvm ) >>> + { >>> + dprintk(XENLOG_INFO, "vPCI requested for non-HVM guest\n"); >>> + return -EINVAL; >>> + } >>> + >>> + if ( vpci && !IS_ENABLED(CONFIG_HAS_VPCI) ) >>> + { >>> + dprintk(XENLOG_INFO, "vPCI requested but not enabled\n"); >>> + return -EINVAL; >>> + } >> >> Maybe flip the order of these checks? But I'm uncertain about the first >> one anyway: Isn't this something that needs deciding per-arch? > > In v4, the equivalent of the ( vpci && !hvm ) check was indeed in xen/arch/x86/domain.c:emulation_flags_ok(), but it seemed there was a suggestion that it be moved to common code... See discussion at [1]. How about putting it back into xen/arch/x86/domain.c, in arch_sanitise_domain_config(), not emulation_flags_ok()? Actually no, I take back that part of the comment. I think I mistakenly considered PVH as "non-HVM" (as the log message has it). Jan > [1] https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg02345.html
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c index d16573e72cd4..ebce1552accd 100644 --- a/tools/libs/light/libxl_x86.c +++ b/tools/libs/light/libxl_x86.c @@ -8,13 +8,16 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc, { switch(d_config->c_info.type) { case LIBXL_DOMAIN_TYPE_HVM: - config->arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI); + config->arch.emulation_flags = XEN_X86_EMU_ALL; + config->flags &= ~XEN_DOMCTL_CDF_vpci; break; case LIBXL_DOMAIN_TYPE_PVH: config->arch.emulation_flags = XEN_X86_EMU_LAPIC; + config->flags &= ~XEN_DOMCTL_CDF_vpci; break; case LIBXL_DOMAIN_TYPE_PV: config->arch.emulation_flags = 0; + config->flags &= ~XEN_DOMCTL_CDF_vpci; break; default: abort(); diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index d6c6eb73db44..6f3da9c6e064 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -46,7 +46,6 @@ type x86_arch_emulation_flags = | X86_EMU_IOMMU | X86_EMU_PIT | X86_EMU_USE_PIRQ - | X86_EMU_VPCI type x86_arch_misc_flags = | X86_MSR_RELAXED @@ -70,6 +69,7 @@ type domain_create_flag = | CDF_IOMMU | CDF_NESTED_VIRT | CDF_VPMU + | CDF_VPCI type domain_create_iommu_opts = | IOMMU_NO_SHAREPT diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index 3bfc16edba96..e2dd02bec962 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -40,7 +40,6 @@ type x86_arch_emulation_flags = | X86_EMU_IOMMU | X86_EMU_PIT | X86_EMU_USE_PIRQ - | X86_EMU_VPCI type x86_arch_misc_flags = | X86_MSR_RELAXED @@ -63,6 +62,7 @@ type domain_create_flag = | CDF_IOMMU | CDF_NESTED_VIRT | CDF_VPMU + | CDF_VPCI type domain_create_iommu_opts = | IOMMU_NO_SHAREPT diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index d3ea350e07b9..e3623cdcb90d 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -159,7 +159,10 @@ static PyObject *pyxc_domain_create(XcObject *self, #if defined (__i386) || defined(__x86_64__) if ( config.flags & XEN_DOMCTL_CDF_hvm ) - config.arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI); + { + config.arch.emulation_flags = XEN_X86_EMU_ALL; + config.flags &= ~XEN_DOMCTL_CDF_vpci; + } #elif defined (__arm__) || defined(__aarch64__) config.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE; #else diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h index 99e798ffff68..be9ed39c9d42 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -298,9 +298,6 @@ static inline void arch_vcpu_block(struct vcpu *v) {} #define arch_vm_assist_valid_mask(d) (1UL << VMASST_TYPE_runstate_update_flag) -/* vPCI is not available on Arm */ -#define has_vpci(d) ({ (void)(d); false; }) - struct arch_vcpu_io { struct instr_details dabt_instr; /* when the instruction is decoded */ }; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 3712e36df930..98f0397686cf 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -712,7 +712,8 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) return 0; } -static bool emulation_flags_ok(const struct domain *d, uint32_t emflags) +static bool emulation_flags_ok(const struct domain *d, unsigned int emflags, + unsigned int cdf) { #ifdef CONFIG_HVM /* This doesn't catch !CONFIG_HVM case but it is better than nothing */ @@ -722,11 +723,13 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags) if ( is_hvm_domain(d) ) { if ( is_hardware_domain(d) && - emflags != (X86_EMU_VPCI | X86_EMU_LAPIC | X86_EMU_IOAPIC) ) + (!(cdf & XEN_DOMCTL_CDF_vpci) || + emflags != (X86_EMU_LAPIC | X86_EMU_IOAPIC)) ) return false; if ( !is_hardware_domain(d) && - emflags != (X86_EMU_ALL & ~X86_EMU_VPCI) && - emflags != X86_EMU_LAPIC ) + ((cdf & XEN_DOMCTL_CDF_vpci) || + (emflags != X86_EMU_ALL && + emflags != X86_EMU_LAPIC)) ) return false; } else if ( emflags != 0 && emflags != X86_EMU_PIT ) @@ -798,7 +801,7 @@ int arch_domain_create(struct domain *d, return -EINVAL; } - if ( !emulation_flags_ok(d, emflags) ) + if ( !emulation_flags_ok(d, emflags, config->flags) ) { printk(XENLOG_G_ERR "d%d: Xen does not allow %s domain creation " "with the current selection of emulators: %#x\n", diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h index 619e667938ed..cb02a4d1ebb2 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -471,7 +471,6 @@ struct arch_domain #define X86_EMU_VGA XEN_X86_EMU_VGA #define X86_EMU_IOMMU XEN_X86_EMU_IOMMU #define X86_EMU_USE_PIRQ XEN_X86_EMU_USE_PIRQ -#define X86_EMU_VPCI XEN_X86_EMU_VPCI #else #define X86_EMU_LAPIC 0 #define X86_EMU_HPET 0 @@ -482,7 +481,6 @@ struct arch_domain #define X86_EMU_VGA 0 #define X86_EMU_IOMMU 0 #define X86_EMU_USE_PIRQ 0 -#define X86_EMU_VPCI 0 #endif #define X86_EMU_PIT XEN_X86_EMU_PIT @@ -492,8 +490,7 @@ struct arch_domain X86_EMU_PM | X86_EMU_RTC | \ X86_EMU_IOAPIC | X86_EMU_PIC | \ X86_EMU_VGA | X86_EMU_IOMMU | \ - X86_EMU_PIT | X86_EMU_USE_PIRQ | \ - X86_EMU_VPCI) + X86_EMU_PIT | X86_EMU_USE_PIRQ) #define has_vlapic(d) (!!((d)->arch.emulation_flags & X86_EMU_LAPIC)) #define has_vhpet(d) (!!((d)->arch.emulation_flags & X86_EMU_HPET)) @@ -505,7 +502,6 @@ struct arch_domain #define has_viommu(d) (!!((d)->arch.emulation_flags & X86_EMU_IOMMU)) #define has_vpit(d) (!!((d)->arch.emulation_flags & X86_EMU_PIT)) #define has_pirq(d) (!!((d)->arch.emulation_flags & X86_EMU_USE_PIRQ)) -#define has_vpci(d) (!!((d)->arch.emulation_flags & X86_EMU_VPCI)) #define gdt_ldt_pt_idx(v) \ ((v)->vcpu_id >> (PAGETABLE_ORDER - GDT_LDT_VCPU_SHIFT)) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index a3d3f797bb1e..00dfcf231e21 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -890,12 +890,12 @@ static struct domain *__init create_dom0(const module_t *image, if ( opt_dom0_pvh ) { - dom0_cfg.flags |= (XEN_DOMCTL_CDF_hvm | + dom0_cfg.flags |= (XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_vpci | ((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; + XEN_X86_EMU_LAPIC | XEN_X86_EMU_IOAPIC; } if ( iommu_enabled ) diff --git a/xen/common/domain.c b/xen/common/domain.c index 8f9ab01c0cb7..6a42eb6d8c18 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -509,12 +509,14 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config) bool hap = config->flags & XEN_DOMCTL_CDF_hap; bool iommu = config->flags & XEN_DOMCTL_CDF_iommu; bool vpmu = config->flags & XEN_DOMCTL_CDF_vpmu; + bool vpci = config->flags & XEN_DOMCTL_CDF_vpci; if ( config->flags & ~(XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap | XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off | XEN_DOMCTL_CDF_xs_domain | XEN_DOMCTL_CDF_iommu | - XEN_DOMCTL_CDF_nested_virt | XEN_DOMCTL_CDF_vpmu) ) + XEN_DOMCTL_CDF_nested_virt | XEN_DOMCTL_CDF_vpmu | + XEN_DOMCTL_CDF_vpci) ) { dprintk(XENLOG_INFO, "Unknown CDF flags %#x\n", config->flags); return -EINVAL; @@ -575,6 +577,18 @@ static int sanitise_domain_config(struct xen_domctl_createdomain *config) return -EINVAL; } + if ( vpci && !hvm ) + { + dprintk(XENLOG_INFO, "vPCI requested for non-HVM guest\n"); + return -EINVAL; + } + + if ( vpci && !IS_ENABLED(CONFIG_HAS_VPCI) ) + { + dprintk(XENLOG_INFO, "vPCI requested but not enabled\n"); + return -EINVAL; + } + return arch_sanitise_domain_config(config); } diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index c0f4551247f4..4cf066761c6b 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -283,15 +283,12 @@ struct xen_arch_domainconfig { #define XEN_X86_EMU_PIT (1U<<_XEN_X86_EMU_PIT) #define _XEN_X86_EMU_USE_PIRQ 9 #define XEN_X86_EMU_USE_PIRQ (1U<<_XEN_X86_EMU_USE_PIRQ) -#define _XEN_X86_EMU_VPCI 10 -#define XEN_X86_EMU_VPCI (1U<<_XEN_X86_EMU_VPCI) #define XEN_X86_EMU_ALL (XEN_X86_EMU_LAPIC | XEN_X86_EMU_HPET | \ XEN_X86_EMU_PM | XEN_X86_EMU_RTC | \ XEN_X86_EMU_IOAPIC | XEN_X86_EMU_PIC | \ XEN_X86_EMU_VGA | XEN_X86_EMU_IOMMU | \ - XEN_X86_EMU_PIT | XEN_X86_EMU_USE_PIRQ |\ - XEN_X86_EMU_VPCI) + XEN_X86_EMU_PIT | XEN_X86_EMU_USE_PIRQ) uint32_t emulation_flags; /* diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index a33f9ec32b08..5f3b5579c377 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -21,7 +21,7 @@ #include "hvm/save.h" #include "memory.h" -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000016 +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017 /* * NB. xen_domctl.domain is an IN/OUT parameter for this operation. @@ -55,9 +55,12 @@ struct xen_domctl_createdomain { #define XEN_DOMCTL_CDF_nested_virt (1U << _XEN_DOMCTL_CDF_nested_virt) /* Should we expose the vPMU to the guest? */ #define XEN_DOMCTL_CDF_vpmu (1U << 7) +/* Should vPCI be enabled for the guest? */ +#define _XEN_DOMCTL_CDF_vpci 8 +#define XEN_DOMCTL_CDF_vpci (1U<<_XEN_DOMCTL_CDF_vpci) /* Max XEN_DOMCTL_CDF_* constant. Used for ABI checking. */ -#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_vpmu +#define XEN_DOMCTL_CDF_MAX XEN_DOMCTL_CDF_vpci uint32_t flags; diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 54d88bf5e34b..ab8f06c5f6a2 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -51,6 +51,9 @@ void arch_get_domain_info(const struct domain *d, #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) +#define has_vpci(d) (((d)->options & XEN_DOMCTL_CDF_vpci) && \ + IS_ENABLED(CONFIG_HAS_VPCI)) + /* * Arch-specifics. */