<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">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-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> Zhu, Changfeng <Changfeng.Zhu@amd.com><br>
<b>Sent:</b> Thursday, September 3, 2020 11:19 AM<br>
<b>To:</b> Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Huang, Ray <Ray.Huang@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu: add ta firmware load in psp_v12_0 for renoir</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:DengXian}
@font-face
        {font-family:Calibri}
@font-face
        {}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
p.x_msipheader87abd423, li.x_msipheader87abd423, div.x_msipheader87abd423
        {margin-right:0in;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_EmailStyle20
        {font-family:"Arial",sans-serif;
        color:#317100}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
        {}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple">
<p align="Left" style="font-family:Arial; font-size:10pt; color:#317100; margin:15pt">
[AMD Public Use]<br>
</p>
<br>
<div>
<div class="x_WordSection1">
<p class="x_msipheader87abd423" style="margin:0in"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Thanks, Lakha.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">BR,</p>
<p class="x_MsoNormal">Changfeng.</p>
<p class="x_MsoNormal"> </p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal"><b>From:</b> Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>
<br>
<b>Sent:</b> Thursday, September 3, 2020 11:07 PM<br>
<b>To:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Zhu, Changfeng <Changfeng.Zhu@amd.com>; amd-gfx@lists.freedesktop.org; Huang, Ray <Ray.Huang@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: add ta firmware load in psp_v12_0 for renoir</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p style="margin:15.0pt"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal"> </p>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Hi Alex, </span>
</p>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">psp_sw_fini() releases the ta firmware
</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Reviewed-by: Bhawanpreet Lakha <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>></span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<p class="x_MsoNormal"> </p>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="1" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="x_MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>><br>
<b>Sent:</b> September 2, 2020 10:18 AM<br>
<b>To:</b> Zhu, Changfeng <<a href="mailto:Changfeng.Zhu@amd.com">Changfeng.Zhu@amd.com</a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>>; Huang, Ray <<a href="mailto:Ray.Huang@amd.com">Ray.Huang@amd.com</a>>; Lakha, Bhawanpreet <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: add ta firmware load in psp_v12_0 for renoir</span>
</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<p style="margin:15.0pt"><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#317100">[AMD Public Use]</span></p>
<p class="x_MsoNormal"> </p>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">We also need to release the firmware when the driver unloads or is that already handled in some common path?</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Alex</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="1" width="98%" align="center">
</div>
<div id="x_x_divRplyFwdMsg">
<p class="x_MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Changfeng.Zhu <<a href="mailto:changfeng.zhu@amd.com">changfeng.zhu@amd.com</a>><br>
<b>Sent:</b> Tuesday, September 1, 2020 10:25 PM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>>; Huang, Ray <<a href="mailto:Ray.Huang@amd.com">Ray.Huang@amd.com</a>>; Lakha, Bhawanpreet
 <<a href="mailto:Bhawanpreet.Lakha@amd.com">Bhawanpreet.Lakha@amd.com</a>><br>
<b>Cc:</b> Zhu, Changfeng <<a href="mailto:Changfeng.Zhu@amd.com">Changfeng.Zhu@amd.com</a>><br>
<b>Subject:</b> [PATCH] drm/amdgpu: add ta firmware load in psp_v12_0 for renoir</span>
</p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">From: changzhu <<a href="mailto:Changfeng.Zhu@amd.com">Changfeng.Zhu@amd.com</a>><br>
<br>
From: Changfeng <<a href="mailto:Changfeng.Zhu@amd.com">Changfeng.Zhu@amd.com</a>><br>
<br>
It needs to load renoir_ta firmware because hdcp is enabled by default<br>
for renoir now. This can avoid error:DTM TA is not initialized<br>
<br>
Change-Id: Ib2f03a531013e4b432c2e9d4ec3dc021b4f8da7d<br>
Signed-off-by: Changfeng <<a href="mailto:Changfeng.Zhu@amd.com">Changfeng.Zhu@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/psp_v12_0.c | 54 ++++++++++++++++++++++++++<br>
 1 file changed, 54 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c<br>
index 6c9614f77d33..75489313dbad 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v12_0.c<br>
@@ -38,6 +38,8 @@<br>
 #include "oss/osssys_4_0_sh_mask.h"<br>
 <br>
 MODULE_FIRMWARE("amdgpu/renoir_asd.bin");<br>
+MODULE_FIRMWARE("amdgpu/renoir_ta.bin");<br>
+<br>
 /* address block */<br>
 #define smnMP1_FIRMWARE_FLAGS           0x3010024<br>
 <br>
@@ -45,7 +47,10 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)<br>
 {<br>
         struct amdgpu_device *adev = psp->adev;<br>
         const char *chip_name;<br>
+       char fw_name[30];<br>
         int err = 0;<br>
+       const struct ta_firmware_header_v1_0 *ta_hdr;<br>
+       DRM_DEBUG("\n");<br>
 <br>
         switch (adev->asic_type) {<br>
         case CHIP_RENOIR:<br>
@@ -56,6 +61,55 @@ static int psp_v12_0_init_microcode(struct psp_context *psp)<br>
         }<br>
 <br>
         err = psp_init_asd_microcode(psp, chip_name);<br>
+       if (err)<br>
+               goto out;<br>
+<br>
+       snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);<br>
+       err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);<br>
+       if (err) {<br>
+               release_firmware(adev->psp.ta_fw);<br>
+               adev->psp.ta_fw = NULL;<br>
+               dev_info(adev->dev,<br>
+                        "psp v12.0: Failed to load firmware \"%s\"\n",<br>
+                        fw_name);<br>
+       } else {<br>
+               err = amdgpu_ucode_validate(adev->psp.ta_fw);<br>
+               if (err)<br>
+                       goto out2;<br>
+<br>
+               ta_hdr = (const struct ta_firmware_header_v1_0 *)<br>
+                                adev->psp.ta_fw->data;<br>
+               adev->psp.ta_hdcp_ucode_version =<br>
+                       le32_to_cpu(ta_hdr->ta_hdcp_ucode_version);<br>
+               adev->psp.ta_hdcp_ucode_size =<br>
+                       le32_to_cpu(ta_hdr->ta_hdcp_size_bytes);<br>
+               adev->psp.ta_hdcp_start_addr =<br>
+                       (uint8_t *)ta_hdr +<br>
+                       le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);<br>
+<br>
+               adev->psp.ta_fw_version = le32_to_cpu(ta_hdr->header.ucode_version);<br>
+<br>
+               adev->psp.ta_dtm_ucode_version =<br>
+                       le32_to_cpu(ta_hdr->ta_dtm_ucode_version);<br>
+               adev->psp.ta_dtm_ucode_size =<br>
+                       le32_to_cpu(ta_hdr->ta_dtm_size_bytes);<br>
+               adev->psp.ta_dtm_start_addr =<br>
+                       (uint8_t *)adev->psp.ta_hdcp_start_addr +<br>
+                       le32_to_cpu(ta_hdr->ta_dtm_offset_bytes);<br>
+       }<br>
+<br>
+       return 0;<br>
+<br>
+out2:<br>
+       release_firmware(adev->psp.ta_fw);<br>
+       adev->psp.ta_fw = NULL;<br>
+out:<br>
+       if (err) {<br>
+               dev_err(adev->dev,<br>
+                       "psp v12.0: Failed to load firmware \"%s\"\n",<br>
+                       fw_name);<br>
+       }<br>
+<br>
         return err;<br>
 }<br>
 <br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7C324a6285d81146a0639b08d84ee78d14%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637346103730596780&amp;sdata=ItQDVbjEzkmKeeEU%2BV01rQb4iGuWvHaqRAFlC4e6oqI%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7C324a6285d81146a0639b08d84ee78d14%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637346103730596780&amp;sdata=ItQDVbjEzkmKeeEU%2BV01rQb4iGuWvHaqRAFlC4e6oqI%3D&amp;reserved=0</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>