drm/amd: consolidate TA shared memory structures
authorCandice Li <candice.li@amd.com>
Mon, 16 Aug 2021 15:28:55 +0000 (23:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Aug 2021 22:22:53 +0000 (18:22 -0400)
Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: John Clements <john.clements@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
drivers/gpu/drm/amd/amdgpu/amdgpu_rap.c
drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c

index 3cf875e..a78a832 100644 (file)
@@ -909,9 +909,9 @@ static int psp_xgmi_init_shared_buf(struct psp_context *psp)
         */
        ret = amdgpu_bo_create_kernel(psp->adev, PSP_XGMI_SHARED_MEM_SIZE,
                                      PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
-                                     &psp->xgmi_context.xgmi_shared_bo,
-                                     &psp->xgmi_context.xgmi_shared_mc_addr,
-                                     &psp->xgmi_context.xgmi_shared_buf);
+                                     &psp->xgmi_context.context.mem_context.shared_bo,
+                                     &psp->xgmi_context.context.mem_context.shared_mc_addr,
+                                     &psp->xgmi_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -958,15 +958,15 @@ static int psp_xgmi_load(struct psp_context *psp)
        psp_prep_ta_load_cmd_buf(cmd,
                                 psp->fw_pri_mc_addr,
                                 psp->xgmi.size_bytes,
-                                psp->xgmi_context.xgmi_shared_mc_addr,
+                                psp->xgmi_context.context.mem_context.shared_mc_addr,
                                 PSP_XGMI_SHARED_MEM_SIZE);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd,
                                 psp->fence_buf_mc_addr);
 
        if (!ret) {
-               psp->xgmi_context.initialized = 1;
-               psp->xgmi_context.session_id = cmd->resp.session_id;
+               psp->xgmi_context.context.initialized = true;
+               psp->xgmi_context.context.session_id = cmd->resp.session_id;
        }
 
        release_psp_cmd_buf(psp);
@@ -991,7 +991,7 @@ static int psp_xgmi_unload(struct psp_context *psp)
 
        cmd = acquire_psp_cmd_buf(psp);
 
-       psp_prep_ta_unload_cmd_buf(cmd, psp->xgmi_context.session_id);
+       psp_prep_ta_unload_cmd_buf(cmd, psp->xgmi_context.context.session_id);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd,
                                 psp->fence_buf_mc_addr);
@@ -1003,26 +1003,26 @@ static int psp_xgmi_unload(struct psp_context *psp)
 
 int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
 {
-       return psp_ta_invoke(psp, ta_cmd_id, psp->xgmi_context.session_id);
+       return psp_ta_invoke(psp, ta_cmd_id, psp->xgmi_context.context.session_id);
 }
 
 int psp_xgmi_terminate(struct psp_context *psp)
 {
        int ret;
 
-       if (!psp->xgmi_context.initialized)
+       if (!psp->xgmi_context.context.initialized)
                return 0;
 
        ret = psp_xgmi_unload(psp);
        if (ret)
                return ret;
 
-       psp->xgmi_context.initialized = 0;
+       psp->xgmi_context.context.initialized = false;
 
        /* free xgmi shared memory */
-       amdgpu_bo_free_kernel(&psp->xgmi_context.xgmi_shared_bo,
-                       &psp->xgmi_context.xgmi_shared_mc_addr,
-                       &psp->xgmi_context.xgmi_shared_buf);
+       amdgpu_bo_free_kernel(&psp->xgmi_context.context.mem_context.shared_bo,
+                       &psp->xgmi_context.context.mem_context.shared_mc_addr,
+                       &psp->xgmi_context.context.mem_context.shared_buf);
 
        return 0;
 }
@@ -1040,7 +1040,7 @@ int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool lo
        if (!load_ta)
                goto invoke;
 
