<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Kenneth Feng <kenneth.feng@amd.com><br>
<b>Sent:</b> Thursday, July 7, 2022 10:27 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/pm: ac/dc change for smu_v13_0</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">fixed the issue: gpu runs in dc mode but it is expected to be in ac mode.<br>
this causes the lower performance on smu_v13_0<br>
<br>
Signed-off-by: Kenneth Feng <kenneth.feng@amd.com><br>
---<br>
 .../pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h  |  9 ++++--<br>
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  1 +<br>
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    | 28 ++++++++++++++++++-<br>
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  2 ++<br>
 4 files changed, 37 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h<br>
index 3f2d0a9e4745..6aaefca9b595 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h<br>
@@ -128,7 +128,12 @@<br>
 #define PPSMC_MSG_EnableAudioStutterWA           0x44<br>
 #define PPSMC_MSG_PowerUpUmsch                   0x45<br>
 #define PPSMC_MSG_PowerDownUmsch                 0x46<br>
-#define PPSMC_Message_Count                      0x4C<br>
-<br>
+#define PPSMC_MSG_SetDcsArch                     0x47<br>
+#define PPSMC_MSG_TriggerVFFLR                   0x48<br>
+#define PPSMC_MSG_SetNumBadMemoryPagesRetired    0x49<br>
+#define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A<br>
+#define PPSMC_MSG_SetPriorityDeltaGain           0x4B<br>
+#define PPSMC_MSG_AllowIHHostInterrupt           0x4C<br>
+#define PPSMC_Message_Count                      0x4D<br>
 <br>
 #endif<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h<br>
index a1cb8e73e171..19084a4fcb2b 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h<br>
@@ -74,6 +74,7 @@<br>
        __SMU_DUMMY_MAP(OverDriveSetPercentage),       \<br>
        __SMU_DUMMY_MAP(SetMinDeepSleepDcefclk),       \<br>
        __SMU_DUMMY_MAP(ReenableAcDcInterrupt),        \<br>
+       __SMU_DUMMY_MAP(AllowIHHostInterrupt),        \<br>
        __SMU_DUMMY_MAP(NotifyPowerSource),            \<br>
        __SMU_DUMMY_MAP(SetUclkFastSwitch),            \<br>
        __SMU_DUMMY_MAP(SetUclkDownHyst),              \<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c<br>
index 0e59ab2192bf..0328bc12ca21 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c<br>
@@ -1084,9 +1084,35 @@ int smu_v13_0_set_power_limit(struct smu_context *smu,<br>
         return 0;<br>
 }<br>
 <br>
+static int smu_v13_0_allow_ih_interrupt(struct smu_context *smu)<br>
+{<br>
+       return smu_cmn_send_smc_msg(smu,<br>
+                                   SMU_MSG_AllowIHHostInterrupt,<br>
+                                   NULL);<br>
+}<br>
+<br>
+static int smu_v13_0_process_pending_interrupt(struct smu_context *smu)<br>
+{<br>
+       int ret = 0;<br>
+<br>
+       if (smu->dc_controlled_by_gpio &&<br>
+           smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))<br>
+               ret = smu_v13_0_allow_ih_interrupt(smu);<br>
+<br>
+       return ret;<br>
+}<br>
+<br>
 int smu_v13_0_enable_thermal_alert(struct smu_context *smu)<br>
 {<br>
-       return amdgpu_irq_get(smu->adev, &smu->irq_source, 0);<br>
+       int ret = 0;<br>
+<br>
+       if (smu->smu_table.thermal_controller_type) {<br>
+               ret = amdgpu_irq_get(smu->adev, &smu->irq_source, 0);<br>
+               if (ret)<br>
+                       return ret;<br>
+       }<br>
+<br>
+       return smu_v13_0_process_pending_interrupt(smu);<br>
 }<br>
 <br>
 int smu_v13_0_disable_thermal_alert(struct smu_context *smu)<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c<br>
index 193222fdd1c4..6259a85bc818 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c<br>
@@ -111,6 +111,8 @@ static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] =<br>
         MSG_MAP(PowerDownJpeg,                  PPSMC_MSG_PowerDownJpeg,               0),<br>
         MSG_MAP(GetDcModeMaxDpmFreq,            PPSMC_MSG_GetDcModeMaxDpmFreq,         1),<br>
         MSG_MAP(OverridePcieParameters,         PPSMC_MSG_OverridePcieParameters,      0),<br>
+       MSG_MAP(ReenableAcDcInterrupt,          PPSMC_MSG_ReenableAcDcInterrupt,       0),<br>
+       MSG_MAP(AllowIHHostInterrupt,           PPSMC_MSG_AllowIHHostInterrupt,       0),<br>
         MSG_MAP(DramLogSetDramAddrHigh,         PPSMC_MSG_DramLogSetDramAddrHigh,      0),<br>
         MSG_MAP(DramLogSetDramAddrLow,          PPSMC_MSG_DramLogSetDramAddrLow,       0),<br>
         MSG_MAP(DramLogSetDramSize,             PPSMC_MSG_DramLogSetDramSize,          0),<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>