<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:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Please fix your git setup to use your name rather than "root" as the author.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<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> Liu ChengZhe <ChengZhe.Liu@amd.com><br>
<b>Sent:</b> Monday, July 27, 2020 6:57 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Tuikov, Luben <Luben.Tuikov@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Xiao, Jack <Jack.Xiao@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Xu, Feifei <Feifei.Xu@amd.com>; Wang, Kevin(Yang)
<Kevin1.Wang@amd.com>; Yuan, Xiaojie <Xiaojie.Yuan@amd.com>; Liu, Cheng Zhe <ChengZhe.Liu@amd.com><br>
<b>Subject:</b> [PATCH 1/2] drm amdgpu: Skip tmr load for SRIOV</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: root <ChengZhe.Liu@amd.com><br>
<br>
1. For Navi12, CHIP_SIENNA_CICHLID, skip tmr load operation;<br>
2. Check pointer before release firmware.<br>
<br>
Signed-off-by: root <ChengZhe.Liu@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 40 +++++++++++++++++++++----<br>
1 file changed, 34 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
index a053b7af0680..a9481e112cb3 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c<br>
@@ -193,12 +193,18 @@ static int psp_sw_fini(void *handle)<br>
struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
<br>
psp_memory_training_fini(&adev->psp);<br>
- release_firmware(adev->psp.sos_fw);<br>
- adev->psp.sos_fw = NULL;<br>
- release_firmware(adev->psp.asd_fw);<br>
- adev->psp.asd_fw = NULL;<br>
- release_firmware(adev->psp.ta_fw);<br>
- adev->psp.ta_fw = NULL;<br>
+ if (adev->psp.sos_fw) {<br>
+ release_firmware(adev->psp.sos_fw);<br>
+ adev->psp.sos_fw = NULL;<br>
+ }<br>
+ if (adev->psp.asd_fw) {<br>
+ release_firmware(adev->psp.asd_fw);<br>
+ adev->psp.asd_fw = NULL;<br>
+ }<br>
+ if (adev->psp.ta_fw) {<br>
+ release_firmware(adev->psp.ta_fw);<br>
+ adev->psp.ta_fw = NULL;<br>
+ }<br>
<br>
if (adev->asic_type == CHIP_NAVI10)<br>
psp_sysfs_fini(adev);<br>
@@ -409,11 +415,33 @@ static int psp_clear_vf_fw(struct psp_context *psp)<br>
return ret;<br>
}<br>
<br>
+static bool psp_skip_tmr(struct psp_context *psp)<br>
+{<br>
+ bool ret = false;<br>
+<br>
+ switch (psp->adev->asic_type) {<br>
+ case CHIP_NAVI12:<br>
+ case CHIP_SIENNA_CICHLID:<br>
+ ret = true;<br>
+ break;<br>
+ default:<br>
+ return false;<br>
+ }<br>
+<br>
+ return ret;<br>
+}<br>
+<br>
static int psp_tmr_load(struct psp_context *psp)<br>
{<br>
int ret;<br>
struct psp_gfx_cmd_resp *cmd;<br>
<br>
+ /* for Navi12 and CHIP_SIENNA_CICHLID SRIOV, do not setup TMR<br>
+ * (already setup by host driver)<br>
+ */<br>
+ if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))<br>
+ return 0;<br>
+<br>
cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);<br>
if (!cmd)<br>
return -ENOMEM;<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>