aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
diff options
context:
space:
mode:
authorShirish S <shirish.s@amd.com>2018-06-08 00:45:42 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-06-15 13:20:40 -0400
commit8f4039fefd94a0ca2c61507975f6d47f9fc9943a (patch)
tree843b494aadc6845762a023590816e0afc4b81631 /drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
parent11528640c77891363bc7dea749ced64607aa1b22 (diff)
drm/amdgpu: change gfx8 ib test to use WB
This patch is extends the usage of WB in gfx8's ib test which was originally implemented in the below upstream patch "ed9324a drm/amdgpu: change gfx9 ib test to use WB" For reference below are the reasons for switching to WB: 1)Because when doing IB test we don't want to involve KIQ health status affect, and since SCRATCH register access is go through KIQ that way GFX IB test would failed due to KIQ fail. 2)acccessing SCRATCH register cost much more time than WB method because SCRATCH register access runs through KIQ which at least could begin after GPU world switch back to current Guest VF Signed-off-by: Shirish S <shirish.s@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 818874b13c99..61452c7c4024 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -866,26 +866,32 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
866 struct amdgpu_device *adev = ring->adev; 866 struct amdgpu_device *adev = ring->adev;
867 struct amdgpu_ib ib; 867 struct amdgpu_ib ib;
868 struct dma_fence *f = NULL; 868 struct dma_fence *f = NULL;
869 uint32_t scratch; 869
870 uint32_t tmp = 0; 870 unsigned int index;
871 uint64_t gpu_addr;
872 uint32_t tmp;
871 long r; 873 long r;
872 874
873 r = amdgpu_gfx_scratch_get(adev, &scratch); 875 r = amdgpu_device_wb_get(adev, &index);
874 if (r) { 876 if (r) {
875 DRM_ERROR("amdgpu: failed to get scratch reg (%ld).\n", r); 877 dev_err(adev->dev, "(%ld) failed to allocate wb slot\n", r);
876 return r; 878 return r;
877 } 879 }
878 WREG32(scratch, 0xCAFEDEAD); 880
881 gpu_addr = adev->wb.gpu_addr + (index * 4);
882 adev->wb.wb[index] = cpu_to_le32(0xCAFEDEAD);
879 memset(&ib, 0, sizeof(ib)); 883 memset(&ib, 0, sizeof(ib));
880 r = amdgpu_ib_get(adev, NULL, 256, &ib); 884 r = amdgpu_ib_get(adev, NULL, 16, &ib);
881 if (r) { 885 if (r) {
882 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r); 886 DRM_ERROR("amdgpu: failed to get ib (%ld).\n", r);
883 goto err1; 887 goto err1;
884 } 888 }
885 ib.ptr[0] = PACKET3(PACKET3_SET_UCONFIG_REG, 1); 889 ib.ptr[0] = PACKET3(PACKET3_WRITE_DATA, 3);
886 ib.ptr[1] = ((scratch - PACKET3_SET_UCONFIG_REG_START)); 890 ib.ptr[1] = WRITE_DATA_DST_SEL(5) | WR_CONFIRM;
887 ib.ptr[2] = 0xDEADBEEF; 891 ib.ptr[2] = lower_32_bits(gpu_addr);
888 ib.length_dw = 3; 892 ib.ptr[3] = upper_32_bits(gpu_addr);
893 ib.ptr[4] = 0xDEADBEEF;
894 ib.length_dw = 5;
889 895
890 r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f); 896 r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f);
891 if (r) 897 if (r)
@@ -900,20 +906,21 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
900 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r); 906 DRM_ERROR("amdgpu: fence wait failed (%ld).\n", r);
901 goto err2; 907 goto err2;
902 } 908 }
903 tmp = RREG32(scratch); 909
910 tmp = adev->wb.wb[index];
904 if (tmp == 0xDEADBEEF) { 911 if (tmp == 0xDEADBEEF) {
905 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx); 912 DRM_DEBUG("ib test on ring %d succeeded\n", ring->idx);
906 r = 0; 913 r = 0;
907 } else { 914 } else {
908 DRM_ERROR("amdgpu: ib test failed (scratch(0x%04X)=0x%08X)\n", 915 DRM_ERROR("ib test on ring %d failed\n", ring->idx);
909 scratch, tmp);
910 r = -EINVAL; 916 r = -EINVAL;
911 } 917 }
918
912err2: 919err2:
913 amdgpu_ib_free(adev, &ib, NULL); 920 amdgpu_ib_free(adev, &ib, NULL);
914 dma_fence_put(f); 921 dma_fence_put(f);
915err1: 922err1:
916 amdgpu_gfx_scratch_free(adev, scratch); 923 amdgpu_device_wb_free(adev, index);
917 return r; 924 return r;
918} 925}
919 926