Skip to content

Commit 74251fe

Browse files
committed
powerpc/powernv: Fix iommu initialization again
So because those things always end up in trainwrecks... In 7846de4 we moved back the iommu initialization earlier, essentially undoing 37f0219 which was causing us endless trouble... except that in the meantime we had merged 959c9bd (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 <[email protected]> CC: <[email protected]> [v3.10]
1 parent 24a72ac commit 74251fe

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,17 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
443443
set_iommu_table_base(&pdev->dev, &pe->tce32_table);
444444
}
445445

446+
static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
447+
{
448+
struct pci_dev *dev;
449+
450+
list_for_each_entry(dev, &bus->devices, bus_list) {
451+
set_iommu_table_base(&dev->dev, &pe->tce32_table);
452+
if (dev->subordinate)
453+
pnv_ioda_setup_bus_dma(pe, dev->subordinate);
454+
}
455+
}
456+
446457
static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl,
447458
u64 *startp, u64 *endp)
448459
{
@@ -599,6 +610,11 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
599610
iommu_init_table(tbl, phb->hose->node);
600611
iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
601612

613+
if (pe->pdev)
614+
set_iommu_table_base(&pe->pdev->dev, tbl);
615+
else
616+
pnv_ioda_setup_bus_dma(pe, pe->pbus);
617+
602618
return;
603619
fail:
604620
/* 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,
670686
}
671687
iommu_init_table(tbl, phb->hose->node);
672688

689+
if (pe->pdev)
690+
set_iommu_table_base(&pe->pdev->dev, tbl);
691+
else
692+
pnv_ioda_setup_bus_dma(pe, pe->pbus);
693+
673694
return;
674695
fail:
675696
if (pe->tce32_seg >= 0)

0 commit comments

Comments
 (0)