* [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle
@ 2023-04-24 13:49 Mario Limonciello
2023-04-24 18:50 ` kernel test robot
2023-04-24 21:03 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Mario Limonciello @ 2023-04-24 13:49 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, Mario Limonciello
Cc: Natikar Basavaraj, Donghun Yoon, linux-usb, linux-kernel
Donghun reports that a notebook that has an AMD Ryzen 5700U but supports
S3 has problems with USB after resuming from suspend. The issue was
bisected down to commit d1658268e439 ("usb: pci-quirks: disable D3cold on
xhci suspend for s2idle on AMD Renoir").
As this issue only happens on S3, narrow the broken D3cold quirk to only
run in s2idle.
Fixes: d1658268e439 ("usb: pci-quirks: disable D3cold on xhci suspend for s2idle on AMD Renoir")
Reported-and-tested-by: Donghun Yoon <donghun.yoon@lge.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/usb/host/xhci-pci.c | 7 +++++--
drivers/usb/host/xhci.h | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index fb988e4ea924..c2c850e8abc2 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/reset.h>
+#include <linux/suspend.h>
#include "xhci.h"
#include "xhci-trace.h"
@@ -194,7 +195,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
if (pdev->vendor == PCI_VENDOR_ID_AMD &&
pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI)
- xhci->quirks |= XHCI_BROKEN_D3COLD;
+ xhci->quirks |= XHCI_BROKEN_D3COLD_S2I;
if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
xhci->quirks |= XHCI_LPM_SUPPORT;
@@ -609,7 +610,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
* Systems with the TI redriver that loses port status change events
* need to have the registers polled during D3, so avoid D3cold.
*/
- if (xhci->quirks & (XHCI_COMP_MODE_QUIRK | XHCI_BROKEN_D3COLD))
+ if (xhci->quirks & XHCI_COMP_MODE_QUIRK ||
+ (pm_suspend_target_state == PM_SUSPEND_TO_IDLE &&
+ xhci->quirks & (XHCI_BROKEN_D3COLD_S2I)))
pci_d3cold_disable(pdev);
if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 786002bb35db..3818359603cc 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1901,7 +1901,7 @@ struct xhci_hcd {
#define XHCI_DISABLE_SPARSE BIT_ULL(38)
#define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39)
#define XHCI_NO_SOFT_RETRY BIT_ULL(40)
-#define XHCI_BROKEN_D3COLD BIT_ULL(41)
+#define XHCI_BROKEN_D3COLD_S2I BIT_ULL(41)
#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42)
#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)
#define XHCI_RESET_TO_DEFAULT BIT_ULL(44)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle
2023-04-24 13:49 [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle Mario Limonciello
@ 2023-04-24 18:50 ` kernel test robot
2023-04-24 21:03 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-04-24 18:50 UTC (permalink / raw)
To: Mario Limonciello, Mathias Nyman, Greg Kroah-Hartman
Cc: llvm, oe-kbuild-all, Natikar Basavaraj, Donghun Yoon, linux-usb,
linux-kernel
Hi Mario,
kernel test robot noticed the following build errors:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.3 next-20230421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/xhci-pci-Only-run-d3cold-avoidance-quirk-for-s2idle/20230424-215356
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20230424134926.1416-1-mario.limonciello%40amd.com
patch subject: [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle
config: i386-randconfig-a003-20230424 (https://download.01.org/0day-ci/archive/20230425/202304250239.9WShH3NB-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/8e287659296330d0cb31e4730daacc92d0467e63
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mario-Limonciello/xhci-pci-Only-run-d3cold-avoidance-quirk-for-s2idle/20230424-215356
git checkout 8e287659296330d0cb31e4730daacc92d0467e63
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/usb/host/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304250239.9WShH3NB-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/usb/host/xhci-pci.c:806:7: error: use of undeclared identifier 'pm_suspend_target_state'
(pm_suspend_target_state == PM_SUSPEND_TO_IDLE &&
^
1 error generated.
vim +/pm_suspend_target_state +806 drivers/usb/host/xhci-pci.c
794
795 static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
796 {
797 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
798 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
799 int ret;
800
801 /*
802 * Systems with the TI redriver that loses port status change events
803 * need to have the registers polled during D3, so avoid D3cold.
804 */
805 if (xhci->quirks & XHCI_COMP_MODE_QUIRK ||
> 806 (pm_suspend_target_state == PM_SUSPEND_TO_IDLE &&
807 xhci->quirks & (XHCI_BROKEN_D3COLD_S2I)))
808 pci_d3cold_disable(pdev);
809
810 if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
811 xhci_pme_quirk(hcd);
812
813 if (xhci->quirks & XHCI_SSIC_PORT_UNUSED)
814 xhci_ssic_port_unused_quirk(hcd, true);
815
816 if (xhci->quirks & XHCI_DISABLE_SPARSE)
817 xhci_sparse_control_quirk(hcd);
818
819 ret = xhci_suspend(xhci, do_wakeup);
820
821 /* synchronize irq when using MSI-X */
822 xhci_msix_sync_irqs(xhci);
823
824 if (ret && (xhci->quirks & XHCI_SSIC_PORT_UNUSED))
825 xhci_ssic_port_unused_quirk(hcd, false);
826
827 return ret;
828 }
829
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle
2023-04-24 13:49 [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle Mario Limonciello
2023-04-24 18:50 ` kernel test robot
@ 2023-04-24 21:03 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-04-24 21:03 UTC (permalink / raw)
To: Mario Limonciello, Mathias Nyman, Greg Kroah-Hartman
Cc: llvm, oe-kbuild-all, Natikar Basavaraj, Donghun Yoon, linux-usb,
linux-kernel
Hi Mario,
kernel test robot noticed the following build errors:
[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus linus/master v6.3 next-20230421]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mario-Limonciello/xhci-pci-Only-run-d3cold-avoidance-quirk-for-s2idle/20230424-215356
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20230424134926.1416-1-mario.limonciello%40amd.com
patch subject: [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle
config: i386-randconfig-a005-20230424 (https://download.01.org/0day-ci/archive/20230425/202304250440.oxpMvFPQ-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/8e287659296330d0cb31e4730daacc92d0467e63
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Mario-Limonciello/xhci-pci-Only-run-d3cold-avoidance-quirk-for-s2idle/20230424-215356
git checkout 8e287659296330d0cb31e4730daacc92d0467e63
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304250440.oxpMvFPQ-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "pm_suspend_target_state" [drivers/usb/host/xhci-pci.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-24 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-24 13:49 [PATCH] xhci-pci: Only run d3cold avoidance quirk for s2idle Mario Limonciello
2023-04-24 18:50 ` kernel test robot
2023-04-24 21:03 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox