<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/drivers/usb, branch docs-5.6</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-5.6</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=docs-5.6'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2019-12-14T20:40:39+00:00</updated>
<entry>
<title>Merge tag 'usb-5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb</title>
<updated>2019-12-14T20:40:39+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2019-12-14T20:40:39+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a1b85b3bf9f9922bdc1428cd2ac4528786a05da7'/>
<id>urn:sha1:a1b85b3bf9f9922bdc1428cd2ac4528786a05da7</id>
<content type='text'>
Pull USB fixes from Greg KH:
 "Here are some small USB driver fixes for reported issues for 5.5-rc2

  There's the usual gadget and xhci fixes, as well as some other
  problems that syzbot has been finding during it's fuzzing runs. Full
  details are in the shortlog.

  All of these have been in linux-next with no reported issues"

* tag 'usb-5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (21 commits)
  usb: dwc3: pci: add ID for the Intel Comet Lake -H variant
  xhci: make sure interrupts are restored to correct state
  xhci: handle some XHCI_TRUST_TX_LENGTH quirks cases as default behaviour.
  xhci: Increase STS_HALT timeout in xhci_suspend()
  usb: xhci: only set D3hot for pci device
  xhci: fix USB3 device initiated resume race with roothub autosuspend
  xhci: Fix memory leak in xhci_add_in_port()
  USB: Fix incorrect DMA allocations for local memory pool drivers
  usb: gadget: fix wrong endpoint desc
  usb: dwc3: ep0: Clear started flag on completion
  usb: dwc3: gadget: Clear started flag for non-IOC
  usb: dwc3: gadget: Fix logical condition
  USB: atm: ueagle-atm: add missing endpoint check
  USB: adutux: fix interface sanity check
  USB: idmouse: fix interface sanity checks
  USB: serial: io_edgeport: fix epic endpoint lookup
  usb: mon: Fix a deadlock in usbmon between mmap and read
  usb: common: usb-conn-gpio: Don't log an error on probe deferral
  usb: core: urb: fix URB structure initialization function
  usb: typec: fix use after free in typec_register_port()
  ...
</content>
</entry>
<entry>
<title>usb: dwc3: pci: add ID for the Intel Comet Lake -H variant</title>
<updated>2019-12-12T13:02:37+00:00</updated>
<author>
<name>Heikki Krogerus</name>
<email>heikki.krogerus@linux.intel.com</email>
</author>
<published>2019-12-12T09:37:13+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=3c3caae4cd6e122472efcf64759ff6392fb6bce2'/>
<id>urn:sha1:3c3caae4cd6e122472efcf64759ff6392fb6bce2</id>
<content type='text'>
The original ID that was added for Comet Lake PCH was
actually for the -LP (low power) variant even though the
constant for it said CMLH. Changing that while at it.

Signed-off-by: Heikki Krogerus &lt;heikki.krogerus@linux.intel.com&gt;
Acked-by: Felipe Balbi &lt;balbi@kernel.org&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Link: https://lore.kernel.org/r/20191212093713.60614-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>xhci: make sure interrupts are restored to correct state</title>
<updated>2019-12-11T14:32:19+00:00</updated>
<author>
<name>Mathias Nyman</name>
<email>mathias.nyman@linux.intel.com</email>
</author>
<published>2019-12-11T14:20:07+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=bd82873f23c9a6ad834348f8b83f3b6a5bca2c65'/>
<id>urn:sha1:bd82873f23c9a6ad834348f8b83f3b6a5bca2c65</id>
<content type='text'>
spin_unlock_irqrestore() might be called with stale flags after
reading port status, possibly restoring interrupts to a incorrect
state.

If a usb2 port just finished resuming while the port status is read
the spin lock will be temporary released and re-acquired in a separate
function. The flags parameter is passed as value instead of a pointer,
not updating flags properly before the final spin_unlock_irqrestore()
is called.

Cc: &lt;stable@vger.kernel.org&gt; # v3.12+
Fixes: 8b3d45705e54 ("usb: Fix xHCI host issues on remote wakeup.")
Signed-off-by: Mathias Nyman &lt;mathias.nyman@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20191211142007.8847-7-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>xhci: handle some XHCI_TRUST_TX_LENGTH quirks cases as default behaviour.</title>
<updated>2019-12-11T14:32:19+00:00</updated>
<author>
<name>Mathias Nyman</name>
<email>mathias.nyman@linux.intel.com</email>
</author>
<published>2019-12-11T14:20:06+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=7ff11162808cc2ec66353fc012c58bb449c892c3'/>
<id>urn:sha1:7ff11162808cc2ec66353fc012c58bb449c892c3</id>
<content type='text'>
xhci driver claims it needs XHCI_TRUST_TX_LENGTH quirk for both
Broadcom/Cavium and a Renesas xHC controllers.

