diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2018-03-07 12:23:53 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-03-13 03:04:16 -0400 |
commit | 6c33a010d8e3983cc3504e073cd552f952440aa1 (patch) | |
tree | c86e364d468320c8b347b58b6a711f773b97ae42 /drivers/gpu/nvgpu/common/mm/page_allocator.c | |
parent | f94c9d19c19883ca2b60acb8a000b34b32da0aa7 (diff) |
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 <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1673142
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/page_allocator.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/page_allocator.c | 11 |
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 | ||
163 | static u64 nvgpu_page_alloc_sgl_phys(struct nvgpu_sgl *sgl) | 163 | static 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: | |||
615 | static struct nvgpu_page_alloc *__nvgpu_alloc_pages( | 616 | static 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 | } |