* [Qemu-devel] [PULL 01/17] usb: Fix bootindex for portnr > 9
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 02/17] xhci: fix debug print compiling error Gerd Hoffmann
` (16 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Markus Armbruster, Gerd Hoffmann
From: Markus Armbruster <armbru@redhat.com>
We identify devices by their Open Firmware device paths. The encoding
of the host controller and hub port numbers is incorrect:
usb_get_fw_dev_path() formats them in decimal, while SeaBIOS uses
hexadecimal. When some port number > 9, SeaBIOS will miss the
bootindex (lucky case), or apply it to another device (unlucky case).
The relevant spec[*] agrees with SeaBIOS (and OVMF, for that matter).
Change %d to %x.
Bug can bite only with host controllers or hubs sporting more than ten
ports. I'm not aware of any.
[*] Open Firmware Recommended Practice: Universal Serial Bus,
Version 1, Section 3.2.1 Device Node Address Representation
http://www.openfirmware.org/1275/bindings/usb/usb-1_0.ps
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Note: xhci can be configured with up to 15 ports (default is 4 ports).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/bus.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 927a47b..516fb52 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -589,11 +589,11 @@ static char *usb_get_fw_dev_path(DeviceState *qdev)
nr = strtol(in, &in, 10);
if (in[0] == '.') {
/* some hub between root port and device */
- pos += snprintf(fw_path + pos, fw_len - pos, "hub@%ld/", nr);
+ pos += snprintf(fw_path + pos, fw_len - pos, "hub@%lx/", nr);
in++;
} else {
/* the device itself */
- pos += snprintf(fw_path + pos, fw_len - pos, "%s@%ld",
+ pos += snprintf(fw_path + pos, fw_len - pos, "%s@%lx",
qdev_fw_name(qdev), nr);
break;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 02/17] xhci: fix debug print compiling error
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 01/17] usb: Fix bootindex for portnr > 9 Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 03/17] Fix OHCI ISO TD state never being written back Gerd Hoffmann
` (15 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
after commit 003e15a180373048f0c1f4df0bfe303746eb2676
the DPRINTF will broke compiling, adjust its location.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 58c4b11..aed8e9f 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1380,14 +1380,11 @@ static void xhci_init_epctx(XHCIEPContext *epctx,
dequeue = xhci_addr64(ctx[2] & ~0xf, ctx[3]);
epctx->type = (ctx[1] >> EP_TYPE_SHIFT) & EP_TYPE_MASK;
- DPRINTF("xhci: endpoint %d.%d type is %d\n", epid/2, epid%2, epctx->type);
epctx->pctx = pctx;
epctx->max_psize = ctx[1]>>16;
epctx->max_psize *= 1+((ctx[1]>>8)&0xff);
epctx->max_pstreams = (ctx[0] >> 10) & 0xf;
epctx->lsa = (ctx[0] >> 15) & 1;
- DPRINTF("xhci: endpoint %d.%d max transaction (burst) size is %d\n",
- epid/2, epid%2, epctx->max_psize);
if (epctx->max_pstreams) {
xhci_alloc_streams(epctx, dequeue);
} else {
@@ -1418,6 +1415,9 @@ static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid,
slot->eps[epid-1] = epctx;
xhci_init_epctx(epctx, pctx, ctx);
+ DPRINTF("xhci: endpoint %d.%d type is %d, max transaction (burst) "
+ "size is %d\n", epid/2, epid%2, epctx->type, epctx->max_psize);
+
epctx->mfindex_last = 0;
epctx->state = EP_RUNNING;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 03/17] Fix OHCI ISO TD state never being written back.
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 01/17] usb: Fix bootindex for portnr > 9 Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 02/17] xhci: fix debug print compiling error Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 04/17] xhci: use (1u << i) Gerd Hoffmann
` (14 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Jack Un
From: Jack Un <jack.un@gmail.com>
There appears to be typo in OHCI with isochronous transfers
resulting in isoch. transfer descriptor state never being written back.
The'put_words' function is in a OR statement hence it is never called.
Signed-off-by: Jack Un <jack.un@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ohci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 13afdf5..cacf7b0 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -619,8 +619,8 @@ static inline int ohci_put_td(OHCIState *ohci,
static inline int ohci_put_iso_td(OHCIState *ohci,
dma_addr_t addr, struct ohci_iso_td *td)
{
- return put_dwords(ohci, addr, (uint32_t *)td, 4 ||
- put_words(ohci, addr + 16, td->offset, 8));
+ return put_dwords(ohci, addr, (uint32_t *)td, 4) ||
+ put_words(ohci, addr + 16, td->offset, 8);
}
static inline int ohci_put_hcca(OHCIState *ohci,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 04/17] xhci: use (1u << i)
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (2 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 03/17] Fix OHCI ISO TD state never being written back Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 05/17] Revert "xhci: Fix number of streams allocated when using streams" Gerd Hoffmann
` (13 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/usb/hcd-xhci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index aed8e9f..f7f9fed 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1180,7 +1180,7 @@ static int xhci_epmask_to_eps_with_streams(XHCIState *xhci,
slot = &xhci->slots[slotid - 1];
for (i = 2, j = 0; i <= 31; i++) {
- if (!(epmask & (1 << i))) {
+ if (!(epmask & (1u << i))) {
continue;
}
@@ -2465,7 +2465,7 @@ static TRBCCode xhci_configure_slot(XHCIState *xhci, unsigned int slotid,
res = xhci_alloc_device_streams(xhci, slotid, ictl_ctx[1]);
if (res != CC_SUCCESS) {
for (i = 2; i <= 31; i++) {
- if (ictl_ctx[1] & (1 << i)) {
+ if (ictl_ctx[1] & (1u << i)) {
xhci_disable_ep(xhci, slotid, i);
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 05/17] Revert "xhci: Fix number of streams allocated when using streams"
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (3 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 04/17] xhci: use (1u << i) Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 06/17] usb: add usb_bus_release function Gerd Hoffmann
` (12 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This reverts commit d063c3112c4cd23a479ee18720c2bd119da2d315.
"2 << x" is the same as "2 ^ (x + 1)", so the old code is correct.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index f7f9fed..88660e8 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1151,7 +1151,7 @@ static void xhci_reset_streams(XHCIEPContext *epctx)
static void xhci_alloc_streams(XHCIEPContext *epctx, dma_addr_t base)
{
assert(epctx->pstreams == NULL);
- epctx->nr_pstreams = 2 << (epctx->max_pstreams + 1);
+ epctx->nr_pstreams = 2 << epctx->max_pstreams;
epctx->pstreams = xhci_alloc_stream_contexts(epctx->nr_pstreams, base);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 06/17] usb: add usb_bus_release function
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (4 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 05/17] Revert "xhci: Fix number of streams allocated when using streams" Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 07/17] usb-ohci: Fix memory leak for ohci timer Gerd Hoffmann
` (11 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
add global variables releasing logic when the usb buses
were removed or hot-unpluged.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/bus.c | 7 +++++++
include/hw/usb.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 516fb52..c7c4dad 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -87,6 +87,13 @@ void usb_bus_new(USBBus *bus, size_t bus_size,
QTAILQ_INSERT_TAIL(&busses, bus, next);
}
+void usb_bus_release(USBBus *bus)
+{
+ assert(next_usb_bus > 0);
+
+ QTAILQ_REMOVE(&busses, bus, next);
+}
+
USBBus *usb_bus_find(int busnr)
{
USBBus *bus;
diff --git a/include/hw/usb.h b/include/hw/usb.h
index 223a5ae..6b32a3b 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -529,6 +529,7 @@ struct USBBusOps {
void usb_bus_new(USBBus *bus, size_t bus_size,
USBBusOps *ops, DeviceState *host);
+void usb_bus_release(USBBus *bus);
USBBus *usb_bus_find(int busnr);
void usb_legacy_register(const char *typename, const char *usbdevice_name,
USBDevice *(*usbdevice_init)(USBBus *bus,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 07/17] usb-ohci: Fix memory leak for ohci timer
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (5 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 06/17] usb: add usb_bus_release function Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 08/17] usb-ohci: add exit function Gerd Hoffmann
` (10 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ohci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index cacf7b0..5505f0a 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1371,8 +1371,10 @@ static int ohci_bus_start(OHCIState *ohci)
/* Stop sending SOF tokens on the bus */
static void ohci_bus_stop(OHCIState *ohci)
{
- if (ohci->eof_timer)
+ if (ohci->eof_timer) {
timer_del(ohci->eof_timer);
+ timer_free(ohci->eof_timer);
+ }
ohci->eof_timer = NULL;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 08/17] usb-ohci: add exit function
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (6 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 07/17] usb-ohci: Fix memory leak for ohci timer Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 09/17] usb-uhci: clean up uhci resource when pci-uhci exit Gerd Hoffmann
` (9 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
clean up ohci resource when ohci pci device exit.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ohci.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 5505f0a..83bec34 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1954,6 +1954,24 @@ static int usb_ohci_initfn_pci(PCIDevice *dev)
return 0;
}
+static void usb_ohci_exit(PCIDevice *dev)
+{
+ OHCIPCIState *ohci = PCI_OHCI(dev);
+ OHCIState *s = &ohci->state;
+
+ ohci_bus_stop(s);
+
+ if (s->async_td) {
+ usb_cancel_packet(&s->usb_packet);
+ s->async_td = 0;
+ }
+ ohci_stop_endpoints(s);
+
+ if (!ohci->masterbus) {
+ usb_bus_release(&s->bus);
+ }
+}
+
#define TYPE_SYSBUS_OHCI "sysbus-ohci"
#define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj), TYPE_SYSBUS_OHCI)
@@ -2091,6 +2109,7 @@ static void ohci_pci_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ohci_initfn_pci;
+ k->exit = usb_ohci_exit;
k->vendor_id = PCI_VENDOR_ID_APPLE;
k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
k->class_id = PCI_CLASS_SERIAL_USB;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 09/17] usb-uhci: clean up uhci resource when pci-uhci exit
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (7 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 08/17] usb-ohci: add exit function Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 10/17] usb-ehci: add vmstate properity for EHCIState Gerd Hoffmann
` (8 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
clean up uhci resource when uhci pci device exit.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-uhci.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index ee5f112..220115b 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1256,6 +1256,27 @@ static int usb_uhci_vt82c686b_initfn(PCIDevice *dev)
return usb_uhci_common_initfn(dev);
}
+static void usb_uhci_exit(PCIDevice *dev)
+{
+ UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
+
+ if (s->frame_timer) {
+ timer_del(s->frame_timer);
+ timer_free(s->frame_timer);
+ s->frame_timer = NULL;
+ }
+
+ if (s->bh) {
+ qemu_bh_delete(s->bh);
+ }
+
+ uhci_async_cancel_all(s);
+
+ if (!s->masterbus) {
+ usb_bus_release(&s->bus);
+ }
+}
+
static Property uhci_properties[] = {
DEFINE_PROP_STRING("masterbus", UHCIState, masterbus),
DEFINE_PROP_UINT32("firstport", UHCIState, firstport, 0),
@@ -1272,6 +1293,7 @@ static void uhci_class_init(ObjectClass *klass, void *data)
UHCIInfo *info = data;
k->init = info->initfn ? info->initfn : usb_uhci_common_initfn;
+ k->exit = info->unplug ? usb_uhci_exit : NULL;
k->vendor_id = info->vendor_id;
k->device_id = info->device_id;
k->revision = info->revision;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 10/17] usb-ehci: add vmstate properity for EHCIState
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (8 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 09/17] usb-uhci: clean up uhci resource when pci-uhci exit Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 11/17] usb-ehci: add ehci unrealize funciton Gerd Hoffmann
` (7 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
since hotunplug the ehci host adapter, we should
delete vm_change_state_handler also, so the
VMChangeStateEntry should be saved in EHCIState.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci.c | 2 +-
hw/usb/hcd-ehci.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 448e007..ef26f36 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2468,7 +2468,7 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
s->device = dev;
qemu_register_reset(ehci_reset, s);
- qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
+ s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
}
void usb_ehci_init(EHCIState *s, DeviceState *dev)
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 1ad4b96..594d9d3 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -316,6 +316,7 @@ struct EHCIState {
uint32_t async_stepdown;
uint32_t periodic_sched_active;
bool int_req_by_async;
+ VMChangeStateEntry *vmstate;
};
extern const VMStateDescription vmstate_ehci;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 11/17] usb-ehci: add ehci unrealize funciton
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (9 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 10/17] usb-ehci: add vmstate properity for EHCIState Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 12/17] usb-ehci: add ehci-pci device exit function Gerd Hoffmann
` (6 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
cleanup ehci controller resource, both pci and sysbus
if they're necessary.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci.c | 25 +++++++++++++++++++++++++
hw/usb/hcd-ehci.h | 1 +
2 files changed, 26 insertions(+)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index ef26f36..2aa06bb 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2471,6 +2471,31 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
}
+void usb_ehci_unrealize(EHCIState *s, DeviceState *dev, Error **errp)
+{
+ if (s->frame_timer) {
+ timer_del(s->frame_timer);
+ timer_free(s->frame_timer);
+ s->frame_timer = NULL;
+ }
+ if (s->async_bh) {
+ qemu_bh_delete(s->async_bh);
+ }
+
+ ehci_queues_rip_all(s, 0);
+ ehci_queues_rip_all(s, 1);
+
+ memory_region_del_subregion(&s->mem, &s->mem_caps);
+ memory_region_del_subregion(&s->mem, &s->mem_opreg);
+ memory_region_del_subregion(&s->mem, &s->mem_ports);
+
+ usb_bus_release(&s->bus);
+
+ if (s->vmstate) {
+ qemu_del_vm_change_state_handler(s->vmstate);
+ }
+}
+
void usb_ehci_init(EHCIState *s, DeviceState *dev)
{
/* 2.2 host controller interface version */
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 594d9d3..4858b7e 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -323,6 +323,7 @@ extern const VMStateDescription vmstate_ehci;
void usb_ehci_init(EHCIState *s, DeviceState *dev);
void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp);
+void usb_ehci_unrealize(EHCIState *s, DeviceState *dev, Error **errp);
#define TYPE_PCI_EHCI "pci-ehci-usb"
#define PCI_EHCI(obj) OBJECT_CHECK(EHCIPCIState, (obj), TYPE_PCI_EHCI)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 12/17] usb-ehci: add ehci-pci device exit function
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (10 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 11/17] usb-ehci: add ehci unrealize funciton Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 13/17] usb-xhci: add " Gerd Hoffmann
` (5 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
clean up ehci resource when ehci pci device exit.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci-pci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 505741a..289ca3b 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -84,6 +84,19 @@ static void usb_ehci_pci_init(Object *obj)
usb_ehci_init(s, DEVICE(obj));
}
+static void usb_ehci_pci_exit(PCIDevice *dev)
+{
+ EHCIPCIState *i = PCI_EHCI(dev);
+ EHCIState *s = &i->ehci;
+
+ usb_ehci_unrealize(s, DEVICE(dev), NULL);
+
+ if (s->irq) {
+ g_free(s->irq);
+ s->irq = NULL;
+ }
+}
+
static void usb_ehci_pci_write_config(PCIDevice *dev, uint32_t addr,
uint32_t val, int l)
{
@@ -121,6 +134,7 @@ static void ehci_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ehci_pci_initfn;
+ k->exit = usb_ehci_pci_exit;
k->class_id = PCI_CLASS_SERIAL_USB;
k->config_write = usb_ehci_pci_write_config;
dc->hotpluggable = false;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 13/17] usb-xhci: add exit function
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (11 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 12/17] usb-ehci: add ehci-pci device exit function Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 14/17] usb: add usb host adapters exit trace Gerd Hoffmann
` (4 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
clean up xhci resource when xhci pci device exit.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 88660e8..a9245d8 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3644,6 +3644,41 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
return 0;
}
+static void usb_xhci_exit(PCIDevice *dev)
+{
+ int i;
+ XHCIState *xhci = XHCI(dev);
+
+ for (i = 0; i < xhci->numslots; i++) {
+ xhci_disable_slot(xhci, i + 1);
+ }
+
+ if (xhci->mfwrap_timer) {
+ timer_del(xhci->mfwrap_timer);
+ timer_free(xhci->mfwrap_timer);
+ xhci->mfwrap_timer = NULL;
+ }
+
+ memory_region_del_subregion(&xhci->mem, &xhci->mem_cap);
+ memory_region_del_subregion(&xhci->mem, &xhci->mem_oper);
+ memory_region_del_subregion(&xhci->mem, &xhci->mem_runtime);
+ memory_region_del_subregion(&xhci->mem, &xhci->mem_doorbell);
+
+ for (i = 0; i < xhci->numports; i++) {
+ XHCIPort *port = &xhci->ports[i];
+ memory_region_del_subregion(&xhci->mem, &port->mem);
+ }
+
+ /* destroy msix memory region */
+ if (dev->msix_table && dev->msix_pba
+ && dev->msix_entry_used) {
+ memory_region_del_subregion(&xhci->mem, &dev->msix_table_mmio);
+ memory_region_del_subregion(&xhci->mem, &dev->msix_pba_mmio);
+ }
+
+ usb_bus_release(&xhci->bus);
+}
+
static int usb_xhci_post_load(void *opaque, int version_id)
{
XHCIState *xhci = opaque;
@@ -3836,6 +3871,7 @@ static void xhci_class_init(ObjectClass *klass, void *data)
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_USB, dc->categories);
k->init = usb_xhci_initfn;
+ k->exit = usb_xhci_exit;
k->vendor_id = PCI_VENDOR_ID_NEC;
k->device_id = PCI_DEVICE_ID_NEC_UPD720200;
k->class_id = PCI_CLASS_SERIAL_USB;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 14/17] usb: add usb host adapters exit trace
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (12 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 13/17] usb-xhci: add " Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 15/17] tests: add OHCI qtest Gerd Hoffmann
` (3 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-ehci.c | 2 ++
hw/usb/hcd-uhci.c | 2 ++
hw/usb/hcd-xhci.c | 2 ++
trace-events | 3 +++
4 files changed, 9 insertions(+)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 2aa06bb..bacb7ce 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2473,6 +2473,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
void usb_ehci_unrealize(EHCIState *s, DeviceState *dev, Error **errp)
{
+ trace_usb_ehci_unrealize();
+
if (s->frame_timer) {
timer_del(s->frame_timer);
timer_free(s->frame_timer);
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 220115b..3b3ebcd 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1260,6 +1260,8 @@ static void usb_uhci_exit(PCIDevice *dev)
{
UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
+ trace_usb_uhci_exit();
+
if (s->frame_timer) {
timer_del(s->frame_timer);
timer_free(s->frame_timer);
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index a9245d8..bbe4c5f 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3649,6 +3649,8 @@ static void usb_xhci_exit(PCIDevice *dev)
int i;
XHCIState *xhci = XHCI(dev);
+ trace_usb_xhci_exit();
+
for (i = 0; i < xhci->numslots; i++) {
xhci_disable_slot(xhci, i + 1);
}
diff --git a/trace-events b/trace-events
index 81bc915..03ac5d2 100644
--- a/trace-events
+++ b/trace-events
@@ -297,6 +297,7 @@ usb_port_release(int bus, const char *port) "bus %d, port %s"
# hw/usb/hcd-ehci.c
usb_ehci_reset(void) "=== RESET ==="
+usb_ehci_unrealize(void) "=== UNREALIZE ==="
usb_ehci_opreg_read(uint32_t addr, const char *str, uint32_t val) "rd mmio %04x [%s] = %x"
usb_ehci_opreg_write(uint32_t addr, const char *str, uint32_t val) "wr mmio %04x [%s] = %x"
usb_ehci_opreg_change(uint32_t addr, const char *str, uint32_t new, uint32_t old) "ch mmio %04x [%s] = %x (old: %x)"
@@ -329,6 +330,7 @@ usb_ehci_dma_error(void) ""
# hw/usb/hcd-uhci.c
usb_uhci_reset(void) "=== RESET ==="
+usb_uhci_exit(void) "=== EXIT ==="
usb_uhci_schedule_start(void) ""
usb_uhci_schedule_stop(void) ""
usb_uhci_frame_start(uint32_t num) "nr %d"
@@ -358,6 +360,7 @@ usb_uhci_td_complete(uint32_t qh, uint32_t td) "qh 0x%x, td 0x%x"
# hw/usb/hcd-xhci.c
usb_xhci_reset(void) "=== RESET ==="
+usb_xhci_exit(void) "=== EXIT ==="
usb_xhci_run(void) ""
usb_xhci_stop(void) ""
usb_xhci_cap_read(uint32_t off, uint32_t val) "off 0x%04x, ret 0x%08x"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 15/17] tests: add OHCI qtest
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (13 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 14/17] usb: add usb host adapters exit trace Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 16/17] tests: add UHCI qtest Gerd Hoffmann
` (2 subsequent siblings)
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
MAINTAINERS | 2 +-
tests/Makefile | 3 +++
tests/usb-hcd-ohci-test.c | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 tests/usb-hcd-ohci-test.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 59940f9..a74c04c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -614,7 +614,7 @@ USB
M: Gerd Hoffmann <kraxel@redhat.com>
S: Maintained
F: hw/usb/*
-F: tests/usb-hcd-ehci-test.c
+F: tests/usb-*-test.c
VFIO
M: Alex Williamson <alex.williamson@redhat.com>
diff --git a/tests/Makefile b/tests/Makefile
index 837e9c8..5d67a55 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -155,6 +155,8 @@ check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
gcov-files-i386-y += hw/pci-bridge/i82801b11.c
check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
gcov-files-i386-y += hw/pci-bridge/ioh3420.c
+check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
+gcov-files-i386-y += hw/usb/hcd-ohci.c
check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
gcov-files-i386-y += hw/usb/hcd-ehci.c
gcov-files-i386-y += hw/usb/hcd-uhci.c
@@ -335,6 +337,7 @@ tests/ac97-test$(EXESUF): tests/ac97-test.o
tests/es1370-test$(EXESUF): tests/es1370-test.o
tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
+tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c
new file mode 100644
index 0000000..fbc3ffe
--- /dev/null
+++ b/tests/usb-hcd-ohci-test.c
@@ -0,0 +1,35 @@
+/*
+ * QTest testcase for USB OHCI controller
+ *
+ * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+
+static void test_ohci_init(void)
+{
+ qtest_start("-device pci-ohci,id=ohci");
+
+ qtest_end();
+}
+
+
+int main(int argc, char **argv)
+{
+ int ret;
+
+ g_test_init(&argc, &argv, NULL);
+
+ qtest_add_func("/ohci/pci/init", test_ohci_init);
+
+ ret = g_test_run();
+
+ return ret;
+}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 16/17] tests: add UHCI qtest
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (14 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 15/17] tests: add OHCI qtest Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 12:03 ` [Qemu-devel] [PULL 17/17] tests: add xHCI qtest Gerd Hoffmann
2014-08-29 13:12 ` [Qemu-devel] [PULL 00/17] usb patch queue Peter Maydell
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
tests/Makefile | 4 +++-
tests/usb-hcd-uhci-test.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
create mode 100644 tests/usb-hcd-uhci-test.c
diff --git a/tests/Makefile b/tests/Makefile
index 5d67a55..6eff8cd 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -157,9 +157,10 @@ check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
gcov-files-i386-y += hw/pci-bridge/ioh3420.c
check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
gcov-files-i386-y += hw/usb/hcd-ohci.c
+check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
+gcov-files-i386-y += hw/usb/hcd-uhci.c
check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
gcov-files-i386-y += hw/usb/hcd-ehci.c
-gcov-files-i386-y += hw/usb/hcd-uhci.c
gcov-files-i386-y += hw/usb/dev-hid.c
gcov-files-i386-y += hw/usb/dev-storage.c
check-qtest-i386-$(CONFIG_LINUX) += tests/vhost-user-test$(EXESUF)
@@ -338,6 +339,7 @@ tests/es1370-test$(EXESUF): tests/es1370-test.o
tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
+tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o
tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c
new file mode 100644
index 0000000..94e858f
--- /dev/null
+++ b/tests/usb-hcd-uhci-test.c
@@ -0,0 +1,35 @@
+/*
+ * QTest testcase for USB UHCI controller
+ *
+ * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+
+static void test_uhci_init(void)
+{
+ qtest_start("-device piix3-usb-uhci,id=uhci");
+
+ qtest_end();
+}
+
+
+int main(int argc, char **argv)
+{
+ int ret;
+
+ g_test_init(&argc, &argv, NULL);
+
+ qtest_add_func("/uhci/pci/init", test_uhci_init);
+
+ ret = g_test_run();
+
+ return ret;
+}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [Qemu-devel] [PULL 17/17] tests: add xHCI qtest
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (15 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 16/17] tests: add UHCI qtest Gerd Hoffmann
@ 2014-08-29 12:03 ` Gerd Hoffmann
2014-08-29 13:12 ` [Qemu-devel] [PULL 00/17] usb patch queue Peter Maydell
17 siblings, 0 replies; 19+ messages in thread
From: Gerd Hoffmann @ 2014-08-29 12:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann
From: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
tests/Makefile | 3 +++
tests/usb-hcd-xhci-test.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 tests/usb-hcd-xhci-test.c
diff --git a/tests/Makefile b/tests/Makefile
index 6eff8cd..469c0a5 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -163,6 +163,8 @@ check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
gcov-files-i386-y += hw/usb/hcd-ehci.c
gcov-files-i386-y += hw/usb/dev-hid.c
gcov-files-i386-y += hw/usb/dev-storage.c
+check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
+gcov-files-i386-y += hw/usb/hcd-xhci.c
check-qtest-i386-$(CONFIG_LINUX) += tests/vhost-user-test$(EXESUF)
check-qtest-x86_64-y = $(check-qtest-i386-y)
gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
@@ -341,6 +343,7 @@ tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o
tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
+tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c
new file mode 100644
index 0000000..743e979
--- /dev/null
+++ b/tests/usb-hcd-xhci-test.c
@@ -0,0 +1,35 @@
+/*
+ * QTest testcase for USB xHCI controller
+ *
+ * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+
+static void test_xhci_init(void)
+{
+ qtest_start("-device nec-usb-xhci,id=xhci");
+
+ qtest_end();
+}
+
+
+int main(int argc, char **argv)
+{
+ int ret;
+
+ g_test_init(&argc, &argv, NULL);
+
+ qtest_add_func("/xhci/pci/init", test_xhci_init);
+
+ ret = g_test_run();
+
+ return ret;
+}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [Qemu-devel] [PULL 00/17] usb patch queue
2014-08-29 12:03 [Qemu-devel] [PULL 00/17] usb patch queue Gerd Hoffmann
` (16 preceding siblings ...)
2014-08-29 12:03 ` [Qemu-devel] [PULL 17/17] tests: add xHCI qtest Gerd Hoffmann
@ 2014-08-29 13:12 ` Peter Maydell
17 siblings, 0 replies; 19+ messages in thread
From: Peter Maydell @ 2014-08-29 13:12 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 29 August 2014 13:03, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Here comes the usb patch queue. It features cleanup functions for the
> host adapters, in preparation to make them hot-pluggable. Hotplug itself
> isn't there yet, some details still need to be sorted as we can't
> hotplug companion controller setups (expect RfC patches soon), but the
> majority of the bits needed to make hotplug fly is there.
>
> There are also some simple host adapter tests (just start qemu with an
> device instance, not much actual testing yet), and the usual collection
> of bugfixes.
>
> please pull,
> Gerd
>
> The following changes since commit c47c61be8dcd91689c8fc77776db924d684c3b39:
>
> Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140825.0' into staging (2014-08-26 10:42:06 +0100)
>
> are available in the git repository at:
>
>
> git://git.kraxel.org/qemu tags/pull-usb-20140829-1
>
> for you to fetch changes up to 25e89ec5d2c7f8d953cb1ca558afa74974ff8930:
>
> tests: add xHCI qtest (2014-08-29 12:53:47 +0200)
>
> ----------------------------------------------------------------
> usb: bugfix collection.
> usb: add cleanup functions for host adapters,
> in preparation for hotplug support.
> usb: add simple qtests for uhci,ohci,xhci.
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 19+ messages in thread