lib: Apply magic clflush serialisation

On Baytrail, Braswell and Atoms beyond we see an issue where the mfence
is insufficient to force the cacheline to be coherent (i.e. such that
writes from the GPU are visible by the CPU after the call to clflush). A
second clflush is ordered with an earlier clflush to the same address
and this appears sufficient to give the coherency required for GPU/CPU
interop.

Testcase: igt/gem_exec_flush
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Akash Goel <akash.goel@intel.com>
This commit is contained in:
Chris Wilson 2016-05-01 09:07:29 +01:00
parent ef3f61a6d3
commit b481705208

View File

@ -425,6 +425,7 @@ void igt_clflush_range(void *addr, int size)
__builtin_ia32_mfence();
for (; p < end; p += clflush_size)
__builtin_ia32_clflush(p);
__builtin_ia32_clflush(end - 1); /* magic serialisation for byt+ */
__builtin_ia32_mfence();
#else
fprintf(stderr, "igt_clflush_range() unsupported\n");