[PATCH 02/12] drm/amdgpu: Optimize xxx_ras_fini function of each ras block
Zhou1, Tao
Tao.Zhou1 at amd.com
Fri Feb 25 06:34:38 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 02/12] drm/amdgpu: Optimize xxx_ras_fini function of each ras
> block
>
> 1. Move the variables of ras block instance members to
> the top of the call to xxx_ras_fini.
[Tao] to the top of the call to xxx_ras_fini -> from specific xxx_ras_fini to general ras_fini call.
> 2. Function calls inside the modules only use parameters
> passed from xxx_ras_fini instead of ras block instance
> members.
>
> Signed-off-by: yipechai <YiPeng.Chai at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 8 ++++----
> drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 4 ++--
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/soc15.c | 2 +-
> 11 files changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index d020c4599433..40f7e29aa9ca 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -647,8 +647,8 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device
> *adev, struct ras_common_if *r 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)
> - amdgpu_ras_block_late_fini(adev, adev->gfx.ras_if);
> + ras_block)
> + amdgpu_ras_block_late_fini(adev, ras_block);
> }
>
> int amdgpu_gfx_process_ras_data_cb(struct amdgpu_device *adev, diff --git
> a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 5dcb341cae19..4823c42e0e02 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, NULL);
> + adev->umc.ras->ras_block.ras_fini(adev, adev->umc.ras_if);
>
> if (adev->mmhub.ras && adev->mmhub.ras->ras_block.ras_fini)
> - adev->mmhub.ras->ras_block.ras_fini(adev, NULL);
> + adev->mmhub.ras->ras_block.ras_fini(adev, adev-
> >mmhub.ras_if);
>
> if (adev->gmc.xgmi.ras && adev->gmc.xgmi.ras->ras_block.ras_fini)
> - adev->gmc.xgmi.ras->ras_block.ras_fini(adev, NULL);
> + adev->gmc.xgmi.ras->ras_block.ras_fini(adev, adev-
> >gmc.xgmi.ras_if);
>
> if (adev->hdp.ras && adev->hdp.ras->ras_block.ras_fini)
> - adev->hdp.ras->ras_block.ras_fini(adev, NULL);
> + adev->hdp.ras->ras_block.ras_fini(adev, adev->hdp.ras_if);
> }
>
> /*
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> index 0f224e21cd55..5595f903c17a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> @@ -27,6 +27,6 @@
> 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)
> - amdgpu_ras_block_late_fini(adev, adev->hdp.ras_if);
> + ras_block)
> + amdgpu_ras_block_late_fini(adev, ras_block);
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> index 6dfcedcc37fd..e7c3b8fff868 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> @@ -27,6 +27,6 @@
> 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)
> - amdgpu_ras_block_late_fini(adev, adev->mmhub.ras_if);
> + ras_block)
> + amdgpu_ras_block_late_fini(adev, ras_block);
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> index 0de2fdf31eed..54a5a15272c1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> @@ -47,6 +47,6 @@ int amdgpu_nbio_ras_late_init(struct amdgpu_device
> *adev, struct ras_common_if * 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)
> - amdgpu_ras_block_late_fini(adev, adev->nbio.ras_if);
> + ras_block)
> + amdgpu_ras_block_late_fini(adev, ras_block);
> }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> index 863035a94bd8..1df8de84386d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> @@ -114,8 +114,8 @@ int amdgpu_sdma_ras_late_init(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)
> - amdgpu_ras_block_late_fini(adev, adev->sdma.ras_if);
> + ras_block)
> + amdgpu_ras_block_late_fini(adev, ras_block);
> }
>
> int amdgpu_sdma_process_ras_data_cb(struct amdgpu_device *adev, diff --git
> a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> index 41e976733c57..2623a2d30703 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> @@ -165,8 +165,8 @@ int amdgpu_umc_ras_late_init(struct amdgpu_device
> *adev, struct ras_common_if *r 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)
> - amdgpu_ras_block_late_fini(adev, adev->umc.ras_if);
> + ras_block)
> + amdgpu_ras_block_late_fini(adev, ras_block);
> }
>
> int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev, diff --git
> a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> index 27421811f2f0..7d18c5d22e10 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> @@ -746,8 +746,8 @@ static int amdgpu_xgmi_ras_late_init(struct
> amdgpu_device *adev, struct ras_comm 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)
> - amdgpu_ras_block_late_fini(adev, adev->gmc.xgmi.ras_if);
> + ras_block)
> + amdgpu_ras_block_late_fini(adev, ras_block);
> }
>
> uint64_t amdgpu_xgmi_get_relative_phy_addr(struct amdgpu_device *adev,
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 3ecb238c6483..e8446967a4d4 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, NULL);
> + adev->gfx.ras->ras_block.ras_fini(adev, adev->gfx.ras_if);
>
> 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/sdma_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index d0a9012e53d7..222d25a0413a 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, NULL);
> + adev->sdma.ras->ras_block.ras_fini(adev, adev->sdma.ras_if);
>
> 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 34cd5cad7da5..0631ebd39db1 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, NULL);
> + adev->nbio.ras->ras_block.ras_fini(adev, adev->nbio.ras_if);
>
> if (adev->df.funcs &&
> adev->df.funcs->sw_fini)
> --
> 2.25.1
More information about the amd-gfx
mailing list