IOMMU Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] PCI: Remove unused includes and superfluous struct declaration
@ 2019-09-01 11:25 Krzysztof Wilczynski
  2019-09-02  3:55 ` kbuild test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Krzysztof Wilczynski @ 2019-09-01 11:25 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: devicetree, Jingoo Han, linux-pci, linux-kernel, iommu,
	Rob Herring, Thomas Petazzoni, Gustavo Pimentel, Frank Rowand,
	linux-arm-kernel

Remove <linux/pci.h> and <linux/msi.h> from being included
directly as part of the include/linux/of_pci.h, and remove
superfluous declaration of struct of_phandle_args.

Move users of include <linux/of_pci.h> to include <linux/pci.h>
and <linux/msi.h> directly rather than rely on both being
included transitively through <linux/of_pci.h>.

Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
---
 drivers/iommu/of_iommu.c                          | 2 ++
 drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
 drivers/pci/controller/pci-aardvark.c             | 1 +
 drivers/pci/pci.c                                 | 1 +
 drivers/pci/probe.c                               | 1 +
 include/linux/of_pci.h                            | 4 +---
 6 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 614a93aa5305..026ad2b29dcd 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -8,6 +8,8 @@
 #include <linux/export.h>
 #include <linux/iommu.h>
 #include <linux/limits.h>
+#include <linux/pci.h>
+#include <linux/msi.h>
 #include <linux/of.h>
 #include <linux/of_iommu.h>
 #include <linux/of_pci.h>
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index d3156446ff27..7a9bef993e57 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -10,6 +10,7 @@
 
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqdomain.h>
+#include <linux/msi.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 #include <linux/pci_regs.h>
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index fc0fe4d4de49..3a05f6ca95b0 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -16,6 +16,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/msi.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 484e35349565..571e7e00984b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -13,6 +13,7 @@
 #include <linux/delay.h>
 #include <linux/dmi.h>
 #include <linux/init.h>
+#include <linux/msi.h>
 #include <linux/of.h>
 #include <linux/of_pci.h>
 #include <linux/pci.h>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 169943f17a4c..11b11a652d18 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -7,6 +7,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/pci.h>
+#include <linux/msi.h>
 #include <linux/of_device.h>
 #include <linux/of_pci.h>
 #include <linux/pci_hotplug.h>
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 21a89c4880fa..7929b4c0e886 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -2,11 +2,9 @@
 #ifndef __OF_PCI_H
 #define __OF_PCI_H
 
-#include <linux/pci.h>
-#include <linux/msi.h>
+#include <linux/types.h>
 
 struct pci_dev;
-struct of_phandle_args;
 struct device_node;
 
 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI)
-- 
2.23.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] PCI: Remove unused includes and superfluous struct declaration
  2019-09-01 11:25 [PATCH] PCI: Remove unused includes and superfluous struct declaration Krzysztof Wilczynski
@ 2019-09-02  3:55 ` kbuild test robot
  2019-09-02  6:31 ` kbuild test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2019-09-02  3:55 UTC (permalink / raw)
  To: Krzysztof Wilczynski
  Cc: devicetree, Jingoo Han, linux-pci, linux-kernel, iommu,
	Rob Herring, Bjorn Helgaas, kbuild-all, Thomas Petazzoni,
	Gustavo Pimentel, Frank Rowand, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

Hi Krzysztof,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Krzysztof-Wilczynski/PCI-Remove-unused-includes-and-superfluous-struct-declaration/20190902-040019
config: x86_64-randconfig-f004-201935 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from <command-line>:0:0:
   include/linux/of_pci.h: In function 'of_pci_get_devfn':
>> include/linux/of_pci.h:24:10: error: 'EINVAL' undeclared (first use in this function)
     return -EINVAL;
             ^~~~~~
   include/linux/of_pci.h:24:10: note: each undeclared identifier is reported only once for each function it appears in

vim +/EINVAL +24 include/linux/of_pci.h

64c5c759084e153 Arnd Bergmann 2014-06-04  21  
64c5c759084e153 Arnd Bergmann 2014-06-04  22  static inline int of_pci_get_devfn(struct device_node *np)
64c5c759084e153 Arnd Bergmann 2014-06-04  23  {
64c5c759084e153 Arnd Bergmann 2014-06-04 @24  	return -EINVAL;
64c5c759084e153 Arnd Bergmann 2014-06-04  25  }
64c5c759084e153 Arnd Bergmann 2014-06-04  26  

:::::: The code at line 24 was first introduced by commit
:::::: 64c5c759084e153272eb05f4103de3e0adf5a88a of/irq: provide more wrappers for !CONFIG_OF

:::::: TO: Arnd Bergmann <arnd@arndb.de>
:::::: CC: Rob Herring <robh@kernel.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32244 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] PCI: Remove unused includes and superfluous struct declaration
  2019-09-01 11:25 [PATCH] PCI: Remove unused includes and superfluous struct declaration Krzysztof Wilczynski
  2019-09-02  3:55 ` kbuild test robot
