<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<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: Kevin Wang <kevin1.wang@amd.com></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);">
Best Regards,<br>
Kevin</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> Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Tuesday, August 20, 2019 10:09 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Subject:</b> RE: [PATCH 3/4] drm/amd/powerplay: get bootup fclk value</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:SimSun}
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:SimSun}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
span.x_EmailStyle18
        {font-family:"Calibri",sans-serif;
        color:windowtext}
span.x_EmailStyle20
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.25in 1.0in 1.25in}
div.x_WordSection1
        {}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple">
<div class="x_WordSection1">
<p class="x_MsoNormal">Ping..</p>
<p class="x_MsoNormal"> </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="x_MsoNormal"><b>From:</b> Quan, Evan <br>
<b>Sent:</b> Friday, August 16, 2019 4:00 PM<br>
<b>To:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> RE: [PATCH 3/4] drm/amd/powerplay: get bootup fclk value</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Since smu_get_atom_data_table() was already used in smu_v11_0_get_vbios_bootup_values(). We should get all our needed information at once.</p>
<p class="x_MsoNormal">Also, what smu_get_atom_data_table() does is to get the data table from vbios. It’s a time and resource cost job.</p>
<p class="x_MsoNormal">I do not think it’s a good idea to call it again just to get some information we should already know.</p>
<p class="x_MsoNormal"> </p>
<p class="x_MsoNormal">Regards,</p>
<p class="x_MsoNormal">Evan</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="x_MsoNormal"><b>From:</b> Wang, Kevin(Yang) <<a href="mailto:Kevin1.Wang@amd.com">Kevin1.Wang@amd.com</a>>
<br>
<b>Sent:</b> Friday, August 16, 2019 3:10 PM<br>
<b>To:</b> Quan, Evan <<a href="mailto:Evan.Quan@amd.com">Evan.Quan@amd.com</a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: [PATCH 3/4] drm/amd/powerplay: get bootup fclk value</p>
</div>
</div>
<p class="x_MsoNormal"> </p>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">i think we can use a function to retrieve this information without storing it separately.</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">likes: <i> ret = smu_get_atom_data_table(smu, index, &size, &frev, &crev,                                                                                                                      <br>
                                      (uint8_t **)&header);  </i></span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">because these information is a generic information from atom_common_table_header.</span></p>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">and other function don't care it except in smu_v11_0_get_clk_info_from_vbios.</span></p>
</div>
<div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
</div>
<div>
<p class="x_MsoNormal"><span style="font-size:12.0pt; color:black">Best Regards,<br>
Kevin</span></p>
</div>
<div class="x_MsoNormal" align="center" style="text-align:center">
<hr size="2" 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"> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Evan Quan <<a href="mailto:evan.quan@amd.com">evan.quan@amd.com</a>><br>
<b>Sent:</b> Friday, August 16, 2019 2:08 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>><br>
<b>Cc:</b> Quan, Evan <<a href="mailto:Evan.Quan@amd.com">Evan.Quan@amd.com</a>><br>
<b>Subject:</b> [PATCH 3/4] drm/amd/powerplay: get bootup fclk value</span> </p>
<div>
<p class="x_MsoNormal"> </p>
</div>
</div>
<div>
<div>
<p class="x_MsoNormal">This is available with firmwareinfo table v3.2 or later.<br>
<br>
Change-Id: I223edf3c616b9e3e2527c752214fef5ab53d1cea<br>
Signed-off-by: Evan Quan <<a href="mailto:evan.quan@amd.com">evan.quan@amd.com</a>><br>
---<br>
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  3 +++<br>
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 21 +++++++++++++++++++<br>
 2 files changed, 24 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
index ca9b9ec39de8..2c16eb412954 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
@@ -222,6 +222,9 @@ struct smu_bios_boot_up_values<br>
         uint16_t                        vdd_gfx;<br>
         uint8_t                         cooling_id;<br>
         uint32_t                        pp_table_id;<br>
+       uint32_t                        format_revision;<br>
+       uint32_t                        content_revision;<br>
+       uint32_t                        fclk;<br>
 };<br>
 <br>
 enum smu_table_id<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
index 4a51de4ff162..df7b65360ac7 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
@@ -568,6 +568,9 @@ int smu_v11_0_get_vbios_bootup_values(struct smu_context *smu)<br>
                 smu->smu_table.boot_values.pp_table_id = v_3_3->pplib_pptable_id;<br>
         }<br>
 <br>
+       smu->smu_table.boot_values.format_revision = header->format_revision;<br>
+       smu->smu_table.boot_values.content_revision = header->content_revision;<br>
+<br>
         return 0;<br>
 }<br>
 <br>
@@ -647,6 +650,24 @@ static int smu_v11_0_get_clk_info_from_vbios(struct smu_context *smu)<br>
         output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)&input;<br>
         smu->smu_table.boot_values.dclk = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;<br>
 <br>
+       if ((smu->smu_table.boot_values.format_revision == 3) &&<br>
+           (smu->smu_table.boot_values.content_revision >= 2)) {<br>
+               memset(&input, 0, sizeof(input));<br>
+               input.clk_id = SMU11_SYSPLL1_0_FCLK_ID;<br>
+               input.syspll_id = SMU11_SYSPLL1_2_ID;<br>
+               input.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ;<br>
+               index = get_index_into_master_table(atom_master_list_of_command_functions_v2_1,<br>
+                                                   getsmuclockinfo);<br>
+<br>
+               ret = amdgpu_atom_execute_table(adev->mode_info.atom_context, index,<br>
+                                               (uint32_t *)&input);<br>
+               if (ret)<br>
+                       return -EINVAL;<br>
+<br>
+               output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)&input;<br>
+               smu->smu_table.boot_values.fclk = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;<br>
+       }<br>
+<br>
         return 0;<br>
 }<br>
 <br>
-- <br>
2.22.0<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://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>