drm/amd/pm: Add GetStaticMetricTable message
authorAsad Kamal <asad.kamal@amd.com>
Mon, 10 Feb 2025 16:17:37 +0000 (00:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Feb 2025 16:43:59 +0000 (11:43 -0500)
Add GetStaticMetricTable message 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/inc/smu_types.h
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
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

index 9ccd5a1986d3bb34eeb1f90718d1ab1444662b06..9c8468fb203a76cd52661de91378c38c9979ac5f 100644 (file)
        __SMU_DUMMY_MAP(SetThrottlingPolicy), \
        __SMU_DUMMY_MAP(MALLPowerController), \
        __SMU_DUMMY_MAP(MALLPowerState), \
-       __SMU_DUMMY_MAP(ResetSDMA),
+       __SMU_DUMMY_MAP(ResetSDMA), \
+       __SMU_DUMMY_MAP(GetStaticMetricsTable),
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)  SMU_MSG_##type
index 31166974746f155677b5397df3e450cf4464864d..609a04c7512911e4fdf490f5fd41fe5cd7b77de2 100644 (file)
@@ -308,5 +308,6 @@ int smu_v13_0_get_boot_freq_by_index(struct smu_context *smu,
 void smu_v13_0_interrupt_work(struct smu_context *smu);
 bool smu_v13_0_12_is_dpm_running(struct smu_context *smu);
 extern const struct cmn2asic_mapping smu_v13_0_12_feature_mask_map[];
+extern const struct cmn2asic_msg_mapping smu_v13_0_12_message_map[];
 #endif
 #endif
index 86852e73883791aa4a025971d8ab69495330859e..5ad5dd879e81db5fdfc0bc240bbb318e3bffe298 100644 (file)
@@ -28,6 +28,7 @@
 #include "amdgpu_smu.h"
 #include "smu_v13_0_12_pmfw.h"
 #include "smu_v13_0_6_ppt.h"
+#include "smu_v13_0_12_ppsmc.h"
 #include "smu_v13_0.h"
 #include "amdgpu_xgmi.h"
 #include <linux/pci.h>
@@ -72,6 +73,63 @@ const struct cmn2asic_mapping smu_v13_0_12_feature_mask_map[SMU_FEATURE_COUNT] =
        SMU_13_0_12_FEA_MAP(SMU_FEATURE_XGMI_PER_LINK_PWR_DWN_BIT,      FEATURE_XGMI_PER_LINK_PWR_DOWN),
 };
 
