linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	Alistair Popple <alistair@popple.id.au>,
	Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
	Reza Arbab <arbab@linux.ibm.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH kernel 1/2] powerpc/powernv/npu: Move compound PEs to powernv
Date: Mon, 14 Jan 2019 11:56:00 +1100	[thread overview]
Message-ID: <20190114005601.1220-2-aik@ozlabs.ru> (raw)
In-Reply-To: <20190114005601.1220-1-aik@ozlabs.ru>

We are going to move NPU code shared among pseries and powernv into sysdev.

This prepares the move by moving compound PEs from the npu struct
(which is going to move to sysdev) to powernv's phb struct as
pseries does not need this. This makes npucomp a pointer instead of
embedding it to the pnv_ohb struct so we can still have the definition of
it in npu-dma.c (the only place which uses it) and save some bytes when
there is no NPU.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 arch/powerpc/platforms/powernv/pci.h     |  4 ++++
 arch/powerpc/platforms/powernv/npu-dma.c | 10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 8e36da3..8eb1cad 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -62,6 +62,7 @@ struct pnv_ioda_pe {
 
 	/* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */
 	struct iommu_table_group table_group;
+	/* Compound PE for P8/NPU */
 	struct npu_comp		*npucomp;
 
 	/* 64-bit TCE bypass region */
@@ -173,6 +174,9 @@ struct pnv_phb {
 	u8			*diag_data;
 
 	int p2p_target_count;
+
+	/* Compound PE for P9/NPU2 */
+	struct npu_comp *npucomp;
 };
 
 extern struct pci_ops pnv_pci_ops;
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
index 2ca7982..c7cd259 100644
--- a/arch/powerpc/platforms/powernv/npu-dma.c
+++ b/arch/powerpc/platforms/powernv/npu-dma.c
@@ -370,8 +370,6 @@ struct npu {
 
 	/* Do we need to explicitly flush the nest mmu? */
 	bool nmmu_flush;
-
-	struct npu_comp npucomp;
 };
 
 #ifdef CONFIG_IOMMU_API
@@ -535,6 +533,7 @@ struct iommu_table_group *pnv_try_setup_npu_table_group(struct pnv_ioda_pe *pe)
 	struct npu_comp *npucomp;
 	struct pci_dev *gpdev = NULL;
 	struct pci_controller *hose;
+	struct pnv_phb *phb;
 	struct pci_dev *npdev = NULL;
 
 	list_for_each_entry(gpdev, &pe->pbus->devices, bus_list) {
@@ -548,9 +547,14 @@ struct iommu_table_group *pnv_try_setup_npu_table_group(struct pnv_ioda_pe *pe)
 		return NULL;
 
 	hose = pci_bus_to_host(npdev->bus);
+	phb = hose->private_data;
 
 	if (hose->npu) {
-		table_group = &hose->npu->npucomp.table_group;
+		if (!phb->npucomp) {
+			phb->npucomp = kzalloc(sizeof(struct npu_comp),
+					GFP_KERNEL);
+		}
+		table_group = &phb->npucomp->table_group;
 
 		if (!table_group->group) {
 			table_group->ops = &pnv_npu_peers_ops;
-- 
2.17.1


  reply	other threads:[~2019-01-14  0:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14  0:55 [PATCH kernel 0/2] powerpc/powernv/npu: Move platform shared code to sysdev Alexey Kardashevskiy
2019-01-14  0:56 ` Alexey Kardashevskiy [this message]
2019-01-14  0:56 ` [PATCH kernel 2/2] " Alexey Kardashevskiy

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=20190114005601.1220-2-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=alistair@popple.id.au \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=arbab@linux.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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).