<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/usb/dwc3, branch linux-5.0.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>usb: dwc3: move synchronize_irq() out of the spinlock protected block</title>
<updated>2019-05-31T13:44:54+00:00</updated>
<author>
<name>Marek Szyprowski</name>
<email>m.szyprowski@samsung.com</email>
</author>
<published>2019-03-27T09:56:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d9681887b3249f37854775bd899beacb820d4aa2'/>
<id>d9681887b3249f37854775bd899beacb820d4aa2</id>
<content type='text'>
[ Upstream commit 41a91c606e7d2b74358a944525267cc451c271e8 ]

dwc3_gadget_suspend() is called under dwc-&gt;lock spinlock. In such context
calling synchronize_irq() is not allowed. Move the problematic call out
of the protected block to fix the following kernel BUG during system
suspend:

BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake
6 locks held by rtcwake/1601:
 #0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c
 #1: b5fe1270 (&amp;of-&gt;mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4
 #2: 7e597705 (kn-&gt;count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4
 #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04
 #4: fc7f1c42 (&amp;dev-&gt;mutex){....}, at: __device_suspend+0xd8/0x74c
 #5: 4b36507e (&amp;(&amp;dwc-&gt;lock)-&gt;rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c
irq event stamp: 11252
hardirqs last  enabled at (11251): [&lt;c09c54a4&gt;] _raw_spin_unlock_irqrestore+0x6c/0x74
hardirqs last disabled at (11252): [&lt;c09c4d44&gt;] _raw_spin_lock_irqsave+0x1c/0x5c
softirqs last  enabled at (9744): [&lt;c0102564&gt;] __do_softirq+0x3a4/0x66c
softirqs last disabled at (9737): [&lt;c0128528&gt;] irq_exit+0x140/0x168
Preemption disabled at:
[&lt;00000000&gt;]   (null)
CPU: 7 PID: 1601 Comm: rtcwake Not tainted
5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[&lt;c01110f0&gt;] (unwind_backtrace) from [&lt;c010d120&gt;] (show_stack+0x10/0x14)
[&lt;c010d120&gt;] (show_stack) from [&lt;c09a4d04&gt;] (dump_stack+0x90/0xc8)
[&lt;c09a4d04&gt;] (dump_stack) from [&lt;c014c700&gt;] (___might_sleep+0x22c/0x2c8)
[&lt;c014c700&gt;] (___might_sleep) from [&lt;c0189d68&gt;] (synchronize_irq+0x28/0x84)
[&lt;c0189d68&gt;] (synchronize_irq) from [&lt;c05cbbf8&gt;] (dwc3_gadget_suspend+0x34/0x3c)
[&lt;c05cbbf8&gt;] (dwc3_gadget_suspend) from [&lt;c05bd020&gt;] (dwc3_suspend_common+0x154/0x410)
[&lt;c05bd020&gt;] (dwc3_suspend_common) from [&lt;c05bd34c&gt;] (dwc3_suspend+0x14/0x2c)
[&lt;c05bd34c&gt;] (dwc3_suspend) from [&lt;c051c730&gt;] (platform_pm_suspend+0x2c/0x54)
[&lt;c051c730&gt;] (platform_pm_suspend) from [&lt;c05285d4&gt;] (dpm_run_callback+0xa4/0x3dc)
[&lt;c05285d4&gt;] (dpm_run_callback) from [&lt;c0528a40&gt;] (__device_suspend+0x134/0x74c)
[&lt;c0528a40&gt;] (__device_suspend) from [&lt;c052c508&gt;] (dpm_suspend+0x174/0x588)
[&lt;c052c508&gt;] (dpm_suspend) from [&lt;c0182134&gt;] (suspend_devices_and_enter+0xc0/0xe74)
[&lt;c0182134&gt;] (suspend_devices_and_enter) from [&lt;c0183658&gt;] (pm_suspend+0x770/0xc04)
[&lt;c0183658&gt;] (pm_suspend) from [&lt;c0180ddc&gt;] (state_store+0x6c/0xcc)
[&lt;c0180ddc&gt;] (state_store) from [&lt;c09a9a70&gt;] (kobj_attr_store+0x14/0x20)
[&lt;c09a9a70&gt;] (kobj_attr_store) from [&lt;c02d6800&gt;] (sysfs_kf_write+0x4c/0x50)
[&lt;c02d6800&gt;] (sysfs_kf_write) from [&lt;c02d594c&gt;] (kernfs_fop_write+0xfc/0x1e4)
[&lt;c02d594c&gt;] (kernfs_fop_write) from [&lt;c02593d8&gt;] (__vfs_write+0x2c/0x160)
[&lt;c02593d8&gt;] (__vfs_write) from [&lt;c0259694&gt;] (vfs_write+0xa4/0x16c)
[&lt;c0259694&gt;] (vfs_write) from [&lt;c0259870&gt;] (ksys_write+0x40/0x8c)
[&lt;c0259870&gt;] (ksys_write) from [&lt;c0101000&gt;] (ret_fast_syscall+0x0/0x28)
Exception stack(0xed55ffa8 to 0xed55fff0)
...

