<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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:#0000FF;margin:15pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Aaron Liu <aaron.liu@amd.com><br>
<b>Sent:</b> Tuesday, May 18, 2021 2:26 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Liu, Aaron <Aaron.Liu@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: modify system reference clock source for navi+</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Starting from Navi+, the rlc reference clock is used for system clock<br>
from vbios gfx_info table. It is incorrect to use core_refclk_10khz of<br>
vbios smu_info table as system clock.<br>
<br>
Signed-off-by: Aaron Liu <aaron.liu@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 15 +++++++++++++++<br>
1 file changed, 15 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c<br>
index 8c417014ca89..83ca58426139 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c<br>
@@ -546,6 +546,21 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev)<br>
ret = 0;<br>
}<br>
<br>
+ /* if asic is Navi+, the rlc reference clock is used for system clock<br>
+ * from vbios gfx_info table */<br>
+ if (adev->asic_type >= CHIP_NAVI10) {<br>
+ index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,<br>
+ gfx_info);<br>
+ if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL,<br>
+ &frev, &crev, &data_offset)) {<br>
+ struct atom_gfx_info_v2_2 *gfx_info = (struct atom_gfx_info_v2_2*)<br>
+ (mode_info->atom_context->bios + data_offset);<br>
+ if ((frev >= 2) && (crev >= 2))</div>
<div class="PlainText">[kevin]:</div>
<div class="PlainText">There is a hidden danger here. We can't assume that the higher version (frev) is compatible with old one.</div>
<div class="PlainText">the code should change to if (frev == 2) && (crev >= 2)) {} ...</div>
<div class="PlainText"><br>
<span></span>+ spll->reference_freq = le32_to_cpu(gfx_info->rlc_gpu_timer_refclk);<br>
+ ret = 0;<br>
+ }<br>
+ }<br>
+<br>
return ret;<br>
}<br>
<br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CKevin1.Wang%40amd.com%7C28bc3524cc2b430f8ee108d919c6494d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637569161701557512%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kD9yMGIWNpeCZc87I%2B4UufLoAssTGQc73DRjOx4ipXM%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CKevin1.Wang%40amd.com%7C28bc3524cc2b430f8ee108d919c6494d%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637569161701557512%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kD9yMGIWNpeCZc87I%2B4UufLoAssTGQc73DRjOx4ipXM%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>