<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p style="font-family:Arial;font-size:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
Instead of mixing to recover workflow, can this be separated out to something like early_reset().</div>
<div id="ms-outlook-mobile-signature">
<div><br>
</div>
Thanks,<br>
Lijo</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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of shaoyunl <shaoyun.liu@amd.com><br>
<b>Sent:</b> Friday, March 5, 2021 11:21:49 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Liu, Shaoyun <Shaoyun.Liu@amd.com><br>
<b>Subject:</b> [PATCH 2/5] drm/amdgpu: Add kfd init_complete flag to check from amdgpu side</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">amdgpu driver may be in reset state during init which will not initialize the kfd,<br>
driver need to initialize the KFD after reset by check the flag<br>
<br>
Signed-off-by: shaoyunl <shaoyun.liu@amd.com><br>
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
Change-Id: Ic1684b55b27e0afd42bee8b9b431c4fb0afcec15<br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++-<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 1 +<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 ++++++++-<br>
3 files changed, 11 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
index c5343a5eecbe..a876dc3af017 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c<br>
@@ -165,7 +165,8 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)<br>
adev->doorbell_index.last_non_cp;<br>
}<br>
<br>
- kgd2kfd_device_init(adev->kfd.dev, adev_to_drm(adev), &gpu_resources);<br>
+ adev->kfd.init_complete = kgd2kfd_device_init(adev->kfd.dev,<br>
+ adev_to_drm(adev), &gpu_resources);<br>
}<br>
}<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h<br>
index 4687ff2961e1..3182dd97840e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h<br>
@@ -80,6 +80,7 @@ struct amdgpu_amdkfd_fence {<br>
struct amdgpu_kfd_dev {<br>
struct kfd_dev *dev;<br>
uint64_t vram_used;<br>
+ bool init_complete;<br>
};<br>
<br>
enum kgd_engine_type {<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index a11760ec3924..62d7ce621457 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -4788,9 +4788,16 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,<br>
<br>
skip_sched_resume:<br>
list_for_each_entry(tmp_adev, device_list_handle, gmc.xgmi.head) {<br>
- /*unlock kfd: SRIOV would do it separately */<br>
+ /* unlock kfd: SRIOV would do it separately */<br>
if (!need_emergency_restart && !amdgpu_sriov_vf(tmp_adev))<br>
amdgpu_amdkfd_post_reset(tmp_adev);<br>
+<br>
+ /* kfd_post_reset will do nothing if kfd device is not initialized,<br>
+ * need to bring up kfd here if it's not be initialized before<br>
+ */<br>
+ if (!adev->kfd.init_complete)<br>
+ amdgpu_amdkfd_device_init(adev);<br>
+<br>
if (audio_suspended)<br>
amdgpu_device_resume_display_audio(tmp_adev);<br>
amdgpu_device_unlock_adev(tmp_adev);<br>
-- <br>
2.17.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%7Clijo.lazar%40amd.com%7Cdb39943153f3475c5b4808d8dfff64ec%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637505635308266548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pYdyi4KiRX7qz5S1Gog63pYZ26sSIUesx3V1jHMXwrM%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7Cdb39943153f3475c5b4808d8dfff64ec%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637505635308266548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pYdyi4KiRX7qz5S1Gog63pYZ26sSIUesx3V1jHMXwrM%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>