Bug 2700 - XHCI:Fix some device identify fail when enable xHCI runtime suspend
Summary: XHCI:Fix some device identify fail when enable xHCI runtime suspend
Status: RESOLVED INVALID
Alias: None
Product: ANCK 5.10 Dev
Classification: ANCK
Component: drivers (show other bugs) drivers
Version: unspecified
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: GuixinLiu
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-02 17:12 UTC by LeoLiu-oc
Modified: 2022-11-02 17:29 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LeoLiu-oc zhaoxin_group 2022-11-02 17:12:30 UTC
Description of problem:
If plug out device form xhci with runtime suspend enabled.
On the one hand, driver will disconnect this device and send disabled
slot command to xhci.
On the other hand, without no device connect to xhci, PM core will
call xhci suspend function to let xhci go to D3 to save power.
However there is a temporal competition to get xhci lock between
disable slot command interrupt and xhci suspend.
If xhci suspend function get xhci lock first, then this function will
clear xhci command ring. It will get error command trb when driver to
handle disable slot command interrupt. This is a serious error for
driver and driver will cleanup xhci. So,any device connect to this
xhci port again will not be recognized.

In order to fix this issues, we let disable slot command interrupt ISR
to get xhci lock first. So, add a delay in xhci suspend function before
to get xhci lock.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1	插拔测试:
多次插入拔出device是否能够正常识别
2	RTD3测试
1)	接入KB/mouse然后拔掉
2)	Enable EHCI RTD3 (以EHCI的BDF为00:10.7为例:echo auto >/sys/bus/pci/devices/0000:00:10.7/power/control)
3)	Watch –n.1 “Cat /proc/interrupt | grep acpi” 查看中断是否快速不断增加,
4)	往USB2.0 port接入device查看是否识别

3	Sx state测试
1)	Sx state是burn-in test是否可以pass
2)	让系统进出Sx, 然后插入device是否可以识别
3)	带着device进出Sx state,然后check回来后device是否能够识别


Actual results:


Expected results:
在各种测试case下面,device都可以正识别, EHCI进入RTD3不会导致SCI中断快速增加,Sx state能够正常进出。

Additional info:
Comment 1 LeoLiu-oc zhaoxin_group 2022-11-02 17:26:12 UTC
测试环境:
1)	任意主板/任意Linux OS
2)	测试设备,如下两款设备不加patch确定可以复现问题,其它device也可以尝试
Sandisk Cruzer Glide 16G 2.0 USB
贝尔金USB2.0 hub

测试Case:
1 插拔测试:
1)	Enable xHCI RTD3 (以xHCI的BDF为00:12.0为例:echo auto >/sys/bus/pci/devices/0000:00:12.0/power/control)
2)	拔掉接入的device,2s后再插入,查看device是否可以被识别到

2  Sx state测试
让系统进出Sx, 然后插入device是否可以识别
Comment 2 LeoLiu-oc zhaoxin_group 2022-11-02 17:29:38 UTC
confirmed