]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/pm: Remove cache logic from SMUv13.0.12
authorLijo Lazar <lijo.lazar@amd.com>
Wed, 6 Aug 2025 06:19:59 +0000 (11:49 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Aug 2025 18:30:43 +0000 (14:30 -0400)
Remove caching logic of temperature metrics from SMUv13.0.12. The
caching logic needs to be moved to a higher level.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_12_ppt.c

index 920f60da9c5c77df6daddb993d4404ada17894a2..aa427fa8ddd2282e1f225d745256750516c225b1 100644 (file)
@@ -83,7 +83,6 @@ const struct cmn2asic_mapping smu_v13_0_12_feature_mask_map[SMU_FEATURE_COUNT] =
        SMU_13_0_12_FEA_MAP(SMU_FEATURE_PIT_BIT,                        FEATURE_PIT),
 };
 
-// clang-format off
 const struct cmn2asic_msg_mapping smu_v13_0_12_message_map[SMU_MSG_MAX_COUNT] = {
        MSG_MAP(TestMessage,                         PPSMC_MSG_TestMessage,                     0),
        MSG_MAP(GetSmuVersion,                       PPSMC_MSG_GetSmuVersion,                   1),
@@ -361,31 +360,24 @@ int smu_v13_0_12_get_smu_metrics_data(struct smu_context *smu,
        return 0;
 }
 
-static int smu_v13_0_12_get_system_metrics_table(struct smu_context *smu, void *metrics_table,
-                                                bool bypass_cache)
+static int smu_v13_0_12_get_system_metrics_table(struct smu_context *smu,
+                                                void *metrics_table)
 {
        struct smu_table_context *smu_table = &smu->smu_table;
        uint32_t table_size = smu_table->tables[SMU_TABLE_SMU_METRICS].size;
        struct smu_table *table = &smu_table->driver_table;
        int ret;
 
-       if (bypass_cache || !smu_table->tables[SMU_TABLE_TEMP_METRICS].metrics_time ||
-           time_after(jiffies,
-                      smu_table->tables[SMU_TABLE_TEMP_METRICS].metrics_time +
-                      msecs_to_jiffies(1))) {
-               ret = smu_cmn_send_smc_msg(smu, SMU_MSG_GetSystemMetricsTable, NULL);
-               if (ret) {
-                       dev_info(smu->adev->dev,
-                                "Failed to export system metrics table!\n");
-                       return ret;
-               }
-
-               amdgpu_asic_invalidate_hdp(smu->adev, NULL);
-               memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
-
-               smu_table->tables[SMU_TABLE_TEMP_METRICS].metrics_time = jiffies;
+       ret = smu_cmn_send_smc_msg(smu, SMU_MSG_GetSystemMetricsTable, NULL);
+       if (ret) {
+               dev_info(smu->adev->dev,
+                        "Failed to export system metrics table!\n");
+               return ret;
        }
 
+       amdgpu_asic_invalidate_hdp(smu->adev, NULL);
+       memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
+
        if (metrics_table)
                memcpy(metrics_table, smu_table->metrics_table, sizeof(SystemMetricsTable_t));
 
@@ -544,7 +536,7 @@ static ssize_t smu_v13_0_12_get_temp_metrics(struct smu_context *smu,
        else if (type  == SMU_TEMP_METRIC_BASEBOARD)
                smu_cmn_init_baseboard_temp_metrics(baseboard_temp_metrics, 1, 0);
 
-       ret = smu_v13_0_12_get_system_metrics_table(smu, metrics, false);
+       ret = smu_v13_0_12_get_system_metrics_table(smu, metrics);
        if (ret) {
                kfree(metrics);
                return ret;