gpu: nvgpu: unit: add tests for userd gk20a HAL

Add unit test for the following HAL:
- gk20a_userd_entry_size

Jira NVGPU-4389

Change-Id: I8da4fcc3c3e3aadf69e7cf1ae26fba6f2701a557
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2254547
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Thomas Fleury
2019-12-03 14:06:25 -05:00
committed by Alex Waterman
parent 2846c26c1e
commit 4e9c117848
11 changed files with 256 additions and 1 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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 \

View File

@@ -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

View File

@@ -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

View File

@@ -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",

View File

@@ -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 ../..

View File

@@ -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:

View File

@@ -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:

View File

@@ -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 <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <unit/io.h>
#include <unit/unit.h>
#include <nvgpu/channel.h>
#include <nvgpu/tsg.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/engines.h>
#include <nvgpu/runlist.h>
#include <nvgpu/fuse.h>
#include <nvgpu/dma.h>
#include <nvgpu/io.h>
#include "hal/fifo/userd_gk20a.h"
#include <nvgpu/hw/gk20a/hw_ram_gk20a.h>
#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);

View File

@@ -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 <nvgpu/types.h>
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 */