1. 21 9月, 2011 1 次提交
  2. 10 9月, 2011 6 次提交
    • A
      xHCI: refine td allocation · 2ffdea25
      Andiry Xu 提交于
      In xhci_urb_enqueue(), allocate a block of memory for all the TDs instead
      of allocating memory for each of them separately. This reduces the number
      of kzalloc calling when an isochronous usb is submitted.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2ffdea25
    • S
      xhci: Track interval bandwidth tables per port/TT. · 2e27980e
      Sarah Sharp 提交于
      In order to update the root port or TT's bandwidth interval table, we will
      need to keep track of a list of endpoints, per interval.  That way we can
      easily know the new largest max packet size when we have to remove an
      endpoint.
      
      Add an endpoint list for each root port or TT structure, sorted by
      endpoint max packet size.  Insert new endpoints into the list such that
      the head of the list always has the endpoint with the greatest max packet
      size.  Only insert endpoints and update the interval table with new
      information when those endpoints are periodic.
      
      Make sure to update the number of active TTs when we add or drop periodic
      endpoints.  A TT is only considered active if it has one or more periodic
      endpoints attached (control and bulk are best effort, and counted in the
      20% reserved on the high speed bus).  If the number of active endpoints
      for a TT was zero, and it's now non-zero, increment the number of active
      TTs for the rootport.  If the number of active endpoints was non-zero, and
      it's now zero, decrement the number of active TTs.
      
      We have to be careful when we're checking the bandwidth for a new
      configuration/alt setting.  If we don't have enough bandwidth, we need to
      be able to "roll back" the bandwidth information stored in the endpoint
      and the root port/TT interval bandwidth table.  We can't just create a
      copy of the interval bandwidth table, modify it, and check the bandwidth
      with the copy because we have lists of endpoints and entries can't be on
      more than one list.  Instead, we copy the old endpoint bandwidth
      information, and use it to revert the interval table when the bandwidth
      check fails.
      
      We don't check the bandwidth after endpoints are dropped from the interval
      table when a device is reset or freed after a disconnect, because having
      endpoints use less bandwidth should not push the bandwidth usage over the
      limits.  Besides which, we can't fail a device disconnect.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2e27980e
    • S
      xhci: Store endpoint bandwidth information. · 9af5d71d
      Sarah Sharp 提交于
      In the upcoming patches, we'll use some stored endpoint information to
      make software keep track of the worst-case bandwidth schedule.  We need to
      store several variables associated with each periodic endpoint:
       - the type of endpoint
       - Max Packet Size
       - Mult
       - Max ESIT payload
       - Max Burst Size (aka number of packets, stored in one-based form)
       - the endpoint interval (normalized to powers of 2 microframes)
      
      All this information is available to the hardware, and stored in its
      device output context.  However, we need to ensure that the new
      information is stored before the xHCI driver drops the xhci->lock to wait
      on the Configure Endpoint command, so that another driver requesting a
      configuration or alt setting change will see the update.  The Configure
      Endpoint command will never fail on the hardware that needs this software
      bandwidth checking (assuming the slot is enabled and the flags are set
      properly), so updating the endpoint info before the command completes
      should be fine.
      
      Until we add in the bandwidth checking code, just update the endpoint
      information after the Configure Endpoint command completes, and after a
      Reset Device command completes.  Don't bother to clear the endpoint
      bandwidth info when a device is being freed, since the xhci_virt_ep is
      just going to be freed anyway.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9af5d71d
    • S
      xhci: Store information about roothubs and TTs. · 839c817c
      Sarah Sharp 提交于
      For upcoming patches, we need to keep information about the bandwidth
      domains under the xHCI host.  Each root port is a separate primary
      bandwidth domain, and each high speed hub's TT (and potentially each port
      on a multi-TT hub) is a secondary bandwidth domain.
      
      If the table were in text form, it would look a bit like this:
      
      EP Interval	Sum of Number	Largest Max	Max Packet
      		of Packets	Packet Size	Overhead
      	0	   N		   mps		  overhead
      ...
      	15	   N		   mps		  overhead
      
      Overhead is the maximum packet overhead (for bit stuffing, CRC, protocol
      overhead, etc) for all the endpoints in this interval.  Devices with
      different speeds have different max packet overhead.  For example, if
      there is a low speed and a full speed endpoint that both have an interval
      of 3, we would use the higher overhead (the low speed overhead).  Interval
      0 is a bit special, since we really just want to know the sum of the max
      ESIT payloads instead of the largest max packet size.  That's stored in
      the interval0_esit_payload variable.  For root ports, we also need to keep
      track of the number of active TTs.
      
      For each root port, and each TT under a root port, store some information
      about the bandwidth consumption.  Dynamically allocate an array of root
      port bandwidth information for the number of root ports on the xHCI host.
      Each root port stores a list of TTs under the root port.  A single TT hub
      only has one entry in the list, but a multi-TT hub will have an entry per
      port.
      
      When the USB core says that a USB device is a hub, create one or more
      entries in the root port TT list for the hub.  When a device is deleted,
      and it is a hub, search through the root port TT list and delete all
      TT entries for the hub.  Keep track of which TT entry is associated with a
      device under a TT.
      
      LS/FS devices attached directly to the root port will have usb_device->tt
      set to the roothub.  Ignore that, and treat it like a primary bandwidth
      domain, since there isn't really a high speed bus between the roothub and
      the host.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      839c817c
    • S
      xhci: Store the "real" root port number. · 66381755
      Sarah Sharp 提交于
      Since the xHCI driver now has split USB2/USB3 roothubs, devices under each
      roothub can have duplicate "fake" port numbers.  For the next set of
      patches, we need to keep track of the "real" port number that the xHCI
      host uses to index into the port status arrays.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      66381755
    • S
      xhci: Rename virt_dev->port to fake_port. · fe30182c
      Sarah Sharp 提交于
      The "port" field in xhci_virt_dev stores the port number associated with
      one of the two xHCI split roothubs, not the unique port number the xHCI
      hardware uses.  Since we'll need to store the real hardware port number in
      future patches, rename this field to "fake_port".
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fe30182c
  3. 24 8月, 2011 1 次提交
    • K
      USB: use usb_endpoint_maxp() instead of le16_to_cpu() · 29cc8897
      Kuninori Morimoto 提交于
      Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size
      instead of le16_to_cpu(desc->wMaxPacketSize).
      This patch fix it up
      
      Cc: Armin Fuerst <fuerst@in.tum.de>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Johannes Erdfelt <johannes@erdfelt.com>
      Cc: Vojtech Pavlik <vojtech@suse.cz>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: David Kubicek <dave@awk.cz>
      Cc: Johan Hovold <jhovold@gmail.com>
      Cc: Brad Hards <bhards@bigpond.net.au>
      Acked-by: NFelipe Balbi <balbi@ti.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Thomas Dahlmann <dahlmann.thomas@arcor.de>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: David Lopo <dlopo@chipidea.mips.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Michal Nazarewicz <m.nazarewicz@samsung.com>
      Cc: Xie Xiaobo <X.Xie@freescale.com>
      Cc: Li Yang <leoli@freescale.com>
      Cc: Jiang Bo <tanya.jiang@freescale.com>
      Cc: Yuan-hsin Chen <yhchen@faraday-tech.com>
      Cc: Darius Augulis <augulis.darius@gmail.com>
      Cc: Xiaochen Shen <xiaochen.shen@intel.com>
      Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Cc: OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>
      Cc: Robert Jarzmik <robert.jarzmik@free.fr>
      Cc: Ben Dooks <ben@simtec.co.uk>
      Cc: Thomas Abraham <thomas.ab@samsung.com>
      Cc: Herbert Pötzl <herbert@13thfloor.at>
      Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
      Cc: Roman Weissgaerber <weissg@vienna.at>
      Acked-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Tony Olech <tony.olech@elandigitalsystems.com>
      Cc: Florian Floe Echtler <echtler@fs.tum.de>
      Cc: Christian Lucht <lucht@codemercs.com>
      Cc: Juergen Stuber <starblue@sourceforge.net>
      Cc: Georges Toth <g.toth@e-biz.lu>
      Cc: Bill Ryder <bryder@sgi.com>
      Cc: Kuba Ober <kuba@mareimbrium.org>
      Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      29cc8897
  4. 16 6月, 2011 1 次提交
    • S
      xhci: Don't warn about zeroed bMaxBurst descriptor field. · d2333632
      Sarah Sharp 提交于
      The USB 3.0 specification says that the bMaxBurst field in the SuperSpeed
      Endpoint Companion descriptor is supposed to indicate how many packets a
      SS device can handle before it needs to wait for an explicit handshake
      from the host controller.  A zero value means the device can only handle
      one packet before it needs a handshake.  Remove a warning in the xHCI
      driver that implies this is an invalid value.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      d2333632
  5. 06 6月, 2011 1 次提交
    • D
      USB: xhci - fix interval calculation for FS isoc endpoints · cd3c18ba
      Dmitry Torokhov 提交于
      Full-speed isoc endpoints specify interval in exponent based form in
      frames, not microframes, so we need to adjust accordingly.
      
      NEC xHCI host controllers will return an error code of 0x11 if a full
      speed isochronous endpoint is added with the Interval field set to
      something less than 3 (2^3 = 8 microframes, or one frame).  It is
      impossible for a full speed device to have an interval smaller than one
      frame.
      
      This was always an issue in the xHCI driver, but commit
      dfa49c4a "USB: xhci - fix math in
      xhci_get_endpoint_interval()" removed the clamping of the minimum value
      in the Interval field, which revealed this bug.
      
      This needs to be backported to stable kernels back to 2.6.31.
      Reported-by: NMatt Evans <matt@ozlabs.org>
      Signed-off-by: NDmitry Torokhov <dtor@vmware.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      cd3c18ba
  6. 03 6月, 2011 1 次提交
  7. 17 5月, 2011 1 次提交
    • S
      xhci: Fix memory leak in ring cache deallocation. · 30f89ca0
      Sarah Sharp 提交于
      When an endpoint ring is freed, it is either cached in a per-device ring
      cache, or simply freed if the ring cache is full.  If the ring was added
      to the cache, then virt_dev->num_rings_cached is incremented.  The cache
      is designed to hold up to 31 endpoint rings, in array indexes 0 to 30.
      When the device is freed (when the slot was disabled),
      xhci_free_virt_device() is called, it would free the cached rings in
      array indexes 0 to virt_dev->num_rings_cached.
      
      Unfortunately, the original code in xhci_free_or_cache_endpoint_ring()
      would put the first entry into the ring cache in array index 1, instead of
      array index 0.  This was caused by the second assignment to rings_cached:
      
      	rings_cached = virt_dev->num_rings_cached;
      	if (rings_cached < XHCI_MAX_RINGS_CACHED) {
      		virt_dev->num_rings_cached++;
      		rings_cached = virt_dev->num_rings_cached;
      		virt_dev->ring_cache[rings_cached] =
      			virt_dev->eps[ep_index].ring;
      
      This meant that when the device was freed, cached rings with indexes 0 to
      N would be freed, and the last cached ring in index N+1 would not be
      freed.  When the driver was unloaded, this caused interesting messages
      like:
      
      xhci_hcd 0000:06:00.0: dma_pool_destroy xHCI ring segments, ffff880063040000 busy
      
      This should be queued to stable kernels back to 2.6.33.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      30f89ca0
  8. 14 5月, 2011 1 次提交
    • S
      xhci: Fix full speed bInterval encoding. · b513d447
      Sarah Sharp 提交于
      Dmitry's patch
      
      dfa49c4a USB: xhci - fix math in xhci_get_endpoint_interval()
      
      introduced a bug.  The USB 2.0 spec says that full speed isochronous endpoints'
      bInterval must be decoded as an exponent to a power of two (e.g. interval =
      2^(bInterval - 1)).  Full speed interrupt endpoints, on the other hand, don't
      use exponents, and the interval in frames is encoded straight into bInterval.
      
      Dmitry's patch was supposed to fix up the full speed isochronous to parse
      bInterval as an exponent, but instead it changed the *interrupt* endpoint
      bInterval decoding.  The isochronous endpoint encoding was the same.
      
      This caused full speed devices with interrupt endpoints (including mice, hubs,
      and USB to ethernet devices) to fail under NEC 0.96 xHCI host controllers:
      
      [  100.909818] xhci_hcd 0000:06:00.0: add ep 0x83, slot id 1, new drop flags = 0x0, new add flags = 0x99, new slot info = 0x38100000
      [  100.909821] xhci_hcd 0000:06:00.0: xhci_check_bandwidth called for udev ffff88011f0ea000
      ...
      [  100.910187] xhci_hcd 0000:06:00.0: ERROR: unexpected command completion code 0x11.
      [  100.910190] xhci_hcd 0000:06:00.0: xhci_reset_bandwidth called for udev ffff88011f0ea000
      
      When the interrupt endpoint was added and a Configure Endpoint command was
      issued to the host, the host controller would return a very odd error message
      (0x11 means "Slot Not Enabled", which isn't true because the slot was enabled).
      Probably the host controller was getting very confused with the bad encoding.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Dmitry Torokhov <dtor@vmware.com>
      Reported-by: NThomas Lindroth <thomas.lindroth@gmail.com>
      Tested-by: NThomas Lindroth <thomas.lindroth@gmail.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b513d447
  9. 10 5月, 2011 2 次提交
  10. 03 5月, 2011 2 次提交
  11. 14 4月, 2011 3 次提交
  12. 14 3月, 2011 5 次提交
    • S
      xhci: Limit roothub ports to 15 USB3 & 31 USB2 ports. · d30b2a20
      Sarah Sharp 提交于
      The USB core allocates a USB 2.0 roothub descriptor that has room for 31
      (USB_MAXCHILDREN) ports' worth of DeviceRemovable and PortPwrCtrlMask
      fields.  Limit the number of USB 2.0 roothub ports accordingly.  I don't
      expect to run into this limitation ever, but this prevents a buffer
      overflow issue in the roothub descriptor filling code.
      
      Similarly, a USB 3.0 hub can only have 15 downstream ports, so limit the
      USB 3.0 roothub to 15 USB 3.0 ports.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      d30b2a20
    • S
      xhci: Register second xHCI roothub. · f6ff0ac8
      Sarah Sharp 提交于
      This patch changes the xHCI driver to allocate two roothubs.  This touches
      the driver initialization and shutdown paths, roothub emulation code, and
      port status change event handlers.  This is a rather large patch, but it
      can't be broken up, or it would break git-bisect.
      
      Make the xHCI driver register its own PCI probe function.  This will call
      the USB core to create the USB 2.0 roothub, and then create the USB 3.0
      roothub.  This gets the code for registering a shared roothub out of the
      USB core, and allows other HCDs later to decide if and how many shared
      roothubs they want to allocate.
      
      Make sure the xHCI's reset method marks the xHCI host controller's primary
      roothub as the USB 2.0 roothub.  This ensures that the high speed bus will
      be processed first when the PCI device is resumed, and any USB 3.0 devices
      that have migrated over to high speed will migrate back after being reset.
      This ensures that USB persist works with these odd devices.
      
      The reset method will also mark the xHCI USB2 roothub as having an
      integrated TT.  Like EHCI host controllers with a "rate matching hub" the
      xHCI USB 2.0 roothub doesn't have an OHCI or UHCI companion controller.
      It doesn't really have a TT, but we'll lie and say it has an integrated
      TT.  We need to do this because the USB core will reject LS/FS devices
      under a HS hub without a TT.
      
      Other details:
      -------------
      
      The roothub emulation code is changed to return the correct number of
      ports for the two roothubs.  For the USB 3.0 roothub, it only reports the
      USB 3.0 ports.  For the USB 2.0 roothub, it reports all the LS/FS/HS
      ports.  The code to disable a port now checks the speed of the roothub,
      and refuses to disable SuperSpeed ports under the USB 3.0 roothub.
      
      The code for initializing a new device context must be changed to set the
      proper roothub port number.  Since we've split the xHCI host into two
      roothubs, we can't just use the port number in the ancestor hub.  Instead,
      we loop through the array of hardware port status register speeds and find
      the Nth port with a similar speed.
      
      The port status change event handler is updated to figure out whether the
      port that reported the change is a USB 3.0 port, or a non-SuperSpeed port.
      Once it figures out the port speed, it kicks the proper roothub.
      
      The function to find a slot ID based on the port index is updated to take
      into account that the two roothubs will have over-lapping port indexes.
      It checks that the virtual device with a matching port index is the same
      speed as the passed in roothub.
      
      There's also changes to the driver initialization and shutdown paths:
      
       1. Make sure that the xhci_hcd pointer is shared across the two
          usb_hcd structures.  The xhci_hcd pointer is allocated and the
          registers are mapped in when xhci_pci_setup() is called with the
          primary HCD.  When xhci_pci_setup() is called with the non-primary
          HCD, the xhci_hcd pointer is stored.
      
       2. Make sure to set the sg_tablesize for both usb_hcd structures.  Set
          the PCI DMA mask for the non-primary HCD to allow for 64-bit or 32-bit
          DMA.  (The PCI DMA mask is set from the primary HCD further down in
          the xhci_pci_setup() function.)
      
       3. Ensure that the host controller doesn't start kicking khubd in
          response to port status changes before both usb_hcd structures are
          registered.  xhci_run() only starts the xHC running once it has been
          called with the non-primary roothub.  Similarly, the xhci_stop()
          function only halts the host controller when it is called with the
          non-primary HCD.  Then on the second call, it resets and cleans up the
          MSI-X irqs.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      f6ff0ac8
    • S
      xhci: Refactor bus suspend state into a struct. · 20b67cf5
      Sarah Sharp 提交于
      There are several variables in the xhci_hcd structure that are related to
      bus suspend and resume state.  There are a couple different port status
      arrays that are accessed by port index.  Move those variables into a
      separate structure, xhci_bus_state.  Stash that structure in xhci_hcd.
      
      When we have two roothhubs that can be suspended and resumed separately,
      we can have two xhci_bus_states, and index into the port arrays in each
      structure with the fake roothub port index (not the real hardware port
      index).
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      20b67cf5
    • S
      xhci: Modify check for TT info. · aa1b13ef
      Sarah Sharp 提交于
      Commit d199c96d by Alan Stern ensured that low speed and full speed
      devices below a high speed hub without a transaction translator (TT) would
      never get enumerated.  Simplify the check for a TT in the xHCI virtual
      device allocation to only check if the usb_device references a parent's
      TT.
      
      Make sure not to set the TT information on LS/FS devices directly
      connected to the roothub.  The xHCI host doesn't really have a TT, and the
      host will throw an error when those virtual device TT fields are set for a
      device connected to the roothub.  We need this check because the xHCI
      driver will shortly register two roothubs: a USB 2.0 roothub and a USB 3.0
      roothub.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      aa1b13ef
    • S
      xhci: Rework port suspend structures for limited ports. · 1d5810b6
      Sarah Sharp 提交于
      The USB core only allows up to 31 (USB_MAXCHILDREN) ports under a roothub.
      The xHCI driver keeps track of which ports are suspended, which ports have
      a suspend change bit set, and what time the port will be done resuming.
      It keeps track of the first two by setting a bit in a u32 variable,
      suspended_ports or port_c_suspend.  The xHCI driver currently assumes we
      can have up to 256 ports under a roothub, so it allocates an array of 8
      u32 variables for both suspended_ports and port_c_suspend.  It also
      allocates a 256-element array to keep track of when the ports will be done
      resuming.
      
      Since we can only have 31 roothub ports, we only need to use one u32 for
      each of the suspend state and change variables.  We simplify the bit math
      that's trying to index into those arrays and set the correct bit, if we
      assume wIndex never exceeds 30.  (wIndex is zero-based after it's
      decremented from the value passed in from the USB core.)  Finally, we
      change the resume_done array to only hold 31 elements.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Andiry Xu <andiry.xu@amd.com>
      1d5810b6
  13. 23 2月, 2011 1 次提交
  14. 20 2月, 2011 2 次提交
  15. 10 12月, 2010 1 次提交
    • S
      xhci: Fix issue with port array setup and buggy hosts. · f8bbeabc
      Sarah Sharp 提交于
      Fix two bugs with the port array setup.
      
      The first bug will only show up with broken xHCI hosts with Extended
      Capabilities registers that have duplicate port speed entries for the same
      port.  The idea with the original code was to set the port_array entry to
      -1 if the duplicate port speed entry said the port was a different speed
      than the original port speed entry.  That would mean that later, the port
      would not be exposed to the USB core. Unfortunately, I forgot a continue
      statement, and the port_array entry would just be overwritten in the next
      line.
      
      The second bug would happen if there are conflicting port speed registers
      (so that some entry in port_array is -1), or one of the hardware port
      registers was not described in the port speed registers (so that some
      entry in port_array is 0).  The code that sets up the usb2_ports array
      would accidentally claim those ports.  That wouldn't really cause any
      user-visible issues, but it is a bug.
      
      This patch should go into the stable trees that have the port array and
      USB 3.0 port disabling prevention patches.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@kernel.org
      f8bbeabc
  16. 20 11月, 2010 1 次提交
    • S
      xhci: Setup array of USB 2.0 and USB 3.0 ports. · da6699ce
      Sarah Sharp 提交于
      An xHCI host controller contains USB 2.0 and USB 3.0 ports, which can
      occur in any order in the PORTSC registers.  We cannot read the port speed
      bits in the PORTSC registers at init time to determine the port speed,
      since those bits are only valid when a USB device is plugged into the
      port.
      
      Instead, we read the "Supported Protocol Capability" registers in the xHC
      Extended Capabilities space.  Those describe the protocol, port offset in
      the PORTSC registers, and port count.  We use those registers to create
      two arrays of pointers to the PORTSC registers, one for USB 3.0 ports, and
      another for USB 2.0 ports.  A third array keeps track of the port protocol
      major revision, and is indexed with the internal xHCI port number.
      
      This commit is a bit big, but it should be queued for stable because the "Don't
      let the USB core disable SuperSpeed ports" patch depends on it.  There is no
      other way to determine which ports are SuperSpeed ports without this patch.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NDon Zickus <dzickus@redhat.com>
      Cc: stable@kernel.org
      da6699ce
  17. 12 11月, 2010 1 次提交
  18. 23 10月, 2010 4 次提交
  19. 11 8月, 2010 5 次提交
    • S
      USB: xhci: Make xhci_set_hc_event_deq() static. · 257d585a
      Sarah Sharp 提交于
      Now that the event handler functions no longer use xhci_set_hc_event_deq()
      to update the event ring dequeue pointer, that function is not used by
      anything in xhci-ring.c.  Move that function into xhci-mem.c and make it
      static.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      257d585a
    • S
      USB: xhci: Performance - move functions that find ep ring. · 021bff91
      Sarah Sharp 提交于
      I've been using perf to measure the top symbols while transferring 1GB of data
      on a USB 3.0 drive with dd.  This is using the raw disk with /dev/sdb, with a
      block size of 1K.
      
      During performance testing, the top symbol was xhci_triad_to_transfer_ring(), a
      function that should return immediately if streams are not enabled for an
      endpoint.  It turned out that the functions to find the endpoint ring was
      defined in xhci-mem.c and used in xhci-ring.c and xhci-hcd.c.  I moved a copy of
      xhci_triad_to_transfer_ring() and xhci_urb_to_transfer_ring() into xhci-ring.c
      and declared them static.  I also made a static version of
      xhci_urb_to_transfer_ring() in xhci.c.
      
      This improved throughput on a 1GB read of the raw disk with dd from
      186MB/s to 195MB/s, and perf reported sampling the xhci_triad_to_transfer_ring()
      0.06% of the time, rather than 9.26% of the time.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      021bff91
    • A
      USB: xHCI: allocate bigger ring for isochronous endpoint · a061a5a0
      Andiry Xu 提交于
      Isochronous endpoint needs a bigger size of transfer ring. Isochronous URB
      consists of multiple packets, each packet needs a isoc td to carry, and
      there will be multiple trbs inserted to the ring at one time. One segment
      is too small for isochronous endpoints, and it will result in
      room_on_ring() check failure and the URB is failed to enqueue.
      
      Allocate bigger ring for isochronous endpoint. 8 segments should be enough.
      This will be replaced with dynamic ring expansion in the future.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a061a5a0
    • A
      USB: xHCI: Introduce urb_priv structure · 8e51adcc
      Andiry Xu 提交于
      Add urb_priv data structure to xHCI driver. This structure allows multiple
      xhci TDs to be linked to one urb, which is essential for isochronous
      transfer. For non-isochronous urb, only one TD is needed for one urb;
      for isochronous urb, the TD number for the urb is equal to
      urb->number_of_packets.
      
      The length field of urb_priv indicates the number of TDs in the urb.
      The td_cnt field indicates the number of TDs already processed by xHC.
      When td_cnt matches length, the urb can be given back to usbcore.
      
      When an urb is dequeued or cancelled, add all the unprocessed TDs to the
      endpoint's cancelled_td_list. When process a cancelled TD, increase
      td_cnt field. When td_cnt equals urb_priv->length, giveback the
      cancelled urb.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      8e51adcc
    • A
      USB: xHCI: Missed Service Error Event process · d18240db
      Andiry Xu 提交于
      This patch adds mechanism to process Missed Service Error Event.
      Sometimes the xHC is unable to process the isoc TDs in time, it will
      generate Missed Service Error Event. In this case some TDs on the ring are
      not processed and missed. When encounter a Missed Servce Error Event, set
      the skip flag of the ep, and process the missed TDs until reach the next
      processed TD, then clear the skip flag.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d18240db