summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-05-01 09:07:29 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-05-01 09:14:16 +0100
commitb4817052080fdc85e2376a5d63dafd8238e95d67 (patch)
tree03290cafed505c238ef99672c93ff3aafd9e81cc
parentef3f61a6d304c5bcec1ea892f292a0cf2c9062cc (diff)
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>
-rw-r--r--lib/igt_gt.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 0236518f..463f8b6d 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -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");