On 2026. szeptember 7., hétfő 9:04:55 közép-európai nyári idő Lazar, Lijo 
wrote:
> 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 <[email protected]>
> > ---
> > 
> >   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

Thank you for the suggestion, I'll add that to the next version of the series.

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




Reply via email to