gpu: nvgpu: Use consistent definition for PTE size

In the buddy allocator the BALLOC_PTE_SIZE_* macros are inconsistent
with the gmmu_page_size_* enum. This patch makes the buddy allocator
use the gmmu_page_size_* fields and now has only BALLOC_PTE_SIZE_ANY
for when the allocator does not care about PTE size.

Change-Id: Idbe727b8208e1ace2b947d67f698c471782d5587
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1185136
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
This commit is contained in:
Alex Waterman
2016-07-21 13:46:44 -07:00
parent b2a8652527
commit 7a2e30267b
2 changed files with 6 additions and 6 deletions

View File

@@ -46,11 +46,10 @@ struct gk20a_buddy {
/*
* Size of the PDE this buddy is using. This allows for grouping like
* sized allocations into the same PDE.
* sized allocations into the same PDE. This uses the gmmu_pgsz_gk20a
* enum except for the BALLOC_PTE_SIZE_ANY specifier.
*/
#define BALLOC_PTE_SIZE_ANY 0x0
#define BALLOC_PTE_SIZE_SMALL 0x1
#define BALLOC_PTE_SIZE_BIG 0x2
#define BALLOC_PTE_SIZE_ANY -1
int pte_size;
};

View File

@@ -111,6 +111,7 @@ static struct gk20a_buddy *balloc_new_buddy(struct gk20a_buddy_allocator *a,
new_buddy->start = start;
new_buddy->order = order;
new_buddy->end = start + (1 << order) * a->blk_size;
new_buddy->pte_size = BALLOC_PTE_SIZE_ANY;
return new_buddy;
}
@@ -132,7 +133,7 @@ static void __balloc_buddy_list_add(struct gk20a_buddy_allocator *a,
* without cycling through the entire list.
*/
if (a->flags & GPU_ALLOC_GVA_SPACE &&
b->pte_size == BALLOC_PTE_SIZE_BIG)
b->pte_size == gmmu_page_size_big)
list_add_tail(&b->buddy_entry, list);
else
list_add(&b->buddy_entry, list);
@@ -474,7 +475,7 @@ static struct gk20a_buddy *__balloc_find_buddy(struct gk20a_buddy_allocator *a,
return NULL;
if (a->flags & GPU_ALLOC_GVA_SPACE &&
pte_size == BALLOC_PTE_SIZE_BIG)
pte_size == gmmu_page_size_big)
bud = list_last_entry(balloc_get_order_list(a, order),
struct gk20a_buddy, buddy_entry);
else