linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Reza Arbab <arbab@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Andrew Donnellan <ajd@linux.ibm.com>,
	Alexey Kardashevskiy <aik@ozlabs.ru>,
	Oliver O'Halloran <oohall@gmail.com>,
	Alistair Popple <alistair@popple.id.au>,
	Paul Mackerras <paulus@samba.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Christoph Hellwig <hch@lst.de>
Subject: [PATCH 04/11] powerpc/powernv/npu: Wire up pnv_npu_try_dma_set_bypass()
Date: Wed, 30 Oct 2019 11:59:53 -0500	[thread overview]
Message-ID: <1572454800-17976-5-git-send-email-arbab@linux.ibm.com> (raw)
In-Reply-To: <1572454800-17976-1-git-send-email-arbab@linux.ibm.com>

Rework of pnv_pci_ioda_iommu_bypass_supported() dropped a call to
pnv_npu_try_dma_set_bypass(). Reintroduce this call, so that the DMA
bypass configuration of a GPU device is propagated to its corresponding
NPU devices.

Fixes: 2d6ad41b2c21 ("powerpc/powernv: use the generic iommu bypass code")
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Cc: Christoph Hellwig <hch@lst.de>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 8849218187d7..70e834635971 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1833,14 +1833,13 @@ static bool pnv_pci_ioda_iommu_bypass_supported(struct pci_dev *pdev,
 	struct pnv_phb *phb = hose->private_data;
 	struct pci_dn *pdn = pci_get_pdn(pdev);
 	struct pnv_ioda_pe *pe;
+	bool bypass;
 
 	if (WARN_ON(!pdn || pdn->pe_number == IODA_INVALID_PE))
 		return false;
 
 	pe = &phb->ioda.pe_array[pdn->pe_number];
-
-	if (pnv_ioda_pe_iommu_bypass_supported(pe, dma_mask))
-		return true;
+	bypass = pnv_ioda_pe_iommu_bypass_supported(pe, dma_mask);
 
 	/*
 	 * If the device can't set the TCE bypass bit but still wants
@@ -1848,7 +1847,8 @@ static bool pnv_pci_ioda_iommu_bypass_supported(struct pci_dev *pdev,
 	 * bypass the 32-bit region and be usable for 64-bit DMAs.
 	 * The device needs to be able to address all of this space.
 	 */
-	if (dma_mask >> 32 &&
+	if (!bypass &&
+	    dma_mask >> 32 &&
 	    dma_mask > (memory_hotplug_max() + (1ULL << 32)) &&
 	    /* pe->pdev should be set if it's a single device, pe->pbus if not */
 	    (pe->device_count == 1 || !pe->pbus) &&
@@ -1859,10 +1859,14 @@ static bool pnv_pci_ioda_iommu_bypass_supported(struct pci_dev *pdev,
 			return false;
 		/* 4GB offset bypasses 32-bit space */
 		pdev->dev.archdata.dma_offset = (1ULL << 32);
-		return true;
+
+		bypass = true;
 	}
 
-	return false;
+	/* Update peer npu devices */
+	pnv_npu_try_dma_set_bypass(pdev, dma_mask);
+
+	return bypass;
 }
 
 static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
-- 
1.8.3.1


  parent reply	other threads:[~2019-10-30 17:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 16:59 [PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass() Reza Arbab
2019-10-30 16:59 ` [PATCH 01/11] Revert "powerpc/powernv: Remove unused pnv_npu_try_dma_set_bypass() function" Reza Arbab
2019-10-30 16:59 ` [PATCH 02/11] powerpc/powernv: Add pnv_ioda_pe_iommu_bypass_supported() Reza Arbab
2019-10-30 16:59 ` [PATCH 03/11] powerpc/powernv/npu: Change pnv_npu_try_dma_set_bypass() argument Reza Arbab
2019-10-30 16:59 ` Reza Arbab [this message]
2019-10-30 16:59 ` [PATCH 05/11] powerpc/powernv: Return failure for some uses of dma_set_mask() Reza Arbab
2019-10-30 16:59 ` [PATCH 06/11] powerpc/powernv: Remove intermediate variable Reza Arbab
2019-10-30 16:59 ` [PATCH 07/11] powerpc/powernv/npu: Simplify pnv_npu_try_dma_set_bypass() loop Reza Arbab
2019-10-30 16:59 ` [PATCH 08/11] powerpc/powernv: Replace open coded pnv_ioda_get_pe()s Reza Arbab
2019-10-30 16:59 ` [PATCH 09/11] Revert "powerpc/pci: remove the dma_set_mask pci_controller ops methods" Reza Arbab
2019-10-30 16:59 ` [PATCH 10/11] powerpc/powernv: Add pnv_phb3_iommu_bypass_supported() Reza Arbab
2019-10-30 17:00 ` [PATCH 11/11] powerpc/powernv: Add pnv_pci_ioda_dma_set_mask() Reza Arbab
2019-10-30 17:55   ` Christoph Hellwig
2019-10-30 18:10     ` Reza Arbab
2019-10-30 17:53 ` [PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass() Christoph Hellwig
2019-10-30 18:08   ` Reza Arbab
2019-10-30 18:13     ` Christoph Hellwig
2019-10-30 18:32       ` Reza Arbab
2019-10-30 18:33         ` Christoph Hellwig

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=1572454800-17976-5-git-send-email-arbab@linux.ibm.com \
    --to=arbab@linux.ibm.com \
    --cc=aik@ozlabs.ru \
    --cc=ajd@linux.ibm.com \
    --cc=alistair@popple.id.au \
    --cc=hch@lst.de \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oohall@gmail.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /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).