|
Hans de Goede |
c8dfc6 |
From cbbfcc647e26708cdd78c8ddf28d99f8a1e1e6b0 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
c8dfc6 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Date: Mon, 3 Sep 2012 10:22:16 +0200
|
|
Hans de Goede |
c8dfc6 |
Subject: [PATCH 313/366] ehci: Add some additional ehci_trace_guest_bug()
|
|
Hans de Goede |
c8dfc6 |
calls
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Hans de Goede |
c8dfc6 |
---
|
|
Hans de Goede |
c8dfc6 |
hw/usb/hcd-ehci.c | 19 +++++++++++++------
|
|
Hans de Goede |
c8dfc6 |
1 file changed, 13 insertions(+), 6 deletions(-)
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
|
|
Hans de Goede |
c8dfc6 |
index 398f5e0..5a88268 100644
|
|
Hans de Goede |
c8dfc6 |
--- a/hw/usb/hcd-ehci.c
|
|
Hans de Goede |
c8dfc6 |
+++ b/hw/usb/hcd-ehci.c
|
|
Hans de Goede |
c8dfc6 |
@@ -820,12 +820,16 @@ static int ehci_reset_queue(EHCIQueue *q)
|
|
Hans de Goede |
c8dfc6 |
return packets;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
-static void ehci_free_queue(EHCIQueue *q)
|
|
Hans de Goede |
c8dfc6 |
+static void ehci_free_queue(EHCIQueue *q, const char *warn)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
EHCIQueueHead *head = q->async ? &q->ehci->aqueues : &q->ehci->pqueues;
|
|
Hans de Goede |
c8dfc6 |
+ int cancelled;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
trace_usb_ehci_queue_action(q, "free");
|
|
Hans de Goede |
c8dfc6 |
- ehci_cancel_queue(q);
|
|
Hans de Goede |
c8dfc6 |
+ cancelled = ehci_cancel_queue(q);
|
|
Hans de Goede |
c8dfc6 |
+ if (warn && cancelled > 0) {
|
|
Hans de Goede |
c8dfc6 |
+ ehci_trace_guest_bug(q->ehci, warn);
|
|
Hans de Goede |
c8dfc6 |
+ }
|
|
Hans de Goede |
c8dfc6 |
QTAILQ_REMOVE(head, q, next);
|
|
Hans de Goede |
c8dfc6 |
g_free(q);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
@@ -847,6 +851,7 @@ static EHCIQueue *ehci_find_queue_by_qh(EHCIState *ehci, uint32_t addr,
|
|
Hans de Goede |
c8dfc6 |
static void ehci_queues_rip_unused(EHCIState *ehci, int async, int flush)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
EHCIQueueHead *head = async ? &ehci->aqueues : &ehci->pqueues;
|
|
Hans de Goede |
c8dfc6 |
+ const char *warn = (async && !flush) ? "guest unlinked busy QH" : NULL;
|
|
Hans de Goede |
c8dfc6 |
uint64_t maxage = FRAME_TIMER_NS * ehci->maxframes * 4;
|
|
Hans de Goede |
c8dfc6 |
EHCIQueue *q, *tmp;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
@@ -859,7 +864,7 @@ static void ehci_queues_rip_unused(EHCIState *ehci, int async, int flush)
|
|
Hans de Goede |
c8dfc6 |
if (!flush && ehci->last_run_ns < q->ts + maxage) {
|
|
Hans de Goede |
c8dfc6 |
continue;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
- ehci_free_queue(q);
|
|
Hans de Goede |
c8dfc6 |
+ ehci_free_queue(q, warn);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
@@ -872,17 +877,18 @@ static void ehci_queues_rip_device(EHCIState *ehci, USBDevice *dev, int async)
|
|
Hans de Goede |
c8dfc6 |
if (q->dev != dev) {
|
|
Hans de Goede |
c8dfc6 |
continue;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
- ehci_free_queue(q);
|
|
Hans de Goede |
c8dfc6 |
+ ehci_free_queue(q, NULL);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
static void ehci_queues_rip_all(EHCIState *ehci, int async)
|
|
Hans de Goede |
c8dfc6 |
{
|
|
Hans de Goede |
c8dfc6 |
EHCIQueueHead *head = async ? &ehci->aqueues : &ehci->pqueues;
|
|
Hans de Goede |
c8dfc6 |
+ const char *warn = async ? "guest stopped busy async schedule" : NULL;
|
|
Hans de Goede |
c8dfc6 |
EHCIQueue *q, *tmp;
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
QTAILQ_FOREACH_SAFE(q, head, next, tmp) {
|
|
Hans de Goede |
c8dfc6 |
- ehci_free_queue(q);
|
|
Hans de Goede |
c8dfc6 |
+ ehci_free_queue(q, warn);
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
@@ -1549,7 +1555,8 @@ static int ehci_execute(EHCIPacket *p, const char *action)
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
p->tbytes = (p->qtd.token & QTD_TOKEN_TBYTES_MASK) >> QTD_TOKEN_TBYTES_SH;
|
|
Hans de Goede |
c8dfc6 |
if (p->tbytes > BUFF_SIZE) {
|
|
Hans de Goede |
c8dfc6 |
- fprintf(stderr, "Request for more bytes than allowed\n");
|
|
Hans de Goede |
c8dfc6 |
+ ehci_trace_guest_bug(p->queue->ehci,
|
|
Hans de Goede |
c8dfc6 |
+ "guest requested more bytes than allowed");
|
|
Hans de Goede |
c8dfc6 |
return USB_RET_PROCERR;
|
|
Hans de Goede |
c8dfc6 |
}
|
|
Hans de Goede |
c8dfc6 |
|
|
Hans de Goede |
c8dfc6 |
--
|
|
Hans de Goede |
c8dfc6 |
1.7.12
|
|
Hans de Goede |
c8dfc6 |
|