Skip to content

Commit 51bd363

Browse files
Hawking Zhangalexdeucher
authored andcommitted
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. Signed-off-by: Hawking Zhang <[email protected]> Reviewed-by: Le Ma <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 53dbc27 commit 51bd363

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,9 @@ static int psp_xgmi_initialize(struct psp_context *psp)
567567
struct ta_xgmi_shared_memory *xgmi_cmd;
568568
int ret;
569569

570-
if (!psp->adev->psp.ta_fw)
570+
if (!psp->adev->psp.ta_fw ||
571+
!psp->adev->psp.ta_xgmi_ucode_size ||
572+
!psp->adev->psp.ta_xgmi_start_addr)
571573
return -ENOENT;
572574

573575
if (!psp->xgmi_context.initialized) {
@@ -777,6 +779,12 @@ static int psp_ras_initialize(struct psp_context *psp)
777779
{
778780
int ret;
779781

782+
if (!psp->adev->psp.ta_ras_ucode_size ||
783+
!psp->adev->psp.ta_ras_start_addr) {
784+
dev_warn(psp->adev->dev, "RAS: ras ta ucode is not available\n");
785+
return 0;
786+
}
787+
780788
if (!psp->ras.ras_initialized) {
781789
ret = psp_ras_init_shared_buf(psp);
782790
if (ret)
@@ -866,6 +874,12 @@ static int psp_hdcp_initialize(struct psp_context *psp)
866874
{
867875
int ret;
868876

877+
if (!psp->adev->psp.ta_hdcp_ucode_size ||
878+
!psp->adev->psp.ta_hdcp_start_addr) {
879+
dev_warn(psp->adev->dev, "HDCP: hdcp ta ucode is not available\n");
880+
return 0;
881+
}
882+
869883
if (!psp->hdcp_context.hdcp_initialized) {
870884
ret = psp_hdcp_init_shared_buf(psp);
871885
if (ret)
@@ -1039,6 +1053,12 @@ static int psp_dtm_initialize(struct psp_context *psp)
10391053
{
10401054
int ret;
10411055

1056+
if (!psp->adev->psp.ta_dtm_ucode_size ||
1057+
!psp->adev->psp.ta_dtm_start_addr) {
1058+
dev_warn(psp->adev->dev, "DTM: dtm ta ucode is not available\n");
1059+
return 0;
1060+
}
1061+
10421062
if (!psp->dtm_context.dtm_initialized) {
10431063
ret = psp_dtm_init_shared_buf(psp);
10441064
if (ret)

0 commit comments

Comments
 (0)