AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Sunil Khatri <sunil.khatri@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Leo Liu <leo.liu@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 02/12] drm/amdgpu: add helper function amdgpu_ip_block_suspend
Date: Fri, 18 Oct 2024 13:10:46 +0200	[thread overview]
Message-ID: <dce6f4ec-80f1-43cd-a45f-2a1655e56200@amd.com> (raw)
In-Reply-To: <20241017162531.1551442-3-sunil.khatri@amd.com>

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

Am 17.10.24 um 18:25 schrieb Sunil Khatri:
> Use the helper function amdgpu_ip_block_suspend where
> same checks and calls are repeated.

I strongly suggest to squash this patch and the next one together.

>
> Signed-off-by: Sunil Khatri<sunil.khatri@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 +
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 17 +++++++++++++++++
>   2 files changed, 18 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 48c9b9b06905..df57efa019ba 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -364,6 +364,7 @@ int amdgpu_device_ip_wait_for_idle(struct amdgpu_device *adev,
>   				   enum amd_ip_block_type block_type);
>   bool amdgpu_device_ip_is_valid(struct amdgpu_device *adev,
>   			      enum amd_ip_block_type block_type);
> +int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
>   
>   #define AMDGPU_MAX_IP_NUM 16
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index b7277bef7463..f69aba68e7b1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -272,6 +272,23 @@ void amdgpu_reg_state_sysfs_fini(struct amdgpu_device *adev)
>   	sysfs_remove_bin_file(&adev->dev->kobj, &bin_attr_reg_state);
>   }
>   
> +int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block)
> +{
> +	int r;
> +
> +	if (ip_block->version->funcs->suspend) {
> +		r = ip_block->version->funcs->suspend(ip_block);
> +		if (r) {
> +			dev_err(ip_block->adev->dev,
> +				"suspend of IP block <%s> failed %d\n",
> +				ip_block->version->funcs->name, r);
> +			return r;
> +		}
> +	}

Please add "ip_blocks->status.hw = false;" and remove that from the 
callers as well. Apart from that looks good to me, Christian.
> +
> +	return 0;
> +}
> +
>   /**
>    * DOC: board_info
>    *

[-- Attachment #2: Type: text/html, Size: 2694 bytes --]

  reply	other threads:[~2024-10-18 11:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 16:25 [PATCH v5 00/12] validate/clean the functions of ip funcs Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 01/12] drm/amdgpu: validate hw_fini before function call Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 02/12] drm/amdgpu: add helper function amdgpu_ip_block_suspend Sunil Khatri
2024-10-18 11:10   ` Christian König [this message]
2024-10-18 11:46     ` Khatri, Sunil
2024-10-17 16:25 ` [PATCH v5 03/12] drm/amdgpu: validate suspend before function call Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 04/12] drm/amdgpu: add helper function amdgpu_ip_block_resume Sunil Khatri
2024-10-18 11:12   ` Christian König
2024-10-17 16:25 ` [PATCH v5 05/12] drm/amdgpu: validate resume before function call Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 06/12] drm/amdgpu: validate wait_for_idle " Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 07/12] drm/amdgpu: clean the dummy resume functions Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 08/12] drm/amdgpu: clean the dummy suspend functions Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 09/12] drm/amdgpu: clean the dummy wait_for_idle functions Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 10/12] drm/amdgpu: clean the dummy soft_reset functions Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 11/12] drm/amdgpu: Clean the functions pointer set as NULL Sunil Khatri
2024-10-17 16:25 ` [PATCH v5 12/12] drm/amdgpu: clean unused functions of uvd/vcn/vce Sunil Khatri
2024-10-18 11:15 ` [PATCH v5 00/12] validate/clean the functions of ip funcs Christian König

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=dce6f4ec-80f1-43cd-a45f-2a1655e56200@amd.com \
    --to=christian.koenig@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=leo.liu@amd.com \
    --cc=sunil.khatri@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox