[07/16] vl: warn for unavailable accelerators, clarify messages
diff mbox series

Message ID 1573655945-14912-8-git-send-email-pbonzini@redhat.com
State New
Headers show
Series
  • Complete the implementation of -accel
Related show

Commit Message

Paolo Bonzini Nov. 13, 2019, 2:38 p.m. UTC
So far, specifying an accelerator that was not compiled in did not result
in an error; fix that.

While at it, clarify the mysterious "Back to TCG" message.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 vl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Marc-André Lureau Nov. 14, 2019, 9:28 a.m. UTC | #1
Hi

On Wed, Nov 13, 2019 at 6:39 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> So far, specifying an accelerator that was not compiled in did not result
> in an error; fix that.
>
> While at it, clarify the mysterious "Back to TCG" message.

I was wondering why this was not addressed in previous patch :)

>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  vl.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/vl.c b/vl.c
> index dd895db..843b263 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2853,6 +2853,8 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
>      int ret;
>
>      if (!ac) {
> +        *p_init_failed = true;
> +        error_report("invalid accelerator %s", acc);
>          return 0;
>      }
>      ret = accel_init_machine(ac, current_machine);
> @@ -2907,6 +2909,9 @@ static void configure_accelerators(const char *progname)
>               */
>              if (accel_find(*tmp)) {
>                  qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, true);
> +            } else {
> +                init_failed = true;
> +                error_report("invalid accelerator %s", *tmp);
>              }
>          }
>      } else {
> @@ -2926,7 +2931,7 @@ static void configure_accelerators(const char *progname)
>
>      if (init_failed) {
>          AccelClass *ac = ACCEL_GET_CLASS(current_machine->accelerator);
> -        error_report("Back to %s accelerator", ac->name);
> +        error_report("falling back to %s", ac->name);
>      }
>
>      if (!tcg_enabled() && use_icount) {
> --
> 1.8.3.1
>
>
>

Patch
diff mbox series

diff --git a/vl.c b/vl.c
index dd895db..843b263 100644
--- a/vl.c
+++ b/vl.c
@@ -2853,6 +2853,8 @@  static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
     int ret;
 
     if (!ac) {
+        *p_init_failed = true;
+        error_report("invalid accelerator %s", acc);
         return 0;
     }
     ret = accel_init_machine(ac, current_machine);
@@ -2907,6 +2909,9 @@  static void configure_accelerators(const char *progname)
              */
             if (accel_find(*tmp)) {
                 qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, true);
+            } else {
+                init_failed = true;
+                error_report("invalid accelerator %s", *tmp);
             }
         }
     } else {
@@ -2926,7 +2931,7 @@  static void configure_accelerators(const char *progname)
 
     if (init_failed) {
         AccelClass *ac = ACCEL_GET_CLASS(current_machine->accelerator);
-        error_report("Back to %s accelerator", ac->name);
+        error_report("falling back to %s", ac->name);
     }
 
     if (!tcg_enabled() && use_icount) {