[PATCH v2] PCI: Move pci_dev_is/assign_added() to pci.h

kernel test robot lkp at intel.com
Tue Jul 20 23:48:39 AEST 2021


Hi Niklas,

I love your patch! Yet something to improve:

[auto build test ERROR on pci/next]
[also build test ERROR on powerpc/next s390/features pm/linux-next v5.14-rc2 next-20210720]
[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]

url:    https://github.com/0day-ci/linux/commits/Niklas-Schnelle/PCI-Move-pci_dev_is-assign_added-to-pci-h/20210720-180050
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: arm-buildonly-randconfig-r002-20210720 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 10.3.0
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/0day-ci/linux/commit/52e04c39213cf20b8c6bc717cfda56103b871cd1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Niklas-Schnelle/PCI-Move-pci_dev_is-assign_added-to-pci-h/20210720-180050
        git checkout 52e04c39213cf20b8c6bc717cfda56103b871cd1
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash drivers/pci/pcie/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   drivers/pci/pcie/dpc.c: In function 'dpc_completed':
>> drivers/pci/pcie/dpc.c:85:15: error: 'PCI_DPC_RECOVERING' undeclared (first use in this function)
      85 |  if (test_bit(PCI_DPC_RECOVERING, &pdev->priv_flags))
         |               ^~~~~~~~~~~~~~~~~~
   drivers/pci/pcie/dpc.c:85:15: note: each undeclared identifier is reported only once for each function it appears in
   In file included from include/linux/bitops.h:32,
                    from include/linux/kernel.h:12,
                    from include/linux/delay.h:22,
                    from drivers/pci/pcie/dpc.c:12:
   drivers/pci/pcie/dpc.c: In function 'pci_dpc_recovered':
>> drivers/pci/pcie/dpc.c:122:28: error: 'PCI_DPC_RECOVERED' undeclared (first use in this function)
     122 |  return test_and_clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags);
         |                            ^~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:24: note: in definition of macro 'ATOMIC_BITOP'
     181 |  (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
         |                        ^~
   drivers/pci/pcie/dpc.c:122:9: note: in expansion of macro 'test_and_clear_bit'
     122 |  return test_and_clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags);
         |         ^~~~~~~~~~~~~~~~~~
   drivers/pci/pcie/dpc.c: In function 'dpc_reset_link':
   drivers/pci/pcie/dpc.c:149:10: error: 'PCI_DPC_RECOVERING' undeclared (first use in this function)
     149 |  set_bit(PCI_DPC_RECOVERING, &pdev->priv_flags);
         |          ^~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:24: note: in definition of macro 'ATOMIC_BITOP'
     181 |  (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
         |                        ^~
   drivers/pci/pcie/dpc.c:149:2: note: in expansion of macro 'set_bit'
     149 |  set_bit(PCI_DPC_RECOVERING, &pdev->priv_flags);
         |  ^~~~~~~
   drivers/pci/pcie/dpc.c:165:13: error: 'PCI_DPC_RECOVERED' undeclared (first use in this function)
     165 |   clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags);
         |             ^~~~~~~~~~~~~~~~~
   arch/arm/include/asm/bitops.h:181:24: note: in definition of macro 'ATOMIC_BITOP'
     181 |  (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
         |                        ^~
   drivers/pci/pcie/dpc.c:165:3: note: in expansion of macro 'clear_bit'
     165 |   clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags);
         |   ^~~~~~~~~
   drivers/pci/pcie/dpc.c: In function 'pci_dpc_recovered':
   drivers/pci/pcie/dpc.c:123:1: error: control reaches end of non-void function [-Werror=return-type]
     123 | }
         | ^
   cc1: some warnings being treated as errors


vim +/PCI_DPC_RECOVERING +85 drivers/pci/pcie/dpc.c

