Skip to contentSkip to conversation

drm/amd/ras: Return RAS TA injection result to userspace

PATCH In review Stanley.Yang 2 participants 3 messages May 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/ras: Return RAS TA injection result to userspace

Return RAS TA injection result to userspace that avoid app continue to load work once injection failed.

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 3 +++
 drivers/gpu/drm/amd/ras/rascore/ras_psp.c        | 5 +++++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
index ef09a6fad659..11f01b2ec211 100644
@@ -686,6 +686,9 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,
 	if (!ret && !cmd_ctx->cmd_res && output && (out_size == cmd_ctx->output_size))
 		memcpy(output, cmd_ctx->output_buff_raw, cmd_ctx->output_size);
 
+	if (cmd_ctx->cmd_res && cmd_id == RAS_CMD__INJECT_ERROR)
+		ret = cmd_ctx->cmd_res;
+
 	kfree(cmd_ctx);
 
 	return ret;
drivers/gpu/drm/amd/ras/rascore/ras_psp.c +5 -0
index 5d556e2a7000..e26fe8107ac7 100644
@@ -417,6 +417,11 @@ static int send_ras_ta_runtime_cmd(struct ras_core_context *ras_core,
 	if (!ras_cmd->ras_status && out && out_size)
 		memcpy(out, &ras_cmd->ras_out_message, out_size);
 
+	if (ras_cmd->ras_status == TA_RAS_STATUS__TEE_ERROR_ACCESS_DENIED)
+		ret = -EACCES;
+	else if (ras_cmd->ras_status)
+		ret = -EINVAL;
+
 	__check_ras_ta_cmd_resp(ras_core, ras_cmd);
 
 unlock:
Signature · 1 line
2.43.0
#1 lore raw

AMD General

Best Regards,
Thomas
-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Monday, May 25, 2026 3:52 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Li, Candice <[email protected]>; Yang, Stanley <[email protected]>
Subject: [PATCH 1/1] drm/amd/ras: Return RAS TA injection result to userspace

Return RAS TA injection result to userspace that avoid app continue to load work once injection failed.

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 3 +++
 drivers/gpu/drm/amd/ras/rascore/ras_psp.c        | 5 +++++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
index ef09a6fad659..11f01b2ec211 100644
@@ -686,6 +686,9 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct amdgpu_device *adev,
        if (!ret && !cmd_ctx->cmd_res && output && (out_size == cmd_ctx->output_size))
                memcpy(output, cmd_ctx->output_buff_raw, cmd_ctx->output_size);
 
+       if (cmd_ctx->cmd_res && cmd_id == RAS_CMD__INJECT_ERROR)
+               ret = cmd_ctx->cmd_res;
+
        kfree(cmd_ctx);
 
        return ret;
drivers/gpu/drm/amd/ras/rascore/ras_psp.c +5 -0
index 5d556e2a7000..e26fe8107ac7 100644
@@ -417,6 +417,11 @@ static int send_ras_ta_runtime_cmd(struct ras_core_context *ras_core,
        if (!ras_cmd->ras_status && out && out_size)
                memcpy(out, &ras_cmd->ras_out_message, out_size);
 
+       if (ras_cmd->ras_status == TA_RAS_STATUS__TEE_ERROR_ACCESS_DENIED)
+               ret = -EACCES;
+       else if (ras_cmd->ras_status)
+               ret = -EINVAL;
+
        __check_ras_ta_cmd_resp(ras_core, ras_cmd);
 

[Thomas] Can we refactor __check_ras_ta_cmd_resp to return a value and assign ret = __check_ras_ta_cmd_resp(...), moving the above changes into the __check_ras_ta_cmd_resp function?

unlock:
--
2.43.0

#2 lore raw

AMD General

Will send v2.

Regards,
Stanley

Quoted 75 lines

-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Monday, May 25, 2026 4:50 PM
To: Yang, Stanley <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>
Subject: RE: [PATCH 1/1] drm/amd/ras: Return RAS TA injection result to userspace

AMD General

Best Regards,
Thomas
-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Monday, May 25, 2026 3:52 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>; Li, Candice <[email protected]>; Yang, Stanley <[email protected]>
Subject: [PATCH 1/1] drm/amd/ras: Return RAS TA injection result to userspace

Return RAS TA injection result to userspace that avoid app continue to load work once injection failed.

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 3 +++
 drivers/gpu/drm/amd/ras/rascore/ras_psp.c        | 5 +++++
 2 files changed, 8 insertions(+)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +3 -0
index ef09a6fad659..11f01b2ec211 100644
@@ -686,6 +686,9 @@ int amdgpu_ras_mgr_handle_ras_cmd(struct
 amdgpu_device *adev,
        if (!ret && !cmd_ctx->cmd_res && output && (out_size == cmd_ctx-
 >output_size))
                memcpy(output, cmd_ctx->output_buff_raw, cmd_ctx->output_size);
 
+       if (cmd_ctx->cmd_res && cmd_id == RAS_CMD__INJECT_ERROR)
+               ret = cmd_ctx->cmd_res;
+
        kfree(cmd_ctx);
        return ret;
drivers/gpu/drm/amd/ras/rascore/ras_psp.c +5 -0
index 5d556e2a7000..e26fe8107ac7 100644
@@ -417,6 +417,11 @@ static int send_ras_ta_runtime_cmd(struct
 ras_core_context *ras_core,
        if (!ras_cmd->ras_status && out && out_size)
                memcpy(out, &ras_cmd->ras_out_message, out_size);
 
+       if (ras_cmd->ras_status ==
 TA_RAS_STATUS__TEE_ERROR_ACCESS_DENIED)
+               ret = -EACCES;
+       else if (ras_cmd->ras_status)
+               ret = -EINVAL;
+
        __check_ras_ta_cmd_resp(ras_core, ras_cmd);

[Thomas] Can we refactor __check_ras_ta_cmd_resp to return a value and assign ret = __check_ras_ta_cmd_resp(...), moving the above changes into the __check_ras_ta_cmd_resp function?

unlock:
--
2.43.0