1
0
Fork 0

MLK-23342-2 usb: host: xhci-plat: keep runtime active when remove host

While remove host(e.g. for USB role switch from host to device), if
runtime pm is enabled, a runtime suspend may happen which cause
below kernel dump:
[  121.438091] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000240
[  121.446913] Mem abort info:
[  121.449707]   ESR = 0x96000004
[  121.452960] xhci-hcd xhci-hcd.1.auto: // Halt the HC
[  121.457935] xhci-hcd xhci-hcd.1.auto: // Reset the HC
[  121.463262] xhci-hcd xhci-hcd.1.auto: Wait for controller to be ready for doorbell rings
[  121.471410]   EC = 0x25: DABT (current EL), IL = 32 bits
[  121.476769]   SET = 0, FnV = 0
[  121.479865]   EA = 0, S1PTW = 0
[  121.483036] Data abort info:
[  121.485921]   ISV = 0, ISS = 0x00000004
[  121.489913] xhci-hcd xhci-hcd.1.auto: // Disabling event ring interrupts
[  121.496740]   CM = 0, WnR = 0
[  121.499773] user pgtable: 4k pages, 48-bit VAs, pgdp=00000001b7b18000
[  121.506342] xhci-hcd xhci-hcd.1.auto: cleaning up memory
[  121.511824] xhci-hcd xhci-hcd.1.auto: Freed event ring
[  121.517028] xhci-hcd xhci-hcd.1.auto: Freed command ring
[  121.522391] [0000000000000240] pgd=0000000000000000
[  121.527314] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  121.532890] Modules linked in:
[  121.535951] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.4.3-00107-g64d454a-dirty #1219
[  121.544039] Hardware name: FSL i.MX8MP EVK (DT)
[  121.548578] Workqueue: pm pm_runtime_work
[  121.552590] pstate: 60000005 (nZCv daif -PAN -UAO)
[  121.557385] pc : xhci_suspend+0x34/0x698
[  121.561311] lr : xhci_plat_runtime_suspend+0x2c/0x38
[  121.566275] sp : ffff800011ddbbc0
[  121.569588] x29: ffff800011ddbbc0 x28: 0000000000000000
[  121.574900] x27: 0000000000000008 x26: ffff800011b28000
[  121.580212] x25: ffff80001012b328 x24: ffff800011ddbd48
[  121.585523] x23: 0000000000000000 x22: ffff80001076ed78
[  121.590837] x21: ffff000177896000 x20: ffff0001714ebce4
[  121.596152] x19: ffff000177896000 x18: ffffffffffffffff
[  121.601464] x17: 0000000000000000 x16: 0000000000000000
[  121.606777] x15: ffff800011b288c8 x14: 0000000000000261
[  121.612089] x13: 0000000000000001 x12: 0000000000000001
[  121.617401] x11: 0000000000000000 x10: 00000000000009c0
[  121.622714] x9 : ffff800011ddbd40 x8 : fefefefefefefeff
[  121.628028] x7 : 0000000000000000 x6 : 000000003ca92688
[  121.633338] x5 : 00ffffffffffffff x4 : 001b6b0b00000000
[  121.638651] x3 : ffff0001714ebc10 x2 : 0000000000000000
[  121.643962] x1 : 0000000000000001 x0 : ffff000177896250
[  121.649277] Call trace:
[  121.651726]  xhci_suspend+0x34/0x698
[  121.655304]  xhci_plat_runtime_suspend+0x2c/0x38
[  121.659924]  pm_generic_runtime_suspend+0x28/0x40
[  121.664628]  __rpm_callback+0xd8/0x138
[  121.668376]  rpm_callback+0x24/0x98
[  121.671868]  rpm_suspend+0xe0/0x448
[  121.675358]  rpm_idle+0x124/0x140
[  121.678675]  pm_runtime_work+0xa0/0xf8
[  121.682426]  process_one_work+0x1dc/0x370
[  121.686434]  worker_thread+0x48/0x468
[  121.690100]  kthread+0xf0/0x120
[  121.693244]  ret_from_fork+0x10/0x1c

So keep the xhci-plat device active during remove host.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Li Jun 2020-02-19 22:57:41 +08:00
parent fa7f754967
commit d3c02ae356
1 changed files with 1 additions and 0 deletions

View File

@ -371,6 +371,7 @@ static int xhci_plat_remove(struct platform_device *dev)
struct clk *reg_clk = xhci->reg_clk;
struct usb_hcd *shared_hcd = xhci->shared_hcd;
pm_runtime_get_sync(&dev->dev);
xhci->xhc_state |= XHCI_STATE_REMOVING;
usb_remove_hcd(shared_hcd);