drm/amdgpu: Add kfd init_complete flag to check from amdgpu side
Subsystems (3)
PATCH 2/5 drm/amdgpu: Add kfd init_complete flag to check from amdgpu side
amdgpu driver may be in reset state during init which will not initialize the kfd, driver need to initialize the KFD after reset by check the flag
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -1
@@ -165,7 +165,8 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) adev->doorbell_index.last_non_cp; } -kgd2kfd_device_init (adev->kfd.dev,adev_to_drm (adev), &gpu_resources); + adev->kfd.init_complete =kgd2kfd_device_init (adev->kfd.dev, +adev_to_drm (adev), &gpu_resources); } }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
@@ -80,6 +80,7 @@ struct amdgpu_amdkfd_fence {struct amdgpu_kfd_dev {struct kfd_dev *dev;uint64_t vram_used; +bool init_complete; };enum kgd_engine_type {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -1
@@ -4788,9 +4788,16 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, skip_sched_resume:list_for_each_entry (tmp_adev, device_list_handle, gmc.xgmi.head) { -/*unlock kfd: SRIOV would do it separately */ +/* unlock kfd: SRIOV would do it separately */ if (!need_emergency_restart && !amdgpu_sriov_vf (tmp_adev))amdgpu_amdkfd_post_reset (tmp_adev); + +/* kfd_post_reset will do nothing if kfd device is not initialized, +* need to bring up kfd here if it's not be initialized before +*/ +if (!adev->kfd.init_complete) +amdgpu_amdkfd_device_init (adev); +if (audio_suspended)amdgpu_device_resume_display_audio (tmp_adev);amdgpu_device_unlock_adev (tmp_adev);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Official Use Only - Internal Distribution Only]
Instead of mixing to recover workflow, can this be separated out to something like early_reset().
Thanks,
Lijo
________________________________
From: amd-gfx <[email protected]> on behalf of shaoyunl <[email protected]>
Sent: Friday, March 5, 2021 11:21:49 PM
To: [email protected] <[email protected]>
Cc: Liu, Shaoyun <[email protected]>
Subject: [PATCH 2/5] drm/amdgpu: Add kfd init_complete flag to check from amdgpu side
amdgpu driver may be in reset state during init which will not initialize the kfd, driver need to initialize the KFD after reset by check the flag
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +2 -1
@@ -165,7 +165,8 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) adev->doorbell_index.last_non_cp; } -kgd2kfd_device_init (adev->kfd.dev,adev_to_drm (adev), &gpu_resources); + adev->kfd.init_complete =kgd2kfd_device_init (adev->kfd.dev, +adev_to_drm (adev), &gpu_resources); } }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -0
@@ -80,6 +80,7 @@ struct amdgpu_amdkfd_fence {struct amdgpu_kfd_dev {struct kfd_dev *dev;uint64_t vram_used; +bool init_complete; };enum kgd_engine_type {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -1
@@ -4788,9 +4788,16 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, skip_sched_resume:list_for_each_entry (tmp_adev, device_list_handle, gmc.xgmi.head) { -/*unlock kfd: SRIOV would do it separately */ +/* unlock kfd: SRIOV would do it separately */ if (!need_emergency_restart && !amdgpu_sriov_vf (tmp_adev))amdgpu_amdkfd_post_reset (tmp_adev); + +/* kfd_post_reset will do nothing if kfd device is not initialized, +* need to bring up kfd here if it's not be initialized before +*/ +if (!adev->kfd.init_complete) +amdgpu_amdkfd_device_init (adev); +if (audio_suspended)amdgpu_device_resume_display_audio (tmp_adev);amdgpu_device_unlock_adev (tmp_adev);
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx