qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org, agraf@suse.com
Cc: aik@au1.ibm.com, "Nikunj A Dadhania" <nikunj@linux.vnet.ibm.com>,
	"Mark Wu" <wudxw@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH] spapr: skip adding usb keyboard/mouse in case of -nodefaults
Date: Thu,  3 Apr 2014 22:26:14 +0530	[thread overview]
Message-ID: <1396544174-8904-1-git-send-email-nikunj@linux.vnet.ibm.com> (raw)

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>
---
 hw/ppc/spapr.c          |  6 +++++-
 include/sysemu/sysemu.h |  1 +
 vl.c                    | 10 ++++++++--
 3 files changed, 14 insertions(+), 3 deletions(-)

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..6bf37a2 100644
--- a/vl.c
+++ b/vl.c
@@ -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
-- 
1.8.3.1

             reply	other threads:[~2014-04-03 16:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03 16:56 Nikunj A Dadhania [this message]
2014-04-03 17:01 ` [Qemu-devel] [PATCH] spapr: skip adding usb keyboard/mouse in case of -nodefaults Andreas Färber
2014-04-03 17:07   ` Nikunj A Dadhania
2014-04-03 17:06 ` Nikunj A Dadhania
2014-04-03 17:12   ` Andreas Färber
2014-04-04  6:34   ` Markus Armbruster
2014-04-04  8:28     ` Nikunj A Dadhania
2014-04-04 10:58       ` Markus Armbruster
2014-04-04 11:00         ` Paolo Bonzini
2014-04-04 11:23           ` Markus Armbruster
2014-04-04 15:08             ` Eric Blake
2014-04-04 13:14       ` Andreas Färber
2014-04-03 18:01 ` Paolo Bonzini
2014-04-03 18:32   ` Eric Blake
2014-04-03 19:24   ` Nikunj A Dadhania
2014-04-03 19:37     ` Paolo Bonzini
2014-04-04  5:28       ` Nikunj A Dadhania
2014-04-04 11:02         ` Paolo Bonzini
2014-04-04 11:40           ` Nikunj A Dadhania
2014-04-04 11:47             ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396544174-8904-1-git-send-email-nikunj@linux.vnet.ibm.com \
    --to=nikunj@linux.vnet.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.com \
    --cc=aik@au1.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=wudxw@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).