a97396c6eb13f65b Lukas Wunner 2021-05-01   75  
a97396c6eb13f65b Lukas Wunner 2021-05-01   76  #ifdef CONFIG_HOTPLUG_PCI_PCIE
a97396c6eb13f65b Lukas Wunner 2021-05-01   77  static bool dpc_completed(struct pci_dev *pdev)
a97396c6eb13f65b Lukas Wunner 2021-05-01   78  {
a97396c6eb13f65b Lukas Wunner 2021-05-01   79  	u16 status;
a97396c6eb13f65b Lukas Wunner 2021-05-01   80  
a97396c6eb13f65b Lukas Wunner 2021-05-01   81  	pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_STATUS, &status);
a97396c6eb13f65b Lukas Wunner 2021-05-01   82  	if ((status != 0xffff) && (status & PCI_EXP_DPC_STATUS_TRIGGER))
a97396c6eb13f65b Lukas Wunner 2021-05-01   83  		return false;
a97396c6eb13f65b Lukas Wunner 2021-05-01   84  
a97396c6eb13f65b Lukas Wunner 2021-05-01  @85  	if (test_bit(PCI_DPC_RECOVERING, &pdev->priv_flags))
a97396c6eb13f65b Lukas Wunner 2021-05-01   86  		return false;
a97396c6eb13f65b Lukas Wunner 2021-05-01   87  
a97396c6eb13f65b Lukas Wunner 2021-05-01   88  	return true;
a97396c6eb13f65b Lukas Wunner 2021-05-01   89  }
a97396c6eb13f65b Lukas Wunner 2021-05-01   90  
a97396c6eb13f65b Lukas Wunner 2021-05-01   91  /**
a97396c6eb13f65b Lukas Wunner 2021-05-01   92   * pci_dpc_recovered - whether DPC triggered and has recovered successfully
a97396c6eb13f65b Lukas Wunner 2021-05-01   93   * @pdev: PCI device
a97396c6eb13f65b Lukas Wunner 2021-05-01   94   *
a97396c6eb13f65b Lukas Wunner 2021-05-01   95   * Return true if DPC was triggered for @pdev and has recovered successfully.
a97396c6eb13f65b Lukas Wunner 2021-05-01   96   * Wait for recovery if it hasn't completed yet.  Called from the PCIe hotplug
a97396c6eb13f65b Lukas Wunner 2021-05-01   97   * driver to recognize and ignore Link Down/Up events caused by DPC.
a97396c6eb13f65b Lukas Wunner 2021-05-01   98   */
a97396c6eb13f65b Lukas Wunner 2021-05-01   99  bool pci_dpc_recovered(struct pci_dev *pdev)
a97396c6eb13f65b Lukas Wunner 2021-05-01  100  {
a97396c6eb13f65b Lukas Wunner 2021-05-01  101  	struct pci_host_bridge *host;
a97396c6eb13f65b Lukas Wunner 2021-05-01  102  
a97396c6eb13f65b Lukas Wunner 2021-05-01  103  	if (!pdev->dpc_cap)
a97396c6eb13f65b Lukas Wunner 2021-05-01  104  		return false;
a97396c6eb13f65b Lukas Wunner 2021-05-01  105  
a97396c6eb13f65b Lukas Wunner 2021-05-01  106  	/*
a97396c6eb13f65b Lukas Wunner 2021-05-01  107  	 * Synchronization between hotplug and DPC is not supported
a97396c6eb13f65b Lukas Wunner 2021-05-01  108  	 * if DPC is owned by firmware and EDR is not enabled.
a97396c6eb13f65b Lukas Wunner 2021-05-01  109  	 */
a97396c6eb13f65b Lukas Wunner 2021-05-01  110  	host = pci_find_host_bridge(pdev->bus);
a97396c6eb13f65b Lukas Wunner 2021-05-01  111  	if (!host->native_dpc && !IS_ENABLED(CONFIG_PCIE_EDR))
a97396c6eb13f65b Lukas Wunner 2021-05-01  112  		return false;
a97396c6eb13f65b Lukas Wunner 2021-05-01  113  
a97396c6eb13f65b Lukas Wunner 2021-05-01  114  	/*
a97396c6eb13f65b Lukas Wunner 2021-05-01  115  	 * Need a timeout in case DPC never completes due to failure of
a97396c6eb13f65b Lukas Wunner 2021-05-01  116  	 * dpc_wait_rp_inactive().  The spec doesn't mandate a time limit,
a97396c6eb13f65b Lukas Wunner 2021-05-01  117  	 * but reports indicate that DPC completes within 4 seconds.
a97396c6eb13f65b Lukas Wunner 2021-05-01  118  	 */
a97396c6eb13f65b Lukas Wunner 2021-05-01  119  	wait_event_timeout(dpc_completed_waitqueue, dpc_completed(pdev),
a97396c6eb13f65b Lukas Wunner 2021-05-01  120  			   msecs_to_jiffies(4000));
a97396c6eb13f65b Lukas Wunner 2021-05-01  121  
a97396c6eb13f65b Lukas Wunner 2021-05-01 @122  	return test_and_clear_bit(PCI_DPC_RECOVERED, &pdev->priv_flags);
a97396c6eb13f65b Lukas Wunner 2021-05-01  123  }
a97396c6eb13f65b Lukas Wunner 2021-05-01  124  #endif /* CONFIG_HOTPLUG_PCI_PCIE */
a97396c6eb13f65b Lukas Wunner 2021-05-01  125  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 40907 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20210720/eb4164d7/attachment-0001.gz>


More information about the Linuxppc-dev mailing list