diff mbox

[06/17] ARM: fixup head for atag verification

Message ID 1360365467-25056-7-git-send-email-ben.dooks@codethink.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Dooks Feb. 8, 2013, 11:17 p.m. UTC
If we booted LE but running BE8, ensure we read ATAGs data from head code
in the correct mode.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/kernel/head-common.S |    8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Nicolas Pitre Feb. 9, 2013, 3:51 a.m. UTC | #1
On Fri, 8 Feb 2013, Ben Dooks wrote:

> If we booted LE but running BE8, ensure we read ATAGs data from head code
> in the correct mode.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

You must be working on some recent platform, right?  Your cover letter 
mention highbank.  Strange that you don't address the DT pointer 
validation as well.

> ---
>  arch/arm/kernel/head-common.S |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
> index 854bd22..4eb53b2 100644
> --- a/arch/arm/kernel/head-common.S
> +++ b/arch/arm/kernel/head-common.S
> @@ -21,6 +21,12 @@
>  #define OF_DT_MAGIC 0xedfe0dd0 /* 0xd00dfeed in big-endian */
>  #endif
>  
> +#ifdef CONFIG_CPU_BE8_BOOT_LE
> +#define BE8_LE(x...)	x
> +#else
> +#define BE8_LE(x...)
> +#endif
> +
>  /*
>   * Exception handling.  Something went wrong and we can't proceed.  We
>   * ought to tell the user, but since we don't have any guarantee that
> @@ -53,10 +59,12 @@ __vet_atags:
>  	cmp	r5, r6
>  	beq	2f
>  #endif
> +BE8_LE(	rev	r5, r5 )
>  	cmp	r5, #ATAG_CORE_SIZE		@ is first tag ATAG_CORE?
>  	cmpne	r5, #ATAG_CORE_SIZE_EMPTY
>  	bne	1f
>  	ldr	r5, [r2, #4]
> +BE8_LE(	rev	r5, r5 )
>  	ldr	r6, =ATAG_CORE
>  	cmp	r5, r6
>  	bne	1f
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
Ben Dooks Feb. 9, 2013, 5:09 p.m. UTC | #2
On 09/02/2013 03:51, Nicolas Pitre wrote:
> On Fri, 8 Feb 2013, Ben Dooks wrote:
>
>> If we booted LE but running BE8, ensure we read ATAGs data from head 
>> code
>> in the correct mode.
>>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>
> You must be working on some recent platform, right?  Your cover 
> letter
> mention highbank.  Strange that you don't address the DT pointer
> validation as well.

I am using highbank for my main tests, I believe the DT pointer is
correct as the data is always guaranteed to be BE and the kernel
is doing the correct thing to test for it.

I will re-check this, but it all looked fine when I went through it.
diff mbox

Patch

diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 854bd22..4eb53b2 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -21,6 +21,12 @@ 
 #define OF_DT_MAGIC 0xedfe0dd0 /* 0xd00dfeed in big-endian */
 #endif
 
+#ifdef CONFIG_CPU_BE8_BOOT_LE
+#define BE8_LE(x...)	x
+#else
+#define BE8_LE(x...)
+#endif
+
 /*
  * Exception handling.  Something went wrong and we can't proceed.  We
  * ought to tell the user, but since we don't have any guarantee that
@@ -53,10 +59,12 @@  __vet_atags:
 	cmp	r5, r6
 	beq	2f
 #endif
+BE8_LE(	rev	r5, r5 )
 	cmp	r5, #ATAG_CORE_SIZE		@ is first tag ATAG_CORE?
 	cmpne	r5, #ATAG_CORE_SIZE_EMPTY
 	bne	1f
 	ldr	r5, [r2, #4]
+BE8_LE(	rev	r5, r5 )
 	ldr	r6, =ATAG_CORE
 	cmp	r5, r6
 	bne	1f