1. 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
  2. 08 8月, 2009 1 次提交
  3. 13 7月, 2009 1 次提交
  4. 16 6月, 2009 1 次提交
  5. 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
  6. 25 3月, 2009 1 次提交
  7. 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
  8. 28 2月, 2009 1 次提交
  9. 14 11月, 2008 1 次提交
  10. 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
  11. 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
  12. 25 4月, 2008 3 次提交
  13. 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
  14. 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
  15. 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
  16. 13 7月, 2007 2 次提交
    • S
      USB: EHCI support for big-endian descriptors · 6dbd682b
      Stefan Roese 提交于
      This patch implements supports for EHCI controllers whose in-memory
      data structures are represented in big-endian format. This is needed
      (unfortunately) for the AMCC PPC440EPx SoC EHCI controller; the EHCI
      spec doesn't specify little-endian format, although that's what most
      other implementations use.
      
      The guts of the patch are to introduce the hc32 type and change all
      references from le32 to hc32.  All access routines are converted from
      cpu_to_le32(...) to cpu_to_hc32(ehci, ...) and similar for the other
      "direction".  (This is the same approach used with OHCI.)
      
      David fixed:
      	Whitespace fixes; refresh against ehci cpufreq patch; move glue
      	for that PPC driver to the patch adding it; fix free symbol
      	capture bugs in modified "constant" macros; and make "hc32" etc
      	be "le32" unless we really need the BE options, so "sparse" can
      	do some real good.
      Signed-off-by: NStefan Roese <sr@denx.de>
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      6dbd682b
    • S
      USB: EHCI cpufreq fix · 196705c9
      Stuart_Hayes@Dell.com 提交于
      EHCI controllers that don't cache enough microframes can get MMF errors
      when CPU frequency changes occur between the start and completion of
      split interrupt transactions, due to delays in reading main memory
      (caused by CPU cache snoop delays).
      
      This patch adds a cpufreq notifier to the EHCI driver that will
      inactivate split interrupt transactions during frequency transitions.
      It was tested on Intel ICH7 and Serverworks/Broadcom HT1000 EHCI
      controllers.
      Signed-off-by: NStuart Hayes <stuart_hayes@dell.com>
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      196705c9
  17. 08 2月, 2007 1 次提交
  18. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780
  19. 28 9月, 2006 1 次提交
  20. 22 6月, 2006 1 次提交
    • D
      [PATCH] improved TT scheduling for EHCI · ba47f66b
      Dan Streetman 提交于
      This updates the EHCI driver by adding an improved scheduler for the
      transaction translators, found in USB 2.0 hubs and used for low and
      full speed devices.
      
       - adds periodic_tt_usecs() and some helper functions, which does
         the same thing that "periodic_usecs" does, except on the other
         side of the TT, i.e.  it calculates the low/fullspeed bandwidth
         usage instead of highspeed.
      
       - adds a tt_available() function which is the new implementation
         of what tt_no_collision() does ... while tt_no_collision() ensures
         that each TT handles only 1 periodic transfer at a time (a very
         pessimistic approach) this version instead tracks bandwidth and
         allows each TT to handle as many transfers as will fit on each TT's
         downstream bus (closer to best-case).
      
      The new scheduler is selected by a config option, marked as EXPERIMENTAL
      so it can be tested (and more broadly reviewed) for a while until it
      seems safe to remove the original scheduler.
      Signed-off-by: NDan Streetman <ddstreet@ieee.org>
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ba47f66b
  21. 21 3月, 2006 3 次提交
  22. 01 2月, 2006 2 次提交
  23. 30 11月, 2005 1 次提交
    • B
      [PATCH] USB: Fix USB suspend/resume crasher (#2) · 8de98402
      Benjamin Herrenschmidt 提交于
      This patch closes the IRQ race and makes various other OHCI & EHCI code
      path safer vs. suspend/resume.
      I've been able to (finally !) successfully suspend and resume various
      Mac models, with or without USB mouse plugged, or plugging while asleep,
      or unplugging while asleep etc... all without a crash.
      
      Alan, please verify the UHCI bit I did, I only verified that it builds.
      It's very simple so I wouldn't expect any issue there. If you aren't
      confident, then just drop the hunks that change uhci-hcd.c
      
      I also made the patch a little bit more "safer" by making sure the store
      to the interrupt register that disables interrupts is not posted before
      I set the flag and drop the spinlock.
      
      Without this patch, you cannot reliably sleep/wakeup any recent Mac, and
      I suspect PCs have some more sneaky issues too (they don't frankly crash
      with machine checks because x86 tend to silently swallow PCI errors but
      that won't last afaik, at least PCI Express will blow up in those
      situations, but the USB code may still misbehave).
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8de98402
  24. 28 10月, 2005 1 次提交
  25. 09 9月, 2005 1 次提交
  26. 08 9月, 2005 1 次提交
  27. 05 8月, 2005 1 次提交
    • D
      [PATCH] USB: ehci: microframe handling fix · 7dedacf4
      David Brownell 提交于
      This patch has a one line oops fix, plus related cleanups.
      
       - The bugfix uses microframe scheduling data given to the hardware to
         test "is this a periodic QH", rather than testing for nonzero period.
         (Prevents an oops by providing the correct answer.)
      
       - The cleanup going along with the patch should make it clearer what's
         going on whenever those bitfields are accessed.
      
      The bug came about when, around January, two new kinds of EHCI interrupt
      scheduling operation were added, involving both the high speed (24 KBytes
      per millisec) and low/full speed (1-64 bytes per millisec) microframe
      scheduling.  A driver for the Edirol UA-1000 Audio Capture Unit ran into
      the oops; it used one of the newly supported high speed modes.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      7dedacf4
  28. 13 7月, 2005 1 次提交