All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: map ATAGs when not in first 1MB of RAM
@ 2011-01-27 15:50 ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-01-27 15:50 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Rob Herring

From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>

If ATAGs or DTB pointer is not within first 1MB of RAM, then the boot params
will not be mapped early enough, so map the 1MB region that r2 points to. Only
map the first 1MB when r2 is 0.

Some assembly improvements from Nicolas Pitre.

Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
---
 arch/arm/kernel/head.S |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 65d9489..9c688bf 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -205,15 +205,32 @@ __create_page_tables:
 #endif
 
 	/*
-	 * Then map first 1MB of ram in case it contains our boot params.
+	 * Then map first 1MB of ram if boot params address is not specified.
 	 */
+	cmp	r2, #0
+	bne	1f
 	add	r0, r4, #PAGE_OFFSET >> 18
 	orr	r6, r7, #(PHYS_OFFSET & 0xff000000)
 	.if	(PHYS_OFFSET & 0x00f00000)
 	orr	r6, r6, #(PHYS_OFFSET & 0x00f00000)
 	.endif
 	str	r6, [r0]
+	b	2f
 
+	/*
+	 * Otherwise map the 1MB region r2 points to (atags or dtb)
+	 */
+1:	mov	r0, r2, lsr #20
+	mov	r0, r0, lsl #20
+	sub	r3, r0, #(PHYS_OFFSET & 0xff000000)
+	.if	(PHYS_OFFSET & 0x00f00000)
+	sub	r3, r3, #(PHYS_OFFSET & 0x00f00000)
+	.endif
+	add	r3, r3, #PAGE_OFFSET
+	add	r3, r4, r3, lsr #18
+	orr	r6, r7, r0
+	str	r6, [r3]
+2:
 #ifdef CONFIG_DEBUG_LL
 #ifndef CONFIG_DEBUG_ICEDCC
 	/*
-- 
1.7.1

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

* [PATCH] ARM: map ATAGs when not in first 1MB of RAM
@ 2011-01-27 15:50 ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-01-27 15:50 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rob Herring <rob.herring@calxeda.com>

If ATAGs or DTB pointer is not within first 1MB of RAM, then the boot params
will not be mapped early enough, so map the 1MB region that r2 points to. Only
map the first 1MB when r2 is 0.

Some assembly improvements from Nicolas Pitre.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/kernel/head.S |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 65d9489..9c688bf 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -205,15 +205,32 @@ __create_page_tables:
 #endif
 
 	/*
-	 * Then map first 1MB of ram in case it contains our boot params.
+	 * Then map first 1MB of ram if boot params address is not specified.
 	 */
+	cmp	r2, #0
+	bne	1f
 	add	r0, r4, #PAGE_OFFSET >> 18
 	orr	r6, r7, #(PHYS_OFFSET & 0xff000000)
 	.if	(PHYS_OFFSET & 0x00f00000)
 	orr	r6, r6, #(PHYS_OFFSET & 0x00f00000)
 	.endif
 	str	r6, [r0]
+	b	2f
 
+	/*
+	 * Otherwise map the 1MB region r2 points to (atags or dtb)
+	 */
+1:	mov	r0, r2, lsr #20
+	mov	r0, r0, lsl #20
+	sub	r3, r0, #(PHYS_OFFSET & 0xff000000)
+	.if	(PHYS_OFFSET & 0x00f00000)
+	sub	r3, r3, #(PHYS_OFFSET & 0x00f00000)
+	.endif
+	add	r3, r3, #PAGE_OFFSET
+	add	r3, r4, r3, lsr #18
+	orr	r6, r7, r0
+	str	r6, [r3]
+2:
 #ifdef CONFIG_DEBUG_LL
 #ifndef CONFIG_DEBUG_ICEDCC
 	/*
-- 
1.7.1

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

* Re: [PATCH] ARM: map ATAGs when not in first 1MB of RAM
  2011-01-27 15:50 ` Rob Herring
@ 2011-01-27 16:31   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2011-01-27 16:31 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree-discuss, Rob Herring, linux-arm-kernel

On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
> +	/*
> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
> +	 */
> +1:	mov	r0, r2, lsr #20
> +	mov	r0, r0, lsl #20
> +	sub	r3, r0, #(PHYS_OFFSET & 0xff000000)
> +	.if	(PHYS_OFFSET & 0x00f00000)
> +	sub	r3, r3, #(PHYS_OFFSET & 0x00f00000)

This introduces new PHYS_OFFSET uses which we're trying hard to get
rid of.  This will need to be reworked.

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

* [PATCH] ARM: map ATAGs when not in first 1MB of RAM
@ 2011-01-27 16:31   ` Russell King - ARM Linux
  0 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2011-01-27 16:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
> +	/*
> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
> +	 */
> +1:	mov	r0, r2, lsr #20
> +	mov	r0, r0, lsl #20
> +	sub	r3, r0, #(PHYS_OFFSET & 0xff000000)
> +	.if	(PHYS_OFFSET & 0x00f00000)
> +	sub	r3, r3, #(PHYS_OFFSET & 0x00f00000)

This introduces new PHYS_OFFSET uses which we're trying hard to get
rid of.  This will need to be reworked.

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

* Re: [PATCH] ARM: map ATAGs when not in first 1MB of RAM
  2011-01-27 16:31   ` Russell King - ARM Linux
@ 2011-01-27 17:41       ` Rob Herring
  -1 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-01-27 17:41 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Russell,

On 01/27/2011 10:31 AM, Russell King - ARM Linux wrote:
> On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
>> +	/*
>> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
>> +	 */
>> +1:	mov	r0, r2, lsr #20
>> +	mov	r0, r0, lsl #20
>> +	sub	r3, r0, #(PHYS_OFFSET&  0xff000000)
>> +	.if	(PHYS_OFFSET&  0x00f00000)
>> +	sub	r3, r3, #(PHYS_OFFSET&  0x00f00000)
>
> This introduces new PHYS_OFFSET uses which we're trying hard to get
> rid of.  This will need to be reworked.

Yeah, I didn't really like that either. How about this? It's untested. 
It replaces the whole section mapping the 1st 1MB and should make 
replacing this instance of PHYS_OFFSET with a variable easier.

	/*
	 * Then map boot params address in r2 or
	 * the first 1MB of ram if boot params address is not specified.
	 */
	ldr	r3, =PHYS_OFFSET
	mov	r0, r2, lsr #20
	movs	r0, r0, lsl #20
	moveq	r0, r3
	sub	r3, r0, r3
	add	r3, r3, #PAGE_OFFSET
	add	r3, r4, r3, lsr #18
	orr	r6, r7, r0
	str	r6, [r3]

Rob

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

* [PATCH] ARM: map ATAGs when not in first 1MB of RAM
@ 2011-01-27 17:41       ` Rob Herring
  0 siblings, 0 replies; 10+ messages in thread
From: Rob Herring @ 2011-01-27 17:41 UTC (permalink / raw)
  To: linux-arm-kernel

Russell,

On 01/27/2011 10:31 AM, Russell King - ARM Linux wrote:
> On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
>> +	/*
>> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
>> +	 */
>> +1:	mov	r0, r2, lsr #20
>> +	mov	r0, r0, lsl #20
>> +	sub	r3, r0, #(PHYS_OFFSET&  0xff000000)
>> +	.if	(PHYS_OFFSET&  0x00f00000)
>> +	sub	r3, r3, #(PHYS_OFFSET&  0x00f00000)
>
> This introduces new PHYS_OFFSET uses which we're trying hard to get
> rid of.  This will need to be reworked.

Yeah, I didn't really like that either. How about this? It's untested. 
It replaces the whole section mapping the 1st 1MB and should make 
replacing this instance of PHYS_OFFSET with a variable easier.

	/*
	 * Then map boot params address in r2 or
	 * the first 1MB of ram if boot params address is not specified.
	 */
	ldr	r3, =PHYS_OFFSET
	mov	r0, r2, lsr #20
	movs	r0, r0, lsl #20
	moveq	r0, r3
	sub	r3, r0, r3
	add	r3, r3, #PAGE_OFFSET
	add	r3, r4, r3, lsr #18
	orr	r6, r7, r0
	str	r6, [r3]

Rob

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

* Re: [PATCH] ARM: map ATAGs when not in first 1MB of RAM
  2011-01-27 17:41       ` Rob Herring
@ 2011-01-27 17:46           ` Russell King - ARM Linux
  -1 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2011-01-27 17:46 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thu, Jan 27, 2011 at 11:41:30AM -0600, Rob Herring wrote:
