From 6c33a010d8e3983cc3504e073cd552f952440aa1 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Wed, 7 Mar 2018 09:23:53 -0800 Subject: gpu: nvgpu: add placeholder for IPA to PA Add __nvgpu_sgl_phys function that can be used to implement IPA to PA translation in a subsequent change. Adapt existing function prototypes to add pointer to gpu context, as we will need to check if IPA to PA translation is needed. JIRA EVLR-2442 Bug 200392719 Change-Id: I5a734c958c8277d1bf673c020dafb31263f142d6 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/1673142 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/page_allocator.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/page_allocator.c') diff --git a/drivers/gpu/nvgpu/common/mm/page_allocator.c b/drivers/gpu/nvgpu/common/mm/page_allocator.c index 13ccc48b..773d33ef 100644 --- a/drivers/gpu/nvgpu/common/mm/page_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/page_allocator.c @@ -160,7 +160,7 @@ static struct nvgpu_sgl *nvgpu_page_alloc_sgl_next(struct nvgpu_sgl *sgl) return (struct nvgpu_sgl *)sgl_impl->next; } -static u64 nvgpu_page_alloc_sgl_phys(struct nvgpu_sgl *sgl) +static u64 nvgpu_page_alloc_sgl_phys(struct gk20a *g, struct nvgpu_sgl *sgl) { struct nvgpu_mem_sgl *sgl_impl = (struct nvgpu_mem_sgl *)sgl; @@ -231,11 +231,12 @@ static void __nvgpu_free_pages(struct nvgpu_page_allocator *a, bool free_buddy_alloc) { struct nvgpu_sgl *sgl = alloc->sgt.sgl; + struct gk20a *g = a->owner->g; if (free_buddy_alloc) { while (sgl) { nvgpu_free(&a->source_allocator, - nvgpu_sgt_get_phys(&alloc->sgt, sgl)); + nvgpu_sgt_get_phys(g, &alloc->sgt, sgl)); sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl); } } @@ -615,6 +616,7 @@ fail: static struct nvgpu_page_alloc *__nvgpu_alloc_pages( struct nvgpu_page_allocator *a, u64 len) { + struct gk20a *g = a->owner->g; struct nvgpu_page_alloc *alloc = NULL; struct nvgpu_sgl *sgl; u64 pages; @@ -635,7 +637,7 @@ static struct nvgpu_page_alloc *__nvgpu_alloc_pages( while (sgl) { palloc_dbg(a, " Chunk %2d: 0x%010llx + 0x%llx", i++, - nvgpu_sgt_get_phys(&alloc->sgt, sgl), + nvgpu_sgt_get_phys(g, &alloc->sgt, sgl), nvgpu_sgt_get_length(&alloc->sgt, sgl)); sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl); } @@ -779,6 +781,7 @@ static u64 nvgpu_page_alloc_fixed(struct nvgpu_allocator *__a, struct nvgpu_page_allocator *a = page_allocator(__a); struct nvgpu_page_alloc *alloc = NULL; struct nvgpu_sgl *sgl; + struct gk20a *g = a->owner->g; u64 aligned_len, pages; int i = 0; @@ -802,7 +805,7 @@ static u64 nvgpu_page_alloc_fixed(struct nvgpu_allocator *__a, while (sgl) { palloc_dbg(a, " Chunk %2d: 0x%010llx + 0x%llx", i++, - nvgpu_sgt_get_phys(&alloc->sgt, sgl), + nvgpu_sgt_get_phys(g, &alloc->sgt, sgl), nvgpu_sgt_get_length(&alloc->sgt, sgl)); sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl); } -- cgit v1.2.2