diff mbox series

[PULL,14/15] python/qemu: accel: Add tcg_available() method

Message ID 20191217051521.1239-15-crosa@redhat.com
State New
Headers show
Series [PULL,01/15] tests/boot_linux_console: Fetch assets from Debian snapshot archives | expand

Commit Message

Cleber Rosa Dec. 17, 2019, 5:15 a.m. UTC
From: Wainer dos Santos Moschetta <wainersm@redhat.com>

This adds a method to check if the tcg accelerator is enabled
in the QEMU binary.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20191216191438.93418-5-wainersm@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 python/qemu/accel.py | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/python/qemu/accel.py b/python/qemu/accel.py
index 5fce3aa3dd..0b38ddf0ab 100644
--- a/python/qemu/accel.py
+++ b/python/qemu/accel.py
@@ -67,3 +67,11 @@  def kvm_available(target_arch=None, qemu_bin=None):
     if qemu_bin and "kvm" not in list_accel(qemu_bin):
         return False
     return True
+
+def tcg_available(qemu_bin):
+    """
+    Check if TCG is available.
+
+    @param qemu_bin (str): path to the QEMU binary
+    """
+    return 'tcg' in list_accel(qemu_bin)