diff mbox series

mmc: sdhci-pci-gli: GL9750: Mask rootport's replay timer timeout during suspend

Message ID 20231212141029.239235-1-kai.heng.feng@canonical.com (mailing list archive)
State New, archived
Headers show
Series mmc: sdhci-pci-gli: GL9750: Mask rootport's replay timer timeout during suspend | expand

Commit Message

Kai-Heng Feng Dec. 12, 2023, 2:10 p.m. UTC
Spamming `lspci -vv` can still observe the replay timer timeout error
even after commit 015c9cbcf0ad ("mmc: sdhci-pci-gli: GL9750: Mask the
replay timer timeout of AER"), albeit with a lower reproduce rate.

Such AER interrupt can still prevent the system from suspending, so let
root port mask and unmask replay timer timeout during suspend and
resume, respectively.

Cc: Victor Shih <victor.shih@genesyslogic.com.tw>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/mmc/host/sdhci-pci-core.c |  2 +-
 drivers/mmc/host/sdhci-pci-gli.c  | 50 +++++++++++++++++++++++++++++--
 drivers/mmc/host/sdhci-pci.h      |  1 +
 3 files changed, 50 insertions(+), 3 deletions(-)

Comments

kernel test robot Dec. 13, 2023, 1:52 a.m. UTC | #1
Hi Kai-Heng,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc5 next-20231212]
[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/Kai-Heng-Feng/mmc-sdhci-pci-gli-GL9750-Mask-rootport-s-replay-timer-timeout-during-suspend/20231212-221223
base:   linus/master
patch link:    https://lore.kernel.org/r/20231212141029.239235-1-kai.heng.feng%40canonical.com
patch subject: [PATCH] mmc: sdhci-pci-gli: GL9750: Mask rootport's replay timer timeout during suspend
config: arm64-randconfig-002-20231213 (https://download.01.org/0day-ci/archive/20231213/202312130937.AU6tt2Ik-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231213/202312130937.AU6tt2Ik-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312130937.AU6tt2Ik-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/mmc/host/sdhci-pci-gli.c:1437:26: error: no member named 'aer_cap' in 'struct pci_dev'
    1437 |         if (!parent || !parent->aer_cap)
         |                         ~~~~~~  ^
   drivers/mmc/host/sdhci-pci-gli.c:1440:40: error: no member named 'aer_cap' in 'struct pci_dev'
    1440 |         pci_read_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, &val);
         |                                       ~~~~~~  ^
   drivers/mmc/host/sdhci-pci-gli.c:1442:41: error: no member named 'aer_cap' in 'struct pci_dev'
    1442 |         pci_write_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, val);
         |                                        ~~~~~~  ^
   drivers/mmc/host/sdhci-pci-gli.c:1450:26: error: no member named 'aer_cap' in 'struct pci_dev'
    1450 |         if (!parent || !parent->aer_cap)
         |                         ~~~~~~  ^
   drivers/mmc/host/sdhci-pci-gli.c:1453:38: error: no member named 'aer_cap' in 'struct pci_dev'
    1453 |         pci_read_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK, &val);
         |                                     ~~~~~~  ^
   drivers/mmc/host/sdhci-pci-gli.c:1455:39: error: no member named 'aer_cap' in 'struct pci_dev'
    1455 |         pci_write_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK, val);
         |                                      ~~~~~~  ^
   6 errors generated.


vim +1437 drivers/mmc/host/sdhci-pci-gli.c

  1431	
  1432	static void mask_replay_timer_timeout(struct pci_dev *pdev)
  1433	{
  1434		struct pci_dev *parent = pci_upstream_bridge(pdev);
  1435		u32 val;
  1436	
> 1437		if (!parent || !parent->aer_cap)
  1438			return;
  1439	
  1440		pci_read_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, &val);
  1441		val |= PCI_ERR_COR_REP_TIMER;
  1442		pci_write_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, val);
  1443	}
  1444
kernel test robot Dec. 14, 2023, 1:57 p.m. UTC | #2
Hi Kai-Heng,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc5 next-20231214]
[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/Kai-Heng-Feng/mmc-sdhci-pci-gli-GL9750-Mask-rootport-s-replay-timer-timeout-during-suspend/20231212-221223
base:   linus/master
patch link:    https://lore.kernel.org/r/20231212141029.239235-1-kai.heng.feng%40canonical.com
patch subject: [PATCH] mmc: sdhci-pci-gli: GL9750: Mask rootport's replay timer timeout during suspend
config: x86_64-randconfig-121-20231213 (https://download.01.org/0day-ci/archive/20231214/202312142103.ADkXHq1r-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231214/202312142103.ADkXHq1r-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312142103.ADkXHq1r-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/mmc/host/sdhci-pci-gli.c: In function 'mask_replay_timer_timeout':
>> drivers/mmc/host/sdhci-pci-gli.c:1437:33: error: 'struct pci_dev' has no member named 'aer_cap'; did you mean 'ats_cap'?
    1437 |         if (!parent || !parent->aer_cap)
         |                                 ^~~~~~~
         |                                 ats_cap
   drivers/mmc/host/sdhci-pci-gli.c:1440:47: error: 'struct pci_dev' has no member named 'aer_cap'; did you mean 'ats_cap'?
    1440 |         pci_read_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, &val);
         |                                               ^~~~~~~
         |                                               ats_cap
   drivers/mmc/host/sdhci-pci-gli.c:1442:48: error: 'struct pci_dev' has no member named 'aer_cap'; did you mean 'ats_cap'?
    1442 |         pci_write_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, val);
         |                                                ^~~~~~~
         |                                                ats_cap
   drivers/mmc/host/sdhci-pci-gli.c: In function 'unmask_replay_timer_timeout':
   drivers/mmc/host/sdhci-pci-gli.c:1450:33: error: 'struct pci_dev' has no member named 'aer_cap'; did you mean 'ats_cap'?
    1450 |         if (!parent || !parent->aer_cap)
         |                                 ^~~~~~~
         |                                 ats_cap
   drivers/mmc/host/sdhci-pci-gli.c:1453:45: error: 'struct pci_dev' has no member named 'aer_cap'; did you mean 'ats_cap'?
    1453 |         pci_read_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK, &val);
         |                                             ^~~~~~~
         |                                             ats_cap
   drivers/mmc/host/sdhci-pci-gli.c:1455:46: error: 'struct pci_dev' has no member named 'aer_cap'; did you mean 'ats_cap'?
    1455 |         pci_write_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK, val);
         |                                              ^~~~~~~
         |                                              ats_cap


