Merge tag 'dma-mapping-4.19-2' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fixes from Christoph Hellwig:
"A few fixes for the fallout of being a little more pedantic about dma
masks"

* tag 'dma-mapping-4.19-2' of git://git.infradead.org/users/hch/dma-mapping:
of/platform: initialise AMBA default DMA masks
sparc: set a default 32-bit dma mask for OF devices
kernel/dma/direct: take DMA offset into account in dma_direct_supported

Changed files
+13 -2
arch
drivers
kernel
dma
+4
arch/sparc/kernel/of_device_32.c
··· 9 9 #include <linux/irq.h> 10 10 #include <linux/of_device.h> 11 11 #include <linux/of_platform.h> 12 + #include <linux/dma-mapping.h> 12 13 #include <asm/leon.h> 13 14 #include <asm/leon_amba.h> 14 15 ··· 381 380 dev_set_name(&op->dev, "root"); 382 381 else 383 382 dev_set_name(&op->dev, "%08x", dp->phandle); 383 + 384 + op->dev.coherent_dma_mask = DMA_BIT_MASK(32); 385 + op->dev.dma_mask = &op->dev.coherent_dma_mask; 384 386 385 387 if (of_device_register(op)) { 386 388 printk("%s: Could not register of device.\n",
+3
arch/sparc/kernel/of_device_64.c
··· 2 2 #include <linux/string.h> 3 3 #include <linux/kernel.h> 4 4 #include <linux/of.h> 5 + #include <linux/dma-mapping.h> 5 6 #include <linux/init.h> 6 7 #include <linux/export.h> 7 8 #include <linux/mod_devicetable.h> ··· 676 675 dev_set_name(&op->dev, "root"); 677 676 else 678 677 dev_set_name(&op->dev, "%08x", dp->phandle); 678 + op->dev.coherent_dma_mask = DMA_BIT_MASK(32); 679 + op->dev.dma_mask = &op->dev.coherent_dma_mask; 679 680 680 681 if (of_device_register(op)) { 681 682 printk("%s: Could not register of device.\n",
+4
drivers/of/platform.c
··· 241 241 if (!dev) 242 242 goto err_clear_flag; 243 243 244 + /* AMBA devices only support a single DMA mask */ 245 + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 246 + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; 247 + 244 248 /* setup generic device info */ 245 249 dev->dev.of_node = of_node_get(node); 246 250 dev->dev.fwnode = &node->fwnode;
+2 -2
kernel/dma/direct.c
··· 168 168 int dma_direct_supported(struct device *dev, u64 mask) 169 169 { 170 170 #ifdef CONFIG_ZONE_DMA 171 - if (mask < DMA_BIT_MASK(ARCH_ZONE_DMA_BITS)) 171 + if (mask < phys_to_dma(dev, DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))) 172 172 return 0; 173 173 #else 174 174 /* ··· 177 177 * memory, or by providing a ZONE_DMA32. If neither is the case, the 178 178 * architecture needs to use an IOMMU instead of the direct mapping. 179 179 */ 180 - if (mask < DMA_BIT_MASK(32)) 180 + if (mask < phys_to_dma(dev, DMA_BIT_MASK(32))) 181 181 return 0; 182 182 #endif 183 183 /*