summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/page_allocator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/page_allocator.c')
-rw-r--r--drivers/gpu/nvgpu/common/mm/page_allocator.c11
1 files changed, 7 insertions, 4 deletions
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)
160 return (struct nvgpu_sgl *)sgl_impl->next; 160 return (struct nvgpu_sgl *)sgl_impl->next;
161} 161}
162 162
163static u64 nvgpu_page_alloc_sgl_phys(struct nvgpu_sgl *sgl) 163static u64 nvgpu_page_alloc_sgl_phys(struct gk20a *g, struct nvgpu_sgl *sgl)
164{ 164{
165 struct nvgpu_mem_sgl *sgl_impl = (struct nvgpu_mem_sgl *)sgl; 165 struct nvgpu_mem_sgl *sgl_impl = (struct nvgpu_mem_sgl *)sgl;
166 166
@@ -231,11 +231,12 @@ static void __nvgpu_free_pages(struct nvgpu_page_allocator *a,
231 bool free_buddy_alloc) 231 bool free_buddy_alloc)
232{ 232{
233 struct nvgpu_sgl *sgl = alloc->sgt.sgl; 233 struct nvgpu_sgl *sgl = alloc->sgt.sgl;
234 struct gk20a *g = a->owner->g;
234 235
235 if (free_buddy_alloc) { 236 if (free_buddy_alloc) {
236 while (sgl) { 237 while (sgl) {
237 nvgpu_free(&a->source_allocator, 238 nvgpu_free(&a->source_allocator,
238 nvgpu_sgt_get_phys(&alloc->sgt, sgl)); 239 nvgpu_sgt_get_phys(g, &alloc->sgt, sgl));
239 sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl); 240 sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl);
240 } 241 }
241 } 242 }
@@ -615,6 +616,7 @@ fail:
615static struct nvgpu_page_alloc *__nvgpu_alloc_pages( 616static struct nvgpu_page_alloc *__nvgpu_alloc_pages(
616 struct nvgpu_page_allocator *a, u64 len) 617 struct nvgpu_page_allocator *a, u64 len)
617{ 618{
619 struct gk20a *g = a->owner->g;
618 struct nvgpu_page_alloc *alloc = NULL; 620 struct nvgpu_page_alloc *alloc = NULL;
619 struct nvgpu_sgl *sgl; 621 struct nvgpu_sgl *sgl;
620 u64 pages; 622 u64 pages;
@@ -635,7 +637,7 @@ static struct nvgpu_page_alloc *__nvgpu_alloc_pages(
635 while (sgl) { 637 while (sgl) {
636 palloc_dbg(a, " Chunk %2d: 0x%010llx + 0x%llx", 638 palloc_dbg(a, " Chunk %2d: 0x%010llx + 0x%llx",
637 i++, 639 i++,
638 nvgpu_sgt_get_phys(&alloc->sgt, sgl), 640 nvgpu_sgt_get_phys(g, &alloc->sgt, sgl),
639 nvgpu_sgt_get_length(&alloc->sgt, sgl)); 641 nvgpu_sgt_get_length(&alloc->sgt, sgl));
640 sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl); 642 sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl);
641 } 643 }
@@ -779,6 +781,7 @@ static u64 nvgpu_page_alloc_fixed(struct nvgpu_allocator *__a,
779 struct nvgpu_page_allocator *a = page_allocator(__a); 781 struct nvgpu_page_allocator *a = page_allocator(__a);
780 struct nvgpu_page_alloc *alloc = NULL; 782 struct nvgpu_page_alloc *alloc = NULL;
781 struct nvgpu_sgl *sgl; 783 struct nvgpu_sgl *sgl;
784 struct gk20a *g = a->owner->g;
782 u64 aligned_len, pages; 785 u64 aligned_len, pages;
783 int i = 0; 786 int i = 0;
784 787
@@ -802,7 +805,7 @@ static u64 nvgpu_page_alloc_fixed(struct nvgpu_allocator *__a,
802 while (sgl) { 805 while (sgl) {
803 palloc_dbg(a, " Chunk %2d: 0x%010llx + 0x%llx", 806 palloc_dbg(a, " Chunk %2d: 0x%010llx + 0x%llx",
804 i++, 807 i++,
805 nvgpu_sgt_get_phys(&alloc->sgt, sgl), 808 nvgpu_sgt_get_phys(g, &alloc->sgt, sgl),
806 nvgpu_sgt_get_length(&alloc->sgt, sgl)); 809 nvgpu_sgt_get_length(&alloc->sgt, sgl));
807 sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl); 810 sgl = nvgpu_sgt_get_next(&alloc->sgt, sgl);
808 } 811 }