diff options
Diffstat (limited to 'drivers/gpu/ion/ion.c')
-rw-r--r-- | drivers/gpu/ion/ion.c | 26 |
1 files changed, 26 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; |