Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> writes: > During the reset of ring submission, we first stop the engine by > clearing the HEAD/TAIL and marking the ring as disabled. However, it > would be safer to disable the ring (after emptying) before resetting the > HEAD/TAIL. > > Suggested-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Cc: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx> Reviewed-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/gt/intel_ring_submission.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c > index 44159595d909..8a5314b97b04 100644 > --- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c > +++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c > @@ -301,13 +301,17 @@ static void xcs_sanitize(struct intel_engine_cs *engine) > > static bool stop_ring(struct intel_engine_cs *engine) > { > + /* Empty the ring by skipping to the end */ > ENGINE_WRITE_FW(engine, RING_HEAD, ENGINE_READ_FW(engine, RING_TAIL)); > - > - ENGINE_WRITE_FW(engine, RING_HEAD, 0); > - ENGINE_WRITE_FW(engine, RING_TAIL, 0); > + ENGINE_POSTING_READ(engine, RING_HEAD); > > /* The ring must be empty before it is disabled */ > ENGINE_WRITE_FW(engine, RING_CTL, 0); > + ENGINE_POSTING_READ(engine, RING_CTL); > + > + /* Then reset the disabled ring */ > + ENGINE_WRITE_FW(engine, RING_HEAD, 0); > + ENGINE_WRITE_FW(engine, RING_TAIL, 0); > > return (ENGINE_READ_FW(engine, RING_HEAD) & HEAD_ADDR) == 0; > } > -- > 2.20.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx