Skip to contentSkip to conversation

spapr: skip adding usb keyboard/mouse in case of -nodefaults

PATCH In review Nikunj A Dadhania 5 participants 20 messages Apr 3, 2014 – Apr 4, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr: skip adding usb keyboard/mouse in case of -nodefaults

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

CC Paolo Bonzini <[email protected]>
CC Mark Wu <[email protected]>
CC Andreas Färber <[email protected]>
---
 hw/ppc/spapr.c          |  6 +++++-
 include/sysemu/sysemu.h |  1 +
 vl.c                    | 10 ++++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)
hw/ppc/spapr.c +5 -1
index a11e121..3095626 100644
@@ -1328,7 +1328,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 
     if (usb_enabled(spapr->has_graphics)) {
         pci_create_simple(phb->bus, -1, "pci-ohci");
-        if (spapr->has_graphics) {
+        /*
+         * For VGA/VNC, by default add usb keyboard/mouse, if -nodefaults
+         * provided skip adding usb keyboard/mouse
+         */
+        if (spapr->has_graphics && qemu_has_defaults()) {
             usbdevice_create("keyboard");
             usbdevice_create("mouse");
         }
include/sysemu/sysemu.h +1 -0
index ba5c7f8..8e90ad0 100644
@@ -200,6 +200,7 @@ DeviceState *get_boot_device(uint32_t position);
 QemuOpts *qemu_get_machine_opts(void);
 
 bool usb_enabled(bool default_usb);
+bool qemu_has_defaults(void);
 
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
vl.c +8 -2
index 9975e5a..6bf37a2 100644
@@ -977,8 +977,14 @@ static void parse_name(QemuOpts *opts)
 
 bool usb_enabled(bool default_usb)
 {
-    return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
-                             has_defaults && default_usb);
+  return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
+			   has_defaults && default_usb);
+}
+
+bool qemu_has_defaults(void)
+{
+  fprintf(stderr, "has_d %d\n", has_defaults);
+  return has_defaults;
 }
 
 #ifndef _WIN32
Signature · 1 line
1.8.3.1
#1 lore raw

Am 03.04.2014 18:56, schrieb Nikunj A Dadhania:

Quoted 56 lines

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

CC Paolo Bonzini <[email protected]>
CC Mark Wu <[email protected]>
CC Andreas Färber <[email protected]>
---
 hw/ppc/spapr.c          |  6 +++++-
 include/sysemu/sysemu.h |  1 +
 vl.c                    | 10 ++++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)
hw/ppc/spapr.c +5 -1
index a11e121..3095626 100644
@@ -1328,7 +1328,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 
     if (usb_enabled(spapr->has_graphics)) {
         pci_create_simple(phb->bus, -1, "pci-ohci");
-        if (spapr->has_graphics) {
+        /*
+         * For VGA/VNC, by default add usb keyboard/mouse, if -nodefaults
+         * provided skip adding usb keyboard/mouse
+         */
+        if (spapr->has_graphics && qemu_has_defaults()) {
             usbdevice_create("keyboard");
             usbdevice_create("mouse");
         }
include/sysemu/sysemu.h +1 -0
index ba5c7f8..8e90ad0 100644
@@ -200,6 +200,7 @@ DeviceState *get_boot_device(uint32_t position);
 QemuOpts *qemu_get_machine_opts(void);
 
 bool usb_enabled(bool default_usb);
+bool qemu_has_defaults(void);
 
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
vl.c +0 -0
index 9975e5a..6bf37a2 100644
@@ -977,8 +977,14 @@ static void parse_name(QemuOpts *opts)
 
 bool usb_enabled(bool default_usb)

vl.c static void parse_name(QemuOpts *opts) · line 986

Quoted 10 lines
vl.c +7 -2
 {
-    return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
-                             has_defaults && default_usb);
+  return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
+			   has_defaults && default_usb);
+}
+
+bool qemu_has_defaults(void)
+{
+  fprintf(stderr, "has_d %d\n", has_defaults);

Debugging leftover surely?

Cheers,
Andreas

Quoted 5 lines
vl.c +1 -0
+  return has_defaults;
 }
 
 #ifndef _WIN32
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
Quoted 56 lines · Andreas Färber

Am 03.04.2014 18:56, schrieb Nikunj A Dadhania:

