Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm: Remove the ability to set HYP vectors outside of the decompressor

Although we have to bounce between HYP and SVC to decompress and
relocate the kernel, we don't need to be able to use it in the
kernel itself. So let's drop the functionnality.

Since the vectors are never changed, there is no need to reset them
either, and nobody calls that stub anyway. The last function
(SOFT_RESTART) is still present in order to support kexec.

Signed-off-by: Marc Zyngier <maz@kernel.org>

+8 -36
-5
arch/arm/include/asm/virt.h
··· 39 39 sync_cache_r(&__boot_cpu_mode); 40 40 } 41 41 42 - void __hyp_set_vectors(unsigned long phys_vector_base); 43 - void __hyp_reset_vectors(void); 44 42 #else 45 43 #define __boot_cpu_mode (SVC_MODE) 46 44 #define sync_boot_mode() ··· 73 75 74 76 #define HVC_SET_VECTORS 0 75 77 #define HVC_SOFT_RESTART 1 76 - #define HVC_RESET_VECTORS 2 77 - 78 - #define HVC_STUB_HCALL_NR 3 79 78 80 79 #endif /* __ASSEMBLY__ */ 81 80
+8 -31
arch/arm/kernel/hyp-stub.S
··· 189 189 ENDPROC(__hyp_stub_install_secondary) 190 190 191 191 __hyp_stub_do_trap: 192 + #ifdef ZIMAGE 192 193 teq r0, #HVC_SET_VECTORS 193 194 bne 1f 195 + /* Only the ZIMAGE stubs can change the HYP vectors */ 194 196 mcr p15, 4, r1, c12, c0, 0 @ set HVBAR 195 197 b __hyp_stub_exit 198 + #endif 196 199 197 200 1: teq r0, #HVC_SOFT_RESTART 198 - bne 1f 201 + bne 2f 199 202 bx r1 200 203 201 - 1: teq r0, #HVC_RESET_VECTORS 202 - beq __hyp_stub_exit 203 - 204 - ldr r0, =HVC_STUB_ERR 204 + 2: ldr r0, =HVC_STUB_ERR 205 205 __ERET 206 206 207 207 __hyp_stub_exit: ··· 210 210 ENDPROC(__hyp_stub_do_trap) 211 211 212 212 /* 213 - * __hyp_set_vectors: Call this after boot to set the initial hypervisor 214 - * vectors as part of hypervisor installation. On an SMP system, this should 215 - * be called on each CPU. 216 - * 217 - * r0 must be the physical address of the new vector table (which must lie in 218 - * the bottom 4GB of physical address space. 219 - * 220 - * r0 must be 32-byte aligned. 221 - * 222 - * Before calling this, you must check that the stub hypervisor is installed 223 - * everywhere, by waiting for any secondary CPUs to be brought up and then 224 - * checking that BOOT_CPU_MODE_HAVE_HYP(__boot_cpu_mode) is true. 225 - * 226 - * If not, there is a pre-existing hypervisor, some CPUs failed to boot, or 227 - * something else went wrong... in such cases, trying to install a new 228 - * hypervisor is unlikely to work as desired. 229 - * 230 - * When you call into your shiny new hypervisor, sp_hyp will contain junk, 231 - * so you will need to set that to something sensible at the new hypervisor's 232 - * 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. 233 216 */ 234 217 ENTRY(__hyp_set_vectors) 235 218 mov r1, r0 ··· 227 244 __HVC(0) 228 245 ret lr 229 246 ENDPROC(__hyp_soft_restart) 230 - 231 - ENTRY(__hyp_reset_vectors) 232 - mov r0, #HVC_RESET_VECTORS 233 - __HVC(0) 234 - ret lr 235 - ENDPROC(__hyp_reset_vectors) 236 247 237 248 #ifndef ZIMAGE 238 249 .align 2