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

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

 



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 = &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;
+
+        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@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]