Quoted 55 lines

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

CC Paolo Bonzini <[email protected]>
CC Mark Wu <[email protected]>
CC Andreas Färber <[email protected]>
---
 hw/ppc/spapr.c          |  6 +++++-
 include/sysemu/sysemu.h |  1 +
 vl.c                    | 10 ++++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)
hw/ppc/spapr.c +5 -1
index a11e121..3095626 100644
@@ -1328,7 +1328,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 
     if (usb_enabled(spapr->has_graphics)) {
         pci_create_simple(phb->bus, -1, "pci-ohci");
-        if (spapr->has_graphics) {
+        /*
+         * For VGA/VNC, by default add usb keyboard/mouse, if -nodefaults
+         * provided skip adding usb keyboard/mouse
+         */
+        if (spapr->has_graphics && qemu_has_defaults()) {
             usbdevice_create("keyboard");
             usbdevice_create("mouse");
         }
include/sysemu/sysemu.h +1 -0
index ba5c7f8..8e90ad0 100644
@@ -200,6 +200,7 @@ DeviceState *get_boot_device(uint32_t position);
 QemuOpts *qemu_get_machine_opts(void);
 
 bool usb_enabled(bool default_usb);
+bool qemu_has_defaults(void);
 
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
vl.c +0 -0
index 9975e5a..6bf37a2 100644
@@ -977,8 +977,14 @@ static void parse_name(QemuOpts *opts)
 
Quoted 13 lines

vl.c static void parse_name(QemuOpts *opts) · line 986

Quoted 11 lines
vl.c +7 -2
 bool usb_enabled(bool default_usb)
 {
-    return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
-                             has_defaults && default_usb);
+  return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
+			   has_defaults && default_usb);
+}
+
+bool qemu_has_defaults(void)
+{
+  fprintf(stderr, "has_d %d\n", has_defaults);

Debugging leftover surely?

Yes, you were too fast, i have sent updated mail just now.

Thanks
Nikunj

#3 lore raw
In reply to Nikunj A Dadhania

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

CC Paolo Bonzini <[email protected]>
CC Mark Wu <[email protected]>
CC Andreas Färber <[email protected]>

---

Removed the debug statement and fixed indentation breakage:

 hw/ppc/spapr.c          | 6 +++++-
 include/sysemu/sysemu.h | 1 +
 vl.c                    | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +5 -1
index a11e121..3095626 100644
@@ -1328,7 +1328,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 
     if (usb_enabled(spapr->has_graphics)) {
         pci_create_simple(phb->bus, -1, "pci-ohci");
-        if (spapr->has_graphics) {
+        /*
+         * For VGA/VNC, by default add usb keyboard/mouse, if -nodefaults
+         * provided skip adding usb keyboard/mouse
+         */
+        if (spapr->has_graphics && qemu_has_defaults()) {
             usbdevice_create("keyboard");
             usbdevice_create("mouse");
         }
include/sysemu/sysemu.h +1 -0
index ba5c7f8..8e90ad0 100644
@@ -200,6 +200,7 @@ DeviceState *get_boot_device(uint32_t position);
 QemuOpts *qemu_get_machine_opts(void);
 
 bool usb_enabled(bool default_usb);
+bool qemu_has_defaults(void);
 
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
vl.c +5 -0
index 9975e5a..4d5832c 100644
@@ -981,6 +981,11 @@ bool usb_enabled(bool default_usb)
                              has_defaults && default_usb);
 }
 
+bool qemu_has_defaults(void)
+{
+    return has_defaults;
+}
+
 #ifndef _WIN32
 static int parse_add_fd(QemuOpts *opts, void *opaque)
 {
Signature · 1 line
1.8.3.1
Reviewed-by
#4 lore raw

Am 03.04.2014 19:06, schrieb Nikunj A Dadhania:

Quoted 11 lines

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

Quoted 4 lines
CC Paolo Bonzini <[email protected]>
CC Mark Wu <[email protected]>
CC Andreas Färber <[email protected]>

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw
In reply to Nikunj A Dadhania
Quoted 59 lines · Nikunj A Dadhania

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

CC Paolo Bonzini <[email protected]>
CC Mark Wu <[email protected]>
CC Andreas Färber <[email protected]>

---

Removed the debug statement and fixed indentation breakage:

 hw/ppc/spapr.c          | 6 +++++-
 include/sysemu/sysemu.h | 1 +
 vl.c                    | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)
hw/ppc/spapr.c +5 -1
index a11e121..3095626 100644
@@ -1328,7 +1328,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 
     if (usb_enabled(spapr->has_graphics)) {
         pci_create_simple(phb->bus, -1, "pci-ohci");
-        if (spapr->has_graphics) {
+        /*
+         * For VGA/VNC, by default add usb keyboard/mouse, if -nodefaults
+         * provided skip adding usb keyboard/mouse
+         */
+        if (spapr->has_graphics && qemu_has_defaults()) {
             usbdevice_create("keyboard");
             usbdevice_create("mouse");
         }
include/sysemu/sysemu.h +1 -0
index ba5c7f8..8e90ad0 100644
@@ -200,6 +200,7 @@ DeviceState *get_boot_device(uint32_t position);
 QemuOpts *qemu_get_machine_opts(void);
 
 bool usb_enabled(bool default_usb);
+bool qemu_has_defaults(void);
 
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
vl.c +0 -0
index 9975e5a..4d5832c 100644
@@ -981,6 +981,11 @@ bool usb_enabled(bool default_usb)
                              has_defaults && default_usb);

vl.c bool usb_enabled(bool default_usb) · line 991

Quoted 10 lines
vl.c +5 -0
 }
 
+bool qemu_has_defaults(void)
+{
+    return has_defaults;
+}
+
 #ifndef _WIN32
 static int parse_add_fd(QemuOpts *opts, void *opaque)
 {

Have you considered extending QEMUMachineInitArgs instead of adding this function?

#6 lore raw
Quoted 4 lines · Markus Armbruster

Nikunj A Dadhania <[email protected]> writes:

Have you considered extending QEMUMachineInitArgs instead of adding this function?

Did not think of this option earlier. You mean doing something like this?

hw/ppc/spapr.c +6 -1
index 3a13231..936a17f 100644
@@ -1410,6 +1410,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
     const char *kernel_cmdline = args->kernel_cmdline;
     const char *initrd_filename = args->initrd_filename;
     const char *boot_device = args->boot_device;
+    unsigned int has_defaults = args->has_defaults;
     PowerPCCPU *cpu;
     CPUPPCState *env;
     PCIHostState *phb;
@@ -1605,7 +1606,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 
     if (usb_enabled(spapr->has_graphics)) {
         pci_create_simple(phb->bus, -1, "pci-ohci");
-        if (spapr->has_graphics) {
+        /*
+         * For VGA/VNC, by default add usb keyboard/mouse, if -nodefaults
+         * provided skip adding usb keyboard/mouse
+         */
+        if (spapr->has_graphics && has_defaults) {
             usbdevice_create("keyboard");
             usbdevice_create("mouse");
         }
include/hw/boards.h +1 -0
index b1d4e9f..ee81ddf 100644
@@ -16,6 +16,7 @@ typedef struct QEMUMachineInitArgs {
     const char *kernel_cmdline;
     const char *initrd_filename;
     const char *cpu_model;
+    unsigned int has_defaults;
 } QEMUMachineInitArgs;
 
 typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
vl.c +2 -1
index 017f92d..0d6c36c 100644
@@ -4348,7 +4348,8 @@ int main(int argc, char **argv, char **envp)
                                  .kernel_filename = kernel_filename,
                                  .kernel_cmdline = kernel_cmdline,
                                  .initrd_filename = initrd_filename,
-                                 .cpu_model = cpu_model };
+                                 .cpu_model = cpu_model,
+                                 .has_defaults = has_defaults, };
     machine->init(&args);
 
     audio_init();
#7 lore raw
Quoted 8 lines · Nikunj A Dadhania
Quoted 4 lines · Markus Armbruster

Nikunj A Dadhania <[email protected]> writes:

Have you considered extending QEMUMachineInitArgs instead of adding this function?

Did not think of this option earlier. You mean doing something like this?

Yes. Looks nicer, doesn't it?

#8 lore raw

Il 04/04/2014 12:58, Markus Armbruster ha scritto:

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Have you considered extending QEMUMachineInitArgs instead of adding this function?

Did not think of this option earlier. You mean doing something like this?

Yes. Looks nicer, doesn't it?

I still think it's a libvirt bug. Mixing -nodefaults and -usb and -device is looking for trouble I think. "-usb" is a do-what-I-mean kind of option and it makes sense for it to add a keyboard and mouse, even with -nodefaults.

Paolo

#9 lore raw
Quoted 5 lines · Paolo Bonzini

Il 04/04/2014 12:58, Markus Armbruster ha scritto:

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

Have you considered extending QEMUMachineInitArgs instead of adding this function?

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

Did not think of this option earlier. You mean doing something like this?

Yes. Looks nicer, doesn't it?

I still think it's a libvirt bug. Mixing -nodefaults and -usb and -device is looking for trouble I think. "-usb" is a do-what-I-mean kind of option and it makes sense for it to add a keyboard and mouse, even with -nodefaults.

I agree that management tools should not use -usb, except when they want to manage ancient versions of QEMU for some reason.

#10 lore raw

[adding libvir-list]

Quoted 11 lines · Markus Armbruster
Quoted 9 lines · Paolo Bonzini

Il 04/04/2014 12:58, Markus Armbruster ha scritto:

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Have you considered extending QEMUMachineInitArgs instead of adding this function?

Did not think of this option earlier. You mean doing something like this?

Yes. Looks nicer, doesn't it?

Quoted 7 lines
Quoted 4 lines

I still think it's a libvirt bug. Mixing -nodefaults and -usb and -device is looking for trouble I think. "-usb" is a do-what-I-mean kind of option and it makes sense for it to add a keyboard and mouse, even with -nodefaults.

I agree that management tools should not use -usb, except when they want to manage ancient versions of QEMU for some reason.

We've tried to make libvirt avoid -usb when it knows it is targetting a new enough qemu. But I'm not the one most familiar with that code. At this point, I'm just trying to facilitate discussions, and make sure the right people are looking at this - what versions of qemu vs. libvirt have you tested, and what does libvirt still need to patch to avoid -usb, and/or qemu patch so that libvirt can correctly probe that -usb is not needed?

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#11 lore raw
In reply to Nikunj A Dadhania

Am 04.04.2014 10:28, schrieb Nikunj A Dadhania:

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

Quoted 11 lines
vl.c +2 -1
index 017f92d..0d6c36c 100644
@@ -4348,7 +4348,8 @@ int main(int argc, char **argv, char **envp)
                                  .kernel_filename = kernel_filename,
                                  .kernel_cmdline = kernel_cmdline,
                                  .initrd_filename = initrd_filename,
-                                 .cpu_model = cpu_model };
+                                 .cpu_model = cpu_model,
+                                 .has_defaults = has_defaults, };

