Re: [libvirt] [RFC 5/6] qemu: Fill in GIC capabilities
On Wed, 2016-03-30 at 16:12 -0400, John Ferlan wrote: > On 03/21/2016 01:28 PM, Andrea Bolognani wrote: > > +static int > > +virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps, > > +virDomainCapsPtr domCaps) > > +{ > > +virDomainCapsFeatureGICPtr gic = >gic; > > +size_t i; > > + > > +if (domCaps->arch != VIR_ARCH_ARMV7L && > > +domCaps->arch != VIR_ARCH_AARCH64) > > +return 0; > > + > > +if (STRNEQ(domCaps->machine, "virt") && > > +!STRPREFIX(domCaps->machine, "virt-")) > > +return 0; > > + > > +for (i = 0; i < qemuCaps->ngicCapabilities; i++) { > > +virGICCapabilityPtr cap = >gicCapabilities[i]; > > + > > +if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM && > > +!(cap->implementation & VIR_GIC_IMPLEMENTATION_KERNEL)) > > +continue; > > + > > +if (domCaps->virttype == VIR_DOMAIN_VIRT_QEMU && > > +!(cap->implementation & VIR_GIC_IMPLEMENTATION_EMULATED)) > > +continue; > > For these, patch 6 would need to be already in place I think if > circumstances were "just right" (so to speak). The feature is not really expected to work properly until the entire series has been applied, right? We can still shuffle patches around to implement proper caching of the capabilities even before such capabilities are actually filled in, but I don't think it's a blocker per se. > > + > > +gic->supported = true; > > +VIR_DOMAIN_CAPS_ENUM_SET(gic->version, > > + cap->version); > > Can there be more than one? Definitely! An example is hardware supporting both GIC v2 and GIC v3; another one is QEMU eventually implementing an emulated GIC v3. In both cases we'll end up with 2 3 > How is that handled! With a bit of magic, really ;) Basically virDomainCapsEnumSet() packs enum values very tightly, as if they were declared as flags to begin with, and virDomainCapsFormat() later unpacks them and presents them as above. Cheers. -- Andrea Bolognani Software Engineer - Virtualization Team -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC 5/6] qemu: Fill in GIC capabilities
On 03/21/2016 01:28 PM, Andrea Bolognani wrote: > Take the GIC capabilities stored in a virQEMUCaps instance and > update a virDomainCaps instance appropriately. > --- > src/qemu/qemu_capabilities.c | 38 +- > 1 file changed, 37 insertions(+), 1 deletion(-) > I think domaincapstest.c should be modified to add a (new) 2.6 version of the *.caps file. One that has the supported='yes' set. and this is probably where the docs get modified to add the new elements... > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c > index e54208a..64007f0 100644 > --- a/src/qemu/qemu_capabilities.c > +++ b/src/qemu/qemu_capabilities.c > @@ -4065,6 +4065,41 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr > qemuCaps, > } > > > +static int > +virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps, > +virDomainCapsPtr domCaps) > +{ > +virDomainCapsFeatureGICPtr gic = >gic; > +size_t i; > + > +if (domCaps->arch != VIR_ARCH_ARMV7L && > +domCaps->arch != VIR_ARCH_AARCH64) > +return 0; > + > +if (STRNEQ(domCaps->machine, "virt") && > +!STRPREFIX(domCaps->machine, "virt-")) > +return 0; > + > +for (i = 0; i < qemuCaps->ngicCapabilities; i++) { > +virGICCapabilityPtr cap = >gicCapabilities[i]; > + > +if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM && > +!(cap->implementation & VIR_GIC_IMPLEMENTATION_KERNEL)) > +continue; > + > +if (domCaps->virttype == VIR_DOMAIN_VIRT_QEMU && > +!(cap->implementation & VIR_GIC_IMPLEMENTATION_EMULATED)) > +continue; For these, patch 6 would need to be already in place I think if circumstances were "just right" (so to speak). > + > +gic->supported = true; > +VIR_DOMAIN_CAPS_ENUM_SET(gic->version, > + cap->version); Can there be more than one? How is that handled! IOW: Once we print, do we just break;? John > +} > + > +return 0; > +} > + > + > int > virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, >virQEMUCapsPtr qemuCaps, > @@ -4081,7 +4116,8 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, > if (virQEMUCapsFillDomainOSCaps(qemuCaps, os, > loader, nloader) < 0 || > virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, > disk) < 0 || > -virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0) > +virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 || > +virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0) > return -1; > return 0; > } > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [RFC 5/6] qemu: Fill in GIC capabilities
Take the GIC capabilities stored in a virQEMUCaps instance and update a virDomainCaps instance appropriately. --- src/qemu/qemu_capabilities.c | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e54208a..64007f0 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4065,6 +4065,41 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps, } +static int +virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps, +virDomainCapsPtr domCaps) +{ +virDomainCapsFeatureGICPtr gic = >gic; +size_t i; + +if (domCaps->arch != VIR_ARCH_ARMV7L && +domCaps->arch != VIR_ARCH_AARCH64) +return 0; + +if (STRNEQ(domCaps->machine, "virt") && +!STRPREFIX(domCaps->machine, "virt-")) +return 0; + +for (i = 0; i < qemuCaps->ngicCapabilities; i++) { +virGICCapabilityPtr cap = >gicCapabilities[i]; + +if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM && +!(cap->implementation & VIR_GIC_IMPLEMENTATION_KERNEL)) +continue; + +if (domCaps->virttype == VIR_DOMAIN_VIRT_QEMU && +!(cap->implementation & VIR_GIC_IMPLEMENTATION_EMULATED)) +continue; + +gic->supported = true; +VIR_DOMAIN_CAPS_ENUM_SET(gic->version, + cap->version); +} + +return 0; +} + + int virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, virQEMUCapsPtr qemuCaps, @@ -4081,7 +4116,8 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, if (virQEMUCapsFillDomainOSCaps(qemuCaps, os, loader, nloader) < 0 || virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk) < 0 || -virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0) +virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 || +virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0) return -1; return 0; } -- 2.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list