Re: [PATCH v6 7/9] dma-buf: system_heap: Enforce shared-granule alignment for cc-shared buffers

From: Christian König

Date: Mon Sep 21 2026 - 05:11:54 EST


On 9/18/26 18:53, Jason Gunthorpe wrote:
> On Fri, Sep 18, 2026 at 05:39:55PM +0200, Christian König wrote:
>
>>> Arch code can figure out how to do it. If some ARM configs only give
>>> order 4 folios or whatever then dmabuf heap doesn't care.
>>
>> The fundamental problem is that DMA allocations are highly
>> architecture and device specific while Linux memory allocation APIs
>> are generic.
>
> This isn't a dma allocation, this is a memory allocation.

No, I mean this is a DMA-buf heaps allocation. It is a DMA allocation, we just don't know for which device.

So ideally we should use resources which work for most devices in the system. If a device has special allocation requirements (CMA, restricted addressing etc...) we need a specialized DMA-buf heaps for it.

That userspace provides this cc_shared flag is a NO-GO to begin with.

Regards,
Christian.
> We made things so the CC shared folios are DMA mappable through the
> DMA API. From the heap perspective the only difference is passing an
> additional DMA_ATTR_CC_SHARED when DMA mapping the folio.
>
> Jason