diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2013-11-21 01:43:14 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-12-05 00:08:17 -0500 |
commit | d905c5df9aef38d63df268f6f5e7b13894f626d3 (patch) | |
tree | 621cbfdcb57729e5ec60c6ffe19aa670818381b8 /arch/powerpc/platforms/powernv/pci-ioda.c | |
parent | 7e1ce5a492e18449fd47ef6305b26e0c572d26e9 (diff) |
PPC: POWERNV: move iommu_add_device earlier
The current implementation of IOMMU on sPAPR does not use iommu_ops
and therefore does not call IOMMU API's bus_set_iommu() which
1) sets iommu_ops for a bus
2) registers a bus notifier
Instead, PCI devices are added to IOMMU groups from
subsys_initcall_sync(tce_iommu_init) which does basically the same
thing without using iommu_ops callbacks.
However Freescale PAMU driver (https://lkml.org/lkml/2013/7/1/158)
implements iommu_ops and when tce_iommu_init is called, every PCI device
is already added to some group so there is a conflict.
This patch does 2 things:
1. removes the loop in which PCI devices were added to groups and
adds explicit iommu_add_device() calls to add devices as soon as they get
the iommu_table pointer assigned to them.
2. moves a bus notifier to powernv code in order to avoid conflict with
the notifier from Freescale driver.
iommu_add_device() and iommu_del_device() are public now.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 084cdfa40682..614356cac466 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -460,7 +460,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev | |||
460 | return; | 460 | return; |
461 | 461 | ||
462 | pe = &phb->ioda.pe_array[pdn->pe_number]; | 462 | pe = &phb->ioda.pe_array[pdn->pe_number]; |
463 | set_iommu_table_base(&pdev->dev, &pe->tce32_table); | 463 | set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table); |
464 | } | 464 | } |
465 | 465 | ||
466 | static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) | 466 | static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) |
@@ -468,7 +468,7 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus) | |||
468 | struct pci_dev *dev; | 468 | struct pci_dev *dev; |
469 | 469 | ||
470 | list_for_each_entry(dev, &bus->devices, bus_list) { | 470 | list_for_each_entry(dev, &bus->devices, bus_list) { |
471 | set_iommu_table_base(&dev->dev, &pe->tce32_table); | 471 | set_iommu_table_base_and_group(&dev->dev, &pe->tce32_table); |
472 | if (dev->subordinate) | 472 | if (dev->subordinate) |
473 | pnv_ioda_setup_bus_dma(pe, dev->subordinate); | 473 | pnv_ioda_setup_bus_dma(pe, dev->subordinate); |
474 | } | 474 | } |
@@ -644,7 +644,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, | |||
644 | iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number); | 644 | iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number); |
645 | 645 | ||
646 | if (pe->pdev) | 646 | if (pe->pdev) |
647 | set_iommu_table_base(&pe->pdev->dev, tbl); | 647 | set_iommu_table_base_and_group(&pe->pdev->dev, tbl); |
648 | else | 648 | else |
649 | pnv_ioda_setup_bus_dma(pe, pe->pbus); | 649 | pnv_ioda_setup_bus_dma(pe, pe->pbus); |
650 | 650 | ||
@@ -722,7 +722,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, | |||
722 | iommu_init_table(tbl, phb->hose->node); | 722 | iommu_init_table(tbl, phb->hose->node); |
723 | 723 | ||
724 | if (pe->pdev) | 724 | if (pe->pdev) |
725 | set_iommu_table_base(&pe->pdev->dev, tbl); | 725 | set_iommu_table_base_and_group(&pe->pdev->dev, tbl); |
726 | else | 726 | else |
727 | pnv_ioda_setup_bus_dma(pe, pe->pbus); | 727 | pnv_ioda_setup_bus_dma(pe, pe->pbus); |
728 | 728 | ||