[RFC PATCH 2/3] bootwrapper: Refactor entry into Hyp mode to be more reusable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  * Split Hyp mode entry out into a separate macro.
  * hvc now jumps back to the caller in Hyp mode instead of
    branching to a fixed label.

Signed-off-by: Dave Martin <dave.martin@xxxxxxxxxx>
---
 boot.S |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/boot.S b/boot.S
index 0acd243..128f74e 100644
--- a/boot.S
+++ b/boot.S
@@ -12,6 +12,15 @@
 	.arch_extension virt
 	.text
 
+.macro enter_hyp
+	@ We can't call hvc from secure mode, so drop down first.
+	mov	r7, #0xffffffff
+	smc	#0				@ Change to NS-mode
+
+	@ This is how we enter hyp mode, for booting the next stage.
+	hvc	#0
+.endm
+
 .align 5
 /* Once we get rid of monitor.S, use these smc vectors too! */
 hyp_vectors:
@@ -20,10 +29,14 @@ hyp_vectors:
 	.word 0 /* svc */
 	.word 0 /* pabt */
 	.word 0 /* dabt */
-	b	into_hyp_mode /* hvc */
+	b	1f
 	.word 0 /* irq */
 	.word 0 /* fiq */
 
+/* Return directly back to the caller without leaving Hyp mode: */
+1:	mrs	lr, elr_hyp
+	mov	pc, lr
+
 	.globl	start
 start:
 #ifdef SMP
@@ -83,14 +96,8 @@ start:
 	mov	r7, #0xfffffff0
 	smc	#0				@ Set HVBAR
 
-	@ We can't call hvc from secure mode, so drop down first.
-	mov	r7, #0xffffffff
-	smc	#0				@ Change to NS-mode 
-
-	@ This is how we enter hyp mode, for booting the next stage.
-	hvc	#0
+	enter_hyp
 
-into_hyp_mode:
 	@ Check CPU nr again
 	mrc	p15, 0, r0, c0, c0, 5		@ MPIDR (ARMv7 only)
 	and	r0, r0, #15			@ CPU number
-- 
1.7.4.1

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm


[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux