Re: [PATCH v3 net] octeontx2-af: allocate qmem from page allocator to avoid CMA
From: Ratheesh Kannoth
Date: Sun Aug 30 2026 - 22:39:13 EST
On 2026-08-27 at 12:35:53, Ratheesh Kannoth (rkannoth@xxxxxxxxxxx) wrote:
> qmem_alloc() uses dma_alloc_attrs() with DMA_ATTR_FORCE_CONTIGUOUS for
> physically contiguous DMA memory (e.g. CN10K LMTST regions spanning page
> boundaries). With CMA enabled, those allocations are drawn from the CMA
> pool. qmem backs NIX/NPA queue contexts, admin queues, and LMTST regions,
> so total usage scales with enabled interfaces and is hard to provision in
> CMA.
>
> Add otx2_dma_alloc_coherent() and otx2_dma_free_coherent() helpers that
> allocate compound pages from the buddy allocator via __get_free_pages()
> with __GFP_COMP, __GFP_ZERO, and __GFP_RECLAIM (qmem_alloc() runs in
> GFP_KERNEL context), select DMA-reachable memory with dma_coherent_ok()
> (retrying with GFP_DMA32), and map the contiguous physical range for DMA
> through dma_map_phys() and dma_unmap_phys() with DMA_ATTR_REQUIRE_COHERENT
> so SMMU/IOMMU page table entries are installed on IOMMU-backed platforms.
> Switch qmem_alloc() and qmem_free() to these helpers instead of
> dma_alloc_attrs()/dma_free_attrs() with DMA_ATTR_FORCE_CONTIGUOUS.
>
Will address compilation issues in v4.
pw-bot: changes-requested