[4/4] python/qemu: accel: Add tcg_available() method
diff mbox series

Message ID 20191115180829.10275-5-wainersm@redhat.com
State New
Headers show
Series
  • python/qemu: New accel module and improvements
Related show

Commit Message

Wainer dos Santos Moschetta Nov. 15, 2019, 6:08 p.m. UTC
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>
---
 python/qemu/accel.py | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Alex Bennée Dec. 3, 2019, 5 p.m. UTC | #1
Wainer dos Santos Moschetta <wainersm@redhat.com> writes:

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

So is this series going to be combined with another avocado series?

> ---
>  python/qemu/accel.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/python/qemu/accel.py b/python/qemu/accel.py
> index 1978fbee4e..513904d46d 100644
> --- a/python/qemu/accel.py
> +++ b/python/qemu/accel.py
> @@ -69,3 +69,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)

Patch
diff mbox series

diff --git a/python/qemu/accel.py b/python/qemu/accel.py
index 1978fbee4e..513904d46d 100644
--- a/python/qemu/accel.py
+++ b/python/qemu/accel.py
@@ -69,3 +69,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)