linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
To: Frederic Barrat <fbarrat@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: arnd@arndb.de, gregkh@linuxfoundation.org, mpe@ellerman.id.au,
	alastair@au1.ibm.com
Subject: Re: [PATCH 01/13] powerpc/powernv: Introduce new PHB type for opencapi links
Date: Wed, 3 Jan 2018 14:53:38 +1100	[thread overview]
Message-ID: <c4cfdd4c-6baa-f62f-886a-b548ed6cb243@au1.ibm.com> (raw)
In-Reply-To: <6870a754d346e7d8a47325e5ba4327853aea9226.1513608243.git.fbarrat@linux.vnet.ibm.com>

On 19/12/17 02:21, Frederic Barrat wrote:
> The NPU was already abstracted by opal as a virtual PHB for nvlink,
> but it helps to be able to differentiate between a nvlink or opencapi
> PHB, as it's not completely transparent to linux. In particular, PE
> assignment differs and we'll also need the information in later
> patches.
> 
> So rename existing PNV_PHB_NPU type to PNV_PHB_NPU_NVLINK and add a
> new type PNV_PHB_NPU_OCAPI.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> ---
>   arch/powerpc/platforms/powernv/npu-dma.c  |  2 +-
>   arch/powerpc/platforms/powernv/pci-ioda.c | 46 +++++++++++++++++++++++--------
>   arch/powerpc/platforms/powernv/pci.c      |  4 +++
>   arch/powerpc/platforms/powernv/pci.h      |  8 ++++--
>   4 files changed, 45 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
> index f6cbc1a71472..c5899c107d59 100644
> --- a/arch/powerpc/platforms/powernv/npu-dma.c
> +++ b/arch/powerpc/platforms/powernv/npu-dma.c
> @@ -277,7 +277,7 @@ static int pnv_npu_dma_set_bypass(struct pnv_ioda_pe *npe)
>   	int64_t rc = 0;
>   	phys_addr_t top = memblock_end_of_DRAM();
> 
> -	if (phb->type != PNV_PHB_NPU || !npe->pdev)
> +	if (phb->type != PNV_PHB_NPU_NVLINK || !npe->pdev)
>   		return -EINVAL;
> 
>   	rc = pnv_npu_unset_window(npe, 0);
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 749055553064..c37b5d288f9c 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -54,7 +54,8 @@
>   #define POWERNV_IOMMU_DEFAULT_LEVELS	1
>   #define POWERNV_IOMMU_MAX_LEVELS	5
> 
> -static const char * const pnv_phb_names[] = { "IODA1", "IODA2", "NPU" };
> +static const char * const pnv_phb_names[] = { "IODA1", "IODA2", "NPU_NVLINK",
> +					      "NPU_OCAPI" };
>   static void pnv_pci_ioda2_table_free_pages(struct iommu_table *tbl);
> 
>   void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
> @@ -924,7 +925,7 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
>   	 * Configure PELTV. NPUs don't have a PELTV table so skip
>   	 * configuration on them.
>   	 */
> -	if (phb->type != PNV_PHB_NPU)
> +	if (phb->type != PNV_PHB_NPU_NVLINK && phb->type != PNV_PHB_NPU_OCAPI)
>   		pnv_ioda_set_peltv(phb, pe, true);
> 
>   	/* Setup reverse map */
> @@ -1260,12 +1261,13 @@ static struct pnv_ioda_pe *pnv_ioda_setup_npu_PE(struct pci_dev *npu_pdev)
>   		return pe;
>   }
> 
> -static void pnv_ioda_setup_npu_PEs(struct pci_bus *bus)
> +static void pnv_ioda_setup_npu_PEs(struct pci_bus *bus,
> +			    struct pnv_ioda_pe *fn(struct pci_dev *npu_pdev))
>   {
>   	struct pci_dev *pdev;
> 
>   	list_for_each_entry(pdev, &bus->devices, bus_list)
> -		pnv_ioda_setup_npu_PE(pdev);
> +		fn(pdev);
>   }

I think adding a function pointer here is rather ugly, at this point you 
might as well just do this directly in pnv_pci_ioda_setup_PEs()

