From: Asad Kamal <[email protected]>

Add static metrics support for smu_v15_0_8

Signed-off-by: Asad Kamal <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 .../drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c  | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
index b3dc04ea5e713..ae2e0d44b1da1 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
@@ -238,6 +238,26 @@ static int smu_v15_0_8_check_fw_status(struct smu_context 
*smu)
        return -EIO;
 }
 
+static int smu_v15_0_8_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_err(smu->adev->dev,
+                        "Failed to export static metrics table!\n");
+               return ret;
+       }
+
+       amdgpu_hdp_invalidate(smu->adev, NULL);
+       memcpy(smu_table->metrics_table, table->cpu_addr, table_size);
+
+       return 0;
+}
+
 static int smu_v15_0_8_irq_process(struct amdgpu_device *adev,
                                   struct amdgpu_irq_src *source,
                                   struct amdgpu_iv_entry *entry)
-- 
2.53.0

Reply via email to