1 #ifndef __ARCH_S390_PERCPU__
2 #define __ARCH_S390_PERCPU__
4 #include <linux/compiler.h>
5 #include <asm/lowcore.h>
8 * s390 uses its own implementation for per cpu data, the offset of
9 * the cpu local data area is cached in the cpu's lowcore memory.
10 * For 64 bit module code s390 forces the use of a GOT slot for the
11 * address of the per cpu variable. This is needed because the module
12 * may be more than 4G above the per cpu area.
14 #if defined(__s390x__) && defined(MODULE)
16 #define __reloc_hide(var,offset) (*({ \
17 extern int simple_identifier_##var(void); \
18 unsigned long *__ptr; \
19 asm ( "larl %0,per_cpu__"#var"@GOTENT" \
20 : "=a" (__ptr) : "X" (per_cpu__##var) ); \
21 (typeof(&per_cpu__##var))((*__ptr) + (offset)); }))
25 #define __reloc_hide(var, offset) (*({ \
26 extern int simple_identifier_##var(void); \
27 unsigned long __ptr; \
28 asm ( "" : "=a" (__ptr) : "0" (&per_cpu__##var) ); \
29 (typeof(&per_cpu__##var)) (__ptr + (offset)); }))
35 extern unsigned long __per_cpu_offset
[NR_CPUS
];
37 /* Separate out the type, so (int[3], foo) works. */
38 #define DEFINE_PER_CPU(type, name) \
39 __attribute__((__section__(".data.percpu"))) \
40 __typeof__(type) per_cpu__##name
42 #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
43 __attribute__((__section__(".data.percpu.shared_aligned"))) \
44 __typeof__(type) per_cpu__##name \
45 ____cacheline_aligned_in_smp
47 #define __get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
48 #define __raw_get_cpu_var(var) __reloc_hide(var,S390_lowcore.percpu_offset)
49 #define per_cpu(var,cpu) __reloc_hide(var,__per_cpu_offset[cpu])
50 #define per_cpu_offset(x) (__per_cpu_offset[x])
52 /* A macro to avoid #include hell... */
53 #define percpu_modcopy(pcpudst, src, size) \
56 for_each_possible_cpu(__i) \
57 memcpy((pcpudst)+__per_cpu_offset[__i], \
63 #define DEFINE_PER_CPU(type, name) \
64 __typeof__(type) per_cpu__##name
65 #define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
66 DEFINE_PER_CPU(type, name)
68 #define __get_cpu_var(var) __reloc_hide(var,0)
69 #define __raw_get_cpu_var(var) __reloc_hide(var,0)
70 #define per_cpu(var,cpu) __reloc_hide(var,0)
74 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
76 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
77 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
79 #endif /* __ARCH_S390_PERCPU__ */
This page took 0.051326 seconds and 5 git commands to generate.