All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Timur Kristóf" <timur.kristof@gmail.com>
To: Jesse Zhang <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com,
	Christian Koenig <christian.koenig@amd.com>,
	 Lijo.Lazar@amd.com, Mario.Novales@amd.com, Manu.Rastogi@amd.com,
	 Jiongyu.Zhu@amd.com
Subject: Re: [PATCH v4 04/13] drm/amdgpu/gfx: add callbacks to save and restore a gfx HQD
Date: Thu, 19 Nov 2026 12:35:12 +0100	[thread overview]
Message-ID: <d1e6815abbda0bc380daddffa7bf1846b0a44b1f.camel@gmail.com> (raw)
In-Reply-To: <20261105030612.726542-4-Jesse.Zhang@amd.com>

On Thu, 2026-11-05 at 11:05 +0800, Jesse Zhang wrote:
> A gfx engine reset clears the HQD registers of the gfx queues,
> including
> the only copy of the ring position of the queues MES didn't preempt.
> MES doesn't save them in the MQD either when the engine hangs.
> 
> Add struct amdgpu_gfx_saved_hqd for that state, and gfx callbacks for
> the gfx IP, which knows its registers and the layout of its MQD:
> - save_hqd() saves the state of the gfx HQD of a doorbell;
> - restore_hqd() writes it into the MQD after the reset, for MES to
> load
>   it into the HQD when it maps the queue again.
> 
> v4: Rename to save_hqd()/restore_hqd() and struct
> amdgpu_gfx_saved_hqd
>     (Timur).
> 
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> index 5939e1fb3b24..1c23e97fd04d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
> @@ -345,6 +345,17 @@ struct amdgpu_gfx_shadow_info {
>  	u32 eop_alignment;
>  };
>  
> +/* State of a gfx HQD that a gfx engine reset clears. */
> +struct amdgpu_gfx_saved_hqd {
> +	u32	doorbell_index;
> +	u64	mqd_addr;	/* the MQD loaded in the HQD */
> +	bool	on_hqd;
> +	u64	wptr;
> +	u32	offset;
> +	u32	csmd_rptr;
> +	bool	connected;	/* the queue the pipe executes */
> +};
> +
>  struct amdgpu_gfx_funcs {
>  	/* get the gpu clock counter */
>  	uint64_t (*get_gpu_clock_counter)(struct amdgpu_device
> *adev);
> @@ -376,6 +387,17 @@ struct amdgpu_gfx_funcs {
>  	/* find the gfx HQD slot (me/pipe/queue) for a doorbell */
>  	bool (*detect_hung_queue)(struct amdgpu_device *adev, u32
> doorbell_index,
>  				  u32 *me, u32 *pipe, u32 *queue);
> +	/* save the state of the gfx HQD of a doorbell, if it has
> one */
> +	bool (*save_hqd)(struct amdgpu_device *adev, u32
> doorbell_index,
> +			 struct amdgpu_gfx_saved_hqd *hqd);
> +	/*
> +	 * write the HQD state saved by save_hqd() into a gfx MQD,
> for MES to
> +	 * load it into the HQD when it maps the queue again;
> +	 * true if the work up to hqd->wptr was dropped
> +	 */
> +	bool (*restore_hqd)(struct amdgpu_device *adev, void *mqd,
> +			    u32 ring_size,
> +			    const struct amdgpu_gfx_saved_hqd *hqd);
>  };
>  
>  struct sq_work {

  reply	other threads:[~2026-11-19 11:35 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  3:05 [PATCH v4 01/13] drm/amdgpu: pass the device to the multi ring reset helpers Jesse Zhang
2026-11-05  3:05 ` [PATCH v4 02/13] drm/amdgpu/ring: During multi-queue reset, only call begin helper if needed Jesse Zhang
2026-11-11 23:52   ` Daniel Campos Ramos
2026-11-19 11:34   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 03/13] drm/amdgpu: add an engine scope to the IP block soft reset Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 04/13] drm/amdgpu/gfx: add callbacks to save and restore a gfx HQD Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf [this message]
2026-11-05  3:05 ` [PATCH v4 05/13] drm/amdgpu/gfx12: " Jesse Zhang
2026-11-19 11:35   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 06/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 07/13] drm/amdgpu/userq: add a helper to signal the fences of a queue up to a point Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 08/13] drm/amdgpu/userq: add helpers to keep the user queues of one engine across a reset Jesse Zhang
2026-11-19 11:36   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 09/13] drm/amdgpu/gfx12: add a gfx engine soft reset Jesse Zhang
2026-11-19 11:42   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 10/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 11/13] drm/amdgpu/userq: reset the gfx engine when a gfx user queue reset fails Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 12/13] drm/amdgpu/gfx12: enable the gfx engine soft reset Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-05  3:05 ` [PATCH v4 13/13] drm/amdgpu/gfx11: " Jesse Zhang
2026-11-19 11:47   ` Timur Kristóf
2026-11-10  2:06 ` [PATCH v4 01/13] drm/amdgpu: pass the device to the multi ring reset helpers Zhang, Jesse(Jie)
2026-11-11 15:28   ` Timur Kristóf
2026-11-19 11:33 ` Timur Kristóf

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=d1e6815abbda0bc380daddffa7bf1846b0a44b1f.camel@gmail.com \
    --to=timur.kristof@gmail.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=Jiongyu.Zhu@amd.com \
    --cc=Lijo.Lazar@amd.com \
    --cc=Manu.Rastogi@amd.com \
    --cc=Mario.Novales@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@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.