The quirk was inteded for handling false "success" complete event for
transfers that had data left untransferred.
These transfers should complete with "short packet" events instead.

In these two new cases the false "success" completion is reported
after a "short packet" if the TD consists of several TRBs.
xHCI specs 4.10.1.1.2 say remaining TRBs should report "short packet"
as well after the first short packet in a TD, but this issue seems so
common it doesn't make sense to add the quirk for all vendors.

Turn these events into short packets automatically instead.

This gets rid of the  "The WARN Successful completion on short TX for
slot 1 ep 1: needs XHCI_TRUST_TX_LENGTH quirk" warning in many cases.

Cc: &lt;stable@vger.kernel.org&gt;
Reported-by: Eli Billauer &lt;eli.billauer@gmail.com&gt;
Reported-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Tested-by: Eli Billauer &lt;eli.billauer@gmail.com&gt;
Tested-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Mathias Nyman &lt;mathias.nyman@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20191211142007.8847-6-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>xhci: Increase STS_HALT timeout in xhci_suspend()</title>
<updated>2019-12-11T14:32:18+00:00</updated>
<author>
<name>Kai-Heng Feng</name>
<email>kai.heng.feng@canonical.com</email>
</author>
<published>2019-12-11T14:20:05+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=7c67cf6658cec70d8a43229f2ce74ca1443dc95e'/>
<id>urn:sha1:7c67cf6658cec70d8a43229f2ce74ca1443dc95e</id>
<content type='text'>
I've recently observed failed xHCI suspend attempt on AMD Raven Ridge
system:
kernel: xhci_hcd 0000:04:00.4: WARN: xHC CMD_RUN timeout
kernel: PM: suspend_common(): xhci_pci_suspend+0x0/0xd0 returns -110
kernel: PM: pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -110
kernel: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x150 returns -110
kernel: PM: Device 0000:04:00.4 failed to suspend async: error -110

