Skip to contentSkip to conversation

drm/amd/powerplay: bypass fan table setup if no fan connected

PATCH In review Hawking Zhang 3 participants 3 messages Dec 1, 2016 – Dec 5, 2016 2 messages not in the archive

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

PATCH 1/1 drm/amd/powerplay: bypass fan table setup if no fan connected

If vBIOS noFan bit is set, the fan table parameters in thermal controller will not get initialized. The driver should avoid to use these uninitialized parameter to do calculation. Otherwise, it may trigger divide 0 error.

Change-Id I76680a5ec5411f59742b65bb70eb7b4a08bda3ef
---
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c      | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c   | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c     | 6 ++++++
 4 files changed, 24 insertions(+)
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c +6 -0
index 34523fe..6aeb1d2 100644
@@ -1958,6 +1958,12 @@ int fiji_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 	int res;
 	uint64_t tmp64;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (smu_data->smu7_data.fan_table_start == 0) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
 				PHM_PlatformCaps_MicrocodeFanControl);
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c +6 -0
index b579f0c..a24971a 100644
@@ -2006,6 +2006,12 @@ int iceland_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 	if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl))
 		return 0;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (0 == smu7_data->fan_table_start) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl);
 		return 0;
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +6 -0
index 8db8e20..5190e82 100644
@@ -1885,6 +1885,12 @@ int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 	int res;
 	uint64_t tmp64;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (smu_data->smu7_data.fan_table_start == 0) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
 				PHM_PlatformCaps_MicrocodeFanControl);
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c +6 -0
index d08f6f1..2e1493c 100644
@@ -2496,6 +2496,12 @@ int tonga_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 					PHM_PlatformCaps_MicrocodeFanControl))
 		return 0;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (0 == smu_data->smu7_data.fan_table_start) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
 					PHM_PlatformCaps_MicrocodeFanControl);
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): 1480583737-2408-1-git-send-email-Hawking.Zhang-5C7GfCeVMHo@public.gmane.org

Reviewed-by Alex Deucher
#2 lore raw
Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Hawking Zhang
Sent: Thursday, December 01, 2016 4:16 AM
To: [email protected]
Cc: Zhang, Hawking
Subject: [PATCH] drm/amd/powerplay: bypass fan table setup if no fan connected

Quoted 6 lines

If vBIOS noFan bit is set, the fan table parameters in thermal controller will not get initialized. The driver should avoid to use these uninitialized parameter to do calculation. Otherwise, it may trigger divide 0 error.

Change-Id I76680a5ec5411f59742b65bb70eb7b4a08bda3ef
Quoted 86 lines
---
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c      | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c   | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c     | 6 ++++++
 4 files changed, 24 insertions(+)
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c +6 -0
index 34523fe..6aeb1d2 100644
@@ -1958,6 +1958,12 @@ int fiji_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
 	int res;
 	uint64_t tmp64;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (smu_data->smu7_data.fan_table_start == 0) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c +0 -0
 				PHM_PlatformCaps_MicrocodeFanControl);
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c +6 -0
index b579f0c..a24971a 100644
@@ -2006,6 +2006,12 @@ int iceland_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
 	if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 PHM_PlatformCaps_MicrocodeFanControl))
 		return 0;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (0 == smu7_data->fan_table_start) {

phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_MicrocodeFanControl);

drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c +0 -0
 		return 0;
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +6 -0
index 8db8e20..5190e82 100644
@@ -1885,6 +1885,12 @@ int polaris10_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
 	int res;
 	uint64_t tmp64;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (smu_data->smu7_data.fan_table_start == 0) {
 		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +0 -0
 				PHM_PlatformCaps_MicrocodeFanControl);
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c +6 -0
index d08f6f1..2e1493c 100644
@@ -2496,6 +2496,12 @@ int tonga_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
 
 	PHM_PlatformCaps_MicrocodeFanControl))
 		return 0;
 
+	if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+		phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+			PHM_PlatformCaps_MicrocodeFanControl);
+		return 0;
+	}
+
 	if (0 == smu_data->smu7_data.fan_table_start) {

phm_cap_unset(hwmgr->platform_descriptor.platformCaps,

Quoted 8 lines
	PHM_PlatformCaps_MicrocodeFanControl);

--
2.7.4

_______________________________________________
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): MWHPR12MB169496EA79EF64BED724E885F78F0-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw
Quoted 9 lines · Alexander
Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Hawking Zhang
Sent: Thursday, December 01, 2016 4:16 AM
To: [email protected]
Cc: Zhang, Hawking
Subject: [PATCH] drm/amd/powerplay: bypass fan table setup if no fan connected

Quoted 8 lines
Quoted 6 lines

If vBIOS noFan bit is set, the fan table parameters in thermal controller will not get initialized. The driver should avoid to use these uninitialized parameter to do calculation. Otherwise, it may trigger divide 0 error.

Change-Id I76680a5ec5411f59742b65bb70eb7b4a08bda3ef

Thanks, this exactly fixes one of the issues with the MacBookPro13,3:
https://lists.freedesktop.org/archives/amd-gfx/2016-November/003673.html

Quoted 91 lines
Quoted 91 lines
---
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c      | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c   | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c | 6 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c     | 6 ++++++
 4 files changed, 24 insertions(+)
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c +6 -0
index 34523fe..6aeb1d2 100644
@@ -1958,6 +1958,12 @@ int fiji_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
      int res;
      uint64_t tmp64;
 
+     if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+             phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                     PHM_PlatformCaps_MicrocodeFanControl);
+             return 0;
+     }
+
      if (smu_data->smu7_data.fan_table_start == 0) {
              phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
                              PHM_PlatformCaps_MicrocodeFanControl);
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c +6 -0
index b579f0c..a24971a 100644
@@ -2006,6 +2006,12 @@ int iceland_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
      if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 PHM_PlatformCaps_MicrocodeFanControl))
              return 0;
 
+     if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+             phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                     PHM_PlatformCaps_MicrocodeFanControl);
+             return 0;
+     }
+
      if (0 == smu7_data->fan_table_start) {
              phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_MicrocodeFanControl);
              return 0;
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +6 -0
index 8db8e20..5190e82 100644
@@ -1885,6 +1885,12 @@ int polaris10_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
      int res;
      uint64_t tmp64;
 
+     if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+             phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                     PHM_PlatformCaps_MicrocodeFanControl);
+             return 0;
+     }
+
      if (smu_data->smu7_data.fan_table_start == 0) {
              phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
                              PHM_PlatformCaps_MicrocodeFanControl);
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c +6 -0
index d08f6f1..2e1493c 100644
@@ -2496,6 +2496,12 @@ int tonga_thermal_setup_fan_table(struct
 pp_hwmgr *hwmgr)
 
      PHM_PlatformCaps_MicrocodeFanControl))
              return 0;
 
+     if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+             phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                     PHM_PlatformCaps_MicrocodeFanControl);
+             return 0;
+     }
+
      if (0 == smu_data->smu7_data.fan_table_start) {
              phm_cap_unset(hwmgr->platform_descriptor.platformCaps,

      PHM_PlatformCaps_MicrocodeFanControl);

--
2.7.4

Quoted 8 lines
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