Commit 5b25199e authored by Alexey Kardashevskiy's avatar Alexey Kardashevskiy Committed by Benjamin Herrenschmidt

powerpc/vfio: Enable on pSeries platform

The enables VFIO on the pSeries platform, enabling user space
programs to access PCI devices directly.
Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Acked-by: default avatarAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 5ffd229c
...@@ -614,6 +614,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus) ...@@ -614,6 +614,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
iommu_table_setparms(pci->phb, dn, tbl); iommu_table_setparms(pci->phb, dn, tbl);
pci->iommu_table = iommu_init_table(tbl, pci->phb->node); pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
iommu_register_group(tbl, pci_domain_nr(bus), 0);
/* Divide the rest (1.75GB) among the children */ /* Divide the rest (1.75GB) among the children */
pci->phb->dma_window_size = 0x80000000ul; pci->phb->dma_window_size = 0x80000000ul;
...@@ -658,6 +659,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) ...@@ -658,6 +659,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
ppci->phb->node); ppci->phb->node);
iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window); iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node); ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node);
iommu_register_group(tbl, pci_domain_nr(bus), 0);
pr_debug(" created table: %p\n", ppci->iommu_table); pr_debug(" created table: %p\n", ppci->iommu_table);
} }
} }
...@@ -684,6 +686,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev) ...@@ -684,6 +686,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
phb->node); phb->node);
iommu_table_setparms(phb, dn, tbl); iommu_table_setparms(phb, dn, tbl);
PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node); PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node);
iommu_register_group(tbl, pci_domain_nr(phb->bus), 0);
set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table); set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table);
return; return;
} }
...@@ -1184,6 +1187,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) ...@@ -1184,6 +1187,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
pci->phb->node); pci->phb->node);
iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window); iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window);
pci->iommu_table = iommu_init_table(tbl, pci->phb->node); pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
iommu_register_group(tbl, pci_domain_nr(pci->phb->bus), 0);
pr_debug(" created table: %p\n", pci->iommu_table); pr_debug(" created table: %p\n", pci->iommu_table);
} else { } else {
pr_debug(" found DMA window, table: %p\n", pci->iommu_table); pr_debug(" found DMA window, table: %p\n", pci->iommu_table);
......
...@@ -263,7 +263,7 @@ config SHMOBILE_IOMMU_L1SIZE ...@@ -263,7 +263,7 @@ config SHMOBILE_IOMMU_L1SIZE
config SPAPR_TCE_IOMMU config SPAPR_TCE_IOMMU
bool "sPAPR TCE IOMMU Support" bool "sPAPR TCE IOMMU Support"
depends on PPC_POWERNV depends on PPC_POWERNV || PPC_PSERIES
select IOMMU_API select IOMMU_API
help help
Enables bits of IOMMU API required by VFIO. The iommu_ops Enables bits of IOMMU API required by VFIO. The iommu_ops
......
...@@ -12,7 +12,7 @@ menuconfig VFIO ...@@ -12,7 +12,7 @@ menuconfig VFIO
tristate "VFIO Non-Privileged userspace driver framework" tristate "VFIO Non-Privileged userspace driver framework"
depends on IOMMU_API depends on IOMMU_API
select VFIO_IOMMU_TYPE1 if X86 select VFIO_IOMMU_TYPE1 if X86
select VFIO_IOMMU_SPAPR_TCE if PPC_POWERNV select VFIO_IOMMU_SPAPR_TCE if (PPC_POWERNV || PPC_PSERIES)
help help
VFIO provides a framework for secure userspace device drivers. VFIO provides a framework for secure userspace device drivers.
See Documentation/vfio.txt for more details. See Documentation/vfio.txt for more details.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment