aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>2014-10-23 17:19:35 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-01-22 22:02:46 -0500
commit4e28784024a0d87f6f04250e46e8c9ac4f30e361 (patch)
treeab5cb3cb1768d5fafeb3021ad8ae1b6ae6d45017 /arch/powerpc/platforms/powernv
parent79872e35469b6db1c5243abded7b24367bd0a353 (diff)
powernv/iommu: disable IOMMU bypass with param iommu=nobypass
When IOMMU bypass is enabled, a PCI device can read and write memory that was not mapped by the driver without causing an EEH. That might cause memory corruption, for example. When we disable bypass, DMA reads and writes to addresses not mapped by the IOMMU will cause an EEH, allowing us to debug such issues. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/powernv')
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 4f1e43c05e84..85b473823fda 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -75,6 +75,28 @@ static void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
75#define pe_info(pe, fmt, ...) \ 75#define pe_info(pe, fmt, ...) \
76 pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__) 76 pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
77 77
78static bool pnv_iommu_bypass_disabled __read_mostly;
79
80static int __init iommu_setup(char *str)
81{
82 if (!str)
83 return -EINVAL;
84
85 while (*str) {
86 if (!strncmp(str, "nobypass", 8)) {
87 pnv_iommu_bypass_disabled = true;
88 pr_info("PowerNV: IOMMU bypass window disabled.\n");
89 break;
90 }
91 str += strcspn(str, ",");
92 if (*str == ',')
93 str++;
94 }
95
96 return 0;
97}
98early_param("iommu", iommu_setup);
99
78/* 100/*
79 * stdcix is only supposed to be used in hypervisor real mode as per 101 * stdcix is only supposed to be used in hypervisor real mode as per
80 * the architecture spec 102 * the architecture spec
@@ -1351,7 +1373,9 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
1351 pnv_ioda_setup_bus_dma(pe, pe->pbus, true); 1373 pnv_ioda_setup_bus_dma(pe, pe->pbus, true);
1352 1374
1353 /* Also create a bypass window */ 1375 /* Also create a bypass window */
1354 pnv_pci_ioda2_setup_bypass_pe(phb, pe); 1376 if (!pnv_iommu_bypass_disabled)
1377 pnv_pci_ioda2_setup_bypass_pe(phb, pe);
1378
1355 return; 1379 return;
1356fail: 1380fail:
1357 if (pe->tce32_seg >= 0) 1381 if (pe->tce32_seg >= 0)