Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: create function to check RAS RMA status

In the convenience of calling it globally.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Tao Zhou and committed by
Alex Deucher
792be2e2 64a90520

+19 -8
+16 -6
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
··· 2153 2153 /* gpu reset is fallback for failed and default cases. 2154 2154 * For RMA case, amdgpu_umc_poison_handler will handle gpu reset. 2155 2155 */ 2156 - if (poison_stat && !con->is_rma) { 2156 + if (poison_stat && !amdgpu_ras_is_rma(adev)) { 2157 2157 event_id = amdgpu_ras_acquire_event_id(adev, type); 2158 2158 RAS_EVENT_LOG(adev, event_id, 2159 2159 "GPU reset for %s RAS poison consumption is issued!\n", ··· 2945 2945 2946 2946 amdgpu_ras_error_data_fini(&err_data); 2947 2947 2948 - if (err_cnt && con->is_rma) 2948 + if (err_cnt && amdgpu_ras_is_rma(adev)) 2949 2949 amdgpu_ras_reset_gpu(adev); 2950 2950 2951 2951 amdgpu_ras_schedule_retirement_dwork(con, ··· 3046 3046 } 3047 3047 3048 3048 /* 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)) { 3050 3050 if (reset_flags & AMDGPU_RAS_GPU_RESET_MODE1_RESET) 3051 3051 reset = AMDGPU_RAS_GPU_RESET_MODE1_RESET; 3052 3052 else if (reset_flags & AMDGPU_RAS_GPU_RESET_MODE2_RESET) ··· 3192 3192 * This calling fails when is_rma is true or 3193 3193 * ret != 0. 3194 3194 */ 3195 - if (con->is_rma || ret) 3195 + if (amdgpu_ras_is_rma(adev) || ret) 3196 3196 goto free; 3197 3197 3198 3198 if (con->eeprom_control.ras_num_recs) { ··· 3241 3241 * Except error threshold exceeding case, other failure cases in this 3242 3242 * function would not fail amdgpu driver init. 3243 3243 */ 3244 - if (!con->is_rma) 3244 + if (!amdgpu_ras_is_rma(adev)) 3245 3245 ret = 0; 3246 3246 else 3247 3247 ret = -EINVAL; ··· 4284 4284 struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); 4285 4285 4286 4286 /* mode1 is the only selection for RMA status */ 4287 - if (ras->is_rma) { 4287 + if (amdgpu_ras_is_rma(adev)) { 4288 4288 ras->gpu_reset_flags = 0; 4289 4289 ras->gpu_reset_flags |= AMDGPU_RAS_GPU_RESET_MODE1_RESET; 4290 4290 } ··· 4823 4823 dev_printk(KERN_INFO, adev->dev, "%pV", &vaf); 4824 4824 4825 4825 va_end(args); 4826 + } 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; 4826 4836 }
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
··· 974 974 void amdgpu_ras_event_log_print(struct amdgpu_device *adev, u64 event_id, 975 975 const char *fmt, ...); 976 976 977 + bool amdgpu_ras_is_rma(struct amdgpu_device *adev); 977 978 #endif
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
··· 196 196 amdgpu_umc_handle_bad_pages(adev, ras_error_status); 197 197 198 198 if ((err_data->ue_count || err_data->de_count) && 199 - (reset || (con && con->is_rma))) { 199 + (reset || amdgpu_ras_is_rma(adev))) { 200 200 con->gpu_reset_flags |= reset; 201 201 amdgpu_ras_reset_gpu(adev); 202 202 }
+1 -1
drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c
··· 97 97 ras->gpu_reset_flags |= AMDGPU_RAS_GPU_RESET_MODE2_RESET; 98 98 } 99 99 100 - if (con && !con->is_rma) 100 + if (con && !amdgpu_ras_is_rma(adev)) 101 101 amdgpu_ras_reset_gpu(adev); 102 102 } 103 103