All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
@ 2018-01-30 20:39 Alexey Skidanov
  2018-01-30 20:47 ` Dan Carpenter
  2018-01-30 22:15 ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Alexey Skidanov @ 2018-01-30 20:39 UTC (permalink / raw)
  To: devel, labbott, gregkh; +Cc: Alexey Skidanov, linux-kernel

dma_buf_vmap and dma_buf_vunmap allow drivers to access buffers, created by ion.

Signed-off-by: Alexey Skidanov <alexey.skidanov@intel.com>
---
Changes in v1:
 - Added changelog text 


 drivers/staging/android/ion/ion.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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;
+}
+
+static void ion_dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
+{
+}
+
 static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
 					enum dma_data_direction direction)
 {
@@ -388,6 +399,8 @@ static const struct dma_buf_ops dma_buf_ops = {
 	.unmap_atomic = ion_dma_buf_kunmap,
 	.map = ion_dma_buf_kmap,
 	.unmap = ion_dma_buf_kunmap,
+	.vmap = ion_dma_buf_vmap,
+	.vunmap = ion_dma_buf_vunmap
 };
 
 int ion_alloc(size_t len, unsigned int heap_id_mask, unsigned int flags)
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
  2018-01-30 20:39 [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap Alexey Skidanov
@ 2018-01-30 20:47 ` Dan Carpenter
  2018-01-30 22:15 ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-01-30 20:47 UTC (permalink / raw)
  To: Alexey Skidanov; +Cc: devel, gregkh, linux-kernel

Are you working against linux-next?  The get_maintainer.pl script should
have told you to CC a bunch of other Android maintainers as well.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
  2018-01-30 20:39 [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap Alexey Skidanov
  2018-01-30 20:47 ` Dan Carpenter
@ 2018-01-30 22:15 ` Greg KH
  2018-01-30 23:44   ` alexey
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2018-01-30 22:15 UTC (permalink / raw)
  To: Alexey Skidanov; +Cc: devel, linux-kernel

On Tue, Jan 30, 2018 at 10:39:13PM +0200, Alexey Skidanov wrote:
> dma_buf_vmap and dma_buf_vunmap allow drivers to access buffers, created by ion.

But why would anyone ever want to do that?  What is wrong with the
existing interfaces that drivers use to access buffers created by ion?

What code uses this new interface?

We need a bit more information please.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
  2018-01-30 22:15 ` Greg KH
@ 2018-01-30 23:44   ` alexey
  2018-01-31  7:58     ` Dan Carpenter
  2018-01-31  8:38     ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: alexey @ 2018-01-30 23:44 UTC (permalink / raw)
  To: Greg KH; +Cc: devel, linux-kernel



On 01/31/2018 12:15 AM, Greg KH wrote:
> On Tue, Jan 30, 2018 at 10:39:13PM +0200, Alexey Skidanov wrote:
>> dma_buf_vmap and dma_buf_vunmap allow drivers to access buffers, created by ion.
> But why would anyone ever want to do that?  What is wrong with the
> existing interfaces that drivers use to access buffers created by ion?
Any driver, sharing the buffers, created by ion, through dma-buf, may 
get back the
sgtable describing the buffer for device DMA  and may call dma_buf_vmap 
to get back
the kernel virtual address of the buffer to get access to it. Currently, 
the second
option is missing. Actually, the buffer already mapped by ion 
implementation.
> What code uses this new interface?
This is not the new interface. this is the missing implementation of the 
last two ops:
struct dma_buf_ops {
   int (* attach) (struct dma_buf *, struct device *, struct 
dma_buf_attachment *);
   void (* detach) (struct dma_buf *, struct dma_buf_attachment *);
   struct sg_table * (* map_dma_buf) (struct dma_buf_attachment *, enum 
dma_data_direction);
   void (* unmap_dma_buf) (struct dma_buf_attachment *,struct sg_table 
*, enum dma_data_direction);
   void (* release) (struct dma_buf *);
   int (* begin_cpu_access) (struct dma_buf *, enum dma_data_direction);
   int (* end_cpu_access) (struct dma_buf *, enum dma_data_direction);
   void *(* map_atomic) (struct dma_buf *, unsigned long);
   void (* unmap_atomic) (struct dma_buf *, unsigned long, void *);
   void *(* map) (struct dma_buf *, unsigned long);
   void (* unmap) (struct dma_buf *, unsigned long, void *);
   int (* mmap) (struct dma_buf *, struct vm_area_struct *vma);
   void *(* vmap) (struct dma_buf *);
   void (* vunmap) (struct dma_buf *, void *vaddr);
};
>
> We need a bit more information please.
>
> thanks,
>
> greg k-h
Thanks,
Alexey
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
  2018-01-30 23:44   ` alexey
@ 2018-01-31  7:58     ` Dan Carpenter
  2018-01-31  8:38     ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-01-31  7:58 UTC (permalink / raw)
  To: alexey; +Cc: devel, Greg KH, linux-kernel

The point is that you have to send a v3 patch which includes that
information.  And please CC all the android folk as well.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
  2018-01-30 23:44   ` alexey
  2018-01-31  7:58     ` Dan Carpenter
@ 2018-01-31  8:38     ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2018-01-31  8:38 UTC (permalink / raw)
  To: alexey; +Cc: devel, linux-kernel

On Wed, Jan 31, 2018 at 01:44:47AM +0200, alexey wrote:
> 
> 
> On 01/31/2018 12:15 AM, Greg KH wrote:
> > On Tue, Jan 30, 2018 at 10:39:13PM +0200, Alexey Skidanov wrote:
> > > dma_buf_vmap and dma_buf_vunmap allow drivers to access buffers, created by ion.
> > But why would anyone ever want to do that?  What is wrong with the
> > existing interfaces that drivers use to access buffers created by ion?
> Any driver, sharing the buffers, created by ion, through dma-buf, may get
> back the
> sgtable describing the buffer for device DMA  and may call dma_buf_vmap to
> get back
> the kernel virtual address of the buffer to get access to it. Currently, the
> second
> option is missing. Actually, the buffer already mapped by ion
> implementation.

Very odd formatting :(

Anyway, as Dan said, this needs to be put in the changelog text itself.

I know Intel has documentation and training for how to submit patches to
the kernel properly.  Please use that resource and get your patch
submission reviewed by someone from the Linux kernel team at Intel
before resending this.  Don't force the community to help you learn this
when you have people whose job it is to help out with this at your
company :)

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2018-01-31  8:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 20:39 [PATCH v2] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap Alexey Skidanov
2018-01-30 20:47 ` Dan Carpenter
2018-01-30 22:15 ` Greg KH
2018-01-30 23:44   ` alexey
2018-01-31  7:58     ` Dan Carpenter
2018-01-31  8:38     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.