[PATCH 03/12] drm/amdgpu: centrally calls the .ras_fini function of all ras blocks
Zhou1, Tao
Tao.Zhou1 at amd.com
Fri Feb 25 06:37:58 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 03/12] drm/amdgpu: centrally calls the .ras_fini function of all
> ras blocks
>
> centrally calls the .ras_fini function of all ras blocks.
>
> Signed-off-by: yipechai <YiPeng.Chai at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 10 ----------
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 22 ++++++++++++++++------
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ---
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 4 ----
> drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ---
> 5 files changed, 16 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 4823c42e0e02..ab75e189bc0b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -454,17 +454,7 @@ 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_if);
>
> - if (adev->mmhub.ras && adev->mmhub.ras->ras_block.ras_fini)
> - 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, adev-
> >gmc.xgmi.ras_if);
> -
> - if (adev->hdp.ras && adev->hdp.ras->ras_block.ras_fini)
> - adev->hdp.ras->ras_block.ras_fini(adev, adev->hdp.ras_if);
> }
>
> /*
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index e5874df3c9ca..846f51b0c013 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -2572,11 +2572,27 @@ int amdgpu_ras_pre_fini(struct amdgpu_device
> *adev) int amdgpu_ras_fini(struct amdgpu_device *adev) {
> struct amdgpu_ras_block_list *ras_node, *tmp;
> + struct amdgpu_ras_block_object *obj;
> struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
>
> if (!adev->ras_enabled || !con)
> return 0;
>
> +
[Tao] the empty line can be deleted.
> + list_for_each_entry_safe(ras_node, tmp, &adev->ras_list, node) {
> +
[Tao] the empty line is unnecessary.
> + if (ras_node->ras_obj) {
> + obj = ras_node->ras_obj;
> + if (amdgpu_ras_is_supported(adev, obj-
> >ras_comm.block) &&
> + obj->ras_fini)
[Tao] the Tab can be replaced with 4 spaces. Same suggestion to other similar codes.
> + obj->ras_fini(adev, &obj->ras_comm);
> + }
> +
> + /* Clear ras blocks from ras_list and free ras block list node */
> + list_del(&ras_node->node);
> + kfree(ras_node);
> + }
> +
> amdgpu_ras_fs_fini(adev);
> amdgpu_ras_interrupt_remove_all(adev);
>
> @@ -2590,12 +2606,6 @@ int amdgpu_ras_fini(struct amdgpu_device *adev)
> amdgpu_ras_set_context(adev, NULL);
> kfree(con);
>
> - /* Clear ras blocks from ras_list and free ras block list node */
> - list_for_each_entry_safe(ras_node, tmp, &adev->ras_list, node) {
> - list_del(&ras_node->node);
> - kfree(ras_node);
> - }
> -
> return 0;
> }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index e8446967a4d4..dc6e6fe6c978 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -2432,9 +2432,6 @@ static int gfx_v9_0_sw_fini(void *handle)
> int i;
> 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_if);
> -
> for (i = 0; i < adev->gfx.num_gfx_rings; i++)
> amdgpu_ring_fini(&adev->gfx.gfx_ring[i]);
> for (i = 0; i < adev->gfx.num_compute_rings; i++) diff --git
> a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> index 222d25a0413a..d1d40bbb2892 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
> @@ -1995,10 +1995,6 @@ static int sdma_v4_0_sw_fini(void *handle)
> struct amdgpu_device *adev = (struct amdgpu_device *)handle;
> int i;
>
> - 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_if);
> -
> for (i = 0; i < adev->sdma.num_instances; i++) {
> amdgpu_ring_fini(&adev->sdma.instance[i].ring);
> if (adev->sdma.has_page_queue)
> diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c
> b/drivers/gpu/drm/amd/amdgpu/soc15.c
> index 0631ebd39db1..496c4a6e23ac 100644
> --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
> +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
> @@ -1214,9 +1214,6 @@ 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_if);
> -
> if (adev->df.funcs &&
> adev->df.funcs->sw_fini)
> adev->df.funcs->sw_fini(adev);
> --
> 2.25.1
More information about the amd-gfx
mailing list