diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 31d99b0010f7..532ea88da66a 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | |||
@@ -236,6 +236,15 @@ static void sdma_v3_0_init_golden_registers(struct amdgpu_device *adev) | |||
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | static void sdma_v3_0_free_microcode(struct amdgpu_device *adev) | ||
240 | { | ||
241 | int i; | ||
242 | for (i = 0; i < adev->sdma.num_instances; i++) { | ||
243 | release_firmware(adev->sdma.instance[i].fw); | ||
244 | adev->sdma.instance[i].fw = NULL; | ||
245 | } | ||
246 | } | ||
247 | |||
239 | /** | 248 | /** |
240 | * sdma_v3_0_init_microcode - load ucode images from disk | 249 | * sdma_v3_0_init_microcode - load ucode images from disk |
241 | * | 250 | * |
@@ -672,6 +681,8 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) | |||
672 | /* Initialize the ring buffer's read and write pointers */ | 681 | /* Initialize the ring buffer's read and write pointers */ |
673 | WREG32(mmSDMA0_GFX_RB_RPTR + sdma_offsets[i], 0); | 682 | WREG32(mmSDMA0_GFX_RB_RPTR + sdma_offsets[i], 0); |
674 | WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[i], 0); | 683 | WREG32(mmSDMA0_GFX_RB_WPTR + sdma_offsets[i], 0); |
684 | WREG32(mmSDMA0_GFX_IB_RPTR + sdma_offsets[i], 0); | ||
685 | WREG32(mmSDMA0_GFX_IB_OFFSET + sdma_offsets[i], 0); | ||
675 | 686 | ||
676 | /* set the wb address whether it's enabled or not */ | 687 | /* set the wb address whether it's enabled or not */ |
677 | WREG32(mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i], | 688 | WREG32(mmSDMA0_GFX_RB_RPTR_ADDR_HI + sdma_offsets[i], |
@@ -711,7 +722,15 @@ static int sdma_v3_0_gfx_resume(struct amdgpu_device *adev) | |||
711 | WREG32(mmSDMA0_GFX_IB_CNTL + sdma_offsets[i], ib_cntl); | 722 | WREG32(mmSDMA0_GFX_IB_CNTL + sdma_offsets[i], ib_cntl); |
712 | 723 | ||
713 | ring->ready = true; | 724 | ring->ready = true; |
725 | } | ||
726 | |||
727 | /* unhalt the MEs */ | ||
728 | sdma_v3_0_enable(adev, true); | ||
729 | /* enable sdma ring preemption */ | ||
730 | sdma_v3_0_ctx_switch_enable(adev, true); | ||
714 | 731 | ||
732 | for (i = 0; i < adev->sdma.num_instances; i++) { | ||
733 | ring = &adev->sdma.instance[i].ring; | ||
715 | r = amdgpu_ring_test_ring(ring); | 734 | r = amdgpu_ring_test_ring(ring); |
716 | if (r) { | 735 | if (r) { |
717 | ring->ready = false; | 736 | ring->ready = false; |
@@ -804,10 +823,9 @@ static int sdma_v3_0_start(struct amdgpu_device *adev) | |||
804 | } | 823 | } |
805 | } | 824 | } |
806 | 825 | ||
807 | /* unhalt the MEs */ | 826 | /* disble sdma engine before programing it */ |
808 | sdma_v3_0_enable(adev, true); | 827 | sdma_v3_0_ctx_switch_enable(adev, false); |
809 | /* enable sdma ring preemption */ | 828 | sdma_v3_0_enable(adev, false); |
810 | sdma_v3_0_ctx_switch_enable(adev, true); | ||
811 | 829 | ||
812 | /* start the gfx rings and rlc compute queues */ | 830 | /* start the gfx rings and rlc compute queues */ |
813 | r = sdma_v3_0_gfx_resume(adev); | 831 | r = sdma_v3_0_gfx_resume(adev); |
@@ -1247,6 +1265,7 @@ static int sdma_v3_0_sw_fini(void *handle) | |||
1247 | for (i = 0; i < adev->sdma.num_instances; i++) | 1265 | for (i = 0; i < adev->sdma.num_instances; i++) |
1248 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); | 1266 | amdgpu_ring_fini(&adev->sdma.instance[i].ring); |
1249 | 1267 | ||
1268 | sdma_v3_0_free_microcode(adev); | ||
1250 | return 0; | 1269 | return 0; |
1251 | } | 1270 | } |
1252 | 1271 | ||