[PATCH 3/3] of: address: Use dma_default_coherent to determine default coherency

Jiaxun Yang jiaxun.yang at flygoat.com
Wed Feb 22 09:57:44 PST 2023



> 2023年2月22日 17:24,Robin Murphy <robin.murphy at arm.com> 写道:

[...]

> 
> AFAICS, all you should actually need is a single self-contained addition here, something like:
> 
> + /*
> +  * DT-based MIPS doesn't use OF_DMA_DEFAULT_COHERENT, but
> +  * might override the system-wide default at runtime.
> +  */
> +#if defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE) || \
> + defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU) || \
> + defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
> + is_coherent = dma_default_coherent;
> +#endif

That makes more sense, thanks.
I’ll append CONFIG_MIPS as a condition here as well because it may break RISC-V whose dma_default_coherent
is not set to true from very beginning.

> 
>>     node = of_node_get(np);
>>  
> 
> Then *after* that's fixed, we can do a more comprehensive refactoring to merge the two mechanisms properly. FWIW I think I'd prefer an approach closer to the first one, where config options control the initial value of dma_default_coherent rather than architectures having to override it unconditionally (and TBH I'd also like to have a generic config symbol for whether an arch supports per-device coherency or not).

Ok I’ll try to revert to the initial way.
Is there any reason that an arch can’t support per-device coherency?

Thanks
- Jiaxun


> 
> Thanks,
> Robin.





More information about the linux-riscv mailing list