gpu: nvgpu: compile out non fusa LTC functionality

nvgpu_ltc_sync_enabled functionality is used only in the kernel mode
submit path and for debugging. en_illegal_compstat functionality is
used for debugging .

Compile them out under CONFIG_NVGPU_NON_FUSA.

JIRA NVGPU-6982

Change-Id: I404d4b74b2e60ba4c2173ba0bfb643b1ecb6ba7c
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2605011
(cherry picked from commit f4bcafe73c8f7184b5e125e3ff6e55ceccaf87eb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2632547
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sagar Kamble
2021-10-04 11:42:36 +05:30
committed by mobile promotions
parent 2c560dce0e
commit 449a4823d4
21 changed files with 145 additions and 80 deletions

View File

@@ -431,10 +431,8 @@ test_ltc_functionality_tests.ltc_functionality_tests=0
test_ltc_init_support.ltc_init_support=0
test_ltc_intr.ltc_intr=0
test_ltc_intr_configure.ltc_intr_configure=0
test_ltc_intr_en_illegal_compstat.ltc_intr_en_illegal_compstat=0
test_ltc_negative_tests.ltc_negative_tests=0
test_ltc_remove_support.ltc_remove_support=0
test_ltc_set_enabled.ltc_set_enabled=0
[nvgpu-netlist]
test_netlist_init_support.netlist_init_support=0

View File

@@ -385,8 +385,10 @@ int test_ltc_functionality_tests(struct unit_module *m,
u32 slice_per_ltc;
u32 cacheline_size;
#if defined(CONFIG_NVGPU_NON_FUSA) || defined(CONFIG_NVGPU_KERNEL_MODE_SUBMIT)
g->mm.ltc_enabled_current = false;
nvgpu_ltc_sync_enabled(g);
#endif
ltc_count = nvgpu_ltc_get_ltc_count(g);
if (ltc_count != NUM_LTC) {
@@ -409,10 +411,13 @@ int test_ltc_negative_tests(struct unit_module *m,
{
int err = 0;
#if defined(CONFIG_NVGPU_NON_FUSA) || defined(CONFIG_NVGPU_KERNEL_MODE_SUBMIT)
g->mm.ltc_enabled_current = g->mm.ltc_enabled_target;
nvgpu_ltc_sync_enabled(g);
g->ops.ltc.set_enabled = NULL;
nvgpu_ltc_sync_enabled(g);
#endif
g->ops.ltc.ltc_remove_support(g);
g->ops.ltc.ltc_remove_support(g);
err = g->ops.ltc.init_ltc_support(g);
@@ -564,34 +569,13 @@ done:
return err;
}
int test_ltc_intr_en_illegal_compstat(struct unit_module *m,
struct gk20a *g, void *args)
{
u32 val;
/* clear the reg to be sure */
nvgpu_posix_io_writel_reg_space(g, ltc_ltcs_ltss_intr_r(), 0);
g->ops.ltc.intr.en_illegal_compstat(g, true);
val = nvgpu_posix_io_readl_reg_space(g, ltc_ltcs_ltss_intr_r());
if ((val & ltc_ltcs_ltss_intr_en_illegal_compstat_m()) == 0) {
unit_return_fail(m, "failed to enable illegal compstat\n");
}
g->ops.ltc.intr.en_illegal_compstat(g, false);
val = nvgpu_posix_io_readl_reg_space(g, ltc_ltcs_ltss_intr_r());
if ((val & ltc_ltcs_ltss_intr_en_illegal_compstat_m()) != 0) {
unit_return_fail(m, "failed to disable illegal compstat\n");
}
return UNIT_SUCCESS;
}
int test_ltc_intr_configure(struct unit_module *m,
struct gk20a *g, void *args)
{
u32 val;
#ifdef CONFIG_NVGPU_NON_FUSA
void (*save_func)(struct gk20a *g, bool en);
#endif
g->ops.ltc.intr.configure(g);
val = nvgpu_posix_io_readl_reg_space(g, ltc_ltcs_ltss_intr_r());
@@ -602,9 +586,11 @@ int test_ltc_intr_configure(struct unit_module *m,
unit_return_fail(m, "failed to configure intr\n");
}
#ifdef CONFIG_NVGPU_NON_FUSA
/* for branch coverage test case where this HAL isn't configured */
save_func = g->ops.ltc.intr.en_illegal_compstat;
g->ops.ltc.intr.en_illegal_compstat = NULL;
#endif
g->ops.ltc.intr.configure(g);
val = nvgpu_posix_io_readl_reg_space(g, ltc_ltcs_ltss_intr_r());
if ((val & (ltc_ltcs_ltss_intr_en_ecc_sec_error_enabled_f() |
@@ -613,7 +599,10 @@ int test_ltc_intr_configure(struct unit_module *m,
ltc_ltcs_ltss_intr_en_ecc_ded_error_enabled_f())) {
unit_return_fail(m, "failed to configure intr\n");
}
#ifdef CONFIG_NVGPU_NON_FUSA
g->ops.ltc.intr.en_illegal_compstat = save_func;
#endif
return UNIT_SUCCESS;
}
@@ -638,6 +627,30 @@ int test_determine_L2_size_bytes(struct unit_module *m,
return UNIT_SUCCESS;
}
#ifdef CONFIG_NVGPU_NON_FUSA
int test_ltc_intr_en_illegal_compstat(struct unit_module *m,
struct gk20a *g, void *args)
{
u32 val;
/* clear the reg to be sure */
nvgpu_posix_io_writel_reg_space(g, ltc_ltcs_ltss_intr_r(), 0);
g->ops.ltc.intr.en_illegal_compstat(g, true);
val = nvgpu_posix_io_readl_reg_space(g, ltc_ltcs_ltss_intr_r());
if ((val & ltc_ltcs_ltss_intr_en_illegal_compstat_m()) == 0) {
unit_return_fail(m, "failed to enable illegal compstat\n");
}
g->ops.ltc.intr.en_illegal_compstat(g, false);
val = nvgpu_posix_io_readl_reg_space(g, ltc_ltcs_ltss_intr_r());
if ((val & ltc_ltcs_ltss_intr_en_illegal_compstat_m()) != 0) {
unit_return_fail(m, "failed to disable illegal compstat\n");
}
return UNIT_SUCCESS;
}
int test_ltc_set_enabled(struct unit_module *m, struct gk20a *g, void *args)
{
u32 val;
@@ -668,6 +681,7 @@ int test_ltc_set_enabled(struct unit_module *m, struct gk20a *g, void *args)
return UNIT_SUCCESS;
}
#endif
int test_flush_ltc(struct unit_module *m, struct gk20a *g, void *args)
{
@@ -711,11 +725,13 @@ struct unit_module_test nvgpu_ltc_tests[] = {
UNIT_TEST(ltc_functionality_tests, test_ltc_functionality_tests,
NULL, 0),
UNIT_TEST(ltc_intr, test_ltc_intr, NULL, 0),
UNIT_TEST(ltc_intr_en_illegal_compstat,
test_ltc_intr_en_illegal_compstat, NULL, 0),
UNIT_TEST(ltc_intr_configure, test_ltc_intr_configure, NULL, 0),
UNIT_TEST(ltc_determine_L2_size, test_determine_L2_size_bytes, NULL, 0),
#ifdef CONFIG_NVGPU_NON_FUSA
UNIT_TEST(ltc_intr_en_illegal_compstat,
test_ltc_intr_en_illegal_compstat, NULL, 0),
UNIT_TEST(ltc_set_enabled, test_ltc_set_enabled, NULL, 0),
#endif
UNIT_TEST(ltc_flush, test_flush_ltc, NULL, 0),
UNIT_TEST(ltc_negative_tests, test_ltc_negative_tests, NULL, 0),
UNIT_TEST(ltc_remove_support, test_ltc_remove_support, NULL, 0),

View File

@@ -108,14 +108,12 @@ int test_ltc_ecc_init_free(struct unit_module *m, struct gk20a *g, void *args);
*
* Test Type: Feature
*
* Targets: nvgpu_ltc_sync_enabled, nvgpu_ltc_get_ltc_count,
* Targets: nvgpu_ltc_get_ltc_count,
* nvgpu_ltc_get_slices_per_ltc, nvgpu_ltc_get_cacheline_size
*
* Input: None
*
* Steps:
* - Set ltc_enabled_current to false and then call
* nvgpu_ltc_sync_enabled.
* - Call nvgpu_ltc_get_ltc_count
* - Call nvgpu_ltc_get_slices_per_ltc
* - Call nvgpu_ltc_get_cacheline_size
@@ -133,14 +131,13 @@ int test_ltc_functionality_tests(struct unit_module *m,
*
* Test Type: Feature, Error guessing
*
* Targets: nvgpu_ltc_sync_enabled, gops_ltc.ltc_remove_support,
* Targets: gops_ltc.ltc_remove_support,
* gops_ltc.init_ltc_support, nvgpu_init_ltc_support,
* nvgpu_ltc_remove_support
*
* Input: None
*
* Steps:
* - Set ltc.set_enabled to NULL and then call nvgpu_ltc_sync_enabled
* - Call gops_ltc.ltc_remove_support twice
* - Call gops_ltc.init_ltc_support
*
@@ -248,29 +245,6 @@ int test_ltc_remove_support(struct unit_module *m,
*/
int test_ltc_intr(struct unit_module *m, struct gk20a *g, void *args);
/**
* Test specification for: test_ltc_intr_en_illegal_compstat
*
* Description: Validate the inter_en_illegal_compstat API.
*
* Test Type: Feature
*
* Targets: gops_ltc_intr.en_illegal_compstat, gv11b_ltc_intr_en_illegal_compstat
*
* Input: None
*
* Steps:
* - Clear the LTC intr register (NV_PLTCG_LTCS_LTSS_INTR).
* - Call the gv11b_ltc_intr_en_illegal_compstat HAL requesting enable.
* - Verify correct setting in LTC intr register.
* - Call the gv11b_ltc_intr_en_illegal_compstat HAL requesting disable.
* - Verify correct setting in LTC intr register.
*
* Output: Returns PASS if register is configured correctly. FAIL otherwise.
*/
int test_ltc_intr_en_illegal_compstat(struct unit_module *m,
struct gk20a *g, void *args);
/**
* Test specification for: test_ltc_intr_configure
*
@@ -316,6 +290,30 @@ int test_ltc_intr_configure(struct unit_module *m,
int test_determine_L2_size_bytes(struct unit_module *m,
struct gk20a *g, void *args);
#ifdef CONFIG_NVGPU_NON_FUSA
/**
* Test specification for: test_ltc_intr_en_illegal_compstat
*
* Description: Validate the inter_en_illegal_compstat API.
*
* Test Type: Feature
*
* Targets: gops_ltc_intr.en_illegal_compstat, gv11b_ltc_intr_en_illegal_compstat
*
* Input: None
*
* Steps:
* - Clear the LTC intr register (NV_PLTCG_LTCS_LTSS_INTR).
* - Call the gv11b_ltc_intr_en_illegal_compstat HAL requesting enable.
* - Verify correct setting in LTC intr register.
* - Call the gv11b_ltc_intr_en_illegal_compstat HAL requesting disable.
* - Verify correct setting in LTC intr register.
*
* Output: Returns PASS if register is configured correctly. FAIL otherwise.
*/
int test_ltc_intr_en_illegal_compstat(struct unit_module *m,
struct gk20a *g, void *args);
/**
* Test specification for: test_ltc_set_enabled
*
@@ -338,6 +336,7 @@ int test_determine_L2_size_bytes(struct unit_module *m,
* Output: Returns PASS if register is configured correctly. FAIL otherwise.
*/
int test_ltc_set_enabled(struct unit_module *m, struct gk20a *g, void *args);
#endif
/**
* Test specification for: test_flush_ltc