Skip to contentSkip to conversation

ARM: pxa: Fix out of vmalloc space bug

PATCH Superseded Laurent Pinchart 4 participants 11 messages Apr 9, 2014 – Jul 11, 2014

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover ARM: pxa: Fix out of vmalloc space bug

Hello,

(Resending due to a typo in an e-mail address that caused LAKML to reject the mails. Sorry about the noise.)

This patch set reworks Ezequiel Garcia's previous fix [1] of an out of vmalloc space bug on PXA2[57]x platforms caused by an attempt to map the start of physical uncached outside of the vmalloc space.

This first three patches perform a couple of cleanups, and the last patch fixes the problem. I've decided to map the memory at address 0xfe000000 to minimize changes to the code, but this causes a bit of fragmentation of vmalloc space. I could map it to the very end of vmalloc space (0xfef00000) instead if preferred, which would involve replacing a mov by an ldr in pxa2[57]x_finish_suspend and pm_enter_standby_start.

I've tested the patch set on a PXA270-based system.

[1] https://lkml.org/lkml/2013/11/28/474

Ezequiel Garcia (1):
ARM: pxa: Move iotable mapping inside vmalloc region

Laurent Pinchart (3):
ARM: pxa: Don't hardcode addresses and size in map_desc tables
ARM: pxa: Move UNCACHED_PHYS_0 mapping from generic.c to pxa2[57]x.c
ARM: pxa: pxa27x: Don't map IMEMC region statically

 arch/arm/mach-pxa/generic.c               | 11 +++--------
 arch/arm/mach-pxa/include/mach/hardware.h |  4 ++--
 arch/arm/mach-pxa/pxa25x.c                |  7 ++++++-
 arch/arm/mach-pxa/pxa27x.c                | 10 +++++-----
 arch/arm/mach-pxa/pxa3xx.c                |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart
#1 lore raw

PATCH v3 1/4 ARM: pxa: Don't hardcode addresses and size in map_desc tables

The virtual address, physical address and size of all regions for which we create static mappings are defined in PXA headers. Replaced the hardcoded values with macros.

---
 arch/arm/mach-pxa/generic.c               | 10 +++++-----
 arch/arm/mach-pxa/include/mach/hardware.h |  2 +-
 arch/arm/mach-pxa/pxa25x.c                |  2 +-
 arch/arm/mach-pxa/pxa27x.c                |  8 ++++----
 arch/arm/mach-pxa/pxa3xx.c                |  2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)
arch/arm/mach-pxa/generic.c +5 -5
index 4225417..4bc0a2c 100644
@@ -79,14 +79,14 @@ EXPORT_SYMBOL(get_clk_frequency_khz);
  */
 static struct map_desc common_io_desc[] __initdata = {
   	{	/* Devs */
-		.virtual	=  0xf2000000,
-		.pfn		= __phys_to_pfn(0x40000000),
-		.length		= 0x02000000,
+		.virtual	= (unsigned long)PERIPH_VIRT,
+		.pfn		= __phys_to_pfn(PERIPH_PHYS),
+		.length		= PERIPH_SIZE,
 		.type		= MT_DEVICE
 	}, {	/* UNCACHED_PHYS_0 */
-		.virtual	= 0xff000000,
+		.virtual	= UNCACHED_PHYS_0,
 		.pfn		= __phys_to_pfn(0x00000000),
-		.length		= 0x00100000,
+		.length		= UNCACHED_PHYS_0_SIZE,
 		.type		= MT_DEVICE
 	}
 };
arch/arm/mach-pxa/include/mach/hardware.h +1 -1
index ccb06e4..efb3965 100644
@@ -20,7 +20,7 @@
  * The mapping is set in mach-pxa/generic.c.
  */
 #define UNCACHED_PHYS_0		0xff000000
-#define UNCACHED_ADDR		UNCACHED_PHYS_0
+#define UNCACHED_PHYS_0_SIZE	0x00100000
 
 /*
  * Intel PXA2xx internal register mapping:
arch/arm/mach-pxa/pxa25x.c +1 -1
index f2c2897..926c506 100644
@@ -331,7 +331,7 @@ static struct map_desc pxa25x_io_desc[] __initdata = {
 	{	/* Mem Ctl */
 		.virtual	= (unsigned long)SMEMC_VIRT,
 		.pfn		= __phys_to_pfn(PXA2XX_SMEMC_BASE),
