1 #ifndef __XEN_PERCPU_H__ 2 #define __XEN_PERCPU_H__ 3 4 #include <asm/percpu.h> 5 6 #define DECLARE_PER_CPU(type, name) \ 7 extern __typeof__(type) per_cpu__ ## name 8 9 #define __DEFINE_PER_CPU(attr, type, name) \ 10 attr __typeof__(type) per_cpu_ ## name 11 12 /* 13 * Separate out the type, so (int[3], foo) works. 14 * 15 * The _##name concatenation is being used here to prevent 'name' from getting 16 * macro expanded. 17 */ 18 #define DEFINE_PER_CPU(type, name) \ 19 __DEFINE_PER_CPU(__section(".bss.percpu"), type, _ ## name) 20 21 #define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ 22 typedef char name ## _chk_t \ 23 [BUILD_BUG_ON_ZERO(__alignof(type) & (PAGE_SIZE - 1))]; \ 24 __DEFINE_PER_CPU(__section(".bss.percpu.page_aligned"), \ 25 type, _ ## name) 26 27 #define DEFINE_PER_CPU_READ_MOSTLY(type, name) \ 28 __DEFINE_PER_CPU(__section(".bss.percpu.read_mostly"), type, _ ## name) 29 30 #define get_per_cpu_var(var) (per_cpu__##var) 31 32 /* Linux compatibility. */ 33 #define get_cpu_var(var) this_cpu(var) 34 #define put_cpu_var(var) 35 36 #endif /* __XEN_PERCPU_H__ */ 37