Re: [RFC, v3 9/9] media: platform: Add Mediatek ISP P1 shared memory device

Robin Murphy
2019-07-26T11:04:23Z

On 26/07/2019 08:42, Tomasz Figa wrote:
> On Fri, Jul 26, 2019 at 4:41 PM Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> wrote:
>>
>> On Fri, Jul 26, 2019 at 02:15:14PM +0900, Tomasz Figa wrote:
>>> Could you try dma_get_sgtable() with the SCP struct device and then
>>> dma_map_sg() with the P1 struct device?
>>
>> Please don't do that. dma_get_sgtable is a pretty broken API (see
>> the common near the arm implementation) and we should not add more
>> users of it. If you want a piece of memory that can be mapped to
>> multiple devices allocate it using alloc_pages and then just map
>> it to each device.
>
> Thanks for taking a look at this thread.
>
> Unfortunately that wouldn't work. We have a specific reserved memory
> pool that is the only memory area accessible to one of the devices.
> Any idea how to handle this?

If it's reserved in the sense of being outside struct-page-backed
"kernel memory", then provided you have a consistent CPU physical
address it might be reasonable for other devices to access it via
dma_map_resource().

Robin.