qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 02/15] vl: add tcg_enabled() for tcg related


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH v2 02/15] vl: add tcg_enabled() for tcg related code
Date: Mon, 3 Jul 2017 14:30:26 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 03.07.2017 12:12, Yang Zhong wrote:
> Need to disable the tcg related code in the vl.c if the
> disable-tcg option is added into ./configure command.
> 
> Signed-off-by: Yang Zhong <address@hidden>
> ---
>  accel/tcg/tcg-all.c    |  2 +-
>  include/sysemu/accel.h |  2 +-
>  vl.c                   | 15 +++++++++++----
>  3 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index dba9931..b86c896 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -28,7 +28,7 @@
>  #include "sysemu/sysemu.h"
>  #include "qom/object.h"
>  
> -int tcg_tb_size;
> +long tcg_tb_size;

This looks like a non-related change. I think you should either put it
into a separate patch, or drop it.

>  static bool tcg_allowed = true;
>  
>  static int tcg_init(MachineState *ms)
> diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h
> index ecc5c84..7b905b7 100644
> --- a/include/sysemu/accel.h
> +++ b/include/sysemu/accel.h
> @@ -63,7 +63,7 @@ typedef struct AccelClass {
>  #define ACCEL_GET_CLASS(obj) \
>      OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL)
>  
> -extern int tcg_tb_size;
> +extern long tcg_tb_size;
>  
>  void configure_accelerator(MachineState *ms);
>  /* Register accelerator specific global properties */
> diff --git a/vl.c b/vl.c
> index 36ff3f4..f28c1ac 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3933,9 +3933,14 @@ int main(int argc, char **argv, char **envp)
>                  configure_rtc(opts);
>                  break;
>              case QEMU_OPTION_tb_size:
> -                tcg_tb_size = strtol(optarg, NULL, 0);
> -                if (tcg_tb_size < 0) {
> -                    tcg_tb_size = 0;
> +                if (tcg_enabled()) {
> +                    qemu_strtol(optarg, NULL, 0, &tcg_tb_size);
> +                    if (tcg_tb_size < 0) {
> +                        tcg_tb_size = 0;
> +                    }
> +                } else {
> +                    error_report("TCG is disabled");
> +                    exit(1);
>                  }


You could do this without an else-part, leaving the tcg_tb_size code
unmodified:

+                  if (!tcg_enabled()) {
+                      error_report("TCG is disabled");
+                      exit(1);
+                  }
                   tcg_tb_size = strtol(optarg, NULL, 0);
                   if (tcg_tb_size < 0) {
                       tcg_tb_size = 0;

>                  break;
>              case QEMU_OPTION_icount:
> @@ -4481,7 +4486,9 @@ int main(int argc, char **argv, char **envp)
>          qemu_opts_del(icount_opts);
>      }
>  
> -    qemu_tcg_configure(accel_opts, &error_fatal);
> +    if (tcg_enabled()) {
> +        qemu_tcg_configure(accel_opts, &error_fatal);
> +    }
>  
>      if (default_net) {
>          QemuOptsList *net = qemu_find_opts("net");
> 

 Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]