summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
diff options
context:
space:
mode:
authorLijo Lazar <lijo.lazar@amd.com>2024-10-07 13:49:45 +0530
committerAlex Deucher <alexander.deucher@amd.com>2024-10-15 11:22:26 -0400
commitd25d26b8a87a97ce3bd7f5db840f9ca72ba5d422 (patch)
treec4de97909b72863bf958fd3f75388b3b97482046 /drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
parent98c0b0efcc11f2a5ddf3ce33af1e48eedf808b04 (diff)
drm/amdgpu: Wait for reset on init completion
When reset on initialization is requested, wait for the reset to finish. In cases where module is loaded after boot, this makes sure all initialization work is done after a successful return of modprobe. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Ramesh Errabolu <ramesh.errabolu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index 63503719303c..fcdbcff57632 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -1548,6 +1548,7 @@ static void amdgpu_xgmi_schedule_reset_on_init(struct amdgpu_hive_info *hive)
int amdgpu_xgmi_reset_on_init(struct amdgpu_device *adev)
{
struct amdgpu_hive_info *hive;
+ bool reset_scheduled;
int num_devs;
hive = amdgpu_get_xgmi_hive(adev);
@@ -1556,12 +1557,18 @@ int amdgpu_xgmi_reset_on_init(struct amdgpu_device *adev)
mutex_lock(&hive->hive_lock);
num_devs = atomic_read(&hive->number_devices);
- if (num_devs == adev->gmc.xgmi.num_physical_nodes)
+ reset_scheduled = false;
+ if (num_devs == adev->gmc.xgmi.num_physical_nodes) {
amdgpu_xgmi_schedule_reset_on_init(hive);
+ reset_scheduled = true;
+ }
mutex_unlock(&hive->hive_lock);
amdgpu_put_xgmi_hive(hive);
+ if (reset_scheduled)
+ flush_work(&hive->reset_on_init_work);
+
return 0;
}