+// 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),
+       MSG_MAP(GetDriverIfVersion,                  PPSMC_MSG_GetDriverIfVersion,              1),
+       MSG_MAP(EnableAllSmuFeatures,                PPSMC_MSG_EnableAllSmuFeatures,            0),
+       MSG_MAP(DisableAllSmuFeatures,               PPSMC_MSG_DisableAllSmuFeatures,           0),
+       MSG_MAP(RequestI2cTransaction,               PPSMC_MSG_RequestI2cTransaction,           0),
+       MSG_MAP(GetMetricsTable,                     PPSMC_MSG_GetMetricsTable,                 1),
+       MSG_MAP(GetMetricsVersion,                   PPSMC_MSG_GetMetricsVersion,               1),
+       MSG_MAP(GetEnabledSmuFeaturesHigh,           PPSMC_MSG_GetEnabledSmuFeaturesHigh,       1),
+       MSG_MAP(GetEnabledSmuFeaturesLow,            PPSMC_MSG_GetEnabledSmuFeaturesLow,        1),
+       MSG_MAP(SetDriverDramAddrHigh,               PPSMC_MSG_SetDriverDramAddrHigh,           1),
+       MSG_MAP(SetDriverDramAddrLow,                PPSMC_MSG_SetDriverDramAddrLow,            1),
+       MSG_MAP(SetToolsDramAddrHigh,                PPSMC_MSG_SetToolsDramAddrHigh,            0),
+       MSG_MAP(SetToolsDramAddrLow,                 PPSMC_MSG_SetToolsDramAddrLow,             0),
+       MSG_MAP(SetSoftMinByFreq,                    PPSMC_MSG_SetSoftMinByFreq,                0),
+       MSG_MAP(SetSoftMaxByFreq,                    PPSMC_MSG_SetSoftMaxByFreq,                1),
+       MSG_MAP(GetMinDpmFreq,                       PPSMC_MSG_GetMinDpmFreq,                   1),
+       MSG_MAP(GetMaxDpmFreq,                       PPSMC_MSG_GetMaxDpmFreq,                   1),
+       MSG_MAP(GetDpmFreqByIndex,                   PPSMC_MSG_GetDpmFreqByIndex,               1),
+       MSG_MAP(SetPptLimit,                         PPSMC_MSG_SetPptLimit,                     0),
+       MSG_MAP(GetPptLimit,                         PPSMC_MSG_GetPptLimit,                     1),
+       MSG_MAP(GfxDeviceDriverReset,                PPSMC_MSG_GfxDriverReset,                  SMU_MSG_RAS_PRI),
+       MSG_MAP(DramLogSetDramAddrHigh,              PPSMC_MSG_DramLogSetDramAddrHigh,          0),
+       MSG_MAP(DramLogSetDramAddrLow,               PPSMC_MSG_DramLogSetDramAddrLow,           0),
+       MSG_MAP(DramLogSetDramSize,                  PPSMC_MSG_DramLogSetDramSize,              0),
+       MSG_MAP(GetDebugData,                        PPSMC_MSG_GetDebugData,                    0),
+       MSG_MAP(SetNumBadHbmPagesRetired,            PPSMC_MSG_SetNumBadHbmPagesRetired,        0),
+       MSG_MAP(DFCstateControl,                     PPSMC_MSG_DFCstateControl,                 0),
+       MSG_MAP(GetGmiPwrDnHyst,                     PPSMC_MSG_GetGmiPwrDnHyst,                 0),
+       MSG_MAP(SetGmiPwrDnHyst,                     PPSMC_MSG_SetGmiPwrDnHyst,                 0),
+       MSG_MAP(GmiPwrDnControl,                     PPSMC_MSG_GmiPwrDnControl,                 0),
+       MSG_MAP(EnterGfxoff,                         PPSMC_MSG_EnterGfxoff,                     0),
+       MSG_MAP(ExitGfxoff,                          PPSMC_MSG_ExitGfxoff,                      0),
+       MSG_MAP(EnableDeterminism,                   PPSMC_MSG_EnableDeterminism,               0),
+       MSG_MAP(DisableDeterminism,                  PPSMC_MSG_DisableDeterminism,              0),
+       MSG_MAP(GfxDriverResetRecovery,              PPSMC_MSG_GfxDriverResetRecovery,          0),
+       MSG_MAP(GetMinGfxclkFrequency,               PPSMC_MSG_GetMinGfxDpmFreq,                1),
+       MSG_MAP(GetMaxGfxclkFrequency,               PPSMC_MSG_GetMaxGfxDpmFreq,                1),
+       MSG_MAP(SetSoftMinGfxclk,                    PPSMC_MSG_SetSoftMinGfxClk,                1),
+       MSG_MAP(SetSoftMaxGfxClk,                    PPSMC_MSG_SetSoftMaxGfxClk,                1),
+       MSG_MAP(PrepareMp1ForUnload,                 PPSMC_MSG_PrepareForDriverUnload,          0),
+       MSG_MAP(GetCTFLimit,                         PPSMC_MSG_GetCTFLimit,                     0),
+       MSG_MAP(GetThermalLimit,                     PPSMC_MSG_ReadThrottlerLimit,              0),
+       MSG_MAP(ClearMcaOnRead,                      PPSMC_MSG_ClearMcaOnRead,                  0),
+       MSG_MAP(QueryValidMcaCount,                  PPSMC_MSG_QueryValidMcaCount,              SMU_MSG_RAS_PRI),
+       MSG_MAP(QueryValidMcaCeCount,                PPSMC_MSG_QueryValidMcaCeCount,            SMU_MSG_RAS_PRI),
+       MSG_MAP(McaBankDumpDW,                       PPSMC_MSG_McaBankDumpDW,                   SMU_MSG_RAS_PRI),
+       MSG_MAP(McaBankCeDumpDW,                     PPSMC_MSG_McaBankCeDumpDW,                 SMU_MSG_RAS_PRI),
+       MSG_MAP(SelectPLPDMode,                      PPSMC_MSG_SelectPLPDMode,                  0),
+       MSG_MAP(RmaDueToBadPageThreshold,            PPSMC_MSG_RmaDueToBadPageThreshold,        0),
+       MSG_MAP(SetThrottlingPolicy,                 PPSMC_MSG_SetThrottlingPolicy,             0),
+       MSG_MAP(ResetSDMA,                           PPSMC_MSG_ResetSDMA,                       0),
+       MSG_MAP(GetStaticMetricsTable,               PPSMC_MSG_GetStaticMetricsTable,           1),
+};
+
 static int smu_v13_0_12_get_enabled_mask(struct smu_context *smu,
                                         uint64_t *feature_mask)
 {
index 9f276f393b8175fcf7255168599e2a60486e3862..c43fce62df1c3bc5e27cf9796cbf4908b01d521b 100644 (file)
@@ -3616,7 +3616,8 @@ static const struct pptable_funcs smu_v13_0_6_ppt_funcs = {
 void smu_v13_0_6_set_ppt_funcs(struct smu_context *smu)
 {
        smu->ppt_funcs = &smu_v13_0_6_ppt_funcs;
-       smu->message_map = smu_v13_0_6_message_map;
+       smu->message_map = (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12)) ?
+               smu_v13_0_12_message_map : smu_v13_0_6_message_map;
        smu->clock_map = smu_v13_0_6_clk_map;
        smu->feature_map = (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 12)) ?
                smu_v13_0_12_feature_mask_map : smu_v13_0_6_feature_mask_map;