Fixes: 01c10880d242 ("usb: dwc3: gadget: synchronize_irq dwc irq in suspend")
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 41a91c606e7d2b74358a944525267cc451c271e8 ]

dwc3_gadget_suspend() is called under dwc-&gt;lock spinlock. In such context
calling synchronize_irq() is not allowed. Move the problematic call out
of the protected block to fix the following kernel BUG during system
suspend:

BUG: sleeping function called from invalid context at kernel/irq/manage.c:112
in_atomic(): 1, irqs_disabled(): 128, pid: 1601, name: rtcwake
6 locks held by rtcwake/1601:
 #0: f70ac2a2 (sb_writers#7){.+.+}, at: vfs_write+0x130/0x16c
 #1: b5fe1270 (&amp;of-&gt;mutex){+.+.}, at: kernfs_fop_write+0xc0/0x1e4
 #2: 7e597705 (kn-&gt;count#60){.+.+}, at: kernfs_fop_write+0xc8/0x1e4
 #3: 8b3527d0 (system_transition_mutex){+.+.}, at: pm_suspend+0xc4/0xc04
 #4: fc7f1c42 (&amp;dev-&gt;mutex){....}, at: __device_suspend+0xd8/0x74c
 #5: 4b36507e (&amp;(&amp;dwc-&gt;lock)-&gt;rlock){....}, at: dwc3_gadget_suspend+0x24/0x3c
