AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Jiang Liu <gerry@linux.alibaba.com>,
	alexander.deucher@amd.com, christian.koenig@amd.com,
	Xinhui.Pan@amd.com, airlied@gmail.com, simona@ffwll.ch,
	sunil.khatri@amd.com, Hawking.Zhang@amd.com,
	mario.limonciello@amd.com, xiaogang.chen@amd.com,
	Kent.Russell@amd.com, shuox.liu@linux.alibaba.com,
	amd-gfx@lists.freedesktop.org
Subject: Re: [RFC v2 08/15] drm/amdgpu: make IP block state machine works in stack like way
Date: Fri, 17 Jan 2025 14:15:36 +0530	[thread overview]
Message-ID: <7c890f79-64e9-47e1-a18e-0a3e156b497d@amd.com> (raw)
In-Reply-To: <4f627f06fab99e7534f590dfa16f1db13b16f7ea.1736732062.git.gerry@linux.alibaba.com>



On 1/13/2025 7:12 AM, Jiang Liu wrote:
> There are some mismatches between IP block state machine and its
> associated status flags, especially about the meaning of
> `status.late_initialized`. So let's make the state machine and
> associated status flas work in stack-like way as below:
> Callback	Status
> early_init:	valid = true
> sw_init: 	sw = true
> hw_init:	hw = true
> late_init:	late_initialized = true
> early_fini:	late_initialized = false

Changing the state like this is confusing. The intention of late_fini is
to reverse the steps in late_init. It's straight forward read like if
the ip is not late_initialized, no need to late_fini. This is making
that complicated.

Thanks,
Lijo

> hw_fini:	hw = false
> sw_fini:	sw = false
> late_fini:	valid = false
> 
> Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 6cbd19ad0fa5..6b503fb7e366 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3376,6 +3376,8 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)
>  			DRM_DEBUG("early_fini of IP block <%s> failed %d\n",
>  				  adev->ip_blocks[i].version->funcs->name, r);
>  		}
> +
> +		adev->ip_blocks[i].status.late_initialized = false;
>  	}
>  
>  	amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
> @@ -3445,15 +3447,14 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
>  			}
>  		}
>  		adev->ip_blocks[i].status.sw = false;
> -		adev->ip_blocks[i].status.valid = false;
>  	}
>  
>  	for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
> -		if (!adev->ip_blocks[i].status.late_initialized)
> +		if (!adev->ip_blocks[i].status.valid)
>  			continue;
>  		if (adev->ip_blocks[i].version->funcs->late_fini)
>  			adev->ip_blocks[i].version->funcs->late_fini(&adev->ip_blocks[i]);
> -		adev->ip_blocks[i].status.late_initialized = false;
> +		adev->ip_blocks[i].status.valid = false;
>  	}
>  
>  	amdgpu_ras_fini(adev);


  reply	other threads:[~2025-01-17  8:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  1:42 [RFC v2 00/15] Enhance device state machine to better support suspend/resume Jiang Liu
2025-01-13  1:42 ` [RFC v2 01/15] drm/amdgpu: add helper functions to track status for ras manager Jiang Liu
2025-01-17  1:13   ` Wang, Yang(Kevin)
2025-01-17  5:03   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 02/15] drm/amdgpu: add a flag to track ras debugfs creation status Jiang Liu
2025-01-17  5:24   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 03/15] drm/amdgpu: free all resources on error recovery path of amdgpu_ras_init() Jiang Liu
2025-01-16 21:02   ` Mario Limonciello
2025-01-17  5:39   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 04/15] drm/amdgpu: introduce a flag to track refcount held for features Jiang Liu
2025-01-17  5:46   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 05/15] drm/amdgpu: enhance amdgpu_ras_block_late_fini() Jiang Liu
2025-01-16 21:10   ` Mario Limonciello
2025-01-17  5:54   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 06/15] drm/amdgpu: enhance amdgpu_ras_pre_fini() to better support SR Jiang Liu
2025-01-16 21:19   ` Mario Limonciello
2025-01-17  6:09   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 07/15] drm/admgpu: rename amdgpu_ras_pre_fini() to amdgpu_ras_early_fini() Jiang Liu
2025-01-16 21:25   ` Mario Limonciello
2025-01-17  1:19   ` Wang, Yang(Kevin)
2025-01-17  8:37   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 08/15] drm/amdgpu: make IP block state machine works in stack like way Jiang Liu
2025-01-17  8:45   ` Lazar, Lijo [this message]
2025-01-13  1:42 ` [RFC v2 09/15] drm/amdgpu_dm: enhance amdgpu_dm_early_fini() for PM ops Jiang Liu
2025-01-16 21:30   ` Mario Limonciello
2025-01-13  1:42 ` [RFC v2 10/15] drm/admgpu: make device state machine work in stack like way Jiang Liu
2025-01-13 22:27   ` Mario Limonciello
2025-01-14  1:58     ` Gerry Liu
2025-01-15 19:36       ` Mario Limonciello
2025-01-17  8:54   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 11/15] drm/amdgpu: convert ip block bool flags into an enum Jiang Liu
2025-01-17  8:57   ` Lazar, Lijo
2025-01-13  1:42 ` [RFC v2 12/15] drm/amdgpu: introduce IP block iterators to reduce duplicated code Jiang Liu
2025-01-13  1:42 ` [RFC v2 13/15] drm/amdgpu: walk IP blocks in reverse order when shutdown Jiang Liu
2025-01-13 22:28   ` Mario Limonciello
2025-01-13  1:42 ` [RFC v2 14/15] drm/amdgpu/nbio: improve the way to manage irq reference count Jiang Liu
2025-01-13  1:42 ` [RFC v2 15/15] drm/amdgpu/asic: make ip block operations symmetric by .early_fini() Jiang Liu
2025-01-20  6:27 ` [RFC v2 00/15] Enhance device state machine to better support suspend/resume Zhang, Hawking
2025-01-23  0:02   ` Mika Laitio

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=7c890f79-64e9-47e1-a18e-0a3e156b497d@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Kent.Russell@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=gerry@linux.alibaba.com \
    --cc=mario.limonciello@amd.com \
    --cc=shuox.liu@linux.alibaba.com \
    --cc=simona@ffwll.ch \
    --cc=sunil.khatri@amd.com \
    --cc=xiaogang.chen@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