linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Questions regarding DMA buffer sharing using IOMMU
@ 2014-05-12  9:42 Pintu Kumar
  2014-05-12 12:00 ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Pintu Kumar @ 2014-05-12  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,?
I have some queries regarding IOMMU and CMA buffer sharing.?
We have an embedded linux device (kernel 3.10, RAM: 256Mb) in which camera and codec supports IOMMU but the display does not support IOMMU.?
Thus for camera capture we are using iommu buffers using ION/DMABUF. But for all display rendering we are using CMA buffers.?
So, the question is how to achieve buffer sharing (zero-copy) between Camera and Display using only IOMMU??
Currently we are achieving zero-copy using CMA. And we are exploring options to use IOMMU.?
Now we wanted to know which option is better? To use IOMMU or CMA??
If anybody have come across these design please share your thoughts and results.?


Thank You!?
Regards,?
Pintu

 		 	   		  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Questions regarding DMA buffer sharing using IOMMU
  2014-05-12  9:42 Questions regarding DMA buffer sharing using IOMMU Pintu Kumar
@ 2014-05-12 12:00 ` Arnd Bergmann
  2014-05-12 14:37   ` Pintu Kumar
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2014-05-12 12:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 12 May 2014 15:12:41 Pintu Kumar wrote:
> Hi, 
> I have some queries regarding IOMMU and CMA buffer sharing. 
> We have an embedded linux device (kernel 3.10, RAM: 256Mb) in 
> which camera and codec supports IOMMU but the display does not support IOMMU. 
> Thus for camera capture we are using iommu buffers using
> ION/DMABUF. But for all display rendering we are using CMA buffers. 
> So, the question is how to achieve buffer sharing (zero-copy)
> between Camera and Display using only IOMMU? 
> Currently we are achieving zero-copy using CMA. And we are
> exploring options to use IOMMU. 
> Now we wanted to know which option is better? To use IOMMU or CMA? 
> If anybody have come across these design please share your thoughts and results. 

There is a slight performance overhead in using the IOMMU in general,
because the IOMMU has to fetch the page table entries from memory
at least some of the time.

If that overhead is within the constraints you have for transfers between
camera and codec, you are always better off using IOMMU since that
means you don't have to do memory migration.

Note however, that we don't have a way to describe IOMMU relations
to devices in DT, so whatever you come up with to do this will most
likely be incompatible with what we do in future kernel versions.

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Questions regarding DMA buffer sharing using IOMMU
  2014-05-12 12:00 ` Arnd Bergmann
@ 2014-05-12 14:37   ` Pintu Kumar
  2014-05-12 16:27     ` Laura Abbott
  0 siblings, 1 reply; 6+ messages in thread
From: Pintu Kumar @ 2014-05-12 14:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,
Thanks for the reply.

----------------------------------------
> From: arnd at arndb.de
> To: linux-arm-kernel at lists.infradead.org
> CC: pintu.k at outlook.com; linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
> Date: Mon, 12 May 2014 14:00:57 +0200
>
> On Monday 12 May 2014 15:12:41 Pintu Kumar wrote:
>> Hi,
>> I have some queries regarding IOMMU and CMA buffer sharing.
>> We have an embedded linux device (kernel 3.10, RAM: 256Mb) in
>> which camera and codec supports IOMMU but the display does not support IOMMU.
>> Thus for camera capture we are using iommu buffers using
>> ION/DMABUF. But for all display rendering we are using CMA buffers.
>> So, the question is how to achieve buffer sharing (zero-copy)
>> between Camera and Display using only IOMMU?
>> Currently we are achieving zero-copy using CMA. And we are
>> exploring options to use IOMMU.
>> Now we wanted to know which option is better? To use IOMMU or CMA?
>> If anybody have come across these design please share your thoughts and results.
>
> There is a slight performance overhead in using the IOMMU in general,
> because the IOMMU has to fetch the page table entries from memory
> at least some of the time.

Ok, we need to check performance later

>
> If that overhead is within the constraints you have for transfers between
> camera and codec, you are always better off using IOMMU since that
> means you don't have to do memory migration.

Transfer between camera is codec is fine. But our major concern is single buffer?
sharing between camera & display. Here camera supports iommu but display does not support iommu.
Is it possible to render camera preview (iommu buffers) on display (not iommu and required physical contiguous overlay memory)?

Also is it possible to buffer sharing between 2 iommu supported devices?

>
> Note however, that we don't have a way to describe IOMMU relations
> to devices in DT, so whatever you come up with to do this will most
> likely be incompatible with what we do in future kernel versions.
>
> Arnd
 		 	   		  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Questions regarding DMA buffer sharing using IOMMU
  2014-05-12 14:37   ` Pintu Kumar