@ 2019-09-02  6:31 ` kbuild test robot
  2019-09-02 13:39 ` Rob Herring
  2019-09-03 11:30 ` [PATCH v2] " Krzysztof Wilczynski
  3 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2019-09-02  6:31 UTC (permalink / raw)
  To: Krzysztof Wilczynski
  Cc: devicetree, Jingoo Han, linux-pci, linux-kernel, iommu,
	Rob Herring, Bjorn Helgaas, kbuild-all, Thomas Petazzoni,
	Gustavo Pimentel, Frank Rowand, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 18112 bytes --]

Hi Krzysztof,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Krzysztof-Wilczynski/PCI-Remove-unused-includes-and-superfluous-struct-declaration/20190902-040019
config: arm64-defconfig (attached as .config)
compiler: aarch64-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=arm64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/list.h:9:0,
                    from include/linux/kobject.h:19,
                    from include/linux/of.h:17,
                    from include/linux/irqdomain.h:35,
                    from include/linux/acpi.h:13,
                    from include/linux/acpi_iort.h:10,
                    from drivers/irqchip/irq-gic-v3-its-pci-msi.c:7:
   drivers/irqchip/irq-gic-v3-its-pci-msi.c: In function 'its_pci_msi_vec_count':
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:37:12: error: implicit declaration of function 'pci_msi_vec_count'; did you mean 'its_pci_msi_vec_count'? [-Werror=implicit-function-declaration]
     msi = max(pci_msi_vec_count(pdev), 0);
               ^
   include/linux/kernel.h:821:22: note: in definition of macro '__typecheck'
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                         ^
   include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
    #define max(x, y) __careful_cmp(x, y, >)
                      ^~~~~~~~~~~~~
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:37:8: note: in expansion of macro 'max'
     msi = max(pci_msi_vec_count(pdev), 0);
           ^~~
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:38:13: error: implicit declaration of function 'pci_msix_vec_count'; did you mean 'its_pci_msi_vec_count'? [-Werror=implicit-function-declaration]
     msix = max(pci_msix_vec_count(pdev), 0);
                ^
   include/linux/kernel.h:821:22: note: in definition of macro '__typecheck'
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                         ^
   include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
    #define max(x, y) __careful_cmp(x, y, >)
                      ^~~~~~~~~~~~~
   drivers/irqchip/irq-gic-v3-its-pci-msi.c:38:9: note: in expansion of macro 'max'
     msix = max(pci_msix_vec_count(pdev), 0);
            ^~~
   drivers/irqchip/irq-gic-v3-its-pci-msi.c: In function 'its_pci_msi_prepare':
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:60:7: error: implicit declaration of function 'dev_is_pci'; did you mean 'dev_to_psd'? [-Werror=implicit-function-declaration]
     if (!dev_is_pci(dev))
          ^~~~~~~~~~
          dev_to_psd
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:65:9: error: implicit declaration of function 'to_pci_dev'; did you mean 'atomic_dec'? [-Werror=implicit-function-declaration]
     pdev = to_pci_dev(dev);
            ^~~~~~~~~~
            atomic_dec
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:65:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     pdev = to_pci_dev(dev);
          ^
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:70:2: error: implicit declaration of function 'pci_for_each_dma_alias'; did you mean 'xas_for_each_conflict'? [-Werror=implicit-function-declaration]
     pci_for_each_dma_alias(pdev, its_get_pci_alias, &alias_dev);
     ^~~~~~~~~~~~~~~~~~~~~~
     xas_for_each_conflict
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:71:36: error: dereferencing pointer to incomplete type 'struct pci_dev'
     if (alias_dev != pdev && alias_dev->subordinate)
                                       ^~
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:72:3: error: implicit declaration of function 'pci_walk_bus' [-Werror=implicit-function-declaration]
      pci_walk_bus(alias_dev->subordinate, its_pci_msi_vec_count,
      ^~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/irqchip/irq-gic-v2m.c: In function 'gicv2m_acpi_init':
>> drivers/irqchip/irq-gic-v2m.c:558:2: error: implicit declaration of function 'pci_msi_register_fwnode_provider'; did you mean 'acpi_bus_register_driver'? [-Werror=implicit-function-declaration]
     pci_msi_register_fwnode_provider(&gicv2m_get_fwnode);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     acpi_bus_register_driver
   cc1: some warnings being treated as errors
--
   In file included from drivers/pci/controller/pci-thunder-pem.c:11:0:
   include/linux/pci-acpi.h: In function 'acpi_find_root_bridge_handle':
>> include/linux/pci-acpi.h:34:29: error: dereferencing pointer to incomplete type 'struct pci_dev'
     struct pci_bus *pbus = pdev->bus;
                                ^~
>> include/linux/pci-acpi.h:37:10: error: implicit declaration of function 'pci_is_root_bus'; did you mean 'acpi_is_root_bridge'? [-Werror=implicit-function-declaration]
     while (!pci_is_root_bus(pbus))
             ^~~~~~~~~~~~~~~
             acpi_is_root_bridge
>> include/linux/pci-acpi.h:38:14: error: dereferencing pointer to incomplete type 'struct pci_bus'
      pbus = pbus->parent;
                 ^~
   In file included from include/linux/acpi.h:32:0,
                    from include/linux/pci-acpi.h:12,
                    from drivers/pci/controller/pci-thunder-pem.c:11:
>> include/acpi/acpi_bus.h:411:23: warning: passing argument 1 of 'is_acpi_device_node' makes pointer from integer without a cast [-Wint-conversion]
      is_acpi_device_node(__to_acpi_device_node_fwnode) ? \
                          ^
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
    #define ACPI_COMPANION(dev)  to_acpi_device_node((dev)->fwnode)
                                 ^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
    #define ACPI_HANDLE(dev)  acpi_device_handle(ACPI_COMPANION(dev))
                                                 ^~~~~~~~~~~~~~
>> include/linux/pci-acpi.h:40:9: note: in expansion of macro 'ACPI_HANDLE'
     return ACPI_HANDLE(pbus->bridge);
            ^~~~~~~~~~~
   include/acpi/acpi_bus.h:399:6: note: expected 'const struct fwnode_handle *' but argument is of type 'int'
    bool is_acpi_device_node(const struct fwnode_handle *fwnode);
         ^~~~~~~~~~~~~~~~~~~
   In file included from drivers/pci/controller/pci-thunder-pem.c:7:0:
>> include/linux/kernel.h:972:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     void *__mptr = (void *)(ptr);     \
                    ^
>> include/acpi/acpi_bus.h:412:4: note: in expansion of macro 'container_of'
       container_of(__to_acpi_device_node_fwnode, \
       ^~~~~~~~~~~~
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
    #define ACPI_COMPANION(dev)  to_acpi_device_node((dev)->fwnode)
                                 ^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
    #define ACPI_HANDLE(dev)  acpi_device_handle(ACPI_COMPANION(dev))
                                                 ^~~~~~~~~~~~~~
>> include/linux/pci-acpi.h:40:9: note: in expansion of macro 'ACPI_HANDLE'
     return ACPI_HANDLE(pbus->bridge);
            ^~~~~~~~~~~
   In file included from include/linux/build_bug.h:5:0,
                    from include/linux/bitfield.h:10,
                    from drivers/pci/controller/pci-thunder-pem.c:6:
>> include/linux/kernel.h:973:32: error: invalid type argument of unary '*' (have 'int')
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                                   ^~~~~~
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^~~~~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:973:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:973:20: note: in expansion of macro '__same_type'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
                       ^~~~~~~~~~~
>> include/acpi/acpi_bus.h:412:4: note: in expansion of macro 'container_of'
       container_of(__to_acpi_device_node_fwnode, \
       ^~~~~~~~~~~~
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
    #define ACPI_COMPANION(dev)  to_acpi_device_node((dev)->fwnode)
                                 ^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
    #define ACPI_HANDLE(dev)  acpi_device_handle(ACPI_COMPANION(dev))
                                                 ^~~~~~~~~~~~~~
>> include/linux/pci-acpi.h:40:9: note: in expansion of macro 'ACPI_HANDLE'
     return ACPI_HANDLE(pbus->bridge);
            ^~~~~~~~~~~
   include/linux/kernel.h:974:18: error: invalid type argument of unary '*' (have 'int')
        !__same_type(*(ptr), void),   \
                     ^~~~~~
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
      if (!(condition))     \
            ^~~~~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
     ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                        ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:973:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
     ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:974:6: note: in expansion of macro '__same_type'
        !__same_type(*(ptr), void),   \
         ^~~~~~~~~~~
>> include/acpi/acpi_bus.h:412:4: note: in expansion of macro 'container_of'
       container_of(__to_acpi_device_node_fwnode, \
       ^~~~~~~~~~~~
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
    #define ACPI_COMPANION(dev)  to_acpi_device_node((dev)->fwnode)
                                 ^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
    #define ACPI_HANDLE(dev)  acpi_device_handle(ACPI_COMPANION(dev))
                                                 ^~~~~~~~~~~~~~

vim +71 drivers/irqchip/irq-gic-v3-its-pci-msi.c

723344dd0b2aa1 Tomasz Nowicki 2016-09-12  @7  #include <linux/acpi_iort.h>
f130420e51df30 Marc Zyngier   2015-07-28   8  #include <linux/msi.h>
f130420e51df30 Marc Zyngier   2015-07-28   9  #include <linux/of.h>
f130420e51df30 Marc Zyngier   2015-07-28  10  #include <linux/of_irq.h>
f130420e51df30 Marc Zyngier   2015-07-28  11  #include <linux/of_pci.h>
f130420e51df30 Marc Zyngier   2015-07-28  12  
f130420e51df30 Marc Zyngier   2015-07-28  13  static void its_mask_msi_irq(struct irq_data *d)
f130420e51df30 Marc Zyngier   2015-07-28  14  {
f130420e51df30 Marc Zyngier   2015-07-28  15  	pci_msi_mask_irq(d);
f130420e51df30 Marc Zyngier   2015-07-28  16  	irq_chip_mask_parent(d);
f130420e51df30 Marc Zyngier   2015-07-28  17  }
f130420e51df30 Marc Zyngier   2015-07-28  18  
f130420e51df30 Marc Zyngier   2015-07-28  19  static void its_unmask_msi_irq(struct irq_data *d)
f130420e51df30 Marc Zyngier   2015-07-28  20  {
f130420e51df30 Marc Zyngier   2015-07-28  21  	pci_msi_unmask_irq(d);
f130420e51df30 Marc Zyngier   2015-07-28  22  	irq_chip_unmask_parent(d);
f130420e51df30 Marc Zyngier   2015-07-28  23  }
f130420e51df30 Marc Zyngier   2015-07-28  24  
f130420e51df30 Marc Zyngier   2015-07-28  25  static struct irq_chip its_msi_irq_chip = {
f130420e51df30 Marc Zyngier   2015-07-28  26  	.name			= "ITS-MSI",
f130420e51df30 Marc Zyngier   2015-07-28  27  	.irq_unmask		= its_unmask_msi_irq,
f130420e51df30 Marc Zyngier   2015-07-28  28  	.irq_mask		= its_mask_msi_irq,
f130420e51df30 Marc Zyngier   2015-07-28  29  	.irq_eoi		= irq_chip_eoi_parent,
f130420e51df30 Marc Zyngier   2015-07-28  30  	.irq_write_msi_msg	= pci_msi_domain_write_msg,
f130420e51df30 Marc Zyngier   2015-07-28  31  };
f130420e51df30 Marc Zyngier   2015-07-28  32  
3403b0259d152c Robin Murphy   2017-05-31  33  static int its_pci_msi_vec_count(struct pci_dev *pdev, void *data)
f130420e51df30 Marc Zyngier   2015-07-28  34  {
3403b0259d152c Robin Murphy   2017-05-31  35  	int msi, msix, *count = data;
f130420e51df30 Marc Zyngier   2015-07-28  36  
f130420e51df30 Marc Zyngier   2015-07-28 @37  	msi = max(pci_msi_vec_count(pdev), 0);
f130420e51df30 Marc Zyngier   2015-07-28 @38  	msix = max(pci_msix_vec_count(pdev), 0);
3403b0259d152c Robin Murphy   2017-05-31  39  	*count += max(msi, msix);
f130420e51df30 Marc Zyngier   2015-07-28  40  
3403b0259d152c Robin Murphy   2017-05-31  41  	return 0;
f130420e51df30 Marc Zyngier   2015-07-28  42  }
f130420e51df30 Marc Zyngier   2015-07-28  43  
f130420e51df30 Marc Zyngier   2015-07-28  44  static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data)
f130420e51df30 Marc Zyngier   2015-07-28  45  {
3403b0259d152c Robin Murphy   2017-05-31  46  	struct pci_dev **alias_dev = data;
f130420e51df30 Marc Zyngier   2015-07-28  47  
3403b0259d152c Robin Murphy   2017-05-31  48  	*alias_dev = pdev;
f130420e51df30 Marc Zyngier   2015-07-28  49  
f130420e51df30 Marc Zyngier   2015-07-28  50  	return 0;
f130420e51df30 Marc Zyngier   2015-07-28  51  }
f130420e51df30 Marc Zyngier   2015-07-28  52  
f130420e51df30 Marc Zyngier   2015-07-28  53  static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
f130420e51df30 Marc Zyngier   2015-07-28  54  			       int nvec, msi_alloc_info_t *info)
f130420e51df30 Marc Zyngier   2015-07-28  55  {
3403b0259d152c Robin Murphy   2017-05-31  56  	struct pci_dev *pdev, *alias_dev;
54456db9a23753 Marc Zyngier   2015-07-28  57  	struct msi_domain_info *msi_info;
30800b3a1fb14c Marc Zyngier   2018-05-31  58  	int alias_count = 0, minnvec = 1;
f130420e51df30 Marc Zyngier   2015-07-28  59  
f130420e51df30 Marc Zyngier   2015-07-28 @60  	if (!dev_is_pci(dev))
f130420e51df30 Marc Zyngier   2015-07-28  61  		return -EINVAL;
f130420e51df30 Marc Zyngier   2015-07-28  62  
54456db9a23753 Marc Zyngier   2015-07-28  63  	msi_info = msi_get_domain_info(domain->parent);
54456db9a23753 Marc Zyngier   2015-07-28  64  
f130420e51df30 Marc Zyngier   2015-07-28 @65  	pdev = to_pci_dev(dev);
3403b0259d152c Robin Murphy   2017-05-31  66  	/*
3403b0259d152c Robin Murphy   2017-05-31  67  	 * If pdev is downstream of any aliasing bridges, take an upper
3403b0259d152c Robin Murphy   2017-05-31  68  	 * bound of how many other vectors could map to the same DevID.
3403b0259d152c Robin Murphy   2017-05-31  69  	 */
3403b0259d152c Robin Murphy   2017-05-31 @70  	pci_for_each_dma_alias(pdev, its_get_pci_alias, &alias_dev);
3403b0259d152c Robin Murphy   2017-05-31 @71  	if (alias_dev != pdev && alias_dev->subordinate)
3403b0259d152c Robin Murphy   2017-05-31 @72  		pci_walk_bus(alias_dev->subordinate, its_pci_msi_vec_count,
3403b0259d152c Robin Murphy   2017-05-31  73  			     &alias_count);
f130420e51df30 Marc Zyngier   2015-07-28  74  
54456db9a23753 Marc Zyngier   2015-07-28  75  	/* ITS specific DeviceID, as the core ITS ignores dev. */
ccf91e68a4357e David Daney    2015-10-08  76  	info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain, pdev);
54456db9a23753 Marc Zyngier   2015-07-28  77  
30800b3a1fb14c Marc Zyngier   2018-05-31  78  	/*
30800b3a1fb14c Marc Zyngier   2018-05-31  79  	 * Always allocate a power of 2, and special case device 0 for
30800b3a1fb14c Marc Zyngier   2018-05-31  80  	 * broken systems where the DevID is not wired (and all devices
30800b3a1fb14c Marc Zyngier   2018-05-31  81  	 * appear as DevID 0). For that reason, we generously allocate a
30800b3a1fb14c Marc Zyngier   2018-05-31  82  	 * minimum of 32 MSIs for DevID 0. If you want more because all
30800b3a1fb14c Marc Zyngier   2018-05-31  83  	 * your devices are aliasing to DevID 0, consider fixing your HW.
30800b3a1fb14c Marc Zyngier   2018-05-31  84  	 */
147c8f376e5526 Marc Zyngier   2018-05-27  85  	nvec = max(nvec, alias_count);
30800b3a1fb14c Marc Zyngier   2018-05-31  86  	if (!info->scratchpad[0].ul)
30800b3a1fb14c Marc Zyngier   2018-05-31  87  		minnvec = 32;
30800b3a1fb14c Marc Zyngier   2018-05-31  88  	nvec = max_t(int, minnvec, roundup_pow_of_two(nvec));
147c8f376e5526 Marc Zyngier   2018-05-27  89  	return msi_info->ops->msi_prepare(domain->parent, dev, nvec, info);
f130420e51df30 Marc Zyngier   2015-07-28  90  }
f130420e51df30 Marc Zyngier   2015-07-28  91  

:::::: The code at line 71 was first introduced by commit
:::::: 3403b0259d152c3ca67b32bb710f826bc17c0d16 irqchip/gic-v3-its: Fix MSI alias accounting

:::::: TO: Robin Murphy <robin.murphy@arm.com>
:::::: CC: Marc Zyngier <marc.zyngier@arm.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45257 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] PCI: Remove unused includes and superfluous struct declaration
  2019-09-01 11:25 [PATCH] PCI: Remove unused includes and superfluous struct declaration Krzysztof Wilczynski
  2019-09-02  3:55 ` kbuild test robot
  2019-09-02  6:31 ` kbuild test robot
@ 2019-09-02 13:39 ` Rob Herring
  2019-09-03 11:30 ` [PATCH v2] " Krzysztof Wilczynski
  3 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-09-02 13:39 UTC (permalink / raw)
  To: Krzysztof Wilczynski
  Cc: , devicetree, Jingoo Han, linux-pci, linux-kernel, iommu,
	Bjorn Helgaas, Thomas Petazzoni, Gustavo Pimentel, Frank Rowand,
	linux-arm-kernel

On Sun,  1 Sep 2019 13:25:06 +0200, Krzysztof Wilczynski wrote:
> Remove <linux/pci.h> and <linux/msi.h> from being included
> directly as part of the include/linux/of_pci.h, and remove
> superfluous declaration of struct of_phandle_args.
> 
> Move users of include <linux/of_pci.h> to include <linux/pci.h>
> and <linux/msi.h> directly rather than rely on both being
> included transitively through <linux/of_pci.h>.
> 
> Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
> ---
>  drivers/iommu/of_iommu.c                          | 2 ++
>  drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
>  drivers/pci/controller/pci-aardvark.c             | 1 +
>  drivers/pci/pci.c                                 | 1 +
>  drivers/pci/probe.c                               | 1 +
>  include/linux/of_pci.h                            | 4 +---
>  6 files changed, 7 insertions(+), 3 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] PCI: Remove unused includes and superfluous struct declaration
  2019-09-01 11:25 [PATCH] PCI: Remove unused includes and superfluous struct declaration Krzysztof Wilczynski
                   ` (2 preceding siblings ...)
  2019-09-02 13:39 ` Rob Herring
@ 2019-09-03 11:30 ` " Krzysztof Wilczynski
  2019-09-03 17:20   ` Rob Herring
  3 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Wilczynski @ 2019-09-03 11:30 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: devicetree, Jingoo Han, linux-pci, linux-kernel, iommu,
	Rob Herring, Thomas Petazzoni, Gustavo Pimentel, Frank Rowand,
	linux-arm-kernel

Remove <linux/pci.h> and <linux/msi.h> from being included
directly as part of the include/linux/of_pci.h, and remove
superfluous declaration of struct of_phandle_args.

Move users of include <linux/of_pci.h> to include <linux/pci.h>
and <linux/msi.h> directly rather than rely on both being
included transitively through <linux/of_pci.h>.

Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
---
 drivers/iommu/of_iommu.c                          | 2 ++
 drivers/irqchip/irq-gic-v2m.c                     | 1 +
 drivers/irqchip/irq-gic-v3-its-pci-msi.c          | 1 +
 drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
 drivers/pci/controller/pci-aardvark.c             | 1 +
 drivers/pci/controller/pci-thunder-pem.c          | 1 +
 drivers/pci/pci.c                                 | 1 +
 drivers/pci/probe.c                               | 1 +
 include/linux/of_pci.h                            | 5 ++---
 9 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c
index 614a93aa5305..026ad2b29dcd 100644
--- a/drivers/iommu/of_iommu.c
+++ b/drivers/iommu/of_iommu.c
@@ -8,6 +8,8 @@
 #include <linux/export.h>
 #include <linux/iommu.h>
 #include <linux/limits.h>
+#include <linux/pci.h>
+#include <linux/msi.h>
 #include <linux/of.h>
 #include <linux/of_iommu.h>
 #include <linux/of_pci.h>
diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index e88e75c22b6a..fbec07d634ad 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -17,6 +17,7 @@
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/kernel.h>
+#include <linux/pci.h>
 #include <linux/msi.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index 229d586c3d7a..87711e0f8014 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -5,6 +5,7 @@
  */
 
 #include <linux/acpi_iort.h>
+#include <linux/pci.h>
 #include <linux/msi.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index d3156446ff27..7a9bef993e57 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -10,6 +10,7 @@
 
 #include <linux/irqchip/chained_irq.h>
 #include <linux/irqdomain.h>
+#include <linux/msi.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 #include <linux/pci_regs.h>
diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
index fc0fe4d4de49..3a05f6ca95b0 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -16,6 +16,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/msi.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 
diff --git a/drivers/pci/controller/pci-thunder-pem.c b/drivers/pci/controller/pci-thunder-pem.c
index f127ce8bd4ef..9491e266b1ea 100644
--- a/drivers/pci/controller/pci-thunder-pem.c
+++ b/drivers/pci/controller/pci-thunder-pem.c
@@ -6,6 +6,7 @@
 #include <linux/bitfield.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/pci.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 #include <linux/pci-acpi.h>
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 484e35349565..571e7e00984b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -13,6 +13,7 @@
 #include <linux/delay.h>
 #include <linux/dmi.h>
 #include <linux/init.h>
+#include <linux/msi.h>
 #include <linux/of.h>
 #include <linux/of_pci.h>
 #include <linux/pci.h>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 169943f17a4c..11b11a652d18 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -7,6 +7,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/pci.h>
+#include <linux/msi.h>
 #include <linux/of_device.h>
 #include <linux/of_pci.h>
 #include <linux/pci_hotplug.h>
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 21a89c4880fa..29658c0ee71f 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -2,11 +2,10 @@
 #ifndef __OF_PCI_H
 #define __OF_PCI_H
 
-#include <linux/pci.h>
-#include <linux/msi.h>
+#include <linux/types.h>
+#include <linux/errno.h>
 
 struct pci_dev;
-struct of_phandle_args;
 struct device_node;
 
 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PCI)
-- 
2.23.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] PCI: Remove unused includes and superfluous struct declaration
  2019-09-03 11:30 ` [PATCH v2] " Krzysztof Wilczynski
