drm/amdgpu: drop asd shared memory
Subsystems (2)
PATCH 1/3 drm/amdgpu: drop asd shared memory
asd shared memory is not needed since drivers doesn't invoke any further cmd to asd directly after the asd loading. trust application is the one who needs to talk to asd after the initialization
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 44 +++++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 12 ++++--- 2 files changed, 18 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +11 -33
@@ -309,35 +309,17 @@ static int psp_tmr_load(struct psp_context *psp)return ret; } -static void psp_prep_asd_cmd_buf (struct psp_gfx_cmd_resp *cmd, -uint64_t asd_mc,uint64_t asd_mc_shared, -uint32_t size,uint32_t shared_size) +static void psp_prep_asd_load_cmd_buf (struct psp_gfx_cmd_resp *cmd, +uint64_t asd_mc,uint32_t size) { cmd->cmd_id =GFX_CMD_ID_LOAD_ASD ; cmd->cmd.cmd_load_ta.app_phy_addr_lo =lower_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_phy_addr_hi =upper_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_len = size; - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =lower_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =upper_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_len = shared_size; -} - -static int psp_asd_init (struct psp_context *psp) -{ -int ret; - -/* -* Allocate 16k memory aligned to 4k from Frame Buffer (local -* physical) for shared ASD <-> Driver -*/ - ret =amdgpu_bo_create_kernel (psp->adev,PSP_ASD_SHARED_MEM_SIZE , -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , - &psp->asd_shared_bo, - &psp->asd_shared_mc_addr, - &psp->asd_shared_buf); - -return ret; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_len =0 ; }static int psp_asd_load (struct psp_context *psp)
@@ -359,11 +341,15 @@ static int psp_asd_load(struct psp_context *psp)memset (psp->fw_pri_buf,0 ,PSP_1_MEG );memcpy (psp->fw_pri_buf, psp->asd_start_addr, psp->asd_ucode_size); -psp_prep_asd_cmd_buf (cmd, psp->fw_pri_mc_addr, psp->asd_shared_mc_addr, - psp->asd_ucode_size,PSP_ASD_SHARED_MEM_SIZE ); +psp_prep_asd_load_cmd_buf (cmd, psp->fw_pri_mc_addr, + psp->asd_ucode_size); ret =psp_cmd_submit_buf (psp,NULL , cmd, psp->fence_buf_mc_addr); +if (!ret) { + psp->asd_context.asd_initialized = true; + psp->asd_context.session_id = cmd->resp.session_id; + }kfree (cmd);
@@ -1198,12 +1184,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_init (psp); -if (ret) { -DRM_ERROR ("PSP asd init failed!\n" ); -return ret; - } - ret =psp_asd_load (psp);if (ret) {DRM_ERROR ("PSP load asd failed!\n" );
@@ -1611,8 +1591,6 @@ static int psp_hw_fini(void *handle) &psp->fw_pri_mc_addr, &psp->fw_pri_buf);amdgpu_bo_free_kernel (&psp->fence_buf_bo, &psp->fence_buf_mc_addr, &psp->fence_buf); -amdgpu_bo_free_kernel (&psp->asd_shared_bo, &psp->asd_shared_mc_addr, - &psp->asd_shared_buf);amdgpu_bo_free_kernel (&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, (void **)&psp->cmd_buf_mem);
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +7 -5
@@ -32,7 +32,6 @@#define PSP_FENCE_BUFFER_SIZE 0x1000#define PSP_CMD_BUFFER_SIZE 0x1000 -#define PSP_ASD_SHARED_MEM_SIZE 0x4000#define PSP_XGMI_SHARED_MEM_SIZE 0x4000#define PSP_RAS_SHARED_MEM_SIZE 0x8000#define PSP_1_MEG 0x100000
@@ -130,6 +129,11 @@ struct psp_xgmi_topology_info {struct psp_xgmi_node_info nodes[AMDGPU_XGMI_MAX_CONNECTED_NODES ]; }; +struct psp_asd_context { +bool asd_initialized; +uint32_t session_id; +}; +struct psp_xgmi_context {uint8_t initialized;uint32_t session_id;
@@ -238,15 +242,12 @@ struct psp_contextstruct amdgpu_bo *tmr_bo;uint64_t tmr_mc_addr; -/* asd firmware and buffer */ +/* asd firmware */ const struct firmware *asd_fw;uint32_t asd_fw_version;uint32_t asd_feature_version;uint32_t asd_ucode_size;uint8_t *asd_start_addr; -struct amdgpu_bo *asd_shared_bo; -uint64_t asd_shared_mc_addr; -void *asd_shared_buf;/* fence buffer */ struct amdgpu_bo *fence_buf_bo;
@@ -281,6 +282,7 @@ struct psp_contextuint32_t ta_dtm_ucode_size;uint8_t *ta_dtm_start_addr; +struct psp_asd_context asd_context;struct psp_xgmi_context xgmi_context;struct psp_ras_context ras;struct psp_hdcp_context hdcp_context;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amdgpu: unload asd in psp hw de-init phase
issue unload_ta_cmd to tOS to unload asd driver
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +36 -0
@@ -356,6 +356,40 @@ static int psp_asd_load(struct psp_context *psp)return ret; } +static void psp_prep_asd_unload_cmd_buf (struct psp_gfx_cmd_resp *cmd, +uint32_t asd_session_id) +{ + cmd->cmd_id =GFX_CMD_ID_UNLOAD_TA ; + cmd->cmd.cmd_unload_ta.session_id = asd_session_id; +} + +static int psp_asd_unload (struct psp_context *psp) +{ +int ret; +struct psp_gfx_cmd_resp *cmd; + +if (amdgpu_sriov_vf (psp->adev)) +return 0 ; + +if (!psp->asd_context.asd_initialized) +return 0 ; + + cmd =kzalloc (sizeof (struct psp_gfx_cmd_resp ),GFP_KERNEL ); +if (!cmd) +return -ENOMEM ; + +psp_prep_asd_unload_cmd_buf (cmd, psp->asd_context.session_id); + + ret =psp_cmd_submit_buf (psp,NULL , cmd, + psp->fence_buf_mc_addr); +if (!ret) + psp->asd_context.asd_initialized = false; + +kfree (cmd); + +return ret; +} +static void psp_prep_reg_prog_cmd_buf (struct psp_gfx_cmd_resp *cmd,uint32_t id,uint32_t value) {
@@ -1583,6 +1617,8 @@ static int psp_hw_fini(void *handle)psp_hdcp_terminate (psp); } +psp_asd_unload (psp); +psp_ring_destroy (psp,PSP_RING_TYPE__KM ); pptr =amdgpu_sriov_vf (psp->adev) ? &tmr_buf :NULL ;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/3] drm/amdgpu: unload asd in psp hw de-init phase
Quoted 9 lines
-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Monday, December 2, 2019 1:04 AM
To: [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 2/3] drm/amdgpu: unload asd in psp hw de-init phase
Quoted 4 lines
issue
unload_ta_cmdto tOS to unload asd driverChange-Id I697cfc1774205ed6cbe22eb3c16143b603543564Signed-off-by Hawking Zhang <[email protected]>
Quoted 61 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +34
-1@@ -356,6 +356,40 @@ static int psp_asd_load(struct psp_context *psp)return ret; } +static void psp_prep_asd_unload_cmd_buf (struct psp_gfx_cmd_resp *cmd, +uint32_t asd_session_id) +{ + cmd->cmd_id =GFX_CMD_ID_UNLOAD_TA ; + cmd->cmd.cmd_unload_ta.session_id = asd_session_id; } + +static int psp_asd_unload (struct psp_context *psp) { +int ret; +struct psp_gfx_cmd_resp *cmd; + +if (amdgpu_sriov_vf (psp->adev)) +return 0 ; + +if (!psp->asd_context.asd_initialized) +return 0 ; + + cmd =kzalloc (sizeof (struct psp_gfx_cmd_resp ),GFP_KERNEL ); +if (!cmd) +return -ENOMEM ; + +psp_prep_asd_unload_cmd_buf (cmd, psp- >asd_context.session_id); + + ret =psp_cmd_submit_buf (psp,NULL , cmd, + psp->fence_buf_mc_addr); +if (!ret) + psp->asd_context.asd_initialized = false; + +kfree (cmd); + +return ret; +} +static void psp_prep_reg_prog_cmd_buf (struct psp_gfx_cmd_resp *cmd,uint32_t id,uint32_t value) {@@ -1583,6 +1617,8 @@ static int psp_hw_fini(void *handle)psp_hdcp_terminate (psp); } +psp_asd_unload (psp); +psp_ring_destroy (psp,PSP_RING_TYPE__KM ); pptr =amdgpu_sriov_vf (psp->adev) ? &tmr_buf :NULL ; --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu: load np fw prior before loading the TAs
In reply to Hawking ZhangPlatform TAs will independently toggle DF Cstate. for instance, get/set topology from xgmi ta. do error injection from ras ta. In such case, PMFW needs to be loaded before TAs so that all the subsequent Cstate calls recieved by PSP FW can be routed to PMFW.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 66 ++++++++++++------------- 1 file changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +33 -33
@@ -1218,39 +1218,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_load (psp); -if (ret) { -DRM_ERROR ("PSP load asd failed!\n" ); -return ret; - } - -if (adev->gmc.xgmi.num_physical_nodes >1 ) { - ret =psp_xgmi_initialize (psp); -/* Warning the XGMI seesion initialize failure -* Instead of stop driver initialization -*/ -if (ret) -dev_err (psp->adev->dev, -"XGMI: Failed to initialize XGMI session\n" ); - } - -if (psp->adev->psp.ta_fw) { - ret =psp_ras_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"RAS: Failed to initialize RAS\n" ); - - ret =psp_hdcp_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"HDCP: Failed to initialize HDCP\n" ); - - ret =psp_dtm_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"DTM: Failed to initialize DTM\n" ); - } -return 0 ; }
@@ -1560,6 +1527,39 @@ static int psp_load_fw(struct amdgpu_device *adev)if (ret) goto failed; + ret =psp_asd_load (psp); +if (ret) { +DRM_ERROR ("PSP load asd failed!\n" ); +return ret; + } + +if (adev->gmc.xgmi.num_physical_nodes >1 ) { + ret =psp_xgmi_initialize (psp); +/* Warning the XGMI seesion initialize failure +* Instead of stop driver initialization +*/ +if (ret) +dev_err (psp->adev->dev, +"XGMI: Failed to initialize XGMI session\n" ); + } + +if (psp->adev->psp.ta_fw) { + ret =psp_ras_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"RAS: Failed to initialize RAS\n" ); + + ret =psp_hdcp_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"HDCP: Failed to initialize HDCP\n" ); + + ret =psp_dtm_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"DTM: Failed to initialize DTM\n" ); + } +return 0 ; failed:
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/3] drm/amdgpu: load np fw prior before loading the TAs
Quoted 9 lines
-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Monday, December 2, 2019 1:04 AM
To: [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: load np fw prior before loading the TAs
Quoted 7 lines
Platform TAs will independently toggle DF Cstate.
for instance, get/set topology from xgmi ta. do error injection from ras ta. In such case, PMFW needs to be loaded before TAs so that all the subsequent Cstate calls recieved by PSP FW can be routed to PMFW.Change-Id I83db1a22577a84ae647e7e570c200057650096c5Signed-off-by Hawking Zhang <[email protected]>
Quoted 90 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 66 ++++++++++++---------- --- 1 file changed, 33 insertions(+), 33 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +33
-33@@ -1218,39 +1218,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_load (psp); -if (ret) { -DRM_ERROR ("PSP load asd failed!\n" ); -return ret; - } - -if (adev->gmc.xgmi.num_physical_nodes >1 ) { - ret =psp_xgmi_initialize (psp); -/* Warning the XGMI seesion initialize failure -* Instead of stop driver initialization -*/ -if (ret) -dev_err (psp->adev->dev, -"XGMI: Failed to initialize XGMI session\n" ); - } - -if (psp->adev->psp.ta_fw) { - ret =psp_ras_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"RAS: Failed to initialize RAS\n" ); - - ret =psp_hdcp_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"HDCP: Failed to initialize HDCP\n" ); - - ret =psp_dtm_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"DTM: Failed to initialize DTM\n" ); - } -return 0 ; }@@ -1560,6 +1527,39 @@ static int psp_load_fw(struct amdgpu_device *adev)if (ret) goto failed; + ret =psp_asd_load (psp); +if (ret) { +DRM_ERROR ("PSP load asd failed!\n" ); +return ret; + } + +if (adev->gmc.xgmi.num_physical_nodes >1 ) { + ret =psp_xgmi_initialize (psp); +/* Warning the XGMI seesion initialize failure +* Instead of stop driver initialization +*/ +if (ret) +dev_err (psp->adev->dev, +"XGMI: Failed to initialize XGMI session\n" ); + } + +if (psp->adev->psp.ta_fw) { + ret =psp_ras_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"RAS: Failed to initialize RAS\n" ); + + ret =psp_hdcp_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"HDCP: Failed to initialize HDCP\n" ); + + ret =psp_dtm_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"DTM: Failed to initialize DTM\n" ); + } +return 0 ;
Quoted 3 lines
failed:
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/3] drm/amdgpu: load np fw prior before loading the TAs
In reply to Hawking ZhangSeries is acked-by: Evan Quan <[email protected]>
Quoted 110 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Hawking Zhang
Sent: Monday, December 2, 2019 2:04 PM
To: [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: load np fw prior before loading the TAsPlatform TAs will independently toggle DF Cstate. for instance, get/set topology from xgmi ta. do error injection from ras ta. In such case, PMFW needs to be loaded before TAs so that all the subsequent Cstate calls recieved by PSP FW can be routed to PMFW.
Change-Id I83db1a22577a84ae647e7e570c200057650096c5Signed-off-by Hawking Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 66 ++++++++++++------------- 1 file changed, 33 insertions(+), 33 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +33
-34@@ -1218,39 +1218,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_load (psp); -if (ret) { -DRM_ERROR ("PSP load asd failed!\n" ); -return ret; - } - -if (adev->gmc.xgmi.num_physical_nodes >1 ) { - ret =psp_xgmi_initialize (psp); -/* Warning the XGMI seesion initialize failure -* Instead of stop driver initialization -*/ -if (ret) -dev_err (psp->adev->dev, -"XGMI: Failed to initialize XGMI session\n" ); - } - -if (psp->adev->psp.ta_fw) { - ret =psp_ras_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"RAS: Failed to initialize RAS\n" ); - - ret =psp_hdcp_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"HDCP: Failed to initialize HDCP\n" ); - - ret =psp_dtm_initialize (psp); -if (ret) -dev_err (psp->adev->dev, -"DTM: Failed to initialize DTM\n" ); - } -return 0 ; }@@ -1560,6 +1527,39 @@ static int psp_load_fw(struct amdgpu_device *adev)if (ret) goto failed; + ret =psp_asd_load (psp); +if (ret) { +DRM_ERROR ("PSP load asd failed!\n" ); +return ret; + } + +if (adev->gmc.xgmi.num_physical_nodes >1 ) { + ret =psp_xgmi_initialize (psp); +/* Warning the XGMI seesion initialize failure +* Instead of stop driver initialization +*/ +if (ret) +dev_err (psp->adev->dev, +"XGMI: Failed to initialize XGMI session\n" ); + } + +if (psp->adev->psp.ta_fw) { + ret =psp_ras_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"RAS: Failed to initialize RAS\n" ); + + ret =psp_hdcp_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"HDCP: Failed to initialize HDCP\n" ); + + ret =psp_dtm_initialize (psp); +if (ret) +dev_err (psp->adev->dev, +"DTM: Failed to initialize DTM\n" ); + } +return 0 ; failed: --2.17.1
Quoted 9 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.free
desktop.org%2Fmailman%2Flistinfo%2Famd- gfx&data=02%7C01%7Cevan.quan%40amd.com%7Cfa57b9cb28ce4af1c61 308d776ed6f91%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6371 08634483533019&sdata=wc15XfsaTlTgIlaP0%2F12a8SFFBnk%2F9RCKGwK oREx8J8%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
maintainerQuoted 9 lines
-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Monday, December 2, 2019 1:04 AM
To: [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: drop asd shared memory
Quoted 4 lines
asd shared memory is not needed since drivers doesn't invoke any further cmd to asd directly after the asd loading. trust application is the one who needs to talk to asd after the initialization
Do we need to keep that memory around for the TAs or do they use some other memory?
Alex
Quoted 155 lines
Change-Id I728afa4c7e8b67bc06678b10e92ac064ba10173eSigned-off-by Hawking Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 44 +++++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 12 ++++--- 2 files changed, 18 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5
-22@@ -309,35 +309,17 @@ static int psp_tmr_load(struct psp_context *psp)return ret; } -static void psp_prep_asd_cmd_buf (struct psp_gfx_cmd_resp *cmd, -uint64_t asd_mc,uint64_t asd_mc_shared, -uint32_t size,uint32_t shared_size) +static void psp_prep_asd_load_cmd_buf (struct psp_gfx_cmd_resp *cmd, +uint64_t asd_mc,uint32_t size) { cmd->cmd_id =GFX_CMD_ID_LOAD_ASD ; cmd->cmd.cmd_load_ta.app_phy_addr_lo =lower_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_phy_addr_hi =upper_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_len = size; - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =lower_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =upper_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_len = shared_size; -} - -static int psp_asd_init(struct psp_context *psp) -{ -int ret; - -/* -* Allocate 16k memory aligned to 4k from Frame Buffer (local -* physical) for shared ASD <-> Driver -*/ - ret =amdgpu_bo_create_kernel (psp->adev,PSP_ASD_SHARED_MEM_SIZE , -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , - &psp->asd_shared_bo, - &psp->asd_shared_mc_addr, - &psp->asd_shared_buf); - -return ret; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_len =0 ; } static int psp_asd_load(struct psp_context *psp) @@ -359,11 +341,15 @@static int
psp_asd_load(struct psp_context *psp)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); memcpy(psp->fw_pri_buf, psp->asd_start_addr, psp-Quoted 1 line
asd_ucode_size);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- psp_prep_asd_cmd_buf(cmd, psp->fw_pri_mc_addr, psp-Quoted 1 line
asd_shared_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- psp->asd_ucode_size,
PSP_ASD_SHARED_MEM_SIZE);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6
-8+psp_prep_asd_load_cmd_buf (cmd, psp->fw_pri_mc_addr, + psp->asd_ucode_size); ret =psp_cmd_submit_buf (psp,NULL , cmd, psp->fence_buf_mc_addr); +if (!ret) { + psp->asd_context.asd_initialized = true; + psp->asd_context.session_id = cmd->resp.session_id; + }kfree (cmd);@@ -1198,12 +1184,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_init (psp); -if (ret) { -DRM_ERROR ("PSP asd init failed!\n" ); -return ret; - } - ret =psp_asd_load (psp);if (ret) {DRM_ERROR ("PSP load asd failed!\n" );@@ -1611,8 +1591,6 @@ static int psp_hw_fini(void *handle) &psp->fw_pri_mc_addr, &psp->fw_pri_buf);amdgpu_bo_free_kernel (&psp->fence_buf_bo, &psp->fence_buf_mc_addr, &psp->fence_buf); -amdgpu_bo_free_kernel (&psp->asd_shared_bo, &psp- >asd_shared_mc_addr, - &psp->asd_shared_buf); amdgpu_bo_free_kernel(&psp->cmd_buf_bo, &psp- >cmd_buf_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0(void **)&psp->cmd_buf_mem);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0
-1@@ -32,7 +32,6 @@#define PSP_FENCE_BUFFER_SIZE 0x1000#define PSP_CMD_BUFFER_SIZE 0x1000 -#define PSP_ASD_SHARED_MEM_SIZE 0x4000#define PSP_XGMI_SHARED_MEM_SIZE 0x4000 #define
PSP_RAS_SHARED_MEM_SIZE0x8000
#definePSP_1_MEG0x100000drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +5
-0@@ -130,6 +129,11 @@ struct psp_xgmi_topology_info {struct psp_xgmi_node_info nodes[AMDGPU_XGMI_MAX_CONNECTED_NODES ]; }; +struct psp_asd_context { +bool asd_initialized; +uint32_t session_id; +}; +struct psp_xgmi_context {uint8_t initialized;drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +2
-5uint32_t session_id;@@ -238,15 +242,12 @@ struct psp_contextstruct amdgpu_bo *tmr_bo;uint64_t tmr_mc_addr; -/* asd firmware and buffer */ +/* asd firmware */ const struct firmware *asd_fw;uint32_t asd_fw_version;uint32_t asd_feature_version;uint32_t asd_ucode_size;uint8_t *asd_start_addr; -struct amdgpu_bo *asd_shared_bo; -uint64_t asd_shared_mc_addr; -void *asd_shared_buf;/* fence buffer */ struct amdgpu_bo *fence_buf_bo;@@ -281,6 +282,7 @@ struct psp_contextuint32_t ta_dtm_ucode_size;uint8_t *ta_dtm_start_addr; +struct psp_asd_context asd_context;struct psp_xgmi_context xgmi_context;struct psp_ras_context ras;struct psp_hdcp_context hdcp_context; --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE - Do we need to keep that memory around for the TAs or do they use some other memory?
Hi Alex,
Each TA owns its shared memory for the cmd that gfx send to TEE. The command could be different per TA and might be using simultaneously so the shared memory can't be shared among Tas.
Originally, we also created shared buffer for ASD driver. but since gfx driver is not privileged to talk to ASD directly. The shared buffer is actually never used.
Regards,
Hawking
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: 2019年12月3日 0:44
To: Zhang, Hawking <[email protected]>; [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 1/3] drm/amdgpu: drop asd shared memory
Quoted 9 lines
-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Monday, December 2, 2019 1:04 AM
To: [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: drop asd shared memory
Quoted 4 lines
asd shared memory is not needed since drivers doesn't invoke any further cmd to asd directly after the asd loading. trust application is the one who needs to talk to asd after the initialization
Do we need to keep that memory around for the TAs or do they use some other memory?
Alex
Quoted 154 lines
Change-Id I728afa4c7e8b67bc06678b10e92ac064ba10173eSigned-off-by Hawking Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 44 +++++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 12 ++++--- 2 files changed, 18 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5
-22@@ -309,35 +309,17 @@ static int psp_tmr_load(struct psp_context *psp)return ret; } -static void psp_prep_asd_cmd_buf (struct psp_gfx_cmd_resp *cmd, -uint64_t asd_mc,uint64_t asd_mc_shared, -uint32_t size,uint32_t shared_size) +static void psp_prep_asd_load_cmd_buf (struct psp_gfx_cmd_resp *cmd, +uint64_t asd_mc,uint32_t size) { cmd->cmd_id =GFX_CMD_ID_LOAD_ASD ; cmd->cmd.cmd_load_ta.app_phy_addr_lo =lower_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_phy_addr_hi =upper_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_len = size; - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =lower_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =upper_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_len = shared_size; -} - -static int psp_asd_init(struct psp_context *psp) -{ -int ret; - -/* -* Allocate 16k memory aligned to 4k from Frame Buffer (local -* physical) for shared ASD <-> Driver -*/ - ret =amdgpu_bo_create_kernel (psp->adev,PSP_ASD_SHARED_MEM_SIZE , -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , - &psp->asd_shared_bo, - &psp->asd_shared_mc_addr, - &psp->asd_shared_buf); - -return ret; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_len =0 ; } static int psp_asd_load(struct psp_context *psp) @@ -359,11 +341,15@@ static int
psp_asd_load(struct psp_context *psp)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); memcpy(psp->fw_pri_buf, psp->asd_start_addr, psp-Quoted 1 line
asd_ucode_size);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- psp_prep_asd_cmd_buf(cmd, psp->fw_pri_mc_addr, psp-Quoted 1 line
asd_shared_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- psp->asd_ucode_size,
PSP_ASD_SHARED_MEM_SIZE);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6
-6+psp_prep_asd_load_cmd_buf (cmd, psp->fw_pri_mc_addr, + psp->asd_ucode_size); ret =psp_cmd_submit_buf (psp,NULL , cmd, psp->fence_buf_mc_addr); +if (!ret) { + psp->asd_context.asd_initialized = true; + psp->asd_context.session_id = cmd->resp.session_id; + }kfree (cmd);@@ -1198,12 +1184,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_init (psp); -if (ret) { -DRM_ERROR ("PSP asd init failed!\n" ); -return ret; - } - ret =psp_asd_load (psp);if (ret) { DRM_ERROR("PSP load asd failed!\n"); @@ -1611,8 +1591,6 @@ staticint
psp_hw_fini(void *handle)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1&psp->fw_pri_mc_addr, &psp->fw_pri_buf);amdgpu_bo_free_kernel (&psp->fence_buf_bo, &psp->fence_buf_mc_addr, &psp->fence_buf); - amdgpu_bo_free_kernel(&psp->asd_shared_bo, &psp-Quoted 1 line
asd_shared_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- &psp->asd_shared_buf); amdgpu_bo_free_kernel(&psp->cmd_buf_bo, &psp-Quoted 1 line
cmd_buf_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0(void **)&psp->cmd_buf_mem);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0
-1@@ -32,7 +32,6 @@#define PSP_FENCE_BUFFER_SIZE 0x1000#define PSP_CMD_BUFFER_SIZE 0x1000 -#define PSP_ASD_SHARED_MEM_SIZE 0x4000 #define
PSP_XGMI_SHARED_MEM_SIZE0x4000#definePSP_RAS_SHARED_MEM_SIZE0x8000
#definePSP_1_MEG0x100000drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +5
-0@@ -130,6 +129,11 @@ struct psp_xgmi_topology_info {struct psp_xgmi_node_info nodes[AMDGPU_XGMI_MAX_CONNECTED_NODES ]; }; +struct psp_asd_context { +bool asd_initialized; +uint32_t session_id; +}; +struct psp_xgmi_context {uint8_t initialized;drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +2
-5uint32_t session_id;@@ -238,15 +242,12 @@ struct psp_contextstruct amdgpu_bo *tmr_bo;uint64_t tmr_mc_addr; -/* asd firmware and buffer */ +/* asd firmware */ const struct firmware *asd_fw;uint32_t asd_fw_version;uint32_t asd_feature_version;uint32_t asd_ucode_size;uint8_t *asd_start_addr; -struct amdgpu_bo *asd_shared_bo; -uint64_t asd_shared_mc_addr; -void *asd_shared_buf;/* fence buffer */ struct amdgpu_bo *fence_buf_bo;@@ -281,6 +282,7 @@ struct psp_contextuint32_t ta_dtm_ucode_size;uint8_t *ta_dtm_start_addr; +struct psp_asd_context asd_context;struct psp_xgmi_context xgmi_context;struct psp_ras_context ras;struct psp_hdcp_context hdcp_context; --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Correct the typo: gfx -> gfx driver in first sentence.
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Zhang, Hawking
Sent: 2019年12月3日 10:57
To: Deucher, Alexander <[email protected]>; [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>
Subject: RE: [PATCH 1/3] drm/amdgpu: drop asd shared memory
RE - Do we need to keep that memory around for the TAs or do they use some other memory?
Hi Alex,
Each TA owns its shared memory for cmd that gfx driver send to TEE. The command could be different per TA and might be using simultaneously so the shared memory can't be shared among Tas.
Originally, we also created shared buffer for ASD driver. but since gfx driver is not privileged to talk to ASD directly. The shared buffer is actually never used.
Regards,
Hawking
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: 2019年12月3日 0:44
To: Zhang, Hawking <[email protected]>; [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 1/3] drm/amdgpu: drop asd shared memory
Quoted 9 lines
-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Monday, December 2, 2019 1:04 AM
To: [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: drop asd shared memory
Quoted 4 lines
asd shared memory is not needed since drivers doesn't invoke any further cmd to asd directly after the asd loading. trust application is the one who needs to talk to asd after the initialization
Do we need to keep that memory around for the TAs or do they use some other memory?
Alex
Quoted 154 lines
Change-Id I728afa4c7e8b67bc06678b10e92ac064ba10173eSigned-off-by Hawking Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 44 +++++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 12 ++++--- 2 files changed, 18 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5
-22@@ -309,35 +309,17 @@ static int psp_tmr_load(struct psp_context *psp)return ret; } -static void psp_prep_asd_cmd_buf (struct psp_gfx_cmd_resp *cmd, -uint64_t asd_mc,uint64_t asd_mc_shared, -uint32_t size,uint32_t shared_size) +static void psp_prep_asd_load_cmd_buf (struct psp_gfx_cmd_resp *cmd, +uint64_t asd_mc,uint32_t size) { cmd->cmd_id =GFX_CMD_ID_LOAD_ASD ; cmd->cmd.cmd_load_ta.app_phy_addr_lo =lower_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_phy_addr_hi =upper_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_len = size; - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =lower_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =upper_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_len = shared_size; -} - -static int psp_asd_init(struct psp_context *psp) -{ -int ret; - -/* -* Allocate 16k memory aligned to 4k from Frame Buffer (local -* physical) for shared ASD <-> Driver -*/ - ret =amdgpu_bo_create_kernel (psp->adev,PSP_ASD_SHARED_MEM_SIZE , -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , - &psp->asd_shared_bo, - &psp->asd_shared_mc_addr, - &psp->asd_shared_buf); - -return ret; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_len =0 ; } static int psp_asd_load(struct psp_context *psp) @@ -359,11 +341,15@@ static int
psp_asd_load(struct psp_context *psp)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0memset (psp->fw_pri_buf,0 ,PSP_1_MEG ); memcpy(psp->fw_pri_buf, psp->asd_start_addr, psp-Quoted 1 line
asd_ucode_size);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- psp_prep_asd_cmd_buf(cmd, psp->fw_pri_mc_addr, psp-Quoted 1 line
asd_shared_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- psp->asd_ucode_size,
PSP_ASD_SHARED_MEM_SIZE);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6
-6+psp_prep_asd_load_cmd_buf (cmd, psp->fw_pri_mc_addr, + psp->asd_ucode_size); ret =psp_cmd_submit_buf (psp,NULL , cmd, psp->fence_buf_mc_addr); +if (!ret) { + psp->asd_context.asd_initialized = true; + psp->asd_context.session_id = cmd->resp.session_id; + }kfree (cmd);@@ -1198,12 +1184,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_init (psp); -if (ret) { -DRM_ERROR ("PSP asd init failed!\n" ); -return ret; - } - ret =psp_asd_load (psp);if (ret) { DRM_ERROR("PSP load asd failed!\n"); @@ -1611,8 +1591,6 @@ staticint
psp_hw_fini(void *handle)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1&psp->fw_pri_mc_addr, &psp->fw_pri_buf);amdgpu_bo_free_kernel (&psp->fence_buf_bo, &psp->fence_buf_mc_addr, &psp->fence_buf); - amdgpu_bo_free_kernel(&psp->asd_shared_bo, &psp-Quoted 1 line
asd_shared_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-1- &psp->asd_shared_buf); amdgpu_bo_free_kernel(&psp->cmd_buf_bo, &psp-Quoted 1 line
cmd_buf_mc_addr,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0
-0(void **)&psp->cmd_buf_mem);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0
-1@@ -32,7 +32,6 @@#define PSP_FENCE_BUFFER_SIZE 0x1000#define PSP_CMD_BUFFER_SIZE 0x1000 -#define PSP_ASD_SHARED_MEM_SIZE 0x4000 #define
PSP_XGMI_SHARED_MEM_SIZE0x4000#definePSP_RAS_SHARED_MEM_SIZE0x8000
#definePSP_1_MEG0x100000drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +5
-0@@ -130,6 +129,11 @@ struct psp_xgmi_topology_info {struct psp_xgmi_node_info nodes[AMDGPU_XGMI_MAX_CONNECTED_NODES ]; }; +struct psp_asd_context { +bool asd_initialized; +uint32_t session_id; +}; +struct psp_xgmi_context {uint8_t initialized;drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +2
-5uint32_t session_id;@@ -238,15 +242,12 @@ struct psp_contextstruct amdgpu_bo *tmr_bo;uint64_t tmr_mc_addr; -/* asd firmware and buffer */ +/* asd firmware */ const struct firmware *asd_fw;uint32_t asd_fw_version;uint32_t asd_feature_version;uint32_t asd_ucode_size;uint8_t *asd_start_addr; -struct amdgpu_bo *asd_shared_bo; -uint64_t asd_shared_mc_addr; -void *asd_shared_buf;/* fence buffer */ struct amdgpu_bo *fence_buf_bo;@@ -281,6 +282,7 @@ struct psp_contextuint32_t ta_dtm_ucode_size;uint8_t *ta_dtm_start_addr; +struct psp_asd_context asd_context;struct psp_xgmi_context xgmi_context;struct psp_ras_context ras;struct psp_hdcp_context hdcp_context; --
Quoted 1 line
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Chawking.zhang%40amd.com%7Cc70c3ac8f5ab4f94fdce08d7779c8e75%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637109386617737275&sdata=8m1uX%2FgM051uKZ%2BVuTHjah5p5KNrvuWKKBRcaR%2F0uqk%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Reviewed-byThanks.
Quoted 185 lines · Hawking
RE - Do we need to keep that memory around for the TAs or do they use some other memory?
Hi Alex,
Each TA owns its shared memory for the cmd that gfx send to TEE. The command could be different per TA and might be using simultaneously so the shared memory can't be shared among Tas.
Originally, we also created shared buffer for ASD driver. but since gfx driver is not privileged to talk to ASD directly. The shared buffer is actually never used.
Regards,
Hawking
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: 2019年12月3日 0:44
To: Zhang, Hawking <[email protected]>; [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 1/3] drm/amdgpu: drop asd shared memoryQuoted 9 lines
-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Monday, December 2, 2019 1:04 AM
To: [email protected]; Min, Frank <[email protected]>; Clements, John <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: drop asd shared memoryQuoted 4 lines
asd shared memory is not needed since drivers doesn't invoke any further cmd to asd directly after the asd loading. trust application is the one who needs to talk to asd after the initialization
Do we need to keep that memory around for the TAs or do they use some other memory?
Alex
Quoted 149 lines
Change-Id I728afa4c7e8b67bc06678b10e92ac064ba10173eSigned-off-by Hawking Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 44 +++++++------------------ drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 12 ++++--- 2 files changed, 18 insertions(+), 38 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5
-22@@ -309,35 +309,17 @@ static int psp_tmr_load(struct psp_context *psp)return ret; } -static void psp_prep_asd_cmd_buf (struct psp_gfx_cmd_resp *cmd, -uint64_t asd_mc,uint64_t asd_mc_shared, -uint32_t size,uint32_t shared_size) +static void psp_prep_asd_load_cmd_buf (struct psp_gfx_cmd_resp *cmd, +uint64_t asd_mc,uint32_t size) { cmd->cmd_id =GFX_CMD_ID_LOAD_ASD ; cmd->cmd.cmd_load_ta.app_phy_addr_lo =lower_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_phy_addr_hi =upper_32_bits (asd_mc); cmd->cmd.cmd_load_ta.app_len = size; - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =lower_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =upper_32_bits (asd_mc_shared); - cmd->cmd.cmd_load_ta.cmd_buf_len = shared_size; -} - -static int psp_asd_init(struct psp_context *psp) -{ -int ret; - -/* -* Allocate 16k memory aligned to 4k from Frame Buffer (local -* physical) for shared ASD <-> Driver -*/ - ret =amdgpu_bo_create_kernel (psp->adev,PSP_ASD_SHARED_MEM_SIZE , -PAGE_SIZE ,AMDGPU_GEM_DOMAIN_VRAM , - &psp->asd_shared_bo, - &psp->asd_shared_mc_addr, - &psp->asd_shared_buf); - -return ret; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_lo =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_phy_addr_hi =0 ; + cmd->cmd.cmd_load_ta.cmd_buf_len =0 ; } static int psp_asd_load(struct psp_context *psp) @@ -359,11 +341,15@@ static int
psp_asd_load(struct psp_context *psp)memset(psp->fw_pri_buf, 0, PSP_1_MEG); memcpy(psp->fw_pri_buf, psp->asd_start_addr, psp-Quoted 1 line
asd_ucode_size);- psp_prep_asd_cmd_buf(cmd,
psp->fw_pri_mc_addr, psp-Quoted 1 line
asd_shared_mc_addr,-
psp->asd_ucode_size,PSP_ASD_SHARED_MEM_SIZE);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6
-6+psp_prep_asd_load_cmd_buf (cmd, psp->fw_pri_mc_addr, + psp->asd_ucode_size); ret =psp_cmd_submit_buf (psp,NULL , cmd, psp->fence_buf_mc_addr); +if (!ret) { + psp->asd_context.asd_initialized = true; + psp->asd_context.session_id = cmd->resp.session_id; + }kfree (cmd);@@ -1198,12 +1184,6 @@ static int psp_hw_start(struct psp_context *psp)return ret; } - ret =psp_asd_init (psp); -if (ret) { -DRM_ERROR ("PSP asd init failed!\n" ); -return ret; - } - ret =psp_asd_load (psp);if (ret) { DRM_ERROR("PSP load asd failed!\n"); @@ -1611,8 +1591,6 @@ staticint
psp_hw_fini(void *handle)&psp->fw_pri_mc_addr, &psp->fw_pri_buf); amdgpu_bo_free_kernel(&psp->fence_buf_bo, &psp->fence_buf_mc_addr, &psp->fence_buf);- amdgpu_bo_free_kernel(&psp->asd_shared_bo, &psp-
Quoted 1 line
asd_shared_mc_addr,- &psp->asd_shared_buf); amdgpu_bo_free_kernel(&psp->cmd_buf_bo, &psp-Quoted 1 line
cmd_buf_mc_addr,(void **)&psp->cmd_buf_mem);drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0
-1@@ -32,7 +32,6 @@#define PSP_FENCE_BUFFER_SIZE 0x1000#define PSP_CMD_BUFFER_SIZE 0x1000 -#define PSP_ASD_SHARED_MEM_SIZE 0x4000 #define
PSP_XGMI_SHARED_MEM_SIZE0x4000#definePSP_RAS_SHARED_MEM_SIZE0x8000
#definePSP_1_MEG0x100000drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +5
-0@@ -130,6 +129,11 @@ struct psp_xgmi_topology_info {struct psp_xgmi_node_info nodes[AMDGPU_XGMI_MAX_CONNECTED_NODES ]; }; +struct psp_asd_context { +bool asd_initialized; +uint32_t session_id; +}; +struct psp_xgmi_context {uint8_t initialized;uint32_t session_id;drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1
-4@@ -238,15 +242,12 @@ struct psp_contextstruct amdgpu_bo *tmr_bo;uint64_t tmr_mc_addr; -/* asd firmware and buffer */ +/* asd firmware */ const struct firmware *asd_fw;uint32_t asd_fw_version;uint32_t asd_feature_version;uint32_t asd_ucode_size;uint8_t *asd_start_addr; -struct amdgpu_bo *asd_shared_bo; -uint64_t asd_shared_mc_addr; -void *asd_shared_buf;/* fence buffer */ struct amdgpu_bo *fence_buf_bo;@@ -281,6 +282,7 @@ struct psp_contextuint32_t ta_dtm_ucode_size;uint8_t *ta_dtm_start_addr;
Quoted 11 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1
-1+struct psp_asd_context asd_context;struct psp_xgmi_context xgmi_context;struct psp_ras_context ras;struct psp_hdcp_context hdcp_context; --2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx