aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2018-10-29 11:12:42 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-11-05 14:21:27 -0500
commit98079389a873f45ba75bbb20dcf14db0ec694a9a (patch)
tree902b6ca7657d9262bbe614f1fd2007891d8d1a5f /drivers
parent315fed0367b4b4197cdc9585d09a1e659ae6c716 (diff)
drm/amdgpu: remove messages from IB tests
We already print an error message that an IB test failed in the common code. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c18
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c18
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c54
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cik_sdma.c17
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c20
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c20
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c18
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c28
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c17
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c17
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c18
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_dma.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c19
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c18
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)
1243{ 1243{
1244 struct dma_fence *fence; 1244 struct dma_fence *fence;
1245 long r; 1245 long r;
1246 uint32_t ip_instance = ring->me;
1247 1246
1248 r = amdgpu_uvd_get_create_msg(ring, 1, NULL); 1247 r = amdgpu_uvd_get_create_msg(ring, 1, NULL);
1249 if (r) { 1248 if (r)
1250 DRM_ERROR("amdgpu: (%d)failed to get create msg (%ld).\n", ip_instance, r);
1251 goto error; 1249 goto error;
1252 }
1253 1250
1254 r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence); 1251 r = amdgpu_uvd_get_destroy_msg(ring, 1, true, &fence);
1255 if (r) { 1252 if (r)
1256 DRM_ERROR("amdgpu: (%d)failed to get destroy ib (%ld).\n", ip_instance, r);
1257 goto error; 1253 goto error;
1258 }
1259 1254
1260 r = dma_fence_wait_timeout(fence, false, timeout); 1255 r = dma_fence_wait_timeout(fence, false, timeout);
1261 if (r == 0) { 1256 if (r == 0)
1262 DRM_ERROR("amdgpu: (%d)IB test timed out.\n", ip_instance);
1263 r = -ETIMEDOUT; 1257 r = -ETIMEDOUT;
1264 } else if (r < 0) { 1258 else if (r > 0)
1265 DRM_ERROR("amdgpu: (%d)fence wait failed (%ld).\n", ip_instance, r);
1266 } else {
1267 DRM_DEBUG("ib test on (%d)ring %d succeeded\n", ip_instance, ring->idx);
1268 r = 0; 1259 r = 0;
1269 }
1270 1260
1271 dma_fence_put(fence); 1261 dma_fence_put(fence);
1272 1262
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)
1113 return 0; 1113 return 0;
1114 1114
1115 r = amdgpu_vce_get_create_msg(ring, 1, NULL); 1115 r = amdgpu_vce_get_create_msg(ring, 1, NULL);
1116 if (r) { 1116 if (r)
1117 DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r);
1118 goto error; 1117 goto error;
1119 }
1120 1118
1121 r = amdgpu_vce_get_destroy_msg(ring, 1, true, &fence); 1119 r = amdgpu_vce_get_destroy_msg(ring, 1, true, &fence);
1122 if (r) { 1120 if (r)
1123 DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r);
1124 goto error; 1121 goto error;
1125 }
1126 1122
1127 r = dma_fence_wait_timeout(fence, false, timeout); 1123 r = dma_fence_wait_timeout(fence, false, timeout);
1128 if (r == 0) { 1124 if (r == 0)
1129 DRM_ERROR("amdgpu: IB test timed out.\n");
1130 r = -ETIMEDOUT; 1125 r = -ETIMEDOUT;
1131 } else if (r < 0) { 1126 else if (r > 0)
1132 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
1133 } else {
1134 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
1135 r = 0; 1127 r = 0;
1136 } 1128
1137error: 1129error:
1138 dma_fence_put(fence); 1130 dma_fence_put(fence);
1139 return r; 1131 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)
563 long r; 563 long r;
564 564
565 r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL); 565 r = amdgpu_vcn_dec_get_create_msg(ring, 1, NULL);
566 if (r) { 566 if (r)
567 DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r);
568 goto error; 567 goto error;
569 }
570 568
571 r = amdgpu_vcn_dec_get_destroy_msg(ring, 1, &fence); 569 r = amdgpu_vcn_dec_get_destroy_msg(ring, 1, &fence);
572 if (r) { 570 if (r)
573 DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r);
574 goto error; 571 goto error;
575 }
576 572
577 r = dma_fence_wait_timeout(fence, false, timeout); 573 r = dma_fence_wait_timeout(fence, false, timeout);
578 if (r == 0) { 574 if (r == 0)
579 DRM_ERROR("amdgpu: IB test timed out.\n");
580 r = -ETIMEDOUT; 575 r = -ETIMEDOUT;
581 } else if (r < 0) { 576 else if (r > 0)
582 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
583 } else {
584 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
585 r = 0; 577 r = 0;
586 }
587 578
588 dma_fence_put(fence); 579 dma_fence_put(fence);
589
590error: 580error:
591 return r; 581 return r;
592} 582}
@@ -727,27 +717,19 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
727 long r; 717 long r;
728 718
729 r = amdgpu_vcn_enc_get_create_msg(ring, 1, NULL); 719 r = amdgpu_vcn_enc_get_create_msg(ring, 1, NULL);
730 if (r) { 720 if (r)
731 DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r);
732 goto error; 721 goto error;
733 }
734 722
735 r = amdgpu_vcn_enc_get_destroy_msg(ring, 1, &fence); 723 r = amdgpu_vcn_enc_get_destroy_msg(ring, 1, &fence);
736 if (r) { 724 if (r)
737 DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r);
738 goto error; 725 goto error;
739 }
740 726
741 r = dma_fence_wait_timeout(fence, false, timeout); 727 r = dma_fence_wait_timeout(fence, false, timeout);
742 if (r == 0) { 728 if (r == 0)
743 DRM_ERROR("amdgpu: IB test timed out.\n");
744 r = -ETIMEDOUT; 729 r = -ETIMEDOUT;
745 } else if (r < 0) { 730 else if (r > 0)
746 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
747 } else {
748 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
749 r = 0; 731 r = 0;
750 } 732
751error: 733error:
752 dma_fence_put(fence); 734 dma_fence_put(fence);
753 return r; 735 return r;
@@ -832,21 +814,18 @@ int amdgpu_vcn_jpeg_ring_test_ib(struct amdgpu_ring *ring, long timeout)
832 long r = 0; 814 long r = 0;
833 815
834 r = amdgpu_vcn_jpeg_set_reg(ring, 1, &fence); 816 r = amdgpu_vcn_jpeg_set_reg(ring, 1, &fence);
835 if (r) { 817 if (r)
836 DRM_ERROR("amdgpu: failed to set jpeg register (%ld).\n", r);
837 goto error; 818 goto error;
838 }
839 819
840 r = dma_fence_wait_timeout(fence, false, timeout); 820 r = dma_fence_wait_timeout(fence, false, timeout);
841 if (r == 0) { 821 if (r == 0) {
842 DRM_ERROR("amdgpu: IB test timed out.\n");
843 r = -ETIMEDOUT; 822 r = -ETIMEDOUT;
844 goto error; 823 goto error;
845 } else if (r < 0) { 824 } else if (r < 0) {
846 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
847 goto error; 825 goto error;
848 } else 826 } else {
849 r = 0; 827 r = 0;
828 }
850 829
851 for (i = 0; i < adev->usec_timeout; i++) { 830 for (i = 0; i < adev->usec_timeout; i++) {
852 tmp = RREG32(SOC15_REG_OFFSET(UVD, 0, mmUVD_SCRATCH9)); 831 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)
855 DRM_UDELAY(1); 834 DRM_UDELAY(1);
856 } 835 }
857 836
858 if (i < adev->usec_timeout) 837 if (i >= adev->usec_timeout)
859 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); 838 r = -ETIMEDOUT;
860 else {
861 DRM_ERROR("ib test failed (0x%08X)\n", tmp);
862 r = -EINVAL;
863 }
864 839
865 dma_fence_put(fence); 840 dma_fence_put(fence);
866
867error: 841error:
868 return r; 842 return r;
869} 843}
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)
668 long r; 668 long r;
669 669
670 r = amdgpu_device_wb_get(adev, &index); 670 r = amdgpu_device_wb_get(adev, &index);
671 if (r) { 671 if (r)
672 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
673 return r; 672 return r;
674 }
675 673
676 gpu_addr = adev->wb.gpu_addr + (index * 4); 674 gpu_addr = adev->wb.gpu_addr + (index * 4);
677 tmp = 0xCAFEDEAD; 675 tmp = 0xCAFEDEAD;
678 adev->wb.wb[index] = cpu_to_le32(tmp); 676 adev->wb.wb[index] = cpu_to_le32(tmp);
679 memset(&ib, 0, sizeof(ib)); 677 memset(&ib, 0, sizeof(ib));
680 r = amdgpu_ib_get(adev, NULL, 256, &ib); 678 r = amdgpu_ib_get(adev, NULL, 256, &ib);
681 if (r) { 679 if (r)
682 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
683 goto err0; 680 goto err0;
684 }
685 681
686 ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, 682 ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE,
687 SDMA_WRITE_SUB_OPCODE_LINEAR, 0); 683 SDMA_WRITE_SUB_OPCODE_LINEAR, 0);
@@ -696,21 +692,16 @@ static int cik_sdma_ring_test_ib(struct amdgpu_ring *ring, long timeout)
696 692
697 r = dma_fence_wait_timeout(f, false, timeout); 693 r = dma_fence_wait_timeout(f, false, timeout);
698 if (r == 0) { 694 if (r == 0) {
699 DRM_ERROR("amdgpu: IB test timed out\n");
700 r = -ETIMEDOUT; 695 r = -ETIMEDOUT;
701 goto err1; 696 goto err1;
702 } else if (r < 0) { 697 } else if (r < 0) {
703 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
704 goto err1; 698 goto err1;
705 } 699 }
706 tmp = le32_to_cpu(adev->wb.wb[index]); 700 tmp = le32_to_cpu(adev->wb.wb[index]);
707 if (tmp == 0xDEADBEEF) { 701 if (tmp == 0xDEADBEEF)
708 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
709 r = 0; 702 r = 0;
710 } else { 703 else
711 DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp);
712 r = -EINVAL; 704 r = -EINVAL;
713 }
714 705
715err1: 706err1:
716 amdgpu_ib_free(adev, &ib, NULL); 707 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)
1887 long r; 1887 long r;
1888 1888
1889 r = amdgpu_gfx_scratch_get(adev, &scratch); 1889 r = amdgpu_gfx_scratch_get(adev, &scratch);
1890 if (r) { 1890 if (r)
1891 DRM_ERROR("amdgpu: failed to get scratch reg (%ld).\n", r);
1892 return r; 1891 return r;
1893 } 1892
1894 WREG32(scratch, 0xCAFEDEAD); 1893 WREG32(scratch, 0xCAFEDEAD);
1895 memset(&ib, 0, sizeof(ib)); 1894 memset(&ib, 0, sizeof(ib));
1896 r = amdgpu_ib_get(adev, NULL, 256, &ib); 1895 r = amdgpu_ib_get(adev, NULL, 256, &ib);
1897 if (r) { 1896 if (r)
1898 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
1899 goto err1; 1897 goto err1;
1900 } 1898
1901 ib.ptr[0] = PACKET3(PACKET3_SET_CONFIG_REG, 1); 1899 ib.ptr[0] = PACKET3(PACKET3_SET_CONFIG_REG, 1);
1902 ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_START)); 1900 ib.ptr[1] = ((scratch - PACKET3_SET_CONFIG_REG_START));
1903 ib.ptr[2] = 0xDEADBEEF; 1901 ib.ptr[2] = 0xDEADBEEF;
@@ -1909,22 +1907,16 @@ static int gfx_v6_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
1909 1907
1910 r = dma_fence_wait_timeout(f, false, timeout); 1908 r = dma_fence_wait_timeout(f, false, timeout);
1911 if (r == 0) { 1909 if (r == 0) {
1912 DRM_ERROR("amdgpu: IB test timed out\n");
1913 r = -ETIMEDOUT; 1910 r = -ETIMEDOUT;
1914 goto err2; 1911 goto err2;
1915 } else if (r < 0) { 1912 } else if (r < 0) {
1916 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
1917 goto err2; 1913 goto err2;
1918 } 1914 }
1919 tmp = RREG32(scratch); 1915 tmp = RREG32(scratch);
1920 if (tmp == 0xDEADBEEF) { 1916 if (tmp == 0xDEADBEEF)
1921 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
1922 r = 0; 1917 r = 0;
1923 } else { 1918 else
1924 DRM_ERROR("amdgpu: ib test failed (scratch(0x%04X)=0x%08X)\n",
1925 scratch, tmp);
1926 r = -EINVAL; 1919 r = -EINVAL;
1927 }
1928 1920
1929err2: 1921err2:
1930 amdgpu_ib_free(adev, &ib, NULL); 1922 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)
2310 long r; 2310 long r;
2311 2311
2312 r = amdgpu_gfx_scratch_get(adev, &scratch); 2312 r = amdgpu_gfx_scratch_get(adev, &scratch);
2313 if (r) { 2313 if (r)
2314 DRM_ERROR("amdgpu: failed to get scratch reg (%ld).\n", r);
2315 return r; 2314 return r;
2316 } 2315
2317 WREG32(scratch, 0xCAFEDEAD); 2316 WREG32(scratch, 0xCAFEDEAD);
2318 memset(&ib, 0, sizeof(ib)); 2317 memset(&ib, 0, sizeof(ib));
2319 r = amdgpu_ib_get(adev, NULL, 256, &ib); 2318 r = amdgpu_ib_get(adev, NULL, 256, &ib);
2320 if (r) { 2319 if (r)
2321 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
2322 goto err1; 2320 goto err1;
2323 } 2321
2324 ib.ptr[0] = PACKET3(PACKET3_SET_UCONFIG_REG, 1); 2322 ib.ptr[0] = PACKET3(PACKET3_SET_UCONFIG_REG, 1);
2325 ib.ptr[1] = ((scratch - PACKET3_SET_UCONFIG_REG_START)); 2323 ib.ptr[1] = ((scratch - PACKET3_SET_UCONFIG_REG_START));
2326 ib.ptr[2] = 0xDEADBEEF; 2324 ib.ptr[2] = 0xDEADBEEF;
@@ -2332,22 +2330,16 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
2332 2330
2333 r = dma_fence_wait_timeout(f, false, timeout); 2331 r = dma_fence_wait_timeout(f, false, timeout);
2334 if (r == 0) { 2332 if (r == 0) {
2335 DRM_ERROR("amdgpu: IB test timed out\n");
2336 r = -ETIMEDOUT; 2333 r = -ETIMEDOUT;
2337 goto err2; 2334 goto err2;
2338 } else if (r < 0) { 2335 } else if (r < 0) {
2339 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
2340 goto err2; 2336 goto err2;
2341 } 2337 }
2342 tmp = RREG32(scratch); 2338 tmp = RREG32(scratch);
2343 if (tmp == 0xDEADBEEF) { 2339 if (tmp == 0xDEADBEEF)
2344 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
2345 r = 0; 2340 r = 0;
2346 } else { 2341 else
2347 DRM_ERROR("amdgpu: ib test failed (scratch(0x%04X)=0x%08X)\n",
2348 scratch, tmp);
2349 r = -EINVAL; 2342 r = -EINVAL;
2350 }
2351 2343
2352err2: 2344err2:
2353 amdgpu_ib_free(adev, &ib, NULL); 2345 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 740c73aa7b45..58c5ebe1cd73 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)
879 long r; 879 long r;
880 880
881 r = amdgpu_device_wb_get(adev, &index); 881 r = amdgpu_device_wb_get(adev, &index);
882 if (r) { 882 if (r)
883 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
884 return r; 883 return r;
885 }
886 884
887 gpu_addr = adev->wb.gpu_addr + (index * 4); 885 gpu_addr = adev->wb.gpu_addr + (index * 4);
888 adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD); 886 adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
889 memset(&ib, 0, sizeof(ib)); 887 memset(&ib, 0, sizeof(ib));
890 r = amdgpu_ib_get(adev, NULL, 16, &ib); 888 r = amdgpu_ib_get(adev, NULL, 16, &ib);
891 if (r) { 889 if (r)
892 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
893 goto err1; 890 goto err1;
894 } 891
895 ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3); 892 ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3);
896 ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM; 893 ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM;
897 ib.ptr[2] = lower_32_bits(gpu_addr); 894 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)
905 902
906 r = dma_fence_wait_timeout(f, false, timeout); 903 r = dma_fence_wait_timeout(f, false, timeout);
907 if (r == 0) { 904 if (r == 0) {
908 DRM_ERROR("amdgpu: IB test timed out.\n");
909 r = -ETIMEDOUT; 905 r = -ETIMEDOUT;
910 goto err2; 906 goto err2;
911 } else if (r < 0) { 907 } else if (r < 0) {
912 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
913 goto err2; 908 goto err2;
914 } 909 }
915 910
916 tmp = adev->wb.wb[index]; 911 tmp = adev->wb.wb[index];
917 if (tmp == 0xDEADBEEF) { 912 if (tmp == 0xDEADBEEF)
918 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
919 r = 0; 913 r = 0;
920 } else { 914 else
921 DRM_ERROR("ib test on ring %d failed\n", ring->idx);
922 r = -EINVAL; 915 r = -EINVAL;
923 }
924 916
925err2: 917err2:
926 amdgpu_ib_free(adev, &ib, NULL); 918 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)
436 long r; 436 long r;
437 437
438 r = amdgpu_device_wb_get(adev, &index); 438 r = amdgpu_device_wb_get(adev, &index);
439 if (r) { 439 if (r)
440 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
441 return r; 440 return r;
442 }
443 441
444 gpu_addr = adev->wb.gpu_addr + (index * 4); 442 gpu_addr = adev->wb.gpu_addr + (index * 4);
445 adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD); 443 adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
446 memset(&ib, 0, sizeof(ib)); 444 memset(&ib, 0, sizeof(ib));
447 r = amdgpu_ib_get(adev, NULL, 16, &ib); 445 r = amdgpu_ib_get(adev, NULL, 16, &ib);
448 if (r) { 446 if (r)
449 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
450 goto err1; 447 goto err1;
451 } 448
452 ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3); 449 ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3);
453 ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM; 450 ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM;
454 ib.ptr[2] = lower_32_bits(gpu_addr); 451 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)
462 459
463 r = dma_fence_wait_timeout(f, false, timeout); 460 r = dma_fence_wait_timeout(f, false, timeout);
464 if (r == 0) { 461 if (r == 0) {
465 DRM_ERROR("amdgpu: IB test timed out.\n"); 462 r = -ETIMEDOUT;
466 r = -ETIMEDOUT; 463 goto err2;
467 goto err2;
468 } else if (r < 0) { 464 } else if (r < 0) {
469 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); 465 goto err2;
470 goto err2;
471 } 466 }
472 467
473 tmp = adev->wb.wb[index]; 468 tmp = adev->wb.wb[index];
474 if (tmp == 0xDEADBEEF) { 469 if (tmp == 0xDEADBEEF)
475 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); 470 r = 0;
476 r = 0; 471 else
477 } else { 472 r = -EINVAL;
478 DRM_ERROR("ib test on ring %d failed\n", ring->idx);
479 r = -EINVAL;
480 }
481 473
482err2: 474err2:
483 amdgpu_ib_free(adev, &ib, NULL); 475 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)
601 long r; 601 long r;
602 602
603 r = amdgpu_device_wb_get(adev, &index); 603 r = amdgpu_device_wb_get(adev, &index);
604 if (r) { 604 if (r)
605 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
606 return r; 605 return r;
607 }
608 606
609 gpu_addr = adev->wb.gpu_addr + (index * 4); 607 gpu_addr = adev->wb.gpu_addr + (index * 4);
610 tmp = 0xCAFEDEAD; 608 tmp = 0xCAFEDEAD;
611 adev->wb.wb[index] = cpu_to_le32(tmp); 609 adev->wb.wb[index] = cpu_to_le32(tmp);
612 memset(&ib, 0, sizeof(ib)); 610 memset(&ib, 0, sizeof(ib));
613 r = amdgpu_ib_get(adev, NULL, 256, &ib); 611 r = amdgpu_ib_get(adev, NULL, 256, &ib);
614 if (r) { 612 if (r)
615 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
616 goto err0; 613 goto err0;
617 }
618 614
619 ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) | 615 ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) |
620 SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_WRITE_LINEAR); 616 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)
633 629
634 r = dma_fence_wait_timeout(f, false, timeout); 630 r = dma_fence_wait_timeout(f, false, timeout);
635 if (r == 0) { 631 if (r == 0) {
636 DRM_ERROR("amdgpu: IB test timed out\n");
637 r = -ETIMEDOUT; 632 r = -ETIMEDOUT;
638 goto err1; 633 goto err1;
639 } else if (r < 0) { 634 } else if (r < 0) {
640 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
641 goto err1; 635 goto err1;
642 } 636 }
643 tmp = le32_to_cpu(adev->wb.wb[index]); 637 tmp = le32_to_cpu(adev->wb.wb[index]);
644 if (tmp == 0xDEADBEEF) { 638 if (tmp == 0xDEADBEEF)
645 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
646 r = 0; 639 r = 0;
647 } else { 640 else
648 DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp);
649 r = -EINVAL; 641 r = -EINVAL;
650 }
651 642
652err1: 643err1:
653 amdgpu_ib_free(adev, &ib, NULL); 644 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)
873 long r; 873 long r;
874 874
875 r = amdgpu_device_wb_get(adev, &index); 875 r = amdgpu_device_wb_get(adev, &index);
876 if (r) { 876 if (r)
877 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
878 return r; 877 return r;
879 }
880 878
881 gpu_addr = adev->wb.gpu_addr + (index * 4); 879 gpu_addr = adev->wb.gpu_addr + (index * 4);
882 tmp = 0xCAFEDEAD; 880 tmp = 0xCAFEDEAD;
883 adev->wb.wb[index] = cpu_to_le32(tmp); 881 adev->wb.wb[index] = cpu_to_le32(tmp);
884 memset(&ib, 0, sizeof(ib)); 882 memset(&ib, 0, sizeof(ib));
885 r = amdgpu_ib_get(adev, NULL, 256, &ib); 883 r = amdgpu_ib_get(adev, NULL, 256, &ib);
886 if (r) { 884 if (r)
887 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
888 goto err0; 885 goto err0;
889 }
890 886
891 ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) | 887 ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) |
892 SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_WRITE_LINEAR); 888 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)
905 901
906 r = dma_fence_wait_timeout(f, false, timeout); 902 r = dma_fence_wait_timeout(f, false, timeout);
907 if (r == 0) { 903 if (r == 0) {
908 DRM_ERROR("amdgpu: IB test timed out\n");
909 r = -ETIMEDOUT; 904 r = -ETIMEDOUT;
910 goto err1; 905 goto err1;
911 } else if (r < 0) { 906 } else if (r < 0) {
912 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
913 goto err1; 907 goto err1;
914 } 908 }
915 tmp = le32_to_cpu(adev->wb.wb[index]); 909 tmp = le32_to_cpu(adev->wb.wb[index]);
916 if (tmp == 0xDEADBEEF) { 910 if (tmp == 0xDEADBEEF)
917 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
918 r = 0; 911 r = 0;
919 } else { 912 else
920 DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp);
921 r = -EINVAL; 913 r = -EINVAL;
922 }
923err1: 914err1:
924 amdgpu_ib_free(adev, &ib, NULL); 915 amdgpu_ib_free(adev, &ib, NULL);
925 dma_fence_put(f); 916 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)
1235 u64 gpu_addr; 1235 u64 gpu_addr;
1236 1236
1237 r = amdgpu_device_wb_get(adev, &index); 1237 r = amdgpu_device_wb_get(adev, &index);
1238 if (r) { 1238 if (r)
1239 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
1240 return r; 1239 return r;
1241 }
1242 1240
1243 gpu_addr = adev->wb.gpu_addr + (index * 4); 1241 gpu_addr = adev->wb.gpu_addr + (index * 4);
1244 tmp = 0xCAFEDEAD; 1242 tmp = 0xCAFEDEAD;
1245 adev->wb.wb[index] = cpu_to_le32(tmp); 1243 adev->wb.wb[index] = cpu_to_le32(tmp);
1246 memset(&ib, 0, sizeof(ib)); 1244 memset(&ib, 0, sizeof(ib));
1247 r = amdgpu_ib_get(adev, NULL, 256, &ib); 1245 r = amdgpu_ib_get(adev, NULL, 256, &ib);
1248 if (r) { 1246 if (r)
1249 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
1250 goto err0; 1247 goto err0;
1251 }
1252 1248
1253 ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) | 1249 ib.ptr[0] = SDMA_PKT_HEADER_OP(SDMA_OP_WRITE) |
1254 SDMA_PKT_HEADER_SUB_OP(SDMA_SUBOP_WRITE_LINEAR); 1250 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)
1267 1263
1268 r = dma_fence_wait_timeout(f, false, timeout); 1264 r = dma_fence_wait_timeout(f, false, timeout);
1269 if (r == 0) { 1265 if (r == 0) {
1270 DRM_ERROR("amdgpu: IB test timed out\n");
1271 r = -ETIMEDOUT; 1266 r = -ETIMEDOUT;
1272 goto err1; 1267 goto err1;
1273 } else if (r < 0) { 1268 } else if (r < 0) {
1274 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
1275 goto err1; 1269 goto err1;
1276 } 1270 }
1277 tmp = le32_to_cpu(adev->wb.wb[index]); 1271 tmp = le32_to_cpu(adev->wb.wb[index]);
1278 if (tmp == 0xDEADBEEF) { 1272 if (tmp == 0xDEADBEEF)
1279 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
1280 r = 0; 1273 r = 0;
1281 } else { 1274 else
1282 DRM_ERROR("amdgpu: ib test failed (0x%08X)\n", tmp);
1283 r = -EINVAL; 1275 r = -EINVAL;
1284 } 1276
1285err1: 1277err1:
1286 amdgpu_ib_free(adev, &ib, NULL); 1278 amdgpu_ib_free(adev, &ib, NULL);
1287 dma_fence_put(f); 1279 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)
258 long r; 258 long r;
259 259
260 r = amdgpu_device_wb_get(adev, &index); 260 r = amdgpu_device_wb_get(adev, &index);
261 if (r) { 261 if (r)
262 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
263 return r; 262 return r;
264 }
265 263
266 gpu_addr = adev->wb.gpu_addr + (index * 4); 264 gpu_addr = adev->wb.gpu_addr + (index * 4);
267 tmp = 0xCAFEDEAD; 265 tmp = 0xCAFEDEAD;
268 adev->wb.wb[index] = cpu_to_le32(tmp); 266 adev->wb.wb[index] = cpu_to_le32(tmp);
269 memset(&ib, 0, sizeof(ib)); 267 memset(&ib, 0, sizeof(ib));
270 r = amdgpu_ib_get(adev, NULL, 256, &ib); 268 r = amdgpu_ib_get(adev, NULL, 256, &ib);
271 if (r) { 269 if (r)
272 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
273 goto err0; 270 goto err0;
274 }
275 271
276 ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 0, 1); 272 ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 0, 1);
277 ib.ptr[1] = lower_32_bits(gpu_addr); 273 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)
284 280
285 r = dma_fence_wait_timeout(f, false, timeout); 281 r = dma_fence_wait_timeout(f, false, timeout);
286 if (r == 0) { 282 if (r == 0) {
287 DRM_ERROR("amdgpu: IB test timed out\n");
288 r = -ETIMEDOUT; 283 r = -ETIMEDOUT;
289 goto err1; 284 goto err1;
290 } else if (r < 0) { 285 } else if (r < 0) {
291 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
292 goto err1; 286 goto err1;
293 } 287 }
294 tmp = le32_to_cpu(adev->wb.wb[index]); 288 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)
327 long r; 327 long r;
328 328
329 r = uvd_v6_0_enc_get_create_msg(ring, 1, NULL); 329 r = uvd_v6_0_enc_get_create_msg(ring, 1, NULL);
330 if (r) { 330 if (r)
331 DRM_ERROR("amdgpu: failed to get create msg (%ld).\n", r);
332 goto error; 331 goto error;
333 }
334 332
335 r = uvd_v6_0_enc_get_destroy_msg(ring, 1, &fence); 333 r = uvd_v6_0_enc_get_destroy_msg(ring, 1, &fence);
336 if (r) { 334 if (r)
337 DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r);
338 goto error; 335 goto error;
339 }
340 336
341 r = dma_fence_wait_timeout(fence, false, timeout); 337 r = dma_fence_wait_timeout(fence, false, timeout);
342 if (r == 0) { 338 if (r == 0)
343 DRM_ERROR("amdgpu: IB test timed out.\n");
344 r = -ETIMEDOUT; 339 r = -ETIMEDOUT;
345 } else if (r < 0) { 340 else if (r > 0)
346 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
347 } else {
348 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
349 r = 0; 341 r = 0;
350 } 342
351error: 343error:
352 dma_fence_put(fence); 344 dma_fence_put(fence);
353 return r; 345 return r;
354} 346}
347
355static int uvd_v6_0_early_init(void *handle) 348static int uvd_v6_0_early_init(void *handle)
356{ 349{
357 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 350 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)
334 long r; 334 long r;
335 335
336 r = uvd_v7_0_enc_get_create_msg(ring, 1, NULL); 336 r = uvd_v7_0_enc_get_create_msg(ring, 1, NULL);
337 if (r) { 337 if (r)
338 DRM_ERROR("amdgpu: (%d)failed to get create msg (%ld).\n", ring->me, r);
339 goto error; 338 goto error;
340 }
341 339
342 r = uvd_v7_0_enc_get_destroy_msg(ring, 1, &fence); 340 r = uvd_v7_0_enc_get_destroy_msg(ring, 1, &fence);
343 if (r) { 341 if (r)
344 DRM_ERROR("amdgpu: (%d)failed to get destroy ib (%ld).\n", ring->me, r);
345 goto error; 342 goto error;
346 }
347 343
348 r = dma_fence_wait_timeout(fence, false, timeout); 344 r = dma_fence_wait_timeout(fence, false, timeout);
349 if (r == 0) { 345 if (r == 0)
350 DRM_ERROR("amdgpu: (%d)IB test timed out.\n", ring->me);
351 r = -ETIMEDOUT; 346 r = -ETIMEDOUT;
352 } else if (r < 0) { 347 else if (r > 0)
353 DRM_ERROR("amdgpu: (%d)fence wait failed (%ld).\n", ring->me, r);
354 } else {
355 DRM_DEBUG("ib test on (%d)ring %d succeeded\n", ring->me, ring->idx);
356 r = 0; 348 r = 0;
357 } 349
358error: 350error:
359 dma_fence_put(fence); 351 dma_fence_put(fence);
360 return r; 352 return r;