gpu: nvgpu: unit: add tests for gp10b pbdma HAL

Add unit tests for the following HALs:
- gp10b_pbdma_get_signature
- gp10b_pbdma_get_fc_runlist_timeslice
- gp10b_pbdma_get_config_auth_level_privileged

Jira NVGPU-3694

Change-Id: I672acc76490db358951b31c1231fb8542852dfee
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2253635
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Thomas Fleury
2019-11-20 08:57:03 -05:00
committed by Alex Waterman
parent 7b1f5a327f
commit 24210bdbc9
10 changed files with 335 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

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-pbdma-gp10b.o
MODULE = nvgpu-pbdma-gp10b
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-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:

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

View File

@@ -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 <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/pbdma_gp10b.h"
#include <nvgpu/hw/gp10b/hw_pbdma_gp10b.h>
#include <nvgpu/hw/gp10b/hw_ram_gp10b.h>
#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);

View File

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