-		.length		= 0x00200000,
+		.length		= SMEMC_SIZE,
 		.type		= MT_DEVICE
 	},
 };
arch/arm/mach-pxa/pxa27x.c +4 -4
index 301471a..4405644 100644
@@ -402,12 +402,12 @@ static struct map_desc pxa27x_io_desc[] __initdata = {
 	{	/* Mem Ctl */
 		.virtual	= (unsigned long)SMEMC_VIRT,
 		.pfn		= __phys_to_pfn(PXA2XX_SMEMC_BASE),
-		.length		= 0x00200000,
+		.length		= SMEMC_SIZE,
 		.type		= MT_DEVICE
 	}, {	/* IMem ctl */
-		.virtual	=  0xfe000000,
-		.pfn		= __phys_to_pfn(0x58000000),
-		.length		= 0x00100000,
+		.virtual	= (unsigned long)IMEMC_VIRT,
+		.pfn		= __phys_to_pfn(IMEMC_PHYS),
+		.length		= IMEMC_SIZE,
 		.type		= MT_DEVICE
 	},
 };
arch/arm/mach-pxa/pxa3xx.c +1 -1
index 87011f3..593ccd35 100644
@@ -416,7 +416,7 @@ static struct map_desc pxa3xx_io_desc[] __initdata = {
 	{	/* Mem Ctl */
 		.virtual	= (unsigned long)SMEMC_VIRT,
 		.pfn		= __phys_to_pfn(PXA3XX_SMEMC_BASE),
-		.length		= 0x00200000,
+		.length		= SMEMC_SIZE,
 		.type		= MT_DEVICE
 	}
 };
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH v3 2/4 ARM: pxa: Move UNCACHED_PHYS_0 mapping from generic.c to pxa2[57]x.c

In reply to Laurent Pinchart

The UNCACHED_PHYS_0 mapping is only needed on PXA25x and PXA27x platforms. Move it to pxa25x.c and pxa27x.c to avoid wasting vmalloc space on PXA3xx.

---
 arch/arm/mach-pxa/generic.c | 5 -----
 arch/arm/mach-pxa/pxa25x.c  | 5 +++++
 arch/arm/mach-pxa/pxa27x.c  | 5 +++++
 3 files changed, 10 insertions(+), 5 deletions(-)
arch/arm/mach-pxa/generic.c +0 -5
index 4bc0a2c..6bd7f36 100644
@@ -83,11 +83,6 @@ static struct map_desc common_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(PERIPH_PHYS),
 		.length		= PERIPH_SIZE,
 		.type		= MT_DEVICE
-	}, {	/* UNCACHED_PHYS_0 */
-		.virtual	= UNCACHED_PHYS_0,
-		.pfn		= __phys_to_pfn(0x00000000),
-		.length		= UNCACHED_PHYS_0_SIZE,
-		.type		= MT_DEVICE
 	}
 };
 
arch/arm/mach-pxa/pxa25x.c +5 -0
index 926c506..66e4a2b 100644
@@ -333,6 +333,11 @@ static struct map_desc pxa25x_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(PXA2XX_SMEMC_BASE),
 		.length		= SMEMC_SIZE,
 		.type		= MT_DEVICE
+	}, {	/* UNCACHED_PHYS_0 */
+		.virtual	= UNCACHED_PHYS_0,
+		.pfn		= __phys_to_pfn(0x00000000),
+		.length		= UNCACHED_PHYS_0_SIZE,
+		.type		= MT_DEVICE
 	},
 };
 
arch/arm/mach-pxa/pxa27x.c +5 -0
index 4405644..6cc0f46 100644
@@ -409,6 +409,11 @@ static struct map_desc pxa27x_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(IMEMC_PHYS),
 		.length		= IMEMC_SIZE,
 		.type		= MT_DEVICE
+	}, {	/* UNCACHED_PHYS_0 */
+		.virtual	= UNCACHED_PHYS_0,
+		.pfn		= __phys_to_pfn(0x00000000),
+		.length		= UNCACHED_PHYS_0_SIZE,
+		.type		= MT_DEVICE
 	},
 };
 
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH v3 3/4 ARM: pxa: pxa27x: Don't map IMEMC region statically

