Re: [RFC 5/6] qemu: Fill in GIC capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 = &domCaps->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 = &qemuCaps->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

  <features>
    <gic supported='yes'>
      <enum name='version'>
        <value>2</value>
        <value>3</value>
      </enum>
    </gic>
  </features>

> 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]