irq event stamp: 11252
hardirqs last  enabled at (11251): [&lt;c09c54a4&gt;] _raw_spin_unlock_irqrestore+0x6c/0x74
hardirqs last disabled at (11252): [&lt;c09c4d44&gt;] _raw_spin_lock_irqsave+0x1c/0x5c
softirqs last  enabled at (9744): [&lt;c0102564&gt;] __do_softirq+0x3a4/0x66c
softirqs last disabled at (9737): [&lt;c0128528&gt;] irq_exit+0x140/0x168
Preemption disabled at:
[&lt;00000000&gt;]   (null)
CPU: 7 PID: 1601 Comm: rtcwake Not tainted
5.0.0-rc3-next-20190122-00039-ga3f4ee4f8a52 #5252
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[&lt;c01110f0&gt;] (unwind_backtrace) from [&lt;c010d120&gt;] (show_stack+0x10/0x14)
[&lt;c010d120&gt;] (show_stack) from [&lt;c09a4d04&gt;] (dump_stack+0x90/0xc8)
[&lt;c09a4d04&gt;] (dump_stack) from [&lt;c014c700&gt;] (___might_sleep+0x22c/0x2c8)
[&lt;c014c700&gt;] (___might_sleep) from [&lt;c0189d68&gt;] (synchronize_irq+0x28/0x84)
[&lt;c0189d68&gt;] (synchronize_irq) from [&lt;c05cbbf8&gt;] (dwc3_gadget_suspend+0x34/0x3c)
[&lt;c05cbbf8&gt;] (dwc3_gadget_suspend) from [&lt;c05bd020&gt;] (dwc3_suspend_common+0x154/0x410)
[&lt;c05bd020&gt;] (dwc3_suspend_common) from [&lt;c05bd34c&gt;] (dwc3_suspend+0x14/0x2c)
[&lt;c05bd34c&gt;] (dwc3_suspend) from [&lt;c051c730&gt;] (platform_pm_suspend+0x2c/0x54)
[&lt;c051c730&gt;] (platform_pm_suspend) from [&lt;c05285d4&gt;] (dpm_run_callback+0xa4/0x3dc)
[&lt;c05285d4&gt;] (dpm_run_callback) from [&lt;c0528a40&gt;] (__device_suspend+0x134/0x74c)
[&lt;c0528a40&gt;] (__device_suspend) from [&lt;c052c508&gt;] (dpm_suspend+0x174/0x588)
[&lt;c052c508&gt;] (dpm_suspend) from [&lt;c0182134&gt;] (suspend_devices_and_enter+0xc0/0xe74)
[&lt;c0182134&gt;] (suspend_devices_and_enter) from [&lt;c0183658&gt;] (pm_suspend+0x770/0xc04)
[&lt;c0183658&gt;] (pm_suspend) from [&lt;c0180ddc&gt;] (state_store+0x6c/0xcc)
[&lt;c0180ddc&gt;] (state_store) from [&lt;c09a9a70&gt;] (kobj_attr_store+0x14/0x20)
[&lt;c09a9a70&gt;] (kobj_attr_store) from [&lt;c02d6800&gt;] (sysfs_kf_write+0x4c/0x50)
[&lt;c02d6800&gt;] (sysfs_kf_write) from [&lt;c02d594c&gt;] (kernfs_fop_write+0xfc/0x1e4)
[&lt;c02d594c&gt;] (kernfs_fop_write) from [&lt;c02593d8&gt;] (__vfs_write+0x2c/0x160)
[&lt;c02593d8&gt;] (__vfs_write) from [&lt;c0259694&gt;] (vfs_write+0xa4/0x16c)
[&lt;c0259694&gt;] (vfs_write) from [&lt;c0259870&gt;] (ksys_write+0x40/0x8c)
[&lt;c0259870&gt;] (ksys_write) from [&lt;c0101000&gt;] (ret_fast_syscall+0x0/0x28)
Exception stack(0xed55ffa8 to 0xed55fff0)
...

Fixes: 01c10880d242 ("usb: dwc3: gadget: synchronize_irq dwc irq in suspend")
Signed-off-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: Fix default lpm_nyet_threshold value</title>
<updated>2019-05-10T16:36:12+00:00</updated>
<author>
<name>Thinh Nguyen</name>
<email>Thinh.Nguyen@synopsys.com</email>
</author>
<published>2019-04-25T20:55:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=083a8f69962a27ad381658a16d5f2f279e51e554'/>
<id>083a8f69962a27ad381658a16d5f2f279e51e554</id>
<content type='text'>
commit 8d791929b2fbdf7734c1596d808e55cb457f4562 upstream.

The max possible value for DCTL.LPM_NYET_THRES is 15 and not 255. Change
the default value to 15.

Cc: stable@vger.kernel.org
Fixes: 80caf7d21adc ("usb: dwc3: add lpm erratum support")
Signed-off-by: Thinh Nguyen &lt;thinhn@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 8d791929b2fbdf7734c1596d808e55cb457f4562 upstream.

The max possible value for DCTL.LPM_NYET_THRES is 15 and not 255. Change
the default value to 15.

Cc: stable@vger.kernel.org
Fixes: 80caf7d21adc ("usb: dwc3: add lpm erratum support")
Signed-off-by: Thinh Nguyen &lt;thinhn@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: Allow building USB_DWC3_QCOM without EXTCON</title>
<updated>2019-05-10T16:36:12+00:00</updated>
<author>
<name>Marc Gonzalez</name>
<email>marc.w.gonzalez@free.fr</email>
</author>
<published>2019-04-24T15:00:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9092861ce665d19f1f2a9fc435f420bc9cf74b17'/>
<id>9092861ce665d19f1f2a9fc435f420bc9cf74b17</id>
<content type='text'>
commit 77a4946516fe488b6a33390de6d749f934a243ba upstream.

Keep EXTCON support optional, as some platforms do not need it.

Do the same for USB_DWC3_OMAP while we're at it.

