[PATCH v3 13/13] dma: arm64: Add CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC and enable it for arm64

Christoph Hellwig hch at lst.de
Mon Nov 7 06:38:49 PST 2022


On Mon, Nov 07, 2022 at 01:03:31PM +0000, Robin Murphy wrote:
> 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.

FYI, one of the reasons for the swiotlb_init refactor that passes
flags and a boolean a while ago is that we can trivially just either
pass another flag or check a condition in swiotlb_init to allocate the
buffer.  There's actually another case for which we need the
unconditional allocation, and that is the bouncing for untrusted
external devices with dma-iommu.



More information about the linux-arm-kernel mailing list