<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;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, 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> Zhang, Yifan <Yifan1.Zhang@amd.com><br>
<b>Sent:</b> Tuesday, October 24, 2023 9:41 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Li, Candice <Candice.Li@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com>; Zhang, Yifan <Yifan1.Zhang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/pm: call smu_cmn_get_smc_version in is_mode1_reset_supported.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">is_mode1_reset_supported may be called before smu init, when smu_context<br>
is unitialized in driver load/unload test. Call smu_cmn_get_smc_version<br>
explicitly is_mode1_reset_supported.<br>
<br>
Fixes: 5fe5098c64d9 ("drm/amd/pm: drop most smu_cmn_get_smc_version in smu")<br>
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com><br>
---<br>
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 8 +++++++-<br>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 8 +++++++-<br>
2 files changed, 14 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c<br>
index 090249b6422a..77c3d76c76a2 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c<br>
@@ -2461,12 +2461,18 @@ static bool sienna_cichlid_is_mode1_reset_supported(struct smu_context *smu)<br>
{<br>
struct amdgpu_device *adev = smu->adev;<br>
uint32_t val;<br>
+ uint32_t smu_version;<br>
+ int ret;<br>
<br>
/**<br>
* SRIOV env will not support SMU mode1 reset<br>
* PM FW support mode1 reset from 58.26<br>
*/<br>
- if (amdgpu_sriov_vf(adev) || (smu->smc_fw_version < 0x003a1a00))<br>
+ ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);<br>
+ if (ret)<br>
+ return false;<br>
+<br>
+ if (amdgpu_sriov_vf(adev) || (smu_version < 0x003a1a00))<br>
return false;<br>
<br>
/**<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c<br>
index b1433973380b..648d5eafb27b 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c<br>
@@ -2615,13 +2615,19 @@ static int smu_v13_0_0_baco_exit(struct smu_context *smu)<br>
static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu)<br>
{<br>
struct amdgpu_device *adev = smu->adev;<br>
+ u32 smu_version;<br>
+ int ret;<br>
<br>
/* SRIOV does not support SMU mode1 reset */<br>
if (amdgpu_sriov_vf(adev))<br>
return false;<br>
<br>
/* PMFW support is available since 78.41 */<br>
- if (smu->smc_fw_version < 0x004e2900)<br>
+ ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);<br>
+ if (ret)<br>
+ return false;<br>
+<br>
+ if (smu_version < 0x004e2900)<br>
return false;<br>
<br>
return true;<br>
-- <br>
2.37.3<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>