> Russell,
>
> On 01/27/2011 10:31 AM, Russell King - ARM Linux wrote:
>> On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
>>> +	/*
>>> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
>>> +	 */
>>> +1:	mov	r0, r2, lsr #20
>>> +	mov	r0, r0, lsl #20
>>> +	sub	r3, r0, #(PHYS_OFFSET&  0xff000000)
>>> +	.if	(PHYS_OFFSET&  0x00f00000)
>>> +	sub	r3, r3, #(PHYS_OFFSET&  0x00f00000)
>>
>> This introduces new PHYS_OFFSET uses which we're trying hard to get
>> rid of.  This will need to be reworked.
>
> Yeah, I didn't really like that either. How about this? It's untested.  
> It replaces the whole section mapping the 1st 1MB and should make  
> replacing this instance of PHYS_OFFSET with a variable easier.

With the p2v patches, queued for the next merge window, PHYS_OFFSET
becomes:

extern unsigned long __pv_phys_offset;
#define PHYS_OFFSET __pv_phys_offset

so using PHYS_OFFSET in any way in assembly isn't going to work too
well.  Luckily, the p2v patches supply __create_page_tables with a
value of PHYS_OFFSET in r8.

What this means is that there's an fundamental interdependence between
your patches and mine.  Your patches can work without the p2v patches.
Or they can be made to work with the p2v patches applied.

So I think this needs to wait until after the next merge window, or it
needs to be prepared against the p2v patches (see my p2v branch) and
applied there once everyone's happy with it.

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

* [PATCH] ARM: map ATAGs when not in first 1MB of RAM
@ 2011-01-27 17:46           ` Russell King - ARM Linux
  0 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2011-01-27 17:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 27, 2011 at 11:41:30AM -0600, Rob Herring wrote:
> Russell,
>
> On 01/27/2011 10:31 AM, Russell King - ARM Linux wrote:
>> On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
>>> +	/*
>>> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
>>> +	 */
>>> +1:	mov	r0, r2, lsr #20
>>> +	mov	r0, r0, lsl #20
>>> +	sub	r3, r0, #(PHYS_OFFSET&  0xff000000)
>>> +	.if	(PHYS_OFFSET&  0x00f00000)
>>> +	sub	r3, r3, #(PHYS_OFFSET&  0x00f00000)
>>
>> This introduces new PHYS_OFFSET uses which we're trying hard to get
>> rid of.  This will need to be reworked.
>
> Yeah, I didn't really like that either. How about this? It's untested.  
> It replaces the whole section mapping the 1st 1MB and should make  
> replacing this instance of PHYS_OFFSET with a variable easier.

With the p2v patches, queued for the next merge window, PHYS_OFFSET
becomes:

extern unsigned long __pv_phys_offset;
#define PHYS_OFFSET __pv_phys_offset

so using PHYS_OFFSET in any way in assembly isn't going to work too
well.  Luckily, the p2v patches supply __create_page_tables with a
value of PHYS_OFFSET in r8.

What this means is that there's an fundamental interdependence between
your patches and mine.  Your patches can work without the p2v patches.
Or they can be made to work with the p2v patches applied.

So I think this needs to wait until after the next merge window, or it
needs to be prepared against the p2v patches (see my p2v branch) and
applied there once everyone's happy with it.

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

* Re: [PATCH] ARM: map ATAGs when not in first 1MB of RAM
  2011-01-27 15:50 ` Rob Herring
