diff mbox

[U-Boot,2/2] ARM: OMAP5+: Override switch_to_hypervisor function

Message ID 1469590536-11993-3-git-send-email-j-keerthy@ti.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Keerthy July 27, 2016, 3:35 a.m. UTC
Override the switch_to_hypervisor function to switch cpu to hypervisor
mode using the available ROM code hook early in the boot phase before
the boot loader checks for HYP mode.

Based on the work done by Jonathan Bergsagel jbergsagel@ti.com.

Cc: beagleboard-x15@googlegroups.com
Signed-off-by: Keerthy <j-keerthy@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Tom Rini July 28, 2016, 1:44 p.m. UTC | #1
On Wed, Jul 27, 2016 at 09:05:36AM +0530, Keerthy wrote:

> Override the switch_to_hypervisor function to switch cpu to hypervisor
> mode using the available ROM code hook early in the boot phase before
> the boot loader checks for HYP mode.
> 
> Based on the work done by Jonathan Bergsagel jbergsagel@ti.com.
> 
> Cc: beagleboard-x15@googlegroups.com
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Acked-by: Nishanth Menon <nm@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
index 5283135..c7707e5 100644
--- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
@@ -23,7 +23,28 @@  ENTRY(save_boot_params)
 	str	r0, [r1]
 	b	save_boot_params_ret
 ENDPROC(save_boot_params)
+
+ENTRY(switch_to_hypervisor)
+/*
+ * Switch to hypervisor mode
+ */
+	adr	r0, save_sp
+	str	sp, [r0]
+	adr	r1, restore_from_hyp
+	ldr	r0, =0x102
+#ifdef CONFIG_TI_SECURE_DEVICE
+	b	omap_smc_sec
+#else
+	b	omap_smc1
+#endif
+restore_from_hyp:
+	adr	r0, save_sp
+	ldr	sp, [r0]
 #endif
+	b	switch_to_hypervisor_ret
+save_sp:
+	.word	0x0
+ENDPROC(switch_to_hypervisor)
 
 ENTRY(omap_smc1)
 	PUSH	{r4-r12, lr}	@ save registers - ROM code may pollute