Skip to contentSkip to conversation

usb patch queue

GIT PULL In review Gerd Hoffmann 3 participants 6 messages Jun 14, 2011 – Jun 15, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

The USB patch queue has been rebased, got a minor fix (wrong comment in patch #8, spotted by David Ahern) and three new patches. I'm just posting the three new patches to avoid spamming the list with 30 identical patches ...

please pull,
Gerd

The following changes since commit 0b862cedf36d927818c50584ddd611b0370673df:

configure: Detect and don't try to use older libcurl (2011-06-13 21:16:27 +0200)

are available in the git repository at:
git://git.kraxel.org/qemu usb.16

Brad Hards (3):
usb: Add defines for USB Serial Bus Release Number register
usb: Use defines for serial bus release number register for UHCI
usb: Use defines for serial bus release number register for EHCI

Gerd Hoffmann (18):
usb-linux: catch ENODEV in more places.
usb-ehci: trace mmio and usbsts
usb-ehci: trace state machine changes
usb-ehci: trace port state
usb-ehci: improve mmio tracing
usb-ehci: trace buffer copy
usb-ehci: add queue data struct
usb-ehci: multiqueue support
usb-ehci: fix offset writeback in ehci_buffer_rw
usb-ehci: fix error handling.
usb: cancel async packets on unplug
usb-ehci: drop EXECUTING checks.
usb-ehci: itd handling fixes.
usb-ehci: split trace calls to handle arg count limits
usb: documentation update
usb-linux: only cleanup in host_close when host_open was successful.
usb: don't call usb_host_device_open from vl.c
usb-uhci: fix expire time initialization.

Hans de Goede (9):
ehci: fix a number of unused-but-set-variable warnings (new with gcc-4.6)
usb-linux: Get speed from sysfs rather then from the connectinfo ioctl
usb-linux: Teach about super speed
usb-linux: Don't do perror when errno is not set
usb-linux: Ensure devep != 0
usb-linux: Don't try to open the same device twice
usb-linux: Enlarge buffer for descriptors to 8192 bytes
usb-bus: Add knowledge of USB_SPEED_SUPER to usb_speed helper
usb-bus: Don't detach non attached devices on device exit

Kevin O'Connor (2):
Fix USB mouse Set_Protocol behavior
The USB tablet should not claim boot protocol support.

Peter Maydell (2):
hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register hw/usb-ohci.c: Implement remote wakeup

 docs/usb2.txt          |   85 ++++
 hw/milkymist-softusb.c |   10 +-
 hw/usb-bus.c           |   10 +-
 hw/usb-ehci.c          | 1198 ++++++++++++++++++++++++++++--------------------
 hw/usb-hid.c           |    5 +-
 hw/usb-musb.c          |   23 +-
 hw/usb-ohci.c          |   37 ++-
 hw/usb-uhci.c          |   32 ++-
 hw/usb.h               |   14 +-
 trace-events           |   20 +
 usb-linux.c            |   96 +++--
 vl.c                   |    6 +-
 12 files changed, 990 insertions(+), 546 deletions(-)
#4 lore raw

PATCH 34/34 usb-uhci: fix expire time initialization.

expire_time must be initialited when the guest activates the usb scheduler, not at device creation time.

---
 hw/usb-uhci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/usb-uhci.c +2 -2
index 1503373..75cd231 100644
@@ -424,6 +424,8 @@ static void uhci_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
     case 0x00:
         if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) {
             /* start frame processing */
+            s->expire_time = qemu_get_clock_ns(vm_clock) +
+                (get_ticks_per_sec() / FRAME_TIMER_FREQ);
             qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock));
             s->status &= ~UHCI_STS_HCHALTED;
         } else if (!(val & UHCI_CMD_RS)) {
@@ -1131,8 +1133,6 @@ static int usb_uhci_common_initfn(UHCIState *s)
         usb_port_location(&s->ports[i].port, NULL, i+1);
     }
     s->frame_timer = qemu_new_timer_ns(vm_clock, uhci_frame_timer, s);
-    s->expire_time = qemu_get_clock_ns(vm_clock) +
-        (get_ticks_per_sec() / FRAME_TIMER_FREQ);
     s->num_ports_vmstate = NB_PORTS;
     QTAILQ_INIT(&s->async_pending);
 
Signature · 1 line
1.7.1
#2 lore raw

PATCH 33/34 hw/usb-ohci.c: Implement remote wakeup

In reply to Gerd Hoffmann

From: Peter Maydell <[email protected]>

Implement the wakeup callback in the OHCI USBPortOps, so that when a downstream device wakes up it correctly causes the OHCI controller to come out of suspend.

---
 hw/usb-ohci.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
hw/usb-ohci.c +17 -0
index ab77434..832dcd6 100644
@@ -367,6 +367,22 @@ static void ohci_detach(USBPort *port1)
         ohci_set_interrupt(s, OHCI_INTR_RHSC);
 }
 
