mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-24 16:26:13 +00:00
lib/igt_gt: Replace asm clflush/mfence with __builtin_ia32 variants
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
4133c7f85b
commit
7499b913b3
13
lib/igt_gt.c
13
lib/igt_gt.c
@ -481,6 +481,11 @@ int igt_setup_clflush(void)
|
|||||||
int first_stanza = 1;
|
int first_stanza = 1;
|
||||||
int has_clflush = 0;
|
int has_clflush = 0;
|
||||||
|
|
||||||
|
#if !defined(__x86_64__) && !defined(__SSE2__)
|
||||||
|
/* requires mfence + clflush, both SSE2 instructions */
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (clflush_size)
|
if (clflush_size)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -514,16 +519,16 @@ int igt_setup_clflush(void)
|
|||||||
|
|
||||||
void igt_clflush_range(void *addr, int size)
|
void igt_clflush_range(void *addr, int size)
|
||||||
{
|
{
|
||||||
#if defined(__i386__) || defined(__x86_64__)
|
#if defined(__x86_64__) || defined(__SSE2__)
|
||||||
char *p, *end;
|
char *p, *end;
|
||||||
|
|
||||||
end = (char *)addr + size;
|
end = (char *)addr + size;
|
||||||
p = (char *)((uintptr_t)addr & ~((uintptr_t)clflush_size - 1));
|
p = (char *)((uintptr_t)addr & ~((uintptr_t)clflush_size - 1));
|
||||||
|
|
||||||
asm volatile("mfence" ::: "memory");
|
__builtin_ia32_mfence();
|
||||||
for (; p < end; p += clflush_size)
|
for (; p < end; p += clflush_size)
|
||||||
asm volatile("clflush %0" : "+m" (*(volatile char *)p));
|
__builtin_ia32_clflush(p);
|
||||||
asm volatile("mfence" ::: "memory");
|
__builtin_ia32_mfence();
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "igt_clflush_range() unsupported\n");
|
fprintf(stderr, "igt_clflush_range() unsupported\n");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user