* [Qemu-devel] [PULL 0/7] usb patch queue
@ 2013-04-16 10:13 Gerd Hoffmann
0 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-04-16 10:13 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Here comes the usb patch queue. Big new feature is the libusb-based
usb-host driver. There also is a usb-serial fix and a small collection
of xhci bugfixes.
please pull,
Gerd
The following changes since commit 24a6e7f4d91e9ed5f8117ecb083431a23f8609a0:
virtio-balloon: fix dynamic properties. (2013-04-15 17:06:58 -0500)
are available in the git repository at:
git://git.kraxel.org/qemu usb.80
for you to fetch changes up to 2b2325ff6491224a42e1fec99b1c39fbc521c95c:
use libusb for usb-host (2013-04-16 12:04:09 +0200)
----------------------------------------------------------------
Gerd Hoffmann (6):
xhci: remove leftover debug printf
xhci: add xhci_cap_write
xhci: fix portsc writes
xhci: use slotid as device address
xhci: fix address device
use libusb for usb-host
Hans de Goede (1):
usb-serial: Remove double call to qemu_chr_add_handlers( NULL )
configure | 36 ++
hw/usb/dev-serial.c | 9 -
hw/usb/hcd-xhci.c | 79 +--
hw/usb/host-libusb.c | 1449 ++++++++++++++++++++++++++++++++++++++++++++++++++
hw/usb/host-linux.c | 14 +-
trace-events | 5 +
6 files changed, 1551 insertions(+), 41 deletions(-)
create mode 100644 hw/usb/host-libusb.c
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 0/7] usb patch queue
@ 2013-06-03 10:05 Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 1/7] Fix usage of USB_DEV_FLAG_IS_HOST flag Gerd Hoffmann
` (7 more replies)
0 siblings, 8 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Here is the usb patch queue, bringing two little bug fixes
and live migration support for xhci.
cheers,
Gerd
The following changes since commit f10acc8b38d65a66ffa0588a036489d7fa6a593e:
tcx: Fix 24-bit display mode (2013-06-02 16:45:40 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu usb.83
for you to fetch changes up to 37352df30fbc38d1de464db8927536d5e36cf52a:
xhci: add live migration support (2013-06-03 11:38:03 +0200)
----------------------------------------------------------------
Ed Maste (1):
host-libusb: Correct test for USB packet state
Gerd Hoffmann (5):
pci: add VMSTATE_MSIX
xhci: add XHCISlot->addressed
xhci: add xhci_alloc_epctx
xhci: add xhci_init_epctx
xhci: add live migration support
Michael Marineau (1):
Fix usage of USB_DEV_FLAG_IS_HOST flag.
hw/pci/msix.c | 33 +++++++
hw/usb/core.c | 2 +-
hw/usb/hcd-xhci.c | 228 ++++++++++++++++++++++++++++++++++++++++++++-----
hw/usb/host-libusb.c | 2 +-
include/hw/pci/msix.h | 11 +++
5 files changed, 251 insertions(+), 25 deletions(-)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 1/7] Fix usage of USB_DEV_FLAG_IS_HOST flag.
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
@ 2013-06-03 10:05 ` Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 2/7] host-libusb: Correct test for USB packet state Gerd Hoffmann
` (6 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Michael Marineau, qemu-stable, Gerd Hoffmann
From: Michael Marineau <mike@marineau.org>
USB_DEV_FLAG_IS_HOST is the bit number, not value. Booting with a
"Fitbit Base Station" USB dongle was triggering this assert.
Signed-off-by: Michael Marineau <mike@marineau.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/core.c b/hw/usb/core.c
index 15a150a..05948ca 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -410,7 +410,7 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
assert(p->ep->type != USB_ENDPOINT_XFER_ISOC);
/* using async for interrupt packets breaks migration */
assert(p->ep->type != USB_ENDPOINT_XFER_INT ||
- (dev->flags & USB_DEV_FLAG_IS_HOST));
+ (dev->flags & (1 << USB_DEV_FLAG_IS_HOST)));
usb_packet_set_state(p, USB_PACKET_ASYNC);
QTAILQ_INSERT_TAIL(&p->ep->queue, p, queue);
} else if (p->status == USB_RET_ADD_TO_QUEUE) {
--
1.7.9.7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 2/7] host-libusb: Correct test for USB packet state
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 1/7] Fix usage of USB_DEV_FLAG_IS_HOST flag Gerd Hoffmann
@ 2013-06-03 10:05 ` Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 3/7] pci: add VMSTATE_MSIX Gerd Hoffmann
` (5 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Ed Maste, qemu-stable, Gerd Hoffmann
From: Ed Maste <emaste@freebsd.org>
USB_RET_ASYNC is -6, so inflight was always false.
Signed-off-by: Ed Maste <emaste@freebsd.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/host-libusb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index f3de459..3a582c5 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -385,7 +385,7 @@ out:
static void usb_host_req_abort(USBHostRequest *r)
{
USBHostDevice *s = r->host;
- bool inflight = (r->p && r->p->state == USB_RET_ASYNC);
+ bool inflight = (r->p && r->p->state == USB_PACKET_ASYNC);
if (inflight) {
r->p->status = USB_RET_NODEV;
--
1.7.9.7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 3/7] pci: add VMSTATE_MSIX
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 1/7] Fix usage of USB_DEV_FLAG_IS_HOST flag Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 2/7] host-libusb: Correct test for USB packet state Gerd Hoffmann
@ 2013-06-03 10:05 ` Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 4/7] xhci: add XHCISlot->addressed Gerd Hoffmann
` (4 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin
Using a trick cut+pasted from vmstate_scsi_device
to wind up msix_save and msix_load.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci/msix.c | 33 +++++++++++++++++++++++++++++++++
include/hw/pci/msix.h | 11 +++++++++++
2 files changed, 44 insertions(+)
diff --git a/hw/pci/msix.c b/hw/pci/msix.c
index e231a0d..6da75ec 100644
--- a/hw/pci/msix.c
+++ b/hw/pci/msix.c
@@ -569,3 +569,36 @@ void msix_unset_vector_notifiers(PCIDevice *dev)
dev->msix_vector_release_notifier = NULL;
dev->msix_vector_poll_notifier = NULL;
}
+
+static void put_msix_state(QEMUFile *f, void *pv, size_t size)
+{
+ msix_save(pv, f);
+}
+
+static int get_msix_state(QEMUFile *f, void *pv, size_t size)
+{
+ msix_load(pv, f);
+ return 0;
+}
+
+static VMStateInfo vmstate_info_msix = {
+ .name = "msix state",
+ .get = get_msix_state,
+ .put = put_msix_state,
+};
+
+const VMStateDescription vmstate_msix = {
+ .name = "msix",
+ .fields = (VMStateField[]) {
+ {
+ .name = "msix",
+ .version_id = 0,
+ .field_exists = NULL,
+ .size = 0, /* ouch */
+ .info = &vmstate_info_msix,
+ .flags = VMS_SINGLE,
+ .offset = 0,
+ },
+ VMSTATE_END_OF_LIST()
+ }
+};
diff --git a/include/hw/pci/msix.h b/include/hw/pci/msix.h
index e648410..954d82b 100644
--- a/include/hw/pci/msix.h
+++ b/include/hw/pci/msix.h
@@ -43,4 +43,15 @@ int msix_set_vector_notifiers(PCIDevice *dev,
MSIVectorReleaseNotifier release_notifier,
MSIVectorPollNotifier poll_notifier);
void msix_unset_vector_notifiers(PCIDevice *dev);
+
+extern const VMStateDescription vmstate_msix;
+
+#define VMSTATE_MSIX(_field, _state) { \
+ .name = (stringify(_field)), \
+ .size = sizeof(PCIDevice), \
+ .vmsd = &vmstate_msix, \
+ .flags = VMS_STRUCT, \
+ .offset = vmstate_offset_value(_state, _field, PCIDevice), \
+}
+
#endif
--
1.7.9.7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 4/7] xhci: add XHCISlot->addressed
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
` (2 preceding siblings ...)
2013-06-03 10:05 ` [Qemu-devel] [PATCH 3/7] pci: add VMSTATE_MSIX Gerd Hoffmann
@ 2013-06-03 10:05 ` Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 5/7] xhci: add xhci_alloc_epctx Gerd Hoffmann
` (3 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Preparing for live-migration support, post_load will need that.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 8813bdf..ac683ce 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -405,6 +405,7 @@ struct XHCIEPContext {
typedef struct XHCISlot {
bool enabled;
+ bool addressed;
dma_addr_t ctx;
USBPort *uport;
XHCIEPContext * eps[31];
@@ -2041,6 +2042,7 @@ static TRBCCode xhci_disable_slot(XHCIState *xhci, unsigned int slotid)
}
xhci->slots[slotid-1].enabled = 0;
+ xhci->slots[slotid-1].addressed = 0;
return CC_SUCCESS;
}
@@ -2167,6 +2169,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
xhci_dma_write_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx));
xhci_dma_write_u32s(xhci, octx+32, ep0_ctx, sizeof(ep0_ctx));
+ xhci->slots[slotid-1].addressed = 1;
return res;
}
--
1.7.9.7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 5/7] xhci: add xhci_alloc_epctx
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
` (3 preceding siblings ...)
2013-06-03 10:05 ` [Qemu-devel] [PATCH 4/7] xhci: add XHCISlot->addressed Gerd Hoffmann
@ 2013-06-03 10:05 ` Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 6/7] xhci: add xhci_init_epctx Gerd Hoffmann
` (2 subsequent siblings)
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Factor out endpoint context allocation to a separate function.
xhci live migration will need that too, in post_load.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index ac683ce..5084e52 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1198,6 +1198,26 @@ static void xhci_ep_kick_timer(void *opaque)
xhci_kick_ep(epctx->xhci, epctx->slotid, epctx->epid, 0);
}
+static XHCIEPContext *xhci_alloc_epctx(XHCIState *xhci,
+ unsigned int slotid,
+ unsigned int epid)
+{
+ XHCIEPContext *epctx;
+ int i;
+
+ epctx = g_new0(XHCIEPContext, 1);
+ epctx->xhci = xhci;
+ epctx->slotid = slotid;
+ epctx->epid = epid;
+
+ for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) {
+ usb_packet_init(&epctx->transfers[i].packet);
+ }
+ epctx->kick_timer = qemu_new_timer_ns(vm_clock, xhci_ep_kick_timer, epctx);
+
+ return epctx;
+}
+
static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
unsigned int epid, dma_addr_t pctx,
uint32_t *ctx)
@@ -1205,7 +1225,6 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
XHCISlot *slot;
XHCIEPContext *epctx;
dma_addr_t dequeue;
- int i;
trace_usb_xhci_ep_enable(slotid, epid);
assert(slotid >= 1 && slotid <= xhci->numslots);
@@ -1216,12 +1235,7 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
xhci_disable_ep(xhci, slotid, epid);
}
- epctx = g_malloc(sizeof(XHCIEPContext));
- memset(epctx, 0, sizeof(XHCIEPContext));
- epctx->xhci = xhci;
- epctx->slotid = slotid;
- epctx->epid = epid;
-
+ epctx = xhci_alloc_epctx(xhci, slotid, epid);
slot->eps[epid-1] = epctx;
dequeue = xhci_addr64(ctx[2] & ~0xf, ctx[3]);
@@ -1241,13 +1255,9 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
xhci_ring_init(xhci, &epctx->ring, dequeue);
epctx->ring.ccs = ctx[2] & 1;
}
- for (i = 0; i < ARRAY_SIZE(epctx->transfers); i++) {
- usb_packet_init(&epctx->transfers[i].packet);
- }
epctx->interval = 1 << (ctx[0] >> 16) & 0xff;
epctx->mfindex_last = 0;
- epctx->kick_timer = qemu_new_timer_ns(vm_clock, xhci_ep_kick_timer, epctx);
epctx->state = EP_RUNNING;
ctx[0] &= ~EP_STATE_MASK;
--
1.7.9.7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 6/7] xhci: add xhci_init_epctx
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
` (4 preceding siblings ...)
2013-06-03 10:05 ` [Qemu-devel] [PATCH 5/7] xhci: add xhci_alloc_epctx Gerd Hoffmann
@ 2013-06-03 10:05 ` Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 7/7] xhci: add live migration support Gerd Hoffmann
2013-06-17 21:18 ` [Qemu-devel] [PULL 0/7] usb patch queue Anthony Liguori
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Factor out endpoint context initialization to a separate function.
xhci live migration will need that too, in post_load.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 43 +++++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 5084e52..9b90067 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1218,26 +1218,11 @@ static XHCIEPContext *xhci_alloc_epctx(XHCIState *xhci,
return epctx;
}
-static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
- unsigned int epid, dma_addr_t pctx,
- uint32_t *ctx)
+static void xhci_init_epctx(XHCIEPContext *epctx,
+ dma_addr_t pctx, uint32_t *ctx)
{
- XHCISlot *slot;
- XHCIEPContext *epctx;
dma_addr_t dequeue;
- trace_usb_xhci_ep_enable(slotid, epid);
- assert(slotid >= 1 && slotid <= xhci->numslots);
- assert(epid >= 1 && epid <= 31);
-
- slot = &xhci->slots[slotid-1];
- if (slot->eps[epid-1]) {
- xhci_disable_ep(xhci, slotid, epid);
- }
-
- epctx = xhci_alloc_epctx(xhci, slotid, epid);
- slot->eps[epid-1] = epctx;
-
dequeue = xhci_addr64(ctx[2] & ~0xf, ctx[3]);
epctx->type = (ctx[1] >> EP_TYPE_SHIFT) & EP_TYPE_MASK;
@@ -1252,11 +1237,33 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
if (epctx->max_pstreams) {
xhci_alloc_streams(epctx, dequeue);
} else {
- xhci_ring_init(xhci, &epctx->ring, dequeue);
+ xhci_ring_init(epctx->xhci, &epctx->ring, dequeue);
epctx->ring.ccs = ctx[2] & 1;
}
epctx->interval = 1 << (ctx[0] >> 16) & 0xff;
+}
+
+static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
+ unsigned int epid, dma_addr_t pctx,
+ uint32_t *ctx)
+{
+ XHCISlot *slot;
+ XHCIEPContext *epctx;
+
+ trace_usb_xhci_ep_enable(slotid, epid);
+ assert(slotid >= 1 && slotid <= xhci->numslots);
+ assert(epid >= 1 && epid <= 31);
+
+ slot = &xhci->slots[slotid-1];
+ if (slot->eps[epid-1]) {
+ xhci_disable_ep(xhci, slotid, epid);
+ }
+
+ epctx = xhci_alloc_epctx(xhci, slotid, epid);
+ slot->eps[epid-1] = epctx;
+ xhci_init_epctx(epctx, pctx, ctx);
+
epctx->mfindex_last = 0;
epctx->state = EP_RUNNING;
--
1.7.9.7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH 7/7] xhci: add live migration support
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
` (5 preceding siblings ...)
2013-06-03 10:05 ` [Qemu-devel] [PATCH 6/7] xhci: add xhci_init_epctx Gerd Hoffmann
@ 2013-06-03 10:05 ` Gerd Hoffmann
2013-06-17 21:18 ` [Qemu-devel] [PULL 0/7] usb patch queue Anthony Liguori
7 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-06-03 10:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
With all preparing pieces in place we can finally drop in
the vmstate structs and the postload function.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 163 insertions(+), 1 deletion(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 9b90067..91633ed 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3386,9 +3386,171 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
return 0;
}
+static int usb_xhci_post_load(void *opaque, int version_id)
+{
+ XHCIState *xhci = opaque;
+ XHCISlot *slot;
+ XHCIEPContext *epctx;
+ dma_addr_t dcbaap, pctx;
+ uint32_t slot_ctx[4];
+ uint32_t ep_ctx[5];
+ int slotid, epid, state, intr;
+
+ dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high);
+
+ for (slotid = 1; slotid <= xhci->numslots; slotid++) {
+ slot = &xhci->slots[slotid-1];
+ if (!slot->addressed) {
+ continue;
+ }
+ slot->ctx =
+ xhci_mask64(ldq_le_pci_dma(&xhci->pci_dev, dcbaap + 8*slotid));
+ xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx));
+ slot->uport = xhci_lookup_uport(xhci, slot_ctx);
+ assert(slot->uport && slot->uport->dev);
+
+ for (epid = 1; epid <= 32; epid++) {
+ pctx = slot->ctx + 32 * epid;
+ xhci_dma_read_u32s(xhci, pctx, ep_ctx, sizeof(ep_ctx));
+ state = ep_ctx[0] & EP_STATE_MASK;
+ if (state == EP_DISABLED) {
+ continue;
+ }
+ epctx = xhci_alloc_epctx(xhci, slotid, epid);
+ slot->eps[epid-1] = epctx;
+ xhci_init_epctx(epctx, pctx, ep_ctx);
+ epctx->state = state;
+ if (state == EP_RUNNING) {
+ /* kick endpoint after vmload is finished */
+ qemu_mod_timer(epctx->kick_timer, qemu_get_clock_ns(vm_clock));
+ }
+ }
+ }
+
+ for (intr = 0; intr < xhci->numintrs; intr++) {
+ if (xhci->intr[intr].msix_used) {
+ msix_vector_use(&xhci->pci_dev, intr);
+ } else {
+ msix_vector_unuse(&xhci->pci_dev, intr);
+ }
+ }
+
+ return 0;
+}
+
+static const VMStateDescription vmstate_xhci_ring = {
+ .name = "xhci-ring",
+ .version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT64(dequeue, XHCIRing),
+ VMSTATE_BOOL(ccs, XHCIRing),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+static const VMStateDescription vmstate_xhci_port = {
+ .name = "xhci-port",
+ .version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32(portsc, XHCIPort),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+static const VMStateDescription vmstate_xhci_slot = {
+ .name = "xhci-slot",
+ .version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_BOOL(enabled, XHCISlot),
+ VMSTATE_BOOL(addressed, XHCISlot),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+static const VMStateDescription vmstate_xhci_event = {
+ .name = "xhci-event",
+ .version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32(type, XHCIEvent),
+ VMSTATE_UINT32(ccode, XHCIEvent),
+ VMSTATE_UINT64(ptr, XHCIEvent),
+ VMSTATE_UINT32(length, XHCIEvent),
+ VMSTATE_UINT32(flags, XHCIEvent),
+ VMSTATE_UINT8(slotid, XHCIEvent),
+ VMSTATE_UINT8(epid, XHCIEvent),
+ }
+};
+
+static bool xhci_er_full(void *opaque, int version_id)
+{
+ struct XHCIInterrupter *intr = opaque;
+ return intr->er_full;
+}
+
+static const VMStateDescription vmstate_xhci_intr = {
+ .name = "xhci-intr",
+ .version_id = 1,
+ .fields = (VMStateField[]) {
+ /* registers */
+ VMSTATE_UINT32(iman, XHCIInterrupter),
+ VMSTATE_UINT32(imod, XHCIInterrupter),
+ VMSTATE_UINT32(erstsz, XHCIInterrupter),
+ VMSTATE_UINT32(erstba_low, XHCIInterrupter),
+ VMSTATE_UINT32(erstba_high, XHCIInterrupter),
+ VMSTATE_UINT32(erdp_low, XHCIInterrupter),
+ VMSTATE_UINT32(erdp_high, XHCIInterrupter),
+
+ /* state */
+ VMSTATE_BOOL(msix_used, XHCIInterrupter),
+ VMSTATE_BOOL(er_pcs, XHCIInterrupter),
+ VMSTATE_UINT64(er_start, XHCIInterrupter),
+ VMSTATE_UINT32(er_size, XHCIInterrupter),
+ VMSTATE_UINT32(er_ep_idx, XHCIInterrupter),
+
+ /* event queue (used if ring is full) */
+ VMSTATE_BOOL(er_full, XHCIInterrupter),
+ VMSTATE_UINT32_TEST(ev_buffer_put, XHCIInterrupter, xhci_er_full),
+ VMSTATE_UINT32_TEST(ev_buffer_get, XHCIInterrupter, xhci_er_full),
+ VMSTATE_STRUCT_ARRAY_TEST(ev_buffer, XHCIInterrupter, EV_QUEUE,
+ xhci_er_full, 1,
+ vmstate_xhci_event, XHCIEvent),
+
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static const VMStateDescription vmstate_xhci = {
.name = "xhci",
- .unmigratable = 1,
+ .version_id = 1,
+ .post_load = usb_xhci_post_load,
+ .fields = (VMStateField[]) {
+ VMSTATE_PCIE_DEVICE(pci_dev, XHCIState),
+ VMSTATE_MSIX(pci_dev, XHCIState),
+
+ VMSTATE_STRUCT_VARRAY_UINT32(ports, XHCIState, numports, 1,
+ vmstate_xhci_port, XHCIPort),
+ VMSTATE_STRUCT_VARRAY_UINT32(slots, XHCIState, numslots, 1,
+ vmstate_xhci_slot, XHCISlot),
+ VMSTATE_STRUCT_VARRAY_UINT32(intr, XHCIState, numintrs, 1,
+ vmstate_xhci_intr, XHCIInterrupter),
+
+ /* Operational Registers */
+ VMSTATE_UINT32(usbcmd, XHCIState),
+ VMSTATE_UINT32(usbsts, XHCIState),
+ VMSTATE_UINT32(dnctrl, XHCIState),
+ VMSTATE_UINT32(crcr_low, XHCIState),
+ VMSTATE_UINT32(crcr_high, XHCIState),
+ VMSTATE_UINT32(dcbaap_low, XHCIState),
+ VMSTATE_UINT32(dcbaap_high, XHCIState),
+ VMSTATE_UINT32(config, XHCIState),
+
+ /* Runtime Registers & state */
+ VMSTATE_INT64(mfindex_start, XHCIState),
+ VMSTATE_TIMER(mfwrap_timer, XHCIState),
+ VMSTATE_STRUCT(cmd_ring, XHCIState, 1, vmstate_xhci_ring, XHCIRing),
+
+ VMSTATE_END_OF_LIST()
+ }
};
static Property xhci_properties[] = {
--
1.7.9.7
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 0/7] usb patch queue
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
` (6 preceding siblings ...)
2013-06-03 10:05 ` [Qemu-devel] [PATCH 7/7] xhci: add live migration support Gerd Hoffmann
@ 2013-06-17 21:18 ` Anthony Liguori
7 siblings, 0 replies; 15+ messages in thread
From: Anthony Liguori @ 2013-06-17 21:18 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel
Pulled. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 0/7] usb patch queue
@ 2013-09-19 9:34 Gerd Hoffmann
0 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2013-09-19 9:34 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Here comes the usb patch queue. It has a number of fixes, mostly for
xhci, and removes the old, pre-libusbx usb-host code.
please pull,
Gerd
The following changes since commit 6c2679fc19560699679200fb42ab4659bcbe7f79:
Merge remote-tracking branch 'kiszka/queues/slirp' into staging (2013-09-17 10:01:24 -0500)
are available in the git repository at:
git://git.kraxel.org/qemu usb.90
for you to fetch changes up to 0ca6db4f3b3df5c4e5285a48a7709bdced5068de:
usb: Fix iovec memleak on combined-packet free (2013-09-19 11:28:40 +0200)
----------------------------------------------------------------
Gerd Hoffmann (1):
usb: remove old usb-host code
Hans de Goede (6):
xhci: Fix number of streams allocated when using streams
xhci: Init a transfers xhci, slotid and epid member on epctx alloc
xhci: Add xhci_epid_to_usbep helper function
xhci: Fix memory leak on xhci_disable_ep
usb: Also reset max_packet_size on ep_reset
usb: Fix iovec memleak on combined-packet free
configure | 26 +-
hw/usb/combined-packet.c | 1 +
hw/usb/core.c | 3 +
hw/usb/hcd-xhci.c | 45 +-
hw/usb/host-bsd.c | 639 ----------------
hw/usb/host-linux.c | 1911 ----------------------------------------------
6 files changed, 39 insertions(+), 2586 deletions(-)
delete mode 100644 hw/usb/host-bsd.c
delete mode 100644 hw/usb/host-linux.c
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 0/7] usb patch queue
@ 2014-02-18 15:50 Gerd Hoffmann
2014-02-20 15:36 ` Peter Maydell
0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2014-02-18 15:50 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Nothing major. Cleanups, bugfixes, xhci emulation improvements.
please pull,
Gerd
The following changes since commit 46eef33b89e936ca793e13c4aeea1414e97e8dbb:
Fix QEMU build on OpenBSD on x86 archs (2014-02-17 11:44:00 +0000)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-usb-3
for you to fetch changes up to d6bb65fcd24c8cb8c37ffe324c360f3b0c94b902:
xhci: use DPRINTF() instead of fprintf(stderr, ...) (2014-02-18 15:39:13 +0100)
----------------------------------------------------------------
- xhci improvements and fixes.
- uhci bugfix.
- cleanups.
----------------------------------------------------------------
Gerd Hoffmann (6):
xhci: fix overflow in usb_xhci_post_load
uhci: invalidate queue on device address changes
xhci iso: fix time calculation
xhci iso: allow for some latency
xhci: switch debug printf to tracepoint
xhci: use DPRINTF() instead of fprintf(stderr, ...)
Pantelis Koukousoulas (1):
usb: Remove magic constants from device bmAttributes
hw/usb/desc.c | 2 +-
hw/usb/dev-audio.c | 2 +-
hw/usb/dev-bluetooth.c | 2 +-
hw/usb/dev-hid.c | 8 ++--
hw/usb/dev-hub.c | 3 +-
hw/usb/dev-network.c | 4 +-
hw/usb/dev-serial.c | 2 +-
hw/usb/dev-smartcard-reader.c | 3 +-
hw/usb/dev-storage.c | 6 +--
hw/usb/dev-uas.c | 4 +-
hw/usb/dev-wacom.c | 2 +-
hw/usb/hcd-uhci.c | 2 +
hw/usb/hcd-xhci.c | 102 +++++++++++++++++++++---------------------
include/hw/usb.h | 5 +++
14 files changed, 77 insertions(+), 70 deletions(-)
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 0/7] usb patch queue
2014-02-18 15:50 Gerd Hoffmann
@ 2014-02-20 15:36 ` Peter Maydell
0 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2014-02-20 15:36 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 18 February 2014 15:50, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Nothing major. Cleanups, bugfixes, xhci emulation improvements.
>
> please pull,
> Gerd
>
> The following changes since commit 46eef33b89e936ca793e13c4aeea1414e97e8dbb:
>
> Fix QEMU build on OpenBSD on x86 archs (2014-02-17 11:44:00 +0000)
>
> are available in the git repository at:
>
> git://git.kraxel.org/qemu tags/pull-usb-3
>
> for you to fetch changes up to d6bb65fcd24c8cb8c37ffe324c360f3b0c94b902:
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Qemu-devel] [PULL 0/7] usb patch queue
@ 2016-01-08 10:40 Gerd Hoffmann
2016-01-08 12:50 ` Peter Maydell
0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2016-01-08 10:40 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Here comes the usb patch queue, with a bunch of bugfixes for
mtp and ohci.
please pull,
Gerd
The following changes since commit a7e00e2536941a6e570b45b7ab4afec4505ff67e:
petalogix-ml605: Set the MicroBlaze CPU version to 8.10.a (2016-01-07 14:57:26 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-usb-20160108-1
for you to fetch changes up to 087462c7739869e9b888c06c06c8f1bbfd99779c:
ohci: clear pending SOF on suspend (2016-01-08 09:29:24 +0100)
----------------------------------------------------------------
usb: mtp and ohci fixes.
----------------------------------------------------------------
Bandan Das (2):
usb-mtp: use safe variant when cleaning events list
usb-mtp: fix call to trace function
Hervé Poussineau (3):
ohci: split reset method in 3 parts
ohci: fix Host Controller USBRESET
ohci: fix command HostControllerReset
Laurent Vivier (2):
ohci: delay first SOF interrupt
ohci: clear pending SOF on suspend
hw/usb/dev-mtp.c | 6 ++--
hw/usb/hcd-ohci.c | 85 +++++++++++++++++++++++++++++++++++--------------------
2 files changed, 57 insertions(+), 34 deletions(-)
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PULL 0/7] usb patch queue
2016-01-08 10:40 Gerd Hoffmann
@ 2016-01-08 12:50 ` Peter Maydell
0 siblings, 0 replies; 15+ messages in thread
From: Peter Maydell @ 2016-01-08 12:50 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 8 January 2016 at 10:40, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Here comes the usb patch queue, with a bunch of bugfixes for
> mtp and ohci.
>
> please pull,
> Gerd
>
> The following changes since commit a7e00e2536941a6e570b45b7ab4afec4505ff67e:
>
> petalogix-ml605: Set the MicroBlaze CPU version to 8.10.a (2016-01-07 14:57:26 +0100)
>
> are available in the git repository at:
>
> git://git.kraxel.org/qemu tags/pull-usb-20160108-1
>
> for you to fetch changes up to 087462c7739869e9b888c06c06c8f1bbfd99779c:
>
> ohci: clear pending SOF on suspend (2016-01-08 09:29:24 +0100)
>
> ----------------------------------------------------------------
> usb: mtp and ohci fixes.
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-01-08 12:50 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03 10:05 [Qemu-devel] [PULL 0/7] usb patch queue Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 1/7] Fix usage of USB_DEV_FLAG_IS_HOST flag Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 2/7] host-libusb: Correct test for USB packet state Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 3/7] pci: add VMSTATE_MSIX Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 4/7] xhci: add XHCISlot->addressed Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 5/7] xhci: add xhci_alloc_epctx Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 6/7] xhci: add xhci_init_epctx Gerd Hoffmann
2013-06-03 10:05 ` [Qemu-devel] [PATCH 7/7] xhci: add live migration support Gerd Hoffmann
2013-06-17 21:18 ` [Qemu-devel] [PULL 0/7] usb patch queue Anthony Liguori
-- strict thread matches above, loose matches on Subject: below --
2016-01-08 10:40 Gerd Hoffmann
2016-01-08 12:50 ` Peter Maydell
2014-02-18 15:50 Gerd Hoffmann
2014-02-20 15:36 ` Peter Maydell
2013-09-19 9:34 Gerd Hoffmann
2013-04-16 10:13 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).