usb: pci-quirks: add XHCI_COMP_MODE_QUIRK for disabling amd xhci D3cold
Subsystems (2)
PATCH 1/1 usb: pci-quirks: add XHCI_COMP_MODE_QUIRK for disabling amd xhci D3cold
During xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid D3cold.
--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/xhci-pci.c +5 -0
@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && + pdev->device ==0x1639 ) { + xhci->quirks |=XHCI_COMP_MODE_QUIRK ; + } +if (pdev->vendor ==PCI_VENDOR_ID_INTEL ) { xhci->quirks |=XHCI_LPM_SUPPORT ; xhci->quirks |=XHCI_INTEL_HOST ;
Signature · 1 line
2.7.4
[AMD Public Use]
Ping ... please help review.
Thanks,
Prike
Quoted 35 lines
-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Tuesday, January 19, 2021 9:49 AM
To: [email protected]
Cc: [email protected]; Liang, Prike <[email protected]>
Subject: [PATCH] usb: pci-quirks: addXHCI_COMP_MODE_QUIRKfor disabling amd xhci D3coldDuring xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid D3cold.
Signed-off-by Prike Liang <[email protected]>--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/usb/host/xhci-pci.c index renamed from drivers/usb/host/xhci-pci.c +0
-03feaafe..bff817a 100644
drivers/usb/host/xhci-pci.c +5
-0@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && +pdev->device ==0x1639 ) { +xhci->quirks |=XHCI_COMP_MODE_QUIRK ; +} +if (pdev->vendor ==PCI_VENDOR_ID_INTEL ) { xhci->quirks |=XHCI_LPM_SUPPORT ;
xhci->quirks|=XHCI_INTEL_HOST;
--
2.7.4
Quoted 13 lines · Prike Liang
During xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid D3cold.
Signed-off-by Prike Liang <[email protected]>--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/usb/host/xhci-pci.c +0
-0
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · line 176
Quoted 7 lines
drivers/usb/host/xhci-pci.c +4
-0@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && + pdev->device ==0x1639 ) { + xhci->quirks |=XHCI_COMP_MODE_QUIRK ; + }
Why not add this check to the xhci_compliance_mode_recovery_timer_quirk_check() function instead, where all other systems that need this quirk are tested for?
thanks,
greg k-h
Quoted 17 lines · Greg KH
Quoted 16 lines · Prike Liang
During xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid D3cold.
Signed-off-by Prike Liang <[email protected]>--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/usb/host/xhci-pci.c +0
-0@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE;
Quoted 8 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · line 176
Quoted 4 lines
drivers/usb/host/xhci-pci.c +4
-0+if (pdev->vendor ==PCI_VENDOR_ID_AMD && + pdev->device ==0x1639 ) { + xhci->quirks |=XHCI_COMP_MODE_QUIRK ; + }Why not add this check to the
xhci_compliance_mode_recovery_timer_quirk_check()function instead, where all other systems that need this quirk are tested for?
Ah, you don't have a pci device at that point in time. But, why aren't you making the same calls that the caller of that function does when setting this quirk here? Isn't that also required?
thanks,
greg k-h
[AMD Official Use Only - Internal Distribution Only]
Quoted 30 lines · Greg KH
Quoted 3 lines · Prike Liang
Quoted 2 lines
During xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid
D3cold.
Quoted 11 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev,
Quoted 11 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0
b/drivers/usb/host/xhci-pci.cindex 3feaafe..bff817a 100644drivers/usb/host/xhci-pci.c +0
-0@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev,struct
xhci_hcd*xhci)Quoted 11 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · line 176
Quoted 7 lines
drivers/usb/host/xhci-pci.c +4
-0(pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && +pdev->device ==0x1639 ) { +xhci->quirks |=XHCI_COMP_MODE_QUIRK ; +}Why not add this check to the
xhci_compliance_mode_recovery_timer_quirk_check()function instead, where all other systems that need this quirk are tested for?
Quoted 4 lines
Ah, you don't have a pci device at that point in time. But, why aren't you making the same calls that the caller of that function does when setting this quirk here? Isn't that also required?
[Prike] Thanks comment. This XHCI host port status lost issue was seen on the s2idle wake up period and poll the CNR bit failed in xhci_resume() that eventually result in the XHCI device resume failed. However, this issue may not totally caused by the entry of XHCI compliance mode and seems only partially enable the COMP flag with disable XHCI D3cold can work around this failed case. Regards to this issue maybe we needn't the COMP quirk and only need disable the D3cold for some specific XHCI device during processing xhci_pci_suspend().
Quoted 3 lines
thanks,
greg k-h
Quoted 1 line · Prike
[AMD Official Use Only - Internal Distribution Only]
Not very internal :)
Quoted 29 lines
Quoted 29 lines · Greg KH
Quoted 3 lines · Prike Liang
Quoted 2 lines
During xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid
D3cold.
Quoted 11 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev,
Quoted 11 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0
b/drivers/usb/host/xhci-pci.cindex 3feaafe..bff817a 100644drivers/usb/host/xhci-pci.c +0
-0@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev,struct
xhci_hcd*xhci)Quoted 11 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · line 176
Quoted 7 lines
drivers/usb/host/xhci-pci.c +4
-0(pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && +pdev->device ==0x1639 ) { +xhci->quirks |=XHCI_COMP_MODE_QUIRK ; +}Why not add this check to the
xhci_compliance_mode_recovery_timer_quirk_check()function instead, where all other systems that need this quirk are tested for?
Quoted 5 lines
Quoted 4 lines
Ah, you don't have a pci device at that point in time. But, why aren't you making the same calls that the caller of that function does when setting this quirk here? Isn't that also required?
[Prike] Thanks comment. This XHCI host port status lost issue was seen on the s2idle wake up period and poll the CNR bit failed in
xhci_resume()that eventually result in the XHCI device resume failed. However, this issue may not totally caused by the entry of XHCI compliance mode and seems only partially enable the COMP flag with disable XHCI D3cold can work around this failed case. Regards to this issue maybe we needn't the COMP quirk and only need disable the D3cold for some specific XHCI device during processingxhci_pci_suspend().
Ok, so what does this mean for us exactly?
Can you please properly test the hardware and let us know what needs to be done?
thanks,
greg k-h
Quoted 32 lines · Prike
[AMD Official Use Only - Internal Distribution Only]
Quoted 30 lines · Greg KH
Quoted 3 lines · Prike Liang
Quoted 2 lines
During xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid
D3cold.
Quoted 11 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev,
Quoted 11 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0
b/drivers/usb/host/xhci-pci.cindex 3feaafe..bff817a 100644drivers/usb/host/xhci-pci.c +0
-0@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev,struct
xhci_hcd*xhci)Quoted 11 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · line 176
Quoted 7 lines
drivers/usb/host/xhci-pci.c +4
-0(pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && +pdev->device ==0x1639 ) { +xhci->quirks |=XHCI_COMP_MODE_QUIRK ; +}Why not add this check to the
xhci_compliance_mode_recovery_timer_quirk_check()function instead, where all other systems that need this quirk are tested for?
Quoted 5 lines
Quoted 4 lines
Ah, you don't have a pci device at that point in time. But, why aren't you making the same calls that the caller of that function does when setting this quirk here? Isn't that also required?
[Prike] Thanks comment. This XHCI host port status lost issue was seen on the s2idle wake up period and poll the CNR bit failed in
xhci_resume()that eventually result in the XHCI device resume failed. However, this issue may not totally caused by the entry of XHCI compliance mode and seems only partially enable the COMP flag with disable XHCI D3cold can work around this failed case. Regards to this issue maybe we needn't the COMP quirk and only need disable the D3cold for some specific XHCI device during processingxhci_pci_suspend().
The XHCI_COMP_MODE_QUIRK is for cases where ports suddenly go to compliance mode. For those we start a timer that polls each port every 2 seconds and checks for compliance mode, and recovers from it. Timer is not running while xhci is suspended. Can you see any port ending up in compliance mode?
The 'Controller Not Ready' (CNR) bit not being cleared by host in resume sounds like the actual problem.
-Mathias
[AMD Public Use]
Quoted 56 lines · Prike
Quoted 34 lines
[AMD Official Use Only - Internal Distribution Only]
Quoted 32 lines · Greg KH
Quoted 4 lines · Prike Liang
Quoted 3 lines
During xhci suspend some AMD USB host will lose port status change events and need to have the registers polled during D3, so now just avoid
D3cold.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Prike Liang <[email protected]>--- drivers/usb/host/xhci-pci.c | 5 +++++ 1 file changed, 5 insertions(+)Quoted 6 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device · line 170
Quoted 6 lines
(quoted diff) +0
-0
b/drivers/usb/host/xhci-pci.cindex 3feaafe..bff817a 100644drivers/usb/host/xhci-pci.c +0
-0@@ -170,6 +170,11 @@ static void xhci_pci_quirks(struct device *dev,struct
xhci_hcd*xhci)Quoted 11 lines
drivers/usb/host/xhci-pci.c static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · line 176
Quoted 7 lines
drivers/usb/host/xhci-pci.c +4
-0(pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1))) xhci->quirks |= XHCI_U2_DISABLE_WAKE; +if (pdev->vendor ==PCI_VENDOR_ID_AMD && +pdev->device ==0x1639 ) { +xhci->quirks |=XHCI_COMP_MODE_QUIRK ; +}Why not add this check to the
xhci_compliance_mode_recovery_timer_quirk_check()function instead, where all other systems that need this quirk are tested for?Quoted 5 lines
Quoted 4 lines
Ah, you don't have a pci device at that point in time. But, why aren't you making the same calls that the caller of that function does when setting this quirk here? Isn't that also required?
[Prike] Thanks comment. This XHCI host port status lost issue was seen on
the s2idle wake up period and poll the CNR bit failed in
xhci_resume()that eventually result in the XHCI device resume failed. However, this issue may not totally caused by the entry of XHCI compliance mode and seems only partially enable the COMP flag with disable XHCI D3cold can work around this failed case. Regards to this issue maybe we needn't the COMP quirk and only need disable the D3cold for some specific XHCI device during processingxhci_pci_suspend().The
XHCI_COMP_MODE_QUIRKis for cases where ports suddenly go to compliance mode.
For those we start a timer that polls each port every 2 seconds and checks for compliance mode, and recovers from it. Timer is not running while xhci is suspended.
Can you see any port ending up in compliance mode?
Quoted 4 lines
The 'Controller Not Ready' (CNR) bit not being cleared by host in resume sounds like the actual problem.
-Mathias
[Prike] Thanks help clarify the compliance quirk. Double confirm that the XHCI device not enter the compliance mode and the PLS field value was 5. So this issue seems not caused by the Compliance Mode entering, but by D3cold entering while in s2idle loop. Meanwhile, PMFW/XHCI HW guys confirm that in the s0ix(s2idle) AMD solution requires the XHCI USB enter D3hot. Therefore, as to this issue how about add a new quirk flag for handling this?
Thanks,
Prike