diff --git a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export index 362a56aa5..9b3290bea 100644 --- a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export +++ b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export @@ -75,6 +75,7 @@ gv11b_fb_intr_is_mmu_fault_pending gv11b_get_litter_value gv11b_gpu_phys_addr gv11b_init_hal +gv11b_is_fault_engine_subid_gpc gv11b_mm_is_bar1_supported gv11b_mm_init_inst_block gv11b_mm_l2_flush diff --git a/userspace/Makefile.sources b/userspace/Makefile.sources index 71739e79d..9cd400bfa 100644 --- a/userspace/Makefile.sources +++ b/userspace/Makefile.sources @@ -85,6 +85,7 @@ UNITS := \ $(UNIT_SRC)/fifo/pbdma \ $(UNIT_SRC)/fifo/engine \ $(UNIT_SRC)/fifo/engine/gv100 \ + $(UNIT_SRC)/fifo/engine/gv11b \ $(UNIT_SRC)/fifo/runlist \ $(UNIT_SRC)/fifo/runlist/gk20a \ $(UNIT_SRC)/fifo/runlist/gv11b \ diff --git a/userspace/SWUTS.h b/userspace/SWUTS.h index fdf03f984..8540765ac 100644 --- a/userspace/SWUTS.h +++ b/userspace/SWUTS.h @@ -43,6 +43,7 @@ * - @ref SWUTS-fifo-channel-gv11b * - @ref SWUTS-fifo-engine * - @ref SWUTS-fifo-engine-gv100 + * - @ref SWUTS-fifo-engine-gv11b * - @ref SWUTS-fifo-pbdma * - @ref SWUTS-fifo-runlist * - @ref SWUTS-fifo-runlist-gk20a diff --git a/userspace/SWUTS.sources b/userspace/SWUTS.sources index cf5bd7f7c..d2fb1213e 100644 --- a/userspace/SWUTS.sources +++ b/userspace/SWUTS.sources @@ -13,6 +13,7 @@ INPUT += ../../../userspace/units/fifo/channel/gm20b/nvgpu-channel-gm20b.h INPUT += ../../../userspace/units/fifo/channel/gv11b/nvgpu-channel-gv11b.h INPUT += ../../../userspace/units/fifo/engine/nvgpu-engine.h INPUT += ../../../userspace/units/fifo/engine/gv100/nvgpu-engine-gv100.h +INPUT += ../../../userspace/units/fifo/engine/gv11b/nvgpu-engine-gv11b.h INPUT += ../../../userspace/units/fifo/pbdma/nvgpu-pbdma.h INPUT += ../../../userspace/units/fifo/runlist/nvgpu-runlist.h INPUT += ../../../userspace/units/fifo/runlist/gk20a/nvgpu-runlist-gk20a.h diff --git a/userspace/units/fifo/engine/gv11b/Makefile b/userspace/units/fifo/engine/gv11b/Makefile new file mode 100644 index 000000000..aae65bb35 --- /dev/null +++ b/userspace/units/fifo/engine/gv11b/Makefile @@ -0,0 +1,32 @@ +# 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. + +.SUFFIXES: + +OBJS = nvgpu-engine-gv11b.o +MODULE = nvgpu-engine-gv11b + +LIB_PATHS += -lnvgpu-fifo +include ../../../Makefile.units + +lib$(MODULE).so: fifo + +fifo: + $(MAKE) -C ../.. diff --git a/userspace/units/fifo/engine/gv11b/Makefile.interface.tmk b/userspace/units/fifo/engine/gv11b/Makefile.interface.tmk new file mode 100644 index 000000000..bcf82a122 --- /dev/null +++ b/userspace/units/fifo/engine/gv11b/Makefile.interface.tmk @@ -0,0 +1,35 @@ +################################### tell Emacs this is a -*- makefile-gmake -*- +# +# 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. +# +# tmake for SW Mobile component makefile +# +############################################################################### + +NVGPU_UNIT_NAME=nvgpu-engine-gv11b + +include $(NV_SOURCE)/kernel/nvgpu/userspace/units/Makefile.units.common.interface.tmk + +# Local Variables: +# indent-tabs-mode: t +# tab-width: 8 +# End: +# vi: set tabstop=8 noexpandtab: diff --git a/userspace/units/fifo/engine/gv11b/Makefile.tmk b/userspace/units/fifo/engine/gv11b/Makefile.tmk new file mode 100644 index 000000000..ce1c11d4b --- /dev/null +++ b/userspace/units/fifo/engine/gv11b/Makefile.tmk @@ -0,0 +1,40 @@ +################################### tell Emacs this is a -*- makefile-gmake -*- +# +# 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. +# +# tmake for SW Mobile component makefile +# +############################################################################### + +NVGPU_UNIT_NAME = nvgpu-engine-gv11b +NVGPU_UNIT_SRCS = nvgpu-engine-gv11b.c + +NVGPU_UNIT_INTERFACE_DIRS := \ + $(NV_SOURCE)/kernel/nvgpu/userspace/units/fifo \ + $(NV_SOURCE)/kernel/nvgpu/drivers/gpu/nvgpu + +include $(NV_SOURCE)/kernel/nvgpu/userspace/units/Makefile.units.common.tmk + +# Local Variables: +# indent-tabs-mode: t +# tab-width: 8 +# End: +# vi: set tabstop=8 noexpandtab: diff --git a/userspace/units/fifo/engine/gv11b/nvgpu-engine-gv11b.c b/userspace/units/fifo/engine/gv11b/nvgpu-engine-gv11b.c new file mode 100644 index 000000000..88d81f62b --- /dev/null +++ b/userspace/units/fifo/engine/gv11b/nvgpu-engine-gv11b.c @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "hal/fifo/engines_gv11b.h" + +#include +#include + +#include "../../nvgpu-fifo.h" +#include "nvgpu-engine-gv11b.h" + +#ifdef ENGINE_GV11B_UNIT_DEBUG +#undef unit_verbose +#define unit_verbose unit_info +#else +#define unit_verbose(unit, msg, ...) \ + do { \ + if (0) { \ + unit_info(unit, msg, ##__VA_ARGS__); \ + } \ + } while (0) +#endif + +#define assert(cond) unit_assert(cond, goto done) + +int test_gv11b_is_fault_engine_subid_gpc(struct unit_module *m, + struct gk20a *g, void *args) +{ + + int ret = UNIT_FAIL; + + assert(gv11b_is_fault_engine_subid_gpc(g, + gmmu_fault_client_type_gpc_v()) == true); + assert(gv11b_is_fault_engine_subid_gpc(g, + gmmu_fault_client_type_hub_v()) == false); + + ret = UNIT_SUCCESS; +done: + return ret; +} + +struct unit_module_test nvgpu_engine_gv11b_tests[] = { + UNIT_TEST(is_fault_engine_subid_gpc, test_gv11b_is_fault_engine_subid_gpc, NULL, 0), +}; + +UNIT_MODULE(nvgpu_engine_gv11b, nvgpu_engine_gv11b_tests, UNIT_PRIO_NVGPU_TEST); diff --git a/userspace/units/fifo/engine/gv11b/nvgpu-engine-gv11b.h b/userspace/units/fifo/engine/gv11b/nvgpu-engine-gv11b.h new file mode 100644 index 000000000..8acf65d2e --- /dev/null +++ b/userspace/units/fifo/engine/gv11b/nvgpu-engine-gv11b.h @@ -0,0 +1,60 @@ +/* + * 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_ENGINE_GV11B_H +#define UNIT_NVGPU_ENGINE_GV11B_H + +#include + +struct unit_module; +struct gk20a; + +/** @addtogroup SWUTS-fifo-engine-gv11b + * @{ + * + * Software Unit Test Specification for fifo/engine/gv11b + */ + +/** + * Test specification for: test_gv11b_is_fault_engine_subid_gpc + * + * Description: Branch coverage for gv11b_is_fault_engine_subid_gpc + * + * Test Type: Feature based + * + * Input: test_fifo_init_support() run for this GPU + * + * Steps: + * - Check that true is returned for GPC engine subid + * (i.e. gmmu_fault_client_type_gpc_v). + * - Check that false is returned for non-GPC engine subid + * (i.e. gmmu_fault_client_type_hub_v). + * + * Output: Returns PASS if all branches gave expected results. FAIL otherwise. + */ +int test_gv11b_is_fault_engine_subid_gpc(struct unit_module *m, + struct gk20a *g, void *args); + +/** + * @} + */ + +#endif /* UNIT_NVGPU_ENGINE_GV11B_H */