In reply to Laurent Pinchart

The IMEMC mapping not only has no user, but maps a reserved memory space. It just wastes vmalloc space, remove it.

---
 arch/arm/mach-pxa/pxa27x.c | 5 -----
 1 file changed, 5 deletions(-)
arch/arm/mach-pxa/pxa27x.c +0 -5
index 6cc0f46..b040d7d 100644
@@ -404,11 +404,6 @@ static struct map_desc pxa27x_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(PXA2XX_SMEMC_BASE),
 		.length		= SMEMC_SIZE,
 		.type		= MT_DEVICE
-	}, {	/* IMem ctl */
-		.virtual	= (unsigned long)IMEMC_VIRT,
-		.pfn		= __phys_to_pfn(IMEMC_PHYS),
-		.length		= IMEMC_SIZE,
-		.type		= MT_DEVICE
 	}, {	/* UNCACHED_PHYS_0 */
 		.virtual	= UNCACHED_PHYS_0,
 		.pfn		= __phys_to_pfn(0x00000000),
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH v3 4/4 ARM: pxa: Move iotable mapping inside vmalloc region

In reply to Laurent Pinchart

From: Ezequiel Garcia <[email protected]>

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 <[email protected]>
Date:   Thu Aug 25 00:35:59 2011 -0400

ARM: move iotable mappings within the vmalloc region

[laurent.pinchart at ideasonboard.com: Hardcode the virtual address]
---
 arch/arm/mach-pxa/include/mach/hardware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/include/mach/hardware.h +1 -1
index efb3965..8d63c21 100644
@@ -19,7 +19,7 @@
  * 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_PHYS_0		0xfe000000
 #define UNCACHED_PHYS_0_SIZE	0x00100000
 
 /*
Signature · 1 line
1.8.3.2
#5 lore raw

v3 cover ARM: pxa: Fix out of vmalloc space bug

In reply to Laurent Pinchart
Quoted 9 lines · Laurent Pinchart

Hello,

(Resending due to a typo in an e-mail address that caused LAKML to reject the mails. Sorry about the noise.)

This patch set reworks Ezequiel Garcia's previous fix [1] of an out of vmalloc space bug on PXA2[57]x platforms caused by an attempt to map the start of physical uncached outside of the vmalloc space.

Quoted 8 lines

This first three patches perform a couple of cleanups, and the last patch fixes the problem. I've decided to map the memory at address 0xfe000000 to minimize changes to the code, but this causes a bit of fragmentation of vmalloc space. I could map it to the very end of vmalloc space (0xfef00000) instead if preferred, which would involve replacing a mov by an ldr in pxa2[57]x_finish_suspend and pm_enter_standby_start.

I've tested the patch set on a PXA270-based system.

For those patches:

Quoted 29 lines

[1] https://lkml.org/lkml/2013/11/28/474

Ezequiel Garcia (1):
ARM: pxa: Move iotable mapping inside vmalloc region

Laurent Pinchart (3):
ARM: pxa: Don't hardcode addresses and size in map_desc tables
ARM: pxa: Move UNCACHED_PHYS_0 mapping from generic.c to pxa2[57]x.c
ARM: pxa: pxa27x: Don't map IMEMC region statically

 arch/arm/mach-pxa/generic.c               | 11 +++--------
 arch/arm/mach-pxa/include/mach/hardware.h |  4 ++--
 arch/arm/mach-pxa/pxa25x.c                |  7 ++++++-
 arch/arm/mach-pxa/pxa27x.c                | 10 +++++-----
 arch/arm/mach-pxa/pxa3xx.c                |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)
Signature · 9 lines
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#6 lore raw

v3 cover ARM: pxa: Fix out of vmalloc space bug

Quoted 18 lines · On Wednesday 09 April 2014 15:05:26 Nicolas Pitre wrote:
Quoted 17 lines · Laurent Pinchart

Hello,

(Resending due to a typo in an e-mail address that caused LAKML to reject the mails. Sorry about the noise.)

This patch set reworks Ezequiel Garcia's previous fix [1] of an out of vmalloc space bug on PXA2[57]x platforms caused by an attempt to map the start of physical uncached outside of the vmalloc space.

This first three patches perform a couple of cleanups, and the last patch fixes the problem. I've decided to map the memory at address 0xfe000000 to minimize changes to the code, but this causes a bit of fragmentation of vmalloc space. I could map it to the very end of vmalloc space (0xfef00000)
instead if preferred, which would involve replacing a mov by an ldr in pxa2[57]x_finish_suspend and pm_enter_standby_start.

Quoted 5 lines
Quoted 1 line

I've tested the patch set on a PXA270-based system.

For those patches:

Thank you.

MAINTAINERS lists three maintainers for the PXA architecture, and two git trees that seem to be either dead or even deleted. Who picks up patches for PXA ? Should I send a pull request ?

Quoted 16 lines
Quoted 16 lines

[1] https://lkml.org/lkml/2013/11/28/474

Ezequiel Garcia (1):
ARM: pxa: Move iotable mapping inside vmalloc region

Laurent Pinchart (3):
ARM: pxa: Don't hardcode addresses and size in map_desc tables
ARM: pxa: Move UNCACHED_PHYS_0 mapping from generic.c to pxa2[57]x.c
ARM: pxa: pxa27x: Don't map IMEMC region statically

 arch/arm/mach-pxa/generic.c               | 11 +++--------
 arch/arm/mach-pxa/include/mach/hardware.h |  4 ++--
 arch/arm/mach-pxa/pxa25x.c                |  7 ++++++-
 arch/arm/mach-pxa/pxa27x.c                | 10 +++++-----
 arch/arm/mach-pxa/pxa3xx.c                |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart
#7 lore raw

v3 cover ARM: pxa: Fix out of vmalloc space bug

Quoted 23 lines · Laurent Pinchart
Quoted 22 lines · On Wednesday 09 April 2014 15:05:26 Nicolas Pitre wrote:
Quoted 17 lines · Laurent Pinchart

Hello,

(Resending due to a typo in an e-mail address that caused LAKML to reject the mails. Sorry about the noise.)

This patch set reworks Ezequiel Garcia's previous fix [1] of an out of vmalloc space bug on PXA2[57]x platforms caused by an attempt to map the start of physical uncached outside of the vmalloc space.

This first three patches perform a couple of cleanups, and the last patch fixes the problem. I've decided to map the memory at address 0xfe000000 to minimize changes to the code, but this causes a bit of fragmentation of vmalloc space. I could map it to the very end of vmalloc space (0xfef00000)
instead if preferred, which would involve replacing a mov by an ldr in pxa2[57]x_finish_suspend and pm_enter_standby_start.

Quoted 1 line

I've tested the patch set on a PXA270-based system.

For those patches:

Quoted 7 lines
Quoted 1 line

Thank you.

MAINTAINERS lists three maintainers for the PXA architecture, and two git trees that seem to be either dead or even deleted. Who picks up patches for PXA ? Should I send a pull request ?

If no one else answers, then just send a pull request to the ARM-SOC team (arm at kernel.org) and CC the linux-arm-kernel mailing list.

Nicolas

#8 lore raw

v3 cover ARM: pxa: Fix out of vmalloc space bug

Quoted 27 lines · Nicolas Pitre
Quoted 25 lines · Laurent Pinchart
Quoted 23 lines · On Wednesday 09 April 2014 15:05:26 Nicolas Pitre wrote:
Quoted 17 lines · Laurent Pinchart

Hello,

(Resending due to a typo in an e-mail address that caused LAKML to reject the mails. Sorry about the noise.)

This patch set reworks Ezequiel Garcia's previous fix [1] of an out of vmalloc space bug on PXA2[57]x platforms caused by an attempt to map the start of physical uncached outside of the vmalloc space.

This first three patches perform a couple of cleanups, and the last patch fixes the problem. I've decided to map the memory at address 0xfe000000 to minimize changes to the code, but this causes a bit of fragmentation of vmalloc space. I could map it to the very end of vmalloc space (0xfef00000)
instead if preferred, which would involve replacing a mov by an ldr in pxa2[57]x_finish_suspend and pm_enter_standby_start.

Quoted 1 line

I've tested the patch set on a PXA270-based system.

For those patches:

Quoted 9 lines
Quoted 5 lines

Thank you.

MAINTAINERS lists three maintainers for the PXA architecture, and two git trees that seem to be either dead or even deleted. Who picks up patches for PXA ? Should I send a pull request ?

If no one else answers, then just send a pull request to the ARM-SOC team (arm at kernel.org) and CC the linux-arm-kernel mailing list.

What ever happened to this?

Signature · 3 lines
Ezequiel Garc?a, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
#9 lore raw

v3 cover ARM: pxa: Fix out of vmalloc space bug

Quoted 34 lines · Ezequiel Garcia
Quoted 33 lines · Nicolas Pitre
Quoted 30 lines · Laurent Pinchart
Quoted 18 lines · On Wednesday 09 April 2014 15:05:26 Nicolas Pitre wrote:
Quoted 17 lines · Laurent Pinchart

Hello,

(Resending due to a typo in an e-mail address that caused LAKML to reject the mails. Sorry about the noise.)

This patch set reworks Ezequiel Garcia's previous fix [1] of an out of vmalloc space bug on PXA2[57]x platforms caused by an attempt to map the start of physical uncached outside of the vmalloc space.

This first three patches perform a couple of cleanups, and the last patch fixes the problem. I've decided to map the memory at address 0xfe000000 to minimize changes to the code, but this causes a bit of fragmentation of vmalloc space. I could map it to the very end of vmalloc space (0xfef00000)
instead if preferred, which would involve replacing a mov by an ldr in pxa2[57]x_finish_suspend and pm_enter_standby_start.

Quoted 5 lines
Quoted 1 line

I've tested the patch set on a PXA270-based system.

For those patches:

Thank you.

MAINTAINERS lists three maintainers for the PXA architecture, and two git trees that seem to be either dead or even deleted. Who picks up patches for PXA ? Should I send a pull request ?

Quoted 5 lines
Quoted 3 lines

If no one else answers, then just send a pull request to the ARM-SOC team (arm at kernel.org) and CC the linux-arm-kernel mailing list.

What ever happened to this?

Nothing, from the looks of it. I can apply them directly unless someone objects.

Laurent, care to rebase and send a fresh copy? cc arm at kernel.org.

-Olof

#10 lore raw

v3 cover ARM: pxa: Fix out of vmalloc space bug

Hi Olof,

Quoted 37 lines · On Thursday 10 July 2014 09:56:32 Olof Johansson wrote:
Quoted 36 lines · Ezequiel Garcia
Quoted 34 lines · Nicolas Pitre
Quoted 23 lines · Laurent Pinchart
Quoted 22 lines · On Wednesday 09 April 2014 15:05:26 Nicolas Pitre wrote:
Quoted 17 lines · Laurent Pinchart

Hello,

(Resending due to a typo in an e-mail address that caused LAKML to reject the mails. Sorry about the noise.)

This patch set reworks Ezequiel Garcia's previous fix [1] of an out of vmalloc space bug on PXA2[57]x platforms caused by an attempt to map the start of physical uncached outside of the vmalloc space.

This first three patches perform a couple of cleanups, and the last patch fixes the problem. I've decided to map the memory at address 0xfe000000 to minimize changes to the code, but this causes a bit of fragmentation of vmalloc space. I could map it to the very end of vmalloc space (0xfef00000) instead if preferred, which would involve replacing a mov by an ldr in pxa2[57]x_finish_suspend and pm_enter_standby_start.

Quoted 1 line

I've tested the patch set on a PXA270-based system.

For those patches:

Quoted 7 lines
Quoted 1 line

Thank you.

MAINTAINERS lists three maintainers for the PXA architecture, and two git trees that seem to be either dead or even deleted. Who picks up patches for PXA ? Should I send a pull request ?

If no one else answers, then just send a pull request to the ARM-SOC team (arm at kernel.org) and CC the linux-arm-kernel mailing list.

Quoted 6 lines
Quoted 1 line

What ever happened to this?

Nothing, from the looks of it. I can apply them directly unless someone objects.

Laurent, care to rebase and send a fresh copy? cc arm at kernel.org.

Sure. Done.

Signature · 3 lines
Regards,

Laurent Pinchart