All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@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, lijo.lazar@amd.com, Hawking.Zhang@amd.com,
	Jun.Ma2@amd.com, xiaogang.chen@amd.com, Kent.Russell@amd.com,
	shuox.liu@linux.alibaba.com, amd-gfx@lists.freedesktop.org
Subject: Re: [RFC PATCH 09/13] drm/amdgpu: make IP block state machine works in stack like way
Date: Wed, 8 Jan 2025 11:04:09 -0600	[thread overview]
Message-ID: <c82d1b49-2ff7-4727-b378-e854b49ba139@amd.com> (raw)
In-Reply-To: <d8d9a5e10dc0cfb8a9d625eccae714a1634d28e5.1736344725.git.gerry@linux.alibaba.com>

On 1/8/2025 08:00, Jiang Liu wrote:
> There are some mismatch 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

s/flas/flag/

> 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
> hw_fini:	hw = false
> sw_fini:	sw = false
> late_fini:	valid = false

Would you mind also putting this into kerneldoc?  I think it would be 
really helpful for others to be able to follow in the future why there 
are so many variables and what they all mean.

> 
> 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 0e69c7c7fe1f..36a33a391411 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -3332,6 +3332,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);
> @@ -3407,15 +3409,14 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
>   				  adev->ip_blocks[i].version->funcs->name, r);
>   		}
>   		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-08 17:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-08 13:59 Jiang Liu
2025-01-08 13:59 ` [RFC PATCH 01/13] amdgpu: wrong array index to get ip block for PSP Jiang Liu
2025-01-08 15:02   ` Alex Deucher
2025-01-08 13:59 ` [RFC PATCH 02/13] drm/admgpu: add helper functions to track status for ras manager Jiang Liu
2025-01-08 13:59 ` [RFC PATCH 03/13] drm/amdgpu: add a flag to track ras debugfs creation status Jiang Liu
2025-01-08 17:19   ` Mario Limonciello
2025-01-10  3:19     ` Gerry Liu
2025-01-10 16:58       ` Mario Limonciello
2025-01-10 17:16         ` Alex Deucher
2025-01-08 13:59 ` [RFC PATCH 04/13] drm/amdgpu: free all resources on error recovery path of amdgpu_ras_init() Jiang Liu
2025-01-08 13:59 ` [RFC PATCH 05/13] drm/amdgpu: introduce a flag to track refcount held for features Jiang Liu
2025-01-08 13:59 ` [RFC PATCH 06/13] drm/amdgpu: enhance amdgpu_ras_block_late_fini() Jiang Liu
2025-01-08 13:59 ` [RFC PATCH 07/13] drm/amdgpu: enhance amdgpu_ras_pre_fini() to better support SR Jiang Liu
2025-01-08 14:00 ` [RFC PATCH 08/13] drm/admgpu: rename amdgpu_ras_pre_fini() to amdgpu_ras_early_fini() Jiang Liu
2025-01-08 14:00 ` [RFC PATCH 09/13] drm/amdgpu: make IP block state machine works in stack like way Jiang Liu
2025-01-08 17:04   ` Mario Limonciello [this message]
2025-01-08 14:00 ` [RFC PATCH 10/13] drm/admgpu: make device state machine work " Jiang Liu
2025-01-08 17:13   ` Mario Limonciello
2025-01-08 14:00 ` [RFC PATCH 11/13] drm/amdgpu/sdma: improve the way to manage irq reference count Jiang Liu
2025-01-08 14:00 ` [RFC PATCH 12/13] drm/amdgpu/nbio: " Jiang Liu
2025-01-08 14:00 ` [RFC PATCH 13/13] drm/amdgpu/asic: make ip block operations symmetric by .early_fini() Jiang Liu
2025-01-08 14:10 ` Christian König
2025-01-08 16:33 ` Re: Mario Limonciello
2025-01-09  5:34   ` Re: Gerry Liu
2025-01-09 17:10     ` Re: Mario Limonciello
2025-01-13  1:19       ` Re: Gerry Liu
2025-01-13 21:59         ` Re: Mario Limonciello

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=c82d1b49-2ff7-4727-b378-e854b49ba139@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Jun.Ma2@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=lijo.lazar@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 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.