[PATCHv2 08/16] qemu: Introduce virQEMUCapsHaveAccel

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

 



The function should be used to check if qemu capabilities include a
hardware acceleration, i.e. accel is not TCG.

Signed-off-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e302fbb48f..f80ee62019 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -643,6 +643,12 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type)
     return type == VIR_DOMAIN_VIRT_KVM;
 }
 
+static bool
+virQEMUCapsHaveAccel(virQEMUCapsPtr qemuCaps)
+{
+    return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM);
+}
+
 /* Checks whether a domain with @guest arch can run natively on @host.
  */
 bool
@@ -2387,7 +2393,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
     if (!(models = virQEMUCapsFetchCPUDefinitions(mon)))
         return -1;
 
-    if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
+    if (tcg || !virQEMUCapsHaveAccel(qemuCaps))
         qemuCaps->tcgCPUModels = models;
     else
         qemuCaps->accelCPUModels = models;
@@ -2413,7 +2419,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
     if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
         return 0;
 
-    if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
+    if (tcg || !virQEMUCapsHaveAccel(qemuCaps)) {
         virtType = VIR_DOMAIN_VIRT_QEMU;
         model = "max";
     } else {
@@ -4528,7 +4534,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
     if (virQEMUCapsInitQMPMonitor(qemuCaps, cmd->mon) < 0)
         goto cleanup;
 
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
+    if (virQEMUCapsHaveAccel(qemuCaps)) {
         virQEMUCapsInitQMPCommandAbort(cmd);
         if ((rc = virQEMUCapsInitQMPCommandRun(cmd, true)) != 0) {
             if (rc == 1)
-- 
2.19.1

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

  Powered by Linux