Subject: Re: [PATCH wireless-drivers 1/2] mt76: mt76x2e: disable pcie_aspm by default

From: kbuild test robot <[email-masked]>
Date: Sat, 26 Oct 2019 09:38:16 +0800

Hi Lorenzo,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless-drivers/master]

url:    https://github.com/0day-ci/linux/commits/Lorenzo-Bianconi/fix-mt76x2e-hangs-on-U7612E-mini-pcie/20191026-054624
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git master
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email-masked]>

All errors (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mmio.c: In function 'mt76_mmio_disable_aspm':
>> drivers/net/wireless/mediatek/mt76/mmio.c:88:2: error: implicit declaration of function 'pcie_capability_read_word'; did you mean 'has_capability_noaudit'? [-Werror=implicit-function-declaration]
     pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf);
     ^~~~~~~~~~~~~~~~~~~~~~~~~
     has_capability_noaudit
>> drivers/net/wireless/mediatek/mt76/mmio.c:120:2: error: implicit declaration of function 'pcie_capability_clear_word'; did you mean 'has_capability_noaudit'? [-Werror=implicit-function-declaration]
     pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, aspm_conf);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
     has_capability_noaudit
   cc1: some warnings being treated as errors

vim +88 drivers/net/wireless/mediatek/mt76/mmio.c

    82	
    83	void mt76_mmio_disable_aspm(struct pci_dev *pdev)
    84	{
    85		struct pci_dev *parent = pdev->bus->self;
    86		u16 aspm_conf, parent_aspm_conf = 0;
    87	
  > 88		pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf);
    89		aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
    90		if (parent) {
    91			pcie_capability_read_word(parent, PCI_EXP_LNKCTL,
    92						  &parent_aspm_conf);
    93			parent_aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
    94		}
    95	
    96		if (!aspm_conf && (!parent || !parent_aspm_conf)) {
    97			/* aspm already disabled */
    98			return;
    99		}
   100	
   101		dev_info(&pdev->dev, "disabling ASPM %s %s\n",
   102			 (aspm_conf & PCI_EXP_LNKCTL_ASPM_L0S) ? "L0s" : "",
   103			 (aspm_conf & PCI_EXP_LNKCTL_ASPM_L1) ? "L1" : "");
   104	
   105	#ifdef CONFIG_PCIEASPM
   106		pci_disable_link_state(pdev, aspm_conf);
   107	
   108		/* Double-check ASPM control.  If not disabled by the above, the
   109		 * BIOS is preventing that from happening (or CONFIG_PCIEASPM is
   110		 * not enabled); override by writing PCI config space directly.
   111		 */
   112		pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf);
   113		if (!(aspm_conf & PCI_EXP_LNKCTL_ASPMC))
   114			return;
   115	#endif /* CONFIG_PCIEASPM */
   116	
   117		/* Both device and parent should have the same ASPM setting.
   118		 * Disable ASPM in downstream component first and then upstream.
   119		 */
 > 120		pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, aspm_conf);
   121	
   122		if (parent)
   123			pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
   124						   aspm_conf);
   125	}
   126	EXPORT_SYMBOL_GPL(mt76_mmio_disable_aspm);
   127	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation