[PATCH v3 13/13] dma: arm64: Add CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC and enable it for arm64
Robin Murphy
robin.murphy at arm.com
Mon Nov 7 05:03:31 PST 2022
On 2022-11-06 22:01, Catalin Marinas wrote:
> With all the infrastructure in place for bouncing small kmalloc()
> buffers, add the corresponding Kconfig entry and select it for arm64.
AFAICS we're missing the crucial part to ensure that SWIOTLB is
available even when max_pfn <= arm64_dma_phys_limit, which is very
likely to be true on low-memory systems that care most about kmalloc
wastage. The only way to override that currently is with
"swiotlb=force", but bouncing *everything* is not desirable either.
Thanks,
Robin.
> Signed-off-by: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Christoph Hellwig <hch at lst.de>
> Cc: Robin Murphy <robin.murphy at arm.com>
> ---
> arch/arm64/Kconfig | 1 +
> kernel/dma/Kconfig | 8 ++++++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 3991cb7b8a33..f889cf16e6ab 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -100,6 +100,7 @@ config ARM64
> select ARCH_WANT_FRAME_POINTERS
> select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
> select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
> + select ARCH_WANT_KMALLOC_DMA_BOUNCE
> select ARCH_WANT_LD_ORPHAN_WARN
> select ARCH_WANTS_NO_INSTR
> select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES
> diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> index d6fab8e3cbae..b56e76371023 100644
> --- a/kernel/dma/Kconfig
> +++ b/kernel/dma/Kconfig
> @@ -86,6 +86,14 @@ config SWIOTLB
> bool
> select NEED_DMA_MAP_STATE
>
> +config ARCH_WANT_KMALLOC_DMA_BOUNCE
> + bool
> +
> +config DMA_BOUNCE_UNALIGNED_KMALLOC
> + def_bool y
> + depends on ARCH_WANT_KMALLOC_DMA_BOUNCE
> + depends on SWIOTLB && !SLOB
> +
> config DMA_RESTRICTED_POOL
> bool "DMA Restricted Pool"
> depends on OF && OF_RESERVED_MEM && SWIOTLB
More information about the linux-arm-kernel
mailing list