[PATCH v6 03/20] dma-direct: use DMA_ATTR_CC_SHARED in alloc/free paths
Jason Gunthorpe
jgg at ziepe.ca
Thu Jul 2 07:47:29 PDT 2026
On Thu, Jul 02, 2026 at 10:25:16AM +1000, Alexey Kardashevskiy wrote:
> > > not externally available so I'll have to trick the DMA layer into
> > > using SWIOTLB (which is still all shared, right?) as I specifically
> > > want to skip page conversions. Setting low DMA mask won't guarantee
> > > that the DMA layer won't allocate a page outside of SWIOTLB and
> > > convert it. Manually do
> >
> > Why so particular?
>
> aahhh I missed "pre-". I need a way to get pre-shared pages for my
> sev-guest activities.
It sounds to me like you don't, what you are worried about is
optimizing the dma_alloc_coherent flow to avoid fragmentation and all
CC architetures require this optimization.
So I'm strongly against you trying to open code something in your
driver. Use the DMA API as-is. Propose general DMA API improvements to
reduce the fragmentation problem. It is a real problem.
Jason
More information about the linux-arm-kernel
mailing list