1. 04 2月, 2016 5 次提交
    • G
      usb: host: ehci.h: remove space before open square bracket · 9dc3af5e
      Geyslan G. Bem 提交于
      Get rid of space before open square bracket.
      
      Caught by checkpatch: "ERROR: space prohibited before open square
      bracket '['"
      Signed-off-by: NGeyslan G. Bem <geyslan@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9dc3af5e
    • G
      usb: host: ehci.h: remove space before function open parenthesis · e06e2264
      Geyslan G. Bem 提交于
      Get rid of space between function name and open parenthesis.
      
      Caught by checkpatch: "WARNING: space prohibited between function name
      and open parenthesis '('"
      Signed-off-by: NGeyslan G. Bem <geyslan@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e06e2264
    • G
      usb: host: ehci.h: remove space before comma · b5566d07
      Geyslan G. Bem 提交于
      Get rid of spaces before comma.
      
      Caught by checkpatch: "ERROR: space prohibited before that ','"
      Signed-off-by: NGeyslan G. Bem <geyslan@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b5566d07
    • A
      USB: EHCI: add a delay when unlinking an active QH · 87d61912
      Alan Stern 提交于
      Michael Reutman reports that an AMD/ATI EHCI host controller on one of
      his computers does not stop transferring data when an active bulk QH
      is unlinked from the async schedule.  Apparently that host controller
      fails to implement the IAA mechanism correctly when an active QH is
      unlinked.  This leads to data corruption, because the controller
      continues to update the QH in memory when the driver doesn't expect
      it.  As a result, the next URB submitted for that QH can hang, because
      the link pointers for the TD queue have been messed up.  This
      misbehavior is observed quite regularly.
      
      To be fair, the EHCI spec (section 4.8.2) says that active QHs should
      not be unlinked.  It goes on to recommend a procedure that involves
      waiting for the QH to go inactive before unlinking it.  In the real
      world this is impractical, not least because the QH may _never_ go
      inactive.  (What were they thinking?)  Sometimes we have no choice but
      to unlink an active QH.
      
      In an attempt to avoid the problems that can ensue, this patch changes
      how the driver decides when the unlink is complete.  In addition to
      waiting through two IAA cycles, in cases where the QH was not known to
      be inactive beforehand we now wait until a 2-ms period has elapsed
      with the host controller making no change to the QH data structure
      (the hw_current and hw_token fields in particular).  The intuition
      here is that after such a long period, the endpoint must be NAKing and
      hopefully the QH has been dropped from the host controller's internal
      cache.  There's no way to know if this reasoning is really valid --
      the spec is no help in this regard -- but at least this approach fixes
      Michael's problem.
      
      The test for whether the QH is already known to be inactive involves
      the reason for unlinking the QH originally.  If it was unlinked
      because it had halted, or it stopped in response to a short read, or
      it overlaid a dummy TD (a silicon bug), then it certainly is inactive.
      If it was unlinked because the TD queue was empty and no TDs have been
      added to the queue in the meantime, then it must be inactive.  Or if
      the hardware status indicates that the QH is currently halted (even if
      that wasn't the reason for unlinking it), then it is inactive.
      Otherwise, if none of those checks apply, we go through the 2-ms
      delay.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NMichael Reutman <mreutman@epiqsolutions.com>
      Tested-by: NMichael Reutman <mreutman@epiqsolutions.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87d61912
    • A
      USB: EHCI: store reason for unlinking a QH · fcc5184e
      Alan Stern 提交于
      This patch replaces the "exception" bitflag in the ehci_qh structure
      with a more explicit "unlink_reason" bitmask.  This is for use in the
      following patch, where we will need to have a good idea of the
      reason for unlinking a QH, not just "something exceptional happened".
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NMichael Reutman <mreutman@epiqsolutions.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fcc5184e
  2. 02 12月, 2015 1 次提交
    • A
      USB: EHCI: warn on unexpectedly active QH · fc0855f2
      Alan Stern 提交于
      This patch adds a new warning message to ehci-hcd.  The warning is
      triggered whenever the driver finds that the hardware has set the
      Active bit in a QH at a time when the driver expects the QH to be
      completely idle.  Such bugs have been observed by users in the past,
      and since they can lead to serious problems (such as inability to
      unlink an URB that never completes), it would be good to know about
      them when they occur.
      
      This won't fix these bugs; that's a bigger job for a later patch.  But
      success isn't guaranteed, since this depends on aspects of the
      hardware which are not documented in the EHCI spec or for which the
      spec's recommendations are clearly unworkable.  It therefore seems
      worthwhile to check for these bugs proactively.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NMichael Reutman <mreutman@epiqsolutions.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc0855f2
  3. 15 8月, 2015 1 次提交
  4. 31 5月, 2015 1 次提交
  5. 10 1月, 2015 1 次提交
  6. 04 11月, 2014 1 次提交
  7. 25 4月, 2014 1 次提交
  8. 14 1月, 2014 1 次提交
  9. 04 12月, 2013 1 次提交
  10. 15 10月, 2013 1 次提交
    • A
      USB: EHCI: create per-TT bandwidth tables · b35c5009
      Alan Stern 提交于
      This patch continues the scheduling changes in ehci-hcd by adding a
      table to store the bandwidth allocation below each TT.  This will
      speed up the scheduling code, as it will no longer need to read
      through the entire schedule to compute the bandwidth currently in use.
      
      Properly speaking, the FS/LS budget calculations should be done in
      terms of full-speed bytes per microframe, as described in the USB-2
      spec.  However the driver currently uses microseconds per microframe,
      and the scheduling code isn't robust enough at this point to change
      over.  For the time being, we leave the calculations as they are.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b35c5009
  11. 12 10月, 2013 3 次提交
    • A
      USB: EHCI: use a bandwidth-allocation table · d0ce5c6b
      Alan Stern 提交于
      This patch significantly changes the scheduling code in ehci-hcd.
      Instead of calculating the current bandwidth utilization by trudging
      through the schedule and adding up the times used by the existing
      transfers, we will now maintain a table holding the time used for each
      of 64 microframes.  This will drastically speed up the bandwidth
      computations.
      
      In addition, it eliminates a theoretical bug.  An isochronous endpoint
      may have bandwidth reserved even at times when it has no transfers
      listed in the schedule.  The table will keep track of the reserved
      bandwidth, whereas adding up entries in the schedule would miss it.
      
      As a corollary, we can keep bandwidth reserved for endpoints even
      when they aren't in active use.  Eventually the bandwidth will be
      reserved when a new alternate setting is installed; for now the
      endpoint's reservation takes place when its first URB is submitted.
      
      A drawback of this approach is that transfers with an interval larger
      than 64 microframes will have to be charged for bandwidth as though
      the interval was 64.  In practice this shouldn't matter much;
      transfers with longer intervals tend to be rather short anyway (things
      like hubs or HID devices).
      
      Another minor drawback is that we will keep track of two different
      period and phase values: the actual ones and the ones used for
      bandwidth allocation (which are limited to 64).  This adds only a
      small amount of overhead: 3 bytes for each endpoint.
      
      The patch also adds a new debugfs file named "bandwidth" to display
      the information stored in the new table.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0ce5c6b
    • A
      USB: EHCI: create a "periodic schedule info" struct · ffa0248e
      Alan Stern 提交于
      This patch begins the process of unifying the scheduling parameters
      that ehci-hcd uses for interrupt and isochronous transfers.  It
      creates an ehci_per_sched structure, which will be stored in both
      ehci_qh and ehci_iso_stream structures, and will contain the common
      scheduling information needed for both.
      
      Initially we merely create the new structure and move some existing
      fields into it.  Later patches will add more fields and utilize these
      structures in improved scheduling algorithms.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ffa0248e
    • A
      USB: EHCI: use consistent NO_FRAME value · 91a99b5e
      Alan Stern 提交于
      ehci-hcd is inconsistent in the sentinel values it uses to indicate
      that no frame number has been assigned for a periodic transfer.  Some
      places it uses NO_FRAME (defined as 65535), other places it uses -1,
      and elsewhere it uses 9999.
      
      This patch defines a value for NO_FRAME which can fit in a 16-bit
      signed integer, and changes the code to use it everywhere.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      91a99b5e
  12. 18 9月, 2013 1 次提交
    • A
      USB: EHCI: handle isochronous underruns with tasklets · 46c73d1d
      Alan Stern 提交于
      This patch updates the iso_stream_schedule() routine in ehci-sched.c
      to handle cases where an underrun causes an isochronous endpoint's
      queue to empty out, but the client driver wants to maintain
      synchronization with the device (i.e., the URB_ISO_ASAP flag is not
      set).  This could not happen until recently, when ehci-hcd switched
      over to completing URBs in a tasklet.
      
      (This may seem like an unlikely case to worry about, but underruns are
      all too common with the snd-usb-audio driver, which doesn't use
      URB_ISO_ASAP.)
      
      As part of the fix, some URBs may need to be given back when they are
      submitted.  This is necessary when the URB's scheduled slots all fall
      before the current value of ehci->last_iso_frame, and as an
      optimization we do it also when the slots all fall before the current
      frame number.
      
      As a second part of the fix, we may need to skip some but not all of
      an URB's packets.  This is necessary when some of the URB's scheduled
      slots fall before the current value of ehci->last_iso_frame and some
      of them fall after the current frame number.  A new field
      (first_packet) is added to struct ehci_iso_sched, to indicate how many
      packets should be skipped.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Ming Lei <tom.leiming@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      46c73d1d
  13. 31 8月, 2013 2 次提交
  14. 13 8月, 2013 2 次提交
  15. 18 6月, 2013 1 次提交
  16. 04 4月, 2013 1 次提交
  17. 26 3月, 2013 3 次提交
    • A
      USB: EHCI: improve end_unlink_async() · 214ac7a0
      Alan Stern 提交于
      This patch (as1665) changes the way ehci-hcd's end_unlink_async()
      routine works in order to avoid recursive execution and to be more
      efficient:
      
      	Now when an IAA cycle ends, a new one gets started up right
      	away (if it is needed) instead of waiting until the
      	just-unlinked QH has been processed.
      
      	The async_iaa list is renamed to async_idle, which better
      	expresses its new purpose: It is now the list of QHs which are
      	now completely idle and are waiting to be processed by
      	end_unlink_async().
      
      	A new flag is added to track whether an IAA cycle is in
      	progress, because the list formerly known as async_iaa no
      	longer stores the QHs waiting for the IAA to finish.
      
      	The decision about how many QHs to process when an IAA cycle
      	ends is now made at the end of the cycle, when we know the
      	current state of the hardware, rather than at the beginning.
      	This means a bunch of logic got moved from start_iaa_cycle()
      	to end_unlink_async().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      214ac7a0
    • A
      USB: EHCI: convert singly-linked lists to list_heads · 6e018751
      Alan Stern 提交于
      This patch (as1664) converts ehci-hcd's async_unlink, async_iaa, and
      intr_unlink from singly-linked lists to standard doubly-linked
      list_heads.  Originally it didn't seem necessary to use list_heads,
      because items are always added to and removed from these lists in FIFO
      order.  But now with more list processing going on, it's easier to use
      the standard routines than continue with a roll-your-own approach.
      
      I don't know if the code ends up being notably shorter, but the
      patterns will be more familiar to any kernel hacker.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e018751
    • A
      USB: EHCI: split needs_rescan into two flags · 7bc782d7
      Alan Stern 提交于
      This patch (as1662) does some more QH-related cleanup in ehci-hcd.
      The qh->needs_rescan flag is currently used for two different
      purposes; the patch replaces it with two separate flags for greater
      clarity: qh->dequeue_during_giveback indicates that a completion
      handler dequeued an URB (implying that a rescan is needed), and
      qh->exception indicates that the QH is in an exceptional state
      requiring an unlink (either it encountered an I/O error or an unlink
      was requested).
      
      The new flags get set where the dequeue, exception, or unlink request
      occurred, rather than where the unlink is started.  This is so that in
      the future, if we need to, we will be able to tell apart unlinks that
      truly were required from those that were carried out merely because
      the QH wasn't being used.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7bc782d7
  18. 23 1月, 2013 2 次提交
  19. 12 11月, 2012 1 次提交
  20. 01 11月, 2012 2 次提交
    • A
      USB: EHCI: prepare to make ehci-hcd a library module · 3e023203
      Alan Stern 提交于
      This patch (as1624) prepares ehci-hcd for being split up into a core
      library and separate platform driver modules.  A generic
      ehci_hc_driver structure is created, containing all the "standard"
      values, and a new mechanism is added whereby a driver module can
      specify a set of overrides to those values.  In addition the
      ehci_setup(), ehci_suspend(), and ehci_resume() routines need to be
      EXPORTed for use by the drivers.
      
      As a side effect of this change, a few routines no longer need to be
      marked __maybe_unused.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Felipe Balbi <balbi@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e023203
    • A
      USB: EHCI: remove unused Link Power Management code · 4968f951
      Alan Stern 提交于
      This patch (as1622) removes the USB-2.1 Link Power Management code
      from the ehci-hcd driver.  This code was never integrated with
      usbcore, it is full of bugs, and it was not getting used by anybody.
      
      However, the debugging code for dumping the LPM-related fields in the
      EHCI registers is left in place.  In theory it might be useful to see
      these values, even though we don't use them.
      
      This essentially amounts to a partial revert of commit
      aa4d8342 (USB: EHCI: EHCI 1.1
      addendum: preparation) and an almost full revert of commit
      48f24970 (USB: EHCI: EHCI 1.1
      addendum: Basic LPM feature support) plus its follow-ons.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4968f951
  21. 25 10月, 2012 2 次提交
  22. 22 10月, 2012 2 次提交
    • A
      EHCI: use the isochronous scheduling threshold · 98cae42d
      Alan Stern 提交于
      This patch (as1609) changes the way ehci-hcd uses the "Isochronous
      Scheduling Threshold" in its calculations.  Until now the code has
      ignored the threshold except for certain Intel PCI-based controllers.
      This violates the EHCI spec.
      
      The new code takes the threshold into account always, removing the
      need for the fs_i_thresh quirk flag.  In addition it implements the
      "full frame cache" setting more efficiently, moving forward only as
      far as the next frame boundary instead of always moving forward 8
      microframes.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      98cae42d
    • A
      EHCI: improved logic for isochronous scheduling · c3ee9b76
      Alan Stern 提交于
      This patch (as1608) reworks the logic used by ehci-hcd for scheduling
      isochronous transfers.  Now the modular calculations are all based on
      a window that starts at the last frame scanned for isochronous
      completions.  No transfer descriptors for any earlier frames can
      possibly remain on the schedule, so there can be no confusion from
      schedule wrap-around.  This removes the need for a "slop" region of
      arbitrary size.
      
      There's no need to check for URBs that are longer than the schedule
      length.  With the old code they could throw things off by wrapping
      around and appearing to end in the near future rather than the distant
      future.  Now such confusion isn't possible, and the existing test for
      submissions that extend too far into the future will also catch those
      that exceed the schedule length.  (But there still has to be an
      initial test to handle the case where the schedule already extends as
      far into the future as possible.)
      
      Delays caused by IRQ latency won't confuse the algorithm unless they
      are ridiculously long (over 250 ms); they will merely reduce how far
      into the future new transfers can be scheduled.  A few people have
      reported problems caused by delays of 50 ms or so.  Now instead of
      failing completely, isochronous transfers will experience a brief
      glitch and then continue normally.
      
      (Whether this is truly a good thing is debatable.  A latency as large
      as 50 ms generally indicates a bug is present, and complete failure of
      audio or video transfers draws people's attention pretty vividly.
      Making the transfers more robust also makes it easier for such bugs to
      remain undetected.)
      
      Finally, ehci->next_frame is renamed to ehci->last_iso_frame, because
      that better describes what it is: the last frame to have been scanned
      for isochronous completions.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3ee9b76
  23. 17 7月, 2012 4 次提交
    • A
      USB: EHCI: resolve some unlikely races · 43fe3a99
      Alan Stern 提交于
      This patch (as1589) resolves some unlikely races involving system
      shutdown or controller death in ehci-hcd:
      
      	Shutdown races with both root-hub resume and controller
      	resume.
      
      	Controller death races with root-hub suspend.
      
      A new bitflag is added to indicate that the controller has been shut
      down (whether for system shutdown or because it died).  Tests are
      added in the suspend and resume pathways to avoid reactivating the
      controller after any sort of shutdown.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      43fe3a99
    • A
      USB: EHCI: simplify isochronous scanning · f4289078
      Alan Stern 提交于
      This patch (as1587) simplifies ehci-hcd's scan_isoc() routine by
      eliminating some local variables, declaring boolean-valued values as
      bool rather than unsigned, changing variable names to make more sense,
      and so on.
      
      The logic at the end of the routine is cut down significantly.  The
      scanning doesn't have to catch up all the way to where the hardware
      is; it merely has to catch up to where the hardware was when the last
      interrupt occurred.  If the hardware has made more progress since then
      and issued another interrupt, a rescan will catch up to it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4289078
    • A
      USB: EHCI: use hrtimer for the I/O watchdog · 18aafe64
      Alan Stern 提交于
      This patch (as1586) replaces the kernel timer used by ehci-hcd as an
      I/O watchdog with an hrtimer event.
      
      Unlike in the current code, the watchdog event is now always enabled
      whenever any isochronous URBs are active.  This will prevent bugs
      caused by the periodic schedule wrapping around with no completion
      interrupts; the watchdog handler is guaranteed to scan the isochronous
      transfers at least once during each iteration of the schedule.  The
      extra overhead will be negligible: one timer interrupt every 100 ms.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      18aafe64
    • A
      USB: EHCI: always scan each interrupt QH · 569b394f
      Alan Stern 提交于
      This patch (as1585) fixes a bug in ehci-hcd's scheme for scanning
      interrupt QHs.
      
      Currently a single routine takes care of scanning everything on the
      periodic schedule.  Whenever an interrupt occurs, it scans all
      isochronous and interrupt URBs scheduled for frames that have elapsed
      since the last scan.
      
      This has two disadvantages.  The first is relatively minor: An
      interrupt QH is likely to end up getting scanned multiple times,
      particularly if the last scan was not fairly recent.  (The current
      code avoids this by maintaining a periodic_stamp in each interrupt
      QH.)
      
      The second is more serious.  The periodic schedule wraps around.  If
      the last scan occurred during frame N, and the next scan occurs when
      the schedule has gone through an entire cycle and is back at frame N,
      the scanning code won't look at any frames other than N.  Consequently
      it won't see any QHs that completed during frame N-1 or earlier.
      
      The patch replaces the entire frame-based approach for scanning
      interrupt QHs with a new routine using a list-based approach, the same
      as for async QHs.  This has a slight disadvantage, because it means
      that all interrupt QHs have to be scanned every time.  But it is more
      robust than the current approach.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      569b394f