If we do this, please put

       };

on the next line so that the next person appending something doesn't need to touch it again. :)

I do agree with the others that libvirt shouldn't be using the legacy -usb option.

Cheers,
Andreas

Quoted 3 lines
vl.c +0 -0
     machine->init(&args);
 
     audio_init();
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#12 lore raw
In reply to Nikunj A Dadhania

Il 03/04/2014 18:56, Nikunj A Dadhania ha scritto:

Quoted 9 lines

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

Does libvirt use "-nodefaults -machine usb=true"? It should create the OHCI controller separately instead of using "-machine".

Paolo

#13 lore raw
Quoted 10 lines · Paolo Bonzini

Il 03/04/2014 18:56, Nikunj A Dadhania ha scritto:

Quoted 9 lines

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

s/Mouses/Mice/

Quoted 3 lines

Does libvirt use "-nodefaults -machine usb=true"? It should create the OHCI controller separately instead of using "-machine".

At least with x86 emulation, libvirt prefers '-nodefaults -machine usb=off -device piix3-usb-uhci'; so I'm assuming libvirt knows how to directly create the USB devices it needs.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#14 lore raw
In reply to Paolo Bonzini
Quoted 6 lines · Paolo Bonzini

Il 03/04/2014 18:56, Nikunj A Dadhania ha scritto:

Quoted 5 lines

The following commit caused the regression in qemu-system-ppc64

7effdaa3: spapr: Fix return value of vga initialization
d44229c5: Fix vga_interface_type for command line argument '-device VGA'

Quoted 7 lines
Quoted 4 lines

Even when -nodefaults was provided, USB Keyboard and Mouse was added to the machine. This breaks libvirt which uses -nodefaults and adds the keyboard and mouse separately. The machine got 2 USB Keyboards and 2 USB Mouses.

Does libvirt use "-nodefaults -machine usb=true"? It should create the OHCI controller separately instead of using "-machine".

I see it creating:

-nodefaults -usb -device usb-kbd,id=input0 -device usb-mouse,id=input1

And -usb is translated to adding "pci-ohci" controller for spapr

Regards,
Nikunj

#15 lore raw

Il 03/04/2014 21:24, Nikunj A Dadhania ha scritto:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Does libvirt use "-nodefaults -machine usb=true"? It should create the OHCI controller separately instead of using "-machine".

I see it creating:

-nodefaults -usb -device usb-kbd,id=input0 -device usb-mouse,id=input1

And -usb is translated to adding "pci-ohci" controller for spapr

Yeah, but with -nodefaults it's better to use -device directly.

Paolo

#16 lore raw
Quoted 10 lines · Paolo Bonzini

