On Mon, 28 May 2018, Geert Uytterhoeven wrote: > > Do we have a consensus on the way forward?
My prefered solution remains the two driver patches that I originally submitted, which you objected to: https://lkml.org/lkml/2018/5/3/10 https://lkml.org/lkml/2018/5/3/9 So there is no consensus yet. To my mind, the existing code is pretty clear: drivers should set the (default) mask. See also, $ egrep -r -A1 "coherent_dma_mask.*expected" */ drivers/of/device.c: * Set default coherent_dma_mask to 32 bit. Drivers are expected to drivers/of/device.c- * setup the correct supported mask. -- drivers/acpi/arm64/iort.c: * Set default coherent_dma_mask to 32 bit. Drivers are expected to drivers/acpi/arm64/iort.c- * setup the correct supported mask. $ And drivers/usb/dwc2/platform.c: /* * Use reasonable defaults so platforms don't have to provide these. */ if (!dev->dev.dma_mask) dev->dev.dma_mask = &dev->dev.coherent_dma_mask; retval = dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32)); And FWIW, $ egrep -wlr "dma_set_mask_and_coherent|dma_set_coherent_mask|dma_coerce_mask_and_coherent" drivers/ | wc -l 196 I suppose that a driver should avoid lengthening an existing device mask. Since an arch gets to apply limits in the dma ops it implements, why would arch code also have to set a limit in the form of default platform device masks? Powerpc seems to be the only arch that does this. The same line of reasoning suggests that the problematic WARN_ON should not appear in include/linux/ in the first place. If it is needed by certain architectures, it should be in arch/x. I would send a patch to revert commit 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") if I thought that arch code was not somehow relying on it. But I'll leave that up to Chrisoph. --