summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/ion/ion.c26
-rw-r--r--drivers/gpu/ion/ion_priv.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/ion/ion.c b/drivers/gpu/ion/ion.c
index 28b8bb44212b..512ebc5cc8ea 100644
--- a/drivers/gpu/ion/ion.c
+++ b/drivers/gpu/ion/ion.c
@@ -405,6 +405,32 @@ struct scatterlist *ion_map_dma(struct ion_client *client,
return sglist;
}
+struct scatterlist *iommu_heap_remap_dma(struct ion_heap *heap,
+ struct ion_buffer *buf,
+ unsigned long addr);
+int ion_remap_dma(struct ion_client *client,
+ struct ion_handle *handle,
+ unsigned long addr)
+{
+ struct ion_buffer *buffer;
+ int ret;
+
+ mutex_lock(&client->lock);
+ if (!ion_handle_validate(client, handle)) {
+ pr_err("invalid handle passed to map_dma.\n");
+ mutex_unlock(&client->lock);
+ return -EINVAL;
+ }
+ buffer = handle->buffer;
+ mutex_lock(&buffer->lock);
+
+ ret = iommu_heap_remap_dma(buffer->heap, buffer, addr);
+
+ mutex_unlock(&buffer->lock);
+ mutex_unlock(&client->lock);
+ return ret;
+}
+
void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle)
{
struct ion_buffer *buffer;
diff --git a/drivers/gpu/ion/ion_priv.h b/drivers/gpu/ion/ion_priv.h
index 555b49168655..bfe26da9c049 100644
--- a/drivers/gpu/ion/ion_priv.h
+++ b/drivers/gpu/ion/ion_priv.h
@@ -128,6 +128,9 @@ struct ion_handle *ion_handle_create(struct ion_client *client,
void ion_handle_add(struct ion_client *client, struct ion_handle *handle);
+int ion_remap_dma(struct ion_client *client,
+ struct ion_handle *handle,
+ unsigned long addr);
/**
* struct ion_buffer - metadata for a particular buffer
* @ref: refernce count