]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/powernv: Fix iommu initialization again
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 1 Jul 2013 07:54:09 +0000 (17:54 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 1 Jul 2013 08:10:29 +0000 (18:10 +1000)
So because those things always end up in trainwrecks... In 7846de406
we moved back the iommu initialization earlier, essentially undoing
37f02195b which was causing us endless trouble... except that in the
meantime we had merged 959c9bdd58 (to workaround the original breakage)
which is now ... broken :-)

This fixes it by doing a partial revert of the latter (we keep the
ppc_md. path which will be needed in the hotplug case, which happens
also during some EEH error recovery situations).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: <stable@vger.kernel.org> [v3.10]
arch/powerpc/platforms/powernv/pci-ioda.c

index c393bf59f1138d2b629ff86dde2f5348ed6af170..49b57b9f835d787977817db8f093d40c354ac7d5 100644 (file)
@@ -443,6 +443,17 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
        set_iommu_table_base(&pdev->dev, &pe->tce32_table);
 }
 
+static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
+{
+       struct pci_dev *dev;
+
+       list_for_each_entry(dev, &bus->devices, bus_list) {
+               set_iommu_table_base(&dev->dev, &pe->tce32_table);
+               if (dev->subordinate)
+                       pnv_ioda_setup_bus_dma(pe, dev->subordinate);
+       }
+}
+
 static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl,
                                         u64 *startp, u64 *endp)
 {
@@ -599,6 +610,11 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
        iommu_init_table(tbl, phb->hose->node);
        iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
 
+       if (pe->pdev)
+               set_iommu_table_base(&pe->pdev->dev, tbl);
+       else
+               pnv_ioda_setup_bus_dma(pe, pe->pbus);
+
        return;
  fail:
        /* XXX Failure: Try to fallback to 64-bit only ? */
@@ -670,6 +686,11 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
        }
        iommu_init_table(tbl, phb->hose->node);
 
+       if (pe->pdev)
+               set_iommu_table_base(&pe->pdev->dev, tbl);
+       else
+               pnv_ioda_setup_bus_dma(pe, pe->pbus);
+
        return;
 fail:
        if (pe->tce32_seg >= 0)