From edb116661348f1bc843849cdcc318fa47cf9724a Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 16 Aug 2017 16:19:53 -0700 Subject: gpu: nvgpu: rename ops.mm.get_physical_addr_bits Rename get_physical_addr_bits and related functions to something that more clearly conveys what they are doing. The basic idea of these functions is to translate from a physical GPU address to a IOMMU GPU address. To do that a particular bit (that varies from chip to chip) is added to the physical address. JIRA NVGPU-68 Change-Id: I536cc595c4397aad69a24f740bc74db03f52bc0a Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1542966 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/nvgpu_mem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers/gpu/nvgpu/common/mm/nvgpu_mem.c') diff --git a/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c b/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c index 52d20883..faee482d 100644 --- a/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c @@ -22,6 +22,7 @@ #include #include +#include #include "gk20a/gk20a.h" @@ -56,3 +57,14 @@ void nvgpu_sgt_free(struct nvgpu_sgt *sgt, struct gk20a *g) if (sgt && sgt->ops->sgt_free) sgt->ops->sgt_free(g, sgt); } + +u64 nvgpu_mem_iommu_translate(struct gk20a *g, u64 phys) +{ + /* ensure it is not vidmem allocation */ + WARN_ON(is_vidmem_page_alloc(phys)); + + if (nvgpu_iommuable(g) && g->ops.mm.get_iommu_bit) + return phys | 1ULL << g->ops.mm.get_iommu_bit(g); + + return phys; +} -- cgit v1.2.2