linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH kernel] powerpc/iommu/ioda2: Enable compile with IOV=on and IOMMU_API=off
@ 2015-06-15  7:49 Alexey Kardashevskiy
  2015-06-16  3:40 ` David Gibson
  2015-06-17  7:05 ` David Gibson
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Kardashevskiy @ 2015-06-15  7:49 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Alexey Kardashevskiy, David Gibson, Gavin Shan, Michael Ellerman,
	Paul Mackerras, linux-kernel

The pnv_pci_ioda2_unset_window() function is used to do the final
cleanup of a DMA window being released:
- via VFIO ioctl by the guest request;
- via unplugging a virtual PCI function.
However the function was under #ifdef CONFIG_IOMMU_API and was missing.

This moves the helper outside of IOMMU_API block and enables it
for either or both IOMMU_API and PCI_IOV.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 50 ++++++++++++++++---------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index b9f0f43..8424f5c 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2116,6 +2116,32 @@ static long pnv_pci_ioda2_setup_default_config(struct pnv_ioda_pe *pe)
 	return 0;
 }
 
+#if defined(CONFIG_IOMMU_API) || defined(CONFIG_PCI_IOV)
+static long pnv_pci_ioda2_unset_window(struct iommu_table_group *table_group,
+		int num)
+{
+	struct pnv_ioda_pe *pe = container_of(table_group, struct pnv_ioda_pe,
+			table_group);
+	struct pnv_phb *phb = pe->phb;
+	long ret;
+
+	pe_info(pe, "Removing DMA window #%d\n", num);
+
+	ret = opal_pci_map_pe_dma_window(phb->opal_id, pe->pe_number,
+			(pe->pe_number << 1) + num,
+			0/* levels */, 0/* table address */,
+			0/* table size */, 0/* page size */);
+	if (ret)
+		pe_warn(pe, "Unmapping failed, ret = %ld\n", ret);
+	else
+		pnv_pci_ioda2_tce_invalidate_entire(pe);
+
+	pnv_pci_unlink_table_and_group(table_group->tables[num], table_group);
+
+	return ret;
+}
+#endif
+
 #ifdef CONFIG_IOMMU_API
 static unsigned long pnv_pci_ioda2_get_table_size(__u32 page_shift,
 		__u64 window_size, __u32 levels)
@@ -2149,30 +2175,6 @@ static unsigned long pnv_pci_ioda2_get_table_size(__u32 page_shift,
 	return bytes;
 }
 
-static long pnv_pci_ioda2_unset_window(struct iommu_table_group *table_group,
-		int num)
-{
-	struct pnv_ioda_pe *pe = container_of(table_group, struct pnv_ioda_pe,
-			table_group);
-	struct pnv_phb *phb = pe->phb;
-	long ret;
-
-	pe_info(pe, "Removing DMA window #%d\n", num);
-
-	ret = opal_pci_map_pe_dma_window(phb->opal_id, pe->pe_number,
-			(pe->pe_number << 1) + num,
-			0/* levels */, 0/* table address */,
-			0/* table size */, 0/* page size */);
-	if (ret)
-		pe_warn(pe, "Unmapping failed, ret = %ld\n", ret);
-	else
-		pnv_pci_ioda2_tce_invalidate_entire(pe);
-
-	pnv_pci_unlink_table_and_group(table_group->tables[num], table_group);
-
-	return ret;
-}
-
 static void pnv_ioda2_take_ownership(struct iommu_table_group *table_group)
 {
 	struct pnv_ioda_pe *pe = container_of(table_group, struct pnv_ioda_pe,
-- 
2.4.0.rc3.8.gfb3e7d5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH kernel] powerpc/iommu/ioda2: Enable compile with IOV=on and IOMMU_API=off
  2015-06-15  7:49 [PATCH kernel] powerpc/iommu/ioda2: Enable compile with IOV=on and IOMMU_API=off Alexey Kardashevskiy
@ 2015-06-16  3:40 ` David Gibson
  2015-06-17  7:05 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2015-06-16  3:40 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: linuxppc-dev, Gavin Shan, Michael Ellerman, Paul Mackerras, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]

On Mon, Jun 15, 2015 at 05:49:59PM +1000, Alexey Kardashevskiy wrote:
> The pnv_pci_ioda2_unset_window() function is used to do the final
> cleanup of a DMA window being released:
> - via VFIO ioctl by the guest request;
> - via unplugging a virtual PCI function.
> However the function was under #ifdef CONFIG_IOMMU_API and was missing.
> 
> This moves the helper outside of IOMMU_API block and enables it
> for either or both IOMMU_API and PCI_IOV.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH kernel] powerpc/iommu/ioda2: Enable compile with IOV=on and IOMMU_API=off
  2015-06-15  7:49 [PATCH kernel] powerpc/iommu/ioda2: Enable compile with IOV=on and IOMMU_API=off Alexey Kardashevskiy
  2015-06-16  3:40 ` David Gibson
@ 2015-06-17  7:05 ` David Gibson
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2015-06-17  7:05 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: linuxppc-dev, Gavin Shan, Michael Ellerman, Paul Mackerras, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

On Mon, Jun 15, 2015 at 05:49:59PM +1000, Alexey Kardashevskiy wrote:
> The pnv_pci_ioda2_unset_window() function is used to do the final
> cleanup of a DMA window being released:
> - via VFIO ioctl by the guest request;
> - via unplugging a virtual PCI function.
> However the function was under #ifdef CONFIG_IOMMU_API and was missing.
> 
> This moves the helper outside of IOMMU_API block and enables it
> for either or both IOMMU_API and PCI_IOV.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-17  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-15  7:49 [PATCH kernel] powerpc/iommu/ioda2: Enable compile with IOV=on and IOMMU_API=off Alexey Kardashevskiy
2015-06-16  3:40 ` David Gibson
2015-06-17  7:05 ` David Gibson

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