drm/amd/pm: Use common function to fetch static metrics table
authorAsad Kamal <asad.kamal@amd.com>
Mon, 14 Apr 2025 13:43:09 +0000 (21:43 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 Apr 2025 22:09:50 +0000 (18:09 -0400)
Use common function to fetch static metrics table for smu_v13_0_12

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

index 5d4437e413cc2113bceb7f17e414f8734512afd7..533d58e57d05063062c31fd5ae1f43f586d0dd31 100644 (file)
@@ -187,26 +187,6 @@ int smu_v13_0_12_get_max_metrics_size(void)
        return max(sizeof(StaticMetricsTable_t), sizeof(MetricsTable_t));
 }
 
-static int smu_v13_0_12_get_static_metrics_table(struct smu_context *smu)
-{
-       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;
-
-       ret = smu_cmn_send_smc_msg(smu, SMU_MSG_GetStaticMetricsTable, NULL);
-       if (ret) {
-               dev_info(smu->adev->dev,
-                        "Failed to export static metrics table!\n");
-               return ret;
-       }
-
-       amdgpu_asic_invalidate_hdp(smu->adev, NULL);
-       memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
-
-       return 0;
-}
-
 int smu_v13_0_12_setup_driver_pptable(struct smu_context *smu)
 {
        struct smu_table_context *smu_table = &smu->smu_table;
@@ -217,7 +197,7 @@ int smu_v13_0_12_setup_driver_pptable(struct smu_context *smu)
        int ret, i;
 
        if (!pptable->Init) {
-               ret = smu_v13_0_12_get_static_metrics_table(smu);
+               ret = smu_v13_0_6_get_static_metrics_table(smu);
                if (ret)
                        return ret;
 
index 1a16b92c97c15df6ece71142657150c2881097b3..b4bea0881ac989224ae12a2981543f9e62698940 100644 (file)
@@ -739,7 +739,7 @@ static ssize_t smu_v13_0_6_get_pm_metrics(struct smu_context *smu,
        return pm_metrics->common_header.structure_size;
 }
 
-static int smu_v13_0_6_get_static_metrics_table(struct smu_context *smu)
+int smu_v13_0_6_get_static_metrics_table(struct smu_context *smu)
 {
        struct smu_table_context *smu_table = &smu->smu_table;
        uint32_t table_size = smu_table->tables[SMU_TABLE_SMU_METRICS].size;
index 2a8f42dbd9f573adf0577b9f8c18775bd97fa113..c7a07aa5ef14b384a9da691ee521a002a4bfd1b1 100644 (file)
@@ -71,5 +71,6 @@ enum smu_v13_0_6_caps {
 
 extern void smu_v13_0_6_set_ppt_funcs(struct smu_context *smu);
 bool smu_v13_0_6_cap_supported(struct smu_context *smu, enum smu_v13_0_6_caps cap);
+int smu_v13_0_6_get_static_metrics_table(struct smu_context *smu);
 
 #endif