@ 2014-05-12 16:27     ` Laura Abbott
  2014-05-13  4:57       ` Pintu Kumar
  2014-05-13  5:41       ` Pintu Kumar
  0 siblings, 2 replies; 6+ messages in thread
From: Laura Abbott @ 2014-05-12 16:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 5/12/2014 7:37 AM, Pintu Kumar wrote:
> Hi,
> Thanks for the reply.
> 
> ----------------------------------------
>> From: arnd at arndb.de
>> To: linux-arm-kernel at lists.infradead.org
>> CC: pintu.k at outlook.com; linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
>> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
>> Date: Mon, 12 May 2014 14:00:57 +0200
>>
>> On Monday 12 May 2014 15:12:41 Pintu Kumar wrote:
>>> Hi,
>>> I have some queries regarding IOMMU and CMA buffer sharing.
>>> We have an embedded linux device (kernel 3.10, RAM: 256Mb) in
>>> which camera and codec supports IOMMU but the display does not support IOMMU.
>>> Thus for camera capture we are using iommu buffers using
>>> ION/DMABUF. But for all display rendering we are using CMA buffers.
>>> So, the question is how to achieve buffer sharing (zero-copy)
>>> between Camera and Display using only IOMMU?
>>> Currently we are achieving zero-copy using CMA. And we are
>>> exploring options to use IOMMU.
>>> Now we wanted to know which option is better? To use IOMMU or CMA?
>>> If anybody have come across these design please share your thoughts and results.
>>
>> There is a slight performance overhead in using the IOMMU in general,
>> because the IOMMU has to fetch the page table entries from memory
>> at least some of the time.
> 
> Ok, we need to check performance later
> 
>>
>> If that overhead is within the constraints you have for transfers between
>> camera and codec, you are always better off using IOMMU since that
>> means you don't have to do memory migration.
> 
> Transfer between camera is codec is fine. But our major concern is single buffer 
> sharing between camera & display. Here camera supports iommu but display does not support iommu.
> Is it possible to render camera preview (iommu buffers) on display (not iommu and required physical contiguous overlay memory)?
> 

I'm pretty sure the answer is no for zero copy IOMMU buffers if one of your
devices does not support IOMMU. If the data is coming in as individual pages
and the hardware does not support scattered pages there isn't much you can
do except copy to a contiguous buffer. At least with Ion, the heap types can
be set up in a particular way such that the client need never know about the
existence of an IOMMU or not. 

> Also is it possible to buffer sharing between 2 iommu supported devices?
> 

I don't see why not but there isn't a lot of information to go on here.

Thanks,
Laura

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Questions regarding DMA buffer sharing using IOMMU
  2014-05-12 16:27     ` Laura Abbott
@ 2014-05-13  4:57       ` Pintu Kumar
  2014-05-13  5:41       ` Pintu Kumar
  1 sibling, 0 replies; 6+ messages in thread
From: Pintu Kumar @ 2014-05-13  4:57 UTC (permalink / raw)
  To: linux-arm-kernel

Thanks Lauraa for your answers.
I have few more queries below.?

