Skip to contentSkip to conversation

drm/amd/powerplay: add max_power_limit to pp_hwmgr

PATCH In review Aleksandr Mezin 2 participants 3 messages Oct 3, 2018 – Oct 11, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amd/powerplay: add max_power_limit to pp_hwmgr

And initialize it to the default limit for now. Will allow increasing the power limit on select cards.

---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h         | 2 +-
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c          | 8 ++++----
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   | 2 ++
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c | 1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c     | 1 +
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h              | 1 +
 6 files changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -1
index bd7404532029..be6c6c9eb5d1 100644
@@ -243,7 +243,7 @@ struct amd_pm_funcs {
 				uint32_t block_type, bool gate);
 	int (*set_clockgating_by_smu)(void *handle, uint32_t msg_id);
 	int (*set_power_limit)(void *handle, uint32_t n);
-	int (*get_power_limit)(void *handle, uint32_t *limit, bool default_limit);
+	int (*get_power_limit)(void *handle, uint32_t *limit, bool max_limit);
 	int (*get_power_profile_mode)(void *handle, char *buf);
 	int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
 	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size);
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -4
index da4ebff5b74d..b8c96b6d4923 100644
@@ -937,7 +937,7 @@ static int pp_set_power_limit(void *handle, uint32_t limit)
 	if (limit == 0)
 		limit = hwmgr->default_power_limit;
 
-	if (limit > hwmgr->default_power_limit)
+	if (limit > hwmgr->max_power_limit)
 		return -EINVAL;
 
 	mutex_lock(&hwmgr->smu_lock);
@@ -947,7 +947,7 @@ static int pp_set_power_limit(void *handle, uint32_t limit)
 	return 0;
 }
 
-static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
+static int pp_get_power_limit(void *handle, uint32_t *limit, bool max_limit)
 {
 	struct pp_hwmgr *hwmgr = handle;
 
@@ -956,8 +956,8 @@ static int pp_get_power_limit(void *handle, uint32_t *limit, bool default_limit)
 
 	mutex_lock(&hwmgr->smu_lock);
 
-	if (default_limit)
-		*limit = hwmgr->default_power_limit;
+	if (max_limit)
+		*limit = hwmgr->max_power_limit;
 	else
 		*limit = hwmgr->power_limit;
 
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c +2 -0
index 5e19f5977eb1..5e273c8cd0c4 100644
@@ -1140,6 +1140,8 @@ int smu7_enable_power_containment(struct pp_hwmgr *hwmgr)
 			if (0 == smc_result) {
 				hwmgr->default_power_limit = hwmgr->power_limit =
 						cac_table->usMaximumPowerDeliveryLimit;
+				hwmgr->max_power_limit =
+						hwmgr->default_power_limit;
 				data->power_containment_features |=
 						POWERCONTAINMENT_FEATURE_PkgPwrLimit;
 
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c +1 -0
index 2d88abf97e7b..a6432f9a75b4 100644
@@ -1342,6 +1342,7 @@ int vega10_enable_power_containment(struct pp_hwmgr *hwmgr)
 
 	hwmgr->default_power_limit = hwmgr->power_limit =
 			(uint32_t)(tdp_table->usMaximumPowerDeliveryLimit);
+	hwmgr->max_power_limit = hwmgr->default_power_limit;
 
 	if (PP_CAP(PHM_PlatformCaps_PowerContainment)) {
 		if (data->smu_features[GNLD_PPT].supported)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1 -0
index 7884ae3b1922..56060b943e7a 100644
@@ -1554,6 +1554,7 @@ static int vega20_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
 			return result);
 	hwmgr->power_limit =
 		hwmgr->default_power_limit = smum_get_argument(hwmgr);
+	hwmgr->max_power_limit = hwmgr->default_power_limit;
 
 	return 0;
 }
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index a6d92128b19c..094d25831e57 100644
@@ -764,6 +764,7 @@ struct pp_hwmgr {
 	bool od_enabled;
 	uint32_t power_limit;
 	uint32_t default_power_limit;
+	uint32_t max_power_limit;
 	uint32_t workload_mask;
 	uint32_t workload_prority[Workload_Policy_Max];
 	uint32_t workload_setting[Workload_Policy_Max];
Signature · 6 lines
2.19.0

_______________________________________________
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): 20181003220300.5931-1-mezin.alexander-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amd/vega10: allow increased power limit

Allow setting the power limit to 150% of the default one, like Windows driver does.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c +2 -1
index a6432f9a75b4..8218aa9189da 100644
@@ -1342,7 +1342,8 @@ int vega10_enable_power_containment(struct pp_hwmgr *hwmgr)
 
 	hwmgr->default_power_limit = hwmgr->power_limit =
 			(uint32_t)(tdp_table->usMaximumPowerDeliveryLimit);
-	hwmgr->max_power_limit = hwmgr->default_power_limit;
+	hwmgr->max_power_limit = hwmgr->default_power_limit +
+			hwmgr->default_power_limit / 2;
 
 	if (PP_CAP(PHM_PlatformCaps_PowerContainment)) {
 		if (data->smu_features[GNLD_PPT].supported)
Signature · 6 lines
2.19.0

_______________________________________________
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): 20181003220300.5931-2-mezin.alexander-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] drm/amd/vega10: allow increased power limit

Quoted 3 lines · Aleksandr Mezin

Allow setting the power limit to 150% of the default one, like Windows driver does.

Please see this patch:
https://patchwork.freedesktop.org/patch/255970/
This matches what the windows driver does.

Alex

Quoted 23 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_powertune.c +2 -2
index a6432f9a75b4..8218aa9189da 100644
@@ -1342,7 +1342,8 @@ int vega10_enable_power_containment(struct pp_hwmgr *hwmgr)
 
        hwmgr->default_power_limit = hwmgr->power_limit =
                        (uint32_t)(tdp_table->usMaximumPowerDeliveryLimit);
-       hwmgr->max_power_limit = hwmgr->default_power_limit;
+       hwmgr->max_power_limit = hwmgr->default_power_limit +
+                       hwmgr->default_power_limit / 2;
 
        if (PP_CAP(PHM_PlatformCaps_PowerContainment)) {
                if (data->smu_features[GNLD_PPT].supported)
--

2.19.0

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