Skip to contentSkip to conversation

drm/amdgpu/vcn5.0.1: use correct dpm helper

PATCH In review Alex Deucher 3 participants 6 messages Feb 12, 2025

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/4 drm/amdgpu/vcn5.0.1: use correct dpm helper

The VCN and UVD helpers were split in
commit ff69bba05f08 ("drm/amd/pm: add inst to dpm_set_powergating_by_smu") However, this happened in parallel to the vcn 5.0.1 development so it was missed there.

Fixes 346492f30ce3 ("drm/amdgpu: Add VCN_5_0_1 support")
Cc Sonny Jiang <[email protected]>
Cc Boyuan Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +8 -4
index 8b463c977d08f..8b0b3739a5377 100644
@@ -575,8 +575,10 @@ static int vcn_v5_0_1_start(struct amdgpu_device *adev)
 	uint32_t tmp;
 	int i, j, k, r, vcn_inst;
 
-	if (adev->pm.dpm_enabled)
-		amdgpu_dpm_enable_uvd(adev, true);
+	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_vcn(adev, true, i);
+	}
 
 	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 		fw_shared = adev->vcn.inst[i].fw_shared.cpu_addr;
@@ -816,8 +818,10 @@ static int vcn_v5_0_1_stop(struct amdgpu_device *adev)
 		WREG32_SOC15(VCN, vcn_inst, regUVD_STATUS, 0);
 	}
 
-	if (adev->pm.dpm_enabled)
-		amdgpu_dpm_enable_uvd(adev, false);
+	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
+		if (adev->pm.dpm_enabled)
+			amdgpu_dpm_enable_vcn(adev, false, i);
+	}
 
 	return 0;
 }
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH 2/4 drm/amdgpu/vcn5.0.1: drop dpm power helpers

VCN 5.0.1 doesn't support powergating so there is
no need to call these.

---
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c +0 -10
index 8b0b3739a5377..288a77179036b 100644
@@ -575,11 +575,6 @@ static int vcn_v5_0_1_start(struct amdgpu_device *adev)
 	uint32_t tmp;
 	int i, j, k, r, vcn_inst;
 
-	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
-		if (adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_vcn(adev, true, i);
-	}
-
 	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 		fw_shared = adev->vcn.inst[i].fw_shared.cpu_addr;
 
@@ -818,11 +813,6 @@ static int vcn_v5_0_1_stop(struct amdgpu_device *adev)
 		WREG32_SOC15(VCN, vcn_inst, regUVD_STATUS, 0);
 	}
 
-	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
-		if (adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_vcn(adev, false, i);
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.48.1
author maintainer
#2 lore raw

PATCH 3/4 drm/amdgpu/vcn2.5: drop dpm power helpers

In reply to Alex Deucher

VCN 2.5 doesn't support powergating so there is
no need to call these.

---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0 -6
index b9be304aa294b..08e73d1685e92 100644
@@ -1011,9 +1011,6 @@ static int vcn_v2_5_start(struct amdgpu_device *adev, int i)
 	if (adev->vcn.harvest_config & (1 << i))
 		return 0;
 
-	if (adev->pm.dpm_enabled)
-		amdgpu_dpm_enable_vcn(adev, true, i);
-
 	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
 		return vcn_v2_5_start_dpg_mode(adev, i, adev->vcn.indirect_sram);
 
@@ -1465,9 +1462,6 @@ static int vcn_v2_5_stop(struct amdgpu_device *adev, int i)
 		 UVD_POWER_STATUS__UVD_POWER_STATUS_MASK,
 		 ~UVD_POWER_STATUS__UVD_POWER_STATUS_MASK);
 
-	if (adev->pm.dpm_enabled)
-		amdgpu_dpm_enable_vcn(adev, false, i);
-
 	return 0;
 }
 
Signature · 1 line
2.48.1
#3 lore raw

Re: [PATCH 3/4] drm/amdgpu/vcn2.5: drop dpm power helpers

Quoted 5 lines · Alex Deucher

VCN 2.5 doesn't support powergating so there is
no need to call these.

Dropping this one. VCN 2.5 doesn't support powergating, but this function gets used for other stuff in the smu code.

Alex

Quoted 31 lines
---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +0 -7
index b9be304aa294b..08e73d1685e92 100644
@@ -1011,9 +1011,6 @@ static int vcn_v2_5_start(struct amdgpu_device *adev, int i)
        if (adev->vcn.harvest_config & (1 << i))
                return 0;
 
-       if (adev->pm.dpm_enabled)
-               amdgpu_dpm_enable_vcn(adev, true, i);
-
        if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
                return vcn_v2_5_start_dpg_mode(adev, i, adev->vcn.indirect_sram);
 
@@ -1465,9 +1462,6 @@ static int vcn_v2_5_stop(struct amdgpu_device *adev, int i)
                 UVD_POWER_STATUS__UVD_POWER_STATUS_MASK,
                 ~UVD_POWER_STATUS__UVD_POWER_STATUS_MASK);
 
-       if (adev->pm.dpm_enabled)
-               amdgpu_dpm_enable_vcn(adev, false, i);
-
        return 0;
 }
 
--

2.48.1

author maintainer
#4 lore raw

PATCH 4/4 drm/amdgpu/vcn4.0.3: drop dpm power helpers

In reply to Alex Deucher

VCN 4.0.3 doesn't support powergating so there is
no need to call these.

---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +0 -10
index e09eaf4469ddf..acda694eb74ea 100644
@@ -1127,11 +1127,6 @@ static int vcn_v4_0_3_start(struct amdgpu_device *adev)
 	int i, j, k, r, vcn_inst;
 	uint32_t tmp;
 
-	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
-		if (adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_vcn(adev, true, i);
-	}
-
 	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 		if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
 			r = vcn_v4_0_3_start_dpg_mode(adev, i, adev->vcn.indirect_sram);
@@ -1403,11 +1398,6 @@ static int vcn_v4_0_3_stop(struct amdgpu_device *adev)
 		vcn_v4_0_3_enable_clock_gating(adev, i);
 	}
 Done:
-	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
-		if (adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_vcn(adev, false, i);
-	}
-
 	return 0;
 }
 
Signature · 1 line
2.48.1
Reviewed-by Acked-by on v1 4/4
#5 lore raw

Re: [PATCH 4/4] drm/amdgpu/vcn4.0.3: drop dpm power helpers

Quoted 4 lines · Alex Deucher

VCN 4.0.3 doesn't support powergating so there is
no need to call these.

Patches 1, 2 & 4

Patch 3

Thanks,
Lijo

Quoted 32 lines
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +0 -10
index e09eaf4469ddf..acda694eb74ea 100644
@@ -1127,11 +1127,6 @@ static int vcn_v4_0_3_start(struct amdgpu_device *adev)
 	int i, j, k, r, vcn_inst;
 	uint32_t tmp;
 
-	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
-		if (adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_vcn(adev, true, i);
-	}
-
 	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
 		if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG) {
 			r = vcn_v4_0_3_start_dpg_mode(adev, i, adev->vcn.indirect_sram);
@@ -1403,11 +1398,6 @@ static int vcn_v4_0_3_stop(struct amdgpu_device *adev)
 		vcn_v4_0_3_enable_clock_gating(adev, i);
 	}
 Done:
-	for (i = 0; i < adev->vcn.num_vcn_inst; ++i) {
-		if (adev->pm.dpm_enabled)
-			amdgpu_dpm_enable_vcn(adev, false, i);
-	}
-
 	return 0;
 }