Commit 9eb28ac1 authored by Yifan Zha's avatar Yifan Zha Committed by Alex Deucher
Browse files

drm/amdgpu: Add MES KIQ dequeue in MES hw fini



[Why]
Need dequeue MES KIQ under SRIOV when unloading driver

[How]
Modify mes_v11_0_kiq_dequeue_sched which was used to dequeue MES SCHED
to support veriable pipe.
Add MES KIQ dequeue in hw fini

Signed-off-by: default avatarYifan Zha <Yifan.Zha@amd.com>
Reviewed-by: default avatarHorace Chen <horace.chen@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 583da1b8
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -1089,13 +1089,14 @@ static int mes_v11_0_sw_fini(void *handle)
	return 0;
}

static void mes_v11_0_kiq_dequeue_sched(struct amdgpu_device *adev)
static void mes_v11_0_kiq_dequeue(struct amdgpu_ring *ring)
{
	uint32_t data;
	int i;
	struct amdgpu_device *adev = ring->adev;

	mutex_lock(&adev->srbm_mutex);
	soc21_grbm_select(adev, 3, AMDGPU_MES_SCHED_PIPE, 0, 0);
	soc21_grbm_select(adev, 3, ring->pipe, 0, 0);

	/* disable the queue if it's active */
	if (RREG32_SOC15(GC, 0, regCP_HQD_ACTIVE) & 1) {
@@ -1121,8 +1122,6 @@ static void mes_v11_0_kiq_dequeue_sched(struct amdgpu_device *adev)

	soc21_grbm_select(adev, 0, 0, 0, 0);
	mutex_unlock(&adev->srbm_mutex);

	adev->mes.ring.sched.ready = false;
}

static void mes_v11_0_kiq_setting(struct amdgpu_ring *ring)
@@ -1176,8 +1175,14 @@ static int mes_v11_0_kiq_hw_init(struct amdgpu_device *adev)

static int mes_v11_0_kiq_hw_fini(struct amdgpu_device *adev)
{
	if (adev->mes.ring.sched.ready)
		mes_v11_0_kiq_dequeue_sched(adev);
	if (adev->mes.ring.sched.ready) {
		mes_v11_0_kiq_dequeue(&adev->mes.ring);
		adev->mes.ring.sched.ready = false;
	}

	if (amdgpu_sriov_vf(adev)) {
		mes_v11_0_kiq_dequeue(&adev->gfx.kiq.ring);
	}

	if (!amdgpu_sriov_vf(adev))
		mes_v11_0_enable(adev, false);