diff --git a/Makefile.umbrella.tmk b/Makefile.umbrella.tmk index 1ba79902f..30ec69c80 100644 --- a/Makefile.umbrella.tmk +++ b/Makefile.umbrella.tmk @@ -82,6 +82,7 @@ NV_REPOSITORY_COMPONENTS += userspace/units/fifo/engine/gv11b NV_REPOSITORY_COMPONENTS += userspace/units/fifo/pbdma NV_REPOSITORY_COMPONENTS += userspace/units/fifo/pbdma/gv11b NV_REPOSITORY_COMPONENTS += userspace/units/fifo/pbdma/gm20b +NV_REPOSITORY_COMPONENTS += userspace/units/fifo/pbdma/gp10b NV_REPOSITORY_COMPONENTS += userspace/units/fifo/runlist NV_REPOSITORY_COMPONENTS += userspace/units/fifo/runlist/gk20a NV_REPOSITORY_COMPONENTS += userspace/units/fifo/runlist/gv11b diff --git a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export index d93d4f90a..71ec79115 100644 --- a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export +++ b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export @@ -66,6 +66,9 @@ gp10b_mm_get_iommu_bit gp10b_mm_get_mmu_levels gp10b_mm_init_bar2_vm gp10b_mm_remove_bar2_vm +gp10b_pbdma_get_config_auth_level_privileged +gp10b_pbdma_get_fc_runlist_timeslice +gp10b_pbdma_get_signature gp10b_ramin_init_pdb gp10b_device_info_parse_data gp10b_engine_init_ce_info diff --git a/userspace/Makefile.sources b/userspace/Makefile.sources index 1e1818d5e..04be5e709 100644 --- a/userspace/Makefile.sources +++ b/userspace/Makefile.sources @@ -89,6 +89,7 @@ UNITS := \ $(UNIT_SRC)/fifo/engine/gv11b \ $(UNIT_SRC)/fifo/pbdma \ $(UNIT_SRC)/fifo/pbdma/gm20b \ + $(UNIT_SRC)/fifo/pbdma/gp10b \ $(UNIT_SRC)/fifo/pbdma/gv11b \ $(UNIT_SRC)/fifo/runlist \ $(UNIT_SRC)/fifo/runlist/gk20a \ diff --git a/userspace/SWUTS.h b/userspace/SWUTS.h index 966b8bce1..772872d52 100644 --- a/userspace/SWUTS.h +++ b/userspace/SWUTS.h @@ -48,6 +48,7 @@ * - @ref SWUTS-fifo-engine-gv11b * - @ref SWUTS-fifo-pbdma * - @ref SWUTS-fifo-pbdma-gm20b + * - @ref SWUTS-fifo-pbdma-gp10b * - @ref SWUTS-fifo-pbdma-gv11b * - @ref SWUTS-fifo-runlist * - @ref SWUTS-fifo-runlist-gk20a diff --git a/userspace/SWUTS.sources b/userspace/SWUTS.sources index 2e3408c44..196c56d0b 100644 --- a/userspace/SWUTS.sources +++ b/userspace/SWUTS.sources @@ -18,6 +18,7 @@ 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/pbdma/gm20b/nvgpu-pbdma-gm20b.h +INPUT += ../../../userspace/units/fifo/pbdma/gp10b/nvgpu-pbdma-gp10b.h INPUT += ../../../userspace/units/fifo/pbdma/gv11b/nvgpu-pbdma-gv11b.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/pbdma/gp10b/Makefile b/userspace/units/fifo/pbdma/gp10b/Makefile new file mode 100644 index 000000000..31cc33f5a --- /dev/null +++ b/userspace/units/fifo/pbdma/gp10b/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-pbdma-gp10b.o +MODULE = nvgpu-pbdma-gp10b + +LIB_PATHS += -lnvgpu-fifo +include ../../../Makefile.units + +lib$(MODULE).so: fifo + +fifo: + $(MAKE) -C ../.. diff --git a/userspace/units/fifo/pbdma/gp10b/Makefile.interface.tmk b/userspace/units/fifo/pbdma/gp10b/Makefile.interface.tmk new file mode 100644 index 000000000..af4dc611c --- /dev/null +++ b/userspace/units/fifo/pbdma/gp10b/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-pbdma-gp10b + +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/pbdma/gp10b/Makefile.tmk b/userspace/units/fifo/pbdma/gp10b/Makefile.tmk new file mode 100644 index 000000000..9ed0d85c9 --- /dev/null +++ b/userspace/units/fifo/pbdma/gp10b/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-pbdma-gp10b +NVGPU_UNIT_SRCS = nvgpu-pbdma-gp10b.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/pbdma/gp10b/nvgpu-pbdma-gp10b.c b/userspace/units/fifo/pbdma/gp10b/nvgpu-pbdma-gp10b.c new file mode 100644 index 000000000..4155e9429 --- /dev/null +++ b/userspace/units/fifo/pbdma/gp10b/nvgpu-pbdma-gp10b.c @@ -0,0 +1,120 @@ +/* + * 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 +#include +#include +#include + +#include "hal/fifo/pbdma_gp10b.h" + +#include +#include + +#include "../../nvgpu-fifo.h" +#include "../../nvgpu-fifo-gv11b.h" +#include "nvgpu-pbdma-gp10b.h" + +#ifdef PBDMA_GP10B_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_gp10b_pbdma_get_signature(struct unit_module *m, + struct gk20a *g, void *args) +{ + int ret = UNIT_FAIL; + assert(gp10b_pbdma_get_signature(g) == + (g->ops.get_litter_value(g, GPU_LIT_GPFIFO_CLASS) | + pbdma_signature_sw_zero_f())); + + ret = UNIT_SUCCESS; +done: + return ret; +} + +#define RL_MAX_TIMESLICE_TIMEOUT ram_rl_entry_timeslice_timeout_v(U32_MAX) +#define RL_MAX_TIMESLICE_SCALE ram_rl_entry_timeslice_scale_v(U32_MAX) + +int test_gp10b_pbdma_get_fc_runlist_timeslice(struct unit_module *m, + struct gk20a *g, void *args) +{ + int ret = UNIT_FAIL; + u32 timeslice = gp10b_pbdma_get_fc_runlist_timeslice(); + + u32 timeout = timeslice & 0xFF; + u32 timescale = (timeslice >> 12) & 0xF; + bool enabled = ((timeslice & pbdma_runlist_timeslice_enable_true_f()) != 0); + + assert(timeout <= RL_MAX_TIMESLICE_TIMEOUT); + assert(timescale <= RL_MAX_TIMESLICE_SCALE); + assert(enabled); + + ret = UNIT_SUCCESS; +done: + return ret; +} + +int test_gp10b_pbdma_get_config_auth_level_privileged(struct unit_module *m, + struct gk20a *g, void *args) +{ + int ret = UNIT_FAIL; + + assert(gp10b_pbdma_get_config_auth_level_privileged() == + pbdma_config_auth_level_privileged_f()); + + ret = UNIT_SUCCESS; +done: + return ret; +} + +struct unit_module_test nvgpu_pbdma_gp10b_tests[] = { + UNIT_TEST(init_support, test_fifo_init_support, NULL, 0), + UNIT_TEST(get_signature, test_gp10b_pbdma_get_signature, NULL, 0), + UNIT_TEST(get_fc_runlist_timeslice, + test_gp10b_pbdma_get_fc_runlist_timeslice, NULL, 0), + UNIT_TEST(get_config_auth_level_privileged, + test_gp10b_pbdma_get_config_auth_level_privileged, NULL, 0), + UNIT_TEST(remove_support, test_fifo_remove_support, NULL, 0), +}; + +UNIT_MODULE(nvgpu_pbdma_gp10b, nvgpu_pbdma_gp10b_tests, UNIT_PRIO_NVGPU_TEST); diff --git a/userspace/units/fifo/pbdma/gp10b/nvgpu-pbdma-gp10b.h b/userspace/units/fifo/pbdma/gp10b/nvgpu-pbdma-gp10b.h new file mode 100644 index 000000000..cbe1ad6b1 --- /dev/null +++ b/userspace/units/fifo/pbdma/gp10b/nvgpu-pbdma-gp10b.h @@ -0,0 +1,101 @@ +/* + * 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_PBDMA_GP10B_H +#define UNIT_NVGPU_PBDMA_GP10B_H + +#include + +struct unit_module; +struct gk20a; + +/** @addtogroup SWUTS-fifo-pbdma-gp10b + * @{ + * + * Software Unit Test Specification for fifo/pbdma/gp10b + */ + +/** + * Test specification for: test_gp10b_pbdma_get_signature + * + * Description: Get RAMFC setting for PBDMA signature + * + * Test Type: Feature based + * + * Targets: gp10b_pbdma_get_signature + * + * Input: test_fifo_init_support() run for this GPU + * + * Steps: + * - Check that PBDMA signature consists in the host class for current litter, + * combined with a SW signature set to 0. + * + * Output: Returns PASS if all branches gave expected results. FAIL otherwise. + */ +int test_gp10b_pbdma_get_signature(struct unit_module *m, + struct gk20a *g, void *args); + +/** + * Test specification for: test_gp10b_pbdma_get_fc_runlist_timeslice + * + * Description: Get RAMFC setting for runlist timeslice + * + * Test Type: Feature based + * + * Targets: gp10b_pbdma_get_fc_runlist_timeslice + * + * Input: test_fifo_init_support() run for this GPU + * + * Steps: + * - Get runlist timeslice, and check that timeout and scale are within + * the range used for runlists. + * - Also check that enable bit is set. + * + * Output: Returns PASS if all branches gave expected results. FAIL otherwise. + */ +int test_gp10b_pbdma_get_fc_runlist_timeslice(struct unit_module *m, + struct gk20a *g, void *args); + +/** + * Test specification for: test_gp10b_pbdma_get_config_auth_level_privileged + * + * Description: Get RAMFC setting for privileged channel + * + * Test Type: Feature based + * + * Targets: gp10b_pbdma_get_config_auth_level_privileged + * + * Input: test_fifo_init_support() run for this GPU + * + * Steps: + * - Check that gp10b_pbdma_get_config_auth_level_privileged returns a value + * consistent with H/W manuals. + * + * Output: Returns PASS if all branches gave expected results. FAIL otherwise. + */ +int test_gp10b_pbdma_get_config_auth_level_privileged(struct unit_module *m, + struct gk20a *g, void *args); + +/** + * @} + */ + +#endif /* UNIT_NVGPU_PBDMA_GP10B_H */