From: Hans de Goede <hdegoede@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 10/12] ehci: Add support for input queuing
Date: Mon, 8 Oct 2012 09:51:34 +0200 [thread overview]
Message-ID: <1349682696-3046-11-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1349682696-3046-1-git-send-email-hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
hw/usb/hcd-ehci.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index d9d4918..444db15 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -353,13 +353,13 @@ enum async_state {
};
struct EHCIPacket {
+ USBPacket packet;
EHCIQueue *queue;
QTAILQ_ENTRY(EHCIPacket) next;
EHCIqtd qtd; /* copy of current QTD (being worked on) */
uint32_t qtdaddr; /* address QTD read from */
- USBPacket packet;
QEMUSGList sgl;
int pid;
enum async_state async;
@@ -990,6 +990,21 @@ static void ehci_wakeup(USBPort *port)
qemu_bh_schedule(s->async_bh);
}
+static void ehci_remove_from_queue(USBPort *port, USBPacket *usb_p)
+{
+ EHCIState *s = port->opaque;
+ uint32_t portsc = s->portsc[port->index];
+ EHCIPacket *p = DO_UPCAST(EHCIPacket, packet, usb_p);
+
+ if (portsc & PORTSC_POWNER) {
+ USBPort *companion = s->companion_ports[port->index];
+ companion->ops->remove_from_queue(companion, usb_p);
+ return;
+ }
+
+ ehci_free_packet(p);
+}
+
static int ehci_register_companion(USBBus *bus, USBPort *ports[],
uint32_t portcount, uint32_t firstport)
{
@@ -1021,6 +1036,8 @@ static int ehci_register_companion(USBBus *bus, USBPort *ports[],
s->companion_ports[firstport + i] = ports[i];
s->ports[firstport + i].speedmask |=
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL;
+ /* Only claim to support queuing if our companion does too */
+ s->ports[firstport + i].supports_queuing = ports[i]->supports_queuing;
/* Ensure devs attached before the initial reset go to the companion */
s->portsc[firstport + i] = PORTSC_POWNER;
}
@@ -1580,6 +1597,10 @@ static int ehci_execute(EHCIPacket *p, const char *action)
usb_packet_setup(&p->packet, p->pid, ep, p->qtdaddr);
usb_packet_map(&p->packet, &p->sgl);
+ if (p->pid == USB_TOKEN_IN && NLPTR_TBIT(p->qtd.altnext) == 0) {
+ p->packet.short_not_ok = true;
+ }
+ p->packet.int_req = ((p->qtd.token & QTD_TOKEN_IOC) != 0);
p->async = EHCI_ASYNC_INITIALIZED;
}
@@ -2071,7 +2092,8 @@ static int ehci_fill_queue(EHCIPacket *p)
uint32_t qtdaddr;
for (;;) {
- if (NLPTR_TBIT(qtd.altnext) == 0) {
+ if (!usb_ep_input_pipeline(p->packet.ep) &&
+ NLPTR_TBIT(qtd.altnext) == 0) {
break;
}
if (NLPTR_TBIT(qtd.next) != 0) {
@@ -2094,6 +2116,9 @@ static int ehci_fill_queue(EHCIPacket *p)
assert(p->usb_status == USB_RET_ASYNC);
p->async = EHCI_ASYNC_INFLIGHT;
}
+ if (p->usb_status != USB_RET_PROCERR) {
+ usb_ep_process_queue(p->packet.ep);
+ }
return p->usb_status;
}
@@ -2548,6 +2573,7 @@ static USBPortOps ehci_port_ops = {
.child_detach = ehci_child_detach,
.wakeup = ehci_wakeup,
.complete = ehci_async_complete_packet,
+ .remove_from_queue = ehci_remove_from_queue,
};
static USBBusOps ehci_bus_ops = {
@@ -2740,6 +2766,7 @@ static int usb_ehci_initfn(PCIDevice *dev)
usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops,
USB_SPEED_MASK_HIGH);
s->ports[i].dev = 0;
+ s->ports[i].supports_queuing = true;
}
s->frame_timer = qemu_new_timer_ns(vm_clock, ehci_frame_timer, s);
--
1.7.12.1
next prev parent reply other threads:[~2012-10-08 7:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 7:51 [Qemu-devel] [PATCH 00/12] RFC: usb: input pipelining support and other speedups Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 01/12] usb-redir: When a packet contains data on a stall, ignore the stall Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 02/12] usb-redir: Add support for 32 bits bulk packet length Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 03/12] usb-host-linux: Only enabling pipeling for output endpoints Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 04/12] usb: Add support for input pipelining Hans de Goede
2012-10-08 12:50 ` Gerd Hoffmann
2012-10-08 14:50 ` Hans de Goede
2012-10-09 9:21 ` Gerd Hoffmann
2012-10-09 10:40 ` Hans de Goede
2012-10-09 13:31 ` Gerd Hoffmann
2012-10-09 14:19 ` Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 05/12] uhci: Properly unmap packets on cancel / invalid pid Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 06/12] uhci: Move checks to continue queuing to uhci_fill_queue() Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 07/12] uhci: Add support for input queuing Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 08/12] ehci: Get rid of packet tbytes field Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 09/12] ehci: Set int flag on a short input packet Hans de Goede
2012-10-08 7:51 ` Hans de Goede [this message]
2012-10-08 7:51 ` [Qemu-devel] [PATCH 11/12] ehci: Improve latency of interrupt delivery and async schedule scanning Hans de Goede
2012-10-08 7:51 ` [Qemu-devel] [PATCH 12/12] ehci: Speed up the timer of raising int from the async schedule Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349682696-3046-11-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).