drm/amd/pm: ac/dc change for smu_v13_0
authorKenneth Feng <kenneth.feng@amd.com>
Thu, 7 Jul 2022 14:16:11 +0000 (22:16 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 8 Jul 2022 22:25:44 +0000 (18:25 -0400)
fixed the issue: gpu runs in dc mode but it is expected to be in ac mode.
this causes the lower performance on smu_v13_0

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h
drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c

index 3f2d0a9e4745397e68ecf4cda07b75d5f45bd6c9..6aaefca9b595c7dd1e0314f89098531803e85c7c 100644 (file)
 #define PPSMC_MSG_EnableAudioStutterWA           0x44
 #define PPSMC_MSG_PowerUpUmsch                   0x45
 #define PPSMC_MSG_PowerDownUmsch                 0x46
-#define PPSMC_Message_Count                      0x4C
-
+#define PPSMC_MSG_SetDcsArch                     0x47
+#define PPSMC_MSG_TriggerVFFLR                   0x48
+#define PPSMC_MSG_SetNumBadMemoryPagesRetired    0x49
+#define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A
+#define PPSMC_MSG_SetPriorityDeltaGain           0x4B
+#define PPSMC_MSG_AllowIHHostInterrupt           0x4C
+#define PPSMC_Message_Count                      0x4D
 
 #endif
index a1cb8e73e171e91863db548228269e6fb6f287cc..19084a4fcb2bd75f60fd328a1441e9ee9a71ba73 100644 (file)
@@ -74,6 +74,7 @@
        __SMU_DUMMY_MAP(OverDriveSetPercentage),       \
        __SMU_DUMMY_MAP(SetMinDeepSleepDcefclk),       \
        __SMU_DUMMY_MAP(ReenableAcDcInterrupt),        \
+       __SMU_DUMMY_MAP(AllowIHHostInterrupt),        \
        __SMU_DUMMY_MAP(NotifyPowerSource),            \
        __SMU_DUMMY_MAP(SetUclkFastSwitch),            \
        __SMU_DUMMY_MAP(SetUclkDownHyst),              \
index 0e59ab2192bf4fb14a455e5f5d571b037c224e78..0328bc12ca218ee2531cd78d57faf5e6713e3f90 100644 (file)
@@ -1084,9 +1084,35 @@ int smu_v13_0_set_power_limit(struct smu_context *smu,
        return 0;
 }
 
+static int smu_v13_0_allow_ih_interrupt(struct smu_context *smu)
+{
+       return smu_cmn_send_smc_msg(smu,
+                                   SMU_MSG_AllowIHHostInterrupt,
+                                   NULL);
+}
+
+static int smu_v13_0_process_pending_interrupt(struct smu_context *smu)
+{
+       int ret = 0;
+
+       if (smu->dc_controlled_by_gpio &&
+           smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
+               ret = smu_v13_0_allow_ih_interrupt(smu);
+
+       return ret;
+}
+
 int smu_v13_0_enable_thermal_alert(struct smu_context *smu)
 {
-       return amdgpu_irq_get(smu->adev, &smu->irq_source, 0);
+       int ret = 0;
+
+       if (smu->smu_table.thermal_controller_type) {
+               ret = amdgpu_irq_get(smu->adev, &smu->irq_source, 0);
+               if (ret)
+                       return ret;
+       }
+
+       return smu_v13_0_process_pending_interrupt(smu);
 }
 
 int smu_v13_0_disable_thermal_alert(struct smu_context *smu)
index 193222fdd1c46251a652e9f6c126fbd1f3056095..6259a85bc818527b2a5f54f1606a14df30a09d6d 100644 (file)
@@ -111,6 +111,8 @@ static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] =
        MSG_MAP(PowerDownJpeg,                  PPSMC_MSG_PowerDownJpeg,               0),
        MSG_MAP(GetDcModeMaxDpmFreq,            PPSMC_MSG_GetDcModeMaxDpmFreq,         1),
        MSG_MAP(OverridePcieParameters,         PPSMC_MSG_OverridePcieParameters,      0),
+       MSG_MAP(ReenableAcDcInterrupt,          PPSMC_MSG_ReenableAcDcInterrupt,       0),
+       MSG_MAP(AllowIHHostInterrupt,           PPSMC_MSG_AllowIHHostInterrupt,       0),
        MSG_MAP(DramLogSetDramAddrHigh,         PPSMC_MSG_DramLogSetDramAddrHigh,      0),
        MSG_MAP(DramLogSetDramAddrLow,          PPSMC_MSG_DramLogSetDramAddrLow,       0),
        MSG_MAP(DramLogSetDramSize,             PPSMC_MSG_DramLogSetDramSize,          0),