public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region
@ 2013-11-29  0:00 Ezequiel Garcia
  2013-11-29 18:26 ` David Heidelberger
  2014-04-09 16:26 ` Laurent Pinchart
  0 siblings, 2 replies; 4+ messages in thread
From: Ezequiel Garcia @ 2013-11-29  0:00 UTC (permalink / raw)
  To: linux-arm-kernel

In order to remove the following ugly message:

  BUG: mapping for 0x00000000 at 0xff000000 out of vmalloc space

the iotable mappings should be re-located inside the vmalloc
region. Such move was introduced at commit:

commit 0536bdf33faff4d940ac094c77998cfac368cfff
Author: Nicolas Pitre <nicolas.pitre@linaro.org>
Date:   Thu Aug 25 00:35:59 2011 -0400

    ARM: move iotable mappings within the vmalloc region

While at it, condition the mapping to PXA25x and PXA27x, which
are the only platforms where it's used.

Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: David Heidelberger <david.heidelberger@ixit.cz>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
David,

Is it possible for you to give this a try on your board?

 arch/arm/mach-pxa/generic.c               | 6 ++++--
 arch/arm/mach-pxa/include/mach/hardware.h | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 4225417..3c1b4fa 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -83,11 +83,13 @@ static struct map_desc common_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(0x40000000),
 		.length		= 0x02000000,
 		.type		= MT_DEVICE
+#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
 	}, {	/* UNCACHED_PHYS_0 */
-		.virtual	= 0xff000000,
+		.virtual	= UNCACHED_PHYS_0,
 		.pfn		= __phys_to_pfn(0x00000000),
-		.length		= 0x00100000,
+		.length		= UNCACHED_SIZE,
 		.type		= MT_DEVICE
+#endif
 	}
 };
 
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index ccb06e4..b365a72 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -14,13 +14,14 @@
 #define __ASM_ARCH_HARDWARE_H
 
 #include <mach/addr-map.h>
+#include <asm/pgtable.h>
 
 /*
  * Workarounds for at least 2 errata so far require this.
  * The mapping is set in mach-pxa/generic.c.
  */
