diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 66 | 
1 files changed, 45 insertions, 21 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index b067ce45d226..effa7df3ddbf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -138,6 +138,7 @@ static int psp_early_init(void *handle)  	case IP_VERSION(13, 0, 3):  	case IP_VERSION(13, 0, 5):  	case IP_VERSION(13, 0, 8): +	case IP_VERSION(13, 0, 10):  		psp_v13_0_set_psp_funcs(psp);  		psp->autoload_supported = true;  		break; @@ -327,23 +328,32 @@ static int psp_init_sriov_microcode(struct psp_context *psp)  	switch (adev->ip_versions[MP0_HWIP][0]) {  	case IP_VERSION(9, 0, 0): +		adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;  		ret = psp_init_cap_microcode(psp, "vega10");  		break;  	case IP_VERSION(11, 0, 9): +		adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;  		ret = psp_init_cap_microcode(psp, "navi12");  		break;  	case IP_VERSION(11, 0, 7): +		adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;  		ret = psp_init_cap_microcode(psp, "sienna_cichlid");  		break;  	case IP_VERSION(13, 0, 2): +		adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;  		ret = psp_init_cap_microcode(psp, "aldebaran");  		ret &= psp_init_ta_microcode(psp, "aldebaran");  		break; +	case IP_VERSION(13, 0, 0): +		adev->virt.autoload_ucode_id = 0; +		break; +	case IP_VERSION(13, 0, 10): +		adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA; +		break;  	default:  		BUG();  		break;  	} -  	return ret;  } @@ -486,11 +496,14 @@ static int psp_sw_fini(void *handle)  		release_firmware(psp->ta_fw);  		psp->ta_fw = NULL;  	} -	if (adev->psp.cap_fw) { +	if (psp->cap_fw) {  		release_firmware(psp->cap_fw);  		psp->cap_fw = NULL;  	} - +	if (psp->toc_fw) { +		release_firmware(psp->toc_fw); +		psp->toc_fw = NULL; +	}  	if (adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 0) ||  	    adev->ip_versions[MP0_HWIP][0] == IP_VERSION(11, 0, 7))  		psp_sysfs_fini(adev); @@ -498,6 +511,11 @@ static int psp_sw_fini(void *handle)  	kfree(cmd);  	cmd = NULL; +	if (psp->km_ring.ring_mem) +		amdgpu_bo_free_kernel(&adev->firmware.rbuf, +				      &psp->km_ring.ring_mem_mc_addr, +				      (void **)&psp->km_ring.ring_mem); +  	amdgpu_bo_free_kernel(&psp->fw_pri_bo,  			      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);  	amdgpu_bo_free_kernel(&psp->fence_buf_bo, @@ -753,7 +771,7 @@ static int psp_tmr_init(struct psp_context *psp)  	}  	pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL; -	ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE(psp->adev), +	ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT,  				      AMDGPU_GEM_DOMAIN_VRAM,  				      &psp->tmr_bo, &psp->tmr_mc_addr, pptr); @@ -766,6 +784,7 @@ static bool psp_skip_tmr(struct psp_context *psp)  	case IP_VERSION(11, 0, 9):  	case IP_VERSION(11, 0, 7):  	case IP_VERSION(13, 0, 2): +	case IP_VERSION(13, 0, 10):  		return true;  	default:  		return false; @@ -812,7 +831,7 @@ static int psp_tmr_unload(struct psp_context *psp)  	struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);  	psp_prep_tmr_unload_cmd_buf(psp, cmd); -	DRM_INFO("free PSP TMR buffer\n"); +	dev_info(psp->adev->dev, "free PSP TMR buffer\n");  	ret = psp_cmd_submit_buf(psp, NULL, cmd,  				 psp->fence_buf_mc_addr); @@ -2041,6 +2060,15 @@ static int psp_hw_start(struct psp_context *psp)  			}  		} +		if ((is_psp_fw_valid(psp->ras_drv)) && +		    (psp->funcs->bootloader_load_ras_drv != NULL)) { +			ret = psp_bootloader_load_ras_drv(psp); +			if (ret) { +				DRM_ERROR("PSP load ras_drv failed!\n"); +				return ret; +			} +		} +  		if ((is_psp_fw_valid(psp->sos)) &&  		    (psp->funcs->bootloader_load_sos != NULL)) {  			ret = psp_bootloader_load_sos(psp); @@ -2401,7 +2429,7 @@ static int psp_load_smu_fw(struct psp_context *psp)  static bool fw_load_skip_check(struct psp_context *psp,  			       struct amdgpu_firmware_info *ucode)  { -	if (!ucode->fw) +	if (!ucode->fw || !ucode->ucode_size)  		return true;  	if (ucode->ucode_id == AMDGPU_UCODE_ID_SMC && @@ -2411,20 +2439,7 @@ static bool fw_load_skip_check(struct psp_context *psp,  		return true;  	if (amdgpu_sriov_vf(psp->adev) && -	   (ucode->ucode_id == AMDGPU_UCODE_ID_SDMA0 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SDMA1 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SDMA2 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SDMA3 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SDMA4 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SDMA5 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SDMA6 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SDMA7 -	    || ucode->ucode_id == AMDGPU_UCODE_ID_RLC_G -	    || ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL -	    || ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM -	    || ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM -	    || ucode->ucode_id == AMDGPU_UCODE_ID_SMC)) -		/*skip ucode loading in SRIOV VF */ +	    amdgpu_virt_fw_load_skip_check(psp->adev, ucode->ucode_id))  		return true;  	if (psp->autoload_supported && @@ -2498,7 +2513,7 @@ static int psp_load_non_psp_fw(struct psp_context *psp)  		/* Start rlc autoload after psp recieved all the gfx firmware */  		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ? -		    AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_G)) { +		    adev->virt.autoload_ucode_id : AMDGPU_UCODE_ID_RLC_G)) {  			ret = psp_rlc_autoload_start(psp);  			if (ret) {  				DRM_ERROR("Failed to start rlc autoload\n"); @@ -2641,6 +2656,9 @@ static int psp_hw_fini(void *handle)  		psp_rap_terminate(psp);  		psp_dtm_terminate(psp);  		psp_hdcp_terminate(psp); + +		if (adev->gmc.xgmi.num_physical_nodes > 1) +			psp_xgmi_terminate(psp);  	}  	psp_asd_terminate(psp); @@ -3036,6 +3054,12 @@ static int parse_sos_bin_descriptor(struct psp_context *psp,  		psp->dbg_drv.size_bytes         = le32_to_cpu(desc->size_bytes);  		psp->dbg_drv.start_addr         = ucode_start_addr;  		break; +	case PSP_FW_TYPE_PSP_RAS_DRV: +		psp->ras_drv.fw_version         = le32_to_cpu(desc->fw_version); +		psp->ras_drv.feature_version    = le32_to_cpu(desc->fw_version); +		psp->ras_drv.size_bytes         = le32_to_cpu(desc->size_bytes); +		psp->ras_drv.start_addr         = ucode_start_addr; +		break;  	default:  		dev_warn(psp->adev->dev, "Unsupported PSP FW type: %d\n", desc->fw_type);  		break; |