Skip to contentSkip to conversation

vl: Fixes for cleanups to -accel

PATCH Applied Richard Henderson 7 participants 18 messages Jan 9, 2020

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover vl: Fixes for cleanups to -accel

Running qemu-system-foo with no options should not generate a warning for "invalid accelerator bar".

Also, fix some mistakes made while moving the code from accel/accel.c.

r~

Richard Henderson (4):
vl: Remove unused variable in configure_accelerators
vl: Free accel_list in configure_accelerators
vl: Remove useless test in configure_accelerators
vl: Only choose enabled accelerators in configure_accelerators

 vl.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 vl: Remove unused variable in configure_accelerators

The accel_initialised variable no longer has any setters.

Fixes 6f6e1698a68c
---
 vl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
vl.c +1 -2
index 86474a55c9..be79b03c1a 100644
@@ -2749,7 +2749,6 @@ static void configure_accelerators(const char *progname)
 {
     const char *accel;
     char **accel_list, **tmp;
-    bool accel_initialised = false;
     bool init_failed = false;
 
     qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2776,7 +2775,7 @@ static void configure_accelerators(const char *progname)
 
         accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) {
+        for (tmp = accel_list; tmp && *tmp; tmp++) {
             /*
              * Filter invalid accelerators here, to prevent obscenities
              * such as "-machine accel=tcg,,thread=single".
Signature · 1 line
2.20.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] vl: Remove unused variable in configure_accelerators

Quoted 4 lines · Richard Henderson

The accel_initialised variable no longer has any setters.

Fixes 6f6e1698a68c
Quoted 25 lines
---
 vl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
vl.c +1 -2
index 86474a55c9..be79b03c1a 100644
@@ -2749,7 +2749,6 @@ static void configure_accelerators(const char *progname)
 {
     const char *accel;
     char **accel_list, **tmp;
-    bool accel_initialised = false;
     bool init_failed = false;
 
     qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2776,7 +2775,7 @@ static void configure_accelerators(const char *progname)
 
         accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) {
+        for (tmp = accel_list; tmp && *tmp; tmp++) {
             /*
              * Filter invalid accelerators here, to prevent obscenities
              * such as "-machine accel=tcg,,thread=single".
Signature · 1 line
Alex Bennée
#3 lore raw

Re: [PATCH 1/4] vl: Remove unused variable in configure_accelerators

In reply to Richard Henderson
Quoted 9 lines · Richard Henderson

The accel_initialised variable no longer has any setters.

Fixes 6f6e1698a68c
---
 vl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed by: Aleksandar Markovic <[email protected]>

Quoted 28 lines
vl.c +0 -1
index 86474a55c9..be79b03c1a 100644
@@ -2749,7 +2749,6 @@ static void configure_accelerators(const char
 *progname)
 {
     const char *accel;
     char **accel_list, **tmp;
-    bool accel_initialised = false;
     bool init_failed = false;
 

qemu_opts_foreach(qemu_find_opts("icount"),

vl.c +1 -1
@@ -2776,7 +2775,7 @@ static void configure_accelerators(const char
 *progname)
 
         accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) {
+        for (tmp = accel_list; tmp && *tmp; tmp++) {
             /*
              * Filter invalid accelerators here, to prevent obscenities

* such as "-machine accel=tcg,,thread=single".
--
2.20.1

Reviewed-by on v1 1/4
#4 lore raw

Re: [PATCH 1/4] vl: Remove unused variable in configure_accelerators

In reply to Richard Henderson
Quoted 4 lines · Richard Henderson

The accel_initialised variable no longer has any setters.

Fixes 6f6e1698a68c
Quoted 26 lines
---
  vl.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
vl.c +1 -2
index 86474a55c9..be79b03c1a 100644
@@ -2749,7 +2749,6 @@ static void configure_accelerators(const char *progname)
  {
      const char *accel;
      char **accel_list, **tmp;
-    bool accel_initialised = false;
      bool init_failed = false;
 
      qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2776,7 +2775,7 @@ static void configure_accelerators(const char *progname)
 
          accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) {
+        for (tmp = accel_list; tmp && *tmp; tmp++) {
              /*
               * Filter invalid accelerators here, to prevent obscenities
               * such as "-machine accel=tcg,,thread=single".
#5 lore raw

PATCH 2/4 vl: Free accel_list in configure_accelerators

In reply to Richard Henderson

We allocate the list with g_strsplit, so free it too. This freeing was lost during one of the rearrangements.

Fixes 6f6e1698a68c
---
 vl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
vl.c +3 -1
index be79b03c1a..c9329fe699 100644
@@ -2748,7 +2748,6 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
 static void configure_accelerators(const char *progname)
 {
     const char *accel;
-    char **accel_list, **tmp;
     bool init_failed = false;
 
     qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2756,6 +2755,8 @@ static void configure_accelerators(const char *progname)
 
     accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
     if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
+        char **accel_list, **tmp;
+
         if (accel == NULL) {
             /* Select the default accelerator */
             if (!accel_find("tcg") && !accel_find("kvm")) {
@@ -2787,6 +2788,7 @@ static void configure_accelerators(const char *progname)
                 error_report("invalid accelerator %s", *tmp);
             }
         }
+        g_strfreev(accel_list);
     } else {
         if (accel != NULL) {
             error_report("The -accel and \"-machine accel=\" options are incompatible");
Signature · 1 line
2.20.1
#6 lore raw

Re: [PATCH 2/4] vl: Free accel_list in configure_accelerators

Quoted 32 lines · Richard Henderson

We allocate the list with g_strsplit, so free it too. This freeing was lost during one of the rearrangements.

Fixes 6f6e1698a68c
---
 vl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
vl.c +2 -1
index be79b03c1a..c9329fe699 100644
@@ -2748,7 +2748,6 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
 static void configure_accelerators(const char *progname)
 {
     const char *accel;
-    char **accel_list, **tmp;
     bool init_failed = false;
 
     qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2756,6 +2755,8 @@ static void configure_accelerators(const char *progname)
 
     accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
     if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
+        char **accel_list, **tmp;
+
         if (accel == NULL) {
             /* Select the default accelerator */
             if (!accel_find("tcg") && !accel_find("kvm")) {

vl.c static void configure_accelerators(const char *progname) · line 2794

Quoted 7 lines
vl.c +1 -0
@@ -2787,6 +2788,7 @@ static void configure_accelerators(const char *progname)
                 error_report("invalid accelerator %s", *tmp);
             }
         }
+        g_strfreev(accel_list);
     } else {
         if (accel != NULL) {
             error_report("The -accel and \"-machine accel=\" options are incompatible");

FYI, a fix for this is already part of Laurent's "Trivial branch patches" PULL request from yesterday.

Thomas

#7 lore raw

Re: [PATCH 2/4] vl: Free accel_list in configure_accelerators

Quoted 35 lines · Thomas Huth
Quoted 34 lines · Richard Henderson

We allocate the list with g_strsplit, so free it too. This freeing was lost during one of the rearrangements.

Fixes 6f6e1698a68c
---
 vl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
vl.c +2 -1
index be79b03c1a..c9329fe699 100644
@@ -2748,7 +2748,6 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
 static void configure_accelerators(const char *progname)
 {
     const char *accel;
-    char **accel_list, **tmp;
     bool init_failed = false;
 
     qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2756,6 +2755,8 @@ static void configure_accelerators(const char *progname)
 
     accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
     if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
+        char **accel_list, **tmp;
+
         if (accel == NULL) {
             /* Select the default accelerator */
             if (!accel_find("tcg") && !accel_find("kvm")) {
@@ -2787,6 +2788,7 @@ static void configure_accelerators(const char *progname)
                 error_report("invalid accelerator %s", *tmp);
             }
         }
Quoted 8 lines

vl.c static void configure_accelerators(const char *progname) · line 2794

Quoted 5 lines
vl.c +1 -0
+        g_strfreev(accel_list);
     } else {
         if (accel != NULL) {
             error_report("The -accel and \"-machine accel=\" options are incompatible");

FYI, a fix for this is already part of Laurent's "Trivial branch patches" PULL request from yesterday.

https://patchew.org/QEMU/[email protected]/[email protected]/

Thanks,
Laurent

#8 lore raw

PATCH 2/4 vl: Free accel_list in configure_accelerators

Quoted 43 lines · Laurent Vivier
Quoted 10 lines · Thomas Huth
Quoted 9 lines · Richard Henderson

We allocate the list with g_strsplit, so free it too. This freeing was lost during one of the rearrangements.

Fixes 6f6e1698a68c
---
 vl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 5 lines

vl.c static int do_configure_accelerator(void *opaque,

Quoted 5 lines
vl.c +0 -0
index be79b03c1a..c9329fe699 100644
@@ -2748,7 +2748,6 @@ static int do_configure_accelerator(void *opaque,

QemuOpts *opts, Error **errp)

Quoted 8 lines

vl.c static void configure_accelerators(const char

Quoted 8 lines
vl.c +0 -1
 static void configure_accelerators(const char *progname)
 {
     const char *accel;
-    char **accel_list, **tmp;
     bool init_failed = false;
 
     qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2756,6 +2755,8 @@ static void configure_accelerators(const char

*progname)

Quoted 9 lines

vl.c static void configure_accelerators(const char

Quoted 9 lines
vl.c +2 -0
     accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
     if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
+        char **accel_list, **tmp;
+
         if (accel == NULL) {
             /* Select the default accelerator */
             if (!accel_find("tcg") && !accel_find("kvm")) {
@@ -2787,6 +2788,7 @@ static void configure_accelerators(const char

*progname)

Quoted 7 lines

vl.c static void configure_accelerators(const char *progname)

Quoted 7 lines
vl.c +1 -0
                 error_report("invalid accelerator %s", *tmp);
             }
         }
+        g_strfreev(accel_list);
     } else {
         if (accel != NULL) {
             error_report("The -accel and \"-machine accel=\" options
Quoted 10 lines

are incompatible");

Quoted 4 lines
Quoted 1 line

FYI, a fix for this is already part of Laurent's "Trivial branch patches" PULL request from yesterday.

https://patchew.org/QEMU/20200108160233.991134-1-laurent@
vivier.eu/[email protected]/

If this (from Laurent's PR) patch is merged, Richard could transform his patch into "vl: Fix the scope of variables accel_list and tmp in configure_accelerator()" in v2.

Whatever happens:

Reviewed by: Aleksandar Markovic <[email protected]>

Quoted 5 lines

Thanks,
Laurent

Reviewed-by on v1 2/4
#9 lore raw

Re: [PATCH 2/4] vl: Free accel_list in configure_accelerators

In reply to Richard Henderson
Quoted 5 lines · Richard Henderson

We allocate the list with g_strsplit, so free it too. This freeing was lost during one of the rearrangements.

Fixes 6f6e1698a68c
Quoted 33 lines
---
 vl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
vl.c +3 -1
index be79b03c1a..c9329fe699 100644
@@ -2748,7 +2748,6 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
 static void configure_accelerators(const char *progname)
 {
     const char *accel;
-    char **accel_list, **tmp;
     bool init_failed = false;
 
     qemu_opts_foreach(qemu_find_opts("icount"),
@@ -2756,6 +2755,8 @@ static void configure_accelerators(const char *progname)
 
     accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
     if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
+        char **accel_list, **tmp;
+
         if (accel == NULL) {
             /* Select the default accelerator */
             if (!accel_find("tcg") && !accel_find("kvm")) {
@@ -2787,6 +2788,7 @@ static void configure_accelerators(const char *progname)
                 error_report("invalid accelerator %s", *tmp);
             }
         }
+        g_strfreev(accel_list);
     } else {
         if (accel != NULL) {
             error_report("The -accel and \"-machine accel=\" options are incompatible");
Signature · 1 line
Alex Bennée
#10 lore raw

PATCH 3/4 vl: Remove useless test in configure_accelerators

In reply to Richard Henderson

The result of g_strsplit is never NULL.

---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +1 -1
index c9329fe699..887dbfbb5d 100644
@@ -2776,7 +2776,7 @@ static void configure_accelerators(const char *progname)
 
         accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; tmp && *tmp; tmp++) {
+        for (tmp = accel_list; *tmp; tmp++) {
             /*
              * Filter invalid accelerators here, to prevent obscenities
              * such as "-machine accel=tcg,,thread=single".
Signature · 1 line
2.20.1
Reviewed-by on v1 3/4
#11 lore raw

Re: [PATCH 3/4] vl: Remove useless test in configure_accelerators

Quoted 3 lines · Richard Henderson

The result of g_strsplit is never NULL.

Quoted 17 lines
---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +1 -1
index c9329fe699..887dbfbb5d 100644
@@ -2776,7 +2776,7 @@ static void configure_accelerators(const char *progname)
 
         accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; tmp && *tmp; tmp++) {
+        for (tmp = accel_list; *tmp; tmp++) {
             /*
              * Filter invalid accelerators here, to prevent obscenities
              * such as "-machine accel=tcg,,thread=single".
Signature · 1 line
Alex Bennée
#12 lore raw

Re: [PATCH 3/4] vl: Remove useless test in configure_accelerators

In reply to Richard Henderson
Quoted 8 lines · Richard Henderson

The result of g_strsplit is never NULL.

---
 vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed by: Aleksandar Markovic <[email protected]>

Quoted 19 lines
vl.c +1 -1
index c9329fe699..887dbfbb5d 100644
@@ -2776,7 +2776,7 @@ static void configure_accelerators(const char
 *progname)
 
         accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; tmp && *tmp; tmp++) {
+        for (tmp = accel_list; *tmp; tmp++) {
             /*
              * Filter invalid accelerators here, to prevent obscenities

* such as "-machine accel=tcg,,thread=single".
--
2.20.1

Reviewed-by on v1 3/4
#13 lore raw

Re: [PATCH 3/4] vl: Remove useless test in configure_accelerators

In reply to Richard Henderson
Quoted 13 lines · Richard Henderson

The result of g_strsplit is never NULL.

---
  vl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
vl.c +0 -0
index c9329fe699..887dbfbb5d 100644

vl.c static void configure_accelerators(const char *progname) · line 2782

Quoted 8 lines
vl.c +1 -1
@@ -2776,7 +2776,7 @@ static void configure_accelerators(const char *progname)
 
          accel_list = g_strsplit(accel, ":", 0);
 
-        for (tmp = accel_list; tmp && *tmp; tmp++) {
+        for (tmp = accel_list; *tmp; tmp++) {
              /*
               * Filter invalid accelerators here, to prevent obscenities
               * such as "-machine accel=tcg,,thread=single".
#14 lore raw

PATCH 4/4 vl: Only choose enabled accelerators in configure_accelerators

In reply to Richard Henderson

By choosing "tcg:kvm" when kvm is not enabled, we generate an incorrect warning: "invalid accelerator kvm".

Presumably the inverse is also true with --disable-tcg.

Fixes 28a0961757fc
---
 vl.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
vl.c +12 -6
index 887dbfbb5d..9b7651c80d 100644
@@ -2759,11 +2759,10 @@ static void configure_accelerators(const char *progname)
 
         if (accel == NULL) {
             /* Select the default accelerator */
-            if (!accel_find("tcg") && !accel_find("kvm")) {
-                error_report("No accelerator selected and"
-                             " no default accelerator available");
-                exit(1);
-            } else {
+            bool have_tcg = accel_find("tcg");
+            bool have_kvm = accel_find("kvm");
+
+            if (have_tcg && have_kvm) {
                 int pnlen = strlen(progname);
                 if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
                     /* If the program name ends with "kvm", we prefer KVM */
@@ -2771,9 +2770,16 @@ static void configure_accelerators(const char *progname)
                 } else {
                     accel = "tcg:kvm";
                 }
+            } else if (have_kvm) {
+                accel = "kvm";
+            } else if (have_tcg) {
+                accel = "tcg";
+            } else {
+                error_report("No accelerator selected and"
+                             " no default accelerator available");
+                exit(1);
             }
         }
-
         accel_list = g_strsplit(accel, ":", 0);
 
         for (tmp = accel_list; *tmp; tmp++) {
Signature · 1 line
2.20.1
Reviewed-by on v1 4/4
#15 lore raw

Re: [PATCH 4/4] vl: Only choose enabled accelerators in configure_accelerators

Quoted 21 lines · Richard Henderson

By choosing "tcg:kvm" when kvm is not enabled, we generate an incorrect warning: "invalid accelerator kvm".

Presumably the inverse is also true with --disable-tcg.

Fixes 28a0961757fc
---
 vl.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
vl.c +0 -2
index 887dbfbb5d..9b7651c80d 100644
@@ -2759,11 +2759,10 @@ static void configure_accelerators(const char *progname)
 
         if (accel == NULL) {
             /* Select the default accelerator */
-            if (!accel_find("tcg") && !accel_find("kvm")) {
-                error_report("No accelerator selected and"

vl.c static void configure_accelerators(const char *progname) · line 2768

Quoted 10 lines
vl.c +4 -3
-                             " no default accelerator available");
-                exit(1);
-            } else {
+            bool have_tcg = accel_find("tcg");
+            bool have_kvm = accel_find("kvm");
+
+            if (have_tcg && have_kvm) {
                 int pnlen = strlen(progname);
                 if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3],
         "kvm")) {

I know you're not touching this bit but:

modified vl.c
@@ -2763,8 +2763,7 @@ static void configure_accelerators(const char *progname)

             bool have_kvm = accel_find("kvm");
 
             if (have_tcg && have_kvm) {
-                int pnlen = strlen(progname);
-                if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
+                if (g_str_has_suffix(progname, "kvm")) {
                     /* If the program name ends with "kvm", we prefer KVM */
                     accel = "kvm:tcg";
                 } else {
Quoted 9 lines
                     /* If the program name ends with "kvm", we prefer KVM */
vl.c +4 -0
@@ -2771,9 +2770,16 @@ static void configure_accelerators(const char *progname)
                 } else {
                     accel = "tcg:kvm";
                 }
+            } else if (have_kvm) {
+                accel = "kvm";
+            } else if (have_tcg) {
+                accel = "tcg";

vl.c static void configure_accelerators(const char *progname) · line 2785

Quoted 10 lines
vl.c +4 -1
+            } else {
+                error_report("No accelerator selected and"
+                             " no default accelerator available");
+                exit(1);
             }
         }
-
         accel_list = g_strsplit(accel, ":", 0);
 
         for (tmp = accel_list; *tmp; tmp++) {

Anyway:

Signature · 1 line
Alex Bennée
#16 lore raw

PATCH 4/4 vl: Only choose enabled accelerators in configure_accelerators

Quoted 74 lines · Alex Bennée

vl.c static void configure_accelerators(const char

Quoted 16 lines · Richard Henderson

By choosing "tcg:kvm" when kvm is not enabled, we generate an incorrect warning: "invalid accelerator kvm".

Presumably the inverse is also true with --disable-tcg.

Fixes 28a0961757fc
---
 vl.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
vl.c +0 -0
index 887dbfbb5d..9b7651c80d 100644
@@ -2759,11 +2759,10 @@ static void configure_accelerators(const char

*progname)

Quoted 5 lines
vl.c +0 -2
         if (accel == NULL) {
             /* Select the default accelerator */
-            if (!accel_find("tcg") && !accel_find("kvm")) {
-                error_report("No accelerator selected and"

vl.c static void configure_accelerators(const char *progname)

Quoted 10 lines
vl.c +4 -3
-                             " no default accelerator available");
-                exit(1);
-            } else {
+            bool have_tcg = accel_find("tcg");
+            bool have_kvm = accel_find("kvm");
+
+            if (have_tcg && have_kvm) {
                 int pnlen = strlen(progname);
                 if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3],
         "kvm")) {

I know you're not touching this bit but:

modified vl.c

(quoted diff) +1 -2
@@ -2763,8 +2763,7 @@ static void configure_accelerators(const char
 *progname)
             bool have_kvm = accel_find("kvm");
 
             if (have_tcg && have_kvm) {
-                int pnlen = strlen(progname);
-                if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3],
 "kvm")) {
+                if (g_str_has_suffix(progname, "kvm")) {
                     /* If the program name ends with "kvm", we prefer KVM

*/

                     accel = "kvm:tcg";
                 } else {

vl.c static void configure_accelerators(const char · line 2768

Quoted 1 line
vl.c +0 -0
                     /* If the program name ends with "kvm", we prefer

KVM */

vl.c static void configure_accelerators(const char

Quoted 1 line
vl.c +0 -0
@@ -2771,9 +2770,16 @@ static void configure_accelerators(const char

*progname)

Quoted 16 lines
vl.c +8 -1
                 } else {
                     accel = "tcg:kvm";
                 }
+            } else if (have_kvm) {
+                accel = "kvm";
+            } else if (have_tcg) {
+                accel = "tcg";
+            } else {
+                error_report("No accelerator selected and"
+                             " no default accelerator available");
+                exit(1);
             }
         }
-
         accel_list = g_strsplit(accel, ":", 0);
 
Quoted 7 lines

vl.c static void configure_accelerators(const char *progname) · line 2785

Quoted 1 line
vl.c +0 -0
         for (tmp = accel_list; *tmp; tmp++) {

Anyway:

With or without Alex' hint:

Reviewed by: Aleksandar Markovic <[email protected]>

Alex' hint could be a separate patch. If you decide to do it, for that patch too you can include my r-b.

Quoted 3 lines

Alex Bennée

Acked-by on the v1 series Applied
#17 lore raw
In reply to Richard Henderson
Quoted 9 lines · Richard Henderson

Running qemu-system-foo with no options should not generate a warning for "invalid accelerator bar".

Also, fix some mistakes made while moving the code from accel/accel.c.

r~

Quoted 9 lines

Richard Henderson (4):
vl: Remove unused variable in configure_accelerators
vl: Free accel_list in configure_accelerators
vl: Remove useless test in configure_accelerators
vl: Only choose enabled accelerators in configure_accelerators

 vl.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

I've queued it, but feel free to beat me to sending a pull request.

Paolo