----------------------------------------
> Date: Mon, 12 May 2014 09:27:27 -0700
> From: lauraa at codeaurora.org
> To: pintu.k at outlook.com; arnd at arndb.de; linux-arm-kernel at lists.infradead.org
> CC: linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
>
> On 5/12/2014 7:37 AM, Pintu Kumar wrote:
>> Hi,
>> Thanks for the reply.
>>
>> ----------------------------------------
>>> From: arnd at arndb.de
>>> To: linux-arm-kernel at lists.infradead.org
>>> CC: pintu.k at outlook.com; linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
>>> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
>>> Date: Mon, 12 May 2014 14:00:57 +0200
>>>
>>> On Monday 12 May 2014 15:12:41 Pintu Kumar wrote:
>>>> Hi,
>>>> I have some queries regarding IOMMU and CMA buffer sharing.
>>>> We have an embedded linux device (kernel 3.10, RAM: 256Mb) in
>>>> which camera and codec supports IOMMU but the display does not support IOMMU.
>>>> Thus for camera capture we are using iommu buffers using
>>>> ION/DMABUF. But for all display rendering we are using CMA buffers.
>>>> So, the question is how to achieve buffer sharing (zero-copy)
>>>> between Camera and Display using only IOMMU?
>>>> Currently we are achieving zero-copy using CMA. And we are
>>>> exploring options to use IOMMU.
>>>> Now we wanted to know which option is better? To use IOMMU or CMA?
>>>> If anybody have come across these design please share your thoughts and results.
>>>
>>> There is a slight performance overhead in using the IOMMU in general,
>>> because the IOMMU has to fetch the page table entries from memory
>>> at least some of the time.
>>
>> Ok, we need to check performance later
>>
>>>
>>> If that overhead is within the constraints you have for transfers between
>>> camera and codec, you are always better off using IOMMU since that
>>> means you don't have to do memory migration.
>>
>> Transfer between camera is codec is fine. But our major concern is single buffer
>> sharing between camera & display. Here camera supports iommu but display does not support iommu.
>> Is it possible to render camera preview (iommu buffers) on display (not iommu and required physical contiguous overlay memory)?
>>
>
> I'm pretty sure the answer is no for zero copy IOMMU buffers if one of your
> devices does not support IOMMU. If the data is coming in as individual pages
> and the hardware does not support scattered pages there isn't much you can
> do except copy to a contiguous buffer. At least with Ion, the heap types can
> be set up in a particular way such that the client need never know about the
> existence of an IOMMU or not.

So, the zero copy cannot be achieved between iommu and non-iommu devices?
Do you have any references like in case of QC MSM8974/etc, how this is achieved?

Yes, we are using ION, with SYSTEM_HEAP, for IOMMU, in case of camera, but still we could not?
render the preview on display.
You mean to say, with ION it is possible to do buffer sharing(a.k.a zero copy) ?using the IOMMU heap?


>
>> Also is it possible to buffer sharing between 2 iommu supported devices?
>>
>
> I don't see why not but there isn't a lot of information to go on here.

Is this also possible with ION?
Can you point out some use cases?
Like in our cases camera, codec and GPU have IOMMU. Is it possible to do zero copy here?


>
> Thanks,
> Laura
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
 		 	   		  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Questions regarding DMA buffer sharing using IOMMU
  2014-05-12 16:27     ` Laura Abbott
  2014-05-13  4:57       ` Pintu Kumar
