Skip to contentSkip to conversation

drm/amd/powerplay: issue no PPSMC_MSG_GetCurrPkgPwr on unsupported ASICs

PATCH In review Evan Quan 2 participants 2 messages Nov 14, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: issue no PPSMC_MSG_GetCurrPkgPwr on unsupported ASICs

Otherwise, the error message prompted will confuse user.

Change-Id I44b9f870a8663714d715a1d5bf2aa24abe75bb8e
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 23 +++++++++++++++----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +18 -5
index d3c3b3512a16..5c6b71b356e7 100644
@@ -3476,18 +3476,31 @@ static int smu7_get_pp_table_entry(struct pp_hwmgr *hwmgr,
 
 static int smu7_get_gpu_power(struct pp_hwmgr *hwmgr, u32 *query)
 {
+	struct amdgpu_device *adev = hwmgr->adev;
 	int i;
 	u32 tmp = 0;
 
 	if (!query)
 		return -EINVAL;
 
-	smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_GetCurrPkgPwr, 0);
-	tmp = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0);
-	*query = tmp;
+	/*
+	 * PPSMC_MSG_GetCurrPkgPwr is not supported on:
+	 *  - Hawaii
+	 *  - Bonaire
+	 *  - Fiji
+	 *  - Tonga
+	 */
+	if ((adev->asic_type != CHIP_HAWAII) &&
+	    (adev->asic_type != CHIP_BONAIRE) &&
+	    (adev->asic_type != CHIP_FIJI) &&
+	    (adev->asic_type != CHIP_TONGA)) {
+		smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_GetCurrPkgPwr, 0);
+		tmp = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0);
+		*query = tmp;
 
-	if (tmp != 0)
-		return 0;
+		if (tmp != 0)
+			return 0;
+	}
 
 	smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PmStatusLogStart);
 	cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,
Signature · 6 lines
2.24.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): [email protected]

#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Evan Quan <[email protected]>
Sent: Thursday, November 14, 2019 2:33 AM
To: [email protected] <[email protected]>
Cc: Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/powerplay: issue no PPSMC_MSG_GetCurrPkgPwr on unsupported ASICs

Otherwise, the error message prompted will confuse user.

Change-Id I44b9f870a8663714d715a1d5bf2aa24abe75bb8e
---
 .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c  | 23 +++++++++++++++----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +18 -5
index d3c3b3512a16..5c6b71b356e7 100644
@@ -3476,18 +3476,31 @@ static int smu7_get_pp_table_entry(struct pp_hwmgr *hwmgr,
 
 static int smu7_get_gpu_power(struct pp_hwmgr *hwmgr, u32 *query)
 {
+       struct amdgpu_device *adev = hwmgr->adev;
         int i;
         u32 tmp = 0;
 
         if (!query)
                 return -EINVAL;
 
-       smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_GetCurrPkgPwr, 0);
-       tmp = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0);
-       *query = tmp;
+       /*
+        * PPSMC_MSG_GetCurrPkgPwr is not supported on:
+        *  - Hawaii
+        *  - Bonaire
+        *  - Fiji
+        *  - Tonga
+        */
+       if ((adev->asic_type != CHIP_HAWAII) &&
+           (adev->asic_type != CHIP_BONAIRE) &&
+           (adev->asic_type != CHIP_FIJI) &&
+           (adev->asic_type != CHIP_TONGA)) {
+               smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_GetCurrPkgPwr, 0);
+               tmp = cgs_read_register(hwmgr->device, mmSMC_MSG_ARG_0);
+               *query = tmp;
 
-       if (tmp != 0)
-               return 0;
+               if (tmp != 0)
+                       return 0;
+       }
 
         smum_send_msg_to_smc(hwmgr, PPSMC_MSG_PmStatusLogStart);
         cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,

--
2.24.0

_______________________________________________
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