@ 2011-02-02  3:26     ` Grant Likely
  -1 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2011-02-02  3:26 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Rob Herring,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
> From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> 
> If ATAGs or DTB pointer is not within first 1MB of RAM, then the boot params
> will not be mapped early enough, so map the 1MB region that r2 points to. Only
> map the first 1MB when r2 is 0.
> 
> Some assembly improvements from Nicolas Pitre.
> 
> Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>

I'll try temporarily picking this one up into my devicetree/test
branch until Russell's p2v patches get merged into mainline.

Thanks!
g.

> ---
>  arch/arm/kernel/head.S |   19 ++++++++++++++++++-
>  1 files changed, 18 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
> index 65d9489..9c688bf 100644
> --- a/arch/arm/kernel/head.S
> +++ b/arch/arm/kernel/head.S
> @@ -205,15 +205,32 @@ __create_page_tables:
>  #endif
>  
>  	/*
> -	 * Then map first 1MB of ram in case it contains our boot params.
> +	 * Then map first 1MB of ram if boot params address is not specified.
>  	 */
> +	cmp	r2, #0
> +	bne	1f
>  	add	r0, r4, #PAGE_OFFSET >> 18
>  	orr	r6, r7, #(PHYS_OFFSET & 0xff000000)
>  	.if	(PHYS_OFFSET & 0x00f00000)
>  	orr	r6, r6, #(PHYS_OFFSET & 0x00f00000)
>  	.endif
>  	str	r6, [r0]
> +	b	2f
>  
> +	/*
> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
> +	 */
> +1:	mov	r0, r2, lsr #20
> +	mov	r0, r0, lsl #20
> +	sub	r3, r0, #(PHYS_OFFSET & 0xff000000)
> +	.if	(PHYS_OFFSET & 0x00f00000)
> +	sub	r3, r3, #(PHYS_OFFSET & 0x00f00000)
> +	.endif
> +	add	r3, r3, #PAGE_OFFSET
> +	add	r3, r4, r3, lsr #18
> +	orr	r6, r7, r0
> +	str	r6, [r3]
> +2:
>  #ifdef CONFIG_DEBUG_LL
>  #ifndef CONFIG_DEBUG_ICEDCC
>  	/*
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] ARM: map ATAGs when not in first 1MB of RAM
@ 2011-02-02  3:26     ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2011-02-02  3:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 27, 2011 at 09:50:43AM -0600, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> If ATAGs or DTB pointer is not within first 1MB of RAM, then the boot params
> will not be mapped early enough, so map the 1MB region that r2 points to. Only
> map the first 1MB when r2 is 0.
> 
> Some assembly improvements from Nicolas Pitre.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>

I'll try temporarily picking this one up into my devicetree/test
branch until Russell's p2v patches get merged into mainline.

Thanks!
g.

> ---
>  arch/arm/kernel/head.S |   19 ++++++++++++++++++-
>  1 files changed, 18 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
> index 65d9489..9c688bf 100644
> --- a/arch/arm/kernel/head.S
> +++ b/arch/arm/kernel/head.S
> @@ -205,15 +205,32 @@ __create_page_tables:
>  #endif
>  
>  	/*
> -	 * Then map first 1MB of ram in case it contains our boot params.
> +	 * Then map first 1MB of ram if boot params address is not specified.
>  	 */
> +	cmp	r2, #0
> +	bne	1f
>  	add	r0, r4, #PAGE_OFFSET >> 18
>  	orr	r6, r7, #(PHYS_OFFSET & 0xff000000)
>  	.if	(PHYS_OFFSET & 0x00f00000)
>  	orr	r6, r6, #(PHYS_OFFSET & 0x00f00000)
>  	.endif
>  	str	r6, [r0]
> +	b	2f
>  
> +	/*
> +	 * Otherwise map the 1MB region r2 points to (atags or dtb)
> +	 */
> +1:	mov	r0, r2, lsr #20
> +	mov	r0, r0, lsl #20
> +	sub	r3, r0, #(PHYS_OFFSET & 0xff000000)
> +	.if	(PHYS_OFFSET & 0x00f00000)
> +	sub	r3, r3, #(PHYS_OFFSET & 0x00f00000)
> +	.endif
> +	add	r3, r3, #PAGE_OFFSET
> +	add	r3, r4, r3, lsr #18
> +	orr	r6, r7, r0
> +	str	r6, [r3]
> +2:
>  #ifdef CONFIG_DEBUG_LL
>  #ifndef CONFIG_DEBUG_ICEDCC
>  	/*
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2011-02-02  3:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 15:50 [PATCH] ARM: map ATAGs when not in first 1MB of RAM Rob Herring
2011-01-27 15:50 ` Rob Herring
2011-01-27 16:31 ` Russell King - ARM Linux
2011-01-27 16:31   ` Russell King - ARM Linux
     [not found]   ` <20110127163149.GF25968-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-01-27 17:41     ` Rob Herring
2011-01-27 17:41       ` Rob Herring
     [not found]       ` <4D41AE4A.1000105-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-01-27 17:46         ` Russell King - ARM Linux
2011-01-27 17:46           ` Russell King - ARM Linux
     [not found] ` <1296143443-9442-1-git-send-email-robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-02-02  3:26   ` Grant Likely
2011-02-02  3:26     ` Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.