Skip to content
  • Chris Wilson's avatar
    drm/i915/gt: Detect if we miss WaIdleLiteRestore · f26a9e95
    Chris Wilson authored
    In order to avoid confusing the HW, we must never submit an empty ring
    during lite-restore, that is we should always advance the RING_TAIL
    before submitting to stay ahead of the RING_HEAD.
    
    Normally this is prevented by keeping a couple of spare NOPs in the
    request->wa_tail so that on resubmission we can advance the tail. This
    relies on the request only being resubmitted once, which is the normal
    condition as it is seen once for ELSP[1] and then later in ELSP[0]. On
    preemption, the requests are unwound and the tail reset back to the
    normal end point (as we know the request is incomplete and therefore its
    RING_HEAD is even earlier).
    
    However, if this w/a should fail we would try and resubmit the request
    with the RING_TAIL already set to the location of this request's wa_tail
    potentially causing a GPU hang. We can spot when we do try and
    incorrectly resubmit without advancing the RING_TAIL and spare any
    embarrassment by forcing the context restore.
    
    In the case of preempt-to-busy, we leave the requests running on the HW
    while we unwind. As the ring is still live, we cannot rewind our
    rq->tail without forcing a reload so leave it set to rq->wa_tail and
    only force a reload if we resubmit after a lite-restore. (Normally, the
    forced reload will be a part of the preemption event.)
    
    Fixes: 22b7a426 ("drm/i915/execlists: Preempt-to-busy")
    Closes: https://gitlab.freedesktop.org/drm/intel/issues/673
    
    
    Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: stable@kernel.vger.org
    Link: https://patchwork.freedesktop.org/patch/msgid/20191209023215.3519970-1-chris@chris-wilson.co.uk
    (cherry picked from commit 82c69bf5
    
    )
    Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
    f26a9e95