1. 12 10月, 2013 16 次提交
    • 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
    • A
      USB: EHCI: change toggle only upon successful reset · 27c4a31d
      Alan Stern 提交于
      ehci-hcd uses a value of 0 in an endpoint's toggle flag to indicate
      that the endpoint has been reset (and therefore the Data Toggle bit
      needs to be cleared in the endpoint's QH overlay region).
      
      The toggle flag should be set to 0 only when ehci_endpoint_reset()
      succeeds.  This patch moves the usb_settoggle() call into the
      appropriate branch of the "if" statement.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27c4a31d
    • A
      USB: EHCI: No SSPLIT allowed in uframe 7 · 8c05dc59
      Alan Stern 提交于
      The scheduling code in ehci-hcd contains an error.  For full-speed
      isochronous-OUT transfers, the EHCI spec forbids scheduling
      Start-Split transactions in H-microframe 7, but the driver allows it
      anyway.  This patch adds a check to prevent it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c05dc59
    • A
      USB: EHCI: compute full-speed bandwidth usage correctly · 2b90f01b
      Alan Stern 提交于
      Although the bandwidth statistics maintained by ehci-hcd show up only
      in the /sys/kernel/debug/usb/devices file, they ought to be calculated
      correctly.  The calculation for full-speed isochronous endpoints is
      wrong; it mistakenly yields bytes per microframe instead of bytes per
      frame.  The "interval" value, which is in frames, should not be
      converted to microframes.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b90f01b
    • A
      USB: EHCI: check the right uframes for CSPLIT · e24371a6
      Alan Stern 提交于
      The check_intr_schedule() routine in ehci-hcd looks at the wrong
      microframes when checking to see if a full-speed or low-speed
      interrupt endpoint will fit in the periodic schedule.  If the
      Start-Split transaction is scheduled for microframe N then the
      Complete-Split transactions get scheduled for microframes N+2, N+3, and
      N+4.  However the code considers N+1, N+2, and N+3 instead.
      
      This patch fixes the limits on the "for" loop and also improves the
      use of whitespace.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e24371a6
    • A
      USB: NS_TO_US should round up · 63fb3a28
      Alan Stern 提交于
      Host controller drivers use the NS_TO_US macro to convert transaction
      times, which are computed in nanoseconds, to microseconds for
      scheduling.  Periodic scheduling requires worst-case estimates, but
      the macro does its conversion using round-to-nearest.  This patch
      changes it to use round-up, giving a correct worst-case value.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      63fb3a28
    • H
      usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done · 6ec4147e
      Hans de Goede 提交于
      usb_wait_anchor_empty_timeout() should wait till the completion handler
      has run. Both the zd1211rw driver and the uas driver (in its task mgmt) depend
      on the completion handler having completed when usb_wait_anchor_empty_timeout()
      returns, as they read state set by the completion handler after an
      usb_wait_anchor_empty_timeout() call.
      
      But __usb_hcd_giveback_urb() calls usb_unanchor_urb before calling the
      completion handler. This is necessary as the completion handler may
      re-submit and re-anchor the urb. But this introduces a race where the state
      these drivers want to read has not been set yet by the completion handler
      (this race is easily triggered with the uas task mgmt code).
      
      I've considered adding an anchor_count to struct urb, which would be
      incremented on anchor and decremented on unanchor, and then only actually
      do the anchor / unanchor on 0 -> 1 and 1 -> 0 transtions, combined with
      moving the unanchor call in hcd_giveback_urb to after calling the completion
      handler. But this will only work if urb's are only re-anchored to the same
      anchor as they were anchored to before the completion handler ran.
      
      And at least one driver re-anchors to another anchor from the completion
      handler (rtlwifi).
      
      So I have come up with this patch instead, which adds the ability to
      suspend wakeups of usb_wait_anchor_empty_timeout() waiters to the usb_anchor
      functionality, and uses this in __usb_hcd_giveback_urb() to delay wake-ups
      until the completion handler has run.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NOliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ec4147e
    • H
      usb-anchor: Ensure poisened gets initialized to 0 · 9ef73dbd
      Hans de Goede 提交于
      And do so in a way which ensures that any fields added in the future will
      also get properly zero-ed.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NOliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ef73dbd
    • J
      USB: ohci-exynos: Add missing usb_put_hcd() to prevent memory leak · a72e2e5c
      Jingoo Han 提交于
      When devm_usb_get_phy() fails, usb_put_hcd() should be called
      to prevent memory leak.
      Signed-off-by: NJingoo Han <jg1.han@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a72e2e5c
    • I
      USB: ehci-msm: Add device tree support and binding information · 0fc924bd
      Ivan T. Ivanov 提交于
      Allows MSM EHCI controller to be specified via device tree.
      Signed-off-by: NIvan T. Ivanov <iivanov@mm-sol.com>
      Acked-by: NDavid Brown <davidb@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0fc924bd
    • I
      ehci-msm: Remove global struct usb_phy variable · e4f0da05
      Ivan T. Ivanov 提交于
      Use struct usb_hcd::phy to hold USB PHY instance.
      Signed-off-by: NIvan T. Ivanov <iivanov@mm-sol.com>
      Acked-by: NDavid Brown <davidb@codeaurora.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4f0da05
    • J
      usb: Remove unnecessary semicolons · 2b84f92b
      Joe Perches 提交于
      These aren't necessary after switch and if blocks.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b84f92b
    • P
      usb: chipidea: udc: Fix calling spin_lock_irqsave at sleep context · 65b2fb32
      Peter Chen 提交于
      Fixing the below dump:
      
      root@freescale ~$ modprobe g_serial
      g_serial gadget: Gadget Serial v2.4
      g_serial gadget: g_serial ready
      BUG: sleeping function called from invalid context at /home/b29397/work/projects/upstream/usb/usb/drivers/base/power/runtime.c:952
      in_atomic(): 1, irqs_disabled(): 128, pid: 805, name: modprobe
      2 locks held by modprobe/805:
       #0:  (udc_lock){+.+.+.}, at: [<7f000a74>] usb_gadget_probe_driver+0x44/0xb4 [udc_core]
       #1:  (&(&ci->lock)->rlock){......}, at: [<7f033488>] ci_udc_start+0x94/0x110 [ci_hdrc]
      irq event stamp: 3878
      hardirqs last  enabled at (3877): [<806b6720>] _raw_spin_unlock_irqrestore+0x40/0x6c
      hardirqs last disabled at (3878): [<806b6474>] _raw_spin_lock_irqsave+0x2c/0xa8
      softirqs last  enabled at (3872): [<8002ec0c>] __do_softirq+0x1c8/0x2e8
      softirqs last disabled at (3857): [<8002f180>] irq_exit+0xbc/0x110
      CPU: 0 PID: 805 Comm: modprobe Not tainted 3.11.0-next-20130910+ #85
      [<80016b94>] (unwind_backtrace+0x0/0xf8) from [<80012e0c>] (show_stack+0x20/0x24)
      [<80012e0c>] (show_stack+0x20/0x24) from [<806af554>] (dump_stack+0x9c/0xc4)
      [<806af554>] (dump_stack+0x9c/0xc4) from [<8005940c>] (__might_sleep+0xf4/0x134)
      [<8005940c>] (__might_sleep+0xf4/0x134) from [<803a04a4>] (__pm_runtime_resume+0x94/0xa0)
      [<803a04a4>] (__pm_runtime_resume+0x94/0xa0) from [<7f0334a4>] (ci_udc_start+0xb0/0x110 [ci_hdrc])
      [<7f0334a4>] (ci_udc_start+0xb0/0x110 [ci_hdrc]) from [<7f0009b4>] (udc_bind_to_driver+0x5c/0xd8 [udc_core])
      [<7f0009b4>] (udc_bind_to_driver+0x5c/0xd8 [udc_core]) from [<7f000ab0>] (usb_gadget_probe_driver+0x80/0xb4 [udc_core])
      [<7f000ab0>] (usb_gadget_probe_driver+0x80/0xb4 [udc_core]) from [<7f008618>] (usb_composite_probe+0xac/0xd8 [libcomposite])
      [<7f008618>] (usb_composite_probe+0xac/0xd8 [libcomposite]) from [<7f04b168>] (init+0x8c/0xb4 [g_serial])
      [<7f04b168>] (init+0x8c/0xb4 [g_serial]) from [<800088e8>] (do_one_initcall+0x108/0x16c)
      [<800088e8>] (do_one_initcall+0x108/0x16c) from [<8008e518>] (load_module+0x1b00/0x20a4)
      [<8008e518>] (load_module+0x1b00/0x20a4) from [<8008eba8>] (SyS_init_module+0xec/0x100)
      [<8008eba8>] (SyS_init_module+0xec/0x100) from [<8000ec40>] (ret_fast_syscall+0x0/0x48)
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65b2fb32
    • P
      usb: chipidea: udc: Fix spinlock recursion during bus reset · a3aee368
      Peter Chen 提交于
      After configuration, the host also possible sends bus reset
      at any time, at such situation, it will trigger below spinlock
      recursion dump. This commit unlocks the spinlock before calling
      gadget's disconnect.
      
      BUG: spinlock recursion on CPU#0, swapper/0/0
       lock: 0xbf128014, .magic: dead4ead, .owner: swapper/0/0, .owner_cpu: 0
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.11.0-next-20130910+ #106
      [<80014e20>] (unwind_backtrace+0x0/0xec) from [<80011a6c>] (show_stack+0x10/0x14)
      [<80011a6c>] (show_stack+0x10/0x14) from [<805c143c>] (dump_stack+0x94/0xbc)
      [<805c143c>] (dump_stack+0x94/0xbc) from [<80282cf8>] (do_raw_spin_lock+0x16c/0x18c)
      [<80282cf8>] (do_raw_spin_lock+0x16c/0x18c) from [<805c77e0>] (_raw_spin_lock_irqsave+0x50/0x5c)
      [<805c77e0>] (_raw_spin_lock_irqsave+0x50/0x5c) from [<803cff88>] (ep_disable+0x24/0x110)
      [<803cff88>] (ep_disable+0x24/0x110) from [<7f015d50>] (gserial_disconnect+0xa0/0x15c [u_serial])
      [<7f015d50>] (gserial_disconnect+0xa0/0x15c [u_serial]) from [<7f01c06c>] (acm_disable+0xc/0x30 [usb_f_acm])
      [<7f01c06c>] (acm_disable+0xc/0x30 [usb_f_acm]) from [<7f001478>] (reset_config.isra.10+0x34/0x5c [libcomposite])
      [<7f001478>] (reset_config.isra.10+0x34/0x5c [libcomposite]) from [<7f0014d4>] (composite_disconnect+0x34/0x5c [libcomposite])
      [<7f0014d4>] (composite_disconnect+0x34/0x5c [libcomposite]) from [<803d1024>] (udc_irq+0x770/0xce4)
      [<803d1024>] (udc_irq+0x770/0xce4) from [<803cdcc0>] (ci_irq+0x98/0x164)
      [<803cdcc0>] (ci_irq+0x98/0x164) from [<8007edfc>] (handle_irq_event_percpu+0x50/0x17c)
      [<8007edfc>] (handle_irq_event_percpu+0x50/0x17c) from [<8007ef64>] (handle_irq_event+0x3c/0x5c)
      [<8007ef64>] (handle_irq_event+0x3c/0x5c) from [<80081e98>] (handle_fasteoi_irq+0x98/0x168)
      [<80081e98>] (handle_fasteoi_irq+0x98/0x168) from [<8007e598>] (generic_handle_irq+0x28/0x3c)
      [<8007e598>] (generic_handle_irq+0x28/0x3c) from [<8000edf4>] (handle_IRQ+0x4c/0xb4)
      [<8000edf4>] (handle_IRQ+0x4c/0xb4) from [<800085bc>] (gic_handle_irq+0x28/0x5c)
      [<800085bc>] (gic_handle_irq+0x28/0x5c) from [<800125c0>] (__irq_svc+0x40/0x54)
      Exception stack(0x8083bf68 to 0x8083bfb0)
      bf60:                   81533b80 00000000 00096234 8001d760 8088e12c 00000000
      bf80: 8083a000 8083a000 8084290c 805cb414 808428ac 8083a000 00000001 8083bfb0
      bfa0: 8000f138 8000f13c 60000013 ffffffff
      [<800125c0>] (__irq_svc+0x40/0x54) from [<8000f13c>] (arch_cpu_idle+0x30/0x3c)
      [<8000f13c>] (arch_cpu_idle+0x30/0x3c) from [<8005eb94>] (cpu_startup_entry+0xf4/0x148)
      [<8005eb94>] (cpu_startup_entry+0xf4/0x148) from [<807f1a2c>] (start_kernel+0x2c4/0x318)
      BUG: spinlock lockup suspected on CPU#0, swapper/0/0
       lock: 0xbf128014, .magic: dead4ead, .owner: swapper/0/0, .owner_cpu: 0
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.11.0-next-20130910+ #106
      [<80014e20>] (unwind_backtrace+0x0/0xec) from [<80011a6c>] (show_stack+0x10/0x14)
      [<80011a6c>] (show_stack+0x10/0x14) from [<805c143c>] (dump_stack+0x94/0xbc)
      [<805c143c>] (dump_stack+0x94/0xbc) from [<80282c94>] (do_raw_spin_lock+0x108/0x18c)
      [<80282c94>] (do_raw_spin_lock+0x108/0x18c) from [<805c77e0>] (_raw_spin_lock_irqsave+0x50/0x5c)
      [<805c77e0>] (_raw_spin_lock_irqsave+0x50/0x5c) from [<803cff88>] (ep_disable+0x24/0x110)
      [<803cff88>] (ep_disable+0x24/0x110) from [<7f015d50>] (gserial_disconnect+0xa0/0x15c [u_serial])
      [<7f015d50>] (gserial_disconnect+0xa0/0x15c [u_serial]) from [<7f01c06c>] (acm_disable+0xc/0x30 [usb_f_acm])
      [<7f01c06c>] (acm_disable+0xc/0x30 [usb_f_acm]) from [<7f001478>] (reset_config.isra.10+0x34/0x5c [libcomposite])
      [<7f001478>] (reset_config.isra.10+0x34/0x5c [libcomposite]) from [<7f0014d4>] (composite_disconnect+0x34/0x5c [libcomposite])
      [<7f0014d4>] (composite_disconnect+0x34/0x5c [libcomposite]) from [<803d1024>] (udc_irq+0x770/0xce4)
      [<803d1024>] (udc_irq+0x770/0xce4) from [<803cdcc0>] (ci_irq+0x98/0x164)
      [<803cdcc0>] (ci_irq+0x98/0x164) from [<8007edfc>] (handle_irq_event_percpu+0x50/0x17c)
      [<8007edfc>] (handle_irq_event_percpu+0x50/0x17c) from [<8007ef64>] (handle_irq_event+0x3c/0x5c)
      [<8007ef64>] (handle_irq_event+0x3c/0x5c) from [<80081e98>] (handle_fasteoi_irq+0x98/0x168)
      [<80081e98>] (handle_fasteoi_irq+0x98/0x168) from [<8007e598>] (generic_handle_irq+0x28/0x3c)
      [<8007e598>] (generic_handle_irq+0x28/0x3c) from [<8000edf4>] (handle_IRQ+0x4c/0xb4)
      [<8000edf4>] (handle_IRQ+0x4c/0xb4) from [<800085bc>] (gic_handle_irq+0x28/0x5c)
      [<800085bc>] (gic_handle_irq+0x28/0x5c) from [<800125c0>] (__irq_svc+0x40/0x54)
      Exception stack(0x8083bf68 to 0x8083bfb0)
      bf60:                   81533b80 00000000 00096234 8001d760 8088e12c 00000000
      bf80: 8083a000 8083a000 8084290c 805cb414 808428ac 8083a000 00000001 8083bfb0
      bfa0: 8000f138 8000f13c 60000013 ffffffff
      [<800125c0>] (__irq_svc+0x40/0x54) from [<8000f13c>] (arch_cpu_idle+0x30/0x3c)
      [<8000f13c>] (arch_cpu_idle+0x30/0x3c) from [<8005eb94>] (cpu_startup_entry+0xf4/0x148)
      [<8005eb94>] (cpu_startup_entry+0xf4/0x148) from [<807f1a2c>] (start_kernel+0x2c4/0x318)
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a3aee368
  2. 07 10月, 2013 10 次提交
  3. 06 10月, 2013 14 次提交