Commit 8a2eef1d authored by Grazvydas Ignotas's avatar Grazvydas Ignotas Committed by Alex Deucher

drm/amdgpu: also track late init state

Successful sw_init() and hw_init() states are tracked, but not
late_init(). Various error paths may result in amdgpu_fini() being
called before .late init is done, so late_init needs to be tracked
to avoid unexpected or multiple .late_fini() calls.
Signed-off-by: default avatarGrazvydas Ignotas <notasas@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8cb619d8
...@@ -1943,6 +1943,7 @@ struct amdgpu_ip_block_status { ...@@ -1943,6 +1943,7 @@ struct amdgpu_ip_block_status {
bool valid; bool valid;
bool sw; bool sw;
bool hw; bool hw;
bool late_initialized;
bool hang; bool hang;
}; };
......
...@@ -1424,6 +1424,7 @@ static int amdgpu_late_init(struct amdgpu_device *adev) ...@@ -1424,6 +1424,7 @@ static int amdgpu_late_init(struct amdgpu_device *adev)
DRM_ERROR("late_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); DRM_ERROR("late_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
return r; return r;
} }
adev->ip_block_status[i].late_initialized = true;
} }
} }
...@@ -1469,8 +1470,11 @@ static int amdgpu_fini(struct amdgpu_device *adev) ...@@ -1469,8 +1470,11 @@ static int amdgpu_fini(struct amdgpu_device *adev)
} }
for (i = adev->num_ip_blocks - 1; i >= 0; i--) { for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
if (!adev->ip_block_status[i].late_initialized)
continue;
if (adev->ip_blocks[i].funcs->late_fini) if (adev->ip_blocks[i].funcs->late_fini)
adev->ip_blocks[i].funcs->late_fini((void *)adev); adev->ip_blocks[i].funcs->late_fini((void *)adev);
adev->ip_block_status[i].late_initialized = false;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment