Re: [PATCH v4 02/15] dma: Allow dma_get_cache_alignment() to return the smaller cache_line_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 18, 2023 at 06:33:50PM +0100, Catalin Marinas wrote:
> On architectures like arm64, ARCH_DMA_MINALIGN is larger than most cache
> line size configurations deployed. However, the single kernel binary
> requirement doesn't allow the smaller ARCH_DMA_MINALIGN. Permit an
> architecture to opt in to dma_get_cache_alignment() returning
> cache_line_size() which can be probed at run-time.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Robin Murphy <robin.murphy@xxxxxxx>
> Cc: Will Deacon <will@xxxxxxxxxx>
> ---
>  include/linux/dma-mapping.h | 2 ++
>  kernel/dma/Kconfig          | 7 +++++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 3288a1339271..b29124341317 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -545,6 +545,8 @@ static inline int dma_set_min_align_mask(struct device *dev,
>  
>  static inline int dma_get_cache_alignment(void)
>  {
> +	if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_CACHE_LINE_SIZE))
> +		return cache_line_size();
>  #ifdef ARCH_HAS_DMA_MINALIGN
>  	return ARCH_DMA_MINALIGN;
>  #endif

Maybe allowing architectures to simply override
dma_get_cache_alignment would be a little cleaner rather than adding
yet another abstraction?  That might also be able to repace
ARCH_DMA_MINALIGN in follow on cleanup.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux