]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
drm/amd/pm: correct Vega10 swctf limit setting
authorEvan Quan <evan.quan@amd.com>
Fri, 21 Aug 2020 04:05:03 +0000 (12:05 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 16 Sep 2020 09:15:01 +0000 (05:15 -0400)
BugLink: https://bugs.launchpad.net/bugs/1895174
commit b05d71b51078fc428c6b72582126d9d75d3c1f4c upstream.

Correct the Vega10 thermal swctf limit.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1267

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c

index ba8763daa3808b2a6fcd57f7ff6315d6bc8c3e5e..848c2a3f9ee8058a546ee1411c35e16cb802b19c 100644 (file)
@@ -364,6 +364,9 @@ int vega10_thermal_get_temperature(struct pp_hwmgr *hwmgr)
 static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
                struct PP_TemperatureRange *range)
 {
+       struct phm_ppt_v2_information *pp_table_info =
+               (struct phm_ppt_v2_information *)(hwmgr->pptable);
+       struct phm_tdp_table *tdp_table = pp_table_info->tdp_table;
        struct amdgpu_device *adev = hwmgr->adev;
        int low = VEGA10_THERMAL_MINIMUM_ALERT_TEMP *
                        PP_TEMPERATURE_UNITS_PER_CENTIGRADES;
@@ -373,8 +376,8 @@ static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr,
 
        if (low < range->min)
                low = range->min;
-       if (high > range->max)
-               high = range->max;
+       if (high > tdp_table->usSoftwareShutdownTemp)
+               high = tdp_table->usSoftwareShutdownTemp;
 
        if (low > high)
                return -EINVAL;