From: Alexey Skidanov <alexey.skidanov@intel.com>
To: devel@driverdev.osuosl.org, labbott@redhat.com,
gregkh@linuxfoundation.org
Cc: Alexey Skidanov <alexey.skidanov@intel.com>,
tkjos@android.com, rve@android.com, linux-kernel@vger.kernel.org,
maco@android.com, sumit.semwal@linaro.org
Subject: [PATCH v3] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap
Date: Wed, 31 Jan 2018 14:03:42 +0200 [thread overview]
Message-ID: <1517400222-2854-1-git-send-email-alexey.skidanov@intel.com> (raw)
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
next reply other threads:[~2018-01-31 12:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 12:03 Alexey Skidanov [this message]
2018-01-31 13:00 ` [PATCH v3] staging: android: ion: Add implementation of dma_buf_vmap and dma_buf_vunmap 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1517400222-2854-1-git-send-email-alexey.skidanov@intel.com \
--to=alexey.skidanov@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=rve@android.com \
--cc=sumit.semwal@linaro.org \
--cc=tkjos@android.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).