@ 2014-05-13  5:41       ` Pintu Kumar
  1 sibling, 0 replies; 6+ messages in thread
From: Pintu Kumar @ 2014-05-13  5:41 UTC (permalink / raw)
  To: linux-arm-kernel

Thanks Lauraa for your answers.
I have few more queries below.?

----------------------------------------
> Date: Mon, 12 May 2014 09:27:27 -0700
> From: lauraa at codeaurora.org
> To: pintu.k at outlook.com; arnd at arndb.de; linux-arm-kernel at lists.infradead.org
> CC: linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
>
> On 5/12/2014 7:37 AM, Pintu Kumar wrote:
>> Hi,
>> Thanks for the reply.
>>
>> ----------------------------------------
>>> From: arnd at arndb.de
>>> To: linux-arm-kernel at lists.infradead.org
>>> CC: pintu.k at outlook.com; linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
>>> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
>>> Date: Mon, 12 May 2014 14:00:57 +0200
>>>
>>> On Monday 12 May 2014 15:12:41 Pintu Kumar wrote:
>>>> Hi,
>>>> I have some queries regarding IOMMU and CMA buffer sharing.
>>>> We have an embedded linux device (kernel 3.10, RAM: 256Mb) in
>>>> which camera and codec supports IOMMU but the display does not support IOMMU.
>>>> Thus for camera capture we are using iommu buffers using
>>>> ION/DMABUF. But for all display rendering we are using CMA buffers.
>>>> So, the question is how to achieve buffer sharing (zero-copy)
>>>> between Camera and Display using only IOMMU?
>>>> Currently we are achieving zero-copy using CMA. And we are
>>>> exploring options to use IOMMU.
>>>> Now we wanted to know which option is better? To use IOMMU or CMA?
>>>> If anybody have come across these design please share your thoughts and results.
>>>
>>> There is a slight performance overhead in using the IOMMU in general,
>>> because the IOMMU has to fetch the page table entries from memory
>>> at least some of the time.
>>
>> Ok, we need to check performance later
>>
>>>
>>> If that overhead is within the constraints you have for transfers between
>>> camera and codec, you are always better off using IOMMU since that
>>> means you don't have to do memory migration.
>>
>> Transfer between camera is codec is fine. But our major concern is single buffer
>> sharing between camera & display. Here camera supports iommu but display does not support iommu.
>> Is it possible to render camera preview (iommu buffers) on display (not iommu and required physical contiguous overlay memory)?
>>
>
> I'm pretty sure the answer is no for zero copy IOMMU buffers if one of your
> devices does not support IOMMU. If the data is coming in as individual pages
> and the hardware does not support scattered pages there isn't much you can
> do except copy to a contiguous buffer. At least with Ion, the heap types can
> be set up in a particular way such that the client need never know about the
> existence of an IOMMU or not.

So, the zero copy cannot be achieved between iommu and non-iommu devices?
Do you have any references like in case of QC MSM8974/etc, how this is achieved?

Yes, we are using ION, with SYSTEM_HEAP, for IOMMU, in case of camera, but still we could not?
render the preview on display.
You mean to say, with ION it is possible to do buffer sharing(a.k.a zero copy) ?using the IOMMU heap?


>
>> Also is it possible to buffer sharing between 2 iommu supported devices?
>>
>
> I don't see why not but there isn't a lot of information to go on here.

Is this also possible with ION?
Can you point out some use cases?
Like in our cases camera, codec and GPU have IOMMU. Is it possible to do zero copy here?


>
> Thanks,
> Laura

----------------------------------------
> Date: Mon, 12 May 2014 09:27:27 -0700
> From: lauraa at codeaurora.org
> To: pintu.k at outlook.com; arnd at arndb.de; linux-arm-kernel at lists.infradead.org
> CC: linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
>
> On 5/12/2014 7:37 AM, Pintu Kumar wrote:
>> Hi,
>> Thanks for the reply.
>>
>> ----------------------------------------
>>> From: arnd at arndb.de
>>> To: linux-arm-kernel at lists.infradead.org
>>> CC: pintu.k at outlook.com; linux-mm at kvack.org; linux-kernel at vger.kernel.org; linaro-mm-sig at lists.linaro.org
>>> Subject: Re: Questions regarding DMA buffer sharing using IOMMU
>>> Date: Mon, 12 May 2014 14:00:57 +0200
>>>
>>> On Monday 12 May 2014 15:12:41 Pintu Kumar wrote:
>>>> Hi,
>>>> I have some queries regarding IOMMU and CMA buffer sharing.
>>>> We have an embedded linux device (kernel 3.10, RAM: 256Mb) in
>>>> which camera and codec supports IOMMU but the display does not support IOMMU.
>>>> Thus for camera capture we are using iommu buffers using
>>>> ION/DMABUF. But for all display rendering we are using CMA buffers.
>>>> So, the question is how to achieve buffer sharing (zero-copy)
>>>> between Camera and Display using only IOMMU?
>>>> Currently we are achieving zero-copy using CMA. And we are
>>>> exploring options to use IOMMU.
>>>> Now we wanted to know which option is better? To use IOMMU or CMA?
>>>> If anybody have come across these design please share your thoughts and results.
>>>
>>> There is a slight performance overhead in using the IOMMU in general,
>>> because the IOMMU has to fetch the page table entries from memory
>>> at least some of the time.
>>
>> Ok, we need to check performance later
>>
>>>
>>> If that overhead is within the constraints you have for transfers between
>>> camera and codec, you are always better off using IOMMU since that
>>> means you don't have to do memory migration.
>>
>> Transfer between camera is codec is fine. But our major concern is single buffer
>> sharing between camera & display. Here camera supports iommu but display does not support iommu.
>> Is it possible to render camera preview (iommu buffers) on display (not iommu and required physical contiguous overlay memory)?
>>
>
> I'm pretty sure the answer is no for zero copy IOMMU buffers if one of your
> devices does not support IOMMU. If the data is coming in as individual pages
> and the hardware does not support scattered pages there isn't much you can
> do except copy to a contiguous buffer. At least with Ion, the heap types can
> be set up in a particular way such that the client need never know about the
> existence of an IOMMU or not.
>
>> Also is it possible to buffer sharing between 2 iommu supported devices?
>>
>
> I don't see why not but there isn't a lot of information to go on here.
>
> Thanks,
> Laura
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> hosted by The Linux Foundation
 		 	   		  

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-05-13  5:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12  9:42 Questions regarding DMA buffer sharing using IOMMU Pintu Kumar
2014-05-12 12:00 ` Arnd Bergmann
2014-05-12 14:37   ` Pintu Kumar
2014-05-12 16:27     ` Laura Abbott
2014-05-13  4:57       ` Pintu Kumar
2014-05-13  5:41       ` Pintu Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).