gpu: nvgpu: compile out vidmem from safety build

Safety build does not support vidmem. This patch compiles out vidmem
related changes - vidmem, dma alloc, cbc/acr/pmu alloc based on
vidmem and corresponding tests like pramin, page allocator &
gmmu_map_unmap_vidmem..
As vidmem is applicable only in case of DGPUs the code is compiled
out using CONFIG_NVGPU_DGPU.

JIRA NVGPU-3524

Change-Id: Ic623801112484ffc071195e828ab9f290f945d4d
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2132773
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2019-06-07 19:58:11 +05:30
committed by mobile promotions
parent c2eb26436a
commit a16cc2dde3
56 changed files with 253 additions and 444 deletions

View File

@@ -73,9 +73,11 @@ static struct vm_gk20a *init_vm_env(struct unit_module *m, struct gk20a *g,
gp10b_mm_get_default_big_page_size;
g->ops.mm.gmmu.get_mmu_levels = gp10b_mm_get_mmu_levels;
#ifdef CONFIG_NVGPU_DGPU
/* Minimum HAL init for PRAMIN */
g->ops.bus.set_bar0_window = gk20a_bus_set_bar0_window;
g->ops.pramin.data032_r = pram_data032_r;
#endif
/* vm should init with SYSMEM */
nvgpu_set_enabled(g, NVGPU_MM_UNIFIED_MEMORY, true);

View File

@@ -33,6 +33,8 @@
#include <nvgpu/page_allocator.h>
#ifdef CONFIG_NVGPU_DGPU
#define BA_DEFAULT_BASE SZ_4K
#define BA_DEFAULT_LENGTH SZ_1M
#define BA_DEFAULT_BLK_SIZE SZ_4K
@@ -589,8 +591,10 @@ static int test_nvgpu_page_allocator_init(struct unit_module *m,
return UNIT_SUCCESS;
}
#endif
struct unit_module_test page_allocator_tests[] = {
#ifdef CONFIG_NVGPU_DGPU
/* These tests create and evaluate page_allocator w/o 4K VIDMEM pages */
UNIT_TEST(init, test_nvgpu_page_allocator_init, NULL, 0),
UNIT_TEST(ops, test_nvgpu_page_allocator_ops, NULL, 0),
@@ -668,6 +672,7 @@ struct unit_module_test page_allocator_tests[] = {
UNIT_TEST(no_more_slabs, test_page_alloc, (void *) &failing_alloc_16K, 0),
UNIT_TEST(destroy_slabs, test_nvgpu_page_allocator_destroy, NULL, 0),
#endif
};
UNIT_MODULE(page_allocator, page_allocator_tests, UNIT_PRIO_NVGPU_TEST);

View File

@@ -212,6 +212,7 @@ static struct test_parameters test_iommu_sysmem_adv_small_sparse = {
.special_null_phys = true,
};
#ifdef CONFIG_NVGPU_DGPU
static struct test_parameters test_no_iommu_vidmem = {
.aperture = APERTURE_VIDMEM,
.is_iommuable = false,
@@ -219,6 +220,7 @@ static struct test_parameters test_no_iommu_vidmem = {
.flags = NVGPU_VM_MAP_CACHEABLE,
.priv = false,
};
#endif
static struct test_parameters test_no_iommu_sysmem_noncacheable = {
.aperture = APERTURE_SYSMEM,
@@ -1190,8 +1192,10 @@ struct unit_module_test nvgpu_gmmu_tests[] = {
(void *) &test_iommu_sysmem_ro_fixed, 0),
UNIT_TEST(gmmu_map_unmap_no_iommu_sysmem, test_nvgpu_gmmu_map_unmap,
(void *) &test_no_iommu_sysmem, 0),
#ifdef CONFIG_NVGPU_DGPU
UNIT_TEST(gmmu_map_unmap_vidmem, test_nvgpu_gmmu_map_unmap,
(void *) &test_no_iommu_vidmem, 0),
#endif
UNIT_TEST(gmmu_map_unmap_iommu_sysmem_coh, test_nvgpu_gmmu_map_unmap,
(void *) &test_iommu_sysmem_coh, 0),
UNIT_TEST(gmmu_set_pte, test_nvgpu_gmmu_set_pte,

View File

@@ -58,6 +58,7 @@
static struct nvgpu_mem *test_mem;
#ifdef CONFIG_NVGPU_DGPU
/*
* Pramin write callback (for all nvgpu_writel calls).
* No-op as callbacks/functions are already tested in pramin module.
@@ -197,6 +198,7 @@ static int test_nvgpu_mem_vidmem(struct unit_module *m,
return UNIT_SUCCESS;
}
#endif
/*
* Test nvgpu_aperture_mask()
@@ -210,6 +212,7 @@ static int test_nvgpu_aperture_mask(struct unit_module *m,
u32 vidmem_mask = 4;
u32 ret_ap_mask;
#ifdef CONFIG_NVGPU_DGPU
/* Case: APERTURE_VIDMEM */
test_mem->aperture = APERTURE_VIDMEM;
ret_ap_mask = nvgpu_aperture_mask(g, test_mem, sysmem_mask,
@@ -217,6 +220,7 @@ static int test_nvgpu_aperture_mask(struct unit_module *m,
if (ret_ap_mask != vidmem_mask) {
unit_return_fail(m, "Vidmem mask returned incorrect\n");
}
#endif
/*
* NVGPU_MM_HONORS_APERTURE enabled
@@ -262,6 +266,7 @@ static int test_nvgpu_aperture_mask(struct unit_module *m,
*/
nvgpu_set_enabled(g, NVGPU_MM_HONORS_APERTURE, false);
#ifdef CONFIG_NVGPU_DGPU
/* Case: APERTURE_SYSMEM */
test_mem->aperture = APERTURE_SYSMEM;
ret_ap_mask = nvgpu_aperture_mask(g, test_mem, sysmem_mask,
@@ -279,6 +284,7 @@ static int test_nvgpu_aperture_mask(struct unit_module *m,
unit_return_fail(m, "MM_HONORS disabled: "
"Incorrect mask returned for sysmem_coh\n");
}
#endif
/* Case: APERTURE_INVALID */
test_mem->aperture = APERTURE_INVALID;
@@ -773,8 +779,9 @@ struct unit_module_test nvgpu_mem_tests[] = {
* Tests covering VIDMEM branches
*/
UNIT_TEST(nvgpu_aperture_mask, test_nvgpu_aperture_mask, NULL, 0),
#ifdef CONFIG_NVGPU_DGPU
UNIT_TEST(nvgpu_mem_vidmem, test_nvgpu_mem_vidmem, NULL, 0),
#endif
/*
* Free test should be executed at the end to free allocated memory.
* As nvgpu_mem doesn't not have an explicit free function for sysmem,

View File

@@ -43,6 +43,8 @@
#include <os/linux/driver_common.h>
#ifdef CONFIG_NVGPU_DGPU
static u32 *rand_test_data;
static u32 *vidmem;
@@ -497,13 +499,16 @@ static int test_pramin_nvgpu_dying(struct unit_module *m, struct gk20a *g,
nvgpu_set_enabled(g, NVGPU_DRIVER_IS_DYING, false);
return UNIT_SUCCESS;
}
#endif
struct unit_module_test pramin_tests[] = {
#ifdef CONFIG_NVGPU_DGPU
UNIT_TEST(nvgpu_pramin_rd_n_1_sgl, test_pramin_rd_n_single, NULL, 0),
UNIT_TEST(nvgpu_pramin_wr_n_3_sgl, test_pramin_wr_n_multi, NULL, 0),
UNIT_TEST(nvgpu_pramin_memset, test_pramin_memset, NULL, 0),
UNIT_TEST(nvgpu_pramin_dying, test_pramin_nvgpu_dying, NULL, 0),
UNIT_TEST(nvgpu_pramin_free_test_env, free_test_env, NULL, 0),
#endif
};
UNIT_MODULE(pramin, pramin_tests, UNIT_PRIO_NVGPU_TEST);