|
@@ -341,6 +341,33 @@ static void cik_sdma_rlc_stop(struct amdgpu_device *adev)
|
|
/* XXX todo */
|
|
/* XXX todo */
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * cik_ctx_switch_enable - stop the async dma engines context switch
|
|
|
|
+ *
|
|
|
|
+ * @adev: amdgpu_device pointer
|
|
|
|
+ * @enable: enable/disable the DMA MEs context switch.
|
|
|
|
+ *
|
|
|
|
+ * Halt or unhalt the async dma engines context switch (VI).
|
|
|
|
+ */
|
|
|
|
+static void cik_ctx_switch_enable(struct amdgpu_device *adev, bool enable)
|
|
|
|
+{
|
|
|
|
+ u32 f32_cntl;
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < adev->sdma.num_instances; i++) {
|
|
|
|
+ f32_cntl = RREG32(mmSDMA0_CNTL + sdma_offsets[i]);
|
|
|
|
+ if (enable) {
|
|
|
|
+ f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL,
|
|
|
|
+ AUTO_CTXSW_ENABLE, 1);
|
|
|
|
+ } else {
|
|
|
|
+ f32_cntl = REG_SET_FIELD(f32_cntl, SDMA0_CNTL,
|
|
|
|
+ AUTO_CTXSW_ENABLE, 0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WREG32(mmSDMA0_CNTL + sdma_offsets[i], f32_cntl);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* cik_sdma_enable - stop the async dma engines
|
|
* cik_sdma_enable - stop the async dma engines
|
|
*
|
|
*
|
|
@@ -537,6 +564,8 @@ static int cik_sdma_start(struct amdgpu_device *adev)
|
|
|
|
|
|
/* halt the engine before programing */
|
|
/* halt the engine before programing */
|
|
cik_sdma_enable(adev, false);
|
|
cik_sdma_enable(adev, false);
|
|
|
|
+ /* enable sdma ring preemption */
|
|
|
|
+ cik_ctx_switch_enable(adev, true);
|
|
|
|
|
|
/* start the gfx rings and rlc compute queues */
|
|
/* start the gfx rings and rlc compute queues */
|
|
r = cik_sdma_gfx_resume(adev);
|
|
r = cik_sdma_gfx_resume(adev);
|
|
@@ -984,6 +1013,7 @@ static int cik_sdma_hw_fini(void *handle)
|
|
{
|
|
{
|
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
|
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
|
|
|
|
|
|
|
+ cik_ctx_switch_enable(adev, false);
|
|
cik_sdma_enable(adev, false);
|
|
cik_sdma_enable(adev, false);
|
|
|
|
|
|
return 0;
|
|
return 0;
|