[PATCH 21/21] dma-mapping: replace custom code with generic implementation
Christoph Hellwig
hch at lst.de
Mon Mar 27 15:25:15 PDT 2023
> +static inline void arch_dma_cache_wback(phys_addr_t paddr, size_t size)
> {
> + dma_cache_wback(paddr, size);
> +}
>
> +static inline void arch_dma_cache_inv(phys_addr_t paddr, size_t size)
> +{
> + dma_cache_inv(paddr, size);
> }
> +static inline void arch_dma_cache_wback_inv(phys_addr_t paddr, size_t size)
> {
> + dma_cache_wback_inv(paddr, size);
> +}
There are the only calls for the three functions for each of the
involved functions. So I'd rather rename the low-level symbols
(and drop the pointless exports for two of them) rather than adding
these wrapppers.
The same is probably true for many other architectures.
> +static inline bool arch_sync_dma_clean_before_fromdevice(void)
> +{
> + return false;
> +}
>
> +static inline bool arch_sync_dma_cpu_needs_post_dma_flush(void)
> +{
> + return true;
> }
Is there a way to cut down on this boilerplate code by just having
sane default, and Kconfig options to override them if they are not
runtime decisions?
> +#include <linux/dma-sync.h>
I can't really say I like the #include version here despite your
rationale in the commit log. I can probably live with it if you
think it is absolutely worth it, but I'm really not in favor of it.
> +config ARCH_DMA_MARK_DCACHE_CLEAN
> + def_bool y
What do we need this symbol for? Unless I'm missing something it is
always enable for arm32, and only used in arm32 code.
More information about the linux-snps-arc
mailing list