aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv/pci-ioda.c
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2015-06-05 02:35:06 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-06-11 01:14:56 -0400
commitda004c3600f52e4f05017f60970e5010978006bc (patch)
tree2f8573ad65adccea54af87be3ecd5bb5f0fa2007 /arch/powerpc/platforms/powernv/pci-ioda.c
parent10b35b2b7485c342334a48cf199063eed8b8748e (diff)
powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table
This adds a iommu_table_ops struct and puts pointer to it into the iommu_table struct. This moves tce_build/tce_free/tce_get/tce_flush callbacks from ppc_md to the new struct where they really belong to. This adds the requirement for @it_ops to be initialized before calling iommu_init_table() to make sure that we do not leave any IOMMU table with iommu_table_ops uninitialized. This is not a parameter of iommu_init_table() though as there will be cases when iommu_init_table() will not be called on TCE tables, for example - VFIO. This does s/tce_build/set/, s/tce_free/clear/ and removes "tce_" redundant prefixes. This removes tce_xxx_rm handlers from ppc_md but does not add them to iommu_table_ops as this will be done later if we decide to support TCE hypercalls in real mode. This removes _vm callbacks as only virtual mode is supported by now so this also removes @rm parameter. For pSeries, this always uses tce_buildmulti_pSeriesLP/ tce_buildmulti_pSeriesLP. This changes multi callback to fall back to tce_build_pSeriesLP/tce_free_pSeriesLP if FW_FEATURE_MULTITCE is not present. The reason for this is we still have to support "multitce=off" boot parameter in disable_multitce() and we do not want to walk through all IOMMU tables in the system and replace "multi" callbacks with single ones. For powernv, this defines _ops per PHB type which are P5IOC2/IODA1/IODA2. This makes the callbacks for them public. Later patches will extend callbacks for IODA1/2. No change in behaviour is expected. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 8070dc9921f2..b0a14c0e7774 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1726,6 +1726,12 @@ static void pnv_pci_ioda1_tce_invalidate(struct pnv_ioda_pe *pe,
1726 */ 1726 */
1727} 1727}
1728 1728
1729static struct iommu_table_ops pnv_ioda1_iommu_ops = {
1730 .set = pnv_tce_build,
1731 .clear = pnv_tce_free,
1732 .get = pnv_tce_get,
1733};
1734
1729static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe, 1735static void pnv_pci_ioda2_tce_invalidate(struct pnv_ioda_pe *pe,
1730 struct iommu_table *tbl, 1736 struct iommu_table *tbl,
1731 __be64 *startp, __be64 *endp, bool rm) 1737 __be64 *startp, __be64 *endp, bool rm)
@@ -1770,6 +1776,12 @@ void pnv_pci_ioda_tce_invalidate(struct iommu_table *tbl,
1770 pnv_pci_ioda2_tce_invalidate(pe, tbl, startp, endp, rm); 1776 pnv_pci_ioda2_tce_invalidate(pe, tbl, startp, endp, rm);
1771} 1777}
1772 1778
1779static struct iommu_table_ops pnv_ioda2_iommu_ops = {
1780 .set = pnv_tce_build,
1781 .clear = pnv_tce_free,
1782 .get = pnv_tce_get,
1783};
1784
1773static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, 1785static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
1774 struct pnv_ioda_pe *pe, unsigned int base, 1786 struct pnv_ioda_pe *pe, unsigned int base,
1775 unsigned int segs) 1787 unsigned int segs)
@@ -1845,6 +1857,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
1845 TCE_PCI_SWINV_FREE | 1857 TCE_PCI_SWINV_FREE |
1846 TCE_PCI_SWINV_PAIR); 1858 TCE_PCI_SWINV_PAIR);
1847 } 1859 }
1860 tbl->it_ops = &pnv_ioda1_iommu_ops;
1848 iommu_init_table(tbl, phb->hose->node); 1861 iommu_init_table(tbl, phb->hose->node);
1849 1862
1850 if (pe->flags & PNV_IODA_PE_DEV) { 1863 if (pe->flags & PNV_IODA_PE_DEV) {
@@ -1973,6 +1986,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
1973 8); 1986 8);
1974 tbl->it_type |= (TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE); 1987 tbl->it_type |= (TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE);
1975 } 1988 }
1989 tbl->it_ops = &pnv_ioda2_iommu_ops;
1976 iommu_init_table(tbl, phb->hose->node); 1990 iommu_init_table(tbl, phb->hose->node);
1977 1991
1978 if (pe->flags & PNV_IODA_PE_DEV) { 1992 if (pe->flags & PNV_IODA_PE_DEV) {