-#define UNCACHED_PHYS_0		0xff000000
-#define UNCACHED_ADDR		UNCACHED_PHYS_0
+#define UNCACHED_PHYS_0		(VMALLOC_END - UNCACHED_SIZE)
+#define UNCACHED_SIZE		SZ_1M
 
 /*
  * Intel PXA2xx internal register mapping:
-- 
1.8.1.5

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

* [PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region
  2013-11-29  0:00 [PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region Ezequiel Garcia
@ 2013-11-29 18:26 ` David Heidelberger
  2014-04-09 16:26 ` Laurent Pinchart
  1 sibling, 0 replies; 4+ messages in thread
From: David Heidelberger @ 2013-11-29 18:26 UTC (permalink / raw)
  To: linux-arm-kernel

Build fails with this patch with:
arch/arm/mach-pxa/standby.S:25: Error: missing ')'
arch/arm/mach-pxa/standby.S:25: Error: garbage following instruction -- 
`mov r3,#(0xff000000UL-0x00100000)'

After replace VMALLOC_END to 0xff000000 (without UL) it fails with:

arch/arm/mach-pxa/sleep.S:52: Error: invalid constant (fffffffffef00000) 
after fixup

it will probably fail everywhere in asm code, where is declared 
UNCACHED_PHYS_0

Thank you,
David

Dne 2013-11-29 01:00, Ezequiel Garcia napsal:
> In order to remove the following ugly message:
> 
>   BUG: mapping for 0x00000000 at 0xff000000 out of vmalloc space
> 
> the iotable mappings should be re-located inside the vmalloc
> region. Such move was introduced at commit:
> 
> commit 0536bdf33faff4d940ac094c77998cfac368cfff
> Author: Nicolas Pitre <nicolas.pitre@linaro.org>
> Date:   Thu Aug 25 00:35:59 2011 -0400
> 
>     ARM: move iotable mappings within the vmalloc region
> 
> While at it, condition the mapping to PXA25x and PXA27x, which
> are the only platforms where it's used.
> 
> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
> Cc: David Heidelberger <david.heidelberger@ixit.cz>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> David,
> 
> Is it possible for you to give this a try on your board?
> 
>  arch/arm/mach-pxa/generic.c               | 6 ++++--
>  arch/arm/mach-pxa/include/mach/hardware.h | 5 +++--
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
> index 4225417..3c1b4fa 100644
> --- a/arch/arm/mach-pxa/generic.c
> +++ b/arch/arm/mach-pxa/generic.c
> @@ -83,11 +83,13 @@ static struct map_desc common_io_desc[] __initdata 
> = {
>  		.pfn		= __phys_to_pfn(0x40000000),
>  		.length		= 0x02000000,
>  		.type		= MT_DEVICE
> +#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
>  	}, {	/* UNCACHED_PHYS_0 */
> -		.virtual	= 0xff000000,
> +		.virtual	= UNCACHED_PHYS_0,
>  		.pfn		= __phys_to_pfn(0x00000000),
> -		.length		= 0x00100000,
> +		.length		= UNCACHED_SIZE,
>  		.type		= MT_DEVICE
> +#endif
>  	}
>  };
> 
> diff --git a/arch/arm/mach-pxa/include/mach/hardware.h
> b/arch/arm/mach-pxa/include/mach/hardware.h
> index ccb06e4..b365a72 100644
> --- a/arch/arm/mach-pxa/include/mach/hardware.h
> +++ b/arch/arm/mach-pxa/include/mach/hardware.h
> @@ -14,13 +14,14 @@
>  #define __ASM_ARCH_HARDWARE_H
> 
>  #include <mach/addr-map.h>
> +#include <asm/pgtable.h>
> 
>  /*
>   * Workarounds for at least 2 errata so far require this.
>   * The mapping is set in mach-pxa/generic.c.
>   */
> -#define UNCACHED_PHYS_0		0xff000000
> -#define UNCACHED_ADDR		UNCACHED_PHYS_0
> +#define UNCACHED_PHYS_0		(VMALLOC_END - UNCACHED_SIZE)
> +#define UNCACHED_SIZE		SZ_1M
> 
>  /*
>   * Intel PXA2xx internal register mapping:

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

* [PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region
  2013-11-29  0:00 [PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region Ezequiel Garcia
  2013-11-29 18:26 ` David Heidelberger
@ 2014-04-09 16:26 ` Laurent Pinchart
  2014-04-09 16:33   ` Ezequiel Garcia
  1 sibling, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2014-04-09 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ezequiel,

On Thursday 28 November 2013 21:00:43 Ezequiel Garcia wrote:
> In order to remove the following ugly message:
> 
>   BUG: mapping for 0x00000000 at 0xff000000 out of vmalloc space
> 
> the iotable mappings should be re-located inside the vmalloc
> region. Such move was introduced at commit:
> 
> commit 0536bdf33faff4d940ac094c77998cfac368cfff
> Author: Nicolas Pitre <nicolas.pitre@linaro.org>
> Date:   Thu Aug 25 00:35:59 2011 -0400
> 
>     ARM: move iotable mappings within the vmalloc region
> 
> While at it, condition the mapping to PXA25x and PXA27x, which
> are the only platforms where it's used.
> 
> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
> Cc: David Heidelberger <david.heidelberger@ixit.cz>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> David,
> 
> Is it possible for you to give this a try on your board?

I'm running into the same issue on a PXA270 system.

UNCACHED_PHYS_0 is used as an immediate operand to a mov instruction, and thus 
needs to be encoded as a shifted 8-bit value. One simple solution would be to 
hardcode it to 0xfd000000 (0xfe000000 is already used for the IMEMC mapping).

Another solution would be to keep the UNCACHED_PHYS_0 mapping at the end of 
the vmalloc area (with a fix for the UL problem due to VMALLOC_END) and modify 
pxa2[57]x_finish_suspend and pm_enter_standby_start to use an ldr instruction 
instead of a move instruction to load the address.

As a side note, the IMEMC mapping seems unused, maybe we could thus reclaim it 
and use 0xfe000000 for UNCACHED_PHYS_0.

Do you plan to submit a v3 of this patch ?

>  arch/arm/mach-pxa/generic.c               | 6 ++++--
>  arch/arm/mach-pxa/include/mach/hardware.h | 5 +++--
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
> index 4225417..3c1b4fa 100644
> --- a/arch/arm/mach-pxa/generic.c
> +++ b/arch/arm/mach-pxa/generic.c
> @@ -83,11 +83,13 @@ static struct map_desc common_io_desc[] __initdata = {
>  		.pfn		= __phys_to_pfn(0x40000000),
>  		.length		= 0x02000000,
>  		.type		= MT_DEVICE
> +#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
>  	}, {	/* UNCACHED_PHYS_0 */
> -		.virtual	= 0xff000000,
> +		.virtual	= UNCACHED_PHYS_0,
>  		.pfn		= __phys_to_pfn(0x00000000),
> -		.length		= 0x00100000,
> +		.length		= UNCACHED_SIZE,
>  		.type		= MT_DEVICE
> +#endif
>  	}
>  };
> 
> diff --git a/arch/arm/mach-pxa/include/mach/hardware.h
> b/arch/arm/mach-pxa/include/mach/hardware.h index ccb06e4..b365a72 100644
> --- a/arch/arm/mach-pxa/include/mach/hardware.h
> +++ b/arch/arm/mach-pxa/include/mach/hardware.h
> @@ -14,13 +14,14 @@
>  #define __ASM_ARCH_HARDWARE_H
> 
>  #include <mach/addr-map.h>
> +#include <asm/pgtable.h>
> 
>  /*
>   * Workarounds for at least 2 errata so far require this.
>   * The mapping is set in mach-pxa/generic.c.
>   */
> -#define UNCACHED_PHYS_0		0xff000000
> -#define UNCACHED_ADDR		UNCACHED_PHYS_0
> +#define UNCACHED_PHYS_0		(VMALLOC_END - UNCACHED_SIZE)
> +#define UNCACHED_SIZE		SZ_1M
> 
>  /*
>   * Intel PXA2xx internal register mapping:

-- 
Regards,

Laurent Pinchart

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

* [PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region
  2014-04-09 16:26 ` Laurent Pinchart
@ 2014-04-09 16:33   ` Ezequiel Garcia
  0 siblings, 0 replies; 4+ messages in thread
From: Ezequiel Garcia @ 2014-04-09 16:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Apr 09, Laurent Pinchart wrote:
> Hi Ezequiel,
> 
> On Thursday 28 November 2013 21:00:43 Ezequiel Garcia wrote:
> > In order to remove the following ugly message:
> > 
> >   BUG: mapping for 0x00000000 at 0xff000000 out of vmalloc space
> > 
> > the iotable mappings should be re-located inside the vmalloc
> > region. Such move was introduced at commit:
> > 
> > commit 0536bdf33faff4d940ac094c77998cfac368cfff
> > Author: Nicolas Pitre <nicolas.pitre@linaro.org>
> > Date:   Thu Aug 25 00:35:59 2011 -0400
> > 
> >     ARM: move iotable mappings within the vmalloc region
> > 
> > While at it, condition the mapping to PXA25x and PXA27x, which
> > are the only platforms where it's used.
> > 
> > Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> > Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
> > Cc: David Heidelberger <david.heidelberger@ixit.cz>
> > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> > ---
> > David,
> > 
> > Is it possible for you to give this a try on your board?
> 
> I'm running into the same issue on a PXA270 system.
> 
> UNCACHED_PHYS_0 is used as an immediate operand to a mov instruction, and thus 
> needs to be encoded as a shifted 8-bit value. One simple solution would be to 
> hardcode it to 0xfd000000 (0xfe000000 is already used for the IMEMC mapping).
> 
> Another solution would be to keep the UNCACHED_PHYS_0 mapping at the end of 
> the vmalloc area (with a fix for the UL problem due to VMALLOC_END) and modify 
> pxa2[57]x_finish_suspend and pm_enter_standby_start to use an ldr instruction 
> instead of a move instruction to load the address.
> 
> As a side note, the IMEMC mapping seems unused, maybe we could thus reclaim it 
> and use 0xfe000000 for UNCACHED_PHYS_0.
> 
> Do you plan to submit a v3 of this patch ?
> 

Not really. I've been a bit busy and couldn't work any longer on this issue,
so feel free to pick the task :-)
-- 
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

end of thread, other threads:[~2014-04-09 16:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29  0:00 [PATCH v2] ARM: pxa: Move iotable mapping inside vmalloc region Ezequiel Garcia
2013-11-29 18:26 ` David Heidelberger
2014-04-09 16:26 ` Laurent Pinchart
2014-04-09 16:33   ` Ezequiel Garcia

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