Re: dma_mmap_fault discussion

From: Thomas HellstrÃm (VMware)
Date: Fri Sep 06 2019 - 03:10:16 EST


On 9/6/19 8:32 AM, Christoph Hellwig wrote:
On Thu, Sep 05, 2019 at 07:05:43PM +0200, Thomas HellstrÃm (VMware) wrote:
I took a quick look at the interfaces and have two questions:

1) dma_mmap_prepare(), would it be possible to drop the references to the
actual coherent region? The thing is that TTM doesn't know at mmap time what
memory will be backing the region. It can be VRAM, coherent memory or system
I guess we can shift the argument checking into the fault handler.

2) @cpu_addr and @dma_addr are the values pointing at the beginning of an
allocated chunk, right?
Yes.

The reason I'm asking is that TTM's coherent memory
pool is sub-allocating from larger chunks into smaller PAGE_SIZE chunks,
which means that a TTM buffer object may be randomly split across larger
chunks, which means we have to store these values for each PAGE_SiZE chunk.
For implementations that remap non-contigous regions using vmap we need the
start cpu address passed, as that is used to find the vm_struct structure
for it. That being said I don't see a problem with you keeping track
of the original start and offset into in your suballocation helpers.

It's definitely possible. I was just wondering whether it was necessary, but it seems like it.

Thanks,

Thomas