Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/include/xen/prefetch.h
Line
Count
Source
1
/*
2
 *  Generic cache management functions. Everything is arch-specific,  
3
 *  but this header exists to make sure the defines/functions can be
4
 *  used in a generic way.
5
 *
6
 *  2000-11-13  Arjan van de Ven   <arjan@fenrus.demon.nl>
7
 *
8
 */
9
10
#ifndef _LINUX_PREFETCH_H
11
#define _LINUX_PREFETCH_H
12
13
#include <asm/processor.h>
14
#include <asm/cache.h>
15
16
/*
17
  prefetch(x) attempts to pre-emptively get the memory pointed to
18
  by address "x" into the CPU L1 cache. 
19
  prefetch(x) should not cause any kind of exception, prefetch(0) is
20
  specifically ok.
21
22
  prefetch() should be defined by the architecture, if not, the 
23
  #define below provides a no-op define.  
24
  
25
  There are 3 prefetch() macros:
26
  
27
  prefetch(x)   - prefetches the cacheline at "x" for read
28
  prefetchw(x)  - prefetches the cacheline at "x" for write
29
  spin_lock_prefetch(x) - prefectches the spinlock *x for taking
30
  
31
  there is also PREFETCH_STRIDE which is the architecture-preferred
32
  "lookahead" size for prefetching streamed operations.
33
  
34
*/
35
36
#ifndef ARCH_HAS_PREFETCH
37
60.2M
#define prefetch(x) __builtin_prefetch(x)
38
#endif
39
40
#ifndef ARCH_HAS_PREFETCHW
41
#define prefetchw(x) __builtin_prefetch(x,1)
42
#endif
43
44
#ifndef ARCH_HAS_SPINLOCK_PREFETCH
45
#define spin_lock_prefetch(x) prefetchw(x)
46
#endif
47
48
#ifndef PREFETCH_STRIDE
49
#define PREFETCH_STRIDE (4*L1_CACHE_BYTES)
50
#endif
51
52
#endif