All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: check rlc_g firmware pointer is valid before using it
@ 2020-01-10 18:33 shaoyunl
  2020-01-13 16:20 ` shaoyunl
  0 siblings, 1 reply; 3+ messages in thread
From: shaoyunl @ 2020-01-10 18:33 UTC (permalink / raw)
  To: amd-gfx; +Cc: shaoyunl

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@amd.com>
---
 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 &&
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: check rlc_g firmware pointer is valid before using it
  2020-01-10 18:33 [PATCH] drm/amdgpu: check rlc_g firmware pointer is valid before using it shaoyunl
@ 2020-01-13 16:20 ` shaoyunl
  2020-01-14  3:08   ` Zhang, Hawking
  0 siblings, 1 reply; 3+ messages in thread
From: shaoyunl @ 2020-01-13 16:20 UTC (permalink / raw)
  To: amd-gfx

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@amd.com>
> ---
>   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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: check rlc_g firmware pointer is valid before using it
  2020-01-13 16:20 ` shaoyunl
@ 2020-01-14  3:08   ` Zhang, Hawking
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Hawking @ 2020-01-14  3:08 UTC (permalink / raw)
  To: Liu, Shaoyun, amd-gfx

[AMD Official Use Only - Internal Distribution Only]

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>

Regards,
Hawking
-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of shaoyunl
Sent: Tuesday, January 14, 2020 00:20
To: amd-gfx@lists.freedesktop.org
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@amd.com>
> ---
>   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@lists.freedesktop.org
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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-14  3:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 18:33 [PATCH] drm/amdgpu: check rlc_g firmware pointer is valid before using it shaoyunl
2020-01-13 16:20 ` shaoyunl
2020-01-14  3:08   ` Zhang, Hawking

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.