Skip to contentSkip to conversation

drm/amd/pp: Delete debug info when set power_profile_mode

PATCH In review Rex Zhu 2 participants 5 messages Jan 30, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/4 drm/amd/pp: Delete debug info when set power_profile_mode

Change-Id I99c148903148bb7143177e023781e408a7ecffb2
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             | 1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 --
 2 files changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
index f12b9e7..39ef93a 100644
@@ -719,7 +719,6 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
 				count = -EINVAL;
 				goto fail;
 			}
-			pr_info("value is %ld \n", parameter[parameter_size]);
 			parameter_size++;
 			while (isspace(*tmp_str))
 				tmp_str++;
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -2
index 87f0660..4c259cd 100644
@@ -5095,8 +5095,6 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
 					PPSMC_MSG_SetCustomGfxDpmParameters,
 					busy_set_point | FPS<<8 |
 					use_rlc_busy << 16 | min_active_level<<24);
-				pr_info("size is %d value is %x \n", size, busy_set_point | FPS<<8 |
-					use_rlc_busy << 16 | min_active_level<<24);
 	}
 
 	return 0;
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): 1517292606-22082-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/4 drm/amd/pp: Refine pp_dpm_force_clock_level functions

Only when user set manual performance mode, driver enable pp_dpm_force_clock_level.
so check the mode in pp_dpm_force_clock_level, and delete the same logic in callback functions.

Change-Id I06cf0d7b7c0407e902155125a7d26de0140989e6
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c                | 4 +---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 5 ++++-
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 3 ---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 5 -----
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 5 -----
 5 files changed, 5 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -3
