[libvirt PATCH 3/5] add virQEMUCapsProbeQMPTCGState function to set QEMU_CAPS_TCG_DISABLED

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

 



virQEMUCapsProbeQMPTCGState will set QEMU_CAPS_TCG_DISABLED if QEMU
version is at least 2.10, KVM is enabled, and qom-list-types does 
not include tcg-accel.

Signed-off-by: Tobin Feldman-Fitzthum <tobin@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9c946339a3..c84ad0e831 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2553,6 +2553,38 @@ virQEMUCapsProbeQMPGenericProps(virQEMUCapsPtr qemuCaps,
     return 0;
 }
 
+static int
+virQEMUCapsProbeQMPTCGState(virQEMUCapsPtr qemuCaps,
+                            qemuMonitorPtr mon)
+{
+    int nvalues;
+    char **values;
+    size_t i;
+    bool found = false;
+    /*
+     * As of version 2.10, QEMU can be built without the TCG.
+     * */
+    if (qemuCaps->version < 2010000)
+        return 0;
+    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
+        return 0;
+    if ((nvalues = qemuMonitorGetObjectTypes(mon, &values)) < 0)
+        return -1;
+
+    for (i = 0; i < nvalues; i++) {
+        if (STREQ(values[i], "tcg-accel")) {
+            found = true;
+            break;
+        }
+    }
+
+    if (!found)
+        virQEMUCapsSet(qemuCaps, QEMU_CAPS_TCG_DISABLED);
+
+    virStringListFreeCount(values, nvalues);
+    return 0;
+}
+
 static int
 virQEMUCapsProbeQMPDevices(virQEMUCapsPtr qemuCaps,
                            qemuMonitorPtr mon)
-- 
2.20.1 (Apple Git-117)






[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]

  Powered by Linux