1 #ifndef __ARCH_S390_PERCPU__
2 #define __ARCH_S390_PERCPU__
4 #include <asm-generic/percpu.h>
5 #include <asm/lowcore.h>
8 * For builtin kernel code s390 uses the generic implementation for
9 * per cpu data, with the exception that the offset of the cpu local
10 * data area is cached in the cpu's lowcore memory
11 * For 64 bit module code s390 forces the use of a GOT slot for the
12 * address of the per cpu variable. This is needed because the module
13 * may be more than 4G above the per cpu area.
15 #if defined(__s390x__) && defined(MODULE)
16 #define __get_got_cpu_var(var,offset) \
17 (*({ unsigned long *__ptr; \
18 asm ( "larl %0,per_cpu__"#var"@GOTENT" : "=a" (__ptr) ); \
19 ((typeof(&per_cpu__##var))((*__ptr) + offset)); \
22 #define __get_cpu_var(var) __get_got_cpu_var(var,S390_lowcore.percpu_offset)
24 #define per_cpu(var,cpu) __get_got_cpu_var(var,__per_cpu_offset[cpu])
27 #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, S390_lowcore.percpu_offset))
30 #endif /* __ARCH_S390_PERCPU__ */