tests/amdgpu: execute copy linear on all the available rings

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
main
Hawking Zhang 2018-01-08 11:20:30 +08:00 committed by Alex Deucher
parent cbbb8a332d
commit f115de819b
1 changed files with 99 additions and 91 deletions

View File

@ -1114,9 +1114,10 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type)
struct amdgpu_cs_request *ibs_request; struct amdgpu_cs_request *ibs_request;
uint64_t bo1_mc, bo2_mc; uint64_t bo1_mc, bo2_mc;
volatile unsigned char *bo1_cpu, *bo2_cpu; volatile unsigned char *bo1_cpu, *bo2_cpu;
int i, j, r, loop1, loop2; int i, j, r, loop1, loop2, ring_id;
uint64_t gtt_flags[2] = {0, AMDGPU_GEM_CREATE_CPU_GTT_USWC}; uint64_t gtt_flags[2] = {0, AMDGPU_GEM_CREATE_CPU_GTT_USWC};
amdgpu_va_handle bo1_va_handle, bo2_va_handle; amdgpu_va_handle bo1_va_handle, bo2_va_handle;
struct drm_amdgpu_info_hw_ip hw_ip_info;
pm4 = calloc(pm4_dw, sizeof(*pm4)); pm4 = calloc(pm4_dw, sizeof(*pm4));
CU_ASSERT_NOT_EQUAL(pm4, NULL); CU_ASSERT_NOT_EQUAL(pm4, NULL);
@ -1127,6 +1128,9 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type)
ibs_request = calloc(1, sizeof(*ibs_request)); ibs_request = calloc(1, sizeof(*ibs_request));
CU_ASSERT_NOT_EQUAL(ibs_request, NULL); CU_ASSERT_NOT_EQUAL(ibs_request, NULL);
r = amdgpu_query_hw_ip_info(device_handle, ip_type, 0, &hw_ip_info);
CU_ASSERT_EQUAL(r, 0);
r = amdgpu_cs_ctx_create(device_handle, &context_handle); r = amdgpu_cs_ctx_create(device_handle, &context_handle);
CU_ASSERT_EQUAL(r, 0); CU_ASSERT_EQUAL(r, 0);
@ -1134,6 +1138,7 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type)
resources = calloc(2, sizeof(amdgpu_bo_handle)); resources = calloc(2, sizeof(amdgpu_bo_handle));
CU_ASSERT_NOT_EQUAL(resources, NULL); CU_ASSERT_NOT_EQUAL(resources, NULL);
for (ring_id = 0; (1 << ring_id) & hw_ip_info.available_rings; ring_id++) {
loop1 = loop2 = 0; loop1 = loop2 = 0;
/* run 9 circle to test all mapping combination */ /* run 9 circle to test all mapping combination */
while(loop1 < 2) { while(loop1 < 2) {
@ -1169,14 +1174,17 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type)
i = j = 0; i = j = 0;
if (ip_type == AMDGPU_HW_IP_DMA) { if (ip_type == AMDGPU_HW_IP_DMA) {
if (family_id == AMDGPU_FAMILY_SI) { if (family_id == AMDGPU_FAMILY_SI) {
pm4[i++] = SDMA_PACKET_SI(SDMA_OPCODE_COPY_SI, 0, 0, 0, pm4[i++] = SDMA_PACKET_SI(SDMA_OPCODE_COPY_SI,
0, 0, 0,
sdma_write_length); sdma_write_length);
pm4[i++] = 0xffffffff & bo2_mc; pm4[i++] = 0xffffffff & bo2_mc;
pm4[i++] = 0xffffffff & bo1_mc; pm4[i++] = 0xffffffff & bo1_mc;
pm4[i++] = (0xffffffff00000000 & bo2_mc) >> 32; pm4[i++] = (0xffffffff00000000 & bo2_mc) >> 32;
pm4[i++] = (0xffffffff00000000 & bo1_mc) >> 32; pm4[i++] = (0xffffffff00000000 & bo1_mc) >> 32;
} else { } else {
pm4[i++] = SDMA_PACKET(SDMA_OPCODE_COPY, SDMA_COPY_SUB_OPCODE_LINEAR, 0); pm4[i++] = SDMA_PACKET(SDMA_OPCODE_COPY,
SDMA_COPY_SUB_OPCODE_LINEAR,
0);
if (family_id >= AMDGPU_FAMILY_AI) if (family_id >= AMDGPU_FAMILY_AI)
pm4[i++] = sdma_write_length - 1; pm4[i++] = sdma_write_length - 1;
else else
@ -1187,7 +1195,6 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type)
pm4[i++] = 0xffffffff & bo2_mc; pm4[i++] = 0xffffffff & bo2_mc;
pm4[i++] = (0xffffffff00000000 & bo2_mc) >> 32; pm4[i++] = (0xffffffff00000000 & bo2_mc) >> 32;
} }
} else if ((ip_type == AMDGPU_HW_IP_GFX) || } else if ((ip_type == AMDGPU_HW_IP_GFX) ||
(ip_type == AMDGPU_HW_IP_COMPUTE)) { (ip_type == AMDGPU_HW_IP_COMPUTE)) {
if (family_id == AMDGPU_FAMILY_SI) { if (family_id == AMDGPU_FAMILY_SI) {
@ -1216,7 +1223,7 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type)
} }
amdgpu_test_exec_cs_helper(context_handle, amdgpu_test_exec_cs_helper(context_handle,
ip_type, 0, ip_type, ring_id,
i, pm4, i, pm4,
2, resources, 2, resources,
ib_info, ibs_request); ib_info, ibs_request);
@ -1236,6 +1243,7 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type)
} }
loop1++; loop1++;
} }
}
/* clean resources */ /* clean resources */
free(resources); free(resources);
free(ibs_request); free(ibs_request);