.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Hibernate low-level support |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2016 ARM Ltd. |
---|
5 | 6 | * Author: James Morse <james.morse@arm.com> |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify |
---|
8 | | - * it under the terms of the GNU General Public License version 2 as |
---|
9 | | - * published by the Free Software Foundation. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | 7 | */ |
---|
19 | 8 | #include <linux/linkage.h> |
---|
20 | 9 | #include <linux/errno.h> |
---|
.. | .. |
---|
33 | 22 | * Even switching to our copied tables will cause a changed output address at |
---|
34 | 23 | * each stage of the walk. |
---|
35 | 24 | */ |
---|
36 | | -.macro break_before_make_ttbr_switch zero_page, page_table, tmp |
---|
| 25 | +.macro break_before_make_ttbr_switch zero_page, page_table, tmp, tmp2 |
---|
37 | 26 | phys_to_ttbr \tmp, \zero_page |
---|
38 | 27 | msr ttbr1_el1, \tmp |
---|
39 | 28 | isb |
---|
40 | 29 | tlbi vmalle1 |
---|
41 | 30 | dsb nsh |
---|
42 | 31 | phys_to_ttbr \tmp, \page_table |
---|
| 32 | + offset_ttbr1 \tmp, \tmp2 |
---|
43 | 33 | msr ttbr1_el1, \tmp |
---|
44 | 34 | isb |
---|
45 | 35 | .endm |
---|
.. | .. |
---|
75 | 65 | * x5: physical address of a zero page that remains zero after resume |
---|
76 | 66 | */ |
---|
77 | 67 | .pushsection ".hibernate_exit.text", "ax" |
---|
78 | | -ENTRY(swsusp_arch_suspend_exit) |
---|
| 68 | +SYM_CODE_START(swsusp_arch_suspend_exit) |
---|
79 | 69 | /* |
---|
80 | 70 | * We execute from ttbr0, change ttbr1 to our copied linear map tables |
---|
81 | 71 | * with a break-before-make via the zero page |
---|
82 | 72 | */ |
---|
83 | | - break_before_make_ttbr_switch x5, x0, x6 |
---|
| 73 | + break_before_make_ttbr_switch x5, x0, x6, x8 |
---|
84 | 74 | |
---|
85 | 75 | mov x21, x1 |
---|
86 | 76 | mov x30, x2 |
---|
.. | .. |
---|
111 | 101 | dsb ish /* wait for PoU cleaning to finish */ |
---|
112 | 102 | |
---|
113 | 103 | /* switch to the restored kernels page tables */ |
---|
114 | | - break_before_make_ttbr_switch x25, x21, x6 |
---|
| 104 | + break_before_make_ttbr_switch x25, x21, x6, x8 |
---|
115 | 105 | |
---|
116 | 106 | ic ialluis |
---|
117 | 107 | dsb ish |
---|
.. | .. |
---|
120 | 110 | cbz x24, 3f /* Do we need to re-initialise EL2? */ |
---|
121 | 111 | hvc #0 |
---|
122 | 112 | 3: ret |
---|
123 | | - |
---|
124 | | - .ltorg |
---|
125 | | -ENDPROC(swsusp_arch_suspend_exit) |
---|
| 113 | +SYM_CODE_END(swsusp_arch_suspend_exit) |
---|
126 | 114 | |
---|
127 | 115 | /* |
---|
128 | 116 | * Restore the hyp stub. |
---|
.. | .. |
---|
131 | 119 | * |
---|
132 | 120 | * x24: The physical address of __hyp_stub_vectors |
---|
133 | 121 | */ |
---|
134 | | -el1_sync: |
---|
| 122 | +SYM_CODE_START_LOCAL(el1_sync) |
---|
135 | 123 | msr vbar_el2, x24 |
---|
136 | 124 | eret |
---|
137 | | -ENDPROC(el1_sync) |
---|
| 125 | +SYM_CODE_END(el1_sync) |
---|
138 | 126 | |
---|
139 | 127 | .macro invalid_vector label |
---|
140 | | -\label: |
---|
| 128 | +SYM_CODE_START_LOCAL(\label) |
---|
141 | 129 | b \label |
---|
142 | | -ENDPROC(\label) |
---|
| 130 | +SYM_CODE_END(\label) |
---|
143 | 131 | .endm |
---|
144 | 132 | |
---|
145 | 133 | invalid_vector el2_sync_invalid |
---|
.. | .. |
---|
153 | 141 | |
---|
154 | 142 | /* el2 vectors - switch el2 here while we restore the memory image. */ |
---|
155 | 143 | .align 11 |
---|
156 | | -ENTRY(hibernate_el2_vectors) |
---|
| 144 | +SYM_CODE_START(hibernate_el2_vectors) |
---|
157 | 145 | ventry el2_sync_invalid // Synchronous EL2t |
---|
158 | 146 | ventry el2_irq_invalid // IRQ EL2t |
---|
159 | 147 | ventry el2_fiq_invalid // FIQ EL2t |
---|
.. | .. |
---|
173 | 161 | ventry el1_irq_invalid // IRQ 32-bit EL1 |
---|
174 | 162 | ventry el1_fiq_invalid // FIQ 32-bit EL1 |
---|
175 | 163 | ventry el1_error_invalid // Error 32-bit EL1 |
---|
176 | | -END(hibernate_el2_vectors) |
---|
| 164 | +SYM_CODE_END(hibernate_el2_vectors) |
---|
177 | 165 | |
---|
178 | 166 | .popsection |
---|