<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)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@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;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:SimSun;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
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="#0563C1" vlink="#954F72">
<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 class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">Acked-by: Evan Quan <evan.quan@amd.com><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> amd-gfx <amd-gfx-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Guo Lei<br>
<b>Sent:</b> Monday, June 15, 2020 3:14 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH] drm/amdgpu: Fix incorrect firmware size calculation<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">From 014162f69b909a59c241e7f73c3630d1da34696c Mon Sep 17 00:00:00 2001<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">From: Lei Guo <<a href="mailto:raykwok1150@163.com">raykwok1150@163.com</a>><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Date: Mon, 15 Jun 2020 13:54:26 +0800<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Subject: [PATCH] drm/amdgpu: Fix incorrect firmware size calculation<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">[WHY]<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">The memcpy() function copies n bytes from memory area src to memory area<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">dest. So specify the firmware size in bytes.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">[How]<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Correct the calculation.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Signed-off-by: Lei Guo <<a href="mailto:raykwok1150@163.com">raykwok1150@163.com</a>><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">Reviewed-by: Junwei Zhang <<a href="mailto:zjunweihit@163.com">zjunweihit@163.com</a>><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">---<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> 1 file changed, 1 insertion(+), 1 deletion(-)<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">index 6b94587df407..c3e59b765268 100644<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">@@ -1960,7 +1960,7 @@ static int gfx_v9_0_mec_init(struct amdgpu_device *adev)<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> fw_data = (const __le32 *)<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> (adev->gfx.mec_fw->data +<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> le32_to_cpu(mec_hdr->header.ucode_array_offset_bytes));<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">- fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes) / 4;<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">+ fw_size = le32_to_cpu(mec_hdr->header.ucode_size_bytes);<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> r = amdgpu_bo_create_reserved(adev, mec_hdr->header.ucode_size_bytes,<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"> PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">-- <o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black">2.17.1<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Arial",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<p> <o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>