Typo, series is Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx> Andrey On 10/29/2018 12:18 PM, Grodzovsky, Andrey wrote: > Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx> > > Andrey > > > On 10/29/2018 11:28 AM, Christian König wrote: >> We already print an error message that an IB test failed in the common >> code. >> >> Signed-off-by: Christian König <christian.koenig@xxxxxxx> >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 18 +++-------- >> drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 18 +++-------- >> drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 54 +++++++++------------------------ >> drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 17 +++-------- >> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 20 ++++-------- >> drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 20 ++++-------- >> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 18 +++-------- >> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 28 ++++++----------- >> drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 17 +++-------- >> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 17 +++-------- >> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 18 +++-------- >> drivers/gpu/drm/amd/amdgpu/si_dma.c | 10 ++---- >> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 19 ++++-------- >> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 18 +++-------- >> 14 files changed, 80 insertions(+), 212 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c >> index e5a6db6beab7..69896f451e8a 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c >> @@ -1243,30 +1243,20 @@ int amdgpu_uvd_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> { >> struct dma_fence *fence; >> long r; >> - uint32_t ip_instance = ring->me; >> >> r = amdgpu_uvd_get_create_msg(ring, 1, NULL); >> - if (r) { >> - DRM_ERROR("amdgpu: (%d)failed to get create msg (%ld).\n", ip_instance, r); >> + if (r) >> goto error; >> - } >> >> r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); >> - if (r) { >> - DRM_ERROR("amdgpu: (%d)failed to get destroy ib (%ld).\n", ip_instance, r); >> + if (r) >> goto error; >> - } >> >> r = dma_fence_wait_timeout(fence, false, timeout); >> - if (r == 0) { >> - DRM_ERROR("amdgpu: (%d)IB test timed out.\n", ip_instance); >> + if (r == 0) >> r = -ETIMEDOUT; >> - } else if (r < 0) { >> - DRM_ERROR("amdgpu: (%d)fence wait failed (%ld).\n", ip_instance, r); >> - } else { >> - DRM_DEBUG("ib test on (%d)ring %d succeeded\n", ip_instance, ring->idx); >> + else if (r > 0) >> r = 0; >> - } >> >> dma_fence_put(fence); >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c >> index 7b999ee3defb..379e1ae7a8fb 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c >> @@ -1113,27 +1113,19 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> return 0; >> >> r = amdgpu_vce_get_create_msg(ring, 1, NULL); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = amdgpu_vce_get_destroy_msg(ring, 1, true, &fence); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = dma_fence_wait_timeout(fence, false, timeout); >> - if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out.\n"); >> + if (r == 0) >> r = -ETIMEDOUT; >> - } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> - } else { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + else if (r > 0) >> r = 0; >> - } >> + >> error: >> dma_fence_put(fence); >> return r; >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c >> index 4b7f52e68457..e2e42e3fbcf3 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c >> @@ -563,30 +563,20 @@ int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = amdgpu_vcn_dec_get_destroy_msg(ring, 1, &fence); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = dma_fence_wait_timeout(fence, false, timeout); >> - if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out.\n"); >> + if (r == 0) >> r = -ETIMEDOUT; >> - } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> - } else { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + else if (r > 0) >> r = 0; >> - } >> >> dma_fence_put(fence); >> - >> error: >> return r; >> } >> @@ -727,27 +717,19 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_vcn_enc_get_create_msg(ring, 1, NULL); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = amdgpu_vcn_enc_get_destroy_msg(ring, 1, &fence); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = dma_fence_wait_timeout(fence, false, timeout); >> - if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out.\n"); >> + if (r == 0) >> r = -ETIMEDOUT; >> - } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> - } else { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + else if (r > 0) >> r = 0; >> - } >> + >> error: >> dma_fence_put(fence); >> return r; >> @@ -832,21 +814,18 @@ int amdgpu_vcn_jpeg_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r = 0; >> >> r = amdgpu_vcn_jpeg_set_reg(ring, 1, &fence); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to set jpeg register (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = dma_fence_wait_timeout(fence, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out.\n"); >> r = -ETIMEDOUT; >> goto error; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto error; >> - } else >> + } else { >> r = 0; >> + } >> >> for (i = 0; i < adev->usec_timeout; i++) { >> tmp = RREG32(SOC15_REG_OFFSET(UVD, 0, mmUVD_SCRATCH9)); >> @@ -855,15 +834,10 @@ int amdgpu_vcn_jpeg_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> DRM_UDELAY(1); >> } >> >> - if (i < adev->usec_timeout) >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> - else { >> - DRM_ERROR("ib test failed (0x%08X)\n", tmp); >> - r = -EINVAL; >> - } >> + if (i >= adev->usec_timeout) >> + r = -ETIMEDOUT; >> >> dma_fence_put(fence); >> - >> error: >> return r; >> } >> diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c >> index 5eb15bf9ec7c..49275f358f7a 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c >> +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c >> @@ -668,20 +668,16 @@ static int cik_sdma_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_device_wb_get(adev, &index); >> - if (r) { >> - dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r); >> + if (r) >> return r; >> - } >> >> gpu_addr = adev->wb.gpu_addr + (index * 4); >> tmp = 0xCAFEDEAD; >> adev->wb.wb[index] = cpu_to_le32(tmp); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 256, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err0; >> - } >> >> ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, >> SDMA_WRITE_SUB_OPCODE_LINEAR, 0); >> @@ -696,21 +692,16 @@ static int cik_sdma_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out\n"); >> r = -ETIMEDOUT; >> goto err1; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err1; >> } >> tmp = le32_to_cpu(adev->wb.wb[index]); >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + if (tmp == 0xDEADBEEF) >> r = 0; >> - } else { >> - DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp); >> + else >> r = -EINVAL; >> - } >> >> err1: >> amdgpu_ib_free(adev, &ib, NULL); >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c >> index 0f36bb08fe1c..25cf905965fb 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c >> @@ -1887,17 +1887,15 @@ static int gfx_v6_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_gfx_scratch_get(adev, &scratch); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get scratch reg (%ld).\n", r); >> + if (r) >> return r; >> - } >> + >> WREG32(scratch, 0xCAFEDEAD); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 256, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err1; >> - } >> + >> ib.ptr[0] = PACKET3(PACKET3_SET_CONFIG_REG, 1); >> ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_START)); >> ib.ptr[2] = 0xDEADBEEF; >> @@ -1909,22 +1907,16 @@ static int gfx_v6_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out\n"); >> r = -ETIMEDOUT; >> goto err2; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err2; >> } >> tmp = RREG32(scratch); >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + if (tmp == 0xDEADBEEF) >> r = 0; >> - } else { >> - DRM_ERROR("amdgpu: ib test failed (scratch(0x%04X)=0x%08X)\n", >> - scratch, tmp); >> + else >> r = -EINVAL; >> - } >> >> err2: >> amdgpu_ib_free(adev, &ib, NULL); >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c >> index 742ec4425ca1..ff8d316d0533 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c >> @@ -2310,17 +2310,15 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_gfx_scratch_get(adev, &scratch); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get scratch reg (%ld).\n", r); >> + if (r) >> return r; >> - } >> + >> WREG32(scratch, 0xCAFEDEAD); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 256, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err1; >> - } >> + >> ib.ptr[0] = PACKET3(PACKET3_SET_UCONFIG_REG, 1); >> ib.ptr[1] = ((scratch - PACKET3_SET_UCONFIG_REG_START)); >> ib.ptr[2] = 0xDEADBEEF; >> @@ -2332,22 +2330,16 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out\n"); >> r = -ETIMEDOUT; >> goto err2; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err2; >> } >> tmp = RREG32(scratch); >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + if (tmp == 0xDEADBEEF) >> r = 0; >> - } else { >> - DRM_ERROR("amdgpu: ib test failed (scratch(0x%04X)=0x%08X)\n", >> - scratch, tmp); >> + else >> r = -EINVAL; >> - } >> >> err2: >> amdgpu_ib_free(adev, &ib, NULL); >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c >> index 677bdc1abf96..1da6c660d50a 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c >> @@ -879,19 +879,16 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_device_wb_get(adev, &index); >> - if (r) { >> - dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r); >> + if (r) >> return r; >> - } >> >> gpu_addr = adev->wb.gpu_addr + (index * 4); >> adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 16, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err1; >> - } >> + >> ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3); >> ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM; >> ib.ptr[2] = lower_32_bits(gpu_addr); >> @@ -905,22 +902,17 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out.\n"); >> r = -ETIMEDOUT; >> goto err2; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err2; >> } >> >> tmp = adev->wb.wb[index]; >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + if (tmp == 0xDEADBEEF) >> r = 0; >> - } else { >> - DRM_ERROR("ib test on ring %d failed\n", ring->idx); >> + else >> r = -EINVAL; >> - } >> >> err2: >> amdgpu_ib_free(adev, &ib, NULL); >> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c >> index 67c011d7f1a6..fcb370cfa1e7 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c >> @@ -436,19 +436,16 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_device_wb_get(adev, &index); >> - if (r) { >> - dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r); >> + if (r) >> return r; >> - } >> >> gpu_addr = adev->wb.gpu_addr + (index * 4); >> adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 16, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err1; >> - } >> + >> ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3); >> ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM; >> ib.ptr[2] = lower_32_bits(gpu_addr); >> @@ -462,22 +459,17 @@ static int gfx_v9_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out.\n"); >> - r = -ETIMEDOUT; >> - goto err2; >> + r = -ETIMEDOUT; >> + goto err2; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> - goto err2; >> + goto err2; >> } >> >> tmp = adev->wb.wb[index]; >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> - r = 0; >> - } else { >> - DRM_ERROR("ib test on ring %d failed\n", ring->idx); >> - r = -EINVAL; >> - } >> + if (tmp == 0xDEADBEEF) >> + r = 0; >> + else >> + r = -EINVAL; >> >> err2: >> amdgpu_ib_free(adev, &ib, NULL); >> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c >> index 4fded77e4ae0..c4ab54a59fc9 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c >> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c >> @@ -601,20 +601,16 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_device_wb_get(adev, &index); >> - if (r) { >> - dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r); >> + if (r) >> return r; >> - } >> >> gpu_addr = adev->wb.gpu_addr + (index * 4); >> tmp = 0xCAFEDEAD; >> adev->wb.wb[index] = cpu_to_le32(tmp); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 256, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err0; >> - } >> >> ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) | >> SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_WRITE_LINEAR); >> @@ -633,21 +629,16 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out\n"); >> r = -ETIMEDOUT; >> goto err1; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err1; >> } >> tmp = le32_to_cpu(adev->wb.wb[index]); >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + if (tmp == 0xDEADBEEF) >> r = 0; >> - } else { >> - DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp); >> + else >> r = -EINVAL; >> - } >> >> err1: >> amdgpu_ib_free(adev, &ib, NULL); >> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c >> index 5d59b7196da9..e3adddbcb593 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c >> @@ -873,20 +873,16 @@ static int sdma_v3_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_device_wb_get(adev, &index); >> - if (r) { >> - dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r); >> + if (r) >> return r; >> - } >> >> gpu_addr = adev->wb.gpu_addr + (index * 4); >> tmp = 0xCAFEDEAD; >> adev->wb.wb[index] = cpu_to_le32(tmp); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 256, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err0; >> - } >> >> ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) | >> SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_WRITE_LINEAR); >> @@ -905,21 +901,16 @@ static int sdma_v3_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out\n"); >> r = -ETIMEDOUT; >> goto err1; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err1; >> } >> tmp = le32_to_cpu(adev->wb.wb[index]); >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + if (tmp == 0xDEADBEEF) >> r = 0; >> - } else { >> - DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp); >> + else >> r = -EINVAL; >> - } >> err1: >> amdgpu_ib_free(adev, &ib, NULL); >> dma_fence_put(f); >> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c >> index 01df6cf910b8..2b944db86950 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c >> @@ -1235,20 +1235,16 @@ static int sdma_v4_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> u64 gpu_addr; >> >> r = amdgpu_device_wb_get(adev, &index); >> - if (r) { >> - dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r); >> + if (r) >> return r; >> - } >> >> gpu_addr = adev->wb.gpu_addr + (index * 4); >> tmp = 0xCAFEDEAD; >> adev->wb.wb[index] = cpu_to_le32(tmp); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 256, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err0; >> - } >> >> ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) | >> SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_WRITE_LINEAR); >> @@ -1267,21 +1263,17 @@ static int sdma_v4_0_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out\n"); >> r = -ETIMEDOUT; >> goto err1; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err1; >> } >> tmp = le32_to_cpu(adev->wb.wb[index]); >> - if (tmp == 0xDEADBEEF) { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + if (tmp == 0xDEADBEEF) >> r = 0; >> - } else { >> - DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp); >> + else >> r = -EINVAL; >> - } >> + >> err1: >> amdgpu_ib_free(adev, &ib, NULL); >> dma_fence_put(f); >> diff --git a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c >> index f051e3d1e988..68718ddf6ed0 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/si_dma.c >> +++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c >> @@ -258,20 +258,16 @@ static int si_dma_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = amdgpu_device_wb_get(adev, &index); >> - if (r) { >> - dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r); >> + if (r) >> return r; >> - } >> >> gpu_addr = adev->wb.gpu_addr + (index * 4); >> tmp = 0xCAFEDEAD; >> adev->wb.wb[index] = cpu_to_le32(tmp); >> memset(&ib, 0, sizeof(ib)); >> r = amdgpu_ib_get(adev, NULL, 256, &ib); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); >> + if (r) >> goto err0; >> - } >> >> ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 0, 1); >> ib.ptr[1] = lower_32_bits(gpu_addr); >> @@ -284,11 +280,9 @@ static int si_dma_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> >> r = dma_fence_wait_timeout(f, false, timeout); >> if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out\n"); >> r = -ETIMEDOUT; >> goto err1; >> } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> goto err1; >> } >> tmp = le32_to_cpu(adev->wb.wb[index]); >> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c >> index c8edd535eae5..234bc91e91a8 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c >> @@ -327,31 +327,24 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = uvd_v6_0_enc_get_create_msg(ring, 1, NULL); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = uvd_v6_0_enc_get_destroy_msg(ring, 1, &fence); >> - if (r) { >> - DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r); >> + if (r) >> goto error; >> - } >> >> r = dma_fence_wait_timeout(fence, false, timeout); >> - if (r == 0) { >> - DRM_ERROR("amdgpu: IB test timed out.\n"); >> + if (r == 0) >> r = -ETIMEDOUT; >> - } else if (r < 0) { >> - DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); >> - } else { >> - DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); >> + else if (r > 0) >> r = 0; >> - } >> + >> error: >> dma_fence_put(fence); >> return r; >> } >> + >> static int uvd_v6_0_early_init(void *handle) >> { >> struct amdgpu_device *adev = (struct amdgpu_device *)handle; >> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c >> index 87fd003ff037..3985530a882f 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c >> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c >> @@ -334,27 +334,19 @@ static int uvd_v7_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) >> long r; >> >> r = uvd_v7_0_enc_get_create_msg(ring, 1, NULL); >> - if (r) { >> - DRM_ERROR("amdgpu: (%d)failed to get create msg (%ld).\n", ring->me, r); >> + if (r) >> goto error; >> - } >> >> r = uvd_v7_0_enc_get_destroy_msg(ring, 1, &fence); >> - if (r) { >> - DRM_ERROR("amdgpu: (%d)failed to get destroy ib (%ld).\n", ring->me, r); >> + if (r) >> goto error; >> - } >> >> r = dma_fence_wait_timeout(fence, false, timeout); >> - if (r == 0) { >> - DRM_ERROR("amdgpu: (%d)IB test timed out.\n", ring->me); >> + if (r == 0) >> r = -ETIMEDOUT; >> - } else if (r < 0) { >> - DRM_ERROR("amdgpu: (%d)fence wait failed (%ld).\n", ring->me, r); >> - } else { >> - DRM_DEBUG("ib test on (%d)ring %d succeeded\n", ring->me, ring->idx); >> + else if (r > 0) >> r = 0; >> - } >> + >> error: >> dma_fence_put(fence); >> return r; > _______________________________________________ > amd-gfx mailing list > amd-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/amd-gfx _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx