diff options
Diffstat (limited to 'include/asm-generic/percpu.h')
-rw-r--r-- | include/asm-generic/percpu.h | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index b0e63c672ebd..af47b9e10064 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h | |||
@@ -73,11 +73,50 @@ extern void setup_per_cpu_areas(void); | |||
73 | 73 | ||
74 | #endif /* SMP */ | 74 | #endif /* SMP */ |
75 | 75 | ||
76 | #ifndef PER_CPU_BASE_SECTION | ||
77 | #ifdef CONFIG_SMP | ||
78 | #define PER_CPU_BASE_SECTION ".data.percpu" | ||
79 | #else | ||
80 | #define PER_CPU_BASE_SECTION ".data" | ||
81 | #endif | ||
82 | #endif | ||
83 | |||
84 | #ifdef CONFIG_SMP | ||
85 | |||
86 | #ifdef MODULE | ||
87 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
88 | #else | ||
89 | #define PER_CPU_SHARED_ALIGNED_SECTION ".shared_aligned" | ||
90 | #endif | ||
91 | #define PER_CPU_FIRST_SECTION ".first" | ||
92 | |||
93 | #else | ||
94 | |||
95 | #define PER_CPU_SHARED_ALIGNED_SECTION "" | ||
96 | #define PER_CPU_FIRST_SECTION "" | ||
97 | |||
98 | #endif | ||
99 | |||
76 | #ifndef PER_CPU_ATTRIBUTES | 100 | #ifndef PER_CPU_ATTRIBUTES |
77 | #define PER_CPU_ATTRIBUTES | 101 | #define PER_CPU_ATTRIBUTES |
78 | #endif | 102 | #endif |
79 | 103 | ||
80 | #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \ | 104 | #define DECLARE_PER_CPU_SECTION(type, name, section) \ |
81 | __typeof__(type) per_cpu_var(name) | 105 | extern \ |
106 | __attribute__((__section__(PER_CPU_BASE_SECTION section))) \ | ||
107 | PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name | ||
108 | |||
109 | #define DECLARE_PER_CPU(type, name) \ | ||
110 | DECLARE_PER_CPU_SECTION(type, name, "") | ||
111 | |||
112 | #define DECLARE_PER_CPU_SHARED_ALIGNED(type, name) \ | ||
113 | DECLARE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \ | ||
114 | ____cacheline_aligned_in_smp | ||
115 | |||
116 | #define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ | ||
117 | DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") | ||
118 | |||
119 | #define DECLARE_PER_CPU_FIRST(type, name) \ | ||
120 | DECLARE_PER_CPU_SECTION(type, name, PER_CPU_FIRST_SECTION) | ||
82 | 121 | ||
83 | #endif /* _ASM_GENERIC_PERCPU_H_ */ | 122 | #endif /* _ASM_GENERIC_PERCPU_H_ */ |