public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] ARMv7: start.S: stay in HYP mode if u-boot is entered in it
@ 2013-04-02 15:43 Andre Przywara
  2013-04-15 17:20 ` Albert ARIBAUD
  0 siblings, 1 reply; 2+ messages in thread
From: Andre Przywara @ 2013-04-02 15:43 UTC (permalink / raw)
  To: u-boot

The KVM and Xen hypervisors for the Cortex-A15 virtualization
implementation need to be entered in HYP mode. Should the primary
board firmware already enter HYP mode (Calxeda firmware does that),
we should not deliberately drop back to SVC mode.
Since U-boot does not use the MMU, running in HYP mode is just fine.

Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
---
 arch/arm/cpu/armv7/start.S | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 36a4c3c..95c8a95 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -126,11 +126,15 @@ IRQ_STACK_START_IN:
 reset:
 	bl	save_boot_params
 	/*
-	 * set the cpu to SVC32 mode
+	 * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode,
+	 * except if in HYP mode already
 	 */
 	mrs	r0, cpsr
-	bic	r0, r0, #0x1f
-	orr	r0, r0, #0xd3
+	and	r1, r0, #0x1f		@ mask mode bits
+	teq	r1, #0x1a		@ test for HYP mode
+	bicne	r0, r0, #0x1f		@ clear all mode bits
+	orrne	r0, r0, #0x13		@ set SVC mode
+	orr	r0, r0, #0xc0		@ disable FIQ and IRQ
 	msr	cpsr,r0
 
 /*
-- 
1.7.12.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] ARMv7: start.S: stay in HYP mode if u-boot is entered in it
  2013-04-02 15:43 [U-Boot] [PATCH] ARMv7: start.S: stay in HYP mode if u-boot is entered in it Andre Przywara
@ 2013-04-15 17:20 ` Albert ARIBAUD
  0 siblings, 0 replies; 2+ messages in thread
From: Albert ARIBAUD @ 2013-04-15 17:20 UTC (permalink / raw)
  To: u-boot

Hi Andre,

On Tue,  2 Apr 2013 17:43:36 +0200, Andre Przywara
<andre.przywara@linaro.org> wrote:

> The KVM and Xen hypervisors for the Cortex-A15 virtualization
> implementation need to be entered in HYP mode. Should the primary
> board firmware already enter HYP mode (Calxeda firmware does that),
> we should not deliberately drop back to SVC mode.
> Since U-boot does not use the MMU, running in HYP mode is just fine.
> 
> Signed-off-by: Andre Przywara <andre.przywara@linaro.org>
> ---
>  arch/arm/cpu/armv7/start.S | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
> index 36a4c3c..95c8a95 100644
> --- a/arch/arm/cpu/armv7/start.S
> +++ b/arch/arm/cpu/armv7/start.S
> @@ -126,11 +126,15 @@ IRQ_STACK_START_IN:
>  reset:
>  	bl	save_boot_params
>  	/*
> -	 * set the cpu to SVC32 mode
> +	 * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode,
> +	 * except if in HYP mode already
>  	 */
>  	mrs	r0, cpsr
> -	bic	r0, r0, #0x1f
> -	orr	r0, r0, #0xd3
> +	and	r1, r0, #0x1f		@ mask mode bits
> +	teq	r1, #0x1a		@ test for HYP mode
> +	bicne	r0, r0, #0x1f		@ clear all mode bits
> +	orrne	r0, r0, #0x13		@ set SVC mode
> +	orr	r0, r0, #0xc0		@ disable FIQ and IRQ
>  	msr	cpsr,r0
>  
>  /*

Applied to u-boot-arm/master, thanks!

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-15 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 15:43 [U-Boot] [PATCH] ARMv7: start.S: stay in HYP mode if u-boot is entered in it Andre Przywara
2013-04-15 17:20 ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox