From fb89f656d7a20e1684e7f0ab92d1439422be7180 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Fri, 10 May 2019 16:13:31 -0700 Subject: [PATCH] gpu: nvgpu: unit: Update allocator init() function Replace individual page allocator init function with common nvgpu_allocator_init() function corresponding the re-arch. Jira NVGPU-991 Change-Id: Ic244c7570bac7e1cc9c3e88116414fd1ad4b4af3 Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/2117008 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../page_allocator/page_allocator.c | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/userspace/units/mm/allocators/page_allocator/page_allocator.c b/userspace/units/mm/allocators/page_allocator/page_allocator.c index 8bb428f90..4265d5ebf 100644 --- a/userspace/units/mm/allocators/page_allocator/page_allocator.c +++ b/userspace/units/mm/allocators/page_allocator/page_allocator.c @@ -345,8 +345,8 @@ static int test_page_allocator_init_slabs(struct unit_module *m, /* Fault injection at init_slabs */ nvgpu_posix_enable_fault_injection(kmem_fi, true, 3); - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, blk_size, flags) == 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + blk_size, 0ULL, flags, PAGE_ALLOCATOR) == 0) { unit_return_fail(m, "pa with slabs inited despite fault injection\n"); } @@ -355,14 +355,14 @@ static int test_page_allocator_init_slabs(struct unit_module *m, /* * Expect to fail as blk_size is odd */ - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, SZ_4K + 1ULL, flags) == 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + SZ_4K + 1ULL, 0ULL, flags, PAGE_ALLOCATOR) == 0) { unit_return_fail(m, "vidmem page allocator inited with odd blk_size\n"); } - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, SZ_4K, flags) != 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + SZ_4K, 0ULL, flags, PAGE_ALLOCATOR) != 0) { unit_return_fail(m, "vidmem page allocator inited with odd blk_size\n"); } else { @@ -373,8 +373,8 @@ static int test_page_allocator_init_slabs(struct unit_module *m, * Initialize page allocator * This will be used for further tests. */ - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, blk_size, flags) != 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + blk_size, 0ULL, flags, PAGE_ALLOCATOR) != 0) { unit_return_fail(m, "init with slabs failed\n"); } @@ -530,15 +530,15 @@ static int test_nvgpu_page_allocator_init(struct unit_module *m, /* * expect to fail as blk_size < SZ_4K */ - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, 0ULL, flags) == 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + 0ULL, 0ULL, flags, PAGE_ALLOCATOR) == 0) { unit_return_fail(m, "inited despite blk_size = 0\n"); } /* Fault injection at nvgpu_page_allocator allocation */ nvgpu_posix_enable_fault_injection(kmem_fi, true, 0); - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, blk_size, flags) == 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + blk_size, 0ULL, flags, PAGE_ALLOCATOR) == 0) { unit_return_fail(m, "inited despite fault injection at page_allocator\n"); } @@ -546,8 +546,8 @@ static int test_nvgpu_page_allocator_init(struct unit_module *m, /* Fault injection at alloc_cache */ nvgpu_posix_enable_fault_injection(kmem_fi, true, 1); - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, blk_size, flags) == 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + blk_size, 0ULL, flags, PAGE_ALLOCATOR) == 0) { unit_return_fail(m, "inited despite fault injection at alloc_cache\n"); } @@ -555,8 +555,8 @@ static int test_nvgpu_page_allocator_init(struct unit_module *m, /* Fault injection at slab_page_cache */ nvgpu_posix_enable_fault_injection(kmem_fi, true, 2); - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, blk_size, flags) == 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + blk_size, 0ULL, flags, PAGE_ALLOCATOR) == 0) { unit_return_fail(m, "inited despite fault injection at slab_page_cache\n"); } @@ -565,14 +565,14 @@ static int test_nvgpu_page_allocator_init(struct unit_module *m, /* * expect to fail as blk_size is odd */ - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, SZ_4K + 3ULL, flags) == 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + SZ_4K + 3ULL, 0ULL, flags, PAGE_ALLOCATOR) == 0) { unit_return_fail(m, "inited despite odd blk_size\n"); } /* base = 0 */ - if (nvgpu_page_allocator_init(g, na, "test_page", 0ULL, - length, blk_size, flags) != 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", 0ULL, length, + blk_size, 0ULL, flags, PAGE_ALLOCATOR) != 0) { unit_return_fail(m, "init failed with base = 0\n"); } else { na->ops->fini(na); @@ -582,8 +582,8 @@ static int test_nvgpu_page_allocator_init(struct unit_module *m, * Initialize page allocator * This will be used for further tests. */ - if (nvgpu_page_allocator_init(g, na, "test_page", base, - length, blk_size, flags) != 0) { + if (nvgpu_allocator_init(g, na, NULL, "test_page", base, length, + blk_size, 0ULL, flags, PAGE_ALLOCATOR) != 0) { unit_return_fail(m, "init failed\n"); }