summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorKrishna Reddy <vdumpa@nvidia.com>2012-01-22 23:28:22 -0800
committerVarun Colbert <vcolbert@nvidia.com>2012-01-30 11:38:06 -0800
commit8d580ed5b5c826e1da3d4349e9a95cb4490a69b7 (patch)
tree87e3def07285ad28c91e3f084bce3af0baaeabb5 /drivers/gpu
parent14fd48c965abe96b31483f6c98f697046df31856 (diff)
HACK: gpu: ion: Add api to remap dma address.
Change-Id: Ib68612c6a1e003938fa6df009df85e9cb4599b11 Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/76784 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
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