diff options
Diffstat (limited to 'include/asm-s390/percpu.h')
-rw-r--r-- | include/asm-s390/percpu.h | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/include/asm-s390/percpu.h b/include/asm-s390/percpu.h index 2d676a873858..408d60b4f75b 100644 --- a/include/asm-s390/percpu.h +++ b/include/asm-s390/percpu.h | |||
@@ -13,49 +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 | ||
35 | extern 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 | /* A macro to avoid #include hell... */ | ||
43 | #define percpu_modcopy(pcpudst, src, size) \ | ||
44 | do { \ | ||
45 | unsigned int __i; \ | ||
46 | for_each_possible_cpu(__i) \ | ||
47 | memcpy((pcpudst)+__per_cpu_offset[__i], \ | ||
48 | (src), (size)); \ | ||
49 | } while (0) | ||
50 | |||
51 | #else /* ! SMP */ | ||
52 | |||
53 | #define __get_cpu_var(var) __reloc_hide(var,0) | ||
54 | #define __raw_get_cpu_var(var) __reloc_hide(var,0) | ||
55 | #define per_cpu(var,cpu) __reloc_hide(var,0) | ||
56 | |||
57 | #endif /* SMP */ | ||
58 | |||
59 | #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name | ||
60 | 36 | ||
61 | #endif /* __ARCH_S390_PERCPU__ */ | 37 | #endif /* __ARCH_S390_PERCPU__ */ |