Commit b4df2823 authored by shaoyunl's avatar shaoyunl Committed by Alex Deucher

drm/amdgpu: check rlc_g firmware pointer is valid before using it

In SRIOV, rlc_g firmware is loaded by host, guest driver won't load it which will
cause the rlc_fw pointer is null
Signed-off-by: default avatarshaoyunl <shaoyun.liu@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 971fe555
...@@ -822,10 +822,11 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) ...@@ -822,10 +822,11 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G]; info = &adev->firmware.ucode[AMDGPU_UCODE_ID_RLC_G];
info->ucode_id = AMDGPU_UCODE_ID_RLC_G; info->ucode_id = AMDGPU_UCODE_ID_RLC_G;
info->fw = adev->gfx.rlc_fw; info->fw = adev->gfx.rlc_fw;
header = (const struct common_firmware_header *)info->fw->data; if (info->fw) {
adev->firmware.fw_size += header = (const struct common_firmware_header *)info->fw->data;
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE); adev->firmware.fw_size +=
ALIGN(le32_to_cpu(header->ucode_size_bytes), PAGE_SIZE);
}
if (adev->gfx.rlc.is_rlc_v2_1 && if (adev->gfx.rlc.is_rlc_v2_1 &&
adev->gfx.rlc.save_restore_list_cntl_size_bytes && adev->gfx.rlc.save_restore_list_cntl_size_bytes &&
adev->gfx.rlc.save_restore_list_gpm_size_bytes && adev->gfx.rlc.save_restore_list_gpm_size_bytes &&
......
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