> 
>   static void pnv_pci_ioda_setup_PEs(void)
> @@ -1275,13 +1277,18 @@ static void pnv_pci_ioda_setup_PEs(void)
> 
>   	list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
>   		phb = hose->private_data;
> -		if (phb->type == PNV_PHB_NPU) {
> +		if (phb->type == PNV_PHB_NPU_NVLINK) {
>   			/* PE#0 is needed for error reporting */
>   			pnv_ioda_reserve_pe(phb, 0);
> -			pnv_ioda_setup_npu_PEs(hose->bus);
> +			pnv_ioda_setup_npu_PEs(hose->bus,
> +					pnv_ioda_setup_npu_PE);
>   			if (phb->model == PNV_PHB_MODEL_NPU2)
>   				pnv_npu2_init(phb);
>   		}
> +		if (phb->type == PNV_PHB_NPU_OCAPI) {
> +			pnv_ioda_setup_npu_PEs(hose->bus,
> +					pnv_ioda_setup_dev_PE);
> +		}
>   	}
>   }
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

  reply	other threads:[~2018-01-03  3:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 15:21 [PATCH 00/13] New driver to support OpenCAPI devices on POWER9 Frederic Barrat
2017-12-18 15:21 ` [PATCH 01/13] powerpc/powernv: Introduce new PHB type for opencapi links Frederic Barrat
2018-01-03  3:53   ` Andrew Donnellan [this message]
2017-12-18 15:21 ` [PATCH 02/13] powerpc/powernv: Set correct configuration space size for opencapi devices Frederic Barrat
2017-12-19  1:14   ` Andrew Donnellan
2018-01-20  9:52   ` Michael Ellerman
2018-01-22  5:07     ` Andrew Donnellan
2017-12-18 15:21 ` [PATCH 03/13] powerpc/powernv: Add opal calls for opencapi Frederic Barrat
2017-12-19  0:47   ` Andrew Donnellan
2017-12-18 15:21 ` [PATCH 04/13] powerpc/powernv: Add platform-specific services " Frederic Barrat
2018-01-03  7:31   ` Andrew Donnellan
2017-12-18 15:21 ` [PATCH 05/13] powerpc/powernv: Capture actag information for the device Frederic Barrat
2017-12-18 15:21 ` [PATCH 06/13] ocxl: Driver code for 'generic' opencapi devices Frederic Barrat
2018-01-03  7:30   ` Andrew Donnellan
2017-12-18 15:21 ` [PATCH 07/13] ocxl: Add AFU interrupt support Frederic Barrat
2017-12-19  4:05   ` Benjamin Herrenschmidt
2018-01-23 17:10     ` Cédric Le Goater
2017-12-18 15:21 ` [PATCH 08/13] ocxl: Add a kernel API for other opencapi drivers Frederic Barrat
2017-12-18 15:21 ` [PATCH 09/13] ocxl: Add trace points Frederic Barrat
2017-12-18 16:48   ` Philippe Ombredanne
2017-12-20 12:01     ` Frederic Barrat
2017-12-18 15:21 ` [PATCH 10/13] ocxl: Add Makefile and Kconfig Frederic Barrat
2018-01-03  5:48   ` Andrew Donnellan
2018-01-09 15:45     ` Frederic Barrat
2018-01-09 23:21       ` Michael Ellerman
2018-01-10 19:17         ` Frederic Barrat
2017-12-18 15:21 ` [PATCH 11/13] cxl: Remove support for "Processing accelerators" class Frederic Barrat
2017-12-18 23:47   ` Andrew Donnellan
2017-12-18 15:21 ` [PATCH 12/13] ocxl: Documentation Frederic Barrat
2017-12-18 15:21 ` [PATCH 13/13] ocxl: add MAINTAINERS entry Frederic Barrat
2017-12-18 16:04   ` Joe Perches
2017-12-19 14:39     ` Frederic Barrat
2017-12-19  0:22 ` [PATCH 00/13] New driver to support OpenCAPI devices on POWER9 Andrew Donnellan

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=c4cfdd4c-6baa-f62f-886a-b548ed6cb243@au1.ibm.com \
    --to=andrew.donnellan@au1.ibm.com \
    --cc=alastair@au1.ibm.com \
    --cc=arnd@arndb.de \
    --cc=fbarrat@linux.vnet.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).