[PATCH v6 7/9] dma-buf: system_heap: Enforce shared-granule alignment for cc-shared buffers
Jason Gunthorpe
jgg at ziepe.ca
Mon Sep 21 05:17:39 PDT 2026
On Mon, Sep 21, 2026 at 02:05:50PM +0200, Christian König wrote:
> On 9/21/26 13:51, Jason Gunthorpe wrote:
> > On Mon, Sep 21, 2026 at 11:07:17AM +0200, Christian König wrote:
> >> 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? How is it any different from the existing alloc pages?
>
> That you need to specify that this is for DMA without encryption.
It is not for "DMA without encryption". It creates shared pages in a
CC guest which *every* guest device can DMA from.
> >> That userspace provides this cc_shared flag is a NO-GO to begin
> >> with.
> >
> > What do you mean? We discussed this with the heap maintainers and we
> > all agreed this was a kind of heap just like any of the other kinds of
> > heaps that userspace can request.
> >
> > It is *exactly* the "special allocation requirements" you are talking
> > about above.
>
> I only see a fraction of the patch set (because no DMA-buf
> maintainer was CCed) and to me it looked like the cc_shared flag was
> added as an additional parameter to the allocation and not a
> separate heap created.
?
It was merged months ago, and you were CC'd:
https://lore.kernel.org/all/20260325192352.437608-1-jiri@resnulli.us/
It follows the design the dma heaps maintiners guided to create a new
named heap:
+ exp_info.name = "system_cc_shared";
+ exp_info.priv = &system_heap_cc_shared_priv;
Along side the normal heap:
exp_info.name = "system";
It is identical to "system" except the pages are "CC shared" meaning
the hypervisor and every DMA device can access them.
This series is just adjusting the rules around how
set_memory_decrypted() works. It isn't changing any uAPI or adding
anything new to dmabuf heaps.
Yes, it ends up as a flag in the internal code flow, that is just how
it got coded..
Jason
More information about the linux-arm-kernel
mailing list