Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/execlists: Apply a full mb before execution for Braswell

Braswell is really picky about having our writes posted to memory before
we execute or else the GPU may see stale values. A wmb() is insufficient
as it only ensures the writes are visible to other cores, we need a full
mb() to ensure the writes are in memory and visible to the GPU.

The most frequent failure in flushing before execution is that we see
stale PTE values and execute the wrong pages.

References: 987abd5c62f9 ("drm/i915/execlists: Force write serialisation into context image vs execution")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181206084431.9805-3-chris@chris-wilson.co.uk
(cherry picked from commit 490b8c65b9db45896769e1095e78725775f47b3e)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

authored by

Chris Wilson and committed by
Joonas Lahtinen
cf66b8a0 d76b21eb

+6 -1
+6 -1
drivers/gpu/drm/i915/intel_lrc.c
··· 442 442 * may not be visible to the HW prior to the completion of the UC 443 443 * register write and that we may begin execution from the context 444 444 * before its image is complete leading to invalid PD chasing. 445 + * 446 + * Furthermore, Braswell, at least, wants a full mb to be sure that 447 + * the writes are coherent in memory (visible to the GPU) prior to 448 + * execution, and not just visible to other CPUs (as is the result of 449 + * wmb). 445 450 */ 446 - wmb(); 451 + mb(); 447 452 return ce->lrc_desc; 448 453 } 449 454