-       if (!psp->xgmi_context.initialized) {
+       if (!psp->xgmi_context.context.initialized) {
                ret = psp_xgmi_init_shared_buf(psp);
                if (ret)
                        return ret;
@@ -1053,7 +1053,7 @@ int psp_xgmi_initialize(struct psp_context *psp, bool set_extended_data, bool lo
 
 invoke:
        /* Initialize XGMI session */
-       xgmi_cmd = (struct ta_xgmi_shared_memory *)(psp->xgmi_context.xgmi_shared_buf);
+       xgmi_cmd = (struct ta_xgmi_shared_memory *)(psp->xgmi_context.context.mem_context.shared_buf);
        memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
        xgmi_cmd->flag_extend_link_record = set_extended_data;
        xgmi_cmd->cmd_id = TA_COMMAND_XGMI__INITIALIZE;
@@ -1068,7 +1068,7 @@ int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id)
        struct ta_xgmi_shared_memory *xgmi_cmd;
        int ret;
 
-       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
+       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
        memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
 
        xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
@@ -1088,7 +1088,7 @@ int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id)
        struct ta_xgmi_shared_memory *xgmi_cmd;
        int ret;
 
-       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
+       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
        memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
 
        xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_NODE_ID;
@@ -1169,7 +1169,7 @@ int psp_xgmi_get_topology_info(struct psp_context *psp,
        if (!topology || topology->num_nodes > TA_XGMI__MAX_CONNECTED_NODES)
                return -EINVAL;
 
-       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
+       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
        memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
        xgmi_cmd->flag_extend_link_record = get_extended_data;
 
@@ -1249,7 +1249,7 @@ int psp_xgmi_set_topology_info(struct psp_context *psp,
        if (!topology || topology->num_nodes > TA_XGMI__MAX_CONNECTED_NODES)
                return -EINVAL;
 
-       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.xgmi_shared_buf;
+       xgmi_cmd = (struct ta_xgmi_shared_memory *)psp->xgmi_context.context.mem_context.shared_buf;
        memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
 
        topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info;
@@ -1278,9 +1278,9 @@ static int psp_ras_init_shared_buf(struct psp_context *psp)
         */
        ret = amdgpu_bo_create_kernel(psp->adev, PSP_RAS_SHARED_MEM_SIZE,
                        PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
-                       &psp->ras_context.ras_shared_bo,
-                       &psp->ras_context.ras_shared_mc_addr,
-                       &psp->ras_context.ras_shared_buf);
+                       &psp->ras_context.context.mem_context.shared_bo,
+                       &psp->ras_context.context.mem_context.shared_mc_addr,
+                       &psp->ras_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -1299,7 +1299,7 @@ static int psp_ras_load(struct psp_context *psp)
 
        psp_copy_fw(psp, psp->ras.start_addr, psp->ras.size_bytes);
 
-       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.ras_shared_buf;
+       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
 
        if (psp->adev->gmc.xgmi.connected_to_cpu)
                ras_cmd->ras_in_message.init_flags.poison_mode_en = 1;
@@ -1311,17 +1311,17 @@ static int psp_ras_load(struct psp_context *psp)
        psp_prep_ta_load_cmd_buf(cmd,
                                 psp->fw_pri_mc_addr,
                                 psp->ras.size_bytes,
-                                psp->ras_context.ras_shared_mc_addr,
+                                psp->ras_context.context.mem_context.shared_mc_addr,
                                 PSP_RAS_SHARED_MEM_SIZE);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd,
                        psp->fence_buf_mc_addr);
 
        if (!ret) {
-               psp->ras_context.session_id = cmd->resp.session_id;
+               psp->ras_context.context.session_id = cmd->resp.session_id;
 
                if (!ras_cmd->ras_status)
-                       psp->ras_context.ras_initialized = true;
+                       psp->ras_context.context.initialized = true;
                else
                        dev_warn(psp->adev->dev, "RAS Init Status: 0x%X\n", ras_cmd->ras_status);
        }
@@ -1347,7 +1347,7 @@ static int psp_ras_unload(struct psp_context *psp)
 
        cmd = acquire_psp_cmd_buf(psp);
 
-       psp_prep_ta_unload_cmd_buf(cmd, psp->ras_context.session_id);
+       psp_prep_ta_unload_cmd_buf(cmd, psp->ras_context.context.session_id);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd,
                        psp->fence_buf_mc_addr);
@@ -1362,7 +1362,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
        struct ta_ras_shared_memory *ras_cmd;
        int ret;
 
-       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.ras_shared_buf;
+       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
 
        /*
         * TODO: bypass the loading in sriov for now
@@ -1370,7 +1370,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
-       ret = psp_ta_invoke(psp, ta_cmd_id, psp->ras_context.session_id);
+       ret = psp_ta_invoke(psp, ta_cmd_id, psp->ras_context.context.session_id);
 
        if (amdgpu_ras_intr_triggered())
                return ret;
@@ -1426,10 +1426,10 @@ int psp_ras_enable_features(struct psp_context *psp,
        struct ta_ras_shared_memory *ras_cmd;
        int ret;
 
-       if (!psp->ras_context.ras_initialized)
+       if (!psp->ras_context.context.initialized)
                return -EINVAL;
 
-       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.ras_shared_buf;
+       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
        memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
 
        if (enable)
@@ -1456,19 +1456,19 @@ static int psp_ras_terminate(struct psp_context *psp)
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
-       if (!psp->ras_context.ras_initialized)
+       if (!psp->ras_context.context.initialized)
                return 0;
 
        ret = psp_ras_unload(psp);
        if (ret)
                return ret;
 
-       psp->ras_context.ras_initialized = false;
+       psp->ras_context.context.initialized = false;
 
        /* free ras shared memory */
-       amdgpu_bo_free_kernel(&psp->ras_context.ras_shared_bo,
-                       &psp->ras_context.ras_shared_mc_addr,
-                       &psp->ras_context.ras_shared_buf);
+       amdgpu_bo_free_kernel(&psp->ras_context.context.mem_context.shared_bo,
+                       &psp->ras_context.context.mem_context.shared_mc_addr,
+                       &psp->ras_context.context.mem_context.shared_buf);
 
        return 0;
 }
@@ -1532,7 +1532,7 @@ static int psp_ras_initialize(struct psp_context *psp)
                }
        }
 
