diff options
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 957a57a6c812..e36738291c32 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -1775,17 +1775,20 @@ static u64 pnv_pci_ioda_dma_get_required_mask(struct pci_dev *pdev) | |||
1775 | } | 1775 | } |
1776 | 1776 | ||
1777 | static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, | 1777 | static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, |
1778 | struct pci_bus *bus) | 1778 | struct pci_bus *bus, |
1779 | bool add_to_group) | ||
1779 | { | 1780 | { |
1780 | struct pci_dev *dev; | 1781 | struct pci_dev *dev; |
1781 | 1782 | ||
1782 | list_for_each_entry(dev, &bus->devices, bus_list) { | 1783 | list_for_each_entry(dev, &bus->devices, bus_list) { |
1783 | set_iommu_table_base(&dev->dev, pe->table_group.tables[0]); | 1784 | set_iommu_table_base(&dev->dev, pe->table_group.tables[0]); |
1784 | set_dma_offset(&dev->dev, pe->tce_bypass_base); | 1785 | set_dma_offset(&dev->dev, pe->tce_bypass_base); |
1785 | iommu_add_device(&dev->dev); | 1786 | if (add_to_group) |
1787 | iommu_add_device(&dev->dev); | ||
1786 | 1788 | ||
1787 | if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) | 1789 | if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) |
1788 | pnv_ioda_setup_bus_dma(pe, dev->subordinate); | 1790 | pnv_ioda_setup_bus_dma(pe, dev->subordinate, |
1791 | add_to_group); | ||
1789 | } | 1792 | } |
1790 | } | 1793 | } |
1791 | 1794 | ||
@@ -2191,7 +2194,7 @@ found: | |||
2191 | set_iommu_table_base(&pe->pdev->dev, tbl); | 2194 | set_iommu_table_base(&pe->pdev->dev, tbl); |
2192 | iommu_add_device(&pe->pdev->dev); | 2195 | iommu_add_device(&pe->pdev->dev); |
2193 | } else if (pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL)) | 2196 | } else if (pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL)) |
2194 | pnv_ioda_setup_bus_dma(pe, pe->pbus); | 2197 | pnv_ioda_setup_bus_dma(pe, pe->pbus, true); |
2195 | 2198 | ||
2196 | return; | 2199 | return; |
2197 | fail: | 2200 | fail: |
@@ -2426,6 +2429,8 @@ static void pnv_ioda2_take_ownership(struct iommu_table_group *table_group) | |||
2426 | 2429 | ||
2427 | pnv_pci_ioda2_set_bypass(pe, false); | 2430 | pnv_pci_ioda2_set_bypass(pe, false); |
2428 | pnv_pci_ioda2_unset_window(&pe->table_group, 0); | 2431 | pnv_pci_ioda2_unset_window(&pe->table_group, 0); |
2432 | if (pe->pbus) | ||
2433 | pnv_ioda_setup_bus_dma(pe, pe->pbus, false); | ||
2429 | pnv_ioda2_table_free(tbl); | 2434 | pnv_ioda2_table_free(tbl); |
2430 | } | 2435 | } |
2431 | 2436 | ||
@@ -2435,6 +2440,8 @@ static void pnv_ioda2_release_ownership(struct iommu_table_group *table_group) | |||
2435 | table_group); | 2440 | table_group); |
2436 | 2441 | ||
2437 | pnv_pci_ioda2_setup_default_config(pe); | 2442 | pnv_pci_ioda2_setup_default_config(pe); |
2443 | if (pe->pbus) | ||
2444 | pnv_ioda_setup_bus_dma(pe, pe->pbus, false); | ||
2438 | } | 2445 | } |
2439 | 2446 | ||
2440 | static struct iommu_table_group_ops pnv_pci_ioda2_ops = { | 2447 | static struct iommu_table_group_ops pnv_pci_ioda2_ops = { |
@@ -2731,7 +2738,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, | |||
2731 | if (pe->flags & PNV_IODA_PE_DEV) | 2738 | if (pe->flags & PNV_IODA_PE_DEV) |
2732 | iommu_add_device(&pe->pdev->dev); | 2739 | iommu_add_device(&pe->pdev->dev); |
2733 | else if (pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL)) | 2740 | else if (pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL)) |
2734 | pnv_ioda_setup_bus_dma(pe, pe->pbus); | 2741 | pnv_ioda_setup_bus_dma(pe, pe->pbus, true); |
2735 | } | 2742 | } |
2736 | 2743 | ||
2737 | #ifdef CONFIG_PCI_MSI | 2744 | #ifdef CONFIG_PCI_MSI |