Il 03/04/2014 21:24, Nikunj A Dadhania ha scritto:

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Does libvirt use "-nodefaults -machine usb=true"? It should create the OHCI controller separately instead of using "-machine".

I see it creating:

-nodefaults -usb -device usb-kbd,id=input0 -device usb-mouse,id=input1

And -usb is translated to adding "pci-ohci" controller for spapr

Yeah, but with -nodefaults it's better to use -device directly.

I think there is special handling for this in vl.c

bool usb_enabled(bool default_usb)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
has_defaults && default_usb);
}

And spapr.c uses this:

    if (usb_enabled(spapr->has_graphics)) {
        pci_create_simple(phb->bus, -1, "pci-ohci");

Regards
Nikunj

#17 lore raw

Il 04/04/2014 07:28, Nikunj A Dadhania ha scritto:

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

And -usb is translated to adding "pci-ohci" controller for spapr

Yeah, but with -nodefaults it's better to use -device directly.

I think there is special handling for this in vl.c

bool usb_enabled(bool default_usb)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
has_defaults && default_usb);
}

Quoted 4 lines

And spapr.c uses this:

    if (usb_enabled(spapr->has_graphics)) {
        pci_create_simple(phb->bus, -1, "pci-ohci");

Sure. However, I'm saying that it's fine for spapr to make -usb mean "OHCI, and also keyboard & mouse if there is a VGA card in the system".

If libvirt used "-device pci-ohci" unconditionally, it would fix the bug *and* it would ensure that the PCI slot of pci-ohci does not change due to some other unrelated reason. So I would rather have the fix in libvirt.

Paolo

#18 lore raw
Quoted 18 lines · Paolo Bonzini

Il 04/04/2014 07:28, Nikunj A Dadhania ha scritto:

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

And -usb is translated to adding "pci-ohci" controller for spapr

Yeah, but with -nodefaults it's better to use -device directly.

I think there is special handling for this in vl.c

bool usb_enabled(bool default_usb)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb",
has_defaults && default_usb);
}

Quoted 4 lines

And spapr.c uses this:

    if (usb_enabled(spapr->has_graphics)) {
        pci_create_simple(phb->bus, -1, "pci-ohci");
Quoted 6 lines

Sure. However, I'm saying that it's fine for spapr to make -usb mean "OHCI, and also keyboard & mouse if there is a VGA card in the system".

If libvirt used "-device pci-ohci" unconditionally, it would fix the bug *and* it would ensure that the PCI slot of pci-ohci does not change due to some other unrelated reason. So I would rather have the fix in libvirt.

Sure, let me check this.

Thanks,
Nikunj

#19 lore raw

Il 04/04/2014 13:40, Nikunj A Dadhania ha scritto:

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

Sure. However, I'm saying that it's fine for spapr to make -usb mean "OHCI, and also keyboard & mouse if there is a VGA card in the system".

If libvirt used "-device pci-ohci" unconditionally, it would fix the bug *and* it would ensure that the PCI slot of pci-ohci does not change due to some other unrelated reason. So I would rather have the fix in libvirt.

Sure, let me check this.

It is probably not that easy---libvirt needs to have an implicit USB <controller> element in the domain XML or something like that, and let the user's XML override the default USB controller. But it would be much better and much more consistent with x86.

Paolo