-       if (!psp->ras_context.ras_initialized) {
+       if (!psp->ras_context.context.initialized) {
                ret = psp_ras_init_shared_buf(psp);
                if (ret)
                        return ret;
@@ -1551,10 +1551,10 @@ int psp_ras_trigger_error(struct psp_context *psp,
        struct ta_ras_shared_memory *ras_cmd;
        int ret;
 
-       if (!psp->ras_context.ras_initialized)
+       if (!psp->ras_context.context.initialized)
                return -EINVAL;
 
-       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.ras_shared_buf;
+       ras_cmd = (struct ta_ras_shared_memory *)psp->ras_context.context.mem_context.shared_buf;
        memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
 
        ras_cmd->cmd_id = TA_RAS_COMMAND__TRIGGER_ERROR;
@@ -1584,9 +1584,9 @@ static int psp_hdcp_init_shared_buf(struct psp_context *psp)
         */
        ret = amdgpu_bo_create_kernel(psp->adev, PSP_HDCP_SHARED_MEM_SIZE,
                                      PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
-                                     &psp->hdcp_context.hdcp_shared_bo,
-                                     &psp->hdcp_context.hdcp_shared_mc_addr,
-                                     &psp->hdcp_context.hdcp_shared_buf);
+                                     &psp->hdcp_context.context.mem_context.shared_bo,
+                                     &psp->hdcp_context.context.mem_context.shared_mc_addr,
+                                     &psp->hdcp_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -1610,14 +1610,14 @@ static int psp_hdcp_load(struct psp_context *psp)
        psp_prep_ta_load_cmd_buf(cmd,
                                 psp->fw_pri_mc_addr,
                                 psp->hdcp.size_bytes,
-                                psp->hdcp_context.hdcp_shared_mc_addr,
+                                psp->hdcp_context.context.mem_context.shared_mc_addr,
                                 PSP_HDCP_SHARED_MEM_SIZE);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
        if (!ret) {
-               psp->hdcp_context.hdcp_initialized = true;
-               psp->hdcp_context.session_id = cmd->resp.session_id;
+               psp->hdcp_context.context.initialized = true;
+               psp->hdcp_context.context.session_id = cmd->resp.session_id;
                mutex_init(&psp->hdcp_context.mutex);
        }
 
@@ -1641,7 +1641,7 @@ static int psp_hdcp_initialize(struct psp_context *psp)
                return 0;
        }
 
-       if (!psp->hdcp_context.hdcp_initialized) {
+       if (!psp->hdcp_context.context.initialized) {
                ret = psp_hdcp_init_shared_buf(psp);
                if (ret)
                        return ret;
@@ -1667,7 +1667,7 @@ static int psp_hdcp_unload(struct psp_context *psp)
 
        cmd = acquire_psp_cmd_buf(psp);
 
-       psp_prep_ta_unload_cmd_buf(cmd, psp->hdcp_context.session_id);
+       psp_prep_ta_unload_cmd_buf(cmd, psp->hdcp_context.context.session_id);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
@@ -1684,7 +1684,7 @@ int psp_hdcp_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
-       return psp_ta_invoke(psp, ta_cmd_id, psp->hdcp_context.session_id);
+       return psp_ta_invoke(psp, ta_cmd_id, psp->hdcp_context.context.session_id);
 }
 
 static int psp_hdcp_terminate(struct psp_context *psp)
@@ -1697,8 +1697,8 @@ static int psp_hdcp_terminate(struct psp_context *psp)
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
-       if (!psp->hdcp_context.hdcp_initialized) {
-               if (psp->hdcp_context.hdcp_shared_buf)
+       if (!psp->hdcp_context.context.initialized) {
+               if (psp->hdcp_context.context.mem_context.shared_buf)
                        goto out;
                else
                        return 0;
@@ -1708,13 +1708,13 @@ static int psp_hdcp_terminate(struct psp_context *psp)
        if (ret)
                return ret;
 
-       psp->hdcp_context.hdcp_initialized = false;
+       psp->hdcp_context.context.initialized = false;
 
 out:
        /* free hdcp shared memory */
-       amdgpu_bo_free_kernel(&psp->hdcp_context.hdcp_shared_bo,
-                             &psp->hdcp_context.hdcp_shared_mc_addr,
-                             &psp->hdcp_context.hdcp_shared_buf);
+       amdgpu_bo_free_kernel(&psp->hdcp_context.context.mem_context.shared_bo,
+                             &psp->hdcp_context.context.mem_context.shared_mc_addr,
+                             &psp->hdcp_context.context.mem_context.shared_buf);
 
        return 0;
 }
@@ -1731,9 +1731,9 @@ static int psp_dtm_init_shared_buf(struct psp_context *psp)
         */
        ret = amdgpu_bo_create_kernel(psp->adev, PSP_DTM_SHARED_MEM_SIZE,
                                      PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
-                                     &psp->dtm_context.dtm_shared_bo,
-                                     &psp->dtm_context.dtm_shared_mc_addr,
-                                     &psp->dtm_context.dtm_shared_buf);
+                                     &psp->dtm_context.context.mem_context.shared_bo,
+                                     &psp->dtm_context.context.mem_context.shared_mc_addr,
+                                     &psp->dtm_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -1756,14 +1756,14 @@ static int psp_dtm_load(struct psp_context *psp)
        psp_prep_ta_load_cmd_buf(cmd,
                                 psp->fw_pri_mc_addr,
                                 psp->dtm.size_bytes,
-                                psp->dtm_context.dtm_shared_mc_addr,
+                                psp->dtm_context.context.mem_context.shared_mc_addr,
                                 PSP_DTM_SHARED_MEM_SIZE);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
        if (!ret) {
-               psp->dtm_context.dtm_initialized = true;
-               psp->dtm_context.session_id = cmd->resp.session_id;
+               psp->dtm_context.context.initialized = true;
+               psp->dtm_context.context.session_id = cmd->resp.session_id;
                mutex_init(&psp->dtm_context.mutex);
        }
 
@@ -1788,7 +1788,7 @@ static int psp_dtm_initialize(struct psp_context *psp)
                return 0;
        }
 
-       if (!psp->dtm_context.dtm_initialized) {
+       if (!psp->dtm_context.context.initialized) {
                ret = psp_dtm_init_shared_buf(psp);
                if (ret)
                        return ret;
@@ -1814,7 +1814,7 @@ static int psp_dtm_unload(struct psp_context *psp)
 
        cmd = acquire_psp_cmd_buf(psp);
 
-       psp_prep_ta_unload_cmd_buf(cmd, psp->dtm_context.session_id);
+       psp_prep_ta_unload_cmd_buf(cmd, psp->dtm_context.context.session_id);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
@@ -1831,7 +1831,7 @@ int psp_dtm_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
-       return psp_ta_invoke(psp, ta_cmd_id, psp->dtm_context.session_id);
+       return psp_ta_invoke(psp, ta_cmd_id, psp->dtm_context.context.session_id);
 }
 
 static int psp_dtm_terminate(struct psp_context *psp)
@@ -1844,8 +1844,8 @@ static int psp_dtm_terminate(struct psp_context *psp)
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
-       if (!psp->dtm_context.dtm_initialized) {
-               if (psp->dtm_context.dtm_shared_buf)
+       if (!psp->dtm_context.context.initialized) {
+               if (psp->dtm_context.context.mem_context.shared_buf)
                        goto out;
                else
                        return 0;
@@ -1855,13 +1855,13 @@ static int psp_dtm_terminate(struct psp_context *psp)
        if (ret)
                return ret;
 
-       psp->dtm_context.dtm_initialized = false;
+       psp->dtm_context.context.initialized = false;
 
 out:
        /* free hdcp shared memory */
-       amdgpu_bo_free_kernel(&psp->dtm_context.dtm_shared_bo,
-                             &psp->dtm_context.dtm_shared_mc_addr,
-                             &psp->dtm_context.dtm_shared_buf);
+       amdgpu_bo_free_kernel(&psp->dtm_context.context.mem_context.shared_bo,
+                             &psp->dtm_context.context.mem_context.shared_mc_addr,
+                             &psp->dtm_context.context.mem_context.shared_buf);
 
        return 0;
 }
@@ -1878,9 +1878,9 @@ static int psp_rap_init_shared_buf(struct psp_context *psp)
         */
        ret = amdgpu_bo_create_kernel(psp->adev, PSP_RAP_SHARED_MEM_SIZE,
                                      PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
-                                     &psp->rap_context.rap_shared_bo,
-                                     &psp->rap_context.rap_shared_mc_addr,
-                                     &psp->rap_context.rap_shared_buf);
+                                     &psp->rap_context.context.mem_context.shared_bo,
+                                     &psp->rap_context.context.mem_context.shared_mc_addr,
+                                     &psp->rap_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -1897,14 +1897,14 @@ static int psp_rap_load(struct psp_context *psp)
        psp_prep_ta_load_cmd_buf(cmd,
                                 psp->fw_pri_mc_addr,
                                 psp->rap.size_bytes,
-                                psp->rap_context.rap_shared_mc_addr,
+                                psp->rap_context.context.mem_context.shared_mc_addr,
                                 PSP_RAP_SHARED_MEM_SIZE);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
        if (!ret) {
-               psp->rap_context.rap_initialized = true;
-               psp->rap_context.session_id = cmd->resp.session_id;
+               psp->rap_context.context.initialized = true;
+               psp->rap_context.context.session_id = cmd->resp.session_id;
                mutex_init(&psp->rap_context.mutex);
        }
 
@@ -1918,7 +1918,7 @@ static int psp_rap_unload(struct psp_context *psp)
        int ret;
        struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
 
-       psp_prep_ta_unload_cmd_buf(cmd, psp->rap_context.session_id);
+       psp_prep_ta_unload_cmd_buf(cmd, psp->rap_context.context.session_id);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
@@ -1944,7 +1944,7 @@ static int psp_rap_initialize(struct psp_context *psp)
                return 0;
        }
 
-       if (!psp->rap_context.rap_initialized) {
+       if (!psp->rap_context.context.initialized) {
                ret = psp_rap_init_shared_buf(psp);
                if (ret)
                        return ret;
@@ -1958,11 +1958,11 @@ static int psp_rap_initialize(struct psp_context *psp)
        if (ret || status != TA_RAP_STATUS__SUCCESS) {
                psp_rap_unload(psp);
 
-               amdgpu_bo_free_kernel(&psp->rap_context.rap_shared_bo,
-                             &psp->rap_context.rap_shared_mc_addr,
-                             &psp->rap_context.rap_shared_buf);
+               amdgpu_bo_free_kernel(&psp->rap_context.context.mem_context.shared_bo,
+                             &psp->rap_context.context.mem_context.shared_mc_addr,
+                             &psp->rap_context.context.mem_context.shared_buf);
 
-               psp->rap_context.rap_initialized = false;
+               psp->rap_context.context.initialized = false;
 
                dev_warn(psp->adev->dev, "RAP TA initialize fail (%d) status %d.\n",
                         ret, status);
@@ -1977,17 +1977,17 @@ static int psp_rap_terminate(struct psp_context *psp)
 {
        int ret;
 
-       if (!psp->rap_context.rap_initialized)
+       if (!psp->rap_context.context.initialized)
                return 0;
 
        ret = psp_rap_unload(psp);
 
-       psp->rap_context.rap_initialized = false;
+       psp->rap_context.context.initialized = false;
 
        /* free rap shared memory */
-       amdgpu_bo_free_kernel(&psp->rap_context.rap_shared_bo,
-                             &psp->rap_context.rap_shared_mc_addr,
-                             &psp->rap_context.rap_shared_buf);
+       amdgpu_bo_free_kernel(&psp->rap_context.context.mem_context.shared_bo,
+                             &psp->rap_context.context.mem_context.shared_mc_addr,
+                             &psp->rap_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -1997,7 +1997,7 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id, enum ta_rap_stat
        struct ta_rap_shared_memory *rap_cmd;
        int ret = 0;
 
-       if (!psp->rap_context.rap_initialized)
+       if (!psp->rap_context.context.initialized)
                return 0;
 
        if (ta_cmd_id != TA_CMD_RAP__INITIALIZE &&
@@ -2007,13 +2007,13 @@ int psp_rap_invoke(struct psp_context *psp, uint32_t ta_cmd_id, enum ta_rap_stat
        mutex_lock(&psp->rap_context.mutex);
 
        rap_cmd = (struct ta_rap_shared_memory *)
-                 psp->rap_context.rap_shared_buf;
+                 psp->rap_context.context.mem_context.shared_buf;
        memset(rap_cmd, 0, sizeof(struct ta_rap_shared_memory));
 
        rap_cmd->cmd_id = ta_cmd_id;
        rap_cmd->validation_method_id = METHOD_A;
 
-       ret = psp_ta_invoke(psp, rap_cmd->cmd_id, psp->rap_context.session_id);
+       ret = psp_ta_invoke(psp, rap_cmd->cmd_id, psp->rap_context.context.session_id);
        if (ret)
                goto out_unlock;
 
@@ -2038,9 +2038,9 @@ static int psp_securedisplay_init_shared_buf(struct psp_context *psp)
         */
        ret = amdgpu_bo_create_kernel(psp->adev, PSP_SECUREDISPLAY_SHARED_MEM_SIZE,
                                      PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
-                                     &psp->securedisplay_context.securedisplay_shared_bo,
-                                     &psp->securedisplay_context.securedisplay_shared_mc_addr,
-                                     &psp->securedisplay_context.securedisplay_shared_buf);
+                                     &psp->securedisplay_context.context.mem_context.shared_bo,
+                                     &psp->securedisplay_context.context.mem_context.shared_mc_addr,
+                                     &psp->securedisplay_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -2056,14 +2056,14 @@ static int psp_securedisplay_load(struct psp_context *psp)
        psp_prep_ta_load_cmd_buf(cmd,
                                 psp->fw_pri_mc_addr,
                                 psp->securedisplay.size_bytes,
-                                psp->securedisplay_context.securedisplay_shared_mc_addr,
+                                psp->securedisplay_context.context.mem_context.shared_mc_addr,
                                 PSP_SECUREDISPLAY_SHARED_MEM_SIZE);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
        if (!ret) {
-               psp->securedisplay_context.securedisplay_initialized = true;
-               psp->securedisplay_context.session_id = cmd->resp.session_id;
+               psp->securedisplay_context.context.initialized = true;
+               psp->securedisplay_context.context.session_id = cmd->resp.session_id;
                mutex_init(&psp->securedisplay_context.mutex);
        }
 
@@ -2077,7 +2077,7 @@ static int psp_securedisplay_unload(struct psp_context *psp)
        int ret;
        struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
 
-       psp_prep_ta_unload_cmd_buf(cmd, psp->securedisplay_context.session_id);
+       psp_prep_ta_unload_cmd_buf(cmd, psp->securedisplay_context.context.session_id);
 
        ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
 
@@ -2103,7 +2103,7 @@ static int psp_securedisplay_initialize(struct psp_context *psp)
                return 0;
        }
 
-       if (!psp->securedisplay_context.securedisplay_initialized) {
+       if (!psp->securedisplay_context.context.initialized) {
                ret = psp_securedisplay_init_shared_buf(psp);
                if (ret)
                        return ret;
@@ -2120,11 +2120,11 @@ static int psp_securedisplay_initialize(struct psp_context *psp)
        if (ret) {
                psp_securedisplay_unload(psp);
 
-               amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo,
-                             &psp->securedisplay_context.securedisplay_shared_mc_addr,
-                             &psp->securedisplay_context.securedisplay_shared_buf);
+               amdgpu_bo_free_kernel(&psp->securedisplay_context.context.mem_context.shared_bo,
+                             &psp->securedisplay_context.context.mem_context.shared_mc_addr,
+                             &psp->securedisplay_context.context.mem_context.shared_buf);
 
-               psp->securedisplay_context.securedisplay_initialized = false;
+               psp->securedisplay_context.context.initialized = false;
 
                dev_err(psp->adev->dev, "SECUREDISPLAY TA initialize fail.\n");
                return -EINVAL;
@@ -2149,19 +2149,19 @@ static int psp_securedisplay_terminate(struct psp_context *psp)
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
-       if (!psp->securedisplay_context.securedisplay_initialized)
+       if (!psp->securedisplay_context.context.initialized)
                return 0;
 
        ret = psp_securedisplay_unload(psp);
        if (ret)
                return ret;
 
-       psp->securedisplay_context.securedisplay_initialized = false;
+       psp->securedisplay_context.context.initialized = false;
 
        /* free securedisplay shared memory */
-       amdgpu_bo_free_kernel(&psp->securedisplay_context.securedisplay_shared_bo,
-                             &psp->securedisplay_context.securedisplay_shared_mc_addr,
-                             &psp->securedisplay_context.securedisplay_shared_buf);
+       amdgpu_bo_free_kernel(&psp->securedisplay_context.context.mem_context.shared_bo,
+                             &psp->securedisplay_context.context.mem_context.shared_mc_addr,
+                             &psp->securedisplay_context.context.mem_context.shared_buf);
 
        return ret;
 }
@@ -2170,7 +2170,7 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
 {
        int ret;
 
-       if (!psp->securedisplay_context.securedisplay_initialized)
+       if (!psp->securedisplay_context.context.initialized)
                return -EINVAL;
 
        if (ta_cmd_id != TA_SECUREDISPLAY_COMMAND__QUERY_TA &&
@@ -2179,7 +2179,7 @@ int psp_securedisplay_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
 
        mutex_lock(&psp->securedisplay_context.mutex);
 
-       ret = psp_ta_invoke(psp, ta_cmd_id, psp->securedisplay_context.session_id);
+       ret = psp_ta_invoke(psp, ta_cmd_id, psp->securedisplay_context.context.session_id);
 
        mutex_unlock(&psp->securedisplay_context.mutex);
 
@@ -2799,7 +2799,7 @@ static int psp_suspend(void *handle)
        struct psp_context *psp = &adev->psp;
 
        if (adev->gmc.xgmi.num_physical_nodes > 1 &&
-           psp->xgmi_context.initialized == 1) {
+           psp->xgmi_context.context.initialized) {
                ret = psp_xgmi_terminate(psp);
                if (ret) {
                        DRM_ERROR("Failed to terminate xgmi ta\n");
index 2a448f6..8ef2d28 100644 (file)
@@ -136,60 +136,32 @@ struct psp_asd_context {
        uint32_t                session_id;
 };
 
-struct psp_xgmi_context {
-       uint8_t                         initialized;
-       uint32_t                        session_id;
-       struct amdgpu_bo                *xgmi_shared_bo;
-       uint64_t                        xgmi_shared_mc_addr;
-       void                            *xgmi_shared_buf;
-       struct psp_xgmi_topology_info   top_info;
-       bool                            supports_extended_data;
-};
-
-struct psp_ras_context {
-       /*ras fw*/
-       bool                    ras_initialized;
-       uint32_t                session_id;
-       struct amdgpu_bo        *ras_shared_bo;
-       uint64_t                ras_shared_mc_addr;
-       void                    *ras_shared_buf;
-       struct amdgpu_ras       *ras;
+struct ta_mem_context {
+       struct amdgpu_bo                *shared_bo;
+       uint64_t                shared_mc_addr;
+       void                    *shared_buf;
 };
 
-struct psp_hdcp_context {
-       bool                    hdcp_initialized;
+struct ta_context {
+       bool                    initialized;
        uint32_t                session_id;
-       struct amdgpu_bo        *hdcp_shared_bo;
-       uint64_t                hdcp_shared_mc_addr;
-       void                    *hdcp_shared_buf;
-       struct mutex            mutex;
+       struct ta_mem_context   mem_context;
 };
 
-struct psp_dtm_context {
-       bool                    dtm_initialized;
-       uint32_t                session_id;
-       struct amdgpu_bo        *dtm_shared_bo;
-       uint64_t                dtm_shared_mc_addr;
-       void                    *dtm_shared_buf;
-       struct mutex            mutex;
+struct ta_cp_context {
+       struct ta_context               context;
+       struct mutex                    mutex;
 };
 
-struct psp_rap_context {
-       bool                    rap_initialized;
-       uint32_t                session_id;
-       struct amdgpu_bo        *rap_shared_bo;
-       uint64_t                rap_shared_mc_addr;
-       void                    *rap_shared_buf;
-       struct mutex            mutex;
+struct psp_xgmi_context {
+       struct ta_context               context;
+       struct psp_xgmi_topology_info   top_info;
+       bool                            supports_extended_data;
 };
 
-struct psp_securedisplay_context {
-       bool                    securedisplay_initialized;
-       uint32_t                session_id;
-       struct amdgpu_bo        *securedisplay_shared_bo;
-       uint64_t                securedisplay_shared_mc_addr;
-       void                    *securedisplay_shared_buf;
-       struct mutex            mutex;
+struct psp_ras_context {
+       struct ta_context               context;
+       struct amdgpu_ras               *ras;
 };
 
 #define MEM_TRAIN_SYSTEM_SIGNATURE             0x54534942
@@ -364,10 +336,10 @@ struct psp_context
        struct psp_asd_context          asd_context;
        struct psp_xgmi_context         xgmi_context;
        struct psp_ras_context          ras_context;
-       struct psp_hdcp_context         hdcp_context;
-       struct psp_dtm_context          dtm_context;
-       struct psp_rap_context          rap_context;
-       struct psp_securedisplay_context        securedisplay_context;
+       struct ta_cp_context            hdcp_context;
+       struct ta_cp_context            dtm_context;
+       struct ta_cp_context            rap_context;
+       struct ta_cp_context            securedisplay_context;
        struct mutex                    mutex;
        struct psp_memory_training_context mem_train_ctx;
 
index 51909bf..12010c9 100644 (file)
@@ -76,7 +76,7 @@ static ssize_t amdgpu_rap_debugfs_write(struct file *f, const char __user *buf,
                        dev_info(adev->dev, "RAP L0 validate test success.\n");
                } else {
                        rap_shared_mem = (struct ta_rap_shared_memory *)
-                                        adev->psp.rap_context.rap_shared_buf;
+                                        adev->psp.rap_context.context.mem_context.shared_buf;
                        rap_cmd_output = &(rap_shared_mem->rap_out_message.output);
 
                        dev_info(adev->dev, "RAP test failed, the output is:\n");
@@ -119,7 +119,7 @@ void amdgpu_rap_debugfs_init(struct amdgpu_device *adev)
 #if defined(CONFIG_DEBUG_FS)
        struct drm_minor *minor = adev_to_drm(adev)->primary;
 
-       if (!adev->psp.rap_context.rap_initialized)
+       if (!adev->psp.rap_context.context.initialized)
                return;
 
        debugfs_create_file("rap_test", S_IWUSR, minor->debugfs_root,
index 1234539..cc7597a 100644 (file)
@@ -80,7 +80,7 @@ void psp_securedisplay_parse_resp_status(struct psp_context *psp,
 void psp_prep_securedisplay_cmd_buf(struct psp_context *psp, struct securedisplay_cmd **cmd,
        enum ta_securedisplay_command command_id)
 {
-       *cmd = (struct securedisplay_cmd *)psp->securedisplay_context.securedisplay_shared_buf;
+       *cmd = (struct securedisplay_cmd *)psp->securedisplay_context.context.mem_context.shared_buf;
        memset(*cmd, 0, sizeof(struct securedisplay_cmd));
        (*cmd)->status = TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE;
        (*cmd)->cmd_id = command_id;
@@ -170,7 +170,7 @@ void amdgpu_securedisplay_debugfs_init(struct amdgpu_device *adev)
 {
 #if defined(CONFIG_DEBUG_FS)
 
-       if (!adev->psp.securedisplay_context.securedisplay_initialized)
+       if (!adev->psp.securedisplay_context.context.initialized)
                return;
 
        debugfs_create_file("securedisplay_test", S_IWUSR, adev_to_drm(adev)->primary->debugfs_root,
index 8e39e92..c5f1dc3 100644 (file)
@@ -79,12 +79,12 @@ static uint8_t *psp_get_srm(struct psp_context *psp, uint32_t *srm_version, uint
 
        struct ta_hdcp_shared_memory *hdcp_cmd;
 
-       if (!psp->hdcp_context.hdcp_initialized) {
+       if (!psp->hdcp_context.context.initialized) {
                DRM_WARN("Failed to get hdcp srm. HDCP TA is not initialized.");
                return NULL;
        }
 
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->cmd_id = TA_HDCP_COMMAND__HDCP_GET_SRM;
@@ -105,12 +105,12 @@ static int psp_set_srm(struct psp_context *psp, uint8_t *srm, uint32_t srm_size,
 
        struct ta_hdcp_shared_memory *hdcp_cmd;
 
-       if (!psp->hdcp_context.hdcp_initialized) {
+       if (!psp->hdcp_context.context.initialized) {
                DRM_WARN("Failed to get hdcp srm. HDCP TA is not initialized.");
                return -EINVAL;
        }
 
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        memcpy(hdcp_cmd->in_msg.hdcp_set_srm.srm_buf, srm, srm_size);
@@ -414,12 +414,12 @@ static bool enable_assr(void *handle, struct dc_link *link)
        struct ta_dtm_shared_memory *dtm_cmd;
        bool res = true;
 
-       if (!psp->dtm_context.dtm_initialized) {
+       if (!psp->dtm_context.context.initialized) {
                DRM_INFO("Failed to enable ASSR, DTM TA is not initialized.");
                return false;
        }
 
-       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
+       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.context.mem_context.shared_buf;
 
        mutex_lock(&psp->dtm_context.mutex);
        memset(dtm_cmd, 0, sizeof(struct ta_dtm_shared_memory));
index ade86a0..e9bd84e 100644 (file)
@@ -54,7 +54,7 @@ static enum mod_hdcp_status remove_display_from_topology_v2(
                        get_active_display_at_index(hdcp, index);
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
-       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
+       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.context.mem_context.shared_buf;
 
        if (!display || !is_display_active(display))
                return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND;
@@ -90,7 +90,7 @@ static enum mod_hdcp_status remove_display_from_topology_v3(
                get_active_display_at_index(hdcp, index);
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
-       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
+       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.context.mem_context.shared_buf;
 
        if (!display || !is_display_active(display))
                return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND;
@@ -128,13 +128,13 @@ static enum mod_hdcp_status add_display_to_topology_v2(
        struct mod_hdcp_link *link = &hdcp->connection.link;
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
-       if (!psp->dtm_context.dtm_initialized) {
+       if (!psp->dtm_context.context.initialized) {
                DRM_INFO("Failed to add display topology, DTM TA is not initialized.");
                display->state = MOD_HDCP_DISPLAY_INACTIVE;
                return MOD_HDCP_STATUS_FAILURE;
        }
 
-       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
+       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.context.mem_context.shared_buf;
 
        mutex_lock(&psp->dtm_context.mutex);
        memset(dtm_cmd, 0, sizeof(struct ta_dtm_shared_memory));
@@ -175,13 +175,13 @@ static enum mod_hdcp_status add_display_to_topology_v3(
        struct mod_hdcp_link *link = &hdcp->connection.link;
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
-       if (!psp->dtm_context.dtm_initialized) {
+       if (!psp->dtm_context.context.initialized) {
                DRM_INFO("Failed to add display topology, DTM TA is not initialized.");
                display->state = MOD_HDCP_DISPLAY_INACTIVE;
                return MOD_HDCP_STATUS_FAILURE;
        }
 
-       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
+       dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.context.mem_context.shared_buf;
 
        mutex_lock(&psp->dtm_context.mutex);
        memset(dtm_cmd, 0, sizeof(struct ta_dtm_shared_memory));
@@ -253,12 +253,12 @@ enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp)
        struct ta_hdcp_shared_memory *hdcp_cmd;
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
-       if (!psp->hdcp_context.hdcp_initialized) {
+       if (!psp->hdcp_context.context.initialized) {
                DRM_ERROR("Failed to create hdcp session. HDCP TA is not initialized.");
                return MOD_HDCP_STATUS_FAILURE;
        }
 
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
 
        mutex_lock(&psp->hdcp_context.mutex);
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
@@ -293,7 +293,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_destroy_session(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->in_msg.hdcp1_destroy_session.session_handle = hdcp->auth.id;
@@ -325,7 +325,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_validate_rx(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->in_msg.hdcp1_first_part_authentication.session_handle = hdcp->auth.id;
@@ -367,7 +367,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->in_msg.hdcp1_enable_encryption.session_handle = hdcp->auth.id;
@@ -393,7 +393,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_validate_ksvlist_vp(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->in_msg.hdcp1_second_part_authentication.session_handle = hdcp->auth.id;
@@ -436,7 +436,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
 
        for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) {
 
@@ -471,7 +471,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_link_maintenance(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
 
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
@@ -498,7 +498,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_create_session(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
 
-       if (!psp->hdcp_context.hdcp_initialized) {
+       if (!psp->hdcp_context.context.initialized) {
                DRM_ERROR("Failed to create hdcp session, HDCP TA is not initialized");
                return MOD_HDCP_STATUS_FAILURE;
        }
@@ -508,7 +508,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_create_session(struct mod_hdcp *hdcp)
 
        mutex_lock(&psp->hdcp_context.mutex);
 
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->in_msg.hdcp2_create_session_v2.display_handle = display->index;
@@ -545,7 +545,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_destroy_session(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->in_msg.hdcp2_destroy_session.session_handle = hdcp->auth.id;
@@ -579,7 +579,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_prepare_ake_init(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -611,7 +611,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_validate_ake_cert(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -671,7 +671,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_validate_h_prime(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -717,7 +717,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_prepare_lc_init(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -750,7 +750,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_validate_l_prime(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -785,7 +785,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_prepare_eks(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -833,7 +833,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_encryption(struct mod_hdcp *hdcp)
 
        mutex_lock(&psp->hdcp_context.mutex);
 
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        hdcp_cmd->in_msg.hdcp2_set_encryption.session_handle = hdcp->auth.id;
@@ -862,7 +862,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_validate_rx_id_list(struct mod_hdcp *hdcp)
 
        mutex_lock(&psp->hdcp_context.mutex);
 
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -914,7 +914,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -958,7 +958,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_prepare_stream_management(struct mod_hdcp *h
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;
@@ -994,7 +994,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_validate_stream_ready(struct mod_hdcp *hdcp)
        enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
 
        mutex_lock(&psp->hdcp_context.mutex);
-       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
+       hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.context.mem_context.shared_buf;
        memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
        msg_in = &hdcp_cmd->in_msg.hdcp2_prepare_process_authentication_message_v2;