Fixes: 3def4031b3e3f ("usb: dwc3: add EXTCON dependency for qcom")
Signed-off-by: Marc Gonzalez &lt;marc.w.gonzalez@free.fr&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 77a4946516fe488b6a33390de6d749f934a243ba upstream.

Keep EXTCON support optional, as some platforms do not need it.

Do the same for USB_DWC3_OMAP while we're at it.

Fixes: 3def4031b3e3f ("usb: dwc3: add EXTCON dependency for qcom")
Signed-off-by: Marc Gonzalez &lt;marc.w.gonzalez@free.fr&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: Reset num_trbs after skipping</title>
<updated>2019-05-08T05:22:55+00:00</updated>
<author>
<name>Thinh Nguyen</name>
<email>thinh.nguyen@synopsys.com</email>
</author>
<published>2019-02-13T03:39:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=08b450e6826c27e4c6cc7cf158ff9f930182711c'/>
<id>08b450e6826c27e4c6cc7cf158ff9f930182711c</id>
<content type='text'>
commit c7152763f02e05567da27462b2277a554e507c89 upstream.

Currently req-&gt;num_trbs is not reset after the TRBs are skipped and
processed from the cancelled list. The gadget driver may reuse the
request with an invalid req-&gt;num_trbs, and DWC3 will incorrectly skip
trbs. To fix this, simply reset req-&gt;num_trbs to 0 after skipping
through all of them.

Fixes: c3acd5901414 ("usb: dwc3: gadget: use num_trbs when skipping TRBs on -&gt;dequeue()")
Signed-off-by: Thinh Nguyen &lt;thinhn@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit c7152763f02e05567da27462b2277a554e507c89 upstream.

Currently req-&gt;num_trbs is not reset after the TRBs are skipped and
processed from the cancelled list. The gadget driver may reuse the
request with an invalid req-&gt;num_trbs, and DWC3 will incorrectly skip
trbs. To fix this, simply reset req-&gt;num_trbs to 0 after skipping
through all of them.

Fixes: c3acd5901414 ("usb: dwc3: gadget: use num_trbs when skipping TRBs on -&gt;dequeue()")
Signed-off-by: Thinh Nguyen &lt;thinhn@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: pci: add support for Comet Lake PCH ID</title>
<updated>2019-05-04T07:21:15+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>felipe.balbi@linux.intel.com</email>
</author>
<published>2019-01-31T09:04:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e5a7f0905664cb60d1acc1081102374c298379df'/>
<id>e5a7f0905664cb60d1acc1081102374c298379df</id>
<content type='text'>
[ Upstream commit 7ae622c978db6b2e28b4fced6ecd2a174492059d ]

This patch simply adds a new PCI Device ID

Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin (Microsoft) &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 7ae622c978db6b2e28b4fced6ecd2a174492059d ]

This patch simply adds a new PCI Device ID

Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin (Microsoft) &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded</title>
<updated>2019-04-05T20:34:47+00:00</updated>
<author>
<name>Roger Quadros</name>
<email>rogerq@ti.com</email>
</author>
<published>2019-01-10T15:04:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3ea0a48aa0809fe64b6004383cc669200d3c1a4b'/>
<id>3ea0a48aa0809fe64b6004383cc669200d3c1a4b</id>
<content type='text'>
[ Upstream commit 169e3b68cadb5775daca009ced4faf01ffd97dcf ]

On v3.10a in dual-role mode, if port is in device mode
and gadget driver isn't loaded, the OTG event interrupts don't
come through.

It seems that if the core is configured to be OTG2.0 only,
then we can't leave the DCFG.DEVSPD at Super-speed (default)
if we expect OTG to work properly. It must be set to High-speed.

Fix this issue by configuring DCFG.DEVSPD to the supported
maximum speed at gadget init. Device tree still needs to provide
correct supported maximum speed for this to work.

This issue wasn't present on v2.40a but is seen on v3.10a.
It doesn't cause any side effects on v2.40a.

Signed-off-by: Roger Quadros &lt;rogerq@ti.com&gt;
Signed-off-by: Sekhar Nori &lt;nsekhar@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 169e3b68cadb5775daca009ced4faf01ffd97dcf ]

On v3.10a in dual-role mode, if port is in device mode
and gadget driver isn't loaded, the OTG event interrupts don't
come through.

