aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/percpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-s390/percpu.h')
-rw-r--r--include/asm-s390/percpu.h33
1 files changed, 9 insertions, 24 deletions
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h
index 465d313ba2dc..408d60b4f75b 100644
--- a/include/asm-s390/percpu.h
+++ b/include/asm-s390/percpu.h
@@ -13,40 +13,25 @@
13 */ 13 */
14#if defined(__s390x__) && defined(MODULE) 14#if defined(__s390x__) && defined(MODULE)
15 15
16#define __reloc_hide(var,offset) (*({ \ 16#define SHIFT_PERCPU_PTR(ptr,offset) (({ \
17 extern int simple_identifier_##var(void); \ 17 extern int simple_identifier_##var(void); \
18 unsigned long *__ptr; \ 18 unsigned long *__ptr; \
19 asm ( "larl %0,per_cpu__"#var"@GOTENT" \ 19 asm ( "larl %0, %1@GOTENT" \
20 : "=a" (__ptr) : "X" (per_cpu__##var) ); \ 20 : "=a" (__ptr) : "X" (ptr) ); \
21 (typeof(&per_cpu__##var))((*__ptr) + (offset)); })) 21 (typeof(ptr))((*__ptr) + (offset)); }))
22 22
23#else 23#else
24 24
25#define __reloc_hide(var, offset) (*({ \ 25#define SHIFT_PERCPU_PTR(ptr, offset) (({ \
26 extern int simple_identifier_##var(void); \ 26 extern int simple_identifier_##var(void); \
27 unsigned long __ptr; \ 27 unsigned long __ptr; \
28 asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \ 28 asm ( "" : "=a" (__ptr) : "0" (ptr) ); \
29 (typeof(&per_cpu__##var)) (__ptr + (offset)); })) 29 (typeof(ptr)) (__ptr + (offset)); }))
30 30
31#endif 31#endif
32 32
33#ifdef CONFIG_SMP 33#define __my_cpu_offset S390_lowcore.percpu_offset
34 34
35extern unsigned long __per_cpu_offset[NR_CPUS]; 35#include <asm-generic/percpu.h>
36
37#define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
38#define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
39#define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
40#define per_cpu_offset(x) (__per_cpu_offset[x])
41
42#else /* ! SMP */
43
44#define __get_cpu_var(var) __reloc_hide(var,0)
45#define __raw_get_cpu_var(var) __reloc_hide(var,0)
46#define per_cpu(var,cpu) __reloc_hide(var,0)
47
48#endif /* SMP */
49
50#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
51 36
52#endif /* __ARCH_S390_PERCPU__ */ 37#endif /* __ARCH_S390_PERCPU__ */