diff options
Diffstat (limited to 'arch/arm/include/asm/proc-fns.h')
-rw-r--r-- | arch/arm/include/asm/proc-fns.h | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h index e25f4392e1b2..e1b6f280ab08 100644 --- a/arch/arm/include/asm/proc-fns.h +++ b/arch/arm/include/asm/proc-fns.h | |||
@@ -23,7 +23,7 @@ struct mm_struct; | |||
23 | /* | 23 | /* |
24 | * Don't change this structure - ASM code relies on it. | 24 | * Don't change this structure - ASM code relies on it. |
25 | */ | 25 | */ |
26 | extern struct processor { | 26 | struct processor { |
27 | /* MISC | 27 | /* MISC |
28 | * get data abort address/flags | 28 | * get data abort address/flags |
29 | */ | 29 | */ |
@@ -79,9 +79,13 @@ extern struct processor { | |||
79 | unsigned int suspend_size; | 79 | unsigned int suspend_size; |
80 | void (*do_suspend)(void *); | 80 | void (*do_suspend)(void *); |
81 | void (*do_resume)(void *); | 81 | void (*do_resume)(void *); |
82 | } processor; | 82 | }; |
83 | 83 | ||
84 | #ifndef MULTI_CPU | 84 | #ifndef MULTI_CPU |
85 | static inline void init_proc_vtable(const struct processor *p) | ||
86 | { | ||
87 | } | ||
88 | |||
85 | extern void cpu_proc_init(void); | 89 | extern void cpu_proc_init(void); |
86 | extern void cpu_proc_fin(void); | 90 | extern void cpu_proc_fin(void); |
87 | extern int cpu_do_idle(void); | 91 | extern int cpu_do_idle(void); |
@@ -98,17 +102,50 @@ extern void cpu_reset(unsigned long addr, bool hvc) __attribute__((noreturn)); | |||
98 | extern void cpu_do_suspend(void *); | 102 | extern void cpu_do_suspend(void *); |
99 | extern void cpu_do_resume(void *); | 103 | extern void cpu_do_resume(void *); |
100 | #else | 104 | #else |
101 | #define cpu_proc_init processor._proc_init | ||
102 | #define cpu_proc_fin processor._proc_fin | ||
103 | #define cpu_reset processor.reset | ||
104 | #define cpu_do_idle processor._do_idle | ||
105 | #define cpu_dcache_clean_area processor.dcache_clean_area | ||
106 | #define cpu_set_pte_ext processor.set_pte_ext | ||
107 | #define cpu_do_switch_mm processor.switch_mm | ||
108 | 105 | ||
109 | /* These three are private to arch/arm/kernel/suspend.c */ | 106 | extern struct processor processor; |
110 | #define cpu_do_suspend processor.do_suspend | 107 | #if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR) |
111 | #define cpu_do_resume processor.do_resume | 108 | #include <linux/smp.h> |
109 | /* | ||
110 | * This can't be a per-cpu variable because we need to access it before | ||
111 | * per-cpu has been initialised. We have a couple of functions that are | ||
112 | * called in a pre-emptible context, and so can't use smp_processor_id() | ||
113 | * there, hence PROC_TABLE(). We insist in init_proc_vtable() that the | ||
114 | * function pointers for these are identical across all CPUs. | ||
115 | */ | ||
116 | extern struct processor *cpu_vtable[]; | ||
117 | #define PROC_VTABLE(f) cpu_vtable[smp_processor_id()]->f | ||
118 | #define PROC_TABLE(f) cpu_vtable[0]->f | ||
119 | static inline void init_proc_vtable(const struct processor *p) | ||
120 | { | ||
121 | unsigned int cpu = smp_processor_id(); | ||
122 | *cpu_vtable[cpu] = *p; | ||
123 | WARN_ON_ONCE(cpu_vtable[cpu]->dcache_clean_area != | ||
124 | cpu_vtable[0]->dcache_clean_area); | ||
125 | WARN_ON_ONCE(cpu_vtable[cpu]->set_pte_ext != | ||
126 | cpu_vtable[0]->set_pte_ext); | ||
127 | } | ||
128 | #else | ||
129 | #define PROC_VTABLE(f) processor.f | ||
130 | #define PROC_TABLE(f) processor.f | ||
131 | static inline void init_proc_vtable(const struct processor *p) | ||
132 | { | ||
133 | processor = *p; | ||
134 | } | ||
135 | #endif | ||
136 | |||
137 | #define cpu_proc_init PROC_VTABLE(_proc_init) | ||
138 | #define cpu_check_bugs PROC_VTABLE(check_bugs) | ||
139 | #define cpu_proc_fin PROC_VTABLE(_proc_fin) | ||
140 | #define cpu_reset PROC_VTABLE(reset) | ||
141 | #define cpu_do_idle PROC_VTABLE(_do_idle) | ||
142 | #define cpu_dcache_clean_area PROC_TABLE(dcache_clean_area) | ||
143 | #define cpu_set_pte_ext PROC_TABLE(set_pte_ext) | ||
144 | #define cpu_do_switch_mm PROC_VTABLE(switch_mm) | ||
145 | |||
146 | /* These two are private to arch/arm/kernel/suspend.c */ | ||
147 | #define cpu_do_suspend PROC_VTABLE(do_suspend) | ||
148 | #define cpu_do_resume PROC_VTABLE(do_resume) | ||
112 | #endif | 149 | #endif |
113 | 150 | ||
114 | extern void cpu_resume(void); | 151 | extern void cpu_resume(void); |