Devices can be inherently DMA coherent and thus dma_alloc_coherent could be implemented as a normal allocation. While using uncached memory in this case isn't wrong, it can lead to a a very stark performance degradation as identified in this patch[1] when barebox ran under KVM. Additionally, devices may have addressing limitations (dma_set_coherent_mask) or a non-1:1 mapping in the coherent DMA case. Therefore, let's do what we already do for streaming DMA and give the coherent/writecombine DMA functions an extra device parameter. This parameter is currently unused, but in future we can use it to handle devices that are already DMA coherent specially. [1]: https://lore.barebox.org/barebox/20241009060511.4121157-6-a.fatoum@xxxxxxxxxxxxxx/ Ahmad Fatoum (6): dma: make DMA_ADDRESS_BROKEN type-safe video: stm: use DMA_ADDRESS_BROKEN instead of NULL crypto: caam - pbl-init: use DMA_ADDRESS_BROKEN instead of NULL net: designware: don't use dma_mapping_error for non-streaming DMA net: macb: fix DMA_ADDRESS_BROKEN in the coherent ring allocations dma: give dma_alloc_coherent a device parameter arch/arm/cpu/mmu-common.c | 11 +++++--- arch/arm/cpu/mmu-common.h | 4 ++- arch/arm/cpu/mmu_32.c | 4 +-- arch/arm/cpu/mmu_64.c | 4 +-- arch/arm/include/asm/dma.h | 13 +++++++--- arch/kvx/include/asm/dma.h | 8 ++++-- arch/mips/include/asm/dma.h | 8 ++++-- arch/riscv/cpu/dma.c | 16 +++++++----- arch/riscv/include/asm/dma.h | 6 +++-- arch/sandbox/include/asm/dma.h | 13 +++++++--- arch/x86/include/asm/dma.h | 8 ++++-- commands/smc.c | 2 +- drivers/ata/ahci.c | 6 +++-- drivers/crypto/caam/caamrng.c | 3 ++- drivers/crypto/caam/jr.c | 9 ++++--- drivers/crypto/caam/pbl-init.c | 3 ++- drivers/firmware/qemu_fw_cfg.c | 3 ++- drivers/mci/dw_mmc.c | 3 ++- drivers/mtd/nand/raw/nand_mxs.c | 8 +++--- drivers/net/ag71xx.c | 6 +++-- drivers/net/arc_emac.c | 6 +++-- drivers/net/at91_ether.c | 6 +++-- drivers/net/designware.c | 10 +++++--- drivers/net/designware_eqos.c | 9 ++++--- drivers/net/e1000/main.c | 6 +++-- drivers/net/fec_imx.c | 6 +++-- drivers/net/fsl-fman.c | 10 +++++--- drivers/net/fsl_enetc.c | 6 +++-- drivers/net/macb.c | 25 +++++++++++-------- drivers/net/mvneta.c | 6 +++-- drivers/net/orion-gbe.c | 6 +++-- drivers/net/r8169_main.c | 16 +++++++----- drivers/net/rtl8139.c | 12 ++++++--- drivers/nvme/host/pci.c | 15 +++++++---- drivers/soc/starfive/jh7100_dma.c | 6 +++-- drivers/usb/dwc3/core.c | 6 +++-- drivers/usb/dwc3/gadget.c | 24 ++++++++++++------ drivers/usb/gadget/udc/fsl_udc.c | 10 +++++--- drivers/usb/host/ehci-hcd.c | 29 ++++++++++++++-------- drivers/usb/host/ohci-hcd.c | 6 ++--- drivers/usb/host/xhci-mem.c | 2 +- drivers/video/atmel_lcdfb_core.c | 6 +++-- drivers/video/imx-ipu-fb.c | 3 ++- drivers/video/imx-ipu-v3/ipufb.c | 3 ++- drivers/video/omap.c | 9 ++++--- drivers/video/pxa.c | 6 +++-- drivers/video/ramfb.c | 6 +++-- drivers/video/rockchip/rockchip_drm_vop2.c | 5 ++-- drivers/video/stm.c | 3 ++- drivers/video/stm32_ltdc.c | 3 ++- drivers/virtio/virtio_ring.c | 4 +-- include/dma.h | 9 ++++--- 52 files changed, 270 insertions(+), 147 deletions(-) -- 2.39.5