diff --git a/userspace/units/priv_ring/nvgpu-priv_ring.c b/userspace/units/priv_ring/nvgpu-priv_ring.c index ef5bf2905..54607d9e5 100644 --- a/userspace/units/priv_ring/nvgpu-priv_ring.c +++ b/userspace/units/priv_ring/nvgpu-priv_ring.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -377,6 +378,7 @@ int test_priv_ring_isr(struct unit_module *m, struct gk20a *g, void *args) } u32 error_codes[] = { + 0U, 0xBADF1100U, 0xBADF1800U, 0xBADF1A00U, @@ -389,6 +391,7 @@ u32 error_codes[] = { 0xBADF5100U, 0xBADF5500U, 0xBADF5600U, + U32_MAX, }; int test_decode_error_code(struct unit_module *m, struct gk20a *g, void *args) @@ -401,6 +404,10 @@ int test_decode_error_code(struct unit_module *m, struct gk20a *g, void *args) g->ops.priv_ring.decode_error_code(g, error_codes[i]); } + /* Call priv_ring ISR randomly on the full range */ + u32 random_code = get_random_u32(1, U32_MAX - 1); + g->ops.priv_ring.decode_error_code(g, random_code); + return ret; } diff --git a/userspace/units/priv_ring/nvgpu-priv_ring.h b/userspace/units/priv_ring/nvgpu-priv_ring.h index 79a18b7a0..ff763f6f3 100644 --- a/userspace/units/priv_ring/nvgpu-priv_ring.h +++ b/userspace/units/priv_ring/nvgpu-priv_ring.h @@ -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 * copy of this software and associated documentation files (the "Software"), @@ -224,17 +224,21 @@ int test_priv_ring_isr(struct unit_module *m, struct gk20a *g, void *args); * * Description: Verify the priv_ring.decode_error_code HAL. * - * Test Type: Feature, Error injection + * Test Type: Feature, Error injection, Boundary Value * * Targets: gops_priv_ring.decode_error_code, gp10b_decode_error_code * * Input: test_priv_ring_setup() has been executed. + * Equivalence classes: + * engine_id + * - Valid : {0 - U32_MAX} * * Steps: * - Call decode_error_code HAL with different error_codes covering all the * branches (0xBADF1xxx, 0xBADF2xxx, 0xBADF3xxx, 0xBADF5xxx). * - Include error codes with reference the largest index for each of the error * types. + * - Include boundary values and one random number in between the range [0 - U32_MAX] * * Output: * - UNIT_SUCCESS