diff mbox

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

Message ID 1473830013-16480-7-git-send-email-j-keerthy@ti.com
State Accepted
Commit 1dbc40e7d2c87f40addbfd6b7a2f119493133d22
Delegated to: Tom Rini
Headers show

Commit Message

Keerthy Sept. 14, 2016, 5:13 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>
---
 arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Tom Rini Sept. 16, 2016, 11:17 a.m. UTC | #1
On Wed, Sep 14, 2016 at 10:43:33AM +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>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini Oct. 8, 2016, 5:05 p.m. UTC | #2
On Wed, Sep 14, 2016 at 10:43:33AM +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>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
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 66a3b3d..8ce12c8 100644
--- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
@@ -24,6 +24,30 @@  ENTRY(save_boot_params)
 	str	r0, [r1]
 	b	save_boot_params_ret
 ENDPROC(save_boot_params)
+
+#if !defined(CONFIG_TI_SECURE_DEVICE) && defined(CONFIG_ARMV7_LPAE)
+ENTRY(switch_to_hypervisor)
+
+/*
+ * Switch to hypervisor mode
+ */
+	adr	r0, save_sp
+	str	sp, [r0]
+	adr	r1, restore_from_hyp
+	ldr	r0, =0x102
+	b	omap_smc1
+restore_from_hyp:
+	adr	r0, save_sp
+	ldr	sp, [r0]
+	MRC p15, 4, R0, c1, c0, 0
+	ldr     r1, =0X1004	@Set cache enable bits for hypervisor mode
+	orr     r0, r0, r1
+	MCR p15, 4, R0, c1, c0, 0
+	b	switch_to_hypervisor_ret
+save_sp:
+	.word	0x0
+ENDPROC(switch_to_hypervisor)
+#endif
 #endif
 
 ENTRY(omap_smc1)