[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/10] ehci: Add a ehci_writeback_async_complete_pac
From: |
Hans de Goede |
Subject: |
[Qemu-devel] [PATCH 04/10] ehci: Add a ehci_writeback_async_complete_packet helper function |
Date: |
Wed, 14 Nov 2012 17:21:39 +0100 |
Also drop the warning printf, which was there mainly because this was an
untested code path (as the previous bug fixes to it show), but that no
longer is the case now :)
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/hcd-ehci.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 89b7520..7772c33 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -437,6 +437,22 @@ static inline bool ehci_periodic_enabled(EHCIState *s)
return ehci_enabled(s) && (s->usbcmd & USBCMD_PSE);
}
+/* Finish executing and writeback a packet outside of the regular
+ fetchqh -> fetchqtd -> execute -> writeback cycle */
+static void ehci_writeback_async_complete_packet(EHCIPacket *p)
+{
+ EHCIQueue *q = p->queue;
+ int state;
+
+ state = ehci_get_state(q->ehci, q->async);
+ ehci_state_executing(q);
+ ehci_state_writeback(q); /* Frees the packet! */
+ if (!(q->qh.token & QTD_TOKEN_HALT)) {
+ ehci_state_advqueue(q);
+ }
+ ehci_set_state(q->ehci, q->async, state);
+}
+
/* packet management */
static EHCIPacket *ehci_alloc_packet(EHCIQueue *q)
@@ -454,17 +470,7 @@ static EHCIPacket *ehci_alloc_packet(EHCIQueue *q)
static void ehci_free_packet(EHCIPacket *p)
{
if (p->async == EHCI_ASYNC_FINISHED) {
- EHCIQueue *q = p->queue;
- int state = ehci_get_state(q->ehci, q->async);
- /* This is a normal, but rare condition (cancel racing completion) */
- fprintf(stderr, "EHCI: Warning packet completed but not processed\n");
- ehci_state_executing(q);
- ehci_state_writeback(q);
- if (!(q->qh.token & QTD_TOKEN_HALT)) {
- ehci_state_advqueue(q);
- }
- ehci_set_state(q->ehci, q->async, state);
- /* state_writeback recurses into us with async == EHCI_ASYNC_NONE!! */
+ ehci_writeback_async_complete_packet(p);
return;
}
trace_usb_ehci_packet_action(p->queue, p, "free");
--
1.7.12.1
- [Qemu-devel] [PATCH 00/10] ehci: various fixes, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 01/10] ehci: Don't access packet after freeing it, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 02/10] ehci: Fixup q->qtdaddr after cancelling an already completed packet, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 03/10] ehci: Better detection for qtd-s linked in circles, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 04/10] ehci: Add a ehci_writeback_async_complete_packet helper function,
Hans de Goede <=
- [Qemu-devel] [PATCH 05/10] ehci: Add ehci_verify_qh and ehci_verify_qtd helper functions, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 06/10] ehci: Verify guest does not change the token of inflight qtd-s, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 07/10] ehci: Don't verify the next pointer for periodic qh-s, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 08/10] ehci: Move get / put_dwords upwards, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 09/10] ehci: writeback_async_complete_packet: verify qh and qtd, Hans de Goede, 2012/11/14
- [Qemu-devel] [PATCH 10/10] ehci: Verify qtd for async completed packets, Hans de Goede, 2012/11/14
- Re: [Qemu-devel] [PATCH 00/10] ehci: various fixes, Gerd Hoffmann, 2012/11/15