* [Qemu-devel] [PULL for-1.2 0/4] usb bugfix patch queue
@ 2012-08-16 10:11 Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 1/4] usb: async control xfer fixup Gerd Hoffmann
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2012-08-16 10:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
USB patch queue, carrying some bugfixes for qemu 1.2.
please pull,
Gerd
Gerd Hoffmann (3):
usb: async control xfer fixup
usb: update uas product id
ehci: fix Interrupt Threshold Control implementation
Hans de Goede (1):
ehci: Fix setting of halt bit from usbcmd register updates
hw/usb/core.c | 1 +
hw/usb/dev-uas.c | 2 +-
hw/usb/hcd-ehci.c | 27 ++++++++++++++++++---------
hw/usb/host-linux.c | 1 +
4 files changed, 21 insertions(+), 10 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH for-1.2 1/4] usb: async control xfer fixup
2012-08-16 10:11 [Qemu-devel] [PULL for-1.2 0/4] usb bugfix patch queue Gerd Hoffmann
@ 2012-08-16 10:11 ` Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 2/4] usb: update uas product id Gerd Hoffmann
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2012-08-16 10:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Need to clear p->result after copying setup data using usb_packet_copy()
because we'll reuse the USBPacket for the data transfer.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/core.c | 1 +
hw/usb/host-linux.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/hw/usb/core.c b/hw/usb/core.c
index 01a7622..c7e5bc0 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -107,6 +107,7 @@ static int do_token_setup(USBDevice *s, USBPacket *p)
}
usb_packet_copy(p, s->setup_buf, p->iov.size);
+ p->result = 0;
s->setup_len = (s->setup_buf[7] << 8) | s->setup_buf[6];
s->setup_index = 0;
diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
index d55be87..8df9207 100644
--- a/hw/usb/host-linux.c
+++ b/hw/usb/host-linux.c
@@ -1045,6 +1045,7 @@ static int usb_host_handle_control(USBDevice *dev, USBPacket *p,
/* Note request is (bRequestType << 8) | bRequest */
trace_usb_host_req_control(s->bus_num, s->addr, p, request, value, index);
+ assert(p->result == 0);
switch (request) {
case DeviceOutRequest | USB_REQ_SET_ADDRESS:
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH for-1.2 2/4] usb: update uas product id
2012-08-16 10:11 [Qemu-devel] [PULL for-1.2 0/4] usb bugfix patch queue Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 1/4] usb: async control xfer fixup Gerd Hoffmann
@ 2012-08-16 10:11 ` Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 3/4] ehci: fix Interrupt Threshold Control implementation Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 4/4] ehci: Fix setting of halt bit from usbcmd register updates Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2012-08-16 10:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Pick other product id to fix clash with audio.
Current usage list (after applying this patch):
46f4:0001 -- usb-storage
46f4:0002 -- usb-audio
46f4:0003 -- usb-uas
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-uas.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 9b02ff4..b13eeba 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -223,7 +223,7 @@ static const USBDescDevice desc_device_high = {
static const USBDesc desc = {
.id = {
.idVendor = 0x46f4, /* CRC16() of "QEMU" */
- .idProduct = 0x0002,
+ .idProduct = 0x0003,
.bcdDevice = 0,
.iManufacturer = STR_MANUFACTURER,
.iProduct = STR_PRODUCT,
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH for-1.2 3/4] ehci: fix Interrupt Threshold Control implementation
2012-08-16 10:11 [Qemu-devel] [PULL for-1.2 0/4] usb bugfix patch queue Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 1/4] usb: async control xfer fixup Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 2/4] usb: update uas product id Gerd Hoffmann
@ 2012-08-16 10:11 ` Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 4/4] ehci: Fix setting of halt bit from usbcmd register updates Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2012-08-16 10:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
First, not all interrupts are subject to Interrupt Threshold Control,
some of them must be delivered without delay.
Second, Interrupt Threshold Control state must be part of vmstate,
otherwise we might loose IRQs on migration.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 104c21d..e489509 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -575,7 +575,12 @@ static inline void ehci_update_irq(EHCIState *s)
/* flag interrupt condition */
static inline void ehci_raise_irq(EHCIState *s, int intr)
{
- s->usbsts_pending |= intr;
+ if (intr & (USBSTS_PCD | USBSTS_FLR | USBSTS_HSE)) {
+ s->usbsts |= intr;
+ ehci_update_irq(s);
+ } else {
+ s->usbsts_pending |= intr;
+ }
}
/*
@@ -2466,13 +2471,16 @@ static int usb_ehci_post_load(void *opaque, int version_id)
static const VMStateDescription vmstate_ehci = {
.name = "ehci",
- .version_id = 1,
+ .version_id = 2,
+ .minimum_version_id = 1,
.post_load = usb_ehci_post_load,
.fields = (VMStateField[]) {
VMSTATE_PCI_DEVICE(dev, EHCIState),
/* mmio registers */
VMSTATE_UINT32(usbcmd, EHCIState),
VMSTATE_UINT32(usbsts, EHCIState),
+ VMSTATE_UINT32_V(usbsts_pending, EHCIState, 2),
+ VMSTATE_UINT32_V(usbsts_frindex, EHCIState, 2),
VMSTATE_UINT32(usbintr, EHCIState),
VMSTATE_UINT32(frindex, EHCIState),
VMSTATE_UINT32(ctrldssegment, EHCIState),
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH for-1.2 4/4] ehci: Fix setting of halt bit from usbcmd register updates
2012-08-16 10:11 [Qemu-devel] [PULL for-1.2 0/4] usb bugfix patch queue Gerd Hoffmann
` (2 preceding siblings ...)
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 3/4] ehci: fix Interrupt Threshold Control implementation Gerd Hoffmann
@ 2012-08-16 10:11 ` Gerd Hoffmann
3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2012-08-16 10:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Hans de Goede, Gerd Hoffmann
From: Hans de Goede <hdegoede@redhat.com>
This fixes linux guests started without any USB devices not seeing newly
plugged devices until "lsusb" is done inside the guest.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index e489509..8b94b17 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1187,22 +1187,23 @@ static void ehci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val)
break;
}
+ /* not supporting dynamic frame list size at the moment */
+ if ((val & USBCMD_FLS) && !(s->usbcmd & USBCMD_FLS)) {
+ fprintf(stderr, "attempt to set frame list size -- value %d\n",
+ val & USBCMD_FLS);
+ val &= ~USBCMD_FLS;
+ }
+
if (((USBCMD_RUNSTOP | USBCMD_PSE | USBCMD_ASE) & val) !=
((USBCMD_RUNSTOP | USBCMD_PSE | USBCMD_ASE) & s->usbcmd)) {
if (s->pstate == EST_INACTIVE) {
SET_LAST_RUN_CLOCK(s);
}
+ s->usbcmd = val; /* Set usbcmd for ehci_update_halt() */
ehci_update_halt(s);
s->async_stepdown = 0;
qemu_mod_timer(s->frame_timer, qemu_get_clock_ns(vm_clock));
}
-
- /* not supporting dynamic frame list size at the moment */
- if ((val & USBCMD_FLS) && !(s->usbcmd & USBCMD_FLS)) {
- fprintf(stderr, "attempt to set frame list size -- value %d\n",
- val & USBCMD_FLS);
- val &= ~USBCMD_FLS;
- }
break;
case USBSTS:
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-16 10:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 10:11 [Qemu-devel] [PULL for-1.2 0/4] usb bugfix patch queue Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 1/4] usb: async control xfer fixup Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 2/4] usb: update uas product id Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 3/4] ehci: fix Interrupt Threshold Control implementation Gerd Hoffmann
2012-08-16 10:11 ` [Qemu-devel] [PATCH for-1.2 4/4] ehci: Fix setting of halt bit from usbcmd register updates 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).