vim +1437 drivers/mmc/host/sdhci-pci-gli.c

  1431	
  1432	static void mask_replay_timer_timeout(struct pci_dev *pdev)
  1433	{
  1434		struct pci_dev *parent = pci_upstream_bridge(pdev);
  1435		u32 val;
  1436	
> 1437		if (!parent || !parent->aer_cap)
  1438			return;
  1439	
  1440		pci_read_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, &val);
  1441		val |= PCI_ERR_COR_REP_TIMER;
  1442		pci_write_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, val);
  1443	}
  1444
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 025b31aa712c..59ae4da72974 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -68,7 +68,7 @@  static int sdhci_pci_init_wakeup(struct sdhci_pci_chip *chip)
 	return 0;
 }
 
-static int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip)
+int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip)
 {
 	int i, ret;
 
diff --git a/drivers/mmc/host/sdhci-pci-gli.c b/drivers/mmc/host/sdhci-pci-gli.c
index 77911a57b12c..7d1548c83742 100644
--- a/drivers/mmc/host/sdhci-pci-gli.c
+++ b/drivers/mmc/host/sdhci-pci-gli.c
@@ -1429,6 +1429,50 @@  static int sdhci_pci_gli_resume(struct sdhci_pci_chip *chip)
 	return sdhci_pci_resume_host(chip);
 }
 
+static void mask_replay_timer_timeout(struct pci_dev *pdev)
+{
+	struct pci_dev *parent = pci_upstream_bridge(pdev);
+	u32 val;
+
+	if (!parent || !parent->aer_cap)
+		return;
+
+	pci_read_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, &val);
+	val |= PCI_ERR_COR_REP_TIMER;
+	pci_write_config_dword(parent, parent->aer_cap + PCI_ERR_COR_MASK, val);
+}
+
+static void unmask_replay_timer_timeout(struct pci_dev *pdev)
+{
+	struct pci_dev *parent = pci_upstream_bridge(pdev);
+	u32 val;
+
+	if (!parent || !parent->aer_cap)
+		return;
+
+	pci_read_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK, &val);
+	val &= ~PCI_ERR_COR_REP_TIMER;
+	pci_write_config_dword(pdev, parent->aer_cap + PCI_ERR_COR_MASK, val);
+}
+
+static int sdhci_pci_gl975x_suspend(struct sdhci_pci_chip *chip)
+{
+	mask_replay_timer_timeout(chip->pdev);
+
+	return sdhci_pci_suspend_host(chip);
+}
+
+static int sdhci_pci_gl975x_resume(struct sdhci_pci_chip *chip)
+{
+	int ret;
+
+	ret = sdhci_pci_gli_resume(chip);
+
+	unmask_replay_timer_timeout(chip->pdev);
+
+	return ret;
+}
+
 static int gl9763e_resume(struct sdhci_pci_chip *chip)
 {
 	struct sdhci_pci_slot *slot = chip->slots[0];
@@ -1547,7 +1591,8 @@  const struct sdhci_pci_fixes sdhci_gl9755 = {
 	.probe_slot	= gli_probe_slot_gl9755,
 	.ops            = &sdhci_gl9755_ops,
 #ifdef CONFIG_PM_SLEEP
-	.resume         = sdhci_pci_gli_resume,
+	.suspend	= sdhci_pci_gl975x_suspend,
+	.resume         = sdhci_pci_gl975x_resume,
 #endif
 };
 
@@ -1570,7 +1615,8 @@  const struct sdhci_pci_fixes sdhci_gl9750 = {
 	.probe_slot	= gli_probe_slot_gl9750,
 	.ops            = &sdhci_gl9750_ops,
 #ifdef CONFIG_PM_SLEEP
-	.resume         = sdhci_pci_gli_resume,
+	.suspend	= sdhci_pci_gl975x_suspend,
+	.resume         = sdhci_pci_gl975x_resume,
 #endif
 };
 
diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
index 153704f812ed..19253dce687d 100644
--- a/drivers/mmc/host/sdhci-pci.h
+++ b/drivers/mmc/host/sdhci-pci.h
@@ -190,6 +190,7 @@  static inline void *sdhci_pci_priv(struct sdhci_pci_slot *slot)
 }
 
 #ifdef CONFIG_PM_SLEEP
+int sdhci_pci_suspend_host(struct sdhci_pci_chip *chip);
 int sdhci_pci_resume_host(struct sdhci_pci_chip *chip);
 #endif
 int sdhci_pci_enable_dma(struct sdhci_host *host);