qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL] usb patch queue
@ 2011-06-14 11:05 Gerd Hoffmann
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 32/34] hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2011-06-14 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: 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

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

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

* [Qemu-devel] [PATCH 32/34] hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register
  2011-06-14 11:05 [Qemu-devel] [PULL] usb patch queue Gerd Hoffmann
@ 2011-06-14 11:05 ` Gerd Hoffmann
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2011-06-14 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Gerd Hoffmann

From: Peter Maydell <peter.maydell@linaro.org>

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

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-ohci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 401045a..ab77434 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -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;
-- 
1.7.1

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

* [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup
  2011-06-14 11:05 [Qemu-devel] [PULL] usb patch queue Gerd Hoffmann
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 32/34] hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register Gerd Hoffmann
@ 2011-06-14 11:05 ` Gerd Hoffmann
  2011-06-15 15:03   ` Peter Maydell
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 34/34] usb-uhci: fix expire time initialization Gerd Hoffmann
  2011-06-15 14:17 ` [Qemu-devel] [PULL] usb patch queue Anthony Liguori
  3 siblings, 1 reply; 6+ messages in thread
From: Gerd Hoffmann @ 2011-06-14 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Gerd Hoffmann

From: Peter Maydell <peter.maydell@linaro.org>

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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-ohci.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index ab77434..832dcd6 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -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,
 };
 
-- 
1.7.1

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

* [Qemu-devel] [PATCH 34/34] usb-uhci: fix expire time initialization.
  2011-06-14 11:05 [Qemu-devel] [PULL] usb patch queue Gerd Hoffmann
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 32/34] hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register Gerd Hoffmann
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup Gerd Hoffmann
@ 2011-06-14 11:05 ` Gerd Hoffmann
  2011-06-15 14:17 ` [Qemu-devel] [PULL] usb patch queue Anthony Liguori
  3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2011-06-14 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

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

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-uhci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 1503373..75cd231 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -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);
 
-- 
1.7.1

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

* Re: [Qemu-devel] [PULL] usb patch queue
  2011-06-14 11:05 [Qemu-devel] [PULL] usb patch queue Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 34/34] usb-uhci: fix expire time initialization Gerd Hoffmann
@ 2011-06-15 14:17 ` Anthony Liguori
  3 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2011-06-15 14:17 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

On 06/14/2011 06:05 AM, Gerd Hoffmann wrote:
>    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

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

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

* Re: [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup
  2011-06-14 11:05 ` [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup Gerd Hoffmann
@ 2011-06-15 15:03   ` Peter Maydell
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2011-06-15 15:03 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel

On 14 June 2011 12:05, Gerd Hoffmann <kraxel@redhat.com> wrote:
> From: Peter Maydell <peter.maydell@linaro.org>
>
> 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

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

end of thread, other threads:[~2011-06-15 15:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-14 11:05 [Qemu-devel] [PULL] usb patch queue Gerd Hoffmann
2011-06-14 11:05 ` [Qemu-devel] [PATCH 32/34] hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register Gerd Hoffmann
2011-06-14 11:05 ` [Qemu-devel] [PATCH 33/34] hw/usb-ohci.c: Implement remote wakeup Gerd Hoffmann
2011-06-15 15:03   ` Peter Maydell
2011-06-14 11:05 ` [Qemu-devel] [PATCH 34/34] usb-uhci: fix expire time initialization Gerd Hoffmann
2011-06-15 14:17 ` [Qemu-devel] [PULL] usb patch queue Anthony Liguori

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