diff mbox

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

Message ID 871txez6jd.fsf@abhimanyu.in.ibm.com
State New
Headers show

Commit Message

Nikunj A Dadhania April 3, 2014, 5:06 p.m. UTC
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 <pbonzini@redhat.com>
CC: Mark Wu <wudxw@linux.vnet.ibm.com>
CC: Andreas Färber <afaerber@suse.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
---

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(-)

Comments

Andreas Färber April 3, 2014, 5:12 p.m. UTC | #1
Am 03.04.2014 19:06, schrieb 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 <pbonzini@redhat.com>
> CC: Mark Wu <wudxw@linux.vnet.ibm.com>
> CC: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas
Markus Armbruster April 4, 2014, 6:34 a.m. UTC | #2
Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> writes:

> 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 <pbonzini@redhat.com>
> CC: Mark Wu <wudxw@linux.vnet.ibm.com>
> CC: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
> ---
>
> 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(-)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index a11e121..3095626 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -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");
>          }
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index ba5c7f8..8e90ad0 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -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;
> diff --git a/vl.c b/vl.c
> index 9975e5a..4d5832c 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -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)
>  {

Have you considered extending QEMUMachineInitArgs instead of adding this
function?
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a11e121..3095626 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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");
         }
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index ba5c7f8..8e90ad0 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -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;
diff --git a/vl.c b/vl.c
index 9975e5a..4d5832c 100644
--- a/vl.c
+++ b/vl.c
@@ -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)
 {