<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:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-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> Lee, Peyton <Peyton.Lee@amd.com><br>
<b>Sent:</b> Thursday, April 18, 2024 1:12 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>; Liu, HaoPing (Alan) <HaoPing.Liu@amd.com>; Yu, Lang <Lang.Yu@amd.com>; Lee, Peyton <Peyton.Lee@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu/vpe: fix vpe dpm setup failed</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The vpe dpm settings should be done before firmware is loaded.<br>
Otherwise, the frequency cannot be successfully raised.<br>
<br>
Signed-off-by: Peyton Lee <peytolee@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 2 +-<br>
drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c | 14 +++++++-------<br>
2 files changed, 8 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c<br>
index 6695481f870f..c23d97d34b7e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c<br>
@@ -205,7 +205,7 @@ int amdgpu_vpe_configure_dpm(struct amdgpu_vpe *vpe)<br>
dpm_ctl &= 0xfffffffe; /* Disable DPM */<br>
WREG32(vpe_get_reg_offset(vpe, 0, vpe->regs.dpm_enable), dpm_ctl);<br>
dev_dbg(adev->dev, "%s: disable vpe dpm\n", __func__);<br>
- return 0;<br>
+ return -EINVAL;<br>
}<br>
<br>
int amdgpu_vpe_psp_update_sram(struct amdgpu_device *adev)<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c b/drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c<br>
index 769eb8f7bb3c..09315dd5a1ec 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c<br>
@@ -144,6 +144,12 @@ static int vpe_v6_1_load_microcode(struct amdgpu_vpe *vpe)<br>
WREG32(vpe_get_reg_offset(vpe, j, regVPEC_CNTL), ret);<br>
}<br>
<br>
+ /* setup collaborate mode */<br>
+ vpe_v6_1_set_collaborate_mode(vpe, true);<br>
+ /* setup DPM */<br>
+ if (amdgpu_vpe_configure_dpm(vpe))<br>
+ dev_warn(adev->dev, "VPE failed to enable DPM\n");<br>
+<br>
/*<br>
* For VPE 6.1.1, still only need to add master's offset, and psp will apply it to slave as well.<br>
* Here use instance 0 as master.<br>
@@ -159,11 +165,7 @@ static int vpe_v6_1_load_microcode(struct amdgpu_vpe *vpe)<br>
adev->vpe.cmdbuf_cpu_addr[0] = f32_offset;<br>
adev->vpe.cmdbuf_cpu_addr[1] = f32_cntl;<br>
<br>
- amdgpu_vpe_psp_update_sram(adev);<br>
- vpe_v6_1_set_collaborate_mode(vpe, true);<br>
- amdgpu_vpe_configure_dpm(vpe);<br>
-<br>
- return 0;<br>
+ return amdgpu_vpe_psp_update_sram(adev);<br>
}<br>
<br>
vpe_hdr = (const struct vpe_firmware_header_v1_0 *)adev->vpe.fw->data;<br>
@@ -196,8 +198,6 @@ static int vpe_v6_1_load_microcode(struct amdgpu_vpe *vpe)<br>
}<br>
<br>
vpe_v6_1_halt(vpe, false);<br>
- vpe_v6_1_set_collaborate_mode(vpe, true);<br>
- amdgpu_vpe_configure_dpm(vpe);<br>
<br>
return 0;<br>
}<br>
-- <br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>