qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: qemu-devel@nongnu.org
Cc: Hans de Goede <hdegoede@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 13/22] usb: Add an int_req flag to USBPacket
Date: Mon, 15 Oct 2012 12:38:22 +0200	[thread overview]
Message-ID: <1350297511-25437-14-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1350297511-25437-1-git-send-email-hdegoede@redhat.com>

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/usb.h          |  3 ++-
 hw/usb/core.c     |  3 ++-
 hw/usb/hcd-ehci.c |  6 ++++--
 hw/usb/hcd-musb.c |  2 +-
 hw/usb/hcd-ohci.c |  7 +++++--
 hw/usb/hcd-uhci.c |  3 ++-
 hw/usb/hcd-xhci.c | 13 +++++++++++--
 7 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/hw/usb.h b/hw/usb.h
index 1fcf79c..3a6cc84 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -352,6 +352,7 @@ struct USBPacket {
     QEMUIOVector iov;
     uint64_t parameter; /* control transfers */
     bool short_not_ok;
+    bool int_req;
     int result; /* transfer length or USB_RET_* status code */
     /* Internal use by the USB layer.  */
     USBPacketState state;
@@ -362,7 +363,7 @@ void usb_packet_init(USBPacket *p);
 void usb_packet_set_state(USBPacket *p, USBPacketState state);
 void usb_packet_check_state(USBPacket *p, USBPacketState expected);
 void usb_packet_setup(USBPacket *p, int pid, USBEndpoint *ep, uint64_t id,
-                      bool short_not_ok);
+                      bool short_not_ok, bool int_req);
 void usb_packet_addbuf(USBPacket *p, void *ptr, size_t len);
 int usb_packet_map(USBPacket *p, QEMUSGList *sgl);
 void usb_packet_unmap(USBPacket *p, QEMUSGList *sgl);
diff --git a/hw/usb/core.c b/hw/usb/core.c
index f4a5ad2..87a513f 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -533,7 +533,7 @@ void usb_packet_set_state(USBPacket *p, USBPacketState state)
 }
 
 void usb_packet_setup(USBPacket *p, int pid, USBEndpoint *ep, uint64_t id,
-                      bool short_not_ok)
+                      bool short_not_ok, bool int_req)
 {
     assert(!usb_packet_is_inflight(p));
     assert(p->iov.iov != NULL);
@@ -543,6 +543,7 @@ void usb_packet_setup(USBPacket *p, int pid, USBEndpoint *ep, uint64_t id,
     p->result = 0;
     p->parameter = 0;
     p->short_not_ok = short_not_ok;
+    p->int_req = int_req;
     qemu_iovec_reset(&p->iov);
     usb_packet_set_state(p, USB_PACKET_SETUP);
 }
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 4dfe0f3..18cf097 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -1591,7 +1591,8 @@ static int ehci_execute(EHCIPacket *p, const char *action)
         }
 
         spd = (p->pid == USB_TOKEN_IN && NLPTR_TBIT(p->qtd.altnext) == 0);
-        usb_packet_setup(&p->packet, p->pid, ep, p->qtdaddr, spd);
+        usb_packet_setup(&p->packet, p->pid, ep, p->qtdaddr, spd,
+                         (p->qtd.token & QTD_TOKEN_IOC) != 0);
         usb_packet_map(&p->packet, &p->sgl);
         p->async = EHCI_ASYNC_INITIALIZED;
     }
@@ -1661,7 +1662,8 @@ static int ehci_process_itd(EHCIState *ehci,
             dev = ehci_find_device(ehci, devaddr);
             ep = usb_ep_get(dev, pid, endp);
             if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) {
-                usb_packet_setup(&ehci->ipacket, pid, ep, addr, false);
+                usb_packet_setup(&ehci->ipacket, pid, ep, addr, false,
+                                 (itd->transact[i] & ITD_XACT_IOC) != 0);
                 usb_packet_map(&ehci->ipacket, &ehci->isgl);
                 ret = usb_handle_packet(dev, &ehci->ipacket);
                 assert(ret != USB_RET_ASYNC);
diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c
index f65fa3c..a6105d3 100644
--- a/hw/usb/hcd-musb.c
+++ b/hw/usb/hcd-musb.c
@@ -627,7 +627,7 @@ static void musb_packet(MUSBState *s, MUSBEndPoint *ep,
     dev = usb_find_device(&s->port, ep->faddr[idx]);
     uep = usb_ep_get(dev, pid, ep->type[idx] & 0xf);
     usb_packet_setup(&ep->packey[dir].p, pid, uep,
-                     (dev->addr << 16) | (uep->nr << 8) | pid, false);
+                     (dev->addr << 16) | (uep->nr << 8) | pid, false, true);
     usb_packet_addbuf(&ep->packey[dir].p, ep->buf[idx], len);
     ep->packey[dir].ep = ep;
     ep->packey[dir].dir = dir;
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 8741d0f..4c77600 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -810,9 +810,11 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
     if (completion) {
         ret = ohci->usb_packet.result;
     } else {
+        bool int_req = relative_frame_number == frame_count &&
+                       OHCI_BM(iso_td.flags, TD_DI) == 0;
         dev = ohci_find_device(ohci, OHCI_BM(ed->flags, ED_FA));
         ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN));