It seems that if the core is configured to be OTG2.0 only,
then we can't leave the DCFG.DEVSPD at Super-speed (default)
if we expect OTG to work properly. It must be set to High-speed.

Fix this issue by configuring DCFG.DEVSPD to the supported
maximum speed at gadget init. Device tree still needs to provide
correct supported maximum speed for this to work.

This issue wasn't present on v2.40a but is seen on v3.10a.
It doesn't cause any side effects on v2.40a.

Signed-off-by: Roger Quadros &lt;rogerq@ti.com&gt;
Signed-off-by: Sekhar Nori &lt;nsekhar@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: exynos: Fix error handling of clk_prepare_enable</title>
<updated>2019-01-28T13:31:11+00:00</updated>
<author>
<name>Alexey Khoroshilov</name>
<email>khoroshilov@ispras.ru</email>
</author>
<published>2019-01-21T21:23:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=512e6fb589bc18f9321457632e89b95017447db9'/>
<id>512e6fb589bc18f9321457632e89b95017447db9</id>
<content type='text'>
If clk_prepare_enable() fails in dwc3_exynos_probe() or in
dwc3_exynos_resume(), exynos-&gt;clks[0] is left undisabled
because of usage preincrement in while condition.

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 9f2168367a0a ("usb: dwc3: exynos: Rework clock handling and prepare for new variants")
Acked-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Alexey Khoroshilov &lt;khoroshilov@ispras.ru&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If clk_prepare_enable() fails in dwc3_exynos_probe() or in
dwc3_exynos_resume(), exynos-&gt;clks[0] is left undisabled
because of usage preincrement in while condition.

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 9f2168367a0a ("usb: dwc3: exynos: Rework clock handling and prepare for new variants")
Acked-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Alexey Khoroshilov &lt;khoroshilov@ispras.ru&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: gadget: Handle 0 xfer length for OUT EP</title>
<updated>2019-01-28T13:27:07+00:00</updated>
<author>
<name>Tejas Joglekar</name>
<email>tejas.joglekar@synopsys.com</email>
</author>
<published>2019-01-22T07:56:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1e19cdc8060227b0802bda6bc0bd22b23679ba32'/>
<id>1e19cdc8060227b0802bda6bc0bd22b23679ba32</id>
<content type='text'>
For OUT endpoints, zero-length transfers require MaxPacketSize buffer as
per the DWC_usb3 programming guide 3.30a section 4.2.3.3.

This patch fixes this by explicitly checking zero length
transfer to correctly pad up to MaxPacketSize.

Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
Cc: stable@vger.kernel.org

Signed-off-by: Tejas Joglekar &lt;joglekar@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For OUT endpoints, zero-length transfers require MaxPacketSize buffer as
per the DWC_usb3 programming guide 3.30a section 4.2.3.3.

This patch fixes this by explicitly checking zero length
transfer to correctly pad up to MaxPacketSize.

Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
Cc: stable@vger.kernel.org

Signed-off-by: Tejas Joglekar &lt;joglekar@synopsys.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: gadget: Fix the uninitialized link_state when udc starts</title>
<updated>2019-01-14T08:29:55+00:00</updated>
<author>
<name>Zeng Tao</name>
<email>prime.zeng@hisilicon.com</email>
</author>
<published>2018-12-26T11:22:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=88b1bb1f3b88e0bf20b05d543a53a5b99bd7ceb6'/>
<id>88b1bb1f3b88e0bf20b05d543a53a5b99bd7ceb6</id>
<content type='text'>
Currently the link_state is uninitialized and the default value is 0(U0)
before the first time we start the udc, and after we start the udc then
 stop the udc, the link_state will be undefined.
We may have the following warnings if we start the udc again with
an undefined link_state:

