drm/amdgpu: Add kfd init_complete flag to check from amdgpu side
Subsystems (3)
PATCH 3/4 drm/amdgpu: Add kfd init_complete flag to check from amdgpu side
amdgpu driver may in reset state duirng 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 | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-)
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 +7 -0
@@ -4841,6 +4841,13 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,/*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]
-----Original Message-----
From: Liu, Shaoyun <[email protected]>
Sent: Thursday, February 18, 2021 8:20 PM
To: [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: [PATCH 3/4] drm/amdgpu: Add kfd init_complete flag to check from amdgpu side
amdgpu driver may in reset state duirng 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 | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-)
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 +7 -0
@@ -4841,6 +4841,13 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,/*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://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 2 lines · shaoyunl
amdgpu driver may in reset state duirng init which will not initialize the kfd,
grammer "may be in"
typo duirng -> during
Quoted 41 lines
driver need to initialize the KFD after reset by check the flag
Signed-off-by shaoyunl <[email protected]>Change-Id Ic1684b55b27e0afd42bee8b9b431c4fb0afcec15--- 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 | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-)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 +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 4847
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0@@ -4841,6 +4841,13 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,/*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 +*/
Fix up the comment here. Need a space between * and the comment. E.g., /* kfd_post_reset ...
Also, I think this patch also needs to come before patch 1.
With those comments addressed:
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-1+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
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx