Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bec26b11 authored by Liam Mark's avatar Liam Mark
Browse files

staging: android: ion: Add support for dma_buf_vmap



Currently ION only supports mapping memory from the kernel via
dma_buf_kmap. However dma_buf_kmap only allows mappings of page size and
clients would like an easier way to map the complete ION buffer, so add
support for dma_buf_vmap.

Change-Id: Ibff3c4b83f323676b86f558cf05c5e49d53dc4e9
Signed-off-by: default avatarLiam Mark <lmark@codeaurora.org>
parent 8887fcbe
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -435,6 +435,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 void ion_sgl_sync_range(struct device *dev, struct scatterlist *sgl,
			       unsigned int nents, unsigned long offset,
			       unsigned long length,
@@ -646,6 +657,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,
	.get_flags = ion_dma_buf_get_flags,
};