From: "Jesse.zhang@amd.com" <jesse.zhang@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
Kamil Konieczny <kamil.konieczny@linux.intel.com>,
"Jesse.zhang@amd.com" <jesse.zhang@amd.com>
Subject: [PATCH i-g-t] lib/amdgpu: enhance sdma test
Date: Fri, 27 Sep 2024 17:09:51 +0800 [thread overview]
Message-ID: <20240927090951.3761844-1-jesse.zhang@amd.com> (raw)
The sdma may have multiple rings,
each of which should be tested.
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
---
lib/amdgpu/amd_deadlock_helpers.c | 45 +++++++++++++++++++++++++++----
lib/amdgpu/amd_deadlock_helpers.h | 5 ++--
tests/amdgpu/amd_deadlock.c | 18 ++++++-------
3 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/lib/amdgpu/amd_deadlock_helpers.c b/lib/amdgpu/amd_deadlock_helpers.c
index c71272e58..851f096b9 100644
--- a/lib/amdgpu/amd_deadlock_helpers.c
+++ b/lib/amdgpu/amd_deadlock_helpers.c
@@ -169,8 +169,8 @@ amdgpu_wait_memory_helper(amdgpu_device_handle device_handle, unsigned int ip_ty
free_cmd_base(base_cmd);
}
-void
-bad_access_helper(amdgpu_device_handle device_handle, unsigned int cmd_error, unsigned int ip_type)
+static void
+bad_access_helper(amdgpu_device_handle device_handle, unsigned int cmd_error, unsigned int ip_type, unsigned int ring_id)
{
const struct amdgpu_ip_block_version *ip_block = NULL;
@@ -190,7 +190,7 @@ bad_access_helper(amdgpu_device_handle device_handle, unsigned int cmd_error, un
ring_context->pm4 = calloc(pm4_dw, sizeof(*ring_context->pm4));
ring_context->pm4_size = pm4_dw;
ring_context->res_cnt = 1;
- ring_context->ring_id = 0;
+ ring_context->ring_id = ring_id;
igt_assert(ring_context->pm4);
ip_block = get_ip_block(device_handle, ip_type);
r = amdgpu_bo_alloc_and_map(device_handle,
@@ -216,11 +216,27 @@ bad_access_helper(amdgpu_device_handle device_handle, unsigned int cmd_error, un
free(ring_context);
}
+void bad_access_ring_helper(amdgpu_device_handle device_handle, unsigned int cmd_error, unsigned int ip_type)
+{
+ int r;
+ struct drm_amdgpu_info_hw_ip info;
+ uint32_t ring_id;
+
+ r = amdgpu_query_hw_ip_info(device_handle, ip_type, 0, &info);
+ igt_assert_eq(r, 0);
+ if (!info.available_rings)
+ igt_info("SKIP ... as there's no ring for ip %d\n", ip_type);
+
+ for (ring_id = 0; (1 << ring_id) & info.available_rings; ring_id++) {
+ bad_access_helper(device_handle, cmd_error, ip_type, ring_id);
+ }
+}
+
#define MAX_DMABUF_COUNT 0x20000
#define MAX_DWORD_COUNT 256
-void
-amdgpu_hang_sdma_helper(amdgpu_device_handle device_handle, uint8_t hang_type)
+static void
+amdgpu_hang_sdma_helper(amdgpu_device_handle device_handle, uint8_t hang_type, unsigned int ring_id)
{
int j, r;
uint32_t *ptr, offset;
@@ -240,6 +256,7 @@ amdgpu_hang_sdma_helper(amdgpu_device_handle device_handle, uint8_t hang_type)
}
ring_context->secure = false;
ring_context->res_cnt = 2;
+ ring_context->ring_id = ring_id;
igt_assert(ring_context->pm4);
r = amdgpu_cs_ctx_create(device_handle, &ring_context->context_handle);
@@ -309,3 +326,21 @@ amdgpu_hang_sdma_helper(amdgpu_device_handle device_handle, uint8_t hang_type)
igt_assert_eq(r, 0);
free_cmd_base(base_cmd);
}
+
+void amdgpu_hang_sdma_ring_helper(amdgpu_device_handle device_handle, uint8_t hang_type)
+{
+ int r;
+ struct drm_amdgpu_info_hw_ip info;
+ uint32_t ring_id;
+
+ r = amdgpu_query_hw_ip_info(device_handle, AMDGPU_HW_IP_DMA, 0, &info);
+ igt_assert_eq(r, 0);
+ if (!info.available_rings)
+ igt_info("SKIP ... as there's no ring for the sdma\n");
+
+ for (ring_id = 0; (1 << ring_id) & info.available_rings; ring_id++) {
+ printf("%s[%d] ring_id:%d ######## \n",__func__,__LINE__,ring_id);
+ amdgpu_hang_sdma_helper(device_handle, hang_type, ring_id);
+ }
+}
+
diff --git a/lib/amdgpu/amd_deadlock_helpers.h b/lib/amdgpu/amd_deadlock_helpers.h
index 165ffb98d..7f8419280 100644
--- a/lib/amdgpu/amd_deadlock_helpers.h
+++ b/lib/amdgpu/amd_deadlock_helpers.h
@@ -26,11 +26,10 @@
void
amdgpu_wait_memory_helper(amdgpu_device_handle device_handle, unsigned int ip_type);
-
void
-bad_access_helper(amdgpu_device_handle device_handle, unsigned int cmd_error, unsigned int ip_type);
+bad_access_ring_helper(amdgpu_device_handle device_handle, unsigned int cmd_error, unsigned int ip_type);
void
-amdgpu_hang_sdma_helper(amdgpu_device_handle device_handle, uint8_t hang_type);
+amdgpu_hang_sdma_ring_helper(amdgpu_device_handle device_handle, uint8_t hang_type);
#endif
diff --git a/tests/amdgpu/amd_deadlock.c b/tests/amdgpu/amd_deadlock.c
index 696fac2eb..b5d053663 100644
--- a/tests/amdgpu/amd_deadlock.c
+++ b/tests/amdgpu/amd_deadlock.c
@@ -73,7 +73,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-gfx-illegal-reg-access") {
if (arr_cap[AMD_IP_GFX]) {
igt_dynamic_f("amdgpu-illegal-reg-access")
- bad_access_helper(device, CMD_STREAM_TRANS_BAD_REG_ADDRESS,
+ bad_access_ring_helper(device, CMD_STREAM_TRANS_BAD_REG_ADDRESS,
AMDGPU_HW_IP_GFX);
}
}
@@ -82,7 +82,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-gfx-illegal-mem-access") {
if (arr_cap[AMD_IP_GFX]) {
igt_dynamic_f("amdgpu-illegal-mem-access")
- bad_access_helper(device, CMD_STREAM_TRANS_BAD_MEM_ADDRESS,
+ bad_access_ring_helper(device, CMD_STREAM_TRANS_BAD_MEM_ADDRESS,
AMDGPU_HW_IP_GFX);
}
}
@@ -99,7 +99,7 @@ igt_main
igt_describe("Test-GPU-reset-by-access-compute-illegal-mem-addr");
igt_subtest("amdgpu-compute-illegal-mem-access") {
igt_skip_on_f(!arr_cap[AMD_IP_COMPUTE], "SKIP, compute ring don't support\n");
- bad_access_helper(device, CMD_STREAM_TRANS_BAD_MEM_ADDRESS,
+ bad_access_ring_helper(device, CMD_STREAM_TRANS_BAD_MEM_ADDRESS,
AMDGPU_HW_IP_COMPUTE);
}
@@ -115,7 +115,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-deadlock-sdma-corrupted-header-test") {
if (arr_cap[AMD_IP_DMA]) {
igt_dynamic_f("amdgpu-deadlock-sdma-corrupted-header-test")
- amdgpu_hang_sdma_helper(device, DMA_CORRUPTED_HEADER_HANG);
+ amdgpu_hang_sdma_ring_helper(device, DMA_CORRUPTED_HEADER_HANG);
}
}
@@ -123,7 +123,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-deadlock-sdma-slow-linear-copy") {
if (arr_cap[AMD_IP_DMA]) {
igt_dynamic_f("amdgpu-deadlock-sdma-slow-linear-copy")
- amdgpu_hang_sdma_helper(device, DMA_SLOW_LINEARCOPY_HANG);
+ amdgpu_hang_sdma_ring_helper(device, DMA_SLOW_LINEARCOPY_HANG);
}
}
@@ -131,7 +131,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-deadlock-sdma-badop-test") {
if (arr_cap[AMD_IP_DMA]) {
igt_dynamic_f("amdgpu-deadlock-sdma-badop-test")
- bad_access_helper(device, CMD_STREAM_EXEC_INVALID_OPCODE,
+ bad_access_ring_helper(device, CMD_STREAM_EXEC_INVALID_OPCODE,
AMDGPU_HW_IP_DMA);
}
}
@@ -140,7 +140,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-deadlock-sdma-bad-mem-test") {
if (arr_cap[AMD_IP_DMA]) {
igt_dynamic_f("amdgpu-deadlock-sdma-bad-mem-test")
- bad_access_helper(device, CMD_STREAM_TRANS_BAD_MEM_ADDRESS,
+ bad_access_ring_helper(device, CMD_STREAM_TRANS_BAD_MEM_ADDRESS,
AMDGPU_HW_IP_DMA);
}
}
@@ -149,7 +149,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-deadlock-sdma-bad-reg-test") {
if (arr_cap[AMD_IP_DMA]) {
igt_dynamic_f("amdgpu-deadlock-sdma-bad-reg-test")
- bad_access_helper(device, CMD_STREAM_TRANS_BAD_REG_ADDRESS,
+ bad_access_ring_helper(device, CMD_STREAM_TRANS_BAD_REG_ADDRESS,
AMDGPU_HW_IP_DMA);
}
}
@@ -158,7 +158,7 @@ igt_main
igt_subtest_with_dynamic("amdgpu-deadlock-sdma-bad-length-test") {
if (arr_cap[AMD_IP_DMA]) {
igt_dynamic_f("amdgpu-deadlock-sdma-bad-length-test")
- bad_access_helper(device, CMD_STREAM_EXEC_INVALID_PACKET_LENGTH,
+ bad_access_ring_helper(device, CMD_STREAM_EXEC_INVALID_PACKET_LENGTH,
AMDGPU_HW_IP_DMA);
}
}
--
2.25.1
next reply other threads:[~2024-09-27 9:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 9:09 Jesse.zhang@amd.com [this message]
2024-09-27 14:48 ` ✓ Fi.CI.BAT: success for lib/amdgpu: enhance sdma test Patchwork
2024-09-27 15:08 ` ✓ CI.xeBAT: " Patchwork
2024-09-28 9:41 ` ✗ CI.xeFULL: failure " Patchwork
2024-09-28 18:29 ` ✗ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240927090951.3761844-1-jesse.zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=vitaly.prosyak@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox