From 7d08913aeb80cc609678e6b73a836af9f1aa0da2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 1 May 2016 16:39:14 +0100 Subject: lib: Enable clflush for 32bit x86 builds Signed-off-by: Chris Wilson --- lib/igt_gt.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'lib/igt_gt.c') diff --git a/lib/igt_gt.c b/lib/igt_gt.c index 463f8b6d..ac3ab773 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -370,6 +370,7 @@ int igt_open_forcewake_handle(void) } static unsigned int clflush_size; +#if defined(__x86_64__) || defined(__i386__) int igt_setup_clflush(void) { FILE *file; @@ -378,11 +379,6 @@ int igt_setup_clflush(void) int first_stanza = 1; int has_clflush = 0; -#if !defined(__x86_64__) && !defined(__SSE2__) - /* requires mfence + clflush, both SSE2 instructions */ - return 0; -#endif - if (clflush_size) return 1; @@ -414,9 +410,9 @@ int igt_setup_clflush(void) return has_clflush && clflush_size; } +__attribute__((target("sse2"))) void igt_clflush_range(void *addr, int size) { -#if defined(__x86_64__) || defined(__SSE2__) char *p, *end; end = (char *)addr + size; @@ -427,10 +423,19 @@ void igt_clflush_range(void *addr, int size) __builtin_ia32_clflush(p); __builtin_ia32_clflush(end - 1); /* magic serialisation for byt+ */ __builtin_ia32_mfence(); +} #else +int igt_setup_clflush(void) +{ + /* requires mfence + clflush, both SSE2 instructions */ + return 0; +} + +void igt_clflush_range(void *addr, int size) +{ fprintf(stderr, "igt_clflush_range() unsupported\n"); -#endif } +#endif /** * intel_detect_and_clear_missed_irq: -- cgit v1.2.3