Skip to contentSkip to conversation

drm/amdgpu: Fix vce initialize failed on Kaveri/Mullins

PATCH In review Rex Zhu 3 participants 6 messages Aug 24, 2018 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/3 drm/amdgpu: Fix vce initialize failed on Kaveri/Mullins

Forgot to add vce pg support via smu for Kaveri/Mullins.

Fixes 561a5c83eadd ("drm/amd/pp: Unify powergate_uvd/vce/mmhub

to set_powergating_by_smu")

v2: refine patch descriptions suggested by Michel

---
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 41 +++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +26 -15
index 3f57f64..a713c8b 100644
@@ -66,7 +66,6 @@ static int kv_set_thermal_temperature_range(struct amdgpu_device *adev,
 static int kv_init_fps_limits(struct amdgpu_device *adev);
 
 static void kv_dpm_powergate_uvd(void *handle, bool gate);
-static void kv_dpm_powergate_vce(struct amdgpu_device *adev, bool gate);
 static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate);
 static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate);
 
@@ -1374,6 +1373,8 @@ static int kv_dpm_enable(struct amdgpu_device *adev)
 
 static void kv_dpm_disable(struct amdgpu_device *adev)
 {
+	struct kv_power_info *pi = kv_get_pi(adev);
+
 	amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
 		       AMDGPU_THERMAL_IRQ_LOW_TO_HIGH);
 	amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
@@ -1387,7 +1388,8 @@ static void kv_dpm_disable(struct amdgpu_device *adev)
 	/* powerup blocks */
 	kv_dpm_powergate_acp(adev, false);
 	kv_dpm_powergate_samu(adev, false);
-	kv_dpm_powergate_vce(adev, false);
+	if (pi->caps_vce_pg) /* power on the VCE block */
+		amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
 	kv_dpm_powergate_uvd(adev, false);
 
 	kv_enable_smc_cac(adev, false);
@@ -1551,7 +1553,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev,
 	int ret;
 
 	if (amdgpu_new_state->evclk > 0 && amdgpu_current_state->evclk == 0) {
-		kv_dpm_powergate_vce(adev, false);
 		if (pi->caps_stable_p_state)
 			pi->vce_boot_level = table->count - 1;
 		else
@@ -1573,7 +1574,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev,
 		kv_enable_vce_dpm(adev, true);
 	} else if (amdgpu_new_state->evclk == 0 && amdgpu_current_state->evclk > 0) {
 		kv_enable_vce_dpm(adev, false);
-		kv_dpm_powergate_vce(adev, true);
 	}
 
 	return 0;
@@ -1702,24 +1702,32 @@ static void kv_dpm_powergate_uvd(void *handle, bool gate)
 	}
 }
 
-static void kv_dpm_powergate_vce(struct amdgpu_device *adev, bool gate)
+static void kv_dpm_powergate_vce(void *handle, bool gate)
 {
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct kv_power_info *pi = kv_get_pi(adev);
-
-	if (pi->vce_power_gated == gate)
-		return;
+	int ret;
 
 	pi->vce_power_gated = gate;
 
-	if (!pi->caps_vce_pg)
-		return;
-
-	if (gate)
-		amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerOFF);
-	else
-		amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
+	if (gate) {
+		/* stop the VCE block */
+		ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
+							     AMD_PG_STATE_GATE);
+		kv_enable_vce_dpm(adev, false);
+		if (pi->caps_vce_pg) /* power off the VCE block */
+			amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerOFF);
+	} else {
+		if (pi->caps_vce_pg) /* power on the VCE block */
+			amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
+		kv_enable_vce_dpm(adev, true);
+		/* re-init the VCE block */
+		ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
+							     AMD_PG_STATE_UNGATE);
+	}
 }
 
+
 static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate)
 {
 	struct kv_power_info *pi = kv_get_pi(adev);
@@ -3313,6 +3321,9 @@ static int kv_set_powergating_by_smu(void *handle,
 	case AMD_IP_BLOCK_TYPE_UVD:
 		kv_dpm_powergate_uvd(handle, gate);
 		break;
+	case AMD_IP_BLOCK_TYPE_VCE:
+		kv_dpm_powergate_vce(handle, gate);
+		break;
 	default:
 		break;
 	}
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1535100626-14880-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/3 drm/amdgpu: Update power state at the end of smu hw_init.

For SI/Kv, the power state is managed by function
amdgpu_pm_compute_clocks.

when dpm enabled, we should call amdgpu_pm_compute_clocks to update current power state instand of set boot state.

this change can fix the oops when kfd driver was enabled on Kv.

---
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 4 +---
 drivers/gpu/drm/amd/amdgpu/si_dpm.c | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +1 -3
index a713c8b..b497c37 100644
@@ -1353,8 +1353,6 @@ static int kv_dpm_enable(struct amdgpu_device *adev)
 		return ret;
 	}
 
-	kv_update_current_ps(adev, adev->pm.dpm.boot_ps);
-
 	if (adev->irq.installed &&
 	    amdgpu_is_internal_thermal_sensor(adev->pm.int_thermal_type)) {
 		ret = kv_set_thermal_temperature_range(adev, KV_TEMP_RANGE_MIN, KV_TEMP_RANGE_MAX);
@@ -3069,7 +3067,7 @@ static int kv_dpm_hw_init(void *handle)
 	else
 		adev->pm.dpm_enabled = true;
 	mutex_unlock(&adev->pm.mutex);
-
+	amdgpu_pm_compute_clocks(adev);
 	return ret;
 }
 
drivers/gpu/drm/amd/amdgpu/si_dpm.c +1 -2
index db327b4..1de9699 100644
@@ -6887,7 +6887,6 @@ static int si_dpm_enable(struct amdgpu_device *adev)
 
 	si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true);
 	si_thermal_start_thermal_controller(adev);
-	ni_update_current_ps(adev, boot_ps);
 
 	return 0;
 }
@@ -7763,7 +7762,7 @@ static int si_dpm_hw_init(void *handle)
 	else
 		adev->pm.dpm_enabled = true;
 	mutex_unlock(&adev->pm.mutex);
-
+	amdgpu_pm_compute_clocks(adev);
 	return ret;
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 3/3 drm/amdgpu: Power on uvd block when hw_fini

In reply to a message not in the archive

when hw_fini/suspend, smu only need to power on uvd block if uvd pg is supported, don't need to call uvd to do hw_init.

v2: fix typo in patch descriptions.

---
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +2 -2
index b497c37..ce81a53 100644
@@ -65,7 +65,6 @@ static int kv_set_thermal_temperature_range(struct amdgpu_device *adev,
 					    int min_temp, int max_temp);
 static int kv_init_fps_limits(struct amdgpu_device *adev);
 
-static void kv_dpm_powergate_uvd(void *handle, bool gate);
 static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate);
 static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate);
 
@@ -1388,7 +1387,8 @@ static void kv_dpm_disable(struct amdgpu_device *adev)
 	kv_dpm_powergate_samu(adev, false);
 	if (pi->caps_vce_pg) /* power on the VCE block */
 		amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
-	kv_dpm_powergate_uvd(adev, false);
+	if (pi->caps_uvd_pg) /* power off the UVD block */
+		amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_UVDPowerON);
 
 	kv_enable_smc_cac(adev, false);
 	kv_enable_didt(adev, false);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1535100626-14880-3-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Tested-by
#5 lore raw

Re: [PATCH 3/3] drm/amdgpu: Power on uvd block when hw_fini

Quoted 23 lines · Rex Zhu

when hw_fini/suspend, smu only need to power on uvd block if uvd pg is supported, don't need to call uvd to do hw_init.

v2: fix typo in patch descriptions.

---
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -1
index b497c37..ce81a53 100644
@@ -65,7 +65,6 @@ static int kv_set_thermal_temperature_range(struct amdgpu_device *adev,
 					    int min_temp, int max_temp);
 static int kv_init_fps_limits(struct amdgpu_device *adev);
 
-static void kv_dpm_powergate_uvd(void *handle, bool gate);
 static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate);
 static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate);
 

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static void kv_dpm_disable(struct amdgpu_device *adev) · line 1391

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +2 -1
@@ -1388,7 +1387,8 @@ static void kv_dpm_disable(struct amdgpu_device *adev)
 	kv_dpm_powergate_samu(adev, false);
 	if (pi->caps_vce_pg) /* power on the VCE block */
 		amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
-	kv_dpm_powergate_uvd(adev, false);
+	if (pi->caps_uvd_pg) /* power off the UVD block */
+		amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_UVDPowerON);

