mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: unit: add tests for usermode gv11b HAL
Add unit tests for the following usermode HALs: - gv11b_usermode_base - gv11b_usermode_bus_base - gv11b_usermode_doorbell_token - gv11b_usermode_ring_doorbell Jira NVGPU-4389 Change-Id: I7fdad23b0482c1437d309e8eeab239aad1fb5c99 Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2254548 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
4e9c117848
commit
63de725df9
@@ -86,6 +86,7 @@ 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/fifo/usermode/gv11b
|
||||
NV_REPOSITORY_COMPONENTS += userspace/units/fuse
|
||||
NV_REPOSITORY_COMPONENTS += userspace/units/list
|
||||
NV_REPOSITORY_COMPONENTS += userspace/units/ltc
|
||||
|
||||
@@ -88,6 +88,10 @@ gv11b_mc_is_mmu_fault_pending
|
||||
gv11b_runlist_entry_size
|
||||
gv11b_runlist_get_tsg_entry
|
||||
gv11b_runlist_get_ch_entry
|
||||
gv11b_usermode_base
|
||||
gv11b_usermode_bus_base
|
||||
gv11b_usermode_doorbell_token
|
||||
gv11b_usermode_ring_doorbell
|
||||
gv11b_class_is_valid_compute
|
||||
gv11b_class_is_valid
|
||||
gv11b_slcg_bus_gating_prod_size
|
||||
|
||||
@@ -94,6 +94,7 @@ UNITS := \
|
||||
$(UNIT_SRC)/fifo/tsg \
|
||||
$(UNIT_SRC)/fifo/tsg/gv11b \
|
||||
$(UNIT_SRC)/fifo/userd/gk20a \
|
||||
$(UNIT_SRC)/fifo/usermode/gv11b \
|
||||
$(UNIT_SRC)/list \
|
||||
$(UNIT_SRC)/ltc \
|
||||
$(UNIT_SRC)/enabled \
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
* - @ref SWUTS-fifo-tsg
|
||||
* - @ref SWUTS-fifo-tsg-gv11b
|
||||
* - @ref SWUTS-fifo-userd-gk20a
|
||||
* - @ref SWUTS-fifo-usermode-gv11b
|
||||
* - @ref SWUTS-init
|
||||
* - @ref SWUTS-interface-atomic
|
||||
* - @ref SWUTS-ltc
|
||||
|
||||
@@ -23,6 +23,7 @@ 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/fifo/userd/gv11b/nvgpu-usermode-gv11b.h
|
||||
INPUT += ../../../userspace/units/fuse/nvgpu-fuse.h
|
||||
INPUT += ../../../userspace/units/fuse/nvgpu-fuse-gm20b.h
|
||||
INPUT += ../../../userspace/units/fuse/nvgpu-fuse-gp10b.h
|
||||
|
||||
@@ -2111,6 +2111,24 @@
|
||||
"unit": "nvgpu_userd_gk20a",
|
||||
"test_level": 0
|
||||
},
|
||||
{
|
||||
"test": "test_fifo_init_support",
|
||||
"case": "init_support",
|
||||
"unit": "nvgpu_usermode_gv11b",
|
||||
"test_level": 0
|
||||
},
|
||||
{
|
||||
"test": "test_fifo_remove_support",
|
||||
"case": "remove_support",
|
||||
"unit": "nvgpu_usermode_gv11b",
|
||||
"test_level": 0
|
||||
},
|
||||
{
|
||||
"test": "test_gv11b_usermode",
|
||||
"case": "usermode",
|
||||
"unit": "nvgpu_usermode_gv11b",
|
||||
"test_level": 0
|
||||
},
|
||||
{
|
||||
"test": "test_nvgpu_gmmu_clean",
|
||||
"case": "gmmu_clean",
|
||||
|
||||
32
userspace/units/fifo/usermode/gv11b/Makefile
Normal file
32
userspace/units/fifo/usermode/gv11b/Makefile
Normal 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-usermode-gv11b.o
|
||||
MODULE = nvgpu-usermode-gv11b
|
||||
|
||||
LIB_PATHS += -lnvgpu-fifo
|
||||
include ../../../Makefile.units
|
||||
|
||||
lib$(MODULE).so: fifo
|
||||
|
||||
fifo:
|
||||
$(MAKE) -C ../..
|
||||
35
userspace/units/fifo/usermode/gv11b/Makefile.interface.tmk
Normal file
35
userspace/units/fifo/usermode/gv11b/Makefile.interface.tmk
Normal 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-usermode-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:
|
||||
40
userspace/units/fifo/usermode/gv11b/Makefile.tmk
Normal file
40
userspace/units/fifo/usermode/gv11b/Makefile.tmk
Normal 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-usermode-gv11b
|
||||
NVGPU_UNIT_SRCS = nvgpu-usermode-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:
|
||||
103
userspace/units/fifo/usermode/gv11b/nvgpu-usermode-gv11b.c
Normal file
103
userspace/units/fifo/usermode/gv11b/nvgpu-usermode-gv11b.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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/runlist.h>
|
||||
#include <nvgpu/tsg.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/io.h>
|
||||
#include <nvgpu/io_usermode.h>
|
||||
|
||||
#include "hal/fifo/usermode_gv11b.h"
|
||||
|
||||
#include <nvgpu/hw/gv11b/hw_usermode_gv11b.h>
|
||||
|
||||
#include "../../nvgpu-fifo.h"
|
||||
#include "nvgpu-usermode-gv11b.h"
|
||||
|
||||
#ifdef USERMODE_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)
|
||||
#define branches_str test_fifo_flags_str
|
||||
|
||||
int test_gv11b_usermode(struct unit_module *m,
|
||||
struct gk20a *g, void *args)
|
||||
{
|
||||
int ret = UNIT_FAIL;
|
||||
u64 base = gv11b_usermode_base(g);
|
||||
u64 bus_base = gv11b_usermode_bus_base(g);
|
||||
struct nvgpu_channel *ch = NULL;
|
||||
struct nvgpu_fifo *f = &g->fifo;
|
||||
u32 runlist_id = NVGPU_INVALID_RUNLIST_ID;
|
||||
bool privileged = false;
|
||||
u32 hw_chid;
|
||||
u32 token;
|
||||
u32 val;
|
||||
|
||||
assert(base == usermode_cfg0_r());
|
||||
assert(bus_base == usermode_cfg0_r());
|
||||
|
||||
ch = nvgpu_channel_open_new(g, runlist_id,
|
||||
privileged, getpid(), getpid());
|
||||
assert(ch != NULL);
|
||||
hw_chid = f->channel_base + ch->chid;
|
||||
|
||||
token = gv11b_usermode_doorbell_token(ch);
|
||||
assert(token == usermode_notify_channel_pending_id_f(hw_chid));
|
||||
|
||||
nvgpu_usermode_writel(g, usermode_notify_channel_pending_r(), 0);
|
||||
gv11b_usermode_ring_doorbell(ch);
|
||||
val = nvgpu_readl(g, usermode_notify_channel_pending_r());
|
||||
assert(val == token);
|
||||
|
||||
ret = UNIT_SUCCESS;
|
||||
done:
|
||||
if (ch != NULL) {
|
||||
nvgpu_channel_close(ch);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct unit_module_test nvgpu_usermode_gv11b_tests[] = {
|
||||
UNIT_TEST(init_support, test_fifo_init_support, NULL, 0),
|
||||
UNIT_TEST(usermode, test_gv11b_usermode, NULL, 0),
|
||||
UNIT_TEST(remove_support, test_fifo_remove_support, NULL, 0),
|
||||
};
|
||||
|
||||
UNIT_MODULE(nvgpu_usermode_gv11b, nvgpu_usermode_gv11b_tests, UNIT_PRIO_NVGPU_TEST);
|
||||
61
userspace/units/fifo/usermode/gv11b/nvgpu-usermode-gv11b.h
Normal file
61
userspace/units/fifo/usermode/gv11b/nvgpu-usermode-gv11b.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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_USERMODE_GV11B_H
|
||||
#define UNIT_NVGPU_USERMODE_GV11B_H
|
||||
|
||||
#include <nvgpu/types.h>
|
||||
|
||||
struct unit_module;
|
||||
struct gk20a;
|
||||
|
||||
/** @addtogroup SWUTS-fifo-usermode-gv11b
|
||||
* @{
|
||||
*
|
||||
* Software Unit Test Specification for fifo/usermode/gv11b
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test specification for: test_gv11b_usermode
|
||||
*
|
||||
* Description: Usermode gv11b HALs
|
||||
*
|
||||
* Test Type: Feature based
|
||||
*
|
||||
* Targets: gv11b_usermode_base, gv11b_usermode_bus_base,
|
||||
* gv11b_usermode_doorbell_token, gv11b_usermode_ring_doorbell
|
||||
*
|
||||
* 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_gv11b_usermode(struct unit_module *m,
|
||||
struct gk20a *g, void *args);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* UNIT_NVGPU_USERMODE_GV11B_H */
|
||||
Reference in New Issue
Block a user