diff mbox

[1/2] powerpc/powernv/pci: Add helper to check if a PE has a single vendor

Message ID 20170621071804.11660-1-ruscur@russell.cc (mailing list archive)
State Accepted
Commit a0f98629f19943fb8387a7d5fd01e60178223c00
Headers show

Commit Message

Russell Currey June 21, 2017, 7:18 a.m. UTC
Add a helper that determines if all the devices contained in a given PE
are all from the same vendor or not.  This can be useful in determining
if it's okay to make PE-wide changes that may be suitable for some
devices but not for others.

This is used later in the series.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

kernel test robot June 23, 2017, 4:15 p.m. UTC | #1
Hi Russell,

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.12-rc6 next-20170623]
[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/Russell-Currey/powerpc-powernv-pci-Add-helper-to-check-if-a-PE-has-a-single-vendor/20170623-201801
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-ppc64_defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=powerpc 

Note: the linux-review/Russell-Currey/powerpc-powernv-pci-Add-helper-to-check-if-a-PE-has-a-single-vendor/20170623-201801 HEAD cc13610eab0edbbdf3d9a8b29b33b1bc02859672 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

>> arch/powerpc/platforms/powernv/pci-ioda.c:1721:13: error: 'pnv_pci_ioda_pe_single_vendor' defined but not used [-Werror=unused-function]
    static bool pnv_pci_ioda_pe_single_vendor(struct pnv_ioda_pe *pe)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/pnv_pci_ioda_pe_single_vendor +1721 arch/powerpc/platforms/powernv/pci-ioda.c

  1715		 * for physical PE: the device is already added by now;
  1716		 * for virtual PE: sysfs entries are not ready yet and
  1717		 * tce_iommu_bus_notifier will add the device to a group later.
  1718		 */
  1719	}
  1720	
> 1721	static bool pnv_pci_ioda_pe_single_vendor(struct pnv_ioda_pe *pe)
  1722	{
  1723		unsigned short vendor = 0;
  1724		struct pci_dev *pdev;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Alistair Popple June 26, 2017, 4:48 a.m. UTC | #2
You may need some kind of temporary unused annotation to shut the
compiler/kbuild robot up but the patch itself looks fine.

Reviewed-by: Alistair Popple <alistair@popple.id.au>

On Wed, 21 Jun 2017 05:18:03 PM Russell Currey wrote:
> Add a helper that determines if all the devices contained in a given PE
> are all from the same vendor or not.  This can be useful in determining
> if it's okay to make PE-wide changes that may be suitable for some
> devices but not for others.
> 
> This is used later in the series.
> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>
> ---
>  arch/powerpc/platforms/powernv/pci-ioda.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 283caf1070c9..13835ac30795 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -1718,6 +1718,31 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
>  	 */
>  }
>  
> +static bool pnv_pci_ioda_pe_single_vendor(struct pnv_ioda_pe *pe)
> +{
> +	unsigned short vendor = 0;
> +	struct pci_dev *pdev;
> +
> +	if (pe->device_count == 1)
> +		return true;
> +
> +	/* pe->pdev should be set if it's a single device, pe->pbus if not */
> +	if (!pe->pbus)
> +		return true;
> +
> +	list_for_each_entry(pdev, &pe->pbus->devices, bus_list) {
> +		if (!vendor) {
> +			vendor = pdev->vendor;
> +			continue;
> +		}
> +
> +		if (pdev->vendor != vendor)
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
>  static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
>  {
>  	struct pci_controller *hose = pci_bus_to_host(pdev->bus);
>
Michael Ellerman June 29, 2017, 12:21 p.m. UTC | #3
On Wed, 2017-06-21 at 07:18:03 UTC, Russell Currey wrote:
> Add a helper that determines if all the devices contained in a given PE
> are all from the same vendor or not.  This can be useful in determining
> if it's okay to make PE-wide changes that may be suitable for some
> devices but not for others.
> 
> This is used later in the series.
> 
> Signed-off-by: Russell Currey <ruscur@russell.cc>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/a0f98629f19943fb8387a7d5fd01e6

cheers
diff mbox

Patch

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 283caf1070c9..13835ac30795 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1718,6 +1718,31 @@  static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
 	 */
 }
 
+static bool pnv_pci_ioda_pe_single_vendor(struct pnv_ioda_pe *pe)
+{
+	unsigned short vendor = 0;
+	struct pci_dev *pdev;
+
+	if (pe->device_count == 1)
+		return true;
+
+	/* pe->pdev should be set if it's a single device, pe->pbus if not */
+	if (!pe->pbus)
+		return true;
+
+	list_for_each_entry(pdev, &pe->pbus->devices, bus_list) {
+		if (!vendor) {
+			vendor = pdev->vendor;
+			continue;
+		}
+
+		if (pdev->vendor != vendor)
+			return false;
+	}
+
+	return true;
+}
+
 static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
 {
 	struct pci_controller *hose = pci_bus_to_host(pdev->bus);