From bf49996bd292655618d09f3ae272c994851f1382 Mon Sep 17 00:00:00 2001 From: Philip Elcan Date: Tue, 10 Sep 2019 16:54:02 -0400 Subject: [PATCH] gpu: nvgpu: unit: fuse: re-enable FUSA tests When the non-FUSA HALs were removed, the entire fuse unit test was removed. However, some of the fuse HALs are used in the FUSA build, so re-enable the FUSA tests, as appropriate. JIRA NVGPU-3943 Change-Id: I6656940492102ace335672466592b22ed9ce95fd Signed-off-by: Philip Elcan Reviewed-on: https://git-master.nvidia.com/r/2194569 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- Makefile.umbrella.tmk | 2 - userspace/Makefile.sources | 5 +- userspace/required_tests.json | 55 +++++++++++++++++++ userspace/units/fuse/Makefile | 8 ++- userspace/units/fuse/nvgpu-fuse-gm20b.c | 4 ++ userspace/units/fuse/nvgpu-fuse.c | 13 +++++ userspace/units/fuse/nvgpu-fuse.h | 73 +++++++++++++++++++++++++ 7 files changed, 152 insertions(+), 8 deletions(-) create mode 100644 userspace/units/fuse/nvgpu-fuse.h diff --git a/Makefile.umbrella.tmk b/Makefile.umbrella.tmk index a280031e4..e04f5e1d8 100644 --- a/Makefile.umbrella.tmk +++ b/Makefile.umbrella.tmk @@ -63,9 +63,7 @@ NV_REPOSITORY_COMPONENTS += userspace/units/fifo NV_REPOSITORY_COMPONENTS += userspace/units/fifo/channel NV_REPOSITORY_COMPONENTS += userspace/units/fifo/runlist NV_REPOSITORY_COMPONENTS += userspace/units/fifo/tsg -ifeq ($(CONFIG_NVGPU_HAL_NON_FUSA),1) NV_REPOSITORY_COMPONENTS += userspace/units/fuse -endif NV_REPOSITORY_COMPONENTS += userspace/units/list NV_REPOSITORY_COMPONENTS += userspace/units/enabled NV_REPOSITORY_COMPONENTS += userspace/units/falcon diff --git a/userspace/Makefile.sources b/userspace/Makefile.sources index 6673d1c4b..f34c8857a 100644 --- a/userspace/Makefile.sources +++ b/userspace/Makefile.sources @@ -75,11 +75,8 @@ UNITS := \ $(UNIT_SRC)/enabled \ $(UNIT_SRC)/falcon \ $(UNIT_SRC)/falcon/falcon_tests \ + $(UNIT_SRC)/fuse \ $(UNIT_SRC)/pmu \ $(UNIT_SRC)/gr \ $(UNIT_SRC)/gr/config \ $(UNIT_SRC)/gr/init - -ifeq ($(CONFIG_NVGPU_HAL_NON_FUSA),1) -UNITS += $(UNIT_SRC)/fuse -endif diff --git a/userspace/required_tests.json b/userspace/required_tests.json index 5e87327e1..ba5ef94f1 100644 --- a/userspace/required_tests.json +++ b/userspace/required_tests.json @@ -384,6 +384,61 @@ "test_level": 0, "unit": "fault_injection" }, + { + "test": "fuse_gm20b_basic_fuses", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gm20b_cleanup", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gm20b_init", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_check_gcplex_fail", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_check_non_sec", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_check_sec", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_check_sec_invalid_gcplex", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_cleanup", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_ecc", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_feature_override_disable", + "test_level": 0, + "unit": "fuse" + }, + { + "test": "fuse_gp10b_init", + "test_level": 0, + "unit": "fuse" + }, { "test": "init_can_busy", "test_level": 0, diff --git a/userspace/units/fuse/Makefile b/userspace/units/fuse/Makefile index 1a52925e8..1c0f16d06 100644 --- a/userspace/units/fuse/Makefile +++ b/userspace/units/fuse/Makefile @@ -22,8 +22,12 @@ OBJS = nvgpu-fuse.o \ nvgpu-fuse-gm20b.o \ - nvgpu-fuse-gp10b.o \ - nvgpu-fuse-tu104.o + nvgpu-fuse-gp10b.o + +ifeq ($(CONFIG_NVGPU_HAL_NON_FUSA),1) +OBJS += nvgpu-fuse-tu104.o +endif + MODULE = nvgpu-fuse include ../Makefile.units diff --git a/userspace/units/fuse/nvgpu-fuse-gm20b.c b/userspace/units/fuse/nvgpu-fuse-gm20b.c index 0231c3770..6fa3f8549 100644 --- a/userspace/units/fuse/nvgpu-fuse-gm20b.c +++ b/userspace/units/fuse/nvgpu-fuse-gm20b.c @@ -53,6 +53,7 @@ struct fuse_test_args gm20b_init_args = { .sec_fuse_addr = GM20B_FUSE_STATUS_OPT_PRIV_SEC_EN, }; +#ifdef CONFIG_NVGPU_HAL_NON_FUSA int test_fuse_gm20b_check_sec(struct unit_module *m, struct gk20a *g, void *__args) { @@ -174,6 +175,7 @@ int test_fuse_gm20b_check_non_sec(struct unit_module *m, return ret; } +#endif /* CONFIG_NVGPU_HAL_NON_FUSA */ int test_fuse_gm20b_basic_fuses(struct unit_module *m, struct gk20a *g, void *__args) @@ -218,6 +220,7 @@ int test_fuse_gm20b_basic_fuses(struct unit_module *m, } } +#ifdef CONFIG_NVGPU_HAL_NON_FUSA nvgpu_posix_io_writel_reg_space(g, GM20B_FUSE_STATUS_OPT_GPC, set); /* @@ -230,6 +233,7 @@ int test_fuse_gm20b_basic_fuses(struct unit_module *m, __func__, val, set); ret = UNIT_FAIL; } +#endif for (i = 0; i < GM20B_MAX_GPC_COUNT; i++) { g->ops.fuse.fuse_ctrl_opt_tpc_gpc(g, i, set*i); diff --git a/userspace/units/fuse/nvgpu-fuse.c b/userspace/units/fuse/nvgpu-fuse.c index 12cba4639..2f5f9daad 100644 --- a/userspace/units/fuse/nvgpu-fuse.c +++ b/userspace/units/fuse/nvgpu-fuse.c @@ -28,6 +28,7 @@ #include #include +#include "nvgpu-fuse.h" #include "nvgpu-fuse-priv.h" #include "nvgpu-fuse-gp10b.h" #include "nvgpu-fuse-gm20b.h" @@ -35,6 +36,11 @@ #include "nvgpu-fuse-tu104.h" #endif + +#define NV_PMC_BOOT_0_ARCHITECTURE_GV110 (0x00000015 << \ + NVGPU_GPU_ARCHITECTURE_SHIFT) +#define NV_PMC_BOOT_0_IMPLEMENTATION_B 0xB + /* * Mock I/O */ @@ -106,8 +112,13 @@ int test_fuse_device_common_init(struct unit_module *m, (void)nvgpu_posix_register_io(g, &test_reg_callbacks); +#ifdef CONFIG_NVGPU_HAL_NON_FUSA g->params.gpu_arch = args->gpu_arch << NVGPU_GPU_ARCHITECTURE_SHIFT; g->params.gpu_impl = args->gpu_impl; +#else + g->params.gpu_arch = NV_PMC_BOOT_0_ARCHITECTURE_GV110; + g->params.gpu_impl = NV_PMC_BOOT_0_IMPLEMENTATION_B; +#endif nvgpu_posix_io_writel_reg_space(g, args->sec_fuse_addr, 0x0); @@ -160,6 +171,7 @@ struct unit_module_test fuse_tests[] = { UNIT_TEST(fuse_gm20b_init, test_fuse_device_common_init, &gm20b_init_args, 0), +#ifdef CONFIG_NVGPU_HAL_NON_FUSA UNIT_TEST(fuse_gm20b_check_sec, test_fuse_gm20b_check_sec, NULL, 0), UNIT_TEST(fuse_gm20b_check_sec_invalid_gcplex, test_fuse_gm20b_check_sec_invalid_gcplex, @@ -173,6 +185,7 @@ struct unit_module_test fuse_tests[] = { test_fuse_gm20b_check_non_sec, NULL, 0), +#endif UNIT_TEST(fuse_gm20b_basic_fuses, test_fuse_gm20b_basic_fuses, NULL, 0), #ifdef CONFIG_NVGPU_SIM UNIT_TEST(fuse_gm20b_check_fmodel, test_fuse_gm20b_check_fmodel, NULL, 0), diff --git a/userspace/units/fuse/nvgpu-fuse.h b/userspace/units/fuse/nvgpu-fuse.h new file mode 100644 index 000000000..9e4c321be --- /dev/null +++ b/userspace/units/fuse/nvgpu-fuse.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef UNIT_NVGPU_FUSE_H +#define UNIT_NVGPU_FUSE_H + +struct gk20a; +struct unit_module; + +/** @addtogroup SWUTS-fuse + * @{ + * + * Software Unit Test Specification for nvgpu-fuse + */ + +/** + * Test specification for: test_fuse_device_common_init + * + * Description: Initialization required for before fuse tests for each GPU. + * + * Test Type: Other (Setup) + * + * Input: struct fuse_test_args passed via args param. + * + * Steps: + * - Setup g struct + * - Setup fuse ops + * - Setup mock I/O + * + * Output: Returns SUCCESS if the steps above were executed successfully. FAIL + * otherwise. + */ +static int test_fuse_device_common_init(struct unit_module *m, + struct gk20a *g, void *__args); + +/** + * Test specification for: test_fuse_device_common_init + * + * Description: Initialization required for before fuse tests for each GPU. + * + * Test Type: Other (Cleanup) + * + * Input: struct fuse_test_args passed via args param. + * + * Steps: + * - Remove mock I/O + * + * Output: Returns SUCCESS if the steps above were executed successfully. FAIL + * otherwise. + */ +static int test_fuse_device_common_cleanup(struct unit_module *m, + struct gk20a *g, void *__args); + +#endif /* UNIT_NVGPU_FUSE_H */ \ No newline at end of file