<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
p.msipheader87abd423, li.msipheader87abd423, div.msipheader87abd423
        {mso-style-name:msipheader87abd423;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-compose;
        font-family:"Arial",sans-serif;
        color:#317100;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="msipheader87abd423" style="margin:0in"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#317100">[AMD Public Use]</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks, Lakha.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">BR,<o:p></o:p></p>
<p class="MsoNormal">Changfeng.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="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<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:15.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#317100">[AMD Public Use]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Hi Alex, <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">psp_sw_fini() releases the ta firmware
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="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>><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="1" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="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>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></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]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="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?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Alex<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="1" width="98%" align="center">
</div>
<div id="x_divRplyFwdMsg">
<p class="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>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="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><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>