Re: [RFC][PATCH 0/5 v2] DMA-BUF Heaps (destaging ION)
From: John Stultz
Date: Wed Mar 20 2019 - 12:11:46 EST
On Wed, Mar 20, 2019 at 2:16 AM Benjamin Gaignard
> Le mar. 19 mars 2019 Ã 23:36, John Stultz <john.stultz@xxxxxxxxxx> a Ãcrit :
> > On Tue, Mar 19, 2019 at 2:58 PM Rob Clark <robdclark@xxxxxxxxx> wrote:
> > > For at least some hw the importing driver needs to configure things
> > > differently for secure buffers :-/
> > Does the import ioctl need/use a flag for that then? Userland already
> > has to keep meta-data about dmabufs around.
> To secure a buffer you need to know who is allowed to write/read it and
> hardware block involved in the dataflow may need to know that the buffer
> is secure to configure themself.
> As example for a video decoding you allow hw video decoder to read in
> a buffer and display to read it. You can also allow cpu to write on the buffer
> to add subtitles. For that we need to be able to mmap/kmap the buffer.
> Using a carveout heap for secure buffer mean that you reserved a large
> memory region only for this purpose, that isn't possible on embedded device
> where we are always limited in memory so we use CMA.
> In the past I have used dmabuf's attach function to know who write into
> the buffer and then configure who will be able to read it. It was working well
> but the issue was how to in generic way this behavior.
Given the complexity of the configuration needed when allocating the
buffer, instead of trying to make a generic secure buffer allocator,
would having per-usege heaps make sense? It just feels there are so
many specifics to the secure buffer setup and configuration that maybe
there can't be a generic configuration interface. So instead maybe we
let the heap implementations provide set usage configs?
This doesn't necessarily require that you have separate pools of
memory (they can share the same backing store), but by having multiple
per-config heap devices, maybe this could avoid trying to fit all the
options into one interface?
On the import side, I'm not sure how much the importing device needs
to know about the specific rules here (out side of "secure buffer" or
not), so maybe that's another catch.