Skip to content

Commit

Permalink
MLK-22366-4 usb: cdns3: gadget: don't call request handler for the un…
Browse files Browse the repository at this point in the history
…configured device

We don't need to notify the bus reset for class driver if the non-control
endpoints are not enabled. It could cause unnecessary disconnect event for
android due to below two reasons:
- Android declares the disconnect event for reset handler.
- The controller will get two reset interrupts at HS mode
it fixed two below oops:

oops #1

android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
android_work: sent uevent USB_STATE=CONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONFIGURED
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=8846 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
init: Received control message 'start' for 'adbd' from pid: 3275 (system_server)
android_work: sent uevent USB_STATE=CONNECTED
android_disconnect: gadget driver already disconnected
init: Received control message 'stop' for 'adbd' from pid: 3135
(/vendor/bin/hw/[email protected])
init: Sending signal 9 to service 'adbd' (pid 5859) process group...
android_work: sent uevent USB_STATE=DISCONNECTED
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5858 at kernel_imx/drivers/usb/gadget/configfs.c:1533 android_disconnect+0x60/0x68
Modules linked in:
audit: audit_lost=8877 audit_rate_limit=5 audit_backlog_limit=64
CPU: 0 PID: 5858 Comm: main Not tainted 4.14.98-07844-g346f959 #14
audit: rate limit exceeded
Hardware name: Freescale i.MX8QXP MEK (DT)
task: ffff800063950e00 task.stack: ffff00000daf8000
PC is at android_disconnect+0x60/0x68
LR is at android_disconnect+0x60/0x68
pc : [<ffff000008a044cc>] lr : [<ffff000008a044cc>] pstate: 600001c5
sp : ffff000008003e00
x29: ffff000008003e00 x28: ffff800063950e00
Timeout for IPC response!
x27: ffff000009885018 x26: ffff000008004000
Failed power operation on resource 248 sc_err 3
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff800836158810 x22: 00000000000001c0
x21: ffff800836158b94 x20: ffff800836158810
x19: 0000000000000000 x18: 0000f6cba5d06050
Synchronous External Abort: synchronous external abort (0x96000210) at 0xffff000011790024
x17: 0000f6cba74ac218 x16: ffff00000829be84
Internal error: : 96000210 [#1] PREEMPT SMP
Modules linked in:
x15: 0000f6cba5d067f0
x14: 0000f6cba5d0a3d0
CPU: 2 PID: 2353 Comm: kworker/2:1H Not tainted 4.14.98-07844-g346f959 #14
Hardware name: Freescale i.MX8QXP MEK (DT)
x13: 656c626174206665 x12: 078db5fab2ae6e00
Workqueue: kblockd blk_mq_run_work_fn
x11: ffff000008003ad0
task: ffff80083bf62a00 task.stack: ffff00000b5e8000
x10: ffff000008003ad0
PC is at esdhc_readl_le+0x8/0x15c
x9 : 0000000000000006
LR is at sdhci_send_command+0xc4/0xa54
x8 : ffff000009c8e280
pc : [<ffff000008b82ea4>] lr : [<ffff000008b6ca48>] pstate: 200001c5
i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: rpmsg_xfer failed: timeout
fxos8700 14-001e: i2c block read acc failed
i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: rpmsg_xfer failed: timeout

oops 2#:

init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/[email protected])
init: starting service 'adbd'...
init: Created socket '/dev/socket/adbd', mode 660, user 1000, group 1000
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
configfs-gadget gadget: high-speed config #1: b
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=CONFIGURED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/[email protected])
android_work: sent uevent USB_STATE=DISCONNECTED
audit: audit_lost=179935 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
audit: audit_lost=179970 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
using random self ethernet address
using random host ethernet address
read descriptors
read strings
usb0: HOST MAC f2:80:c5:eb:a1:fd
usb0: MAC 92:da:4f:13:01:73
android_work: did not send uevent (0 0           (null))
audit: audit_lost=180005 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
read descriptors
read strings
android_work: did not send uevent (0 0           (null))
android_work: sent uevent USB_STATE=CONNECTED
android_work: sent uevent USB_STATE=DISCONNECTED
init: Received control message 'start' for 'adbd' from pid: 3499 (system_server)
composite_disconnect: Calling disconnect on a Gadget that is                      not connected
android_work: did not send uevent (0 0           (null))
init: Received control message 'stop' for 'adbd' from pid: 3359 (/vendor/bin/hw/[email protected])
init: Sending signal 9 to service 'adbd' (pid 22343) process group...
------------[ cut here ]------------
audit: audit_lost=180038 audit_rate_limit=5 audit_backlog_limit=64
audit: rate limit exceeded
WARNING: CPU: 0 PID: 3468 at /home/tianyang/maddev_pie9.0/vendor/nxp-opensource/kernel_imx/drivers/usb/gadget/composite.c:2009 composite_disconnect+0x80/0x88
Modules linked in:
CPU: 0 PID: 3468 Comm: HWC-UEvent-Thre Not tainted 4.14.98-07846-g0b40a9b-dirty #16
Hardware name: Freescale i.MX8QM MEK (DT)
task: ffff8008f2349c00 task.stack: ffff00000b0a8000
PC is at composite_disconnect+0x80/0x88
LR is at composite_disconnect+0x80/0x88
pc : [<ffff0000089ff9b0>] lr : [<ffff0000089ff9b0>] pstate: 600001c5
sp : ffff000008003dd0
x29: ffff000008003dd0 x28: ffff8008f2349c00
x27: ffff000009885018 x26: ffff000008004000
Timeout for IPC response!
x25: ffff000009885018 x24: ffff000009c8e280
x23: ffff8008f2d98010 x22: 00000000000001c0
x21: ffff8008f2d98394 x20: ffff8008f2d98010
x19: 0000000000000000 x18: 0000e3956f4f075a
fxos8700 4-001e: i2c block read acc failed
x17: 0000e395735727e8 x16: ffff00000829f4d4
x15: ffffffffffffffff x14: 7463656e6e6f6320
x13: 746f6e2009090920 x12: 7369207461687420
x11: 7465676461472061 x10: 206e6f207463656e
x9 : 6e6f637369642067 x8 : ffff000009c8e280
x7 : ffff0000086ca6cc x6 : ffff000009f15e78
x5 : 0000000000000000 x4 : 0000000000000000
x3 : ffffffffffffffff x2 : c3f28b86000c3900
x1 : c3f28b86000c3900 x0 : 000000000000004e

