drm/amd/powerplay: correct Navi1X temperature limit settings
authorEvan Quan <evan.quan@amd.com>
Thu, 2 Jul 2020 06:48:03 +0000 (14:48 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 15 Jul 2020 16:44:09 +0000 (12:44 -0400)
These are needed for temp1/2/3 related hwmon interfaces.

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>
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
drivers/gpu/drm/amd/powerplay/navi10_ppt.c

index 3687e7620eb8389317782f06715888b883f30d26..0b33cde051339d1bd9c043f4ed20771f083d7e56 100644 (file)
 
 #define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c))
 
-#define CTF_OFFSET_EDGE                        5
-#define CTF_OFFSET_HOTSPOT             5
-#define CTF_OFFSET_HBM                 5
-
 #define MSG_MAP(msg, index, valid_in_vf) \
        [SMU_MSG_##msg] = {1, (index), (valid_in_vf)}
 #define ARCTURUS_FEA_MAP(smu_feature, arcturus_feature) \
@@ -1048,7 +1044,7 @@ static int arcturus_get_thermal_temperature_range(struct smu_context *smu,
                SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
        range->mem_crit_max = pptable->TmemLimit *
                SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
-       range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_HBM)*
+       range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_MEM)*
                SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
        return 0;
index ef319c7a1a37102ea410ce5b5bcc2554d637809d..21e2cc3a526c9fcd9a9b9eb854e37a08f9a9d909 100644 (file)
 #define WORKLOAD_MAP(profile, workload) \
        [profile] = {1, (workload)}
 
+#define CTF_OFFSET_EDGE                        5
+#define CTF_OFFSET_HOTSPOT             5
+#define CTF_OFFSET_MEM                 5
+
 static const struct smu_temperature_range smu11_thermal_policy[] =
 {
        {-273150,  99000, 99000, -273150, 99000, 99000, -273150, 99000, 99000},
index 45fe9f1d52c8353ed760d8f8cd8201253630bbb1..cd1306c976f4263234a67a7f521447b7122b1f3d 100644 (file)
@@ -1856,13 +1856,22 @@ static int navi10_get_uclk_dpm_states(struct smu_context *smu, uint32_t *clocks_
 static int navi10_get_thermal_temperature_range(struct smu_context *smu,
                                                struct smu_temperature_range *range)
 {
-       struct smu_table_context *table_context = &smu->smu_table;
-       struct smu_11_0_powerplay_table *powerplay_table = table_context->power_play_table;
+       PPTable_t *pptable = smu->smu_table.driver_pptable;
 
-       if (!range || !powerplay_table)
+       if (!range)
                return -EINVAL;
 
-       range->max = powerplay_table->software_shutdown_temp *
+       range->max = pptable->TedgeLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->edge_emergency_max = (pptable->TedgeLimit + CTF_OFFSET_EDGE) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_crit_max = pptable->ThotspotLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->hotspot_emergency_max = (pptable->ThotspotLimit + CTF_OFFSET_HOTSPOT) *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_crit_max = pptable->TmemLimit *
+               SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
+       range->mem_emergency_max = (pptable->TmemLimit + CTF_OFFSET_MEM)*
                SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
 
        return 0;