+static void ohci_wakeup(USBDevice *dev)
+{
+    USBBus *bus = usb_bus_from_device(dev);
+    OHCIState *s = container_of(bus, OHCIState, bus);
+    int portnum = dev->port->index;
+    OHCIPort *port = &s->rhport[portnum];
+    if (port->ctrl & OHCI_PORT_PSS) {
+        DPRINTF("usb-ohci: port %d: wakeup\n", portnum);
+        port->ctrl |= OHCI_PORT_PSSC;
+        port->ctrl &= ~OHCI_PORT_PSS;
+        if ((s->ctl & OHCI_CTL_HCFS) == OHCI_USB_SUSPEND) {
+            ohci_set_interrupt(s, OHCI_INTR_RD);
+        }
+    }
+}
+
 /* Reset the controller */
 static void ohci_reset(void *opaque)
 {
@@ -1675,6 +1691,7 @@ static CPUWriteMemoryFunc * const ohci_writefn[3]={
 static USBPortOps ohci_port_ops = {
     .attach = ohci_attach,
     .detach = ohci_detach,
+    .wakeup = ohci_wakeup,
     .complete = ohci_async_complete_packet,
 };
 
Signature · 1 line
1.7.1
#1 lore raw

PATCH 32/34 hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register

In reply to Gerd Hoffmann

From: Peter Maydell <[email protected]>

HcPeriodCurrentED is read-only, but Linux writes to it anyway; silently ignore this rather than printing a warning message.

(Specifically, drivers/usb/host/ohci-hub.c:ohci_rh_resume() writes a 0, in at least kernels 2.6.25 through 2.6.39.)

---
 hw/usb-ohci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
hw/usb-ohci.c +4 -0
index 401045a..ab77434 100644
@@ -1575,6 +1575,10 @@ static void ohci_mem_write(void *ptr, target_phys_addr_t addr, uint32_t val)
         ohci->hcca = val & OHCI_HCCA_MASK;
         break;
 
+    case 7: /* HcPeriodCurrentED */
+        /* Ignore writes to this read-only register, Linux does them */
+        break;
+
     case 8: /* HcControlHeadED */
         ohci->ctrl_head = val & OHCI_EDPTR_MASK;
         break;
Signature · 1 line
1.7.1
#5 lore raw
In reply to Gerd Hoffmann
Quoted 9 lines · Gerd Hoffmann
   Hi,

The USB patch queue has been rebased, got a minor fix (wrong comment in patch #8, spotted by David Ahern) and three new patches. I'm just posting the three new patches to avoid spamming the list with 30 identical patches ...

please pull,
Gerd

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 67 lines

The following changes since commit 0b862cedf36d927818c50584ddd611b0370673df:

configure: Detect and don't try to use older libcurl (2011-06-13 21:16:27 +0200)

are available in the git repository at:

   git://git.kraxel.org/qemu usb.16

Brad Hards (3):
usb: Add defines for USB Serial Bus Release Number register
usb: Use defines for serial bus release number register for UHCI
usb: Use defines for serial bus release number register for EHCI

Gerd Hoffmann (18):
usb-linux: catch ENODEV in more places.
usb-ehci: trace mmio and usbsts
usb-ehci: trace state machine changes
usb-ehci: trace port state
usb-ehci: improve mmio tracing
usb-ehci: trace buffer copy
usb-ehci: add queue data struct
usb-ehci: multiqueue support
usb-ehci: fix offset writeback in ehci_buffer_rw
usb-ehci: fix error handling.
usb: cancel async packets on unplug
usb-ehci: drop EXECUTING checks.
usb-ehci: itd handling fixes.
usb-ehci: split trace calls to handle arg count limits
usb: documentation update
usb-linux: only cleanup in host_close when host_open was successful.
usb: don't call usb_host_device_open from vl.c
usb-uhci: fix expire time initialization.

Hans de Goede (9):
ehci: fix a number of unused-but-set-variable warnings (new with gcc-4.6)
usb-linux: Get speed from sysfs rather then from the connectinfo ioctl
usb-linux: Teach about super speed
usb-linux: Don't do perror when errno is not set
usb-linux: Ensure devep != 0
usb-linux: Don't try to open the same device twice
usb-linux: Enlarge buffer for descriptors to 8192 bytes
usb-bus: Add knowledge of USB_SPEED_SUPER to usb_speed helper
usb-bus: Don't detach non attached devices on device exit

Kevin O'Connor (2):
Fix USB mouse Set_Protocol behavior
The USB tablet should not claim boot protocol support.

Peter Maydell (2):
hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register hw/usb-ohci.c: Implement remote wakeup

  docs/usb2.txt          |   85 ++++
  hw/milkymist-softusb.c |   10 +-
  hw/usb-bus.c           |   10 +-
  hw/usb-ehci.c          | 1198 ++++++++++++++++++++++++++++--------------------
  hw/usb-hid.c           |    5 +-
  hw/usb-musb.c          |   23 +-
  hw/usb-ohci.c          |   37 ++-
  hw/usb-uhci.c          |   32 ++-
  hw/usb.h               |   14 +-
  trace-events           |   20 +
  usb-linux.c            |   96 +++--
  vl.c                   |    6 +-
  12 files changed, 990 insertions(+), 546 deletions(-)
#3 lore raw

Re: [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup

In reply to Gerd Hoffmann
Quoted 5 lines · Gerd Hoffmann

From: Peter Maydell <[email protected]>

Implement the wakeup callback in the OHCI USBPortOps, so that when a downstream device wakes up it correctly causes the OHCI controller to come out of suspend.

Just to let you know, this patch turns out to not be quite right:
* if the port is suspended and the controller is not, we need to raise OHCI_INTR_RHSC
* if the controller is suspended we need to put it into the resume state
* the controller can be suspended when the port is not, so the check on s->ctl musn't be inside the port->ctrl if().

Sorry for the half-baked patch. I'll send a fixed version shortly.

-- PMM