RE: [PATCH] drm/amdgpu: Add a check to avoid panic because of unexpected irqs

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

 



Reviewed-by: Evan Quan <evan.quan@xxxxxxx>

> -----Original Message-----
> From: Pan, Xinhui <Xinhui.Pan@xxxxxxx>
> Sent: Tuesday, April 09, 2019 4:59 PM
> To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx>; Quan, Evan
> <Evan.Quan@xxxxxxx>
> Subject: [PATCH] drm/amdgpu: Add a check to avoid panic because of
> unexpected irqs
> 
> IP initialize ras in late_init, because of the BUGs of PSP or any other
> components, driver receives unexpected irqs. It is ok to add such check
> anyway.
> 
> Signed-off-by: xinhui pan <xinhui.pan@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 8 +++++++-
> drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 +++++++-
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 +++++++-
>  3 files changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 7e749ba6fb4a..54432fa8d420 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -4844,10 +4844,16 @@ static int gfx_v9_0_cp_ecc_error_irq(struct
> amdgpu_device *adev,
>  				  struct amdgpu_irq_src *source,
>  				  struct amdgpu_iv_entry *entry)
>  {
> +	struct ras_common_if *ras_if = adev->gfx.ras_if;
>  	struct ras_dispatch_if ih_data = {
> -		.head = *adev->gfx.ras_if,
>  		.entry = entry,
>  	};
> +
> +	if (!ras_if)
> +		return 0;
> +
> +	ih_data.head = *ras_if;
> +
>  	DRM_ERROR("CP ECC ERROR IRQ\n");
>  	amdgpu_ras_interrupt_dispatch(adev, &ih_data);
>  	return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index dafe91770863..b9c009236a33 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -297,10 +297,16 @@ static int gmc_v9_0_process_ecc_irq(struct
> amdgpu_device *adev,
>  		struct amdgpu_irq_src *source,
>  		struct amdgpu_iv_entry *entry)
>  {
> +	struct ras_common_if *ras_if = adev->gmc.ras_if;
>  	struct ras_dispatch_if ih_data = {
> -		.head = *adev->gmc.ras_if,
>  		.entry = entry,
>  	};
> +
> +	if (!ras_if)
> +		return 0;
> +
> +	ih_data.head = *ras_if;
> +
>  	amdgpu_ras_interrupt_dispatch(adev, &ih_data);
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index 2a2025f548a1..304d7ba0772c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -1865,10 +1865,16 @@ static int sdma_v4_0_process_ecc_irq(struct
> amdgpu_device *adev,
>  				      struct amdgpu_irq_src *source,
>  				      struct amdgpu_iv_entry *entry)  {
> +	struct ras_common_if *ras_if = adev->sdma.ras_if;
>  	struct ras_dispatch_if ih_data = {
> -		.head = *adev->sdma.ras_if,
>  		.entry = entry,
>  	};
> +
> +	if (!ras_if)
> +		return 0;
> +
> +	ih_data.head = *ras_if;
> +
>  	amdgpu_ras_interrupt_dispatch(adev, &ih_data);
>  	return 0;
>  }
> --
> 2.17.1

_______________________________________________
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