qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] q35: usb keyboard trouble
@ 2012-10-24 14:55 Gabriel L. Somlo
  2012-10-26 20:24 ` Jason Baron
  0 siblings, 1 reply; 4+ messages in thread
From: Gabriel L. Somlo @ 2012-10-24 14:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: jbaron

Jason,

Commit d8b0dbdba325773469733222a167b54aca74de55 in the q35 tree breaks
'-usbdevice keyboard' for me. Instead of being able to type at the VM,
none of the keypresses make it through, and qemu stderr soon starts
logging this error: "usb-kbd: warning: key event queue full".

Specifically, it's the introduction of ich9-usb-ehci1 that causes the
issue (in hw/pc_q35.c, line 197):

+        pci_create_simple_multifunction(
+            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
+            true, "ich9-usb-ehci1");

Commenting out the above makes the problem go away.

Thanks much,
--Gabriel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] q35: usb keyboard trouble
  2012-10-24 14:55 [Qemu-devel] q35: usb keyboard trouble Gabriel L. Somlo
@ 2012-10-26 20:24 ` Jason Baron
  2012-10-28 15:37   ` Gabriel L. Somlo
  2012-10-29  7:11   ` Gerd Hoffmann
  0 siblings, 2 replies; 4+ messages in thread
From: Jason Baron @ 2012-10-26 20:24 UTC (permalink / raw)
  To: Gabriel L. Somlo; +Cc: pbonzini, kraxel, qemu-devel, hdegoede

On Wed, Oct 24, 2012 at 10:55:28AM -0400, Gabriel L. Somlo wrote:
> Jason,
> 
> Commit d8b0dbdba325773469733222a167b54aca74de55 in the q35 tree breaks
> '-usbdevice keyboard' for me. Instead of being able to type at the VM,
> none of the keypresses make it through, and qemu stderr soon starts
> logging this error: "usb-kbd: warning: key event queue full".
> 
> Specifically, it's the introduction of ich9-usb-ehci1 that causes the
> issue (in hw/pc_q35.c, line 197):
> 
> +        pci_create_simple_multifunction(
> +            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
> +            true, "ich9-usb-ehci1");
> 
> Commenting out the above makes the problem go away.
> 
> Thanks much,
> --Gabriel
> 
> 

Thanks for the bug report! What OS are you running? I'm not seeing any
issue with -usbdevice keyboard on Fedora.

Paolo pointed out that I was missing some ich9 specific initialization
from docs/ich9-ehci-uhci.cfg. I've added that in the patch below. I have
no idea if that will resolve this issue for you.

Thanks,

-Jason


