Commit ac3ff8a9 authored by Hawking Zhang's avatar Hawking Zhang Committed by Alex Deucher

drm/amdgpu: Replace DRM_* with dev_* in amdgpu_psp.c

So kernel message has the device pcie bdf information,
which helps issue debugging especially in multiple GPU
system.
Signed-off-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4cabb217
...@@ -291,21 +291,22 @@ static int psp_memory_training_init(struct psp_context *psp) ...@@ -291,21 +291,22 @@ static int psp_memory_training_init(struct psp_context *psp)
struct psp_memory_training_context *ctx = &psp->mem_train_ctx; struct psp_memory_training_context *ctx = &psp->mem_train_ctx;
if (ctx->init != PSP_MEM_TRAIN_RESERVE_SUCCESS) { if (ctx->init != PSP_MEM_TRAIN_RESERVE_SUCCESS) {
DRM_DEBUG("memory training is not supported!\n"); dev_dbg(psp->adev->dev, "memory training is not supported!\n");
return 0; return 0;
} }
ctx->sys_cache = kzalloc(ctx->train_data_size, GFP_KERNEL); ctx->sys_cache = kzalloc(ctx->train_data_size, GFP_KERNEL);
if (ctx->sys_cache == NULL) { if (ctx->sys_cache == NULL) {
DRM_ERROR("alloc mem_train_ctx.sys_cache failed!\n"); dev_err(psp->adev->dev, "alloc mem_train_ctx.sys_cache failed!\n");
ret = -ENOMEM; ret = -ENOMEM;
goto Err_out; goto Err_out;
} }
DRM_DEBUG("train_data_size:%llx,p2c_train_data_offset:%llx,c2p_train_data_offset:%llx.\n", dev_dbg(psp->adev->dev,
ctx->train_data_size, "train_data_size:%llx,p2c_train_data_offset:%llx,c2p_train_data_offset:%llx.\n",
ctx->p2c_train_data_offset, ctx->train_data_size,
ctx->c2p_train_data_offset); ctx->p2c_train_data_offset,
ctx->c2p_train_data_offset);
ctx->init = PSP_MEM_TRAIN_INIT_SUCCESS; ctx->init = PSP_MEM_TRAIN_INIT_SUCCESS;
return 0; return 0;
...@@ -407,7 +408,7 @@ static int psp_sw_init(void *handle) ...@@ -407,7 +408,7 @@ static int psp_sw_init(void *handle)
psp->cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL); psp->cmd = kzalloc(sizeof(struct psp_gfx_cmd_resp), GFP_KERNEL);
if (!psp->cmd) { if (!psp->cmd) {
DRM_ERROR("Failed to allocate memory to command buffer!\n"); dev_err(adev->dev, "Failed to allocate memory to command buffer!\n");
ret = -ENOMEM; ret = -ENOMEM;
} }
...@@ -454,13 +455,13 @@ static int psp_sw_init(void *handle) ...@@ -454,13 +455,13 @@ static int psp_sw_init(void *handle)
if (mem_training_ctx->enable_mem_training) { if (mem_training_ctx->enable_mem_training) {
ret = psp_memory_training_init(psp); ret = psp_memory_training_init(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize memory training!\n"); dev_err(adev->dev, "Failed to initialize memory training!\n");
return ret; return ret;
} }
ret = psp_mem_training(psp, PSP_MEM_TRAIN_COLD_BOOT); ret = psp_mem_training(psp, PSP_MEM_TRAIN_COLD_BOOT);
if (ret) { if (ret) {
DRM_ERROR("Failed to process memory training!\n"); dev_err(adev->dev, "Failed to process memory training!\n");
return ret; return ret;
} }
} }
...@@ -675,9 +676,11 @@ psp_cmd_submit_buf(struct psp_context *psp, ...@@ -675,9 +676,11 @@ psp_cmd_submit_buf(struct psp_context *psp,
*/ */
if (!skip_unsupport && (psp->cmd_buf_mem->resp.status || !timeout) && !ras_intr) { if (!skip_unsupport && (psp->cmd_buf_mem->resp.status || !timeout) && !ras_intr) {
if (ucode) if (ucode)
DRM_WARN("failed to load ucode %s(0x%X) ", dev_warn(psp->adev->dev,
amdgpu_ucode_name(ucode->ucode_id), ucode->ucode_id); "failed to load ucode %s(0x%X) ",
DRM_WARN("psp gfx command %s(0x%X) failed and response status is (0x%X)\n", amdgpu_ucode_name(ucode->ucode_id), ucode->ucode_id);
dev_warn(psp->adev->dev,
"psp gfx command %s(0x%X) failed and response status is (0x%X)\n",
psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id), psp->cmd_buf_mem->cmd_id, psp_gfx_cmd_name(psp->cmd_buf_mem->cmd_id), psp->cmd_buf_mem->cmd_id,
psp->cmd_buf_mem->resp.status); psp->cmd_buf_mem->resp.status);
/* If any firmware (including CAP) load fails under SRIOV, it should /* If any firmware (including CAP) load fails under SRIOV, it should
...@@ -807,7 +810,7 @@ static int psp_tmr_init(struct psp_context *psp) ...@@ -807,7 +810,7 @@ static int psp_tmr_init(struct psp_context *psp)
psp->fw_pri_buf) { psp->fw_pri_buf) {
ret = psp_load_toc(psp, &tmr_size); ret = psp_load_toc(psp, &tmr_size);
if (ret) { if (ret) {
DRM_ERROR("Failed to load toc\n"); dev_err(psp->adev->dev, "Failed to load toc\n");
return ret; return ret;
} }
} }
...@@ -855,7 +858,7 @@ static int psp_tmr_load(struct psp_context *psp) ...@@ -855,7 +858,7 @@ static int psp_tmr_load(struct psp_context *psp)
psp_prep_tmr_cmd_buf(psp, cmd, psp->tmr_mc_addr, psp->tmr_bo); psp_prep_tmr_cmd_buf(psp, cmd, psp->tmr_mc_addr, psp->tmr_bo);
if (psp->tmr_bo) if (psp->tmr_bo)
DRM_INFO("reserve 0x%lx from 0x%llx for PSP TMR\n", dev_info(psp->adev->dev, "reserve 0x%lx from 0x%llx for PSP TMR\n",
amdgpu_bo_size(psp->tmr_bo), psp->tmr_mc_addr); amdgpu_bo_size(psp->tmr_bo), psp->tmr_mc_addr);
ret = psp_cmd_submit_buf(psp, NULL, cmd, ret = psp_cmd_submit_buf(psp, NULL, cmd,
...@@ -1113,7 +1116,7 @@ int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg, ...@@ -1113,7 +1116,7 @@ int psp_reg_program(struct psp_context *psp, enum psp_reg_prog_id reg,
psp_prep_reg_prog_cmd_buf(cmd, reg, value); psp_prep_reg_prog_cmd_buf(cmd, reg, value);
ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr); ret = psp_cmd_submit_buf(psp, NULL, cmd, psp->fence_buf_mc_addr);
if (ret) if (ret)
DRM_ERROR("PSP failed to program reg id %d", reg); dev_err(psp->adev->dev, "PSP failed to program reg id %d\n", reg);
release_psp_cmd_buf(psp); release_psp_cmd_buf(psp);
...@@ -1526,22 +1529,22 @@ static void psp_ras_ta_check_status(struct psp_context *psp) ...@@ -1526,22 +1529,22 @@ static void psp_ras_ta_check_status(struct psp_context *psp)
switch (ras_cmd->ras_status) { switch (ras_cmd->ras_status) {
case TA_RAS_STATUS__ERROR_UNSUPPORTED_IP: case TA_RAS_STATUS__ERROR_UNSUPPORTED_IP:
dev_warn(psp->adev->dev, dev_warn(psp->adev->dev,
"RAS WARNING: cmd failed due to unsupported ip\n"); "RAS WARNING: cmd failed due to unsupported ip\n");
break; break;
case TA_RAS_STATUS__ERROR_UNSUPPORTED_ERROR_INJ: case TA_RAS_STATUS__ERROR_UNSUPPORTED_ERROR_INJ:
dev_warn(psp->adev->dev, dev_warn(psp->adev->dev,
"RAS WARNING: cmd failed due to unsupported error injection\n"); "RAS WARNING: cmd failed due to unsupported error injection\n");
break; break;
case TA_RAS_STATUS__SUCCESS: case TA_RAS_STATUS__SUCCESS:
break; break;
case TA_RAS_STATUS__TEE_ERROR_ACCESS_DENIED: case TA_RAS_STATUS__TEE_ERROR_ACCESS_DENIED:
if (ras_cmd->cmd_id == TA_RAS_COMMAND__TRIGGER_ERROR) if (ras_cmd->cmd_id == TA_RAS_COMMAND__TRIGGER_ERROR)
dev_warn(psp->adev->dev, dev_warn(psp->adev->dev,
"RAS WARNING: Inject error to critical region is not allowed\n"); "RAS WARNING: Inject error to critical region is not allowed\n");
break; break;
default: default:
dev_warn(psp->adev->dev, dev_warn(psp->adev->dev,
"RAS WARNING: ras status = 0x%X\n", ras_cmd->ras_status); "RAS WARNING: ras status = 0x%X\n", ras_cmd->ras_status);
break; break;
} }
} }
...@@ -1565,7 +1568,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id) ...@@ -1565,7 +1568,7 @@ int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
return ret; return ret;
if (ras_cmd->if_version > RAS_TA_HOST_IF_VER) { if (ras_cmd->if_version > RAS_TA_HOST_IF_VER) {
DRM_WARN("RAS: Unsupported Interface"); dev_warn(psp->adev->dev, "RAS: Unsupported Interface\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1715,7 +1718,7 @@ int psp_ras_initialize(struct psp_context *psp) ...@@ -1715,7 +1718,7 @@ int psp_ras_initialize(struct psp_context *psp)
psp->ras_context.context.initialized = true; psp->ras_context.context.initialized = true;
else { else {
if (ras_cmd->ras_status) if (ras_cmd->ras_status)
dev_warn(psp->adev->dev, "RAS Init Status: 0x%X\n", ras_cmd->ras_status); dev_warn(adev->dev, "RAS Init Status: 0x%X\n", ras_cmd->ras_status);
/* fail to load RAS TA */ /* fail to load RAS TA */
psp->ras_context.context.initialized = false; psp->ras_context.context.initialized = false;
...@@ -2150,7 +2153,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2150,7 +2153,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_kdb != NULL)) { (psp->funcs->bootloader_load_kdb != NULL)) {
ret = psp_bootloader_load_kdb(psp); ret = psp_bootloader_load_kdb(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load kdb failed!\n"); dev_err(adev->dev, "PSP load kdb failed!\n");
return ret; return ret;
} }
} }
...@@ -2159,7 +2162,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2159,7 +2162,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_spl != NULL)) { (psp->funcs->bootloader_load_spl != NULL)) {
ret = psp_bootloader_load_spl(psp); ret = psp_bootloader_load_spl(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load spl failed!\n"); dev_err(adev->dev, "PSP load spl failed!\n");
return ret; return ret;
} }
} }
...@@ -2168,7 +2171,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2168,7 +2171,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_sysdrv != NULL)) { (psp->funcs->bootloader_load_sysdrv != NULL)) {
ret = psp_bootloader_load_sysdrv(psp); ret = psp_bootloader_load_sysdrv(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load sys drv failed!\n"); dev_err(adev->dev, "PSP load sys drv failed!\n");
return ret; return ret;
} }
} }
...@@ -2177,7 +2180,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2177,7 +2180,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_soc_drv != NULL)) { (psp->funcs->bootloader_load_soc_drv != NULL)) {
ret = psp_bootloader_load_soc_drv(psp); ret = psp_bootloader_load_soc_drv(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load soc drv failed!\n"); dev_err(adev->dev, "PSP load soc drv failed!\n");
return ret; return ret;
} }
} }
...@@ -2186,7 +2189,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2186,7 +2189,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_intf_drv != NULL)) { (psp->funcs->bootloader_load_intf_drv != NULL)) {
ret = psp_bootloader_load_intf_drv(psp); ret = psp_bootloader_load_intf_drv(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load intf drv failed!\n"); dev_err(adev->dev, "PSP load intf drv failed!\n");
return ret; return ret;
} }
} }
...@@ -2195,7 +2198,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2195,7 +2198,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_dbg_drv != NULL)) { (psp->funcs->bootloader_load_dbg_drv != NULL)) {
ret = psp_bootloader_load_dbg_drv(psp); ret = psp_bootloader_load_dbg_drv(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load dbg drv failed!\n"); dev_err(adev->dev, "PSP load dbg drv failed!\n");
return ret; return ret;
} }
} }
...@@ -2204,7 +2207,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2204,7 +2207,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_ras_drv != NULL)) { (psp->funcs->bootloader_load_ras_drv != NULL)) {
ret = psp_bootloader_load_ras_drv(psp); ret = psp_bootloader_load_ras_drv(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load ras_drv failed!\n"); dev_err(adev->dev, "PSP load ras_drv failed!\n");
return ret; return ret;
} }
} }
...@@ -2213,7 +2216,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2213,7 +2216,7 @@ static int psp_hw_start(struct psp_context *psp)
(psp->funcs->bootloader_load_sos != NULL)) { (psp->funcs->bootloader_load_sos != NULL)) {
ret = psp_bootloader_load_sos(psp); ret = psp_bootloader_load_sos(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load sos failed!\n"); dev_err(adev->dev, "PSP load sos failed!\n");
return ret; return ret;
} }
} }
...@@ -2221,7 +2224,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2221,7 +2224,7 @@ static int psp_hw_start(struct psp_context *psp)
ret = psp_ring_create(psp, PSP_RING_TYPE__KM); ret = psp_ring_create(psp, PSP_RING_TYPE__KM);
if (ret) { if (ret) {
DRM_ERROR("PSP create ring failed!\n"); dev_err(adev->dev, "PSP create ring failed!\n");
return ret; return ret;
} }
...@@ -2231,7 +2234,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2231,7 +2234,7 @@ static int psp_hw_start(struct psp_context *psp)
if (!psp_boottime_tmr(psp)) { if (!psp_boottime_tmr(psp)) {
ret = psp_tmr_init(psp); ret = psp_tmr_init(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP tmr init failed!\n"); dev_err(adev->dev, "PSP tmr init failed!\n");
return ret; return ret;
} }
} }
...@@ -2250,7 +2253,7 @@ static int psp_hw_start(struct psp_context *psp) ...@@ -2250,7 +2253,7 @@ static int psp_hw_start(struct psp_context *psp)
ret = psp_tmr_load(psp); ret = psp_tmr_load(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load tmr failed!\n"); dev_err(adev->dev, "PSP load tmr failed!\n");
return ret; return ret;
} }
...@@ -2518,7 +2521,8 @@ static void psp_print_fw_hdr(struct psp_context *psp, ...@@ -2518,7 +2521,8 @@ static void psp_print_fw_hdr(struct psp_context *psp,
} }
} }
static int psp_prep_load_ip_fw_cmd_buf(struct amdgpu_firmware_info *ucode, static int psp_prep_load_ip_fw_cmd_buf(struct psp_context *psp,
struct amdgpu_firmware_info *ucode,
struct psp_gfx_cmd_resp *cmd) struct psp_gfx_cmd_resp *cmd)
{ {
int ret; int ret;
...@@ -2531,7 +2535,7 @@ static int psp_prep_load_ip_fw_cmd_buf(struct amdgpu_firmware_info *ucode, ...@@ -2531,7 +2535,7 @@ static int psp_prep_load_ip_fw_cmd_buf(struct amdgpu_firmware_info *ucode,
ret = psp_get_fw_type(ucode, &cmd->cmd.cmd_load_ip_fw.fw_type); ret = psp_get_fw_type(ucode, &cmd->cmd.cmd_load_ip_fw.fw_type);
if (ret) if (ret)
DRM_ERROR("Unknown firmware type\n"); dev_err(psp->adev->dev, "Unknown firmware type\n");
return ret; return ret;
} }
...@@ -2542,7 +2546,7 @@ int psp_execute_ip_fw_load(struct psp_context *psp, ...@@ -2542,7 +2546,7 @@ int psp_execute_ip_fw_load(struct psp_context *psp,
int ret = 0; int ret = 0;
struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp); struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
ret = psp_prep_load_ip_fw_cmd_buf(ucode, cmd); ret = psp_prep_load_ip_fw_cmd_buf(psp, ucode, cmd);
if (!ret) { if (!ret) {
ret = psp_cmd_submit_buf(psp, ucode, cmd, ret = psp_cmd_submit_buf(psp, ucode, cmd,
psp->fence_buf_mc_addr); psp->fence_buf_mc_addr);
...@@ -2601,13 +2605,13 @@ static int psp_load_smu_fw(struct psp_context *psp) ...@@ -2601,13 +2605,13 @@ static int psp_load_smu_fw(struct psp_context *psp)
amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(11, 0, 2)))) { amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(11, 0, 2)))) {
ret = amdgpu_dpm_set_mp1_state(adev, PP_MP1_STATE_UNLOAD); ret = amdgpu_dpm_set_mp1_state(adev, PP_MP1_STATE_UNLOAD);
if (ret) if (ret)
DRM_WARN("Failed to set MP1 state prepare for reload\n"); dev_err(adev->dev, "Failed to set MP1 state prepare for reload\n");
} }
ret = psp_execute_ip_fw_load(psp, ucode); ret = psp_execute_ip_fw_load(psp, ucode);
if (ret) if (ret)
DRM_ERROR("PSP load smu failed!\n"); dev_err(adev->dev, "PSP load smu failed!\n");
return ret; return ret;
} }
...@@ -2712,7 +2716,7 @@ static int psp_load_non_psp_fw(struct psp_context *psp) ...@@ -2712,7 +2716,7 @@ static int psp_load_non_psp_fw(struct psp_context *psp)
adev->virt.autoload_ucode_id : AMDGPU_UCODE_ID_RLC_G)) { adev->virt.autoload_ucode_id : AMDGPU_UCODE_ID_RLC_G)) {
ret = psp_rlc_autoload_start(psp); ret = psp_rlc_autoload_start(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to start rlc autoload\n"); dev_err(adev->dev, "Failed to start rlc autoload\n");
return ret; return ret;
} }
} }
...@@ -2734,7 +2738,7 @@ static int psp_load_fw(struct amdgpu_device *adev) ...@@ -2734,7 +2738,7 @@ static int psp_load_fw(struct amdgpu_device *adev)
ret = psp_ring_init(psp, PSP_RING_TYPE__KM); ret = psp_ring_init(psp, PSP_RING_TYPE__KM);
if (ret) { if (ret) {
DRM_ERROR("PSP ring init failed!\n"); dev_err(adev->dev, "PSP ring init failed!\n");
goto failed; goto failed;
} }
} }
...@@ -2749,13 +2753,13 @@ static int psp_load_fw(struct amdgpu_device *adev) ...@@ -2749,13 +2753,13 @@ static int psp_load_fw(struct amdgpu_device *adev)
ret = psp_asd_initialize(psp); ret = psp_asd_initialize(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load asd failed!\n"); dev_err(adev->dev, "PSP load asd failed!\n");
goto failed1; goto failed1;
} }
ret = psp_rl_load(adev); ret = psp_rl_load(adev);
if (ret) { if (ret) {
DRM_ERROR("PSP load RL failed!\n"); dev_err(adev->dev, "PSP load RL failed!\n");
goto failed1; goto failed1;
} }
...@@ -2775,7 +2779,7 @@ static int psp_load_fw(struct amdgpu_device *adev) ...@@ -2775,7 +2779,7 @@ static int psp_load_fw(struct amdgpu_device *adev)
ret = psp_ras_initialize(psp); ret = psp_ras_initialize(psp);
if (ret) if (ret)
dev_err(psp->adev->dev, dev_err(psp->adev->dev,
"RAS: Failed to initialize RAS\n"); "RAS: Failed to initialize RAS\n");
ret = psp_hdcp_initialize(psp); ret = psp_hdcp_initialize(psp);
if (ret) if (ret)
...@@ -2828,7 +2832,7 @@ static int psp_hw_init(void *handle) ...@@ -2828,7 +2832,7 @@ static int psp_hw_init(void *handle)
ret = psp_load_fw(adev); ret = psp_load_fw(adev);
if (ret) { if (ret) {
DRM_ERROR("PSP firmware loading failed\n"); dev_err(adev->dev, "PSP firmware loading failed\n");
goto failed; goto failed;
} }
...@@ -2875,7 +2879,7 @@ static int psp_suspend(void *handle) ...@@ -2875,7 +2879,7 @@ static int psp_suspend(void *handle)
psp->xgmi_context.context.initialized) { psp->xgmi_context.context.initialized) {
ret = psp_xgmi_terminate(psp); ret = psp_xgmi_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate xgmi ta\n"); dev_err(adev->dev, "Failed to terminate xgmi ta\n");
goto out; goto out;
} }
} }
...@@ -2883,46 +2887,46 @@ static int psp_suspend(void *handle) ...@@ -2883,46 +2887,46 @@ static int psp_suspend(void *handle)
if (psp->ta_fw) { if (psp->ta_fw) {
ret = psp_ras_terminate(psp); ret = psp_ras_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate ras ta\n"); dev_err(adev->dev, "Failed to terminate ras ta\n");
goto out; goto out;
} }
ret = psp_hdcp_terminate(psp); ret = psp_hdcp_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate hdcp ta\n"); dev_err(adev->dev, "Failed to terminate hdcp ta\n");
goto out; goto out;
} }
ret = psp_dtm_terminate(psp); ret = psp_dtm_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate dtm ta\n"); dev_err(adev->dev, "Failed to terminate dtm ta\n");
goto out; goto out;
} }
ret = psp_rap_terminate(psp); ret = psp_rap_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate rap ta\n"); dev_err(adev->dev, "Failed to terminate rap ta\n");
goto out; goto out;
} }
ret = psp_securedisplay_terminate(psp); ret = psp_securedisplay_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate securedisplay ta\n"); dev_err(adev->dev, "Failed to terminate securedisplay ta\n");
goto out; goto out;
} }
} }
ret = psp_asd_terminate(psp); ret = psp_asd_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate asd\n"); dev_err(adev->dev, "Failed to terminate asd\n");
goto out; goto out;
} }
ret = psp_tmr_terminate(psp); ret = psp_tmr_terminate(psp);
if (ret) { if (ret) {
DRM_ERROR("Failed to terminate tmr\n"); dev_err(adev->dev, "Failed to terminate tmr\n");
goto out; goto out;
} }
ret = psp_ring_stop(psp, PSP_RING_TYPE__KM); ret = psp_ring_stop(psp, PSP_RING_TYPE__KM);
if (ret) if (ret)
DRM_ERROR("PSP ring stop failed\n"); dev_err(adev->dev, "PSP ring stop failed\n");
out: out:
return ret; return ret;
...@@ -2934,12 +2938,12 @@ static int psp_resume(void *handle) ...@@ -2934,12 +2938,12 @@ static int psp_resume(void *handle)
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct psp_context *psp = &adev->psp; struct psp_context *psp = &adev->psp;
DRM_INFO("PSP is resuming...\n"); dev_info(adev->dev, "PSP is resuming...\n");
if (psp->mem_train_ctx.enable_mem_training) { if (psp->mem_train_ctx.enable_mem_training) {
ret = psp_mem_training(psp, PSP_MEM_TRAIN_RESUME); ret = psp_mem_training(psp, PSP_MEM_TRAIN_RESUME);
if (ret) { if (ret) {
DRM_ERROR("Failed to process memory training!\n"); dev_err(adev->dev, "Failed to process memory training!\n");
return ret; return ret;
} }
} }
...@@ -2956,7 +2960,7 @@ static int psp_resume(void *handle) ...@@ -2956,7 +2960,7 @@ static int psp_resume(void *handle)
ret = psp_asd_initialize(psp); ret = psp_asd_initialize(psp);
if (ret) { if (ret) {
DRM_ERROR("PSP load asd failed!\n"); dev_err(adev->dev, "PSP load asd failed!\n");
goto failed; goto failed;
} }
...@@ -2980,7 +2984,7 @@ static int psp_resume(void *handle) ...@@ -2980,7 +2984,7 @@ static int psp_resume(void *handle)
ret = psp_ras_initialize(psp); ret = psp_ras_initialize(psp);
if (ret) if (ret)
dev_err(psp->adev->dev, dev_err(psp->adev->dev,
"RAS: Failed to initialize RAS\n"); "RAS: Failed to initialize RAS\n");
ret = psp_hdcp_initialize(psp); ret = psp_hdcp_initialize(psp);
if (ret) if (ret)
...@@ -3008,7 +3012,7 @@ static int psp_resume(void *handle) ...@@ -3008,7 +3012,7 @@ static int psp_resume(void *handle)
return 0; return 0;
failed: failed:
DRM_ERROR("PSP resume failed\n"); dev_err(adev->dev, "PSP resume failed\n");
mutex_unlock(&adev->firmware.mutex); mutex_unlock(&adev->firmware.mutex);
return ret; return ret;
} }
...@@ -3069,9 +3073,11 @@ int psp_ring_cmd_submit(struct psp_context *psp, ...@@ -3069,9 +3073,11 @@ int psp_ring_cmd_submit(struct psp_context *psp,
write_frame = ring_buffer_start + (psp_write_ptr_reg / rb_frame_size_dw); write_frame = ring_buffer_start + (psp_write_ptr_reg / rb_frame_size_dw);
/* Check invalid write_frame ptr address */ /* Check invalid write_frame ptr address */
if ((write_frame < ring_buffer_start) || (ring_buffer_end < write_frame)) { if ((write_frame < ring_buffer_start) || (ring_buffer_end < write_frame)) {
DRM_ERROR("ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n", dev_err(adev->dev,
ring_buffer_start, ring_buffer_end, write_frame); "ring_buffer_start = %p; ring_buffer_end = %p; write_frame = %p\n",
DRM_ERROR("write_frame is pointing to address out of bounds\n"); ring_buffer_start, ring_buffer_end, write_frame);
dev_err(adev->dev,
"write_frame is pointing to address out of bounds\n");
return -EINVAL; return -EINVAL;
} }
...@@ -3597,7 +3603,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_read(struct device *dev, ...@@ -3597,7 +3603,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_read(struct device *dev,
int ret; int ret;
if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) { if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) {
DRM_INFO("PSP block is not ready yet."); dev_info(adev->dev, "PSP block is not ready yet\n.");
return -EBUSY; return -EBUSY;
} }
...@@ -3606,7 +3612,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_read(struct device *dev, ...@@ -3606,7 +3612,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_read(struct device *dev,
mutex_unlock(&adev->psp.mutex); mutex_unlock(&adev->psp.mutex);
if (ret) { if (ret) {
DRM_ERROR("Failed to read USBC PD FW, err = %d", ret); dev_err(adev->dev, "Failed to read USBC PD FW, err = %d\n", ret);
return ret; return ret;
} }
...@@ -3628,7 +3634,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev, ...@@ -3628,7 +3634,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
void *fw_pri_cpu_addr; void *fw_pri_cpu_addr;
if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) { if (!adev->ip_blocks[AMD_IP_BLOCK_TYPE_PSP].status.late_initialized) {
DRM_INFO("PSP block is not ready yet."); dev_err(adev->dev, "PSP block is not ready yet.");
return -EBUSY; return -EBUSY;
} }
...@@ -3661,7 +3667,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev, ...@@ -3661,7 +3667,7 @@ static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
release_firmware(usbc_pd_fw); release_firmware(usbc_pd_fw);
fail: fail:
if (ret) { if (ret) {
DRM_ERROR("Failed to load USBC PD FW, err = %d", ret); dev_err(adev->dev, "Failed to load USBC PD FW, err = %d", ret);
count = ret; count = ret;
} }
...@@ -3708,7 +3714,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj, ...@@ -3708,7 +3714,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj,
/* Safeguard against memory drain */ /* Safeguard against memory drain */
if (adev->psp.vbflash_image_size > AMD_VBIOS_FILE_MAX_SIZE_B) { if (adev->psp.vbflash_image_size > AMD_VBIOS_FILE_MAX_SIZE_B) {
dev_err(adev->dev, "File size cannot exceed %u", AMD_VBIOS_FILE_MAX_SIZE_B); dev_err(adev->dev, "File size cannot exceed %u\n", AMD_VBIOS_FILE_MAX_SIZE_B);
kvfree(adev->psp.vbflash_tmp_buf); kvfree(adev->psp.vbflash_tmp_buf);
adev->psp.vbflash_tmp_buf = NULL; adev->psp.vbflash_tmp_buf = NULL;
adev->psp.vbflash_image_size = 0; adev->psp.vbflash_image_size = 0;
...@@ -3727,7 +3733,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj, ...@@ -3727,7 +3733,7 @@ static ssize_t amdgpu_psp_vbflash_write(struct file *filp, struct kobject *kobj,
adev->psp.vbflash_image_size += count; adev->psp.vbflash_image_size += count;
mutex_unlock(&adev->psp.mutex); mutex_unlock(&adev->psp.mutex);
dev_dbg(adev->dev, "IFWI staged for update"); dev_dbg(adev->dev, "IFWI staged for update\n");
return count; return count;
} }
...@@ -3747,7 +3753,7 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj, ...@@ -3747,7 +3753,7 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj,
if (adev->psp.vbflash_image_size == 0) if (adev->psp.vbflash_image_size == 0)
return -EINVAL; return -EINVAL;
dev_dbg(adev->dev, "PSP IFWI flash process initiated"); dev_dbg(adev->dev, "PSP IFWI flash process initiated\n");
ret = amdgpu_bo_create_kernel(adev, adev->psp.vbflash_image_size, ret = amdgpu_bo_create_kernel(adev, adev->psp.vbflash_image_size,
AMDGPU_GPU_PAGE_SIZE, AMDGPU_GPU_PAGE_SIZE,
...@@ -3772,11 +3778,11 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj, ...@@ -3772,11 +3778,11 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj,
adev->psp.vbflash_image_size = 0; adev->psp.vbflash_image_size = 0;
if (ret) { if (ret) {
dev_err(adev->dev, "Failed to load IFWI, err = %d", ret); dev_err(adev->dev, "Failed to load IFWI, err = %d\n", ret);
return ret; return ret;
} }
dev_dbg(adev->dev, "PSP IFWI flash process done"); dev_dbg(adev->dev, "PSP IFWI flash process done\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment