Skip to content

Commit 19a2aa9

Browse files
committed
dma-mapping: MMIO mappings still need phys_to_dma
The new concept of MMIO DMA addresses is used to indicate things with fixed addresses - hardware registers, not movable pages. As such it is reasonable to bypass the SWIOTLB mapping logic, but not any CPU<->DMA address translation that has been configured by Device Tree. Doing so will break any drives using (possibly indirectly) dma_map_resource for register addresses where ther is a non-identity mapping between CPU and DMA addresses. A good example of this is the SDHOST MMC interface on BCM283x SoCs. Fix the bug by reinstating the phys_to_dma call in the MMIO code path. N.B. The upstream SDHOST driver (drivers/mmc/host/bcm2835.c) is not affected by this bug because it pulls bus/DMA addresses directly out of Device Tree. See: #7136 Fixes: e53d29f ("dma-mapping: convert dma_direct_*map_page to be phys_addr_t based") Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent 671d4ea commit 19a2aa9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/dma/direct.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static inline dma_addr_t dma_direct_map_phys(struct device *dev,
9494
}
9595

9696
if (attrs & DMA_ATTR_MMIO) {
97-
dma_addr = phys;
97+
dma_addr = phys_to_dma(dev, phys);
9898
if (unlikely(!dma_capable(dev, dma_addr, size, false)))
9999
goto err_overflow;
100100
} else {

0 commit comments

Comments
 (0)