diff --git a/hw/pc_q35.c b/hw/pc_q35.c
index a72ad36..22b72ed 100644
--- a/hw/pc_q35.c
+++ b/hw/pc_q35.c
@@ -200,20 +200,27 @@ static void pc_q35_init_late(BusState **idebus, ISADevice *rtc_state,
     idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
 
     if (usb_enabled) {
+        int i;
+        PCIDevice *usb;
+        DeviceState *usb_qdev;
+
         /* Should we create 6 UHCI according to ich9 spec? */
-        pci_create_simple_multifunction(
-            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC),
-            true, "ich9-usb-uhci1");
-        pci_create_simple_multifunction(
-            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI2_FUNC),
-            true, "ich9-usb-uhci2");
-        pci_create_simple_multifunction(
-            host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI3_FUNC),
-            true, "ich9-usb-uhci3");
-        pci_create_simple_multifunction(
+        usb = pci_create_multifunction(
             host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
             true, "ich9-usb-ehci1");
-        /* XXX: EHCI */
+        usb_qdev = &usb->qdev;
+        usb_qdev->id = g_strdup("ich9-usb-bus");
+        qdev_init_nofail(usb_qdev);
+
+        for (i = 0; i < 3; i++) {
+            usb = pci_create_multifunction(
+                host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC + i),
+                true, "ich9-usb-uhci1");
+            usb_qdev = &usb->qdev;
+            qdev_prop_set_string(usb_qdev, "masterbus", "ich9-usb-bus.0");
+            qdev_prop_set_uint32(usb_qdev, "firstport", i * 2);
+            qdev_init_nofail(usb_qdev);
+        }
     }
 
     /* TODO: Populate SPD eeprom data.  */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] q35: usb keyboard trouble
  2012-10-26 20:24 ` Jason Baron
@ 2012-10-28 15:37   ` Gabriel L. Somlo
  2012-10-29  7:11   ` Gerd Hoffmann
  1 sibling, 0 replies; 4+ messages in thread
From: Gabriel L. Somlo @ 2012-10-28 15:37 UTC (permalink / raw)
  To: Jason Baron; +Cc: pbonzini, kraxel, qemu-devel, hdegoede

On Fri, Oct 26, 2012 at 04:24:44PM -0400, Jason Baron wrote:
> Thanks for the bug report! What OS are you running? I'm not seeing any
> issue with -usbdevice keyboard on Fedora.

I was using this:

bin/qemu-system-x86_64 \
   -M pc_q35 -L q35-seabios/out \
   -usbdevice keyboard \
   -hdd ./Fedora-14-x86_64-netinst.iso

> Paolo pointed out that I was missing some ich9 specific initialization
> from docs/ich9-ehci-uhci.cfg. I've added that in the patch below. I have
> no idea if that will resolve this issue for you.

This patch does indeed fix the problem for me, thanks for sending it !
The only small observation I have is that you seem to name all three
UHCI devices "ich9-usb-uhci1". There's probably a better way than my
patch below (on top of the one you just sent), but here's the general
idea :)

Thanks,
--Gabriel

--- a/hw/pc_q35.c
+++ b/hw/pc_q35.c
@@ -185,23 +185,25 @@
 
     if (usb_enabled) {
         int i;
         PCIDevice *usb;
         DeviceState *usb_qdev;
+        char devname[] = "ich9-usb-uhciX";
 
         /* Should we create 6 UHCI according to ich9 spec? */
         usb = pci_create_multifunction(
             host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
             true, "ich9-usb-ehci1");
         usb_qdev = &usb->qdev;
         usb_qdev->id = g_strdup("ich9-usb-bus");
         qdev_init_nofail(usb_qdev);
 
         for (i = 0; i < 3; i++) {
+            sprintf(devname, "ich9-usb-uhci%d", i + 1);
             usb = pci_create_multifunction(
                 host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC + i),
-                true, "ich9-usb-uhci1");
+                true, devname);
             usb_qdev = &usb->qdev;
             qdev_prop_set_string(usb_qdev, "masterbus",
"ich9-usb-bus.0");
             qdev_prop_set_uint32(usb_qdev, "firstport", i * 2);
             qdev_init_nofail(usb_qdev);
         }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] q35: usb keyboard trouble
  2012-10-26 20:24 ` Jason Baron
  2012-10-28 15:37   ` Gabriel L. Somlo
@ 2012-10-29  7:11   ` Gerd Hoffmann
  1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2012-10-29  7:11 UTC (permalink / raw)
  To: Jason Baron; +Cc: pbonzini, Gabriel L. Somlo, qemu-devel, hdegoede

  Hi,

> +        for (i = 0; i < 3; i++) {
> +            usb = pci_create_multifunction(
> +                host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC + i),
> +                true, "ich9-usb-uhci1");

ich9-usb-uhci1,ich9-usb-uhci2,ich9-usb-uhci3

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-29  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24 14:55 [Qemu-devel] q35: usb keyboard trouble Gabriel L. Somlo
2012-10-26 20:24 ` Jason Baron
2012-10-28 15:37   ` Gabriel L. Somlo
2012-10-29  7:11   ` Gerd Hoffmann

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