@ 2019-09-03 17:20   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2019-09-03 17:20 UTC (permalink / raw)
  To: Krzysztof Wilczynski
  Cc: devicetree, Jingoo Han, linux-pci, linux-kernel, iommu,
	Bjorn Helgaas, Thomas Petazzoni, Gustavo Pimentel, Frank Rowand,
	linux-arm-kernel

On Tue, Sep 03, 2019 at 01:30:59PM +0200, Krzysztof Wilczynski wrote:
> Remove <linux/pci.h> and <linux/msi.h> from being included
> directly as part of the include/linux/of_pci.h, and remove
> superfluous declaration of struct of_phandle_args.
> 
> Move users of include <linux/of_pci.h> to include <linux/pci.h>
> and <linux/msi.h> directly rather than rely on both being
> included transitively through <linux/of_pci.h>.
> 
> Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
> ---
>  drivers/iommu/of_iommu.c                          | 2 ++
>  drivers/irqchip/irq-gic-v2m.c                     | 1 +
>  drivers/irqchip/irq-gic-v3-its-pci-msi.c          | 1 +
>  drivers/pci/controller/dwc/pcie-designware-host.c | 1 +
>  drivers/pci/controller/pci-aardvark.c             | 1 +
>  drivers/pci/controller/pci-thunder-pem.c          | 1 +
>  drivers/pci/pci.c                                 | 1 +
>  drivers/pci/probe.c                               | 1 +
>  include/linux/of_pci.h                            | 5 ++---
>  9 files changed, 11 insertions(+), 3 deletions(-)

Reviewed-by: Rob Herring <robh@kernel.org>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-01 11:25 [PATCH] PCI: Remove unused includes and superfluous struct declaration Krzysztof Wilczynski
2019-09-02  3:55 ` kbuild test robot
2019-09-02  6:31 ` kbuild test robot
2019-09-02 13:39 ` Rob Herring
2019-09-03 11:30 ` [PATCH v2] " Krzysztof Wilczynski
2019-09-03 17:20   ` Rob Herring

IOMMU Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iommu/0 linux-iommu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iommu linux-iommu/ https://lore.kernel.org/linux-iommu \
		iommu@lists.linux-foundation.org iommu@archiver.kernel.org
	public-inbox-index linux-iommu


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linux-foundation.lists.iommu


AGPL code for this site: git clone https://public-inbox.org/ public-inbox