diff --git a/Makefile.umbrella.tmk b/Makefile.umbrella.tmk index 97a4347d3..51c2764bb 100644 --- a/Makefile.umbrella.tmk +++ b/Makefile.umbrella.tmk @@ -85,6 +85,7 @@ NV_REPOSITORY_COMPONENTS += userspace/units/fifo/runlist/gk20a NV_REPOSITORY_COMPONENTS += userspace/units/fifo/runlist/gv11b NV_REPOSITORY_COMPONENTS += userspace/units/fifo/tsg NV_REPOSITORY_COMPONENTS += userspace/units/fifo/tsg/gv11b +NV_REPOSITORY_COMPONENTS += userspace/units/fifo/userd/gk20a NV_REPOSITORY_COMPONENTS += userspace/units/fuse NV_REPOSITORY_COMPONENTS += userspace/units/list NV_REPOSITORY_COMPONENTS += userspace/units/ltc diff --git a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export index 6bc4daf7c..010264cb1 100644 --- a/drivers/gpu/nvgpu/libnvgpu-drv_safe.export +++ b/drivers/gpu/nvgpu/libnvgpu-drv_safe.export @@ -24,6 +24,7 @@ gk20a_runlist_length_max gk20a_runlist_hw_submit gk20a_runlist_wait_pending gk20a_runlist_write_state +gk20a_userd_entry_size gk20a_vm_release_share gm20b_channel_bind gm20b_channel_force_ctx_reload diff --git a/userspace/Makefile.sources b/userspace/Makefile.sources index 63fd53567..e2465835b 100644 --- a/userspace/Makefile.sources +++ b/userspace/Makefile.sources @@ -93,6 +93,7 @@ UNITS := \ $(UNIT_SRC)/fifo/runlist/gv11b \ $(UNIT_SRC)/fifo/tsg \ $(UNIT_SRC)/fifo/tsg/gv11b \ + $(UNIT_SRC)/fifo/userd/gk20a \ $(UNIT_SRC)/list \ $(UNIT_SRC)/ltc \ $(UNIT_SRC)/enabled \ @@ -111,4 +112,4 @@ UNITS := \ $(UNIT_SRC)/gr/setup \ $(UNIT_SRC)/acr \ $(UNIT_SRC)/cg \ - $(UNIT_SRC)/sync \ No newline at end of file + $(UNIT_SRC)/sync diff --git a/userspace/SWUTS.h b/userspace/SWUTS.h index df2e37b6a..f1bfeab3a 100644 --- a/userspace/SWUTS.h +++ b/userspace/SWUTS.h @@ -52,6 +52,7 @@ * - @ref SWUTS-fifo-runlist-gv11b * - @ref SWUTS-fifo-tsg * - @ref SWUTS-fifo-tsg-gv11b + * - @ref SWUTS-fifo-userd-gk20a * - @ref SWUTS-init * - @ref SWUTS-interface-atomic * - @ref SWUTS-ltc diff --git a/userspace/SWUTS.sources b/userspace/SWUTS.sources index 3e76e433f..22e900191 100644 --- a/userspace/SWUTS.sources +++ b/userspace/SWUTS.sources @@ -22,6 +22,7 @@ INPUT += ../../../userspace/units/fifo/runlist/gk20a/nvgpu-runlist-gk20a.h INPUT += ../../../userspace/units/fifo/runlist/gv11b/nvgpu-runlist-gv11b.h INPUT += ../../../userspace/units/fifo/tsg/nvgpu-tsg.h INPUT += ../../../userspace/units/fifo/tsg/gv11b/nvgpu-tsg-gv11b.h +INPUT += ../../../userspace/units/fifo/userd/gk20a/nvgpu-userd-gk20a.h INPUT += ../../../userspace/units/fuse/nvgpu-fuse.h INPUT += ../../../userspace/units/fuse/nvgpu-fuse-gm20b.h INPUT += ../../../userspace/units/fuse/nvgpu-fuse-gp10b.h diff --git a/userspace/required_tests.json b/userspace/required_tests.json index f14f780f9..c04ff1477 100644 --- a/userspace/required_tests.json +++ b/userspace/required_tests.json @@ -2105,6 +2105,12 @@ "unit": "nvgpu_tsg_gv11b", "test_level": 0 }, + { + "test": "test_gk20a_userd_entry_size", + "case": "entry_size", + "unit": "nvgpu_userd_gk20a", + "test_level": 0 + }, { "test": "test_nvgpu_gmmu_clean", "case": "gmmu_clean", diff --git a/userspace/units/fifo/userd/gk20a/Makefile b/userspace/units/fifo/userd/gk20a/Makefile new file mode 100644 index 000000000..eeaf3c1a7 --- /dev/null +++ b/userspace/units/fifo/userd/gk20a/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-userd-gk20a.o +MODULE = nvgpu-userd-gk20a + +LIB_PATHS += -lnvgpu-fifo +include ../../../Makefile.units + +lib$(MODULE).so: fifo + +fifo: + $(MAKE) -C ../.. diff --git a/userspace/units/fifo/userd/gk20a/Makefile.interface.tmk b/userspace/units/fifo/userd/gk20a/Makefile.interface.tmk new file mode 100644 index 000000000..9e022c0b1 --- /dev/null +++ b/userspace/units/fifo/userd/gk20a/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-userd-gk20a + +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/userd/gk20a/Makefile.tmk b/userspace/units/fifo/userd/gk20a/Makefile.tmk new file mode 100644 index 000000000..128943654 --- /dev/null +++ b/userspace/units/fifo/userd/gk20a/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-userd-gk20a +NVGPU_UNIT_SRCS = nvgpu-userd-gk20a.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/userd/gk20a/nvgpu-userd-gk20a.c b/userspace/units/fifo/userd/gk20a/nvgpu-userd-gk20a.c new file mode 100644 index 000000000..84e1e2e5a --- /dev/null +++ b/userspace/units/fifo/userd/gk20a/nvgpu-userd-gk20a.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 +#include +#include +#include + +#include "hal/fifo/userd_gk20a.h" + +#include + +#include "../../nvgpu-fifo.h" +#include "nvgpu-userd-gk20a.h" + +#ifdef USERD_GK20A_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) +#define branches_str test_fifo_flags_str + +int test_gk20a_userd_entry_size(struct unit_module *m, + struct gk20a *g, void *args) +{ + int ret = UNIT_FAIL; + u32 size = gk20a_userd_entry_size(g); + + assert(size == ram_userd_chan_size_v()); + ret = UNIT_SUCCESS; +done: + return ret; +} + +struct unit_module_test nvgpu_userd_gk20a_tests[] = { + UNIT_TEST(entry_size, test_gk20a_userd_entry_size, NULL, 0), +}; + +UNIT_MODULE(nvgpu_userd_gk20a, nvgpu_userd_gk20a_tests, UNIT_PRIO_NVGPU_TEST); diff --git a/userspace/units/fifo/userd/gk20a/nvgpu-userd-gk20a.h b/userspace/units/fifo/userd/gk20a/nvgpu-userd-gk20a.h new file mode 100644 index 000000000..dbf8a2b8e --- /dev/null +++ b/userspace/units/fifo/userd/gk20a/nvgpu-userd-gk20a.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_USERD_GK20A_H +#define UNIT_NVGPU_USERD_GK20A_H + +#include + +struct unit_module; +struct gk20a; + +/** @addtogroup SWUTS-fifo-userd-gk20a + * @{ + * + * Software Unit Test Specification for fifo/userd/gk20a + */ + +/** + * Test specification for: test_gk20a_userd_entry_size + * + * Description: USERD entry size + * + * Test Type: Feature based + * + * Targets: gk20a_userd_entry_size + * + * Input: test_fifo_init_support() run for this GPU + * + * Steps: + * - Get USERD entry size in bytes by calling gk20a_userd_entry_size. + * - Check that it is consistent with definitions in HW manuals. + * + * Output: Returns PASS if all branches gave expected results. FAIL otherwise. + */ +int test_gk20a_userd_entry_size(struct unit_module *m, + struct gk20a *g, void *args); + +/** + * @} + */ + +#endif /* UNIT_NVGPU_USERD_GK20A_H */