Skip to contentSkip to conversation

drm/amdgpu: Don't show false warning for reg list

PATCH In review Lijo Lazar 2 participants 2 messages Jun 3, 2024

Subsystems (2)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Don't show false warning for reg list

If reg list is already loaded on PSP 13.0.2 SOCs, psp will give TEE_ERR_CANCEL response on second time load. Avoid printing warn message for it.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 25 +++++++++++++++++++++----
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h |  5 +++--
 2 files changed, 24 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +21 -4
index 6d1911773043..079feb139b16 100644
@@ -643,6 +643,20 @@ static const char *psp_gfx_cmd_name(enum psp_gfx_cmd_id cmd_id)
 	}
 }
 
+static bool psp_err_warn(struct psp_context *psp)
+{
+	struct psp_gfx_cmd_resp *cmd = psp->cmd_buf_mem;
+
+	/* This response indicates reg list is already loaded */
+	if (amdgpu_ip_version(psp->adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 2) &&
+	    cmd->cmd_id == GFX_CMD_ID_LOAD_IP_FW &&
+	    cmd->cmd.cmd_load_ip_fw.fw_type == GFX_FW_TYPE_REG_LIST &&
+	    cmd->resp.status == TEE_ERROR_CANCEL)
+		return false;
+
+	return true;
+}
+
 static int
 psp_cmd_submit_buf(struct psp_context *psp,
 		   struct amdgpu_firmware_info *ucode,
@@ -702,10 +716,13 @@ psp_cmd_submit_buf(struct psp_context *psp,
 			dev_warn(psp->adev->dev,
 				 "failed to load ucode %s(0x%X) ",
 				 amdgpu_ucode_name(ucode->ucode_id), ucode->ucode_id);
-		dev_warn(psp->adev->dev,
-			 "psp gfx command %s(0x%X) failed and response status is (0x%X)\n",
-			 psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id), psp->cmd_buf_mem->cmd_id,
-			 psp->cmd_buf_mem->resp.status);
+		if (psp_err_warn(psp))
+			dev_warn(
+				psp->adev->dev,
+				"psp gfx command %s(0x%X) failed and response status is (0x%X)\n",
+				psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id),
+				psp->cmd_buf_mem->cmd_id,
+				psp->cmd_buf_mem->resp.status);
 		/* If any firmware (including CAP) load fails under SRIOV, it should
 		 * return failure to stop the VF from initializing.
 		 * Also return failure in case of timeout
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +3 -2
index 7566973ed8f5..37b5ddd6f13b 100644
@@ -464,8 +464,9 @@ struct psp_gfx_rb_frame
 #define PSP_ERR_UNKNOWN_COMMAND 0x00000100
 
 enum tee_error_code {
-    TEE_SUCCESS                         = 0x00000000,
-    TEE_ERROR_NOT_SUPPORTED             = 0xFFFF000A,
+	TEE_SUCCESS			= 0x00000000,
+	TEE_ERROR_CANCEL		= 0xFFFF0002,
+	TEE_ERROR_NOT_SUPPORTED		= 0xFFFF000A,
 };
 
 #endif /* _PSP_TEE_GFX_IF_H_ */
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Monday, June 3, 2024 2:58 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Li, Candice <[email protected]>
Subject: [PATCH] drm/amdgpu: Don't show false warning for reg list

If reg list is already loaded on PSP 13.0.2 SOCs, psp will give TEE_ERR_CANCEL response on second time load. Avoid printing warn message for it.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 25 +++++++++++++++++++++----  drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h |  5 +++--
 2 files changed, 24 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +13 -0
index 6d1911773043..079feb139b16 100644
@@ -643,6 +643,20 @@ static const char *psp_gfx_cmd_name(enum psp_gfx_cmd_id cmd_id)
        }
 }
 
+static bool psp_err_warn(struct psp_context *psp) {
+       struct psp_gfx_cmd_resp *cmd = psp->cmd_buf_mem;
+
+       /* This response indicates reg list is already loaded */
+       if (amdgpu_ip_version(psp->adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 2) &&
+           cmd->cmd_id == GFX_CMD_ID_LOAD_IP_FW &&
+           cmd->cmd.cmd_load_ip_fw.fw_type == GFX_FW_TYPE_REG_LIST &&
+           cmd->resp.status == TEE_ERROR_CANCEL)
+               return false;
+
+       return true;
+}
+
 static int
 psp_cmd_submit_buf(struct psp_context *psp,
                   struct amdgpu_firmware_info *ucode, @@ -702,10 +716,13 @@ psp_cmd_submit_buf(struct psp_context *psp,
                        dev_warn(psp->adev->dev,
                                 "failed to load ucode %s(0x%X) ",
                                 amdgpu_ucode_name(ucode->ucode_id), ucode->ucode_id);
-               dev_warn(psp->adev->dev,
-                        "psp gfx command %s(0x%X) failed and response status is (0x%X)\n",
-                        psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id), psp->cmd_buf_mem->cmd_id,
-                        psp->cmd_buf_mem->resp.status);
+               if (psp_err_warn(psp))
+                       dev_warn(
+                               psp->adev->dev,
+                               "psp gfx command %s(0x%X) failed and response status is (0x%X)\n",
+                               psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id),
+                               psp->cmd_buf_mem->cmd_id,
+                               psp->cmd_buf_mem->resp.status);

/* If any firmware (including CAP) load fails under SRIOV, it should
* return failure to stop the VF from initializing.
* Also return failure in case of timeout diff --git a/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h b/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h
index 7566973ed8f5..37b5ddd6f13b 100644

drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +3 -3
@@ -464,8 +464,9 @@ struct psp_gfx_rb_frame  #define PSP_ERR_UNKNOWN_COMMAND 0x00000100
 
 enum tee_error_code {
-    TEE_SUCCESS                         = 0x00000000,
-    TEE_ERROR_NOT_SUPPORTED             = 0xFFFF000A,
+       TEE_SUCCESS                     = 0x00000000,
+       TEE_ERROR_CANCEL                = 0xFFFF0002,
+       TEE_ERROR_NOT_SUPPORTED         = 0xFFFF000A,
 };
 
 #endif /* _PSP_TEE_GFX_IF_H_ */
--

2.25.1