Message ID | 20190530070355.121802-2-aik@ozlabs.ru (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | powerpc/ioda2: Yet another attempt to allow DMA masks between 32 and 59 | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (8150a153c013aa2dd1ffae43370b89ac1347a7fb) |
snowpatch_ozlabs/checkpatch | warning | total: 0 errors, 1 warnings, 0 checks, 23 lines checked |
On Thu, May 30, 2019 at 05:03:53PM +1000, Alexey Kardashevskiy wrote: > POWER8 and newer support a bypass mode which maps all host memory to > PCI buses so an IOMMU table is not always required. However if we fail to > create such a table, the DMA setup fails and the kernel does not boot. > > This skips the 32bit DMA setup check if the bypass is can be selected. > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > --- > > This minor thing helped me debugging next 2 patches so it can help > somebody else too. > --- > arch/powerpc/kernel/dma-iommu.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c > index 09231ef06d01..809c1dc01edf 100644 > --- a/arch/powerpc/kernel/dma-iommu.c > +++ b/arch/powerpc/kernel/dma-iommu.c > @@ -118,18 +118,17 @@ int dma_iommu_dma_supported(struct device *dev, u64 mask) > { > struct iommu_table *tbl = get_iommu_table_base(dev); > > - if (!tbl) { > - dev_info(dev, "Warning: IOMMU dma not supported: mask 0x%08llx" > - ", table unavailable\n", mask); > - return 0; > - } > - > if (dev_is_pci(dev) && dma_iommu_bypass_supported(dev, mask)) { > dev->archdata.iommu_bypass = true; > dev_dbg(dev, "iommu: 64-bit OK, using fixed ops\n"); > return 1; > } > > + if (!tbl) { > + dev_err(dev, "Warning: IOMMU dma not supported: mask 0x%08llx, table unavailable\n", mask); > + return 0; > + } > + > if (tbl->it_offset > (mask >> tbl->it_page_shift)) { > dev_info(dev, "Warning: IOMMU offset too big for device mask\n"); > dev_info(dev, "mask: 0x%08llx, table offset: 0x%08lx\n",
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c index 09231ef06d01..809c1dc01edf 100644 --- a/arch/powerpc/kernel/dma-iommu.c +++ b/arch/powerpc/kernel/dma-iommu.c @@ -118,18 +118,17 @@ int dma_iommu_dma_supported(struct device *dev, u64 mask) { struct iommu_table *tbl = get_iommu_table_base(dev); - if (!tbl) { - dev_info(dev, "Warning: IOMMU dma not supported: mask 0x%08llx" - ", table unavailable\n", mask); - return 0; - } - if (dev_is_pci(dev) && dma_iommu_bypass_supported(dev, mask)) { dev->archdata.iommu_bypass = true; dev_dbg(dev, "iommu: 64-bit OK, using fixed ops\n"); return 1; } + if (!tbl) { + dev_err(dev, "Warning: IOMMU dma not supported: mask 0x%08llx, table unavailable\n", mask); + return 0; + } + if (tbl->it_offset > (mask >> tbl->it_page_shift)) { dev_info(dev, "Warning: IOMMU offset too big for device mask\n"); dev_info(dev, "mask: 0x%08llx, table offset: 0x%08lx\n",
POWER8 and newer support a bypass mode which maps all host memory to PCI buses so an IOMMU table is not always required. However if we fail to create such a table, the DMA setup fails and the kernel does not boot. This skips the 32bit DMA setup check if the bypass is can be selected. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- This minor thing helped me debugging next 2 patches so it can help somebody else too. --- arch/powerpc/kernel/dma-iommu.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)