Similar to commit ac343366846a ("xhci: Increase STS_SAVE timeout in
xhci_suspend()") we also need to increase the HALT timeout to make it be
able to suspend again.

Cc: &lt;stable@vger.kernel.org&gt; # 5.2+
Fixes: f7fac17ca925 ("xhci: Convert xhci_handshake() to use readl_poll_timeout_atomic()")
Signed-off-by: Kai-Heng Feng &lt;kai.heng.feng@canonical.com&gt;
Signed-off-by: Mathias Nyman &lt;mathias.nyman@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20191211142007.8847-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: xhci: only set D3hot for pci device</title>
<updated>2019-12-11T14:32:18+00:00</updated>
<author>
<name>Henry Lin</name>
<email>henryl@nvidia.com</email>
</author>
<published>2019-12-11T14:20:04+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=f2c710f7dca8457e88b4ac9de2060f011254f9dd'/>
<id>urn:sha1:f2c710f7dca8457e88b4ac9de2060f011254f9dd</id>
<content type='text'>
Xhci driver cannot call pci_set_power_state() on non-pci xhci host
controllers. For example, NVIDIA Tegra XHCI host controller which acts
as platform device with XHCI_SPURIOUS_WAKEUP quirk set in some platform
hits this issue during shutdown.

Cc: &lt;stable@vger.kernel.org&gt;
Fixes: 638298dc66ea ("xhci: Fix spurious wakeups after S5 on Haswell")
Signed-off-by: Henry Lin &lt;henryl@nvidia.com&gt;
Signed-off-by: Mathias Nyman &lt;mathias.nyman@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20191211142007.8847-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>xhci: fix USB3 device initiated resume race with roothub autosuspend</title>
<updated>2019-12-11T14:32:17+00:00</updated>
<author>
<name>Mathias Nyman</name>
<email>mathias.nyman@linux.intel.com</email>
</author>
<published>2019-12-11T14:20:03+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=057d476fff778f1d3b9f861fdb5437ea1a3cfc99'/>
<id>urn:sha1:057d476fff778f1d3b9f861fdb5437ea1a3cfc99</id>
<content type='text'>
A race in xhci USB3 remote wake handling may force device back to suspend
after it initiated resume siganaling, causing a missed resume event or warm
reset of device.

When a USB3 link completes resume signaling and goes to enabled (UO)
state a interrupt is issued and the interrupt handler will clear the
bus_state-&gt;port_remote_wakeup resume flag, allowing bus suspend.

If the USB3 roothub thread just finished reading port status before
the interrupt, finding ports still in suspended (U3) state, but hasn't
yet started suspending the hub, then the xhci interrupt handler will clear
the flag that prevented roothub suspend and allow bus to suspend, forcing
all port links back to suspended (U3) state.

Example case:
usb_runtime_suspend() # because all ports still show suspended U3
  usb_suspend_both()
    hub_suspend();   # successful as hub-&gt;wakeup_bits not set yet
==&gt; INTERRUPT
xhci_irq()
  handle_port_status()
    clear bus_state-&gt;port_remote_wakeup
    usb_wakeup_notification()
      sets hub-&gt;wakeup_bits;
        kick_hub_wq()
&lt;== END INTERRUPT
      hcd_bus_suspend()
        xhci_bus_suspend() # success as port_remote_wakeup bits cleared

Fix this by increasing roothub usage count during port resume to prevent
roothub autosuspend, and by making sure bus_state-&gt;port_remote_wakeup
flag is only cleared after resume completion is visible, i.e.
after xhci roothub returned U0 or other non-U3 link state link on a
get port status request.

Issue rootcaused by Chiasheng Lee

Cc: &lt;stable@vger.kernel.org&gt;
Cc: Lee, Hou-hsun &lt;hou-hsun.lee@intel.com&gt;
Reported-by: Lee, Chiasheng &lt;chiasheng.lee@intel.com&gt;
Signed-off-by: Mathias Nyman &lt;mathias.nyman@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20191211142007.8847-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>xhci: Fix memory leak in xhci_add_in_port()</title>
<updated>2019-12-11T14:32:16+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2019-12-11T14:20:02+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=ce91f1a43b37463f517155bdfbd525eb43adbd1a'/>
<id>urn:sha1:ce91f1a43b37463f517155bdfbd525eb43adbd1a</id>
<content type='text'>
When xHCI is part of Alpine or Titan Ridge Thunderbolt controller and
the xHCI device is hot-removed as a result of unplugging a dock for
example, the driver leaks memory it allocates for xhci-&gt;usb3_rhub.psi
and xhci-&gt;usb2_rhub.psi in xhci_add_in_port() as reported by kmemleak:

unreferenced object 0xffff922c24ef42f0 (size 16):
  comm "kworker/u16:2", pid 178, jiffies 4294711640 (age 956.620s)
  hex dump (first 16 bytes):
    21 00 0c 00 12 00 dc 05 23 00 e0 01 00 00 00 00  !.......#.......
  backtrace:
    [&lt;000000007ac80914&gt;] xhci_mem_init+0xcf8/0xeb7
    [&lt;0000000001b6d775&gt;] xhci_init+0x7c/0x160
    [&lt;00000000db443fe3&gt;] xhci_gen_setup+0x214/0x340
    [&lt;00000000fdffd320&gt;] xhci_pci_setup+0x48/0x110
    [&lt;00000000541e1e03&gt;] usb_add_hcd.cold+0x265/0x747
    [&lt;00000000ca47a56b&gt;] usb_hcd_pci_probe+0x219/0x3b4
    [&lt;0000000021043861&gt;] xhci_pci_probe+0x24/0x1c0
    [&lt;00000000b9231f25&gt;] local_pci_probe+0x3d/0x70
    [&lt;000000006385c9d7&gt;] pci_device_probe+0xd0/0x150
    [&lt;0000000070241068&gt;] really_probe+0xf5/0x3c0
    [&lt;0000000061f35c0a&gt;] driver_probe_device+0x58/0x100
    [&lt;000000009da11198&gt;] bus_for_each_drv+0x79/0xc0
    [&lt;000000009ce45f69&gt;] __device_attach+0xda/0x160
    [&lt;00000000df201aaf&gt;] pci_bus_add_device+0x46/0x70
    [&lt;0000000088a1bc48&gt;] pci_bus_add_devices+0x27/0x60
    [&lt;00000000ad9ee708&gt;] pci_bus_add_devices+0x52/0x60
unreferenced object 0xffff922c24ef3318 (size 8):
  comm "kworker/u16:2", pid 178, jiffies 4294711640 (age 956.620s)
  hex dump (first 8 bytes):
    34 01 05 00 35 41 0a 00                          4...5A..
  backtrace:
    [&lt;000000007ac80914&gt;] xhci_mem_init+0xcf8/0xeb7
    [&lt;0000000001b6d775&gt;] xhci_init+0x7c/0x160
    [&lt;00000000db443fe3&gt;] xhci_gen_setup+0x214/0x340
    [&lt;00000000fdffd320&gt;] xhci_pci_setup+0x48/0x110
    [&lt;00000000541e1e03&gt;] usb_add_hcd.cold+0x265/0x747
    [&lt;00000000ca47a56b&gt;] usb_hcd_pci_probe+0x219/0x3b4
    [&lt;0000000021043861&gt;] xhci_pci_probe+0x24/0x1c0
    [&lt;00000000b9231f25&gt;] local_pci_probe+0x3d/0x70
    [&lt;000000006385c9d7&gt;] pci_device_probe+0xd0/0x150
    [&lt;0000000070241068&gt;] really_probe+0xf5/0x3c0
    [&lt;0000000061f35c0a&gt;] driver_probe_device+0x58/0x100
    [&lt;000000009da11198&gt;] bus_for_each_drv+0x79/0xc0
    [&lt;000000009ce45f69&gt;] __device_attach+0xda/0x160
    [&lt;00000000df201aaf&gt;] pci_bus_add_device+0x46/0x70
    [&lt;0000000088a1bc48&gt;] pci_bus_add_devices+0x27/0x60
    [&lt;00000000ad9ee708&gt;] pci_bus_add_devices+0x52/0x60

Fix this by calling kfree() for the both psi objects in
xhci_mem_cleanup().

Cc: &lt;stable@vger.kernel.org&gt; # 4.4+
Fixes: 47189098f8be ("xhci: parse xhci protocol speed ID list for usb 3.1 usage")
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Signed-off-by: Mathias Nyman &lt;mathias.nyman@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20191211142007.8847-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'fixes-for-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus</title>
<updated>2019-12-11T14:28:37+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2019-12-11T14:28:37+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=85862213e75eec2cbc2eae8adb47f7e41918edbb'/>
<id>urn:sha1:85862213e75eec2cbc2eae8adb47f7e41918edbb</id>
<content type='text'>
Felipe writes:

USB: fixes for v5.5-rc2

Only four patches here this time around. Three of them are on dwc3
fixing some small bugs related to our 'started' flag.

None are major fixes but they're important nevertheless.

* tag 'fixes-for-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb:
  usb: gadget: fix wrong endpoint desc
  usb: dwc3: ep0: Clear started flag on completion
  usb: dwc3: gadget: Clear started flag for non-IOC
  usb: dwc3: gadget: Fix logical condition
</content>
</entry>
<entry>
<title>USB: Fix incorrect DMA allocations for local memory pool drivers</title>
<updated>2019-12-11T08:06:41+00:00</updated>
<author>
<name>Fredrik Noring</name>
<email>noring@nocrew.org</email>
</author>
<published>2019-12-10T17:29:05+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=f8c63edfd78905320e86b6b2be2b7a5ac768fa4e'/>
<id>urn:sha1:f8c63edfd78905320e86b6b2be2b7a5ac768fa4e</id>
<content type='text'>
Fix commit 7b81cb6bddd2 ("usb: add a HCD_DMA flag instead of
guestimating DMA capabilities") where local memory USB drivers
erroneously allocate DMA memory instead of pool memory, causing

	OHCI Unrecoverable Error, disabled
	HC died; cleaning up

The order between hcd_uses_dma() and hcd-&gt;localmem_pool is now
arranged as in hcd_buffer_alloc() and hcd_buffer_free(), with the
test for hcd-&gt;localmem_pool placed first.

As an alternative, one might consider adjusting hcd_uses_dma() with

 static inline bool hcd_uses_dma(struct usb_hcd *hcd)
 {
-	return IS_ENABLED(CONFIG_HAS_DMA) &amp;&amp; (hcd-&gt;driver-&gt;flags &amp; HCD_DMA);
+	return IS_ENABLED(CONFIG_HAS_DMA) &amp;&amp;
+		(hcd-&gt;driver-&gt;flags &amp; HCD_DMA) &amp;&amp;
+		(hcd-&gt;localmem_pool == NULL);
 }

One can also consider unsetting HCD_DMA for local memory pool drivers.

Fixes: 7b81cb6bddd2 ("usb: add a HCD_DMA flag instead of guestimating DMA capabilities")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Fredrik Noring &lt;noring@nocrew.org&gt;
Link: https://lore.kernel.org/r/20191210172905.GA52526@sx9
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
