LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Popple <alistair@popple.id.au>
To: Russell Currey <ruscur@russell.cc>
Cc: linuxppc-dev@lists.ozlabs.org, benh@kernel.crashing.org
Subject: Re: [PATCH 1/2] powerpc/powernv/pci: Add helper to check if a PE has a single vendor
Date: Mon, 26 Jun 2017 14:48:25 +1000	[thread overview]
Message-ID: <1719039.1i4epCekVU@new-mexico> (raw)
In-Reply-To: <20170621071804.11660-1-ruscur@russell.cc>

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);
> 

  parent reply	other threads:[~2017-06-26  4:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  7:18 [PATCH 1/2] powerpc/powernv/pci: Add helper to check if a PE has a single vendor Russell Currey
2017-06-21  7:18 ` [PATCH 2/2] powerpc/powernv/pci: Enable 64-bit devices to access >4GB DMA space Russell Currey
2017-06-23 16:15 ` [PATCH 1/2] powerpc/powernv/pci: Add helper to check if a PE has a single vendor kbuild test robot
2017-06-26  4:48 ` Alistair Popple [this message]
2017-06-29 12:21 ` [1/2] " Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1719039.1i4epCekVU@new-mexico \
    --to=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ruscur@russell.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox