mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 18:03:10 -04:00
drm/amd/ras: add device lost check to early exit psp cmd wait loop
Add device lost status check in PSP fence wait loop to exit polling early when GPU device lost Signed-off-by: Ce Sun <cesun102@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -171,6 +171,9 @@ static int amdgpu_ras_sys_check_gpu_status(struct ras_core_context *ras_core,
|
||||
if (amdgpu_in_reset(adev) || amdgpu_ras_in_recovery(adev))
|
||||
gpu_status |= RAS_GPU_STATUS__IN_RESET;
|
||||
|
||||
if (amdgpu_device_bus_status_check(adev))
|
||||
gpu_status |= RAS_GPU_STATUS__DEVICE_LOST;
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
gpu_status |= RAS_GPU_STATUS__IS_VF;
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ enum ras_gpu_status {
|
||||
RAS_GPU_STATUS__IN_RESET = 0x2,
|
||||
RAS_GPU_STATUS__IS_RMA = 0x4,
|
||||
RAS_GPU_STATUS__IS_VF = 0x8,
|
||||
RAS_GPU_STATUS__DEVICE_LOST = 0x10,
|
||||
};
|
||||
|
||||
enum ras_fw_eeprom_cmd {
|
||||
@@ -374,6 +375,7 @@ int ras_core_query_block_ecc_data(struct ras_core_context *ras_core,
|
||||
bool ras_core_gpu_in_reset(struct ras_core_context *ras_core);
|
||||
bool ras_core_gpu_is_rma(struct ras_core_context *ras_core);
|
||||
bool ras_core_gpu_is_vf(struct ras_core_context *ras_core);
|
||||
bool ras_core_gpu_device_lost(struct ras_core_context *ras_core);
|
||||
bool ras_core_handle_nbio_irq(struct ras_core_context *ras_core, void *data);
|
||||
int ras_core_handle_fatal_error(struct ras_core_context *ras_core);
|
||||
|
||||
|
||||
@@ -147,6 +147,20 @@ bool ras_core_gpu_is_vf(struct ras_core_context *ras_core)
|
||||
return (status & RAS_GPU_STATUS__IS_VF) ? true : false;
|
||||
}
|
||||
|
||||
bool ras_core_gpu_device_lost(struct ras_core_context *ras_core)
|
||||
{
|
||||
uint32_t status = 0;
|
||||
|
||||
if (!ras_core)
|
||||
return false;
|
||||
|
||||
if (ras_core->sys_fn &&
|
||||
ras_core->sys_fn->check_gpu_status)
|
||||
ras_core->sys_fn->check_gpu_status(ras_core, &status);
|
||||
|
||||
return (status & RAS_GPU_STATUS__DEVICE_LOST) ? true : false;
|
||||
}
|
||||
|
||||
bool ras_core_gpu_is_rma(struct ras_core_context *ras_core)
|
||||
{
|
||||
if (!ras_core)
|
||||
|
||||
@@ -294,6 +294,9 @@ static int send_psp_cmd(struct ras_core_context *ras_core,
|
||||
psp_ctx->in_fence_value) {
|
||||
if (--timeout == 0)
|
||||
break;
|
||||
|
||||
if (ras_core_gpu_device_lost(ras_core))
|
||||
break;
|
||||
/*
|
||||
* Shouldn't wait for timeout when err_event_athub occurs,
|
||||
* because gpu reset thread triggered and lock resource should
|
||||
|
||||
Reference in New Issue
Block a user