Skip to contentSkip to conversation

drm/amdgpu: refine cz uvd clock gate logic.

PATCH In review Rex Zhu 4 participants 4 messages Nov 11, 2016 – Nov 14, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: refine cz uvd clock gate logic.

sw clockgate was used on uvd6.0.
when uvd is idle, we gate the uvd clock.
when decode, we ungate the uvd clock.

Change-Id I79ecdc5d0f48e97919386a08acca994f1fa05484
---
 drivers/gpu/drm/amd/amdgpu/cz_dpm.c                       | 6 ++----
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/cz_dpm.c +2 -4
index 41fa351..ba2b66b 100644
@@ -2111,9 +2111,8 @@ static void cz_dpm_powergate_uvd(struct amdgpu_device *adev, bool gate)
 
 	if (gate) {
 		if (pi->caps_uvd_pg) {
-			/* disable clockgating so we can properly shut down the block */
 			ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
-							    AMD_CG_STATE_UNGATE);
+							    AMD_CG_STATE_GATE);
 			if (ret) {
 				DRM_ERROR("UVD DPM Power Gating failed to set clockgating state\n");
 				return;
@@ -2159,9 +2158,8 @@ static void cz_dpm_powergate_uvd(struct amdgpu_device *adev, bool gate)
 				return;
 			}
 
-			/* enable clockgating. hw will dynamically gate/ungate clocks on the fly */
 			ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
-							    AMD_CG_STATE_GATE);
+							    AMD_CG_STATE_UNGATE);
 			if (ret) {
 				DRM_ERROR("UVD DPM Power Gating Failed to set clockgating state\n");
 				return;
drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c +2 -2
index 2028980..b0c63c5 100644
@@ -169,7 +169,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
 	if (bgate) {
 		cgs_set_clockgating_state(hwmgr->device,
 						AMD_IP_BLOCK_TYPE_UVD,
-						AMD_CG_STATE_UNGATE);
+						AMD_CG_STATE_GATE);
 		cgs_set_powergating_state(hwmgr->device,
 						AMD_IP_BLOCK_TYPE_UVD,
 						AMD_PG_STATE_GATE);
@@ -182,7 +182,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
 						AMD_CG_STATE_UNGATE);
 		cgs_set_clockgating_state(hwmgr->device,
 						AMD_IP_BLOCK_TYPE_UVD,
-						AMD_PG_STATE_GATE);
+						AMD_PG_STATE_UNGATE);
 		cz_dpm_update_uvd_dpm(hwmgr, 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): 1478841892-30332-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 6 lines · Rex Zhu

sw clockgate was used on uvd6.0.
when uvd is idle, we gate the uvd clock.
when decode, we ungate the uvd clock.

Change-Id I79ecdc5d0f48e97919386a08acca994f1fa05484
Quoted 56 lines
---
 drivers/gpu/drm/amd/amdgpu/cz_dpm.c                       | 6 ++----
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/cz_dpm.c +2 -4
index 41fa351..ba2b66b 100644
@@ -2111,9 +2111,8 @@ static void cz_dpm_powergate_uvd(struct amdgpu_device *adev, bool gate)
 
        if (gate) {
                if (pi->caps_uvd_pg) {
-                       /* disable clockgating so we can properly shut down the block */
                        ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
-                                                           AMD_CG_STATE_UNGATE);
+                                                           AMD_CG_STATE_GATE);
                        if (ret) {
                                DRM_ERROR("UVD DPM Power Gating failed to set clockgating state\n");
                                return;
@@ -2159,9 +2158,8 @@ static void cz_dpm_powergate_uvd(struct amdgpu_device *adev, bool gate)
                                return;
                        }
 
-                       /* enable clockgating. hw will dynamically gate/ungate clocks on the fly */
                        ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD,
-                                                           AMD_CG_STATE_GATE);
+                                                           AMD_CG_STATE_UNGATE);
                        if (ret) {
                                DRM_ERROR("UVD DPM Power Gating Failed to set clockgating state\n");
                                return;
drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c +2 -3
index 2028980..b0c63c5 100644
@@ -169,7 +169,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
        if (bgate) {
                cgs_set_clockgating_state(hwmgr->device,
                                                AMD_IP_BLOCK_TYPE_UVD,
-                                               AMD_CG_STATE_UNGATE);
+                                               AMD_CG_STATE_GATE);
                cgs_set_powergating_state(hwmgr->device,
                                                AMD_IP_BLOCK_TYPE_UVD,
                                                AMD_PG_STATE_GATE);
@@ -182,7 +182,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
                                                AMD_CG_STATE_UNGATE);
                cgs_set_clockgating_state(hwmgr->device,
                                                AMD_IP_BLOCK_TYPE_UVD,
-                                               AMD_PG_STATE_GATE);
+                                               AMD_PG_STATE_UNGATE);
                cz_dpm_update_uvd_dpm(hwmgr, false);
        }
 
--

1.9.1

Quoted 4 lines

_______________________________________________
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

Reviewed-by Alex Deucher
#3 lore raw
In reply to a message not in the archive
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Friday, November 11, 2016 12:25 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: refine cz uvd clock gate logic.

Quoted 6 lines

sw clockgate was used on uvd6.0.
when uvd is idle, we gate the uvd clock.
when decode, we ungate the uvd clock.

Change-Id I79ecdc5d0f48e97919386a08acca994f1fa05484

Assuming clockgating still works properly:

Quoted 72 lines
---
 drivers/gpu/drm/amd/amdgpu/cz_dpm.c                       | 6 ++----
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -1
index 41fa351..ba2b66b 100644
@@ -2111,9 +2111,8 @@ static void cz_dpm_powergate_uvd(struct
 amdgpu_device *adev, bool gate)
 
 	if (gate) {
 		if (pi->caps_uvd_pg) {
-			/* disable clockgating so we can properly shut down

the block */
ret = amdgpu_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,
-
AMD_CG_STATE_UNGATE);
+
AMD_CG_STATE_GATE);

drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -0
 			if (ret) {
 				DRM_ERROR("UVD DPM Power Gating failed

to set clockgating state\n");

drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -1
 				return;
@@ -2159,9 +2158,8 @@ static void cz_dpm_powergate_uvd(struct
 amdgpu_device *adev, bool gate)
 				return;
 			}
 
-			/* enable clockgating. hw will dynamically

gate/ungate clocks on the fly */
ret = amdgpu_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,
-
AMD_CG_STATE_GATE);
+
AMD_CG_STATE_UNGATE);

drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -0
 			if (ret) {
 				DRM_ERROR("UVD DPM Power Gating Failed

to set clockgating state\n");

drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -0
 				return;
drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c +1 -1
index 2028980..b0c63c5 100644
@@ -169,7 +169,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr
 *hwmgr, bool bgate)
 	if (bgate) {
 		cgs_set_clockgating_state(hwmgr->device,
 						AMD_IP_BLOCK_TYPE_UVD,
-						AMD_CG_STATE_UNGATE);
+						AMD_CG_STATE_GATE);
 		cgs_set_powergating_state(hwmgr->device,
 						AMD_IP_BLOCK_TYPE_UVD,
drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c +1 -2
 						AMD_PG_STATE_GATE);
@@ -182,7 +182,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr
 *hwmgr, bool bgate)
 						AMD_CG_STATE_UNGATE);
 		cgs_set_clockgating_state(hwmgr->device,
 						AMD_IP_BLOCK_TYPE_UVD,
-						AMD_PG_STATE_GATE);
+						AMD_PG_STATE_UNGATE);
 		cz_dpm_update_uvd_dpm(hwmgr, false);
 	}
 
--

1.9.1

Quoted 4 lines

_______________________________________________
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

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

Reviewed-by Alex Deucher
#5 lore raw

I just tried it on my Carrizo this morning (after sending out the dce6 patch) and everything seems peachy.

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Deucher, Alexander <[email protected]>
Sent: Monday, November 14, 2016 11:56
To: Zhu, Rex; [email protected]
Cc: Zhu, Rex
Subject: RE: [PATCH] drm/amdgpu: refine cz uvd clock gate logic.

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Rex Zhu
Sent: Friday, November 11, 2016 12:25 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: refine cz uvd clock gate logic.

Quoted 6 lines

sw clockgate was used on uvd6.0.
when uvd is idle, we gate the uvd clock.
when decode, we ungate the uvd clock.

Change-Id I79ecdc5d0f48e97919386a08acca994f1fa05484

Assuming clockgating still works properly:

Quoted 72 lines
---
 drivers/gpu/drm/amd/amdgpu/cz_dpm.c                       | 6 ++----
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c | 4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -1
index 41fa351..ba2b66b 100644
@@ -2111,9 +2111,8 @@ static void cz_dpm_powergate_uvd(struct
 amdgpu_device *adev, bool gate)
 
       if (gate) {
               if (pi->caps_uvd_pg) {
-                     /* disable clockgating so we can properly shut down

the block */
ret = amdgpu_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,
-
AMD_CG_STATE_UNGATE);
+
AMD_CG_STATE_GATE);
if (ret) {
DRM_ERROR("UVD DPM Power Gating failed

to set clockgating state\n");
                               return;
drivers/gpu/drm/amd/amdgpu/cz_dpm.c +0 -1
@@ -2159,9 +2158,8 @@ static void cz_dpm_powergate_uvd(struct
 amdgpu_device *adev, bool gate)
                               return;
                       }
 
-                     /* enable clockgating. hw will dynamically

gate/ungate clocks on the fly */
ret = amdgpu_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,
-
AMD_CG_STATE_GATE);
+
AMD_CG_STATE_UNGATE);
if (ret) {
DRM_ERROR("UVD DPM Power Gating Failed

to set clockgating state\n");
                               return;
drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c +1 -1
index 2028980..b0c63c5 100644
@@ -169,7 +169,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr
 *hwmgr, bool bgate)
       if (bgate) {
               cgs_set_clockgating_state(hwmgr->device,
                                               AMD_IP_BLOCK_TYPE_UVD,
-                                             AMD_CG_STATE_UNGATE);
+                                             AMD_CG_STATE_GATE);
               cgs_set_powergating_state(hwmgr->device,
                                               AMD_IP_BLOCK_TYPE_UVD,
                                               AMD_PG_STATE_GATE);
drivers/gpu/drm/amd/powerplay/hwmgr/cz_clockpowergating.c +1 -2
@@ -182,7 +182,7 @@ int cz_dpm_powergate_uvd(struct pp_hwmgr
 *hwmgr, bool bgate)
                                               AMD_CG_STATE_UNGATE);
               cgs_set_clockgating_state(hwmgr->device,
                                               AMD_IP_BLOCK_TYPE_UVD,
-                                             AMD_PG_STATE_GATE);
+                                             AMD_PG_STATE_UNGATE);
               cz_dpm_update_uvd_dpm(hwmgr, false);
       }
 
--

1.9.1

Quoted 4 lines

_______________________________________________
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

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