Skip to content

Commit 792be2e

Browse files
Tao Zhoualexdeucher
Tao Zhou
authored andcommitted
drm/amdgpu: create function to check RAS RMA status
In the convenience of calling it globally. Signed-off-by: Tao Zhou <[email protected]> Reviewed-by: Hawking Zhang <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 64a9052 commit 792be2e

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ static void amdgpu_ras_interrupt_poison_consumption_handler(struct ras_manager *
21532153
/* gpu reset is fallback for failed and default cases.
21542154
* For RMA case, amdgpu_umc_poison_handler will handle gpu reset.
21552155
*/
2156-
if (poison_stat && !con->is_rma) {
2156+
if (poison_stat && !amdgpu_ras_is_rma(adev)) {
21572157
event_id = amdgpu_ras_acquire_event_id(adev, type);
21582158
RAS_EVENT_LOG(adev, event_id,
21592159
"GPU reset for %s RAS poison consumption is issued!\n",
@@ -2945,7 +2945,7 @@ static void amdgpu_ras_do_page_retirement(struct work_struct *work)
29452945

29462946
amdgpu_ras_error_data_fini(&err_data);
29472947

2948-
if (err_cnt && con->is_rma)
2948+
if (err_cnt && amdgpu_ras_is_rma(adev))
29492949
amdgpu_ras_reset_gpu(adev);
29502950

29512951
amdgpu_ras_schedule_retirement_dwork(con,
@@ -3046,7 +3046,7 @@ static int amdgpu_ras_poison_consumption_handler(struct amdgpu_device *adev,
30463046
}
30473047

30483048
/* for RMA, amdgpu_ras_poison_creation_handler will trigger gpu reset */
3049-
if (reset_flags && !con->is_rma) {
3049+
if (reset_flags && !amdgpu_ras_is_rma(adev)) {
30503050
if (reset_flags & AMDGPU_RAS_GPU_RESET_MODE1_RESET)
30513051
reset = AMDGPU_RAS_GPU_RESET_MODE1_RESET;
30523052
else if (reset_flags & AMDGPU_RAS_GPU_RESET_MODE2_RESET)
@@ -3192,7 +3192,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev)
31923192
* This calling fails when is_rma is true or
31933193
* ret != 0.
31943194
*/
3195-
if (con->is_rma || ret)
3195+
if (amdgpu_ras_is_rma(adev) || ret)
31963196
goto free;
31973197

31983198
if (con->eeprom_control.ras_num_recs) {
@@ -3241,7 +3241,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device *adev)
32413241
* Except error threshold exceeding case, other failure cases in this
32423242
* function would not fail amdgpu driver init.
32433243
*/
3244-
if (!con->is_rma)
3244+
if (!amdgpu_ras_is_rma(adev))
32453245
ret = 0;
32463246
else
32473247
ret = -EINVAL;
@@ -4284,7 +4284,7 @@ int amdgpu_ras_reset_gpu(struct amdgpu_device *adev)
42844284
struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
42854285

42864286
/* mode1 is the only selection for RMA status */
4287-
if (ras->is_rma) {
4287+
if (amdgpu_ras_is_rma(adev)) {
42884288
ras->gpu_reset_flags = 0;
42894289
ras->gpu_reset_flags |= AMDGPU_RAS_GPU_RESET_MODE1_RESET;
42904290
}
@@ -4824,3 +4824,13 @@ void amdgpu_ras_event_log_print(struct amdgpu_device *adev, u64 event_id,
48244824

48254825
va_end(args);
48264826
}
4827+
4828+
bool amdgpu_ras_is_rma(struct amdgpu_device *adev)
4829+
{
4830+
struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
4831+
4832+
if (!con)
4833+
return false;
4834+
4835+
return con->is_rma;
4836+
}

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,4 +974,5 @@ __printf(3, 4)
974974
void amdgpu_ras_event_log_print(struct amdgpu_device *adev, u64 event_id,
975975
const char *fmt, ...);
976976

977+
bool amdgpu_ras_is_rma(struct amdgpu_device *adev);
977978
#endif

drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static int amdgpu_umc_do_page_retirement(struct amdgpu_device *adev,
196196
amdgpu_umc_handle_bad_pages(adev, ras_error_status);
197197

198198
if ((err_data->ue_count || err_data->de_count) &&
199-
(reset || (con && con->is_rma))) {
199+
(reset || amdgpu_ras_is_rma(adev))) {
200200
con->gpu_reset_flags |= reset;
201201
amdgpu_ras_reset_gpu(adev);
202202
}

drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static int gfx_v11_0_3_poison_consumption_handler(struct amdgpu_device *adev,
9797
ras->gpu_reset_flags |= AMDGPU_RAS_GPU_RESET_MODE2_RESET;
9898
}
9999

100-
if (con && !con->is_rma)
100+
if (con && !amdgpu_ras_is_rma(adev))
101101
amdgpu_ras_reset_gpu(adev);
102102
}
103103

0 commit comments

Comments
 (0)