X20: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
libprocessgroup: Failed to kill process cgroup uid 0 pid 22343 in 215ms, 1 processes remain
7fd0
Timeout for IPC response!
 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
using random self ethernet address
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc
using random host ethernet address
 ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X21: 0xffff8008f2d98314:
8314  ffff8008 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8334  00000000 00000000 00000000 00000000 00000000 08a04cf4 ffff0000 00000000
8354  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
8374  00000000 00000000 00000000 00001001 00000000 00000000 00000000 00000000
8394  e4bbe4bb 0f230000 ffff0000 0afae000 ffff0000 ae001000 00000000 f206d400
Timeout for IPC response!
83b4  ffff8008 00000000 00000000 f7957b18 ffff8008 f7957718 ffff8008 f7957018
83d4  ffff8008 f7957118 ffff8008 f7957618 ffff8008 f7957818 ffff8008 f7957918
83f4  ffff8008 f7957d18 ffff8008 00000000 00000000 00000000 00000000 00000000

X23: 0xffff8008f2d97f90:
7f90  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fb0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7fd0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
7ff0  00000000 00000000 00000000 00000000 f76c8010 ffff8008 f76c8010 ffff8008
8010  00000100 00000000 f2d98018 ffff8008 f2d98018 ffff8008 08a067dc ffff0000
8030  f206d800 ffff8008 091c3650 ffff0000 f7957b18 ffff8008 f7957730 ffff8008
8050  f716a630 ffff8008 00000000 00000005 00000000 00000000 095d1568 ffff0000
8070  f76c8010 ffff8008 f716a800 ffff8008 095cac68 ffff0000 f206d828 ffff8008

X28: 0xffff8008f2349b80:
9b80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9ba0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9bc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9be0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9c00  00000022 00000000 ffffffff ffffffff 00010001 00000000 00000000 00000000
9c20  0b0a8000 ffff0000 00000002 00404040 00000000 00000000 00000000 00000000
9c40  00000001 00000000 00000001 00000000 001ebd44 00000001 f390b800 ffff8008
9c60  00000000 00000001 00000070 00000070 00000070 00000000 09031d48 ffff0000

Call trace:
Exception stack(0xffff000008003c90 to 0xffff000008003dd0)
3c80:                                   000000000000004e c3f28b86000c3900
3ca0: c3f28b86000c3900 ffffffffffffffff 0000000000000000 0000000000000000
3cc0: ffff000009f15e78 ffff0000086ca6cc ffff000009c8e280 6e6f637369642067
3ce0: 206e6f207463656e 7465676461472061 7369207461687420 746f6e2009090920
3d00: 7463656e6e6f6320 ffffffffffffffff ffff00000829f4d4 0000e395735727e8
3d20: 0000e3956f4f075a 0000000000000000 ffff8008f2d98010 ffff8008f2d98394
3d40: 00000000000001c0 ffff8008f2d98010 ffff000009c8e280 ffff000009885018
3d60: ffff000008004000 ffff000009885018 ffff8008f2349c00 ffff000008003dd0
3d80: ffff0000089ff9b0 ffff000008003dd0 ffff0000089ff9b0 00000000600001c5
3da0: ffff8008f33f2cd8 0000000000000000 0000ffffffffffff 0000000000000000
init: Received control message 'start' for 'adbd' from pid: 3359 (/vendor/bin/hw/[email protected])
3dc0: ffff000008003dd0 ffff0000089ff9b0
[<ffff0000089ff9b0>] composite_disconnect+0x80/0x88
[<ffff000008a044d4>] android_disconnect+0x3c/0x68
[<ffff0000089ba9f8>] cdns3_device_irq_handler+0xfc/0x2c8
[<ffff0000089b84c0>] cdns3_irq+0x44/0x94
[<ffff00000814494c>] __handle_irq_event_percpu+0x60/0x24c
[<ffff000008144c0c>] handle_irq_event+0x58/0xc0
[<ffff00000814873c>] handle_fasteoi_irq+0x98/0x180
[<ffff000008143a10>] generic_handle_irq+0x24/0x38
[<ffff000008144170>] __handle_domain_irq+0x60/0xac
[<ffff0000080819c4>] gic_handle_irq+0xd4/0x17c
Exception stack(0xffff00000b0ab950 to 0xffff00000b0aba90)
b940:                                   ffff8008f2a65c00 0000000000000140
b960: 00000000000068ea ffff8008f6cf9c00 0000000000000000 0000000000000000
b980: ffff000009893800 ffff8008f23c38a8 ffff8008ffee21a0 00000000ffffffff
b9a0: 0000000000000001 6f6674616c702f73 30313162352f6d72 336273752e303030
b9c0: 3162352f6364752f ffffffffffffffff ffff00000829f4d4 0000e395735727e8
b9e0: 0000e3956f4f075a ffff8008f2a65c00 0000000000000001 0000000000000140
ba00: 00000000000000c3 0000000000000001 0000000000000001 ffff000009c8e000
ba20: ffff8008f2c5b940 ffff8008d5a6fb00 0000000000000067 ffff00000b0aba90
ba40: ffff00000812b354 ffff00000b0aba90 ffff000009010044 0000000060000145
ba60: 0000000000000140 00000000000000c3 0000ffffffffffff 0000000000000001
ba80: ffff00000b0aba90 ffff000009010044
[<ffff000008083230>] el1_irq+0xb0/0x124
[<ffff000009010044>] _raw_spin_unlock_irqrestore+0x18/0x48
[<ffff00000812b354>] __wake_up_common_lock+0xa0/0xd4
[<ffff00000812b3c0>] __wake_up_sync_key+0x1c/0x24
[<ffff000008d515f0>] sock_def_readable+0x40/0x70
[<ffff000008e7a71c>] unix_dgram_sendmsg+0x45c/0x728
[<ffff000008d4df10>] sock_write_iter+0x10c/0x124
[<ffff00000829c4e0>] do_iter_readv_writev+0xf8/0x160
[<ffff00000829d2e4>] do_iter_write.part.17+0x38/0x154
[<ffff00000829e9c4>] vfs_writev+0x114/0x158
[<ffff00000829ea68>] do_writev+0x60/0xe8
[<ffff00000829f4e4>] SyS_writev+0x10/0x18
Exception stack(0xffff00000b0abec0 to 0xffff00000b0ac000)
bec0: 000000000000000f 0000e3956f4f0cb0 0000000000000004 0000000000000003
bee0: 0000000000000067 0000000080000000 725705beff78606b 7f7f7fff7f7f7f7f
bf00: 0000000000000042 000000000000005c 0000e3956f4f0e60 0000000000000053
bf20: 0000e3956f4f0f98 ffffffffffffffff ffffffffff000000 ffffffffffffffff
bf40: 0000e39572bf0cc0 0000e395735727e8 0000e3956f4f075a 0000000000000000
bf60: 000000000000000f 0000e3956f4f0cb0 0000000000000004 0000e39572bf17e0
bf80: 0000e3956f4f2588 0000e39572bf1618 0000000000000004 0000000000000000
bfa0: 0000e39572bf1618 0000e3956f4f0d70 0000e39572bd4260 0000e3956f4f0cb0
bfc0: 0000e395735727f0 0000000060000000 000000000000000f 0000000000000042
bfe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[<ffff000008083ac0>] el0_svc_naked+0x34/0x38

Reviewed-by: Jun Li <[email protected]>
Signed-off-by: Peter Chen <[email protected]>
  • Loading branch information
Peter Chen authored and tkisky committed Feb 28, 2020
1 parent ba7b8bd commit 0b8cb8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/cdns3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,9 @@ static void cdns3_check_usb_interrupt_proceed(struct cdns3_device *priv_dev,
/* reset*/
if (usb_ists & (USB_ISTS_UWRESI | USB_ISTS_UHRESI | USB_ISTS_U2RESI)) {
if (priv_dev->gadget_driver &&
priv_dev->gadget_driver->reset) {
priv_dev->gadget_driver->reset &&
priv_dev->gadget.state ==
USB_STATE_CONFIGURED) {
spin_unlock(&priv_dev->lock);
priv_dev->gadget_driver->reset(&priv_dev->gadget);
spin_lock(&priv_dev->lock);
Expand Down

0 comments on commit 0b8cb8c

Please sign in to comment.