1. 17 10月, 2013 17 次提交
  2. 24 9月, 2013 4 次提交
    • F
      xhci: Fix race between ep halt and URB cancellation · 526867c3
      Florian Wolter 提交于
      The halted state of a endpoint cannot be cleared over CLEAR_HALT from a
      user process, because the stopped_td variable was overwritten in the
      handle_stopped_endpoint() function. So the xhci_endpoint_reset() function will
      refuse the reset and communication with device can not run over this endpoint.
      https://bugzilla.kernel.org/show_bug.cgi?id=60699Signed-off-by: NFlorian Wolter <wolly84@web.de>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      526867c3
    • S
      usb: Fix xHCI host issues on remote wakeup. · 8b3d4570
      Sarah Sharp 提交于
      When a device signals remote wakeup on a roothub, and the suspend change
      bit is set, the host controller driver must not give control back to the
      USB core until the port goes back into the active state.
      
      EHCI accomplishes this by waiting in the get port status function until
      the PORT_RESUME bit is cleared:
      
                              /* stop resume signaling */
                              temp &= ~(PORT_RWC_BITS | PORT_SUSPEND | PORT_RESUME);
                              ehci_writel(ehci, temp, status_reg);
                              clear_bit(wIndex, &ehci->resuming_ports);
                              retval = ehci_handshake(ehci, status_reg,
                                              PORT_RESUME, 0, 2000 /* 2msec */);
      
      Similarly, the xHCI host should wait until the port goes into U0, before
      passing control up to the USB core.  When the port transitions from the
      RExit state to U0, the xHCI driver will get a port status change event.
      We need to wait for that event before passing control up to the USB
      core.
      
      After the port transitions to the active state, the USB core should time
      a recovery interval before it talks to the device.  The length of that
      recovery interval is TRSMRCY, 10 ms, mentioned in the USB 2.0 spec,
      section 7.1.7.7.  The previous xHCI code (which did not wait for the
      port to go into U0) would cause the USB core to violate that recovery
      interval.
      
      This bug caused numerous USB device disconnects on remote wakeup under
      ChromeOS and a Lynx Point LP xHCI host that takes up to 20 ms to move
      from RExit to U0.  ChromeOS is very aggressive about power savings, and
      sets the autosuspend_delay to 100 ms, and disables USB persist.
      
      I attempted to replicate this bug with Ubuntu 12.04, but could not.  I
      used Ubuntu 12.04 on the same platform, with the same BIOS that the bug
      was triggered on ChromeOS with.  I also changed the USB sysfs settings
      as described above, but still could not reproduce the bug under Ubuntu.
      It may be that ChromeOS userspace triggers this bug through additional
      settings.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      8b3d4570
    • M
      xhci: Ensure a command structure points to the correct trb on the command ring · ec7e43e2
      Mathias Nyman 提交于
      If a command on the command ring needs to be cancelled before it is handled
      it can be turned to a no-op operation when the ring is stopped.
      We want to store the command ring enqueue pointer in the command structure
      when the command in enqueued for the cancellation case.
      
      Some commands used to store the command ring dequeue pointers instead of enqueue
      (these often worked because enqueue happends to equal dequeue quite often)
      
      Other commands correctly used the enqueue pointer but did not check if it pointed
      to a valid trb or a link trb, this caused for example stop endpoint command to timeout in
      xhci_stop_device() in about 2% of suspend/resume cases.
      
      This should also solve some weird behavior happening in command cancellation cases.
      
      This patch is based on a patch submitted by Sarah Sharp to linux-usb, but
      then forgotten:
          http://marc.info/?l=linux-usb&m=136269803207465&w=2
      
      This patch should be backported to kernels as old as 3.7, that contain
      the commit b92cc66c "xHCI: add aborting
      command ring function"
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      ec7e43e2
    • M
      xhci: Fix oops happening after address device timeout · 284d2055
      Mathias Nyman 提交于
      When a command times out, the command ring is first aborted,
      and then stopped. If the command ring is empty when it is stopped
      the stop event will point to next command which is not yet set.
      xHCI tries to handle this next event often causing an oops.
      
      Don't handle command completion events on stopped cmd ring if ring is
      empty.
      
      This patch should be backported to kernels as old as 3.7, that contain
      the commit b92cc66c "xHCI: add aborting
      command ring function"
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Reported-by: NGiovanni <giovanni.nervi@yahoo.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      284d2055
  3. 27 8月, 2013 1 次提交
  4. 14 8月, 2013 6 次提交
  5. 25 7月, 2013 1 次提交
  6. 15 6月, 2013 1 次提交
  7. 06 6月, 2013 1 次提交
  8. 26 3月, 2013 3 次提交
  9. 25 1月, 2013 4 次提交
    • A
      USB: XHCI: fix memory leak of URB-private data · 48c3375c
      Alan Stern 提交于
      This patch (as1640) fixes a memory leak in xhci-hcd.  The urb_priv
      data structure isn't always deallocated in the handle_tx_event()
      routine for non-control transfers.  The patch adds a kfree() call so
      that all paths end up freeing the memory properly.
      
      This patch should be backported to kernels as old as 2.6.36, that
      contain the commit 8e51adcc "USB: xHCI:
      Introduce urb_priv structure"
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Reported-and-tested-by: NMartin Mokrejs <mmokrejs@fold.natur.cuni.cz>
      CC: <stable@vger.kernel.org>
      48c3375c
    • N
      drivers: xhci: fix incorrect bit test · ba7b5c22
      Nickolai Zeldovich 提交于
      Fix incorrect bit test that originally showed up in
      4ee823b8 "USB/xHCI: Support
      device-initiated USB 3.0 resume."
      
      Use '&' instead of '&&'.
      
      This should be backported to kernels as old as 3.4.
      Signed-off-by: NNickolai Zeldovich <nickolai@csail.mit.edu>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      ba7b5c22
    • S
      xhci: Fix TD size for isochronous URBs. · f18f8ed2
      Sarah Sharp 提交于
      To calculate the TD size for a particular TRB in an isoc TD, we need
      know the endpoint's max packet size.  Isochronous endpoints also encode
      the number of additional service opportunities in their wMaxPacketSize
      field.  The TD size calculation did not mask off those bits before using
      the field.  This resulted in incorrect TD size information for
      isochronous TRBs when an URB frame buffer crossed a 64KB boundary.
      
      For example:
       - an isoc endpoint has 2 additional service opportunites and
         a max packet size of 1020 bytes
       - a frame transfer buffer contains 3060 bytes
       - one frame buffer crosses a 64KB boundary, and must be split into
         one 1276 byte TRB, and one 1784 byte TRB.
      
      The TD size is is the number of packets that remain to be transferred
      for a TD after processing all the max packet sized packets in the
      current TRB and all previous TRBs.
      
      For this TD, the number of packets to be transferred is (3060 / 1020),
      or 3.  The first TRB contains 1276 bytes, which means it contains one
      full packet, and a 256 byte remainder.  After processing all the max
      packet-sized packets in the first TRB, the host will have 2 packets left
      to transfer.
      
      The old code would calculate the TD size for the first TRB as:
      
      total packet count = DIV_ROUND_UP (TD length / endpoint wMaxPacketSize)
      total packet count - (first TRB length / endpoint wMaxPacketSize)
      
      The math should have been:
      
      total packet count = DIV_ROUND_UP (3060 / 1020) = 3
      3 - (1276 / 1020) = 2
      
      Since the old code didn't mask off the additional service interval bits
      from the wMaxPacketSize field, the math ended up as
      
      total packet count = DIV_ROUND_UP (3060 / 5116) = 1
      1 - (1276 / 5116) = 1
      
      Fix this by masking off the number of additional service opportunities
      in the wMaxPacketSize field.
      
      This patch should be backported to stable kernels as old as 3.0, that
      contain the commit 4da6e6f2 "xhci 1.0:
      Update TD size field format."  It may not apply well to kernels older
      than 3.2 because of commit 29cc8897
      "USB: use usb_endpoint_maxp() instead of le16_to_cpu()".
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      f18f8ed2
    • S
      xhci: Fix isoc TD encoding. · 760973d2
      Sarah Sharp 提交于
      An isochronous TD is comprised of one isochronous TRB chained to zero or
      more normal TRBs.  Only the isoc TRB has the TBC and TLBPC fields.  The
      normal TRBs must set those fields to zeroes.  The code was setting the
      TBC and TLBPC fields for both isoc and normal TRBs.  Fix this.
      
      This should be backported to stable kernels as old as 3.0, that contain
      the commit b61d378f " xhci 1.0: Set
      transfer burst last packet count field."
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      760973d2
  10. 04 1月, 2013 2 次提交
    • J
      usb: host: xhci: remove unused trb var in xhci_irq() · 026630d0
      Javier Martinez Canillas 提交于
      The union xhci_trb *trb variable is defined and assigned
      inside the xHCI IRQ handler function but is never used.
      Signed-off-by: NJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      026630d0
    • S
      xhci: Avoid "dead ports", add roothub port polling. · c52804a4
      Sarah Sharp 提交于
      The USB core hub thread (khubd) is designed with external USB hubs in
      mind.  It expects that if a port status change bit is set, the hub will
      continue to send a notification through the hub status data transfer.
      Basically, it expects hub notifications to be level-triggered.
      
      The xHCI host controller is designed to be edge-triggered on the logical
      'OR' of all the port status change bits.  When all port status change
      bits are clear, and a new change bit is set, the xHC will generate a
      Port Status Change Event.  If another change bit is set in the same port
      status register before the first bit is cleared, it will not send
      another event.
      
      This means that the hub code may lose port status changes because of
      race conditions between clearing change bits.  The user sees this as a
      "dead port" that doesn't react to device connects.
      
      The fix is to turn on port polling whenever a new change bit is set.
      Once the USB core issues a hub status request that shows that no change
      bits are set in any USB ports, turn off port polling.
      
      We can't allow the USB core to poll the roothub for port events during
      host suspend because if the PCI host is in D3cold, the port registers
      will be all f's.  Instead, stop the port polling timer, and
      unconditionally restart it when the host resumes.  If there are no port
      change bits set after the resume, the first call to hub_status_data will
      disable polling.
      
      This patch should be backported to stable kernels with the first xHCI
      support, 2.6.31 and newer, that include the commit
      0f2a7930 "USB: xhci: Root hub support."
      There will be merge conflicts because the check for HC_STATE_SUSPENDED
      was moved into xhci_suspend in 3.8.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable@vger.kernel.org
      c52804a4