Skip to contentSkip to conversation

handle device help before accelerator set up

PATCH Superseded Bruce Rogers 2 participants 2 messages Aug 9, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 handle device help before accelerator set up

A command line device probe using just -device "?" gets processed after qemu-kvm initializes the accelerator. If /dev/kvm is not present, the accelerator check will fail (kvm is defaulted to on), which causes libvirt to not be set up to handle qemu guests.

Moving the device help handling before the accelerator set up allows the device probe to work in this configuration and libvirt succeeds in setting up for a qemu hypervisor mode.

---
 vl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
vl.c +3 -3
index e71cb30..205b924 100644
@@ -3345,6 +3345,9 @@ int main(int argc, char **argv, char **envp)
         ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
     }
 
+    if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0)
+        exit(0);
+
     configure_accelerator();
 
     qemu_init_cpu_loop();
@@ -3500,9 +3503,6 @@ int main(int argc, char **argv, char **envp)
     }
     select_vgahw(vga_model);
 
-    if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0)
-        exit(0);
-
     if (watchdog) {
         i = select_watchdog(watchdog);
         if (i > 0)
Signature · 1 line
1.7.7
#1 lore raw
Quoted 19 lines · Bruce Rogers

A command line device probe using just -device "?" gets processed after qemu-kvm initializes the accelerator. If /dev/kvm is not present, the accelerator check will fail (kvm is defaulted to on), which causes libvirt to not be set up to handle qemu guests.

Moving the device help handling before the accelerator set up allows the device probe to work in this configuration and libvirt succeeds in setting up for a qemu hypervisor mode.

---
 vl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
vl.c +0 -0
index e71cb30..205b924 100644

vl.c int main(int argc, char **argv, char **envp) · line 3349

Quoted 5 lines
vl.c +2 -0
@@ -3345,6 +3345,9 @@ int main(int argc, char **argv, char **envp)
         ram_size = DEFAULT_RAM_SIZE * 1024 * 1024;
     }
 
+    if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0)
+        exit(0);

Missing braces, please read CODING_STYLE.

Quoted 18 lines
vl.c +1 -4
+
     configure_accelerator();
 
     qemu_init_cpu_loop();
@@ -3500,9 +3503,6 @@ int main(int argc, char **argv, char **envp)
     }
     select_vgahw(vga_model);
 
-    if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func, NULL, 0) != 0)
-        exit(0);
-
     if (watchdog) {
         i = select_watchdog(watchdog);
         if (i > 0)
--

1.7.7