[PATCH 01/12] drm/amdgpu: Modify .ras_fini function pointer parameter

Zhou1, Tao Tao.Zhou1 at amd.com
Fri Feb 25 06:32:37 UTC 2022


[AMD Official Use Only]



> -----Original Message-----
> From: Chai, Thomas <YiPeng.Chai at amd.com>
> Sent: Monday, February 21, 2022 6:16 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Chai, Thomas <YiPeng.Chai at amd.com>; Zhang, Hawking
> <Hawking.Zhang at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>; Clements,
> John <John.Clements at amd.com>; Chai, Thomas <YiPeng.Chai at amd.com>
> Subject: [PATCH 01/12] drm/amdgpu: Modify .ras_fini function pointer
> parameter
> 
> Modify .ras_fini function pointer parameter so that it can remove redundant
[Tao] it can remove -> we can remove

> intermediate calls in some ras blocks.
> 
> Signed-off-by: yipechai <YiPeng.Chai at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c   | 8 ++++----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c  | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h  | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c  | 2 +-
> drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h  | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h   | 2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c  | 2 +-
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c     | 2 +-
>  drivers/gpu/drm/amd/amdgpu/mca_v3_0.c     | 6 +++---
>  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c    | 2 +-
>  drivers/gpu/drm/amd/amdgpu/soc15.c        | 2 +-
>  19 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 52912b6bcb20..d020c4599433 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -644,7 +644,7 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device
> *adev, struct ras_common_if *r
>  	return r;
>  }
> 
> -void amdgpu_gfx_ras_fini(struct amdgpu_device *adev)
> +void amdgpu_gfx_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__GFX) &&
>  			adev->gfx.ras_if)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> index ccca0a85b982..f7c50ab4589c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> @@ -387,7 +387,7 @@ bool amdgpu_gfx_is_me_queue_enabled(struct
> amdgpu_device *adev, int me,  void amdgpu_gfx_off_ctrl(struct amdgpu_device
> *adev, bool enable);  int amdgpu_get_gfx_off_status(struct amdgpu_device
> *adev, uint32_t *value);  int amdgpu_gfx_ras_late_init(struct amdgpu_device
> *adev, struct ras_common_if *ras_block); -void amdgpu_gfx_ras_fini(struct
> amdgpu_device *adev);
> +void amdgpu_gfx_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block);
>  int amdgpu_gfx_process_ras_data_cb(struct amdgpu_device *adev,
>  		void *err_data,
>  		struct amdgpu_iv_entry *entry);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 26e31c53ed0d..5dcb341cae19 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -455,16 +455,16 @@ int amdgpu_gmc_ras_late_init(struct amdgpu_device
> *adev)  void amdgpu_gmc_ras_fini(struct amdgpu_device *adev)  {
>  	if (adev->umc.ras && adev->umc.ras->ras_block.ras_fini)
> -		adev->umc.ras->ras_block.ras_fini(adev);
> +		adev->umc.ras->ras_block.ras_fini(adev, NULL);
> 
>  	if (adev->mmhub.ras && adev->mmhub.ras->ras_block.ras_fini)
> -		adev->mmhub.ras->ras_block.ras_fini(adev);
> +		adev->mmhub.ras->ras_block.ras_fini(adev, NULL);
> 
>  	if (adev->gmc.xgmi.ras && adev->gmc.xgmi.ras->ras_block.ras_fini)
> -		adev->gmc.xgmi.ras->ras_block.ras_fini(adev);
> +		adev->gmc.xgmi.ras->ras_block.ras_fini(adev, NULL);
> 
>  	if (adev->hdp.ras && adev->hdp.ras->ras_block.ras_fini)
> -		adev->hdp.ras->ras_block.ras_fini(adev);
> +		adev->hdp.ras->ras_block.ras_fini(adev, NULL);
>  }
> 
>  	/*
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> index b7fbc114a175..0f224e21cd55 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> @@ -24,7 +24,7 @@
>  #include "amdgpu.h"
>  #include "amdgpu_ras.h"
> 
> -void amdgpu_hdp_ras_fini(struct amdgpu_device *adev)
> +void amdgpu_hdp_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__HDP) &&
>  	    adev->hdp.ras_if)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h
> index aabd59aa5213..c05cd992ef8a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.h
> @@ -44,5 +44,5 @@ struct amdgpu_hdp {
>  };
> 
>  int amdgpu_hdp_ras_late_init(struct amdgpu_device *adev, struct
> ras_common_if *ras_block); -void amdgpu_hdp_ras_fini(struct amdgpu_device
> *adev);
> +void amdgpu_hdp_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block);
>  #endif /* __AMDGPU_HDP_H__ */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> index 42413813765a..6dfcedcc37fd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> @@ -24,7 +24,7 @@
>  #include "amdgpu.h"
>  #include "amdgpu_ras.h"
> 
> -void amdgpu_mmhub_ras_fini(struct amdgpu_device *adev)
> +void amdgpu_mmhub_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__MMHUB)
> &&
>  			adev->mmhub.ras_if)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> index 240b26d9a388..253f047379cf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h
> @@ -47,6 +47,6 @@ struct amdgpu_mmhub {
>  	struct amdgpu_mmhub_ras  *ras;
>  };
> 
> -void amdgpu_mmhub_ras_fini(struct amdgpu_device *adev);
> +void amdgpu_mmhub_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block);
>  #endif
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> index f09ad80f0772..0de2fdf31eed 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> @@ -44,7 +44,7 @@ int amdgpu_nbio_ras_late_init(struct amdgpu_device
> *adev, struct ras_common_if *
>  	return r;
>  }
> 
> -void amdgpu_nbio_ras_fini(struct amdgpu_device *adev)
> +void amdgpu_nbio_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__PCIE_BIF)
> &&
>  			adev->nbio.ras_if)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> index f9546c7341b8..3222e1cae134 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h
> @@ -105,5 +105,5 @@ struct amdgpu_nbio {  };
> 
>  int amdgpu_nbio_ras_late_init(struct amdgpu_device *adev, struct
> ras_common_if *ras_block); -void amdgpu_nbio_ras_fini(struct amdgpu_device
> *adev);
> +void amdgpu_nbio_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block);
>  #endif
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> index 143a83043d7c..7cddaad90d6d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
> @@ -491,7 +491,7 @@ struct amdgpu_ras_block_object {
>  	int (*ras_block_match)(struct amdgpu_ras_block_object *block_obj,
>  				enum amdgpu_ras_block block, uint32_t
> sub_block_index);
>  	int (*ras_late_init)(struct amdgpu_device *adev, struct ras_common_if
> *ras_block);
> -	void (*ras_fini)(struct amdgpu_device *adev);
> +	void (*ras_fini)(struct amdgpu_device *adev, struct ras_common_if
> +*ras_block);
>  	ras_ih_cb ras_cb;
>  	const struct amdgpu_ras_block_hw_ops *hw_ops;  }; diff --git
> a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> index 3b5c43575aa3..863035a94bd8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> @@ -111,7 +111,7 @@ int amdgpu_sdma_ras_late_init(struct amdgpu_device
> *adev,
>  	return r;
>  }
> 
> -void amdgpu_sdma_ras_fini(struct amdgpu_device *adev)
> +void amdgpu_sdma_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__SDMA) &&
>  			adev->sdma.ras_if)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> index 8b226ffee32c..34ec60dfe5e8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h
> @@ -118,7 +118,7 @@ int amdgpu_sdma_get_index_from_ring(struct
> amdgpu_ring *ring, uint32_t *index);  uint64_t
> amdgpu_sdma_get_csa_mc_addr(struct amdgpu_ring *ring, unsigned vmid);  int
> amdgpu_sdma_ras_late_init(struct amdgpu_device *adev,
>  			      struct ras_common_if *ras_block); -void
> amdgpu_sdma_ras_fini(struct amdgpu_device *adev);
> +void amdgpu_sdma_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block);
>  int amdgpu_sdma_process_ras_data_cb(struct amdgpu_device *adev,
>  		void *err_data,
>  		struct amdgpu_iv_entry *entry);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> index 9400260e3263..41e976733c57 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> @@ -162,7 +162,7 @@ int amdgpu_umc_ras_late_init(struct amdgpu_device
> *adev, struct ras_common_if *r
>  	return r;
>  }
> 
> -void amdgpu_umc_ras_fini(struct amdgpu_device *adev)
> +void amdgpu_umc_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC) &&
>  			adev->umc.ras_if)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
> index e4b3678a6685..c8deba8dacb5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.h
> @@ -73,7 +73,7 @@ struct amdgpu_umc {
>  };
> 
>  int amdgpu_umc_ras_late_init(struct amdgpu_device *adev, struct
> ras_common_if *ras_block); -void amdgpu_umc_ras_fini(struct amdgpu_device
> *adev);
> +void amdgpu_umc_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block);
>  int amdgpu_umc_poison_handler(struct amdgpu_device *adev,
>  		void *ras_error_status,
>  		bool reset);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> index 77b65434ccc2..27421811f2f0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> @@ -743,7 +743,7 @@ static int amdgpu_xgmi_ras_late_init(struct
> amdgpu_device *adev, struct ras_comm
>  	return amdgpu_ras_block_late_init(adev, ras_block);  }
> 
> -static void amdgpu_xgmi_ras_fini(struct amdgpu_device *adev)
> +static void amdgpu_xgmi_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	if (amdgpu_ras_is_supported(adev,
> AMDGPU_RAS_BLOCK__XGMI_WAFL) &&
>  			adev->gmc.xgmi.ras_if)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 1997f129db9c..3ecb238c6483 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -2433,7 +2433,7 @@ static int gfx_v9_0_sw_fini(void *handle)
>  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> 
>  	if (adev->gfx.ras && adev->gfx.ras->ras_block.ras_fini)
> -		adev->gfx.ras->ras_block.ras_fini(adev);
> +		adev->gfx.ras->ras_block.ras_fini(adev, NULL);
> 
>  	for (i = 0; i < adev->gfx.num_gfx_rings; i++)
>  		amdgpu_ring_fini(&adev->gfx.gfx_ring[i]);
> diff --git a/drivers/gpu/drm/amd/amdgpu/mca_v3_0.c
> b/drivers/gpu/drm/amd/amdgpu/mca_v3_0.c
> index b4b36899f5c6..02c50be19d3b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mca_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mca_v3_0.c
> @@ -37,7 +37,7 @@ static void mca_v3_0_mp0_query_ras_error_count(struct
> amdgpu_device *adev,
>  				         ras_error_status);
>  }
> 
> -static void mca_v3_0_mp0_ras_fini(struct amdgpu_device *adev)
> +static void mca_v3_0_mp0_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	amdgpu_mca_ras_fini(adev, &adev->mca.mp0);  } @@ -83,7 +83,7 @@
> static void mca_v3_0_mp1_query_ras_error_count(struct amdgpu_device *adev,
>  				         ras_error_status);
>  }
> 
> -static void mca_v3_0_mp1_ras_fini(struct amdgpu_device *adev)
> +static void mca_v3_0_mp1_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	amdgpu_mca_ras_fini(adev, &adev->mca.mp1);  } @@ -115,7 +115,7
> @@ static void mca_v3_0_mpio_query_ras_error_count(struct amdgpu_device
> *adev,
>  				         ras_error_status);
>  }
> 
> -static void mca_v3_0_mpio_ras_fini(struct amdgpu_device *adev)
> +static void mca_v3_0_mpio_ras_fini(struct amdgpu_device *adev, struct
> +ras_common_if *ras_block)
>  {
>  	amdgpu_mca_ras_fini(adev, &adev->mca.mpio);  } diff --git
> a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index e26c39fcd336..d0a9012e53d7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -1997,7 +1997,7 @@ static int sdma_v4_0_sw_fini(void *handle)
> 
>  	if (adev->sdma.ras && adev->sdma.ras->ras_block.hw_ops &&
>  		adev->sdma.ras->ras_block.ras_fini)
> -		adev->sdma.ras->ras_block.ras_fini(adev);
> +		adev->sdma.ras->ras_block.ras_fini(adev, NULL);
> 
>  	for (i = 0; i < adev->sdma.num_instances; i++) {
>  		amdgpu_ring_fini(&adev->sdma.instance[i].ring);
> diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c
> b/drivers/gpu/drm/amd/amdgpu/soc15.c
> index b7c24149a6bd..34cd5cad7da5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
> +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
> @@ -1215,7 +1215,7 @@ static int soc15_common_sw_fini(void *handle)
>  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> 
>  	if (adev->nbio.ras && adev->nbio.ras->ras_block.ras_fini)
> -		adev->nbio.ras->ras_block.ras_fini(adev);
> +		adev->nbio.ras->ras_block.ras_fini(adev, NULL);
> 
>  	if (adev->df.funcs &&
>  	    adev->df.funcs->sw_fini)
> --
> 2.25.1


More information about the amd-gfx mailing list