index 5ceb5a2..5f61e70 100644
@@ -6639,9 +6639,7 @@ static int ci_dpm_force_clock_level(void *handle,
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct ci_power_info *pi = ci_get_pi(adev);
 
-	if (adev->pm.dpm.forced_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
+	if (adev->pm.dpm.forced_level != AMD_DPM_FORCED_LEVEL_MANUAL)
 		return -EINVAL;
 
 	switch (type) {
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -1
index 173382c..2aa0731 100644
@@ -839,7 +839,10 @@ static int pp_dpm_force_clock_level(void *handle,
 		return 0;
 	}
 	mutex_lock(&pp_handle->pp_lock);
-	hwmgr->hwmgr_func->force_clock_level(hwmgr, type, mask);
+	if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)
+		ret = hwmgr->hwmgr_func->force_clock_level(hwmgr, type, mask);
+	else
+		ret = -EINVAL;
 	mutex_unlock(&pp_handle->pp_lock);
 	return ret;
 }
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +0 -3
index 1394b2b..5a7b99f 100644
@@ -1558,9 +1558,6 @@ static int cz_get_dal_power_level(struct pp_hwmgr *hwmgr,
 static int cz_force_clock_level(struct pp_hwmgr *hwmgr,
 		enum pp_clock_type type, uint32_t mask)
 {
-	if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		smum_send_msg_to_smc_with_parameter(hwmgr,
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -5
index 21b9fa2..0c2e025 100644
@@ -4296,11 +4296,6 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-					AMD_DPM_FORCED_LEVEL_LOW |
-					AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		if (!data->sclk_dpm_key_disabled)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -5
index 4c259cd..5e3c63f 100644
@@ -4500,11 +4500,6 @@ static int vega10_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct vega10_hwmgr *data = (struct vega10_hwmgr *)(hwmgr->backend);
 
-	if (hwmgr->request_dpm_level & (AMD_DPM_FORCED_LEVEL_AUTO |
-				AMD_DPM_FORCED_LEVEL_LOW |
-				AMD_DPM_FORCED_LEVEL_HIGH))
-		return -EINVAL;
-
 	switch (type) {
 	case PP_SCLK:
 		data->smc_state_table.gfx_boot_level = mask ? (ffs(mask) - 1) : 0;
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/4 drm/amd/pp: Enable pp_set_power_profile_mode under manual mode

In reply to a message not in the archive

Only user enter manual performance mode, driver allow user configure the sclk/mclk dpm parameters through sysfs pp_power_profile_mode.

Change-Id I97aa7d30ebba3a672d4976c257683c927d30d25c
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +6 -2
index 2aa0731..13879d2 100644
@@ -1088,6 +1088,7 @@ static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
 {
 	struct pp_hwmgr *hwmgr;
 	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	int ret = -EINVAL;
 
 	if (pp_check(pp_handle))
 		return -EINVAL;
@@ -1098,8 +1099,11 @@ static int pp_set_power_profile_mode(void *handle, long *input, uint32_t size)
 		pr_info("%s was not implemented.\n", __func__);
 		return -EINVAL;
 	}
-
-	return hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, input, size);
+	mutex_lock(&pp_handle->pp_lock);
+	if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)
+		ret = hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, input, size);
+	mutex_unlock(&pp_handle->pp_lock);
+	return ret;
 }
 
 static int pp_odn_edit_dpm_table(void *handle, uint32_t type, long *input, uint32_t size)
Signature · 6 lines
1.9.1

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

PATCH 4/4 drm/amd/pp: Fix sysfs pp_dpm_pcie bug on CI/VI

In reply to a message not in the archive

when echo "01">pp_dpm_pcie
the pcie dpm will fix in highest link speed.
But user should expect auto speed between
level 0 and level1

Change-Id I89b8fef3c179c3729b1c06b17e9cb86b52244d7b
---
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c              | 17 ++++++++++-------
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 17 ++++++++++-------
 2 files changed, 20 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +10 -7
index 5f61e70..f82f40f 100644
@@ -6642,6 +6642,9 @@ static int ci_dpm_force_clock_level(void *handle,
 	if (adev->pm.dpm.forced_level != AMD_DPM_FORCED_LEVEL_MANUAL)
 		return -EINVAL;
 
+	if (mask == 0)
+		return -EINVAL;
+
 	switch (type) {
 	case PP_SCLK:
 		if (!pi->sclk_dpm_key_disabled)
@@ -6660,15 +6663,15 @@ static int ci_dpm_force_clock_level(void *handle,
 	case PP_PCIE:
 	{
 		uint32_t tmp = mask & pi->dpm_level_enable_mask.pcie_dpm_enable_mask;
-		uint32_t level = 0;
 
-		while (tmp >>= 1)
-			level++;
-
-		if (!pi->pcie_dpm_key_disabled)
-			amdgpu_ci_send_msg_to_smc_with_parameter(adev,
+		if (!pi->pcie_dpm_key_disabled) {
+			if (fls(tmp) != ffs(tmp))
+				amdgpu_ci_send_msg_to_smc(adev, PPSMC_MSG_PCIeDPM_UnForceLevel);
+			else
+				amdgpu_ci_send_msg_to_smc_with_parameter(adev,
 					PPSMC_MSG_PCIeDPM_ForceLevel,
-					level);
+					fls(tmp) - 1);
+		}
 		break;
 	}
 	default:
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +10 -7
index 0c2e025..c59cb94 100644
@@ -4296,6 +4296,9 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 {
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 
+	if (mask == 0)
+		return -EINVAL;
+
 	switch (type) {
 	case PP_SCLK:
 		if (!data->sclk_dpm_key_disabled)
@@ -4312,15 +4315,15 @@ static int smu7_force_clock_level(struct pp_hwmgr *hwmgr,
 	case PP_PCIE:
 	{
 		uint32_t tmp = mask & data->dpm_level_enable_mask.pcie_dpm_enable_mask;
-		uint32_t level = 0;
 
-		while (tmp >>= 1)
-			level++;
-
-		if (!data->pcie_dpm_key_disabled)
-			smum_send_msg_to_smc_with_parameter(hwmgr,
+		if (!data->pcie_dpm_key_disabled) {
+			if (fls(tmp) != ffs(tmp))
+				smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PCIeDPM_UnForceLevel);
+			else
+				smum_send_msg_to_smc_with_parameter(hwmgr,
 					PPSMC_MSG_PCIeDPM_ForceLevel,
-					level);
+					fls(tmp) - 1);
+		}
 		break;
 	}
 	default:
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#5 lore raw
In reply to a message not in the archive
Quoted 2 lines · Rex Zhu
Change-Id I99c148903148bb7143177e023781e408a7ecffb2

Series is:

Quoted 33 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c             | 1 -
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 2 --
 2 files changed, 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +0 -1
index f12b9e7..39ef93a 100644
@@ -719,7 +719,6 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
                                count = -EINVAL;
                                goto fail;
                        }
-                       pr_info("value is %ld \n", parameter[parameter_size]);
                        parameter_size++;
                        while (isspace(*tmp_str))
                                tmp_str++;
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0 -3
index 87f0660..4c259cd 100644
@@ -5095,8 +5095,6 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui
                                        PPSMC_MSG_SetCustomGfxDpmParameters,
                                        busy_set_point | FPS<<8 |
                                        use_rlc_busy << 16 | min_active_level<<24);
-                               pr_info("size is %d value is %x \n", size, busy_set_point | FPS<<8 |
-                                       use_rlc_busy << 16 | min_active_level<<24);
        }
 
        return 0;
--

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