lkml.org 
[lkml]   [2005]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] x86_64 prefetchw() function can take into account CONFIG_MK8 / CONFIG_MPSC
If we build a x86_64 kernel for an AMD64 or for an Intel EMT64, no need to use alternative_input.
Reserve alternative_input only for a generic kernel.

Thank you

Eric Dumazet

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>

diff -Nru linux-2.6.12/include/asm-x86_64/processor.h linux-2.6.12-orig/include/asm-x86_64/processor.h
--- linux-2.6.12-orig/include/asm-x86_64/processor.h 2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12/include/asm-x86_64/processor.h 2005-06-23 11:20:08.000000000 +0200
@@ -389,10 +389,21 @@
#define ARCH_HAS_PREFETCHW 1
static inline void prefetchw(void *x)
{
+#if defined(CONFIG_MK8)
+ /* AMD64 / MK8 has 3DNOW, we can emit a true prefetchw, using a "m" in the asm input */
+ asm volatile("prefetchw %0" :: "m" (*(unsigned long *)x));
+#elif defined(CONFIG_MPSC)
+ /* Intel EMT64 does not have 3DNOW, no prefetchw instruction */
+#else
+ /* If we build a generic X86_64 kernel,
+ * we must use alternative_input() and a "r" asm constraint to make sure
+ * the size of the instruction will be <= 5
+ */
alternative_input(ASM_NOP5,
"prefetchw (%1)",
X86_FEATURE_3DNOW,
"r" (x));
+#endif
}

#define ARCH_HAS_SPINLOCK_PREFETCH 1
\
 
 \ /
  Last update: 2005-06-23 12:07    [W:0.031 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site