AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: "Timur Kristóf" <timur.kristof@gmail.com>,
	amd-gfx@lists.freedesktop.org, Alexander.Deucher@amd.com,
	"Christian König" <christian.koenig@amd.com>,
	"Natalie Vock" <natalie.vock@gmx.de>,
	"Tvrtko Ursulin" <tursulin@ursulin.net>,
	"Felix Kuehling" <Felix.Kuehling@amd.com>
Subject: Re: [PATCH 5/8] drm/amdgpu/sdma: Clear SDMA rings after reset before starting them
Date: Mon, 7 Sep 2026 12:34:55 +0530	[thread overview]
Message-ID: <a3a99a32-baa1-4ea6-9c8b-b7994beb8f47@amd.com> (raw)
In-Reply-To: <20260904072850.321759-6-timur.kristof@gmail.com>



On 04-Sep-26 12:58 PM, Timur Kristóf wrote:
> The ring contains commands that were emitted before the reset.
> These need to be cleared to make sure the HW doesn't execute
> them, because they are garbage at this point.
> 
> Note that the ring reset helpers will re-emit the commands
> that are necessary after the reset.
> 
> Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> index fbac732f3e01..66f278f77f71 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> @@ -593,6 +593,18 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id,
>   		goto exit;
>   	}
>   
> +	amdgpu_ring_clear_ring(gfx_ring);
> +	gfx_ring->wptr = 0;
> +	atomic64_set((atomic64_t *)gfx_ring->wptr_cpu_addr, 0);
> +	atomic64_set((atomic64_t *)gfx_ring->rptr_cpu_addr, 0);
> +
> +	if (adev->sdma.has_page_queue) {
> +		amdgpu_ring_clear_ring(page_ring);
> +		page_ring->wptr = 0;
> +		atomic64_set((atomic64_t *)page_ring->wptr_cpu_addr, 0);
> +		atomic64_set((atomic64_t *)page_ring->rptr_cpu_addr, 0);
> +	}

This could be made as a small inline function like 
amdgpu_ring_reset_ptr(ring);

Thanks,
Lijo

> +
>   	if (sdma_instance->funcs->start_kernel_queue) {
>   		sdma_instance->funcs->start_kernel_queue(gfx_ring);
>   		if (adev->sdma.has_page_queue)


  reply	other threads:[~2026-09-07  7:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  7:28 [PATCH 0/8] drm/amdgpu/sdma: Improve existing SDMA queue resets (v3) Timur Kristóf
2026-09-04  7:28 ` [PATCH 1/8] drm/amdgpu/sdma: Remove unimplemented soft_reset() for SDMA and SI DMA Timur Kristóf
2026-09-04  7:28 ` [PATCH 2/8] drm/amdgpu/sdma: Remove superfluous rlc_resume and rlc_stop functions Timur Kristóf
2026-09-04  7:28 ` [PATCH 3/8] drm/amdgpu/sdma: Fix executing duplicate commands after recovery on SDMA v4.4.2 Timur Kristóf
2026-09-04  7:28 ` [PATCH 4/8] drm/amdgpu/sdma: Remove unnecessary guilty tracking of SDMA queues Timur Kristóf
2026-09-04  7:28 ` [PATCH 5/8] drm/amdgpu/sdma: Clear SDMA rings after reset before starting them Timur Kristóf
2026-09-07  7:04   ` Lazar, Lijo [this message]
2026-09-07 18:31     ` Timur Kristóf
2026-09-04  7:28 ` [PATCH 6/8] drm/amdgpu/sdma: Move SDMA v5.x queue reset to common code Timur Kristóf
2026-09-04  7:28 ` [PATCH 7/8] drm/amdgpu/sdma: Always handle kernel queues in amdgpu_sdma_reset_engine() Timur Kristóf
2026-09-07  7:17   ` Lazar, Lijo
2026-09-07 18:34     ` Timur Kristóf
2026-09-08  3:25       ` Lazar, Lijo
2026-09-04  7:28 ` [PATCH 8/8] drm/amdgpu/sdma: Use common SDMA legacy queue reset on SDMA v4.4.2 Timur Kristóf
  -- strict thread matches above, loose matches on Subject: below --
2026-09-01  8:41 [PATCH 0/8] drm/amdgpu/sdma: Improve existing SDMA queue resets (v2) Timur Kristóf
2026-09-01  8:41 ` [PATCH 5/8] drm/amdgpu/sdma: Clear SDMA rings after reset before starting them 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=a3a99a32-baa1-4ea6-9c8b-b7994beb8f47@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=natalie.vock@gmx.de \
    --cc=timur.kristof@gmail.com \
    --cc=tursulin@ursulin.net \
    /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