Re: [PATCH] drm/amdgpu/psp11: TA firmware is optional (v3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is
Reviewed-by: James Zhu<James.Zhu@xxxxxxx>
Tested-by: James Zhu<James.Zhu@xxxxxxx>

On 2019-02-12 10:29 p.m., Zhang, Hawking wrote:
> Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>
>
> Regards,
> Hawking
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Alex Deucher via amd-gfx
> Sent: 2019年2月13日 5:11
> To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>
> Subject: [PATCH] drm/amdgpu/psp11: TA firmware is optional (v3)
>
> Don't warn or fail if it's missing.
>
> v2: handle xgmi case more gracefully.
> v3: handle older kernels properly
>
> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c |  9 ++++++--  drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  | 28 ++++++++++++++-----------
>   2 files changed, 23 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 8fab0d637ee5..3a9b48b227ac 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -90,8 +90,10 @@ static int psp_sw_fini(void *handle)
>   	adev->psp.sos_fw = NULL;
>   	release_firmware(adev->psp.asd_fw);
>   	adev->psp.asd_fw = NULL;
> -	release_firmware(adev->psp.ta_fw);
> -	adev->psp.ta_fw = NULL;
> +	if (adev->psp.ta_fw) {
> +		release_firmware(adev->psp.ta_fw);
> +		adev->psp.ta_fw = NULL;
> +	}
>   	return 0;
>   }
>   
> @@ -435,6 +437,9 @@ static int psp_xgmi_initialize(struct psp_context *psp)
>   	struct ta_xgmi_shared_memory *xgmi_cmd;
>   	int ret;
>   
> +	if (!psp->adev->psp.ta_fw)
> +		return -ENOENT;
> +
>   	if (!psp->xgmi_context.initialized) {
>   		ret = psp_xgmi_init_shared_buf(psp);
>   		if (ret)
> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> index 0c6e7f9b143f..189fcb004579 100644
> --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
> @@ -152,18 +152,22 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
>   
>   	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ta.bin", chip_name);
>   	err = request_firmware(&adev->psp.ta_fw, fw_name, adev->dev);
> -	if (err)
> -		goto out2;
> -
> -	err = amdgpu_ucode_validate(adev->psp.ta_fw);
> -	if (err)
> -		goto out2;
> -
> -	ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
> -	adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version);
> -	adev->psp.ta_xgmi_ucode_size = le32_to_cpu(ta_hdr->ta_xgmi_size_bytes);
> -	adev->psp.ta_xgmi_start_addr = (uint8_t *)ta_hdr +
> -		le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
> +	if (err) {
> +		release_firmware(adev->psp.ta_fw);
> +		adev->psp.ta_fw = NULL;
> +		dev_info(adev->dev,
> +			 "psp v11.0: Failed to load firmware \"%s\"\n", fw_name);
> +	} else {
> +		err = amdgpu_ucode_validate(adev->psp.ta_fw);
> +		if (err)
> +			goto out2;
> +
> +		ta_hdr = (const struct ta_firmware_header_v1_0 *)adev->psp.ta_fw->data;
> +		adev->psp.ta_xgmi_ucode_version = le32_to_cpu(ta_hdr->ta_xgmi_ucode_version);
> +		adev->psp.ta_xgmi_ucode_size = le32_to_cpu(ta_hdr->ta_xgmi_size_bytes);
> +		adev->psp.ta_xgmi_start_addr = (uint8_t *)ta_hdr +
> +			le32_to_cpu(ta_hdr->header.ucode_array_offset_bytes);
> +	}
>   
>   	return 0;
>   
> --
> 2.20.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux