diff options
author | Hawking Zhang <Hawking.Zhang@amd.com> | 2018-09-28 03:01:57 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-11-06 14:02:42 -0500 |
commit | ca6e1e59a24bf4aed4d017163f8184eb4e384a9b (patch) | |
tree | c4b3fc97347cf37bae03cb8f61bd338d2bd4fbb4 /drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |
parent | 4de5f0055adf1ed45c81596afad1a41294af9e87 (diff) |
drm/amdgpu/psp: add helper function to invoke xgmi ta per ta cmd_id
psp_xgmi_invoke is the helper function to issue ta cmd to firmware
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index a639bedb0ad3..07f9fcb59c0a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |||
@@ -369,6 +369,42 @@ static int psp_xgmi_unload(struct psp_context *psp) | |||
369 | return ret; | 369 | return ret; |
370 | } | 370 | } |
371 | 371 | ||
372 | static void psp_prep_xgmi_ta_invoke_cmd_buf(struct psp_gfx_cmd_resp *cmd, | ||
373 | uint32_t ta_cmd_id, | ||
374 | uint32_t xgmi_session_id) | ||
375 | { | ||
376 | cmd->cmd_id = GFX_CMD_ID_INVOKE_CMD; | ||
377 | cmd->cmd.cmd_invoke_cmd.session_id = xgmi_session_id; | ||
378 | cmd->cmd.cmd_invoke_cmd.ta_cmd_id = ta_cmd_id; | ||
379 | /* Note: cmd_invoke_cmd.buf is not used for now */ | ||
380 | } | ||
381 | |||
382 | int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id) | ||
383 | { | ||
384 | int ret; | ||
385 | struct psp_gfx_cmd_resp *cmd; | ||
386 | |||
387 | /* | ||
388 | * TODO: bypass the loading in sriov for now | ||
389 | */ | ||
390 | if (amdgpu_sriov_vf(psp->adev)) | ||
391 | return 0; | ||
392 | |||
393 | cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); | ||
394 | if (!cmd) | ||
395 | return -ENOMEM; | ||
396 | |||
397 | psp_prep_xgmi_ta_invoke_cmd_buf(cmd, ta_cmd_id, | ||
398 | psp->xgmi_context.session_id); | ||
399 | |||
400 | ret = psp_cmd_submit_buf(psp, NULL, cmd, | ||
401 | psp->fence_buf_mc_addr); | ||
402 | |||
403 | kfree(cmd); | ||
404 | |||
405 | return ret; | ||
406 | } | ||
407 | |||
372 | static int psp_hw_start(struct psp_context *psp) | 408 | static int psp_hw_start(struct psp_context *psp) |
373 | { | 409 | { |
374 | struct amdgpu_device *adev = psp->adev; | 410 | struct amdgpu_device *adev = psp->adev; |