summaryrefslogtreecommitdiffstats
path: root/kernel/gsp_rpc_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/gsp_rpc_client.c')
-rw-r--r--kernel/gsp_rpc_client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/gsp_rpc_client.c b/kernel/gsp_rpc_client.c
index e91d5f6..ae45513 100644
--- a/kernel/gsp_rpc_client.c
+++ b/kernel/gsp_rpc_client.c
@@ -562,7 +562,7 @@ int gsp_rpc_alloc_emul(struct gsp_client *client,
struct nv_vgpu_device *vgpu = client->dev->driver_data;
struct gsp_vram_alloc *alloc;
u64 va = addr_hint ? addr_hint : 0x100000000ULL; /* Default 4GB */
- int ret;
+ dma_addr_t iova;
alloc = kzalloc(sizeof(*alloc), GFP_KERNEL);
if (!alloc)
@@ -612,9 +612,10 @@ int gsp_rpc_alloc_emul(struct gsp_client *client,
}
alloc->mapping->pinned = true;
- /* Map to IOVA for DMA */
- ret = dma_map_page(&vgpu->pdev->dev, alloc->mapping->pages[0], 0, size, DMA_BIDIRECTIONAL);
- if (dma_mapping_error(&vgpu->pdev->dev, ret)) {
+ /* Map to IOVA for DMA (dma_addr_t is 64-bit - do NOT truncate into int;
+ * with an IOMMU the IOVA may exceed 32 bits) */
+ iova = dma_map_page(&vgpu->pdev->dev, alloc->mapping->pages[0], 0, size, DMA_BIDIRECTIONAL);
+ if (dma_mapping_error(&vgpu->pdev->dev, iova)) {
for (int i = 0; i < alloc->mapping->page_count; i++)
__free_page(alloc->mapping->pages[i]);
vfree(alloc->mapping->pages);
@@ -622,7 +623,7 @@ int gsp_rpc_alloc_emul(struct gsp_client *client,
kfree(alloc);
return -ENOMEM;
}
- alloc->mapping->iova = ret;
+ alloc->mapping->iova = iova;
alloc->mapping->mapped = true;
alloc->gpu_va = va;
@@ -1070,6 +1071,7 @@ int gsp_wpr_scratch_mutex_release(struct gsp_client *client, u32 wpr_id)
* ============================================================ */
EXPORT_SYMBOL(gsp_client_init);
+EXPORT_SYMBOL(gsp_client_init_emulation);
EXPORT_SYMBOL(gsp_client_fini);
EXPORT_SYMBOL(gsp_rpc_alloc);
EXPORT_SYMBOL(gsp_rpc_free);