drm/amdgpu: avoid upload corrupted ta ucode to psp
Subsystems (2)
PATCH 1/1 drm/amdgpu: avoid upload corrupted ta ucode to psp
xgmi, ras, hdcp and dtm ta are actually separated ucode and need to handled case by case to upload to psp.
We support the case that ta binary have one or multiple of them built-in. As a result, the driver should check each ta binariy's availablity before decide to upload them to psp.
In the terminate (unload) case, the driver will check the context readiness before perform unload activity. It's fine to keep it as is.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +21 -1
@@ -558,7 +558,9 @@ static int psp_xgmi_initialize(struct psp_context *psp)struct ta_xgmi_shared_memory *xgmi_cmd;int ret; -if (!psp->adev->psp.ta_fw) +if (!psp->adev->psp.ta_fw || + !psp->adev->psp.ta_xgmi_ucode_size || + !psp->adev->psp.ta_xgmi_start_addr)return -ENOENT ;if (!psp->xgmi_context.initialized) {
@@ -768,6 +770,12 @@ static int psp_ras_initialize(struct psp_context *psp) {int ret; +if (!psp->adev->psp.ta_ras_ucode_size || + !psp->adev->psp.ta_ras_start_addr) { +dev_warn (psp->adev->dev,"RAS: ras ta ucode is not available\n" ); +return 0 ; + } +if (!psp->ras.ras_initialized) { ret =psp_ras_init_shared_buf (psp);if (ret)
@@ -857,6 +865,12 @@ static int psp_hdcp_initialize(struct psp_context *psp) {int ret; +if (!psp->adev->psp.ta_hdcp_ucode_size || + !psp->adev->psp.ta_hdcp_start_addr) { +dev_warn (psp->adev->dev,"HDCP: hdcp ta ucode is not available\n" ); +return 0 ; + } +if (!psp->hdcp_context.hdcp_initialized) { ret =psp_hdcp_init_shared_buf (psp);if (ret)
@@ -1030,6 +1044,12 @@ static int psp_dtm_initialize(struct psp_context *psp) {int ret; +if (!psp->adev->psp.ta_dtm_ucode_size || + !psp->adev->psp.ta_dtm_start_addr) { +dev_warn (psp->adev->dev,"DTM: dtm ta ucode is not available\n" ); +return 0 ; + } +if (!psp->dtm_context.dtm_initialized) { ret =psp_dtm_init_shared_buf (psp);if (ret)
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20191111044157.11356-1-Hawking.Zhang-5C7GfCeVMHo@public.gmane.org
Deucher, Alexander
Reviewed-by________________________________
From: Hawking Zhang <[email protected]>
Sent: Sunday, November 10, 2019 11:41 PM
To: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Clements John <[email protected]>; Ma, Le <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH] drm/amdgpu: avoid upload corrupted ta ucode to psp
xgmi, ras, hdcp and dtm ta are actually separated ucode and need to handled case by case to upload to psp.
We support the case that ta binary have one or multiple of them built-in. As a result, the driver should check each ta binariy's availablity before decide to upload them to psp.
In the terminate (unload) case, the driver will check the context readiness before perform unload activity. It's fine to keep it as is.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +21 -1
@@ -558,7 +558,9 @@ static int psp_xgmi_initialize(struct psp_context *psp)struct ta_xgmi_shared_memory *xgmi_cmd;int ret; -if (!psp->adev->psp.ta_fw) +if (!psp->adev->psp.ta_fw || + !psp->adev->psp.ta_xgmi_ucode_size || + !psp->adev->psp.ta_xgmi_start_addr)return -ENOENT ;if (!psp->xgmi_context.initialized) {
@@ -768,6 +770,12 @@ static int psp_ras_initialize(struct psp_context *psp) {int ret; +if (!psp->adev->psp.ta_ras_ucode_size || + !psp->adev->psp.ta_ras_start_addr) { +dev_warn (psp->adev->dev,"RAS: ras ta ucode is not available\n" ); +return 0 ; + } +if (!psp->ras.ras_initialized) { ret =psp_ras_init_shared_buf (psp);if (ret)
@@ -857,6 +865,12 @@ static int psp_hdcp_initialize(struct psp_context *psp) {int ret; +if (!psp->adev->psp.ta_hdcp_ucode_size || + !psp->adev->psp.ta_hdcp_start_addr) { +dev_warn (psp->adev->dev,"HDCP: hdcp ta ucode is not available\n" ); +return 0 ; + } +if (!psp->hdcp_context.hdcp_initialized) { ret =psp_hdcp_init_shared_buf (psp);if (ret)
@@ -1030,6 +1044,12 @@ static int psp_dtm_initialize(struct psp_context *psp) {int ret; +if (!psp->adev->psp.ta_dtm_ucode_size || + !psp->adev->psp.ta_dtm_start_addr) { +dev_warn (psp->adev->dev,"DTM: dtm ta ucode is not available\n" ); +return 0 ; + } +if (!psp->dtm_context.dtm_initialized) { ret =psp_dtm_init_shared_buf (psp);if (ret)
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx