RE: [PATCH] drm/amdgpu: check rlc_g firmware pointer is valid before using it

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

 



[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>

Regards,
Hawking
-----Original Message-----
From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of shaoyunl
Sent: Tuesday, January 14, 2020 00:20
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: [PATCH] drm/amdgpu: check rlc_g firmware pointer is valid before using it

ping.


On 2020-01-10 1:33 p.m., shaoyunl wrote:
> In SRIOV, rlc_g firmware is loaded by host, guest driver won't load it 
> which will cause the rlc_fw pointer is null
>
> Change-Id: Id16f65171dd427d623af4c5bc75f674019e63dec
> Signed-off-by: shaoyunl <shaoyun.liu@xxxxxxx>
> ---
>   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> index 379e46c..07e22f2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
> @@ -808,10 +808,11 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
>   		info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
>   		info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
>   		info->fw = adev->gfx.rlc_fw;
> -		header = (const struct common_firmware_header *)info->fw->data;
> -		adev->firmware.fw_size +=
> -			ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
> -
> +		if (info->fw) {
> +			header = (const struct common_firmware_header *)info->fw->data;
> +			adev->firmware.fw_size +=
> +				ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
> +		}
>   		if (adev->gfx.rlc.is_rlc_v2_1 &&
>   		    adev->gfx.rlc.save_restore_list_cntl_size_bytes &&
>   		    adev->gfx.rlc.save_restore_list_gpm_size_bytes &&
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Chawking.zhang%40amd.com%7C07f331f5dcd34309309608d798447956%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637145292188230052&amp;sdata=CgDYPwyn688ERtFq3ldST2nMMejq1a1RxdDRAjKK9jc%3D&amp;reserved=0
_______________________________________________
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