This comment still seems inconsistent with the code.

Apart from that, this series is

Thanks!

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c1928832-62f1-a94d-75b9-6c94cd290f78-otUistvHUpPR7s880joybQ@public.gmane.org

author
#7 lore raw

RE: [PATCH 3/3] drm/amdgpu: Power on uvd block when hw_fini

Quoted 41 lines

-----Original Message-----
From: Michel Dänzer <[email protected]>
Sent: Friday, August 24, 2018 5:31 PM
To: Zhu, Rex <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: Power on uvd block when hw_fini

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static int kv_set_thermal_temperature_range(struct

Quoted 16 lines · Rex Zhu

when hw_fini/suspend, smu only need to power on uvd block if uvd pg is supported, don't need to call uvd to do hw_init.

v2: fix typo in patch descriptions.

---
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
index b497c37..ce81a53 100644
@@ -65,7 +65,6 @@ static int kv_set_thermal_temperature_range(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static int kv_set_thermal_temperature_range(struct · line 65

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
 					    int min_temp, int max_temp);  static

int

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static void kv_dpm_disable(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -1
 kv_init_fps_limits(struct amdgpu_device *adev);
 
-static void kv_dpm_powergate_uvd(void *handle, bool gate);  static
 void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate);

static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate);

drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
@@ -1388,7 +1387,8 @@ static void kv_dpm_disable(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static void kv_dpm_disable(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
 	kv_dpm_powergate_samu(adev, false);
 	if (pi->caps_vce_pg) /* power on the VCE block */
 		amdgpu_kv_notify_message_to_smu(adev,
Quoted 7 lines

PPSMC_MSG_VCEPowerON);

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static void kv_dpm_disable(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +2 -1
-	kv_dpm_powergate_uvd(adev, false);
+	if (pi->caps_uvd_pg) /* power off the UVD block */
+		amdgpu_kv_notify_message_to_smu(adev,

PPSMC_MSG_UVDPowerON);

This comment still seems inconsistent with the code.

Thanks. I will fix it immediately.

Regards
Rex

Quoted 11 lines

Apart from that, this series is

Thanks!

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BYAPR12MB277532F8FDF09FCBF55B6123FB360-ZGDeBxoHBPmJeBUhB162ZQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by
#9 lore raw

Re: [PATCH 3/3] drm/amdgpu: Power on uvd block when hw_fini

Quoted 43 lines · Rex
Quoted 43 lines

-----Original Message-----
From: Michel Dänzer <[email protected]>
Sent: Friday, August 24, 2018 5:31 PM
To: Zhu, Rex <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 3/3] drm/amdgpu: Power on uvd block when hw_fini

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static int kv_set_thermal_temperature_range(struct

Quoted 16 lines · Rex Zhu

when hw_fini/suspend, smu only need to power on uvd block if uvd pg is supported, don't need to call uvd to do hw_init.

v2: fix typo in patch descriptions.

---
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
index b497c37..ce81a53 100644
@@ -65,7 +65,6 @@ static int kv_set_thermal_temperature_range(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static int kv_set_thermal_temperature_range(struct · line 65

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
                                        int min_temp, int max_temp);  static

int

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static void kv_dpm_disable(struct

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -1
 kv_init_fps_limits(struct amdgpu_device *adev);
 
-static void kv_dpm_powergate_uvd(void *handle, bool gate);  static
 void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate);

static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate);

drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
@@ -1388,7 +1387,8 @@ static void kv_dpm_disable(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static void kv_dpm_disable(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +0 -0
    kv_dpm_powergate_samu(adev, false);
    if (pi->caps_vce_pg) /* power on the VCE block */
            amdgpu_kv_notify_message_to_smu(adev,

PPSMC_MSG_VCEPowerON);

Quoted 8 lines
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/kv_dpm.c static void kv_dpm_disable(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +2 -1
-   kv_dpm_powergate_uvd(adev, false);
+   if (pi->caps_uvd_pg) /* power off the UVD block */
+           amdgpu_kv_notify_message_to_smu(adev,

PPSMC_MSG_UVDPowerON);

This comment still seems inconsistent with the code.

Thanks. I will fix it immediately.

With the comment fixed the series is:

Quoted 13 lines

Regards
Rex

Quoted 8 lines

Apart from that, this series is

Thanks!

Quoted 7 lines
Quoted 3 lines

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx