mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: units: BVEC test for common.ptimer
Update common.ptimer boundary value test to use BVEC test values. Update test documentation accordingly. Jira NVGPU-6394 Change-Id: Ib215d8a3eeac73f2dbc2a558d0e4df50c9f12157 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2546971 (cherry picked from commit e34aff6524822ff0f0ec74bc8202e2748b027099) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2551338 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Shashank Singh <shashsingh@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
02943a63b4
commit
60e3aee389
@@ -262,65 +262,45 @@ int test_ptimer_scaling(struct unit_module *m,
|
|||||||
struct gk20a *g, void *args)
|
struct gk20a *g, void *args)
|
||||||
{
|
{
|
||||||
int ret = UNIT_SUCCESS;
|
int ret = UNIT_SUCCESS;
|
||||||
|
int err;
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
val = scale_ptimer(100, 20);
|
/* Initialize ptimer source freq as per gv11b platform freq */
|
||||||
if (val != 50) {
|
g->ptimer_src_freq = 31250000U;
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
|
||||||
|
err = nvgpu_ptimer_scale(g, 0U, &val);
|
||||||
|
if ((err != 0) || (val != 0U)) {
|
||||||
|
unit_err(m, "ptimer scale calculation incorrect, line %u\n", __LINE__);
|
||||||
ret = UNIT_FAIL;
|
ret = UNIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = scale_ptimer(111, 20);
|
err = nvgpu_ptimer_scale(g, 1000U, &val);
|
||||||
if (val != 56) {
|
if ((err != 0) || (val != 1000U)) {
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
unit_err(m, "ptimer scale calculation incorrect, line %u\n", __LINE__);
|
||||||
ret = UNIT_FAIL;
|
ret = UNIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = scale_ptimer(U32_MAX/10, 20);
|
err = nvgpu_ptimer_scale(g, U32_MAX / 10, &val);
|
||||||
if (val != (U32_MAX/20)+1) {
|
if ((err != 0) || (val != (U32_MAX / 10))) {
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
unit_err(m, "ptimer scale calculation incorrect, line %u\n", __LINE__);
|
||||||
ret = UNIT_FAIL;
|
ret = UNIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = scale_ptimer(0, U32_MAX);
|
err = nvgpu_ptimer_scale(g, (U32_MAX / 10U) + 1, &val);
|
||||||
if (val != 0) {
|
if (err == 0) {
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
unit_err(m, "unexpected success returned, line %u\n", __LINE__);
|
||||||
ret = UNIT_FAIL;
|
ret = UNIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = scale_ptimer(100, 1);
|
err = nvgpu_ptimer_scale(g, U32_MAX / 5U, &val);
|
||||||
if (val != 1001) {
|
if (err == 0) {
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
unit_err(m, "unexpected success returned, line %u\n", __LINE__);
|
||||||
ret = UNIT_FAIL;
|
ret = UNIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = scale_ptimer(10, 6);
|
err = nvgpu_ptimer_scale(g, U32_MAX, &val);
|
||||||
if (val != 17) {
|
if (err == 0) {
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
unit_err(m, "unexpected success returned, line %u\n", __LINE__);
|
||||||
ret = UNIT_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
val = ptimer_scalingfactor10x(100);
|
|
||||||
if (val != (PTIMER_REF_FREQ_HZ*10/100)) {
|
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
|
||||||
ret = UNIT_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
val = ptimer_scalingfactor10x(97);
|
|
||||||
if (val != (PTIMER_REF_FREQ_HZ*10/97)) {
|
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
|
||||||
ret = UNIT_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
val = ptimer_scalingfactor10x(100);
|
|
||||||
if (val != (PTIMER_REF_FREQ_HZ*10/100)) {
|
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
|
||||||
ret = UNIT_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
val = ptimer_scalingfactor10x(PTIMER_REF_FREQ_HZ);
|
|
||||||
if (val != 10) {
|
|
||||||
unit_err(m, "ptimer scale calculation incorrect\n");
|
|
||||||
ret = UNIT_FAIL;
|
ret = UNIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -156,19 +156,24 @@ int test_ptimer_isr(struct unit_module *m,
|
|||||||
/**
|
/**
|
||||||
* Test specification for: test_ptimer_scaling
|
* Test specification for: test_ptimer_scaling
|
||||||
*
|
*
|
||||||
* Description: Verify the scale_ptimer() and ptimer_scalingfactor10x() APIs.
|
* Description: Verify the nvgpu_ptimer_scale() API.
|
||||||
*
|
*
|
||||||
* Test Type: Feature Based, Boundary Values
|
* Test Type: Feature Based, Boundary Values
|
||||||
*
|
*
|
||||||
* Targets: scale_ptimer, ptimer_scalingfactor10x
|
* Targets: nvgpu_ptimer_scale
|
||||||
|
*
|
||||||
|
* Equivalence classes:
|
||||||
|
* Variable: timeout
|
||||||
|
* - Valid : 0 to U32_MAX/10
|
||||||
*
|
*
|
||||||
* Input: None
|
* Input: None
|
||||||
*
|
*
|
||||||
* Steps:
|
* Steps:
|
||||||
* - Call the scale_ptimer() API with various input values and verify the
|
* - Initialize ptimer source freq as per gv11b platform freq (i.e. 31250000U).
|
||||||
* returned value.
|
* - Call the nvgpu_ptimer_scale() API with below BVEC test values and verify the
|
||||||
* - Call the ptimer_scalingfactor10x() API with various input values and verify
|
* returned value and error code.
|
||||||
* the returned value.
|
* Valid test values : 0, 1000, U32_MAX/10
|
||||||
|
* Invalid test values : U32_MAX/10 + 1, U32_MAX/5, U32_MAX
|
||||||
*
|
*
|
||||||
* Output:
|
* Output:
|
||||||
* - UNIT_FAIL if encounters an error creating reg space
|
* - UNIT_FAIL if encounters an error creating reg space
|
||||||
|
|||||||
Reference in New Issue
Block a user