mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: unit: improve gm20b pbdma coverage
Add the following cases: - timeout == 0 in gm20b_pbdma_acquire_val - 32-bit overflow in pbdma_method1_r computation. Note: 32-bit overflow for pbdma_method0_r in gm20b_pbdma_is_sw_method_subch is hindered by overflow in pbdma_method1_r which occurs first. Jira NVGPU-4673 Change-Id: If8202a4397115efb5af490b1ce974b43699e15c6 Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2276051 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
031d2b77a2
commit
a252ab1b0d
@@ -145,6 +145,9 @@ int test_gm20b_pbdma_acquire_val(struct unit_module *m,
|
||||
int i;
|
||||
int err;
|
||||
|
||||
timeout = gm20b_pbdma_acquire_val(0);
|
||||
assert(is_timeout_valid(m, timeout, 0));
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
ms = (1ULL << i);
|
||||
timeout = gm20b_pbdma_acquire_val(ms);
|
||||
@@ -300,6 +303,7 @@ int test_gm20b_pbdma_handle_intr_0(struct unit_module *m,
|
||||
u32 err_notifier;
|
||||
bool recover;
|
||||
int i;
|
||||
int err;
|
||||
|
||||
assert((f->intr.pbdma.device_fatal_0 & pbdma_intr_0_memreq_pending_f()) != 0);
|
||||
|
||||
@@ -367,9 +371,19 @@ int test_gm20b_pbdma_handle_intr_0(struct unit_module *m,
|
||||
assert(nvgpu_readl(g, pbdma_method2_r(pbdma_id)) != METHOD_SUBCH6);
|
||||
assert(nvgpu_readl(g, pbdma_method3_r(pbdma_id)) != METHOD_SUBCH7);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* trigger assert in pbdma_method1_r() */
|
||||
pbdma_id = (0x100000000ULL - (u64)pbdma_method1_r(0) + 8191ULL) / 8192ULL;
|
||||
err = EXPECT_BUG(
|
||||
recover = gm20b_pbdma_handle_intr_0(g,
|
||||
pbdma_id, /* invalid pbdma_id */
|
||||
pbdma_intr_0_device_pending_f(),
|
||||
&err_notifier)
|
||||
);
|
||||
assert(err != 0);
|
||||
|
||||
ret = UNIT_SUCCESS;
|
||||
done:
|
||||
if (ret != UNIT_SUCCESS) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2019-2020, 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"),
|
||||
@@ -53,6 +53,8 @@ struct gk20a;
|
||||
* - Check that delta between expected and actual values is lower than
|
||||
* 1024 * (1 << exponent).
|
||||
* - Check that BUG_ON occurs on overflow while converting ms to ns.
|
||||
* - Check that enable bit is not set when 0 is passed to
|
||||
* gm20b_pbdma_acquire_val.
|
||||
*
|
||||
* Output: Returns PASS if all branches gave expected results. FAIL otherwise.
|
||||
*/
|
||||
@@ -116,6 +118,8 @@ int test_gm20b_pbdma_handle_intr(struct unit_module *m,
|
||||
* - pbdma_intr_0_device: Check that all pbdma subch methods and header
|
||||
* have been reset and that recover is true.
|
||||
* - Check that recover is false, when none of above interrupt is raised.
|
||||
* - Check that BUG() occurs when passing an invalid pbdma_id that
|
||||
* causes an overflow in register computation.
|
||||
*
|
||||
* Output: Returns PASS if all branches gave expected results. FAIL otherwise.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user