1
0
Fork 0

MLK-18609-2 usb: cdns3: gadget: flush fifo only controller is started

Some gadget drivers may dequeue its request very late, eg, after
the controller is stopped, at this situation, visiting related
register will cause abort. See below oops from android use case:

[ 1676.773258] android_work: sent uevent USB_STATE=CONFIGURED
[ 1676.788278] mtp_open
[ 1850.542145] android_work: sent uevent USB_STATE=DISCONNECTED
[ 1850.545311] mtp_release
[ 1852.050358] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (init.freescale.usb.rc:45)
[ 1852.061224] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (/init.usb.configfs.rc:1)
[ 1852.074316] android_work: did not send uevent (0 0           (null))
[ 1852.080893] Unhandled fault: synchronous external abort (0x96000210) at 0xffff000016a90028
[ 1852.089186] Internal error: : 96000210 [#1] PREEMPT SMP
[ 1852.094422] Modules linked in:
[ 1852.097491] CPU: 0 PID: 1 Comm: init Not tainted 4.9.105-00010-g30f2a53-dirty #4
[ 1852.104889] Hardware name: Freescale i.MX8QXP MEK (DT)
[ 1852.110031] task: ffff80083a0e0000 task.stack: ffff80083a0e8000
[ 1852.115966] PC is at wait_reg_bit.constprop.13+0x24/0xb4
[ 1852.121286] LR is at usb_ss_gadget_ep_dequeue+0x110/0x164
[ 1852.126685] pc : [<ffff00000894c2d0>] lr : [<ffff00000894ccf4>] pstate: a00001c5
[ 1852.134085] sp : ffff80083a0ebc30
[ 1852.137395] x29: ffff80083a0ebc30 x28: ffff80083a0e0000
[ 1852.142720] x27: ffff000008ec3000 x26: 0000000000000000
[ 1852.148046] x25: ffff80083a0ebeb0 x24: ffff80083b751000
[ 1852.153371] x23: 0000000000000080 x22: 0000000000000000
[ 1852.158696] x21: ffff000016a90028 x20: ffff80083b6e7e18
[ 1852.164022] x19: ffff8000507fb580 x18: 000000000042d1e0
[ 1852.169348] x17: aaaaaaaaaaaaaaab x16: ffff0000082678fc
[ 1852.174673] x15: ffffffffffffffff x14: 2020202020202020
[ 1852.179998] x13: 2020203020302820 x12: 746e657665752064
[ 1852.185324] x11: ffff80083ff2ee40 x10: ffff80083b708870
[ 1852.190649] x9 : 0000000040000000 x8 : 0000000000210d00
[ 1852.195974] x7 : 0000000000000005 x6 : ffff80083b708871
[ 1852.201300] x5 : ffff00000894c084 x4 : 0000000000000000
[ 1852.206627] x3 : 0000000000000000 x2 : 0000000000000080
[ 1852.211951] x1 : ffff000016a90028 x0 : ffff80083b751000
[ 1852.217278]
[ 1852.217278] SP: 0xffff80083a0ebbb0:
[ 1852.222245] bbb0  00000000 00000000 00000080 00000000 3b751000 ffff8008 3a0ebeb0 ffff8008
[ 1852.230498] bbd0  00000000 00000000 08ec3000 ffff0000 3a0e0000 ffff8008 3a0ebc30 ffff8008
[ 1852.238751] bbf0  0894ccf4 ffff0000 3a0ebc30 ffff8008 0894c2d0 ffff0000 a00001c5 00000000
[ 1852.247004] bc10  3a0ebeb0 ffff8008 3b6e6418 ffff8008 ffffffff 0000ffff 80080007 00000001
[ 1852.255257] bc30  3a0ebc70 ffff8008 0894ccf4 ffff0000 507fb580 ffff8000 3b6e7e18 ffff8008
[ 1852.263510] bc50  00000000 00000000 00000140 00000000 3b7517d0 ffff8008 3b751000 ffff8008
[ 1852.271764] bc70  3a0ebcb0 ffff8008 0898ef58 ffff0000 3b537490 ffff8008 09a4a5a8 ffff0000
[ 1852.280017] bc90  3b6e7e18 ffff8008 507fb580 ffff8000 00000004 00000000 aee44671 0000ffff
[ 1852.288272]
[ 1852.288272] X0: 0xffff80083b750f80:
[ 1852.293240] 0f80  6cfdc6bf fee6fc67 76effaff d777e7fe 5ff67667 e7eef7ff 7fff75fc 6f7d7fff
[ 1852.301492] 0fa0  7d7ef6f6 f23feefb 7ffff7ee f7de7e72 eeb47f7e 4bff73f4 fe367677 3ef573ed
[ 1852.309745] 0fc0  674eb7e7 76f94767 f6ff66e7 eabe66ee fef663df fe7764e7 66ee2e64 febf7bcc
[ 1852.317998] 0fe0  ef7f35ff f7ef6f6c 4cded7ee 76fffb77 f7f3765d ff8f7efb e5ee6ce7 bfe5e7ff
[ 1852.326252] 1000  3a657c10 ffff8008 3b6e7f00 ffff8008 09341970 ffff0000 3b751388 ffff8008
[ 1852.334505] 1020  3a657c28 ffff8008 3a657c20 ffff8008 3a1b8000 ffff8008 098f9d10 ffff0000
[ 1852.342758] 1040  3b70b5a0 ffff8008 00000006 00000003 00000000 00000000 00000000 00000000
[ 1852.351011] 1060  00000001 00000000 3b751068 ffff8008 3b751068 ffff8008 00000000 00000000
[ 1852.359268]
[ 1852.359268] X6: 0xffff80083b7087f1:
[ 1852.364234] 87f0  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[ 1852.372487] 8810  3b708810 ffff8008 3b708810 ffff8008 00000000 00000000 00000000 00000000
[ 1852.380740] 8830  01ea01ea 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.388993] 8850  3b708850 ffff8008 3b708850 ffff8008 00000004 00000003 00000002 00000000
[ 1852.397246] 8870  00000001 00010001 00000000 00000000 00320032 00000000 3b708888 ffff8008
[ 1852.405499] 8890  3b708888 ffff8008 00000001 00000000 00000000 00000000 3bd5e300 ffff8008
[ 1852.413752] 88b0  34157200 ffff8008 35173c00 ffff8008 35173c1c ffff8008 00000074 00000003
[ 1852.422005] 88d0  00000003 00000005 00000001 00000000 00000000 00000000 3b76e5b0 ffff8008
[ 1852.430258] 88f0  3b76e5b0 ffff8008 3b76e5b0 ffff8008 0000000f 00820100 00000000 00000000
[ 1852.438514]
[ 1852.438514] X10: 0xffff80083b7087f0:
[ 1852.443570] 87f0  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[ 1852.451821] 8810  3b708810 ffff8008 3b708810 ffff8008 00000000 00000000 00000000 00000000
[ 1852.460074] 8830  01ea01ea 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.468327] 8850  3b708850 ffff8008 3b708850 ffff8008 00000004 00000003 00000002 00000000
[ 1852.476580] 8870  00000001 00010001 00000000 00000000 00320032 00000000 3b708888 ffff8008
[ 1852.484833] 8890  3b708888 ffff8008 00000001 00000000 00000000 00000000 3bd5e300 ffff8008
[ 1852.493086] 88b0  34157200 ffff8008 35173c00 ffff8008 35173c1c ffff8008 00000074 00000003
[ 1852.501340] 88d0  00000003 00000005 00000001 00000000 00000000 00000000 3b76e5b0 ffff8008
[ 1852.509595]
[ 1852.509595] X11: 0xffff80083ff2edc0:
[ 1852.514649] edc0  00000000 00000000 00100000 00000000 00000000 00000000 0003b33d 00000000
[ 1852.522902] ede0  000be6cc 00000000 00100000 00000000 00000000 00000000 00000001 00000001
[ 1852.531155] ee00  00000000 00000000 caabd6a1 0000000c 00000000 00000000 00000000 00000000
[ 1852.539408] ee20  3a0e0080 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.547661] ee40  392570e9 000001af 0239e900 00000000 0185fbb6 00000295 000002f9 00000000
[ 1852.555914] ee60  00000211 00000000 0182c397 00000000 0000020d 00000000 00000000 00000000
[ 1852.564167] ee80  00000001 00000000 00000052 00000000 0000001c 00000000 000002f9 00000000
[ 1852.572421] eea0  0005eb9a 00000001 00000000 00000000 3ff2ed80 ffff8008 00000001 00000000
[ 1852.580679]
[ 1852.580679] X19: 0xffff8000507fb500:
[ 1852.585730] b500  00000001 00000000 0994b2b0 ffff0000 00000000 00000000 00000000 00000000
[ 1852.593983] b520  507fb520 ffff8000 507fb520 ffff8000 507fb560 ffff8000 00000002 00000000
[ 1852.602236] b540  00002441 00000000 00000001 00000000 d54b3f06 00000175 00000000 00000000
[ 1852.610489] b560  00010001 00000000 3b413200 ffff8008 0000c4f8 00000000 00000000 00000000
[ 1852.618742] b580  3b76d800 ffff8008 00000000 00000000 fe5db800 00000000 00000000 00000000
[ 1852.626995] b5a0  00000000 00000000 00000000 00000000 08989814 ffff0000 3b537430 ffff8008
[ 1852.635249] b5c0  00000000 00000000 00000000 00000000 ffffff98 00000022 00000000 00000000
[ 1852.643502] b5e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.651758]
[ 1852.651758] X20: 0xffff80083b6e7d98:
[ 1852.656812] 7d98  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.665064] 7db8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.673317] 7dd8  00000000 00000000 00000000 00000000 00000000 00000000 316e6163 00000000
[ 1852.681570] 7df8  00000000 00000000 3b6e7b00 ffff8008 3b7512a8 ffff8008 0874a428 ffff0000
[ 1852.689823] 7e18  3b537430 ffff8008 3b6e7e98 ffff8008 08fe1788 ffff0000 00000000 00000000
[ 1852.698077] 7e38  00000000 00000000 00000031 02000100 00000200 00000004 09917320 ffff0000
[ 1852.706330] 7e58  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.714583] 7e78  00000000 00000000 00000000 00000000 00000000 00000000 3b751000 ffff8008
[ 1852.722839]
[ 1852.722839] X24: 0xffff80083b750f80:
[ 1852.727892] 0f80  6cfdc6bf fee6fc67 76effaff d777e7fe 5ff67667 e7eef7ff 7fff75fc 6f7d7fff
[ 1852.736147] 0fa0  7d7ef6f6 f23feefb 7ffff7ee f7de7e72 eeb47f7e 4bff73f4 fe367677 3ef573ed
[ 1852.744398] 0fc0  674eb7e7 76f94767 f6ff66e7 eabe66ee fef663df fe7764e7 66ee2e64 febf7bcc
[ 1852.752652] 0fe0  ef7f35ff f7ef6f6c 4cded7ee 76fffb77 f7f3765d ff8f7efb e5ee6ce7 bfe5e7ff
[ 1852.760905] 1000  3a657c10 ffff8008 3b6e7f00 ffff8008 09341970 ffff0000 3b751388 ffff8008
[ 1852.769158] 1020  3a657c28 ffff8008 3a657c20 ffff8008 3a1b8000 ffff8008 098f9d10 ffff0000
[ 1852.777411] 1040  3b70b5a0 ffff8008 00000006 00000003 00000000 000 00000000 00000000 00000000
[ 1852.919573] 0040  00000001 00000000 00000034 00000000 0005eb90 00000001 3a905400 ffff8008
52.949389] bbd0  00000000 00000000 08ec3000 ffff0000 3a0e0000 ffff8008 3a0ebc30 ffff8008
[ 1852.957642] bbf0  0894ccf4 ffff3b6e7e18 ffff8008
[ 1852.982401] bc50  00000000 00000000 00000140 00000000 3b7517d0 ffff8008 3b751000 ffff8008
[ 1852.990600140
[ 1853.036348] bc60: ffff80083b7517d0 ffff80083b751000 ffff80083a0ebcb0 ffff00000898ef58
[ 1853.044183] bc80: ffff80083b537490 ffff000009a4a5a8 ffff80083b6e7e18 ffff8000507fb580
[ 1853.052019] bca0: 0000000000000004 0000ffffaee44671 ffff80083a0ebce0 ffff00000898b4f0
[ 1853.059855] bcc0: ffff80083b537490 ffff000009a4a5a8 ffff80083b537490 ffff80083b537430
[ 1853.067691] bce0: ffff80083a0ebd10 ffff00000898d280 ffff80083b537430 ffff000009a4a5a8
[ 1853.075528] bd00: ffff80083b751310 ffff00000991e000 ffff80083a0ebd40 ffff000008990b10
[ 1853.083364] bd20: ffff80083b6fa000 ffff00000991ea48 ffff80083b537350 ffff00000991ea48
[ 1853.091200] bd40: ffff80083a0ebd60 ffff000008990c00 ffff80083b6fa000 ffff00000898e86c
[ 1853.099036] bd60: ffff80083a0ebd90 ffff00000898e8bc ffff800066af6f80 ffff80083b537000
[ 1853.106872] bd80: 0000000000000000 ffff80083b5372a8 ffff80083a0ebdd0 ffff0000082db924
[ 1853.114708] bda0: 0000000000000004 ffff800066af6d80 0000000000000000 ffff800066af6da0
[ 1853.122544] bdc0: ffff8000674aeb00 0000000000000004 ffff80083a0ebe30 ffff0000082507c8
[ 1853.130382] bde0: 0000000000000004 ffff8000674aeb00 0000000000000000 ffff80083a0ebeb0
[ 1853.138216] be00: 0000ffffaee44671 0000000000000015 0000000000000123 0000000000000040
[ 1853.146052] be20: 0000000000000004 0000000000000004 ffff80083a0ebe70 ffff000008251c7c
[ 1853.153889] be40: ffff8000674aeb00 ffff8000674aeb00 ffff000009838000 00000000004ec908
[ 1853.161724] be60: 0000000040000000 0000800836a09000 0000000000000000 ffff000008083780
[ 1853.169561] be80: ffffffffffffff1d 0000800836a09000 ffffffffffffffff 00000000004ec908
[ 1853.177396] bea0: 0000ffffaee44671 0000000000000004 0000000000000000 0000000000040969
[ 1853.185233] bec0: 0000000000000009 0000ffffaee44671 0000000000000004 0000000000000180
[ 1853.193069] bee0: 0000000000000000 0000000000000000 655e666d68736860 7f7f7f7f7f7f7f7f
[ 1853.200905] bf00: 0000000000000040 0000000000000000 0000000000000004 0000ffffffa57620
[ 1853.208742] bf20: 0000ffffffa575d8 4344552f31672f74 0000000000000000 000000000000005c
[ 1853.216577] bf40: 0000000000000000 000000000000000d 0000000052841d82 0000000000000004
[ 1853.224416] bf60: 0000000000000009 0000ffffaee44671 0000ffffaee44670 0000000000088241
[ 1853.232250] bf80: 000000000057da40 0000ffffaee44659 0000000000000001 00000000ffffffff
[ 1853.240086] bfa0: 00000000ffffffff 0000ffffffa57610 0000000000454a30 0000ffffffa575f0
[ 1853.247922] bfc0: 00000000004ec908 0000000040000000 0000000000000009 0000000000000040
[ 1853.255758] bfe0: 0000000000000000 0000000000000000 a62044020608c465 1224422020842444
[ 1853.263592] Call trace:
[ 1853.266035] Exception stack(0xffff80083a0eba40 to 0xffff80083a0ebb70)
[ 1853.272482] ba40: ffff8000507fb580 0000ffffffffffff ffff80083a0ebc30 ffff00000894c2d0
[ 1853.280320] ba60: 00000000a00001c5 ffff00000810a7dc ffff80083a0e0080 0000000000000007
[ 1853.288154] ba80: ffff800800000000 ffff000016a90028 0000000000000000 ffff80083a001e00
[ 1853.295990] baa0: ffff80083a0e0000 ffff80083a0e0000 000000018020001f 0000000100200020
[ 1853.303828] bac0: ffff80083a0ebbe0 ffff00000822fda8 ffff7e00019dc9c0 ffff00000894c084
[ 1853.311663] bae0: ffff80083a0ebc00 ffff00000822fda8 ffff7e000153f0c0 0000000000040969
[ 1853.319498] bb00: ffff80083b751000 ffff000016a90028 0000000000000080 0000000000000000
[ 1853.327334] bb20: 0000000000000000 ffff00000894c084 ffff80083b708871 0000000000000005
[ 1853.335170] bb40: 0000000000210d00 0000000040000000 ffff80083b708870 ffff80083ff2ee40
[ 1853.343005] bb60: 746e657665752064 2020203020302820
[ 1853.347892] [<ffff00000894c2d0>] wait_reg_bit.constprop.13+0x24/0xb4
[ 1853.354248] [<ffff00000894ccf4>] usb_ss_gadget_ep_dequeue+0x110/0x164
[ 1853.360696] [<ffff00000898ef58>] usb_ep_dequeue+0x24/0xd8
[ 1853.366098] [<ffff00000898b4f0>] composite_dev_cleanup+0xe8/0x104
[ 1853.372197] [<ffff00000898d280>] configfs_composite_unbind+0x3c/0x5c
[ 1853.378556] [<ffff000008990b10>] usb_gadget_remove_driver+0x44/0x74
[ 1853.384830] [<ffff000008990c00>] usb_gadget_unregister_driver+0xc0/0xf0

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
pull/10/head
Peter Chen 2018-06-14 11:10:21 +08:00 committed by Jason Liu
parent ffa2804f24
commit c0984db6da
1 changed files with 3 additions and 1 deletions

View File

@ -1849,7 +1849,9 @@ static int usb_ss_gadget_ep_dequeue(struct usb_ep *ep,
request->status = -ECONNRESET;
select_ep(usb_ss, ep->desc->bEndpointAddress);
ret = cdns_data_flush(usb_ss_ep);
if (usb_ss->start_gadget)
ret = cdns_data_flush(usb_ss_ep);
list_for_each_entry_safe(req, req_temp,
&usb_ss_ep->request_list, list) {
if (request == req) {