All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhou1, Tao" <Tao.Zhou1@amd.com>
To: "Chai, Thomas" <YiPeng.Chai@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Clements, John" <John.Clements@amd.com>,
	"Zhang, Hawking" <Hawking.Zhang@amd.com>
Subject: RE: [PATCH 03/11] drm/amdgpu: Optimize amdgpu_hdp_ras_late_init/amdgpu_hdp_ras_fini function code
Date: Wed, 9 Feb 2022 08:54:20 +0000	[thread overview]
Message-ID: <DM5PR12MB177097DBFDF292BAA390B8C3B02E9@DM5PR12MB1770.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220209055644.1873011-3-YiPeng.Chai@amd.com>

[AMD Official Use Only]



> -----Original Message-----
> From: Chai, Thomas <YiPeng.Chai@amd.com>
> Sent: Wednesday, February 9, 2022 1:57 PM
> To: amd-gfx@lists.freedesktop.org
> Cc: Chai, Thomas <YiPeng.Chai@amd.com>; Zhang, Hawking
> <Hawking.Zhang@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Clements,
> John <John.Clements@amd.com>; Chai, Thomas <YiPeng.Chai@amd.com>
> Subject: [PATCH 03/11] drm/amdgpu: Optimize
> amdgpu_hdp_ras_late_init/amdgpu_hdp_ras_fini function code
> 
> Optimize amdgpu_hdp_ras_late_init/amdgpu_hdp_ras_fini function code.
> 
> Signed-off-by: yipechai <YiPeng.Chai@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c | 37 ++-----------------------
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   |  1 +
>  drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c   |  1 +
>  3 files changed, 5 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> index 518966a26130..21a5f884dd2a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_hdp.c
> @@ -26,43 +26,12 @@
> 
>  int amdgpu_hdp_ras_late_init(struct amdgpu_device *adev, void *ras_info)  {
> -	int r;
> -	struct ras_ih_if ih_info = {
> -		.cb = NULL,
> -	};
> -	struct ras_fs_if fs_info = {
> -		.sysfs_name = "hdp_err_count",
> -	};
> -
> -	if (!adev->hdp.ras_if) {
> -		adev->hdp.ras_if = kmalloc(sizeof(struct ras_common_if),
> GFP_KERNEL);
> -		if (!adev->hdp.ras_if)
> -			return -ENOMEM;
> -		adev->hdp.ras_if->block = AMDGPU_RAS_BLOCK__HDP;
> -		adev->hdp.ras_if->type =
> AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE;
> -		adev->hdp.ras_if->sub_block_index = 0;
> -	}
> -	ih_info.head = fs_info.head = *adev->hdp.ras_if;
> -	r = amdgpu_ras_late_init(adev, adev->hdp.ras_if,
> -				 &fs_info, &ih_info);
> -	if (r || !amdgpu_ras_is_supported(adev, adev->hdp.ras_if->block)) {
> -		kfree(adev->hdp.ras_if);
> -		adev->hdp.ras_if = NULL;
> -	}
> -
> -	return r;
> +	return amdgpu_ras_block_late_init(adev, adev->hdp.ras_if);
>  }
> 
>  void amdgpu_hdp_ras_fini(struct amdgpu_device *adev)  {
>  	if (amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__HDP) &&
> -	    adev->hdp.ras_if) {
> -		struct ras_common_if *ras_if = adev->hdp.ras_if;
> -		struct ras_ih_if ih_info = {
> -			.cb = NULL,
> -		};
> -
> -		amdgpu_ras_late_fini(adev, ras_if, &ih_info);
> -		kfree(ras_if);
> -	}
> +	    adev->hdp.ras_if)
> +		amdgpu_ras_block_late_fini(adev, adev->hdp.ras_if);
>  }
[Tao]: Since hdp_ras_late_init/fini are simple wrapper, can we remove them and call amdgpu_ras_block_late_init/fini directly?
The same comment to other blocks.

> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index af873c99d5e4..b12fe6703f02 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -1302,6 +1302,7 @@ static void gmc_v9_0_set_hdp_ras_funcs(struct
> amdgpu_device *adev)  {
>  	adev->hdp.ras = &hdp_v4_0_ras;
>  	amdgpu_ras_register_ras_block(adev, &adev->hdp.ras->ras_block);
> +	adev->hdp.ras_if = &adev->hdp.ras->ras_block.ras_comm;
>  }
> 
>  static void gmc_v9_0_set_mca_funcs(struct amdgpu_device *adev) diff --git
> a/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c
> b/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c
> index 503c292b321e..a9ed4232cdeb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c
> @@ -160,6 +160,7 @@ struct amdgpu_hdp_ras hdp_v4_0_ras = {
>  		.ras_comm = {
>  			.name = "hdp",
>  			.block = AMDGPU_RAS_BLOCK__HDP,
> +			.type =
> AMDGPU_RAS_ERROR__MULTI_UNCORRECTABLE,
>  		},
>  		.hw_ops = &hdp_v4_0_ras_hw_ops,
>  		.ras_late_init = amdgpu_hdp_ras_late_init,
> --
> 2.25.1

  reply	other threads:[~2022-02-09  8:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  5:56 [PATCH 01/11] drm/amdgpu: Optimize xxx_ras_late_init/xxx_ras_late_fini for each ras block yipechai
2022-02-09  5:56 ` [PATCH 02/11] drm/amdgpu: Optimize amdgpu_gfx_ras_late_init/amdgpu_gfx_ras_fini function code yipechai
2022-02-09  5:56 ` [PATCH 03/11] drm/amdgpu: Optimize amdgpu_hdp_ras_late_init/amdgpu_hdp_ras_fini " yipechai
2022-02-09  8:54   ` Zhou1, Tao [this message]
2022-02-10  2:58     ` Chai, Thomas
2022-02-10  6:27       ` Zhou1, Tao
2022-02-09  5:56 ` [PATCH 04/11] drm/amdgpu: Optimize amdgpu_mca_ras_late_init/amdgpu_mca_ras_fini " yipechai
2022-02-09  5:56 ` [PATCH 05/11] drm/amdgpu: Optimize amdgpu_mmhub_ras_late_init/amdgpu_mmhub_ras_fini " yipechai
2022-02-09  5:56 ` [PATCH 06/11] drm/amdgpu: Optimize amdgpu_nbio_ras_late_init/amdgpu_nbio_ras_fini " yipechai
2022-02-09  5:56 ` [PATCH 07/11] drm/amdgpu: Optimize amdgpu_sdma_ras_late_init/amdgpu_sdma_ras_fini " yipechai
2022-02-09  5:56 ` [PATCH 08/11] drm/amdgpu: Optimize amdgpu_umc_ras_late_init/amdgpu_umc_ras_fini " yipechai
2022-02-09  5:56 ` [PATCH 09/11] drm/amdgpu: Optimize amdgpu_xgmi_ras_late_init/amdgpu_xgmi_ras_fini " yipechai
2022-02-09  5:56 ` [PATCH 10/11] drm/amdgpu: Optimize operating sysfs and interrupt function interface in amdgpu_ras.c yipechai
2022-02-09  5:56 ` [PATCH 11/11] drm/amdgpu: Merge amdgpu_ras_late_init/amdgpu_ras_late_fini to amdgpu_ras_block_late_init/amdgpu_ras_block_late_fini yipechai
2022-02-09  8:54 ` [PATCH 01/11] drm/amdgpu: Optimize xxx_ras_late_init/xxx_ras_late_fini for each ras block Zhou1, Tao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM5PR12MB177097DBFDF292BAA390B8C3B02E9@DM5PR12MB1770.namprd12.prod.outlook.com \
    --to=tao.zhou1@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=John.Clements@amd.com \
    --cc=YiPeng.Chai@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.