Re: [PATCH 3/5] PCI: Move pci_dev_is/assign_added() to pci.h

2021-09-07 Thread Niklas Schnelle
On Tue, 2021-09-07 at 10:51 +0300, Andy Shevchenko wrote:
> On Tue, Sep 7, 2021 at 3:26 AM kernel test robot  wrote:
> > Hi Niklas,
> > 
> > I love your patch! Yet something to improve:
> > 
> > [auto build test ERROR on s390/features]
> > [also build test ERROR on next-20210906]
> > [cannot apply to pci/next powerpc/next v5.14]
> > [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/s390-pci-automatic-error-recovery/20210906-175309
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git 
> > features
> > config: i386-allyesconfig (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > reproduce (this is a W=1 build):
> > # 
> > https://github.com/0day-ci/linux/commit/404ed8c00a612e7ae31c50557c80c6726c464863
> > git remote add linux-review https://github.com/0day-ci/linux
> > git fetch --no-tags linux-review 
> > Niklas-Schnelle/s390-pci-automatic-error-recovery/20210906-175309
> > git checkout 404ed8c00a612e7ae31c50557c80c6726c464863
> > # save the attached .config to linux build tree
> > make W=1 ARCH=i386
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > 
> > All errors (new ones prefixed by >>):
> 
> Obviously drivers/pci/pci.h is not only for the above.
> 
> When play with headers always do two test builds: allyesconfig and 
> allmodconfig.

You're right and additionally have to built on some other architectures
as well because allyesconfig and allmodconfig both run through fine on
s390. 

I'll look into it but at first glance it looks like I was over reaching
removing the include from drivers/pci/hotplug/acpiphp_glue.c in
addition it's not even the same kind of awkward relative include from
drivers into arch code. Sorry about that.

> 



Re: [PATCH 3/5] PCI: Move pci_dev_is/assign_added() to pci.h

2021-09-07 Thread Andy Shevchenko
On Tue, Sep 7, 2021 at 3:26 AM kernel test robot  wrote:
>
> Hi Niklas,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on s390/features]
> [also build test ERROR on next-20210906]
> [cannot apply to pci/next powerpc/next v5.14]
> [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/s390-pci-automatic-error-recovery/20210906-175309
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git 
> features
> config: i386-allyesconfig (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce (this is a W=1 build):
> # 
> https://github.com/0day-ci/linux/commit/404ed8c00a612e7ae31c50557c80c6726c464863
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review 
> Niklas-Schnelle/s390-pci-automatic-error-recovery/20210906-175309
> git checkout 404ed8c00a612e7ae31c50557c80c6726c464863
> # save the attached .config to linux build tree
> make W=1 ARCH=i386
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
>
> All errors (new ones prefixed by >>):

Obviously drivers/pci/pci.h is not only for the above.

When play with headers always do two test builds: allyesconfig and allmodconfig.

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH 3/5] PCI: Move pci_dev_is/assign_added() to pci.h

2021-09-06 Thread kernel test robot
Hi Niklas,

I love your patch! Yet something to improve:

[auto build test ERROR on s390/features]
[also build test ERROR on next-20210906]
[cannot apply to pci/next powerpc/next v5.14]
[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/s390-pci-automatic-error-recovery/20210906-175309
base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# 
https://github.com/0day-ci/linux/commit/404ed8c00a612e7ae31c50557c80c6726c464863
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Niklas-Schnelle/s390-pci-automatic-error-recovery/20210906-175309
git checkout 404ed8c00a612e7ae31c50557c80c6726c464863
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   drivers/pci/hotplug/acpiphp_glue.c: In function 'acpiphp_add_context':
>> drivers/pci/hotplug/acpiphp_glue.c:330:6: error: implicit declaration of 
>> function 'pci_bus_read_dev_vendor_id' [-Werror=implicit-function-declaration]
 330 |  if (pci_bus_read_dev_vendor_id(pbus, PCI_DEVFN(device, function),
 |  ^~
   drivers/pci/hotplug/acpiphp_glue.c: In function 'enable_slot':
>> drivers/pci/hotplug/acpiphp_glue.c:505:6: error: implicit declaration of 
>> function '__pci_bus_size_bridges'; did you mean 'pci_bus_size_bridges'? 
>> [-Werror=implicit-function-declaration]
 505 |  __pci_bus_size_bridges(dev->subordinate,
 |  ^~
 |  pci_bus_size_bridges
>> drivers/pci/hotplug/acpiphp_glue.c:510:3: error: implicit declaration of 
>> function '__pci_bus_assign_resources'; did you mean 
>> 'pci_bus_assign_resources'? [-Werror=implicit-function-declaration]
 510 |   __pci_bus_assign_resources(bus, _list, NULL);
 |   ^~
 |   pci_bus_assign_resources
   drivers/pci/hotplug/acpiphp_glue.c: In function 'trim_stale_devices':
>> drivers/pci/hotplug/acpiphp_glue.c:660:3: error: implicit declaration of 
>> function 'pci_dev_set_disconnected' [-Werror=implicit-function-declaration]
 660 |   pci_dev_set_disconnected(dev, NULL);
 |   ^~~~
>> drivers/pci/hotplug/acpiphp_glue.c:661:7: error: implicit declaration of 
>> function 'pci_has_subordinate' [-Werror=implicit-function-declaration]
 661 |   if (pci_has_subordinate(dev))
 |   ^~~
   cc1: some warnings being treated as errors


vim +/pci_bus_read_dev_vendor_id +330 drivers/pci/hotplug/acpiphp_glue.c

4e8662bbd680c5 Kristen Accardi   2006-06-28  217  
3799c5a032aefb Rafael J. Wysocki 2014-02-16  218  /**
3799c5a032aefb Rafael J. Wysocki 2014-02-16  219   * acpiphp_add_context - Add 
ACPIPHP context to an ACPI device object.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  220   * @handle: ACPI handle of 
the object to add a context to.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  221   * @lvl: Not used.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  222   * @data: The object's parent 
ACPIPHP bridge.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  223   * @rv: Not used.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  224   */
3799c5a032aefb Rafael J. Wysocki 2014-02-16  225  static acpi_status 
acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13  226
   void **rv)
^1da177e4c3f41 Linus Torvalds2005-04-16  227  {
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13  228struct acpiphp_bridge 
*bridge = data;
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13  229struct acpiphp_context 
*context;
bbcbfc0eed6220 Rafael J. Wysocki 2014-02-04  230struct acpi_device 
*adev;
^1da177e4c3f41 Linus Torvalds2005-04-16  231struct acpiphp_slot 
*slot;
^1da177e4c3f41 Linus Torvalds2005-04-16  232struct acpiphp_func 
*newfunc;
^1da177e4c3f41 Linus Torvalds2005-04-16  233acpi_status status = 
AE_OK;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13  234unsigned long long adr;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13  235int device, function;
e8c331e963c58b Kenji Kaneshige   2008-12-17  236struct pci_bus *pbus = 
bridge->pci_bus;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13  237struct pci_dev *pdev = 
bridge->pci_dev;
3b63aaa70e1ccc Jiang Liu 2013-04-12  238u32 val;
^1da177e4c3f41 Linus Torvalds2005-04-16  239  
dfb117b3e50c52 Bjorn Helgaas 2012-06-20  240status = 
acpi_evaluate_integer(handle, 

Re: [PATCH 3/5] PCI: Move pci_dev_is/assign_added() to pci.h

2021-09-06 Thread kernel test robot
Hi Niklas,

I love your patch! Yet something to improve:

[auto build test ERROR on s390/features]
[also build test ERROR on next-20210906]
[cannot apply to pci/next powerpc/next v5.14]
[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/s390-pci-automatic-error-recovery/20210906-175309
base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: i386-randconfig-a016-20210906 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
6fe2beba7d2a41964af658c8c59dd172683ef739)
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/404ed8c00a612e7ae31c50557c80c6726c464863
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Niklas-Schnelle/s390-pci-automatic-error-recovery/20210906-175309
git checkout 404ed8c00a612e7ae31c50557c80c6726c464863
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/pci/hotplug/acpiphp_glue.c:330:6: error: implicit declaration of 
>> function 'pci_bus_read_dev_vendor_id' 
>> [-Werror,-Wimplicit-function-declaration]
   if (pci_bus_read_dev_vendor_id(pbus, PCI_DEVFN(device, function),
   ^
>> drivers/pci/hotplug/acpiphp_glue.c:505:6: error: implicit declaration of 
>> function '__pci_bus_size_bridges' [-Werror,-Wimplicit-function-declaration]
   
__pci_bus_size_bridges(dev->subordinate,
   ^
   drivers/pci/hotplug/acpiphp_glue.c:505:6: note: did you mean 
'pci_bus_size_bridges'?
   include/linux/pci.h:1336:6: note: 'pci_bus_size_bridges' declared here
   void pci_bus_size_bridges(struct pci_bus *bus);
^
>> drivers/pci/hotplug/acpiphp_glue.c:510:3: error: implicit declaration of 
>> function '__pci_bus_assign_resources' 
>> [-Werror,-Wimplicit-function-declaration]
   __pci_bus_assign_resources(bus, _list, NULL);
   ^
   drivers/pci/hotplug/acpiphp_glue.c:510:3: note: did you mean 
'pci_bus_assign_resources'?
   include/linux/pci.h:1334:6: note: 'pci_bus_assign_resources' declared here
   void pci_bus_assign_resources(const struct pci_bus *bus);
^
   drivers/pci/hotplug/acpiphp_glue.c:604:8: error: implicit declaration of 
function 'pci_bus_read_dev_vendor_id' [-Werror,-Wimplicit-function-declaration]
   if (pci_bus_read_dev_vendor_id(slot->bus,
   ^
   drivers/pci/hotplug/acpiphp_glue.c:619:7: error: implicit declaration of 
function 'pci_bus_read_dev_vendor_id' [-Werror,-Wimplicit-function-declaration]
   if (pci_bus_read_dev_vendor_id(slot->bus,
   ^
>> drivers/pci/hotplug/acpiphp_glue.c:660:3: error: implicit declaration of 
>> function 'pci_dev_set_disconnected' [-Werror,-Wimplicit-function-declaration]
   pci_dev_set_disconnected(dev, NULL);
   ^
>> drivers/pci/hotplug/acpiphp_glue.c:661:7: error: implicit declaration of 
>> function 'pci_has_subordinate' [-Werror,-Wimplicit-function-declaration]
   if (pci_has_subordinate(dev))
   ^
   7 errors generated.


vim +/pci_bus_read_dev_vendor_id +330 drivers/pci/hotplug/acpiphp_glue.c

4e8662bbd680c5 Kristen Accardi   2006-06-28  217  
3799c5a032aefb Rafael J. Wysocki 2014-02-16  218  /**
3799c5a032aefb Rafael J. Wysocki 2014-02-16  219   * acpiphp_add_context - Add 
ACPIPHP context to an ACPI device object.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  220   * @handle: ACPI handle of 
the object to add a context to.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  221   * @lvl: Not used.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  222   * @data: The object's parent 
ACPIPHP bridge.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  223   * @rv: Not used.
3799c5a032aefb Rafael J. Wysocki 2014-02-16  224   */
3799c5a032aefb Rafael J. Wysocki 2014-02-16  225  static acpi_status 
acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13  226
   void **rv)
^1da177e4c3f41 Linus Torvalds2005-04-16  227  {
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13  228struct acpiphp_bridge 
*bridge = data;
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13  229struct acpiphp_context 
*context;
bbcbfc0eed6220 Rafael J. Wysocki 2014-02-04  230struct 

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

2021-09-06 Thread Niklas Schnelle
The helper function pci_dev_is_added() from drivers/pci/pci.h is used in
PCI arch code of both s390 and powerpc leading to awkward relative
includes. Move it to the global include/linux/pci.h and get rid of these
includes just for that one function.

Signed-off-by: Niklas Schnelle 
---
 arch/powerpc/platforms/powernv/pci-sriov.c |  3 ---
 arch/powerpc/platforms/pseries/setup.c |  1 -
 arch/s390/pci/pci_sysfs.c  |  2 --
 drivers/pci/hotplug/acpiphp_glue.c |  1 -
 drivers/pci/pci.h  | 15 ---
 include/linux/pci.h| 15 +++
 6 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c 
b/arch/powerpc/platforms/powernv/pci-sriov.c
index 28aac933a439..2e0ca5451e85 100644
--- a/arch/powerpc/platforms/powernv/pci-sriov.c
+++ b/arch/powerpc/platforms/powernv/pci-sriov.c
@@ -9,9 +9,6 @@
 
 #include "pci.h"
 
-/* for pci_dev_is_added() */
-#include "../../../../drivers/pci/pci.h"
-
 /*
  * The majority of the complexity in supporting SR-IOV on PowerNV comes from
  * the need to put the MMIO space for each VF into a separate PE. Internally
diff --git a/arch/powerpc/platforms/pseries/setup.c 
b/arch/powerpc/platforms/pseries/setup.c
index 0dfaa6ab44cc..08e846ae1853 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -74,7 +74,6 @@
 #include 
 
 #include "pseries.h"
-#include "../../../../drivers/pci/pci.h"
 
 DEFINE_STATIC_KEY_FALSE(shared_processor);
 EXPORT_SYMBOL(shared_processor);
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index 335c281811c7..40733b93a086 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -13,8 +13,6 @@
 #include 
 #include 
 
-#include "../../../drivers/pci/pci.h"
-
 #include 
 
 #define zpci_attr(name, fmt, member)   \
diff --git a/drivers/pci/hotplug/acpiphp_glue.c 
b/drivers/pci/hotplug/acpiphp_glue.c
index f031302ad401..4cb963f88183 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -38,7 +38,6 @@
 #include 
 #include 
 
-#include "../pci.h"
 #include "acpiphp.h"
 
 static LIST_HEAD(bridge_list);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 93dcdd431072..a159cd0f6f05 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -383,21 +383,6 @@ static inline bool pci_dev_is_disconnected(const struct 
pci_dev *dev)
return dev->error_state == pci_channel_io_perm_failure;
 }
 
-/* pci_dev priv_flags */
-#define PCI_DEV_ADDED 0
-#define PCI_DPC_RECOVERED 1
-#define PCI_DPC_RECOVERING 2
-
-static inline void pci_dev_assign_added(struct pci_dev *dev, bool added)
-{
-   assign_bit(PCI_DEV_ADDED, >priv_flags, added);
-}
-
-static inline bool pci_dev_is_added(const struct pci_dev *dev)
-{
-   return test_bit(PCI_DEV_ADDED, >priv_flags);
-}
-
 #ifdef CONFIG_PCIEAER
 #include 
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 540b377ca8f6..ea0e23dbc8ec 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -507,6 +507,21 @@ struct pci_dev {
unsigned long   priv_flags; /* Private flags for the PCI driver */
 };
 
+/* pci_dev priv_flags */
+#define PCI_DEV_ADDED 0
+#define PCI_DPC_RECOVERED 1
+#define PCI_DPC_RECOVERING 2
+
+static inline void pci_dev_assign_added(struct pci_dev *dev, bool added)
+{
+   assign_bit(PCI_DEV_ADDED, >priv_flags, added);
+}
+
+static inline bool pci_dev_is_added(const struct pci_dev *dev)
+{
+   return test_bit(PCI_DEV_ADDED, >priv_flags);
+}
+
 static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
 {
 #ifdef CONFIG_PCI_IOV
-- 
2.25.1