Commit 7e5e7971 authored by Jack Xiao's avatar Jack Xiao Committed by Alex Deucher

drm/amdgpu/sdma5.2: add mes support for sdma ring test

Add MES support for sdma ring test.
Signed-off-by: default avatarJack Xiao <Jack.Xiao@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 254492b6
...@@ -965,7 +965,18 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring) ...@@ -965,7 +965,18 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
int r; int r;
u32 tmp; u32 tmp;
u64 gpu_addr; u64 gpu_addr;
volatile uint32_t *cpu_ptr = NULL;
tmp = 0xCAFEDEAD;
if (ring->is_mes_queue) {
uint32_t offset = 0;
offset = amdgpu_mes_ctx_get_offs(ring,
AMDGPU_MES_CTX_PADDING_OFFS);
gpu_addr = amdgpu_mes_ctx_get_offs_gpu_addr(ring, offset);
cpu_ptr = amdgpu_mes_ctx_get_offs_cpu_addr(ring, offset);
*cpu_ptr = tmp;
} else {
r = amdgpu_device_wb_get(adev, &index); r = amdgpu_device_wb_get(adev, &index);
if (r) { if (r) {
dev_err(adev->dev, "(%d) failed to allocate wb slot\n", r); dev_err(adev->dev, "(%d) failed to allocate wb slot\n", r);
...@@ -973,10 +984,10 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring) ...@@ -973,10 +984,10 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
} }
gpu_addr = adev->wb.gpu_addr + (index * 4); gpu_addr = adev->wb.gpu_addr + (index * 4);
tmp = 0xCAFEDEAD;
adev->wb.wb[index] = cpu_to_le32(tmp); adev->wb.wb[index] = cpu_to_le32(tmp);
}
r = amdgpu_ring_alloc(ring, 5); r = amdgpu_ring_alloc(ring, 20);
if (r) { if (r) {
DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r); DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
amdgpu_device_wb_free(adev, index); amdgpu_device_wb_free(adev, index);
...@@ -992,6 +1003,9 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring) ...@@ -992,6 +1003,9 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
amdgpu_ring_commit(ring); amdgpu_ring_commit(ring);
for (i = 0; i < adev->usec_timeout; i++) { for (i = 0; i < adev->usec_timeout; i++) {
if (ring->is_mes_queue)
tmp = le32_to_cpu(*cpu_ptr);
else
tmp = le32_to_cpu(adev->wb.wb[index]); tmp = le32_to_cpu(adev->wb.wb[index]);
if (tmp == 0xDEADBEEF) if (tmp == 0xDEADBEEF)
break; break;
...@@ -1004,6 +1018,7 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring) ...@@ -1004,6 +1018,7 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
if (i >= adev->usec_timeout) if (i >= adev->usec_timeout)
r = -ETIMEDOUT; r = -ETIMEDOUT;
if (!ring->is_mes_queue)
amdgpu_device_wb_free(adev, index); amdgpu_device_wb_free(adev, index);
return r; return r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment