1. 17 11月, 2010 1 次提交
    • A
      USB: EHCI: AMD periodic frame list table quirk · 3d091a6f
      Andiry Xu 提交于
      On AMD SB700/SB800/Hudson-2/3 platforms, USB EHCI controller may read/write
      to memory space not allocated to USB controller if there is longer than
      normal latency on DMA read encountered. In this condition the exposure will
      be encountered only if the driver has following format of Periodic Frame
      List link pointer structure:
      
      For any idle periodic schedule, the Frame List link pointers that have the
      T-bit set to 1 intending to terminate the use of frame list link pointer
      as a physical memory pointer.
      
      Idle periodic schedule Frame List Link pointer shoule be in the following
      format to avoid the issue:
      
      Frame list link pointer should be always contains a valid pointer to a
      inactive QHead with T-bit set to 0.
      Signed-off-by: NAndiry Xu <andiry.xu@amd.com>
      Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3d091a6f
  2. 11 8月, 2010 6 次提交
    • A
      USB: EHCI: remove dead code in the periodic scheduler · 88d8aa46
      Alan Stern 提交于
      This patch (as1409) removes some dead code from the ehci-hcd
      scheduler.  Thanks to the previous patch in this series, stream->depth
      is no longer used.  And stream->start and stream->rescheduled
      apparently have not been used for quite a while, except in some
      statistics-reporting code that never gets invoked.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      88d8aa46
    • A
      USB: EHCI: reorganize isochronous scheduler routine · 1fb2e055
      Alan Stern 提交于
      This patch (as1408) rearranges the scheduling code in ehci-hcd, partly
      to improve its structure, but mainly to change the way it works.
      Whether or not a transfer exceeds the hardware schedule length will
      now be determined by looking at the last frame the transfer would use,
      instead of the first available frame following the end of the transfer.
      
      The benefit of this change is that it allows the driver to accept
      valid URBs which would otherwise be rejected.  For example, suppose
      the schedule length is 1024 frames, the endpoint period is 256 frames,
      and a four-packet URB is submitted.  The four transfers would occupy
      slots that are 0, 256, 512, and 768 frames past the current frame
      (plus an extra slop factor).  These don't exceed the 1024-frame limit,
      so the URB should be accepted.  But the current code notices that the
      next available slot would be 1024 frames (plus slop) in the future,
      which is beyond the limit, and so the URB is rejected unnecessarily.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      1fb2e055
    • A
      USB: EHCI: add missing frame -> microframe conversion · ffda0803
      Alan Stern 提交于
      This patch (as1407) fixes a bug in ehci-hcd's isochronous scheduler.
      All its calculations should be done in terms of microframes, but for
      full-speed devices, sched->span is stored in frames.  It needs to be
      converted.
      
      This fix is liable to expose problems in other drivers.  The old code
      would accept URBs that should not have been accepted, so drivers have
      had no reason to avoid submitting URBs that exceeded the maximum
      schedule length.  In an attempt to partially compensate for this, the
      patch also adjusts the schedule length from a minimum of 256 frames up
      to a minimum of 512 frames.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ffda0803
    • A
      USB: EHCI: simplify remainder computations · bccbefaa
      Alan Stern 提交于
      This patch (as1406) adds a micro-optimization to ehci-hcd's scheduling
      code.  Instead of computing remainders with respect to the schedule
      length, use bitwise-and (which is quicker).  We know that the schedule
      length will always be a power of two, but the compiler doesn't have
      this information.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bccbefaa
    • A
      USB: EHCI: remove PCI assumption · ae68a83b
      Alan Stern 提交于
      This patch (as1405) fixes a small bug in ehci-hcd's isochronous
      scheduler.  Not all EHCI controllers are PCI, and the code shouldn't
      assume that they are.  Instead, introduce a special flag for
      controllers which need to delay iso scheduling for full-speed devices
      beyond the scheduling threshold.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      CC: David Brownell <david-b@pacbell.net>
      CC: stable <stable@kernel.org>
      Acked-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      ae68a83b
    • A
      USB: convert usb_hcd bitfields into atomic flags · 541c7d43
      Alan Stern 提交于
      This patch (as1393) converts several of the single-bit fields in
      struct usb_hcd to atomic flags.  This is for safety's sake; not all
      CPUs can update bitfield values atomically, and these flags are used
      in multiple contexts.
      
      The flag fields that are set only during registration or removal can
      remain as they are, since non-atomic accesses at those times will not
      cause any problems.
      
      (Strictly speaking, the authorized_default flag should become atomic
      as well.  I didn't bother with it because it gets changed only via
      sysfs.  It can be done later, if anyone wants.)
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      541c7d43
  3. 23 4月, 2010 1 次提交
  4. 19 3月, 2010 2 次提交
  5. 03 3月, 2010 2 次提交
  6. 12 12月, 2009 2 次提交
    • S
      USB: ehci: Respect IST when scheduling new split iTDs. · dccd574c
      Sarah Sharp 提交于
      The EHCI specification says that an EHCI host controller may cache part of
      the isochronous schedule.  The EHCI controller must advertise how much it
      caches in the schedule through the HCCPARAMS register isochronous
      scheduling threshold (IST) bits.
      
      In theory, adding new iTDs within the IST should be harmless.  The HW will
      follow the old cached linked list and miss the new iTD.  SW will notice HW
      missed the iTD and return 0 for the transfer length.
      
      However, Intel ICH9 chipsets (and some later chipsets) have issues when SW
      attempts to schedule a split transaction within the IST.  All transfers
      will cease being sent out that port, and the drivers will see isochronous
      packets complete with a length of zero.  Start of frames may or may not
      also disappear, causing the device to go into auto-suspend.  This "bus
      stall" will continue until a control or bulk transfer is queued to a
      device under that roothub.
      
      Most drivers will never cause this behavior, because they use multiple
      URBs with multiple packets to keep the bus busy.  If you limit the number
      of URBs to one, you may be able to hit this bug.
      
      Make sure the EHCI driver does not schedule full-speed transfers within
      the IST under an Intel chipset.  Make sure that when we fall behind the
      current microframe plus IST, we schedule the new transfer at the next
      periodic interval after the IST.
      
      Don't change the scheduling for new transfers, since the schedule slop will
      always be greater than the IST.  Allow high speed isochronous transfers to
      be scheduled within the IST, since this doesn't trigger the Intel chipset
      bug.
      
      Make sure that if the host caches the full frame, the EHCI driver's
      internal isochronous threshold (ehci->i_thresh) is set to
      8 microframes + 2 microframes wiggle room.  This is similar to what is done in
      the case where the host caches less than the full frame.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      dccd574c
    • S
      USB: ehci: Minor constant fix for SCHEDULE_SLOP. · d7e055f1
      Sarah Sharp 提交于
      Change the constant SCHEDULE_SLOP to be 80 microframes, instead of 10
      frames.  It was always multiplied by 8 to convert frames to microframes.
      SCHEDULE_SLOP is only used in ehci-sched.c.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d7e055f1
  7. 01 12月, 2009 1 次提交
  8. 15 10月, 2009 1 次提交
  9. 10 10月, 2009 1 次提交
  10. 23 9月, 2009 2 次提交
    • A
      USB: EHCI: change deschedule logic for interrupt QHs · a448c9d8
      Alan Stern 提交于
      This patch (as1281) changes the way ehci-hcd deschedules interrupt
      QHs, copying the approach used for async QHs.  The caller is no longer
      responsible for rescheduling the QH if its queue is non-empty; instead
      the reschedule is done directly by intr_deschedule(), after calling
      qh_completions().  This is exactly the same as how end_unlink_async()
      works.
      
      ehci_urb_dequeue() and intr_deschedule() now correctly handle the case
      where they are called while another interrupt URB for the same QH is
      being given back.  This was a surprisingly large blind spot.  And
      scan_periodic() now respects the new needs_rescan flag.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a448c9d8
    • A
      USB: EHCI: split ehci_qh into hw and sw parts · 3807e26d
      Alek Du 提交于
      The ehci_qh structure merged hw and sw together which is not good:
      1. More and more items are being added into ehci_qh, the ehci_qh software
         part are unnecessary to be allocated in DMA qh_pool.
      2. If HCD has local SRAM, the sw part will consume it too, and it won't
         bring any benefit.
      3. For non-cache-coherence system, the entire ehci_qh is uncachable, actually
         we only need the hw part to be uncacheable. Spliting them will let the sw
         part to be cacheable.
      Signed-off-by: NAlek Du <alek.du@intel.com>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      CC: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3807e26d
  11. 08 8月, 2009 1 次提交
  12. 13 7月, 2009 1 次提交
  13. 16 6月, 2009 1 次提交
  14. 24 4月, 2009 1 次提交
    • D
      USB: ehci-sched.c: EHCI SITD scheduling bugfix · c065c60e
      Dan Streetman 提交于
      Without this patch, the driver won't check that the last fully-occupied
      uframe for a new split transaction was vacant beforehand.  This can
      lead to a situation in which the first 188 bytes of a 192-byte
      isochronous transfer are scheduled in the same uframe as an existing
      interrupt transfer.  The resulting schedule looks like this:
      
             uframe 0: 188-byte isoc-OUT SSPLIT, 8-byte int-IN SSPLIT
             uframe 1: 4-byte isoc-OUT SSPLIT
      
      The SSPLITs are intermingled, causing an error in the downstream hub's
      TT.
      
      If you are having problems with devices or hub ports resetting, or failed
      interrupt transfers, when you start using a USB audio or video (Isochronous)
      device, this patch may help.
      Signed-off-by: NDan Streetman <ddstreet@ieee.org>
      Reported-by: NKung James <kong1191@gmail.com>
      Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      
      c065c60e
  15. 25 3月, 2009 1 次提交
  16. 18 3月, 2009 1 次提交
    • K
      USB: EHCI: Fix isochronous URB leak · 508db8c9
      Karsten Wiese 提交于
      ehci-hcd uses usb_get_urb() and usb_put_urb() in an unbalanced way causing
      isochronous URB's kref.counts incrementing once per usb_submit_urb() call.
      The culprit is *usb being set to NULL when usb_put_urb() is called after URB
      is given back.
      Due to other fixes there is no need for ehci-hcd to deal with usb_get_urb()
      nor usb_put_urb() anymore, so patch removes their usages in ehci-hcd.
      Patch also makes ehci_to_hcd(ehci)->self.bandwidth_allocated adjust, if a
      stream finishes.
      Signed-off-by: NKarsten Wiese <fzu@wemgehoertderstaat.de>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      508db8c9
  17. 28 2月, 2009 1 次提交
  18. 14 11月, 2008 1 次提交
  19. 24 9月, 2008 1 次提交
    • D
      USB: fix EHCI periodic transfers · 01c17142
      David Brownell 提交于
      As noted by Stefan Neis <Stefan.Neis@kobil.com>, we had a recent
      regression with EHCI periodic transfers, in some (seemingly not
      all that common) cases.
      
      The root cause was that the schedule activation was only loosely
      coupled to the addition or removal of transfers, so two different
      execution contexts could both think they had to deactivate (or
      conversely activate) the schedule.  So this fix tightens that
      coupling, managing it more like a refcount.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      01c17142
  20. 30 5月, 2008 1 次提交
    • A
      USB: EHCI: fix bug in Iso scheduling · b40e43fc
      Alan Stern 提交于
      This patch (as1098) changes the way ehci-hcd schedules its periodic
      Iso transfers.  That the current scheduling code is wrong is clear on
      the face of it: Sometimes it returns -EL2NSYNC (meaning that an URB
      couldn't be scheduled because it was submitted too late), but it does
      this even when the URB_ISO_ASAP flag is set (meaning the URB should be
      scheduled as soon as possible).
      
      The new code properly implements as-soon-as-possible scheduling,
      assigning the next unexpired slot as the URB's starting point.  It
      also is more careful about checking for Iso URB completion: It doesn't
      bother to check for activity during frames that are already over,
      and it allows for the possibility that some of the URB's packets may
      have raced the hardware when they were submitted and so never got used
      (the packet status is set to -EXDEV).
      
      This fixes problems several people have experienced with USB video
      applications.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b40e43fc
  21. 25 4月, 2008 3 次提交
  22. 02 2月, 2008 5 次提交
    • D
      USB: ehci completes high speed ISO URBs sooner · 79592b72
      David Brownell 提交于
      This has some bugfixes for the EHCI driver's ISO transfer scanning
      logic.  It was leaving ITDs and SITDs on the schedule too long, for
      a few different reasons, which caused trouble.
      
        (a)	Look at all microframes for high speed transfers, not just
      	the ones we expect to have finished.  This way transfers
      	ending mid-frame will complete without needing another IRQ.
      	This also minimizes bogus scheduling underruns (e.g. EL2NSYNC).
      
        (b)	When we encounter an ISO transfer (either speed, but this
      	hits mostly at full speed) that's not yet been completed,
      	immediately stop scanning; we've caught up to the hardware,
      	no matter what other indications might say.
      
        (c)	Always clean up ITDs (for high speed transfers) when the HC
      	is no longer running.
      
      I'm not sure whether the last one has been observed before, but both
      the others have been reported with "real world" audio and video code.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      79592b72
    • D
      USB: ehci: minor ISO updates, always support split ISO · aa16ca30
      David Brownell 提交于
      Small updates to the EHCI driver's ISO support:
      
       - Get rid of the Kconfig option for full speed ISO.  It may
         not be perfect yet, but it hasn't appeared to be dangerous
         and pretty much every configuration wants it.
      
       - Instead of two places to disable an empty periodic schedule
         after an ISO transfer completes, just have one.
      
       - After the periodic schedule is disabled, we can short-circuit
         the schedule scan ... it can't possibly have more work to do.
      
      Assuming a typical config with split iso enabled, the only change
      in behavior should be almost unobservable:  quicker termination
      of periodic scans when the schedule gets emptied.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      aa16ca30
    • K
      USB: ehci saves some memory in ISO transfer descriptors · 3b6fcfd0
      Karsten Wiese 提交于
      In the EHCI driver, itd->usecs[8] is used in periodic_usecs(), indexed by
      uframe.  For an ITD's unused uframes it is 0, else it contains the same
      value as itd->stream->usecs.  To check if an ITD's uframe is used, we can
      instead test itd->hw_transaction[uframe]:  if used, it will be nonzero no
      matter what endianess is used.
      
      This patch replaces those two uses, eliminates itd->usecs[], and saves
      eight bytes from each ITD.
      Signed-off-by: NKarsten Wiese <fzu@wemgehoertderstaat.de>
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3b6fcfd0
    • D
      USB: PS3: Fix EHCI ISO transfer bug · 30bf54e6
      David Brownell 提交于
      This adds a workaround for an issue reported with ISO transfers
      on some EHCI controllers, most recently with VIA KT800 and PS3
      EHCI silicon.
      
      The issue is that the silicon doesn't necessarily seem to be done
      using ISO DMA descriptors (itd, sitd) when it marks them inactive.
      (One theory is that the ill-defined mechanism where hardware caches
      periodic transfer descriptors isn't invalidating their state...)
      With such silicon, quick re-use of those descriptors makes trouble.
      Waiting until the next frame seems to be a sufficient workaround.
      
      This patch ensures that the relevant descriptors aren't available
      for immediate re-use.  It does so by not recycling them until after
      issuing the completion callback which would reuse them by enqueueing
      an URB and thus (re)allocating ISO DMA descriptors.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Acked-by: NGeoff Levand <geoffrey.levand@am.sony.com>
      Cc: Masashi Kimoto <Masashi_Kimoto@hq.scei.sony.co.jp>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      30bf54e6
    • J
      USB: Spelling fixes · dc0d5c1e
      Joe Perches 提交于
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      dc0d5c1e
  23. 13 10月, 2007 2 次提交
    • A
      USB: reorganize urb->status use in ehci-hcd · 14c04c0f
      Alan Stern 提交于
      This patch (as974) reorganizes the way ehci-hcd sets urb->status.  It
      now keeps the information in a local variable until the last moment.
      
      The patch also simplifies the handling of -EREMOTEIO, since the only
      use of that code is to set the do_status flag.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      14c04c0f
    • A
      USB: make HCDs responsible for managing endpoint queues · e9df41c5
      Alan Stern 提交于
      This patch (as954) implements a suggestion of David Brownell's.  Now
      the host controller drivers are responsible for linking and unlinking
      URBs to/from their endpoint queues.  This eliminates the possiblity of
      strange situations where usbcore thinks an URB is linked but the HCD
      thinks it isn't.  It also means HCDs no longer have to check for URBs
      being dequeued before they were fully enqueued.
      
      In addition to the core changes, this requires changing every host
      controller driver and the root-hub URB handler.  For the most part the
      required changes are fairly small; drivers have to call
      usb_hcd_link_urb_to_ep() in their urb_enqueue method,
      usb_hcd_check_unlink_urb() in their urb_dequeue method, and
      usb_hcd_unlink_urb_from_ep() before giving URBs back.  A few HCDs make
      matters more complicated by the way they split up the flow of control.
      
      In addition some method interfaces get changed.  The endpoint argument
      for urb_enqueue is now redundant so it is removed.  The unlink status
      is required by usb_hcd_check_unlink_urb(), so it has been added to
      urb_dequeue.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e9df41c5
  24. 21 8月, 2007 1 次提交
    • L
      Revert "USB: EHCI cpufreq fix" · 8eb891fc
      Linus Torvalds 提交于
      This reverts commit 196705c9.  It was
      reported to cause a regression by Daniel Exner, and Arjan van de Ven
      points out that we actually already have infrastructure in place for
      setting limits on acceptable DMA latency that would be the much more
      correct fix for the problem with some Broadcom EHCI controllers.
      
      Fixed up trivial conflicts due to the changes to support big-endian host
      controller descriptors in drivers/usb/host/{ehci-sched.c,ehci.h}.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8eb891fc