[igt-dev] [PATCH] lib/amdgpu: fix typo in function compare_pattern

vitaly.prosyak at amd.com vitaly.prosyak at amd.com
Fri Sep 8 02:50:38 UTC 2023


From: Jesse Zhang <jesse.zhang at amd.com>

 In function compare_pattern check the destination buffer (bo2_cpu),
 instead of source buffer(bo_cpu).
 Add validation of the return value in the eviction test.

Cc: Luben Tuikov <luben.tuikov at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: Christian Koenig <christian.koenig at amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang at amd.com>
Reviewed-by: Vitaly Prosyak <vitaly.prosyak at amd.com>
---
 lib/amdgpu/amd_ip_blocks.c | 2 +-
 tests/amdgpu/amd_basic.c   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/amdgpu/amd_ip_blocks.c b/lib/amdgpu/amd_ip_blocks.c
index be9ff38c6..7f8d4a4cd 100644
--- a/lib/amdgpu/amd_ip_blocks.c
+++ b/lib/amdgpu/amd_ip_blocks.c
@@ -296,7 +296,7 @@ x_compare_pattern(const struct amdgpu_ip_funcs *func,
 	int num_compare = ring_context->write_length/div;
 
 	while (i < num_compare) {
-		if (ring_context->bo_cpu[i++] != func->pattern) {
+		if (ring_context->bo2_cpu[i++] != func->pattern) {
 			ret = -1;
 			break;
 		}
diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
index dfe11995f..e7a42a335 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -411,6 +411,7 @@ amdgpu_bo_eviction_test(amdgpu_device_handle device_handle)
 			amdgpu_test_exec_cs_helper(device_handle, ip_block->type, ring_context);
 			/* fulfill PM4: test DMA copy linear */
 			r = ip_block->funcs->compare_pattern(ip_block->funcs, ring_context, sdma_write_length);
+			igt_assert_eq(r, 0);
 			amdgpu_bo_unmap_and_free(ring_context->bo, ring_context->va_handle, ring_context->bo_mc,
 						 ring_context->write_length);
 			amdgpu_bo_unmap_and_free(ring_context->bo2, ring_context->va_handle2, ring_context->bo_mc2,
-- 
2.25.1



More information about the igt-dev mailing list