aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorHawking Zhang <Hawking.Zhang@amd.com>2016-12-01 04:14:45 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-09 02:32:20 -0500
commit326760ba1802a5b2f73de06f3bac4e9752a3257a (patch)
treece90b18520c3c2991a6f9dafcf775ef7c5deafdd /drivers/gpu
parentaa286e88fd914aecfdf5c4807fb814233c0d092b (diff)
drm/amd/powerplay: bypass fan table setup if no fan connected
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c6
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c6
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c6
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c6
4 files changed, 24 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
index 76310ac7ef0d..dca1b13fda2f 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
@@ -1958,6 +1958,12 @@ int fiji_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
1958 int res; 1958 int res;
1959 uint64_t tmp64; 1959 uint64_t tmp64;
1960 1960
1961 if (hwmgr->thermal_controller.fanInfo.bNoFan) {
1962 phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
1963 PHM_PlatformCaps_MicrocodeFanControl);
1964 return 0;
1965 }
1966
1961 if (smu_data->smu7_data.fan_table_start == 0) { 1967 if (smu_data->smu7_data.fan_table_start == 0) {
1962 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 1968 phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
1963 PHM_PlatformCaps_MicrocodeFanControl); 1969 PHM_PlatformCaps_MicrocodeFanControl);
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
index 8c889caba420..6c26b83655d0 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
@@ -2006,6 +2006,12 @@ int iceland_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
2006 if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl)) 2006 if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl))
2007 return 0; 2007 return 0;
2008 2008
2009 if (hwmgr->thermal_controller.fanInfo.bNoFan) {
2010 phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
2011 PHM_PlatformCaps_MicrocodeFanControl);
2012 return 0;
2013 }
2014
2009 if (0 == smu7_data->fan_table_start) { 2015 if (0 == smu7_data->fan_table_start) {
2010 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl); 2016 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl);
2011 return 0; 2017 return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
index 71bb2f8dc157..8ca1a3341dea 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
@@ -1885,6 +1885,12 @@ int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
1885 int res; 1885 int res;
1886 uint64_t tmp64; 1886 uint64_t tmp64;
1887 1887
1888 if (hwmgr->thermal_controller.fanInfo.bNoFan) {
1889 phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
1890 PHM_PlatformCaps_MicrocodeFanControl);
1891 return 0;
1892 }
1893
1888 if (smu_data->smu7_data.fan_table_start == 0) { 1894 if (smu_data->smu7_data.fan_table_start == 0) {
1889 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 1895 phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
1890 PHM_PlatformCaps_MicrocodeFanControl); 1896 PHM_PlatformCaps_MicrocodeFanControl);
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
index de2a24d85f48..a6619e530fe3 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
@@ -2496,6 +2496,12 @@ int tonga_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
2496 PHM_PlatformCaps_MicrocodeFanControl)) 2496 PHM_PlatformCaps_MicrocodeFanControl))
2497 return 0; 2497 return 0;
2498 2498
2499 if (hwmgr->thermal_controller.fanInfo.bNoFan) {
2500 phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
2501 PHM_PlatformCaps_MicrocodeFanControl);
2502 return 0;
2503 }
2504
2499 if (0 == smu_data->smu7_data.fan_table_start) { 2505 if (0 == smu_data->smu7_data.fan_table_start) {
2500 phm_cap_unset(hwmgr->platform_descriptor.platformCaps, 2506 phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
2501 PHM_PlatformCaps_MicrocodeFanControl); 2507 PHM_PlatformCaps_MicrocodeFanControl);