Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/dma-iommu: Fix IOMMU window check

Checking for device mask to cover the whole IOMMU table is too strict.
IOMMU allocators should handle mask constraint properly for each
allocation.

The patch enables to use old AirPort Extreme cards on PowerMacs with
more than 1GB of memory; without the patch the driver init fails with:

b43-pci-bridge 0001:01:01.0: Warning: IOMMU window too big for device mask
b43-pci-bridge 0001:01:01.0: mask: 0x3fffffff, table end: 0x80000000
b43-phy0 ERROR: The machine/kernel does not support the required 30-bit DMA mask

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Aaro Koskinen and committed by
Benjamin Herrenschmidt
4c374af5 f0f0c9ac

+4 -5
+4 -5
arch/powerpc/kernel/dma-iommu.c
··· 83 83 return 0; 84 84 } 85 85 86 - if ((tbl->it_offset + tbl->it_size) > (mask >> IOMMU_PAGE_SHIFT)) { 87 - dev_info(dev, "Warning: IOMMU window too big for device mask\n"); 88 - dev_info(dev, "mask: 0x%08llx, table end: 0x%08lx\n", 89 - mask, (tbl->it_offset + tbl->it_size) << 90 - IOMMU_PAGE_SHIFT); 86 + if (tbl->it_offset > (mask >> IOMMU_PAGE_SHIFT)) { 87 + dev_info(dev, "Warning: IOMMU offset too big for device mask\n"); 88 + dev_info(dev, "mask: 0x%08llx, table offset: 0x%08lx\n", 89 + mask, tbl->it_offset << IOMMU_PAGE_SHIFT); 91 90 return 0; 92 91 } else 93 92 return 1;