Skip to contentSkip to conversation

drm/amd/powerplay: initialize uvd/vce powergate status v3

PATCH In review Evan Quan 4 participants 5 messages Jun 20, 2018 – Jun 29, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: initialize uvd/vce powergate status v3

On UVD/VCE dpm enabled/disabled, the powergate status will be set as false/true. So that we will not try to ungate/gate them( enable/disable their dpm) again.

v2: added check for uvd/vce powergate status before gating
v3: fix typo in description

Change-Id I569a5aa216b5e7d64a2b504f2ff98cc83ca802d5
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c +23 -0
index 45c8f2d..28b172e 100644
@@ -777,6 +777,21 @@ static int vega12_set_allowed_featuresmask(struct pp_hwmgr *hwmgr)
 	return 0;
 }
 
+static void vega12_init_powergate_state(struct pp_hwmgr *hwmgr)
+{
+	struct vega12_hwmgr *data =
+			(struct vega12_hwmgr *)(hwmgr->backend);
+
+	data->uvd_power_gated = true;
+	data->vce_power_gated = true;
+
+	if (data->smu_features[GNLD_DPM_UVD].enabled)
+		data->uvd_power_gated = false;
+
+	if (data->smu_features[GNLD_DPM_VCE].enabled)
+		data->vce_power_gated = false;
+}
+
 static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
 {
 	struct vega12_hwmgr *data =
@@ -801,6 +816,8 @@ static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
 		}
 	}
 
+	vega12_init_powergate_state(hwmgr);
+
 	return 0;
 }
 
@@ -1985,6 +2002,9 @@ static void vega12_power_gate_vce(struct pp_hwmgr *hwmgr, bool bgate)
 {
 	struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+	if (data->vce_power_gated == bgate)
+		return 0;
+
 	data->vce_power_gated = bgate;
 	vega12_enable_disable_vce_dpm(hwmgr, !bgate);
 }
@@ -1993,6 +2013,9 @@ static void vega12_power_gate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
 {
 	struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+	if (data->uvd_power_gated == bgate)
+		return 0;
+
 	data->uvd_power_gated = bgate;
 	vega12_enable_disable_uvd_dpm(hwmgr, !bgate);
 }
Signature · 6 lines
2.7.4

_______________________________________________
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): 1529476835-11315-1-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 9 lines · Evan Quan

On UVD/VCE dpm enabled/disabled, the powergate status will be set as false/true. So that we will not try to ungate/gate them( enable/disable their dpm) again.

v2: added check for uvd/vce powergate status before gating
v3: fix typo in description

Change-Id I569a5aa216b5e7d64a2b504f2ff98cc83ca802d5
Quoted 62 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c +23 -1
index 45c8f2d..28b172e 100644
@@ -777,6 +777,21 @@ static int vega12_set_allowed_featuresmask(struct pp_hwmgr *hwmgr)
        return 0;
 }
 
+static void vega12_init_powergate_state(struct pp_hwmgr *hwmgr)
+{
+       struct vega12_hwmgr *data =
+                       (struct vega12_hwmgr *)(hwmgr->backend);
+
+       data->uvd_power_gated = true;
+       data->vce_power_gated = true;
+
+       if (data->smu_features[GNLD_DPM_UVD].enabled)
+               data->uvd_power_gated = false;
+
+       if (data->smu_features[GNLD_DPM_VCE].enabled)
+               data->vce_power_gated = false;
+}
+
 static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
 {
        struct vega12_hwmgr *data =
@@ -801,6 +816,8 @@ static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
                }
        }
 
+       vega12_init_powergate_state(hwmgr);
+
        return 0;
 }
 
@@ -1985,6 +2002,9 @@ static void vega12_power_gate_vce(struct pp_hwmgr *hwmgr, bool bgate)
 {
        struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+       if (data->vce_power_gated == bgate)
+               return 0;
+
        data->vce_power_gated = bgate;
        vega12_enable_disable_vce_dpm(hwmgr, !bgate);
 }
@@ -1993,6 +2013,9 @@ static void vega12_power_gate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
 {
        struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+       if (data->uvd_power_gated == bgate)
+               return 0;
+
        data->uvd_power_gated = bgate;
        vega12_enable_disable_uvd_dpm(hwmgr, !bgate);
 }
--

2.7.4

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

#3 lore raw
In reply to a message not in the archive

Hi Evan,

Quoted 9 lines · Evan Quan

On UVD/VCE dpm enabled/disabled, the powergate status will be set as false/true. So that we will not try to ungate/gate them( enable/disable their dpm) again.

v2: added check for uvd/vce powergate status before gating
v3: fix typo in description

Change-Id I569a5aa216b5e7d64a2b504f2ff98cc83ca802d5

This patch introduced the following warnings:

CC [M] drivers/gpu/drm//amd/amdgpu/../powerplay/hwmgr/vega12_hwmgr.o
drivers/gpu/drm//amd/amdgpu/../powerplay/hwmgr/vega12_hwmgr.c: In function ‘vega12_power_gate_vce’:
drivers/gpu/drm//amd/amdgpu/../powerplay/hwmgr/vega12_hwmgr.c:2006:10: warning: ‘return’ with a value, in function returning void

   return 0;
          ^
drivers/gpu/drm//amd/amdgpu/../powerplay/hwmgr/vega12_hwmgr.c:2001:13: note: declared here
 static void vega12_power_gate_vce(struct pp_hwmgr *hwmgr, bool bgate)
             ^~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm//amd/amdgpu/../powerplay/hwmgr/vega12_hwmgr.c: In function ‘vega12_power_gate_uvd’:
