diff mbox

ioremap() fail on physical address 0x0 in 3.4 kernel

Message ID 20120822095302.GX18957@n2100.arm.linux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Russell King - ARM Linux Aug. 22, 2012, 9:53 a.m. UTC
On Wed, Aug 22, 2012 at 12:16:08PM +0530, Trilok Soni wrote:
> Thanks for the patch, but how about just checking pmd_none on such  
> addresses and since there won't be any mapping created for such gaps? We  
> need to check if this is fine for all, since I remember that Nico
> added these functions for the OMAP boot issue I guess.

A better solution would be as below - this requires no changes to the
existing ioremap code, we just mark these differently.

Comments

Russell King - ARM Linux Aug. 22, 2012, 11:23 a.m. UTC | #1
On Wed, Aug 22, 2012 at 10:53:02AM +0100, Russell King - ARM Linux wrote:
> @@ -826,7 +826,7 @@ static void __init fill_pmd_gaps(void)
>  
>  	/* we're still single threaded hence no lock needed here */
>  	for (vm = vmlist; vm; vm = vm->next) {
> -		if (!(vm->flags & VM_ARM_STATIC_MAPPING))
> +		if (!(vm->flags & (VM_ARM_STATIC_MAPPING | VM_ARM_EMPTY_MAPPING))

Not forgetting the additional close paren needed here...
Murali Nalajala Aug. 22, 2012, 12:03 p.m. UTC | #2
On 8/22/2012 3:23 PM, Russell King - ARM Linux wrote:
> On Wed, Aug 22, 2012 at 12:16:08PM +0530, Trilok Soni wrote:
>> Thanks for the patch, but how about just checking pmd_none on such
>> addresses and since there won't be any mapping created for such gaps? We
>> need to check if this is fine for all, since I remember that Nico
>> added these functions for the OMAP boot issue I guess.
>
> A better solution would be as below - this requires no changes to the
> existing ioremap code, we just mark these differently.
>
> diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
> index 2e8a1ef..87fa3f2 100644
> --- a/arch/arm/mm/mm.h
> +++ b/arch/arm/mm/mm.h
> @@ -55,6 +55,9 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
>   /* permanent static mappings from iotable_init() */
>   #define VM_ARM_STATIC_MAPPING	0x40000000
>
> +/* empty mapping */
> +#define VM_ARM_EMPTY_MAPPING	0x20000000
> +
>   /* mapping type (attributes) for permanent static mappings */
>   #define VM_ARM_MTYPE(mt)		((mt)<<  20)
>   #define VM_ARM_MTYPE_MASK	(0x1f<<  20)
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index cf4528d..da90ef1 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -813,7 +813,7 @@ static void __init pmd_empty_section_gap(unsigned long addr)
>   	vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm));
>   	vm->addr = (void *)addr;
>   	vm->size = SECTION_SIZE;
> -	vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING;
> +	vm->flags = VM_IOREMAP | VM_ARM_EMPTY_MAPPING;
>   	vm->caller = pmd_empty_section_gap;
>   	vm_area_add_early(vm);
>   }
> @@ -826,7 +826,7 @@ static void __init fill_pmd_gaps(void)
>
>   	/* we're still single threaded hence no lock needed here */
>   	for (vm = vmlist; vm; vm = vm->next) {
> -		if (!(vm->flags&  VM_ARM_STATIC_MAPPING))
> +		if (!(vm->flags&  (VM_ARM_STATIC_MAPPING | VM_ARM_EMPTY_MAPPING))
>   			continue;
>   		addr = (unsigned long)vm->addr;
>   		if (addr<  next)
>
Tested on MSM platform

Tested-by: Murali Nalajala <mnalajal@codeaurora.org>

Thanks,
Murali N
Nicolas Pitre Aug. 22, 2012, 1:19 p.m. UTC | #3
On Wed, 22 Aug 2012, Russell King - ARM Linux wrote:

> On Wed, Aug 22, 2012 at 10:53:02AM +0100, Russell King - ARM Linux wrote:
> > @@ -826,7 +826,7 @@ static void __init fill_pmd_gaps(void)
> >  
> >  	/* we're still single threaded hence no lock needed here */
> >  	for (vm = vmlist; vm; vm = vm->next) {
> > -		if (!(vm->flags & VM_ARM_STATIC_MAPPING))
> > +		if (!(vm->flags & (VM_ARM_STATIC_MAPPING | VM_ARM_EMPTY_MAPPING))
> 
> Not forgetting the additional close paren needed here...

Acked-by: Nicolas Pitre <nico@linaro.org>


Nicolas
diff mbox

Patch

diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 2e8a1ef..87fa3f2 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -55,6 +55,9 @@  extern void __flush_dcache_page(struct address_space *mapping, struct page *page
 /* permanent static mappings from iotable_init() */
 #define VM_ARM_STATIC_MAPPING	0x40000000
 
+/* empty mapping */
+#define VM_ARM_EMPTY_MAPPING	0x20000000
+
 /* mapping type (attributes) for permanent static mappings */
 #define VM_ARM_MTYPE(mt)		((mt) << 20)
 #define VM_ARM_MTYPE_MASK	(0x1f << 20)
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index cf4528d..da90ef1 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -813,7 +813,7 @@  static void __init pmd_empty_section_gap(unsigned long addr)
 	vm = early_alloc_aligned(sizeof(*vm), __alignof__(*vm));
 	vm->addr = (void *)addr;
 	vm->size = SECTION_SIZE;
-	vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING;
+	vm->flags = VM_IOREMAP | VM_ARM_EMPTY_MAPPING;
 	vm->caller = pmd_empty_section_gap;
 	vm_area_add_early(vm);
 }
@@ -826,7 +826,7 @@  static void __init fill_pmd_gaps(void)
 
 	/* we're still single threaded hence no lock needed here */
 	for (vm = vmlist; vm; vm = vm->next) {
-		if (!(vm->flags & VM_ARM_STATIC_MAPPING))
+		if (!(vm->flags & (VM_ARM_STATIC_MAPPING | VM_ARM_EMPTY_MAPPING))
 			continue;
 		addr = (unsigned long)vm->addr;
 		if (addr < next)