-        usb_packet_setup(&ohci->usb_packet, pid, ep, addr, false);
+        usb_packet_setup(&ohci->usb_packet, pid, ep, addr, false, int_req);
         usb_packet_addbuf(&ohci->usb_packet, ohci->usb_buf, len);
         ret = usb_handle_packet(dev, &ohci->usb_packet);
         if (ret == USB_RET_ASYNC) {
@@ -1012,7 +1014,8 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
         }
         dev = ohci_find_device(ohci, OHCI_BM(ed->flags, ED_FA));
         ep = usb_ep_get(dev, pid, OHCI_BM(ed->flags, ED_EN));
-        usb_packet_setup(&ohci->usb_packet, pid, ep, addr, !flag_r);
+        usb_packet_setup(&ohci->usb_packet, pid, ep, addr, !flag_r,
+                         OHCI_BM(td.flags, TD_DI) == 0);
         usb_packet_addbuf(&ohci->usb_packet, ohci->usb_buf, pktlen);
         ret = usb_handle_packet(dev, &ohci->usb_packet);
 #ifdef DEBUG_PACKET
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 953897b..4a1ea6b 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -860,7 +860,8 @@ static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td,
     if (ep_ret) {
         *ep_ret = ep;
     }
-    usb_packet_setup(&async->packet, pid, ep, addr, spd);
+    usb_packet_setup(&async->packet, pid, ep, addr, spd,
+                     (td->ctrl & TD_CTRL_IOC) != 0);
     qemu_sglist_add(&async->sgl, td->buffer, max_len);
     usb_packet_map(&async->packet, &async->sgl);
 
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index f7b37cd..53f030b 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1437,7 +1437,8 @@ static int xhci_setup_packet(XHCITransfer *xfer)
     XHCIPort *port;
     USBDevice *dev;
     USBEndpoint *ep;
-    int dir;
+    bool int_req;
+    int i, dir;
 
     dir = xfer->in_xfer ? USB_TOKEN_IN : USB_TOKEN_OUT;
 
@@ -1455,7 +1456,15 @@ static int xhci_setup_packet(XHCITransfer *xfer)
         ep = usb_ep_get(dev, dir, xfer->epid >> 1);
     }
 
-    usb_packet_setup(&xfer->packet, dir, ep, xfer->trbs[0].addr, false);
+    int_req = false;
+    for (i = 0; i < xfer->trb_count; i++) {
+        if (xfer->trbs[i].control & TRB_TR_IOC) {
+            int_req = true;
+            break;
+        }
+    }
+    usb_packet_setup(&xfer->packet, dir, ep, xfer->trbs[0].addr, false,
+                     int_req);
     xhci_xfer_map(xfer);
     DPRINTF("xhci: setup packet pid 0x%x addr %d ep %d\n",
             xfer->packet.pid, dev->addr, ep->nr);
-- 
1.7.12.1

  parent reply	other threads:[~2012-10-15 10:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 10:38 [Qemu-devel] RFC: usb input pipelining / speedup patchset v2 Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 01/22] uhci: Properly unmap packets on cancel / invalid pid Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 02/22] uhci: Move checks to continue queuing to uhci_fill_queue() Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 03/22] ehci: Get rid of packet tbytes field Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 04/22] ehci: Set int flag on a short input packet Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 05/22] ehci: Improve latency of interrupt delivery and async schedule scanning Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 06/22] ehci: Speed up the timer of raising int from the async schedule Hans de Goede
2012-10-15 11:17   ` Gerd Hoffmann
2012-10-15 13:00     ` Hans de Goede
2012-10-17 11:01       ` Gerd Hoffmann
2012-10-17 11:11         ` Hans de Goede
2012-10-17 11:37           ` Gerd Hoffmann
2012-10-15 10:38 ` [Qemu-devel] [PATCH 07/22] ehci: Detect going in circles when filling the queue Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 08/22] xhci: Add a xhci_ep_nuke_one_xfer helper function Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 09/22] usb: Rename __usb_packet_complete to usb_packet_complete_one Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 10/22] usb: Add USB_RET_ADD_TO_QUEUE packet result code Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 11/22] usb: Move clearing of queue on halt to the core Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 12/22] usb: Move short-not-ok handling " Hans de Goede
2012-10-15 10:38 ` Hans de Goede [this message]
2012-10-17 11:04   ` [Qemu-devel] [PATCH 13/22] usb: Add an int_req flag to USBPacket Gerd Hoffmann
2012-10-17 11:11     ` Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 14/22] usb: Add packet combining functions Hans de Goede
2012-10-17 11:29   ` Gerd Hoffmann
2012-10-17 14:41     ` Hans de Goede
2012-10-18  6:00       ` Gerd Hoffmann
2012-10-15 10:38 ` [Qemu-devel] [PATCH 15/22] combined-packet: Add a workaround for Linux usbfs + live migration Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 16/22] usb-redir: When a packet contains data on a stall, ignore the stall Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 17/22] usb-redir: Add support for 32 bits bulk packet length Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 18/22] usb-redir: Add support for input pipelining Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 19/22] usb-redir: Add an usbredir_setup_usb_eps() helper function Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 20/22] usb-redir: Use reject rather the disconnect on bad ep info Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 21/22] usb-redir: Allow to attach USB 2.0 devices to 1.1 host controller Hans de Goede
2012-10-15 10:38 ` [Qemu-devel] [PATCH 22/22] usb-redir: Allow redirecting super speed devices to high speed controllers 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=1350297511-25437-14-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).