drivers/gpu/drm//amd/amdgpu/../powerplay/hwmgr/vega12_hwmgr.c:2017:10: warning: ‘return’ with a value, in function returning void
   return 0;
          ^
drivers/gpu/drm//amd/amdgpu/../powerplay/hwmgr/vega12_hwmgr.c:2012:13: note: declared here
 static void vega12_power_gate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
             ^~~~~~~~~~~~~~~~~~~~~
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
#4 lore raw
In reply to a message not in the archive
Quoted 9 lines · Evan Quan

On UVD/VCE dpm enabled/disabled, the powergate status will be set as false/true. So that we will not try to ungate/gate them( enable/disable their dpm) again.

v2: added check for uvd/vce powergate status before gating
v3: fix typo in description

Change-Id I569a5aa216b5e7d64a2b504f2ff98cc83ca802d5

Does vega10 need a similar fix?

Alex

Quoted 62 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c +23 -1
index 45c8f2d..28b172e 100644
@@ -777,6 +777,21 @@ static int vega12_set_allowed_featuresmask(struct pp_hwmgr *hwmgr)
        return 0;
 }
 
+static void vega12_init_powergate_state(struct pp_hwmgr *hwmgr)
+{
+       struct vega12_hwmgr *data =
+                       (struct vega12_hwmgr *)(hwmgr->backend);
+
+       data->uvd_power_gated = true;
+       data->vce_power_gated = true;
+
+       if (data->smu_features[GNLD_DPM_UVD].enabled)
+               data->uvd_power_gated = false;
+
+       if (data->smu_features[GNLD_DPM_VCE].enabled)
+               data->vce_power_gated = false;
+}
+
 static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
 {
        struct vega12_hwmgr *data =
@@ -801,6 +816,8 @@ static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
                }
        }
 
+       vega12_init_powergate_state(hwmgr);
+
        return 0;
 }
 
@@ -1985,6 +2002,9 @@ static void vega12_power_gate_vce(struct pp_hwmgr *hwmgr, bool bgate)
 {
        struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+       if (data->vce_power_gated == bgate)
+               return 0;
+
        data->vce_power_gated = bgate;
        vega12_enable_disable_vce_dpm(hwmgr, !bgate);
 }
@@ -1993,6 +2013,9 @@ static void vega12_power_gate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
 {
        struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+       if (data->uvd_power_gated == bgate)
+               return 0;
+
        data->uvd_power_gated = bgate;
        vega12_enable_disable_uvd_dpm(hwmgr, !bgate);
 }
--

2.7.4

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): CADnq5_PM77A24XoD-XQpPD_QZ7iHrkNgXjDsDEaGZybHOa=fQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Do we need to maintain the uvd/vce pg state in pp?

uvd/vce have maintained the pg state by themselves.

pp only provide an interface for uvd/vce/gfx/mmhub to power up/down the ip through smu if smu supported, concurrently enable/disable uvd/vce/mmhub dpm feature.

Best Regards

Rex

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Alex Deucher <[email protected]>
Sent: Thursday, June 28, 2018 11:31 PM
To: Quan, Evan
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amd/powerplay: initialize uvd/vce powergate status v3

Quoted 9 lines · Evan Quan

On UVD/VCE dpm enabled/disabled, the powergate status will be set as false/true. So that we will not try to ungate/gate them( enable/disable their dpm) again.

v2: added check for uvd/vce powergate status before gating
v3: fix typo in description

Change-Id I569a5aa216b5e7d64a2b504f2ff98cc83ca802d5

Does vega10 need a similar fix?

Alex

Quoted 62 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c +23 -1
index 45c8f2d..28b172e 100644
@@ -777,6 +777,21 @@ static int vega12_set_allowed_featuresmask(struct pp_hwmgr *hwmgr)
        return 0;
 }
 
+static void vega12_init_powergate_state(struct pp_hwmgr *hwmgr)
+{
+       struct vega12_hwmgr *data =
+                       (struct vega12_hwmgr *)(hwmgr->backend);
+
+       data->uvd_power_gated = true;
+       data->vce_power_gated = true;
+
+       if (data->smu_features[GNLD_DPM_UVD].enabled)
+               data->uvd_power_gated = false;
+
+       if (data->smu_features[GNLD_DPM_VCE].enabled)
+               data->vce_power_gated = false;
+}
+
 static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
 {
        struct vega12_hwmgr *data =
@@ -801,6 +816,8 @@ static int vega12_enable_all_smu_features(struct pp_hwmgr *hwmgr)
                }
        }
 
+       vega12_init_powergate_state(hwmgr);
+
        return 0;
 }
 
@@ -1985,6 +2002,9 @@ static void vega12_power_gate_vce(struct pp_hwmgr *hwmgr, bool bgate)
 {
        struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+       if (data->vce_power_gated == bgate)
+               return 0;
+
        data->vce_power_gated = bgate;
        vega12_enable_disable_vce_dpm(hwmgr, !bgate);
 }
@@ -1993,6 +2013,9 @@ static void vega12_power_gate_uvd(struct pp_hwmgr *hwmgr, bool bgate)
 {
        struct vega12_hwmgr *data = (struct vega12_hwmgr *)(hwmgr->backend);
 
+       if (data->uvd_power_gated == bgate)
+               return 0;
+
        data->uvd_power_gated = bgate;
        vega12_enable_disable_uvd_dpm(hwmgr, !bgate);
 }
--

2.7.4

Quoted 4 lines

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

amd-gfx Info Page - freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of Conduct.

_______________________________________________
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