mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] ARM: vector_table: Fix creation of second level page table
@ 2016-08-25  6:36 Sascha Hauer
  2016-08-25 21:32 ` Peter Kardos
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2016-08-25  6:36 UTC (permalink / raw)
  To: Barebox List

The second level page tables can only start at a 1MiB section boundary,
so instead of calling arm_create_pte() with the high vector address
(which is 0xffff0000, not 1MiB aligned) we have to call it with
0xfff00000 to correctly create a second level page table.
The old values broke SoCs which have peripherals in the upper 1MiB
area, like for example the Atmel AT91RM9200. On these Socs we correctly
created the vector page, but the pages around it did not have a 1:1
mapping anymore which led to unreachable peripherals.

Fixes: f6b77fe9: ARM: Rework vector table setup

Reported-by: Peter Kardos <kardos.peter.sk@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Changes since v1:
- Use ALIGN_DOWN instead of open coded alignment
- more clear commit message

 arch/arm/cpu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index a31bce4..459abe5 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -307,7 +307,7 @@ static void create_vector_table(unsigned long adr)
 		vectors = xmemalign(PAGE_SIZE, PAGE_SIZE);
 		pr_debug("Creating vector table, virt = 0x%p, phys = 0x%08lx\n",
 			 vectors, adr);
-		exc = arm_create_pte(adr);
+		exc = arm_create_pte(ALIGN_DOWN(adr, SZ_1M));
 		idx = (adr & (SZ_1M - 1)) >> PAGE_SHIFT;
 		exc[idx] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached;
 	}
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] ARM: vector_table: Fix creation of second level page table
  2016-08-25  6:36 [PATCH v2] ARM: vector_table: Fix creation of second level page table Sascha Hauer
@ 2016-08-25 21:32 ` Peter Kardos
  2016-08-26  5:45   ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Kardos @ 2016-08-25 21:32 UTC (permalink / raw)
  To: barebox

Tested this one as well  with my AT91RM9200 system, v2016.08 + patch; 
The system starts/boots as expected.
If no one objects, we can consider this issue closed/fixed.

Peter

On 8/25/2016 8:36 AM, Sascha Hauer wrote:
> The second level page tables can only start at a 1MiB section boundary,
> so instead of calling arm_create_pte() with the high vector address
> (which is 0xffff0000, not 1MiB aligned) we have to call it with
> 0xfff00000 to correctly create a second level page table.
> The old values broke SoCs which have peripherals in the upper 1MiB
> area, like for example the Atmel AT91RM9200. On these Socs we correctly
> created the vector page, but the pages around it did not have a 1:1
> mapping anymore which led to unreachable peripherals.
>
> Fixes: f6b77fe9: ARM: Rework vector table setup
>
> Reported-by: Peter Kardos <kardos.peter.sk@gmail.com>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>
> Changes since v1:
> - Use ALIGN_DOWN instead of open coded alignment
> - more clear commit message
>
>   arch/arm/cpu/mmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
> index a31bce4..459abe5 100644
> --- a/arch/arm/cpu/mmu.c
> +++ b/arch/arm/cpu/mmu.c
> @@ -307,7 +307,7 @@ static void create_vector_table(unsigned long adr)
>   		vectors = xmemalign(PAGE_SIZE, PAGE_SIZE);
>   		pr_debug("Creating vector table, virt = 0x%p, phys = 0x%08lx\n",
>   			 vectors, adr);
> -		exc = arm_create_pte(adr);
> +		exc = arm_create_pte(ALIGN_DOWN(adr, SZ_1M));
>   		idx = (adr & (SZ_1M - 1)) >> PAGE_SHIFT;
>   		exc[idx] = (u32)vectors | PTE_TYPE_SMALL | pte_flags_cached;
>   	}


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] ARM: vector_table: Fix creation of second level page table
  2016-08-25 21:32 ` Peter Kardos
@ 2016-08-26  5:45   ` Sascha Hauer
  2016-08-27 19:09     ` Peter Kardos
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2016-08-26  5:45 UTC (permalink / raw)
  To: Peter Kardos; +Cc: barebox

On Thu, Aug 25, 2016 at 11:32:43PM +0200, Peter Kardos wrote:
> Tested this one as well  with my AT91RM9200 system, v2016.08 + patch; The
> system starts/boots as expected.
> If no one objects, we can consider this issue closed/fixed.

I took this as a
Tested-by: Peter Kardos <kardos.peter.sk@gmail.com>

Thanks for testing.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] ARM: vector_table: Fix creation of second level page table
  2016-08-26  5:45   ` Sascha Hauer
@ 2016-08-27 19:09     ` Peter Kardos
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Kardos @ 2016-08-27 19:09 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Thanks for the fix.

Peter

On 8/26/2016 7:45 AM, Sascha Hauer wrote:
> On Thu, Aug 25, 2016 at 11:32:43PM +0200, Peter Kardos wrote:
>> Tested this one as well  with my AT91RM9200 system, v2016.08 + patch; The
>> system starts/boots as expected.
>> If no one objects, we can consider this issue closed/fixed.
> I took this as a
> Tested-by: Peter Kardos <kardos.peter.sk@gmail.com>
>
> Thanks for testing.
>
> Sascha
>


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2016-08-27 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-25  6:36 [PATCH v2] ARM: vector_table: Fix creation of second level page table Sascha Hauer
2016-08-25 21:32 ` Peter Kardos
2016-08-26  5:45   ` Sascha Hauer
2016-08-27 19:09     ` Peter Kardos

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