diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-05-01 16:39:14 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-05-01 16:40:16 +0100 |
commit | 7d08913aeb80cc609678e6b73a836af9f1aa0da2 (patch) | |
tree | b2d75a2ef23fe4c2ae8c78c531b5f259f5d7e3ee /lib/igt_gt.c | |
parent | 89f354e0a5008f7a51a785c52c1d25a32b052c26 (diff) |
lib: Enable clflush for 32bit x86 builds
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_gt.c')
-rw-r--r-- | lib/igt_gt.c | 19 |
1 files changed, 12 insertions, 7 deletions
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: |