WARNING: CPU: 0 PID: 327 at drivers/usb/dwc3/gadget.c:294 dwc3_send_gadget_ep_cmd+0x304/0x308
dwc3 100e0000.hidwc3_0: wakeup failed --&gt; -22
[...]
Call Trace:
[&lt;c010f270&gt;] (unwind_backtrace) from [&lt;c010b3d8&gt;] (show_stack+0x10/0x14)
[&lt;c010b3d8&gt;] (show_stack) from [&lt;c034a4dc&gt;] (dump_stack+0x84/0x98)
[&lt;c034a4dc&gt;] (dump_stack) from [&lt;c0118000&gt;] (__warn+0xe8/0x100)
[&lt;c0118000&gt;] (__warn) from [&lt;c0118050&gt;](warn_slowpath_fmt+0x38/0x48)
[&lt;c0118050&gt;] (warn_slowpath_fmt) from [&lt;c0442ec0&gt;](dwc3_send_gadget_ep_cmd+0x304/0x308)
[&lt;c0442ec0&gt;] (dwc3_send_gadget_ep_cmd) from [&lt;c0445e68&gt;](dwc3_ep0_start_trans+0x48/0xf4)
[&lt;c0445e68&gt;] (dwc3_ep0_start_trans) from [&lt;c0446750&gt;](dwc3_ep0_out_start+0x64/0x80)
[&lt;c0446750&gt;] (dwc3_ep0_out_start) from [&lt;c04451c0&gt;](__dwc3_gadget_start+0x1e0/0x278)
[&lt;c04451c0&gt;] (__dwc3_gadget_start) from [&lt;c04452e0&gt;](dwc3_gadget_start+0x88/0x10c)
[&lt;c04452e0&gt;] (dwc3_gadget_start) from [&lt;c045ee54&gt;](udc_bind_to_driver+0x88/0xbc)
[&lt;c045ee54&gt;] (udc_bind_to_driver) from [&lt;c045f29c&gt;](usb_gadget_probe_driver+0xf8/0x140)
[&lt;c045f29c&gt;] (usb_gadget_probe_driver) from [&lt;bf005424&gt;](gadget_dev_desc_UDC_store+0xac/0xc4 [libcomposite])
[&lt;bf005424&gt;] (gadget_dev_desc_UDC_store [libcomposite]) from[&lt;c023d8e0&gt;] (configfs_write_file+0xd4/0x160)
[&lt;c023d8e0&gt;] (configfs_write_file) from [&lt;c01d51e8&gt;] (__vfs_write+0x1c/0x114)
[&lt;c01d51e8&gt;] (__vfs_write) from [&lt;c01d5ff4&gt;] (vfs_write+0xa4/0x168)
[&lt;c01d5ff4&gt;] (vfs_write) from [&lt;c01d6d40&gt;] (SyS_write+0x3c/0x90)
[&lt;c01d6d40&gt;] (SyS_write) from [&lt;c0107400&gt;] (ret_fast_syscall+0x0/0x3c)

Signed-off-by: Zeng Tao &lt;prime.zeng@hisilicon.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the link_state is uninitialized and the default value is 0(U0)
before the first time we start the udc, and after we start the udc then
 stop the udc, the link_state will be undefined.
We may have the following warnings if we start the udc again with
an undefined link_state:

WARNING: CPU: 0 PID: 327 at drivers/usb/dwc3/gadget.c:294 dwc3_send_gadget_ep_cmd+0x304/0x308
dwc3 100e0000.hidwc3_0: wakeup failed --&gt; -22
[...]
Call Trace:
[&lt;c010f270&gt;] (unwind_backtrace) from [&lt;c010b3d8&gt;] (show_stack+0x10/0x14)
[&lt;c010b3d8&gt;] (show_stack) from [&lt;c034a4dc&gt;] (dump_stack+0x84/0x98)
[&lt;c034a4dc&gt;] (dump_stack) from [&lt;c0118000&gt;] (__warn+0xe8/0x100)
[&lt;c0118000&gt;] (__warn) from [&lt;c0118050&gt;](warn_slowpath_fmt+0x38/0x48)
[&lt;c0118050&gt;] (warn_slowpath_fmt) from [&lt;c0442ec0&gt;](dwc3_send_gadget_ep_cmd+0x304/0x308)
[&lt;c0442ec0&gt;] (dwc3_send_gadget_ep_cmd) from [&lt;c0445e68&gt;](dwc3_ep0_start_trans+0x48/0xf4)
[&lt;c0445e68&gt;] (dwc3_ep0_start_trans) from [&lt;c0446750&gt;](dwc3_ep0_out_start+0x64/0x80)
[&lt;c0446750&gt;] (dwc3_ep0_out_start) from [&lt;c04451c0&gt;](__dwc3_gadget_start+0x1e0/0x278)
[&lt;c04451c0&gt;] (__dwc3_gadget_start) from [&lt;c04452e0&gt;](dwc3_gadget_start+0x88/0x10c)
[&lt;c04452e0&gt;] (dwc3_gadget_start) from [&lt;c045ee54&gt;](udc_bind_to_driver+0x88/0xbc)
[&lt;c045ee54&gt;] (udc_bind_to_driver) from [&lt;c045f29c&gt;](usb_gadget_probe_driver+0xf8/0x140)
[&lt;c045f29c&gt;] (usb_gadget_probe_driver) from [&lt;bf005424&gt;](gadget_dev_desc_UDC_store+0xac/0xc4 [libcomposite])
[&lt;bf005424&gt;] (gadget_dev_desc_UDC_store [libcomposite]) from[&lt;c023d8e0&gt;] (configfs_write_file+0xd4/0x160)
[&lt;c023d8e0&gt;] (configfs_write_file) from [&lt;c01d51e8&gt;] (__vfs_write+0x1c/0x114)
[&lt;c01d51e8&gt;] (__vfs_write) from [&lt;c01d5ff4&gt;] (vfs_write+0xa4/0x168)
[&lt;c01d5ff4&gt;] (vfs_write) from [&lt;c01d6d40&gt;] (SyS_write+0x3c/0x90)
[&lt;c01d6d40&gt;] (SyS_write) from [&lt;c0107400&gt;] (ret_fast_syscall+0x0/0x3c)

Signed-off-by: Zeng Tao &lt;prime.zeng@hisilicon.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>usb: dwc3: gadget: Clear req-&gt;needs_extra_trb flag on cleanup</title>
<updated>2019-01-14T08:29:55+00:00</updated>
<author>
<name>Jack Pham</name>
<email>jackp@codeaurora.org</email>
</author>
<published>2019-01-10T20:39:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=bd6742249b9ca918565e4e3abaa06665e587f4b5'/>
<id>bd6742249b9ca918565e4e3abaa06665e587f4b5</id>
<content type='text'>
OUT endpoint requests may somtimes have this flag set when
preparing to be submitted to HW indicating that there is an
additional TRB chained to the request for alignment purposes.
If that request is removed before the controller can execute the
transfer (e.g. ep_dequeue/ep_disable), the request will not go
through the dwc3_gadget_ep_cleanup_completed_request() handler
and will not have its needs_extra_trb flag cleared when
dwc3_gadget_giveback() is called.  This same request could be
later requeued for a new transfer that does not require an
extra TRB and if it is successfully completed, the cleanup
and TRB reclamation will incorrectly process the additional TRB
which belongs to the next request, and incorrectly advances the
TRB dequeue pointer, thereby messing up calculation of the next
requeust's actual/remaining count when it completes.

The right thing to do here is to ensure that the flag is cleared
before it is given back to the function driver.  A good place
to do that is in dwc3_gadget_del_and_unmap_request().

Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
Cc: stable@vger.kernel.org
Signed-off-by: Jack Pham &lt;jackp@codeaurora.org&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
OUT endpoint requests may somtimes have this flag set when
preparing to be submitted to HW indicating that there is an
additional TRB chained to the request for alignment purposes.
If that request is removed before the controller can execute the
transfer (e.g. ep_dequeue/ep_disable), the request will not go
through the dwc3_gadget_ep_cleanup_completed_request() handler
and will not have its needs_extra_trb flag cleared when
dwc3_gadget_giveback() is called.  This same request could be
later requeued for a new transfer that does not require an
extra TRB and if it is successfully completed, the cleanup
and TRB reclamation will incorrectly process the additional TRB
which belongs to the next request, and incorrectly advances the
TRB dequeue pointer, thereby messing up calculation of the next
requeust's actual/remaining count when it completes.

The right thing to do here is to ensure that the flag is cleared
before it is given back to the function driver.  A good place
to do that is in dwc3_gadget_del_and_unmap_request().

Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
Cc: stable@vger.kernel.org
Signed-off-by: Jack Pham &lt;jackp@codeaurora.org&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
