From 2559fa295d0c478466e47496174fa2108ab01c33 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 16 Aug 2017 15:53:55 -0700 Subject: gpu: nvgpu: Add common vaddr translate function Add a function to do address translation for IOMMU capable GPUs. When an iGPU is behind and IOMMU it can pick whether to use that IOMMU for translation by adding a bit to physical addresses. This function takes care of that. However, this required an abstracted nvgpu_iommuable() API to check whether a GPU is behind an IOMMU. This patch adds that API for Linux. JIRA NVGPU-68 Change-Id: I489d14475167c019c294407372395df78c8b5feb Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1542965 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Sourab Gupta Reviewed-by: Konsta Holtta Reviewed-by: Vijayakumar Subbu --- drivers/gpu/nvgpu/common/linux/dma.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index 67b58016..7b892731 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c @@ -631,3 +631,10 @@ void nvgpu_free_sgtable(struct gk20a *g, struct sg_table **sgt) nvgpu_kfree(g, *sgt); *sgt = NULL; } + +bool nvgpu_iommuable(struct gk20a *g) +{ + struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); + + return device_is_iommuable(l->dev); +} -- cgit v1.2.2