All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
@ 2018-01-31 12:03 Alexey Skidanov
  2018-01-31 13:00 ` Greg KH
  0 siblings, 1 reply; 12+ messages in thread
From: Alexey Skidanov @ 2018-01-31 12:03 UTC (permalink / raw)
  To: devel, labbott, gregkh
  Cc: Alexey Skidanov, tkjos, rve, linux-kernel, maco, sumit.semwal

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>
---
 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] 12+ messages in thread

end of thread, other threads:[~2019-01-29 23:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 12:03 [PATCH v3] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap Alexey Skidanov
2018-01-31 13:00 ` Greg KH
2018-02-01  6:10   ` Alexey Skidanov
2018-02-06 23:56     ` Laura Abbott
2018-02-07  5:25       ` Alexey Skidanov
2018-12-16  5:20         ` Liam Mark
2018-12-16  6:35           ` Alexey Skidanov
2018-12-17 18:42             ` Liam Mark
2018-12-18 16:24               ` Alexey Skidanov
2019-01-04 17:41                 ` Liam Mark
2019-01-04 22:11                   ` Skidanov, Alexey
2019-01-29 23:56                     ` Liam Mark

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.