Commit 734e75636429f58d104f6efc3157c913d8e4bd30
Committed by
Greg Kroah-Hartman
1 parent
b0bb76920d
arm64: Move cpu_resume into the text section
commit c3684fbb446501b48dec6677a6a9f61c215053de upstream. The function cpu_resume currently lives in the .data section. There's no reason for it to be there since we can use relative instructions without a problem. Move a few cpu_resume data structures out of the assembly file so the .data annotation can be dropped completely and cpu_resume ends up in the read only text section. Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Tested-by: Kees Cook <keescook@chromium.org> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Laura Abbott <lauraa@codeaurora.org> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 2 changed files with 8 additions and 32 deletions Side-by-side Diff
arch/arm64/kernel/sleep.S
... | ... | @@ -147,14 +147,12 @@ |
147 | 147 | ret |
148 | 148 | ENDPROC(cpu_resume_after_mmu) |
149 | 149 | |
150 | - .data | |
151 | 150 | ENTRY(cpu_resume) |
152 | 151 | bl el2_setup // if in EL2 drop to EL1 cleanly |
153 | 152 | #ifdef CONFIG_SMP |
154 | 153 | mrs x1, mpidr_el1 |
155 | - adr x4, mpidr_hash_ptr | |
156 | - ldr x5, [x4] | |
157 | - add x8, x4, x5 // x8 = struct mpidr_hash phys address | |
154 | + adrp x8, mpidr_hash | |
155 | + add x8, x8, #:lo12:mpidr_hash // x8 = struct mpidr_hash phys address | |
158 | 156 | /* retrieve mpidr_hash members to compute the hash */ |
159 | 157 | ldr x2, [x8, #MPIDR_HASH_MASK] |
160 | 158 | ldp w3, w4, [x8, #MPIDR_HASH_SHIFTS] |
161 | 159 | |
162 | 160 | |
... | ... | @@ -164,14 +162,15 @@ |
164 | 162 | #else |
165 | 163 | mov x7, xzr |
166 | 164 | #endif |
167 | - adr x0, sleep_save_sp | |
165 | + adrp x0, sleep_save_sp | |
166 | + add x0, x0, #:lo12:sleep_save_sp | |
168 | 167 | ldr x0, [x0, #SLEEP_SAVE_SP_PHYS] |
169 | 168 | ldr x0, [x0, x7, lsl #3] |
170 | 169 | /* load sp from context */ |
171 | 170 | ldr x2, [x0, #CPU_CTX_SP] |
172 | - adr x1, sleep_idmap_phys | |
171 | + adrp x1, sleep_idmap_phys | |
173 | 172 | /* load physical address of identity map page table in x1 */ |
174 | - ldr x1, [x1] | |
173 | + ldr x1, [x1, #:lo12:sleep_idmap_phys] | |
175 | 174 | mov sp, x2 |
176 | 175 | /* |
177 | 176 | * cpu_do_resume expects x0 to contain context physical address |
... | ... | @@ -180,27 +179,4 @@ |
180 | 179 | bl cpu_do_resume // PC relative jump, MMU off |
181 | 180 | b cpu_resume_mmu // Resume MMU, never returns |
182 | 181 | ENDPROC(cpu_resume) |
183 | - | |
184 | - .align 3 | |
185 | -mpidr_hash_ptr: | |
186 | - /* | |
187 | - * offset of mpidr_hash symbol from current location | |
188 | - * used to obtain run-time mpidr_hash address with MMU off | |
189 | - */ | |
190 | - .quad mpidr_hash - . | |
191 | -/* | |
192 | - * physical address of identity mapped page tables | |
193 | - */ | |
194 | - .type sleep_idmap_phys, #object | |
195 | -ENTRY(sleep_idmap_phys) | |
196 | - .quad 0 | |
197 | -/* | |
198 | - * struct sleep_save_sp { | |
199 | - * phys_addr_t *save_ptr_stash; | |
200 | - * phys_addr_t save_ptr_stash_phys; | |
201 | - * }; | |
202 | - */ | |
203 | - .type sleep_save_sp, #object | |
204 | -ENTRY(sleep_save_sp) | |
205 | - .space SLEEP_SAVE_SP_SZ // struct sleep_save_sp |
arch/arm64/kernel/suspend.c