From 8df790f38fc6501dadb8302ef4a236525bb7d2c4 Mon Sep 17 00:00:00 2001 From: rwatson Date: Sun, 19 Apr 2009 20:19:13 +0000 Subject: 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@ --- sys/amd64/include/param.h | 4 ++++ sys/arm/include/param.h | 5 +++++ sys/i386/include/param.h | 5 +++++ sys/ia64/include/param.h | 5 +++++ sys/mips/include/param.h | 5 +++++ sys/powerpc/include/param.h | 5 +++++ sys/sparc64/include/param.h | 5 +++++ sys/sun4v/include/param.h | 5 +++++ 8 files changed, 39 insertions(+) diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h index 82e439f..7cf1286 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 8fb8555..6e3ee59 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 265337a..d9a3cda 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<