]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
drm/amd/powerplay: bypass fan table setup if no fan connected
authorHawking Zhang <Hawking.Zhang@amd.com>
Thu, 1 Dec 2016 09:14:45 +0000 (17:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Jan 2017 07:32:20 +0000 (08:32 +0100)
commit 10e2ca346bf74561ff1b7fff6287716ab976cd8c upstream.

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.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c

index 76310ac7ef0d12ac6e25a84847655261a284bd48..dca1b13fda2f43db570cfe78e1b4f28be6e21862 100644 (file)
@@ -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);
index 8c889caba420dc2d55ec9340d46ab0a92d468514..6c26b83655d0d4097a1136d7f4c4b613198419d4 100644 (file)
@@ -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;
index 71bb2f8dc157ba36029c5131237a20a8c0e2b7be..8ca1a3341dea7b542d76587fe73731a79784a265 100644 (file)
@@ -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);
index de2a24d85f48b94a0d17aafd41af3058839a4c6b..a6619e530fe3a3634849a72930b656d218c3bc01 100644 (file)
@@ -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);