<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
Series is:<br>
<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
Reviewed-by: Rex Zhu<<a href="mailto:rezhu@amd.com">rezhu@amd.com</a>> <br>
<br>
<br>
<br>
</div>
<div align="left">
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
<font color="#000000">Best Regards</font><br>
</div>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
<br>
</div>
<div align="left">
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
<font color="#000000">Rex</font><br>
</div>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
<br>
<br>
</div>
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
获取 <a href="https://aka.ms/ghei36">Outlook for Android</a></div>
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_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 Alex Deucher <alexdeucher@gmail.com><br>
<b>Sent:</b> Thursday, July 12, 2018 10:39:38 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Deucher, Alexander; stable@vger.kernel.org<br>
<b>Subject:</b> [PATCH 1/4] drm/amdgpu/pp/smu7: use a local variable for toc indexing</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:11pt;">
<div class="PlainText">Rather than using the index variable stored in vram.  If<br>
the device fails to come back online after a resume cycle,<br>
reads from vram will return all 1s which will cause a<br>
segfault. Based on a patch from Thomas Martitz <kugel@rockbox.org>.<br>
This avoids the segfault, but we still need to sort out<br>
why the GPU does not come back online after a resume.<br>
<br>
Bug: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=105760">https://bugs.freedesktop.org/show_bug.cgi?id=105760</a><br>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com><br>
Cc: stable@vger.kernel.org<br>
---<br>
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 23 +++++++++++-----------<br>
 1 file changed, 12 insertions(+), 11 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c<br>
index d644a9bb9078..9f407c48d4f0 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c<br>
@@ -381,6 +381,7 @@ int smu7_request_smu_load_fw(struct pp_hwmgr *hwmgr)<br>
         uint32_t fw_to_load;<br>
         int result = 0;<br>
         struct SMU_DRAMData_TOC *toc;<br>
+       uint32_t num_entries = 0;<br>
 <br>
         if (!hwmgr->reload_fw) {<br>
                 pr_info("skip reloading...\n");<br>
@@ -422,41 +423,41 @@ int smu7_request_smu_load_fw(struct pp_hwmgr *hwmgr)<br>
         }<br>
 <br>
         toc = (struct SMU_DRAMData_TOC *)smu_data->header;<br>
-       toc->num_entries = 0;<br>
         toc->structure_version = 1;<br>
 <br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_RLC_G, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_RLC_G, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_CP_CE, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_CP_CE, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_CP_PFP, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_CP_PFP, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_CP_ME, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_CP_ME, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_CP_MEC, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_CP_MEC, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_CP_MEC_JT1, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_CP_MEC_JT1, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_CP_MEC_JT2, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_CP_MEC_JT2, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_SDMA0, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_SDMA0, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_SDMA1, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_SDMA1, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
         if (!hwmgr->not_vf)<br>
                 PP_ASSERT_WITH_CODE(0 == smu7_populate_single_firmware_entry(hwmgr,<br>
-                               UCODE_ID_MEC_STORAGE, &toc->entry[toc->num_entries++]),<br>
+                               UCODE_ID_MEC_STORAGE, &toc->entry[num_entries++]),<br>
                                 "Failed to Get Firmware Entry.", return -EINVAL);<br>
 <br>
+       toc->num_entries = num_entries;<br>
         smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, upper_32_bits(smu_data->header_buffer.mc_addr));<br>
         smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, lower_32_bits(smu_data->header_buffer.mc_addr));<br>
 <br>
-- <br>
2.13.6<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font>
</body>
</html>