<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:Calibri;font-size:10pt;color:#008000;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; margin: 0px; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com></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> Huang, Tim <Tim.Huang@amd.com><br>
<b>Sent:</b> Sunday, June 30, 2024 11:45 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>; Zhang, Yifan <Yifan1.Zhang@amd.com>; Huang, Tim <Tim.Huang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/pm: avoid to load smu firmware for APUs</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Certain call paths still load the SMU firmware for APUs,<br>
which needs to be skipped.<br>
<br>
Signed-off-by: Tim Huang <Tim.Huang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 8 +++-----<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 8 +++-----<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 8 +++-----<br>
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c    | 2 +-<br>
 4 files changed, 10 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
index 18488c02d1cf..c55518fe542c 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
@@ -7324,11 +7324,9 @@ static int gfx_v10_0_hw_init(void *handle)<br>
                  * loaded firstly, so in direct type, it has to load smc ucode<br>
                  * here before rlc.<br>
                  */<br>
-               if (!(adev->flags & AMD_IS_APU)) {<br>
-                       r = amdgpu_pm_load_smu_firmware(adev, NULL);<br>
-                       if (r)<br>
-                               return r;<br>
-               }<br>
+               r = amdgpu_pm_load_smu_firmware(adev, NULL);<br>
+               if (r)<br>
+                       return r;<br>
                 gfx_v10_0_disable_gpa_mode(adev);<br>
         }<br>
 <br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
index 38150398a31b..0ad35e96d2b8 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c<br>
@@ -4558,11 +4558,9 @@ static int gfx_v11_0_hw_init(void *handle)<br>
                  * loaded firstly, so in direct type, it has to load smc ucode<br>
                  * here before rlc.<br>
                  */<br>
-               if (!(adev->flags & AMD_IS_APU)) {<br>
-                       r = amdgpu_pm_load_smu_firmware(adev, NULL);<br>
-                       if (r)<br>
-                               return r;<br>
-               }<br>
+               r = amdgpu_pm_load_smu_firmware(adev, NULL);<br>
+               if (r)<br>
+                       return r;<br>
         }<br>
 <br>
         gfx_v11_0_constants_init(adev);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c<br>
index ccb26f78252a..40edda2c3003 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c<br>
@@ -3306,11 +3306,9 @@ static int gfx_v12_0_hw_init(void *handle)<br>
                  * loaded firstly, so in direct type, it has to load smc ucode<br>
                  * here before rlc.<br>
                  */<br>
-               if (!(adev->flags & AMD_IS_APU)) {<br>
-                       r = amdgpu_pm_load_smu_firmware(adev, NULL);<br>
-                       if (r)<br>
-                               return r;<br>
-               }<br>
+               r = amdgpu_pm_load_smu_firmware(adev, NULL);<br>
+               if (r)<br>
+                       return r;<br>
         }<br>
 <br>
         gfx_v12_0_constants_init(adev);<br>
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c<br>
index b3b5e7b74c85..a1b8a82d77cf 100644<br>
--- a/drivers/gpu/drm/amd/pm/amdgpu_dpm.c<br>
+++ b/drivers/gpu/drm/amd/pm/amdgpu_dpm.c<br>
@@ -618,7 +618,7 @@ int amdgpu_pm_load_smu_firmware(struct amdgpu_device *adev, uint32_t *smu_versio<br>
         const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;<br>
         int r = 0;<br>
 <br>
-       if (!pp_funcs || !pp_funcs->load_firmware)<br>
+       if (!pp_funcs || !pp_funcs->load_firmware || adev->flags & AMD_IS_APU)<br>
                 return 0;<br>
 <br>
         mutex_lock(&adev->pm.mutex);<br>
-- <br>
2.43.0<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>