diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2009-04-19 20:19:13 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2009-04-19 20:19:13 +0000 |
commit | a93fa8f2bbd27fcd845e2ed0b5359e14f0e19910 (patch) | |
tree | 30f708f0df558e2567b5c3f03e96c6e13b769058 /sys | |
parent | 99d67eca502799fc5e63a6409033a0fabe79c64e (diff) | |
download | src-a93fa8f2bbd27fcd845e2ed0b5359e14f0e19910.tar.gz src-a93fa8f2bbd27fcd845e2ed0b5359e14f0e19910.zip |
For each architecture, define CACHE_LINE_SHIFT and a derived
CACHE_LINE_SIZE constant. These constants are intended to
over-estimate the cache line size, and be used at compile-time
when a run-time tuning alternative isn't appropriate or
available.
Defaults for all architectures are 64 bytes, except powerpc
where it is 128 bytes (used on G5 systems).
MFC after: 2 weeks
Discussed on: arch@
Notes
Notes:
svn path=/head/; revision=191276
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/include/param.h | 4 | ||||
-rw-r--r-- | sys/arm/include/param.h | 5 | ||||
-rw-r--r-- | sys/i386/include/param.h | 5 | ||||
-rw-r--r-- | sys/ia64/include/param.h | 5 | ||||
-rw-r--r-- | sys/mips/include/param.h | 5 | ||||
-rw-r--r-- | sys/powerpc/include/param.h | 5 | ||||
-rw-r--r-- | sys/sparc64/include/param.h | 5 | ||||
-rw-r--r-- | sys/sun4v/include/param.h | 5 |
8 files changed, 39 insertions, 0 deletions
diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index 82e439fd4c6e..7cf1286721d8 100644 --- a/sys/amd64/include/param.h +++ b/sys/amd64/include/param.h @@ -89,6 +89,10 @@ #define ALIGN(p) _ALIGN(p) #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) /* Size of the level 1 page table units */ #define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h index 8fb85559146c..6e3ee5929bc3 100644 --- a/sys/arm/include/param.h +++ b/sys/arm/include/param.h @@ -81,6 +81,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define PAGE_SHIFT 12 #define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ #define PAGE_MASK (PAGE_SIZE - 1) diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 265337ad616c..d9a3cdaf3434 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -74,6 +74,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ #define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */ #define PAGE_MASK (PAGE_SIZE-1) diff --git a/sys/ia64/include/param.h b/sys/ia64/include/param.h index acea69007d2b..f9a9c4a0b0a2 100644 --- a/sys/ia64/include/param.h +++ b/sys/ia64/include/param.h @@ -99,6 +99,11 @@ #define ALIGN(p) _ALIGN(p) #define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #ifndef LOG2_PAGE_SIZE #define LOG2_PAGE_SIZE 13 /* 8K pages by default. */ #endif diff --git a/sys/mips/include/param.h b/sys/mips/include/param.h index 5acdfdfa115e..55f877f17e7a 100644 --- a/sys/mips/include/param.h +++ b/sys/mips/include/param.h @@ -89,6 +89,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define NBPG 4096 /* bytes/page */ #define PGOFSET (NBPG-1) /* byte offset into page */ #define PGSHIFT 12 /* LOG2(NBPG) */ diff --git a/sys/powerpc/include/param.h b/sys/powerpc/include/param.h index 1a910baa8e00..7dddb30b9160 100644 --- a/sys/powerpc/include/param.h +++ b/sys/powerpc/include/param.h @@ -79,6 +79,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 7 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define PAGE_SHIFT 12 #define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ #define PAGE_MASK (PAGE_SIZE - 1) diff --git a/sys/sparc64/include/param.h b/sys/sparc64/include/param.h index 8a1c7df4aedf..e8f783f180b4 100644 --- a/sys/sparc64/include/param.h +++ b/sys/sparc64/include/param.h @@ -71,6 +71,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define PAGE_SHIFT_8K 13 #define PAGE_SIZE_8K (1L<<PAGE_SHIFT_8K) #define PAGE_MASK_8K (PAGE_SIZE_8K-1) diff --git a/sys/sun4v/include/param.h b/sys/sun4v/include/param.h index 0ac9c9b793ab..4d7b42ebdead 100644 --- a/sys/sun4v/include/param.h +++ b/sys/sun4v/include/param.h @@ -71,6 +71,11 @@ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) +#ifndef CACHE_LINE_SHIFT +#define CACHE_LINE_SHIFT 6 +#endif +#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) + #define PAGE_SHIFT_8K 13 #define PAGE_SIZE_8K (1L<<PAGE_SHIFT_8K) #define PAGE_MASK_8K (PAGE_SIZE_8K-1) |