Skip to contentSkip to conversation

dma-buf: system_heap: Add a system-uncached heap re-using the system heap

PATCH Hillf Danton 2 participants 2 messages Oct 30, 2020 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · On Thu, 29 Oct 2020 21:04:30 -0700 John Stultz wrote:

But I'll try to share my thoughts:

So the system heap allows for allocation of non-contiguous buffers (currently allocated from page_alloc), which we keep track using sglists.
Since the resulting dmabufs are shared between multiple devices, we want to provide a *specific type of memory* (in this case non-contiguous system memory), rather than what the underlying dma_alloc_attr() allocates for a specific device.

If the memory slice(just a page for simple case) from dma_alloc_attr(for device-A) does not work for device-B, nor can page_alloc do the job imho.

Quoted 6 lines

My sense is dma_mmap_wc() likely ought to be paired with switching to using dma_alloc_wc() as well, which calls down to dma_alloc_attr(). Maybe one could use dma_alloc_attr against the heap device to allocate chunks that we track in the sglist. But I'm not sure how that saves us much other than possibly swapping dma_mmap_wc() for remap_pfn_range()?

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 12 lines · Hillf Danton
Quoted 10 lines · On Thu, 29 Oct 2020 21:04:30 -0700 John Stultz wrote:

But I'll try to share my thoughts:

So the system heap allows for allocation of non-contiguous buffers (currently allocated from page_alloc), which we keep track using sglists.
Since the resulting dmabufs are shared between multiple devices, we want to provide a *specific type of memory* (in this case non-contiguous system memory), rather than what the underlying dma_alloc_attr() allocates for a specific device.

Quoted 3 lines

If the memory slice(just a page for simple case) from dma_alloc_attr(for device-A) does not work for device-B, nor can page_alloc do the job imho.

Right. That's why userland chooses which heap to allocate from, as it's the only one that knows the path the buffer will take.

thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel