]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/iommu: Allow bypass-only for DMA
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Thu, 18 Jul 2019 05:11:37 +0000 (15:11 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 19 Aug 2019 03:20:23 +0000 (13:20 +1000)
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 selected.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190718051139.74787-3-aik@ozlabs.ru
arch/powerpc/kernel/dma-iommu.c

index a0879674a9c875c82cd9af54a252f447b631e677..c963d704fa31384024839e41b5cfa6b012e3e043 100644 (file)
@@ -122,18 +122,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",