diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-03-23 09:48:06 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2004-03-23 09:48:06 +0000 |
commit | 2a5f90e8e88330b026e79c1a3c38a711f545c167 (patch) | |
tree | caa5435c339291cc581777a52e4981c75b77260d /xen/include/xen/prefetch.h | |
parent | c2929ecdf6cba5d5e5fd09c52e465e5f4a22fb83 (diff) | |
download | xen-2a5f90e8e88330b026e79c1a3c38a711f545c167.tar.gz xen-2a5f90e8e88330b026e79c1a3c38a711f545c167.tar.bz2 xen-2a5f90e8e88330b026e79c1a3c38a711f545c167.zip |
bitkeeper revision 1.821 (406007d6uu0vZYDxa9P1ZfNO9kF_Cg)
Many files:
xeno -> xen renames.
ide-xen.c:
Rename: xen/drivers/ide/ide-xeno.c -> xen/drivers/ide/ide-xen.c
xen.lds:
Rename: xen/arch/i386/xeno.lds -> xen/arch/i386/xen.lds
Many files:
mvdir
Diffstat (limited to 'xen/include/xen/prefetch.h')
-rw-r--r-- | xen/include/xen/prefetch.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/xen/include/xen/prefetch.h b/xen/include/xen/prefetch.h new file mode 100644 index 0000000000..8d7d3ffeb4 --- /dev/null +++ b/xen/include/xen/prefetch.h @@ -0,0 +1,60 @@ +/* + * Generic cache management functions. Everything is arch-specific, + * but this header exists to make sure the defines/functions can be + * used in a generic way. + * + * 2000-11-13 Arjan van de Ven <arjan@fenrus.demon.nl> + * + */ + +#ifndef _LINUX_PREFETCH_H +#define _LINUX_PREFETCH_H + +#include <asm/processor.h> +#include <asm/cache.h> + +/* + prefetch(x) attempts to pre-emptively get the memory pointed to + by address "x" into the CPU L1 cache. + prefetch(x) should not cause any kind of exception, prefetch(0) is + specifically ok. + + prefetch() should be defined by the architecture, if not, the + #define below provides a no-op define. + + There are 3 prefetch() macros: + + prefetch(x) - prefetches the cacheline at "x" for read + prefetchw(x) - prefetches the cacheline at "x" for write + spin_lock_prefetch(x) - prefectches the spinlock *x for taking + + there is also PREFETCH_STRIDE which is the architecure-prefered + "lookahead" size for prefetching streamed operations. + +*/ + +/* + * These cannot be do{}while(0) macros. See the mental gymnastics in + * the loop macro. + */ + +#ifndef ARCH_HAS_PREFETCH +#define ARCH_HAS_PREFETCH +static inline void prefetch(const void *x) {;} +#endif + +#ifndef ARCH_HAS_PREFETCHW +#define ARCH_HAS_PREFETCHW +static inline void prefetchw(const void *x) {;} +#endif + +#ifndef ARCH_HAS_SPINLOCK_PREFETCH +#define ARCH_HAS_SPINLOCK_PREFETCH +#define spin_lock_prefetch(x) prefetchw(x) +#endif + +#ifndef PREFETCH_STRIDE +#define PREFETCH_STRIDE (4*L1_CACHE_BYTES) +#endif + +#endif |