lkml.org 
[lkml]   [2018]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
From
Date

On 01/31/2018 03:00 PM, Greg KH wrote:
> On Wed, Jan 31, 2018 at 02:03:42PM +0200, Alexey Skidanov wrote:
>> Any driver may access shared buffers, created by ion, using dma_buf_vmap and
>> dma_buf_vunmap dma-buf API that maps/unmaps previosuly allocated buffers into
>> the kernel virtual address space. The implementation of these API is missing in
>> the current ion implementation.
>>
>> Signed-off-by: Alexey Skidanov <alexey.skidanov@intel.com>
>> ---
>
> No review from any other Intel developers? :(
Will add.
>
> Anyway, what in-tree driver needs access to these functions?
I'm not sure that there are the in-tree drivers using these functions
and ion as buffer exporter because they are not implemented in ion :)
But there are some in-tree drivers using these APIs (gpu drivers) with
other buffer exporters.
>
> And are you sure that you don't need to do any "real" logic in the
> vmap/vunmap calls? That feels like there would be some reference
> counting problems here.
dma_buf_start_cpu_access is called before the call to dma_buf_vmap. It
actually increments the reference count. dma_buf_end_cpu_access is
called after the dma_buf_vunmap. It actually decrements the reference
count.>>
>> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
>> index f480885..4f1dc7f 100644
>> --- a/drivers/staging/android/ion/ion.c
>> +++ b/drivers/staging/android/ion/ion.c
>> @@ -327,6 +327,17 @@ static void ion_dma_buf_kunmap(struct dma_buf *dmabuf, unsigned long offset,
>> {
>> }
>>
>> +static void *ion_dma_buf_vmap(struct dma_buf *dmabuf)
>> +{
>> + struct ion_buffer *buffer = dmabuf->priv;
>> +
>> + return buffer->vaddr;
>
> Just call ion_dma_buf_kmap(dmabuf, 0)?
Sure.
>
> Again, please get this reviewed by someone else in Intel first. Don't
> ignore the resources you have, to do so would be foolish :)
Sure. Will do.
>
> thanks,
>
> greg k-h
>

Thanks,
Alexey

\
 
 \ /
  Last update: 2018-02-01 07:10    [W:0.924 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site