forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/arch/arm/kernel/hyp-stub.S
....@@ -1,19 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Copyright (c) 2012 Linaro Limited.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along
15
- * with this program; if not, write to the Free Software Foundation, Inc.,
16
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
174 */
185
196 #include <linux/init.h>
....@@ -202,19 +189,19 @@
202189 ENDPROC(__hyp_stub_install_secondary)
203190
204191 __hyp_stub_do_trap:
192
+#ifdef ZIMAGE
205193 teq r0, #HVC_SET_VECTORS
206194 bne 1f
195
+ /* Only the ZIMAGE stubs can change the HYP vectors */
207196 mcr p15, 4, r1, c12, c0, 0 @ set HVBAR
208197 b __hyp_stub_exit
198
+#endif
209199
210200 1: teq r0, #HVC_SOFT_RESTART
211
- bne 1f
201
+ bne 2f
212202 bx r1
213203
214
-1: teq r0, #HVC_RESET_VECTORS
215
- beq __hyp_stub_exit
216
-
217
- ldr r0, =HVC_STUB_ERR
204
+2: ldr r0, =HVC_STUB_ERR
218205 __ERET
219206
220207 __hyp_stub_exit:
....@@ -223,26 +210,9 @@
223210 ENDPROC(__hyp_stub_do_trap)
224211
225212 /*
226
- * __hyp_set_vectors: Call this after boot to set the initial hypervisor
227
- * vectors as part of hypervisor installation. On an SMP system, this should
228
- * be called on each CPU.
229
- *
230
- * r0 must be the physical address of the new vector table (which must lie in
231
- * the bottom 4GB of physical address space.
232
- *
233
- * r0 must be 32-byte aligned.
234
- *
235
- * Before calling this, you must check that the stub hypervisor is installed
236
- * everywhere, by waiting for any secondary CPUs to be brought up and then
237
- * checking that BOOT_CPU_MODE_HAVE_HYP(__boot_cpu_mode) is true.
238
- *
239
- * If not, there is a pre-existing hypervisor, some CPUs failed to boot, or
240
- * something else went wrong... in such cases, trying to install a new
241
- * hypervisor is unlikely to work as desired.
242
- *
243
- * When you call into your shiny new hypervisor, sp_hyp will contain junk,
244
- * so you will need to set that to something sensible at the new hypervisor's
245
- * initialisation entry point.
213
+ * __hyp_set_vectors is only used when ZIMAGE must bounce between HYP
214
+ * and SVC. For the kernel itself, the vectors are set once and for
215
+ * all by the stubs.
246216 */
247217 ENTRY(__hyp_set_vectors)
248218 mov r1, r0
....@@ -257,12 +227,6 @@
257227 __HVC(0)
258228 ret lr
259229 ENDPROC(__hyp_soft_restart)
260
-
261
-ENTRY(__hyp_reset_vectors)
262
- mov r0, #HVC_RESET_VECTORS
263
- __HVC(0)
264
- ret lr
265
-ENDPROC(__hyp_reset_vectors)
266230
267231 #ifndef ZIMAGE
268232 .align 2