Skip to contentSkip to conversation

removal of mach/vmalloc.h and generic optimizations

PATCH New Nicolas Pitre 7 participants 49 messages Sep 16, 2011 – Sep 21, 2011

Subsystems (27)
lore
Share & tools
lore
#0 lore raw

cover removal of mach/vmalloc.h and generic optimizations

This patch series removes all instances of mach/vmalloc.h in order to have a more unified memory map across all ARM architectures. To do so, the static mappings are moved inside the vmalloc area. And finally this allows for a generic optimization to ioremap where static mappings are reused whenever possible, using common code instead of having this duplicated in a couple places.

This also provides a net reduction of more than 1200 lines of code.

Those patches are also available in the following repository:

git://git.linaro.org/people/nico/linux vmalloc

Nicolas Pitre (19):
ARM: sort the meminfo array earlier
ARM: mach-dove: remove inclusion of <mach/vmalloc.h>
ARM: mach-prima2: don't define SIRFSOC_VA in terms of VMALLOC_END
ARM: plat-mxc: remove inclusion of <mach/vmalloc.h>
ARM: plat-omap: don't define OMAP1_SRAM_VA in terms of VMALLOC_END
ARM: mach-at91: remove arch specific special handling for ioremap
ARM: mach-davinci: remove arch specific special handling for ioremap
ARM: mach-tegra: remove arch specific special handling for ioremap
ARM: plat-omap: remove arch specific special handling for ioremap
ARM: mach-bcmring: use proper constant to identify DMA memory area
ARM: mach-orion5x: remove arch specific special handling for ioremap
ARM: mach-kirkwood: remove arch specific special handling for ioremap
ARM: mach-ixp23xx: remove arch specific special handling for ioremap
ARM: plat-iop: remove arch specific special handling for ioremap
mm: add vm_area_add_early()
ARM: move iotable mappings within the vmalloc region
ARM: simplify __iounmap() when dealing with section based mapping
ARM: add generic ioremap optimization by reusing static mappings
ARM: big removal of now unused vmalloc.h files

 arch/arm/include/asm/pgtable.h                  |    8 +-
 arch/arm/kernel/setup.c                         |    8 +
 arch/arm/mach-at91/include/mach/io.h            |    8 -
 arch/arm/mach-at91/include/mach/vmalloc.h       |   26 ---
 arch/arm/mach-at91/setup.c                      |   18 --
 arch/arm/mach-bcmring/dma.c                     |    2 +-
 arch/arm/mach-bcmring/include/mach/vmalloc.h    |   25 ---
 arch/arm/mach-clps711x/include/mach/vmalloc.h   |   20 ---
 arch/arm/mach-cns3xxx/include/mach/vmalloc.h    |   11 --
 arch/arm/mach-davinci/Makefile                  |    2 +-
 arch/arm/mach-davinci/include/mach/io.h         |    8 -
 arch/arm/mach-davinci/include/mach/vmalloc.h    |   14 --
 arch/arm/mach-davinci/io.c                      |   48 ------
 arch/arm/mach-dove/include/mach/dove.h          |    2 -
 arch/arm/mach-dove/include/mach/vmalloc.h       |    5 -
 arch/arm/mach-ebsa110/include/mach/vmalloc.h    |   10 --
 arch/arm/mach-ep93xx/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-exynos4/include/mach/vmalloc.h    |   22 ---
 arch/arm/mach-footbridge/include/mach/vmalloc.h |   10 --
 arch/arm/mach-gemini/include/mach/vmalloc.h     |   10 --
 arch/arm/mach-h720x/include/mach/vmalloc.h      |   10 --
 arch/arm/mach-integrator/include/mach/vmalloc.h |   20 ---
 arch/arm/mach-iop13xx/include/mach/vmalloc.h    |    4 -
 arch/arm/mach-iop32x/include/mach/io.h          |    7 -
 arch/arm/mach-iop32x/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-iop33x/include/mach/io.h          |    7 -
 arch/arm/mach-iop33x/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-ixp2000/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-ixp23xx/include/mach/io.h         |   29 ----
 arch/arm/mach-ixp23xx/include/mach/vmalloc.h    |   10 --
 arch/arm/mach-ixp4xx/include/mach/vmalloc.h     |    5 -
 arch/arm/mach-kirkwood/include/mach/io.h        |   25 ---
 arch/arm/mach-kirkwood/include/mach/vmalloc.h   |    5 -
 arch/arm/mach-ks8695/include/mach/vmalloc.h     |   19 ---
 arch/arm/mach-lpc32xx/include/mach/vmalloc.h    |   24 ---
 arch/arm/mach-mmp/include/mach/vmalloc.h        |    5 -
 arch/arm/mach-msm/include/mach/vmalloc.h        |   22 ---
 arch/arm/mach-mv78xx0/include/mach/vmalloc.h    |    5 -
 arch/arm/mach-mxs/include/mach/vmalloc.h        |   22 ---
 arch/arm/mach-netx/include/mach/vmalloc.h       |   19 ---
 arch/arm/mach-nomadik/include/mach/vmalloc.h    |    2 -
 arch/arm/mach-nuc93x/include/mach/vmalloc.h     |   23 ---
 arch/arm/mach-omap1/include/mach/vmalloc.h      |   20 ---
 arch/arm/mach-omap2/include/mach/vmalloc.h      |   20 ---
 arch/arm/mach-orion5x/include/mach/io.h         |   25 ---
 arch/arm/mach-orion5x/include/mach/vmalloc.h    |    5 -
 arch/arm/mach-pnx4008/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-prima2/include/mach/map.h         |    6 +-
 arch/arm/mach-prima2/include/mach/vmalloc.h     |   16 --
 arch/arm/mach-pxa/include/mach/vmalloc.h        |   11 --
 arch/arm/mach-realview/include/mach/vmalloc.h   |   21 ---
 arch/arm/mach-rpc/include/mach/vmalloc.h        |   10 --
 arch/arm/mach-s3c2410/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-s3c64xx/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-s5p64x0/include/mach/vmalloc.h    |   20 ---
 arch/arm/mach-s5pc100/include/mach/vmalloc.h    |   17 --
 arch/arm/mach-s5pv210/include/mach/vmalloc.h    |   22 ---
 arch/arm/mach-sa1100/include/mach/vmalloc.h     |    4 -
 arch/arm/mach-shark/include/mach/vmalloc.h      |    4 -
 arch/arm/mach-shmobile/include/mach/vmalloc.h   |    7 -
 arch/arm/mach-spear3xx/include/mach/vmalloc.h   |   19 ---
 arch/arm/mach-spear6xx/include/mach/vmalloc.h   |   19 ---
 arch/arm/mach-tegra/include/mach/io.h           |    6 -
 arch/arm/mach-tegra/include/mach/vmalloc.h      |   28 ----
 arch/arm/mach-tegra/io.c                        |   21 ---
 arch/arm/mach-u300/include/mach/vmalloc.h       |   12 --
 arch/arm/mach-ux500/include/mach/vmalloc.h      |   18 --
 arch/arm/mach-versatile/include/mach/vmalloc.h  |   21 ---
 arch/arm/mach-vexpress/include/mach/vmalloc.h   |   21 ---
 arch/arm/mach-vt8500/include/mach/vmalloc.h     |   20 ---
 arch/arm/mach-w90x900/include/mach/vmalloc.h    |   23 ---
 arch/arm/mach-zynq/include/mach/vmalloc.h       |   20 ---
 arch/arm/mm/init.c                              |   10 --
 arch/arm/mm/ioremap.c                           |   70 ++++++---
 arch/arm/mm/mm.h                                |   14 ++
 arch/arm/mm/mmu.c                               |   43 ++++--
 arch/arm/plat-iop/Makefile                      |    2 -
 arch/arm/plat-iop/io.c                          |   59 -------
 arch/arm/plat-mxc/include/mach/mx1.h            |    2 -
 arch/arm/plat-mxc/include/mach/vmalloc.h        |   22 ---
 arch/arm/plat-omap/Makefile                     |    2 +-
 arch/arm/plat-omap/include/plat/io.h            |    6 -
 arch/arm/plat-omap/io.c                         |  141 -----------------
 arch/arm/plat-omap/sram.c                       |    2 +-
 arch/arm/plat-spear/include/plat/vmalloc.h      |   19 ---
 arch/arm/plat-tcc/include/mach/vmalloc.h        |   10 --
 include/linux/vmalloc.h                         |    1 +
 mm/vmalloc.c                                    |   28 +++-
 88 files changed, 136 insertions(+), 1346 deletions(-)
#1 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

From: Nicolas Pitre <[email protected]>

The meminfo array has to be sorted before sanity_check_meminfo() can work properly.

---
 arch/arm/kernel/setup.c |    8 ++++++++
 arch/arm/mm/init.c      |   10 ----------
 2 files changed, 8 insertions(+), 10 deletions(-)
arch/arm/kernel/setup.c +8 -0
index 70bca649e9..56cd8c351c 100644
@@ -29,6 +29,7 @@
 #include <linux/fs.h>
 #include <linux/proc_fs.h>
 #include <linux/memblock.h>
+#include <linux/sort.h>
 
 #include <asm/unified.h>
 #include <asm/cpu.h>
@@ -875,6 +876,12 @@ static struct machine_desc * __init setup_machine_tags(unsigned int nr)
 	return mdesc;
 }
 
+static int __init meminfo_cmp(const void *_a, const void *_b)
+{
+	const struct membank *a = _a, *b = _b;
+	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
+	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
+}
 
 void __init setup_arch(char **cmdline_p)
 {
@@ -903,6 +910,7 @@ void __init setup_arch(char **cmdline_p)
 
 	parse_early_param();
 
+	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
 	sanity_check_meminfo();
 	arm_memblock_init(&meminfo, mdesc);
 
arch/arm/mm/init.c +0 -10
index 91bca355cd..7080f10cc2 100644
@@ -19,7 +19,6 @@
 #include <linux/highmem.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
-#include <linux/sort.h>
 
 #include <asm/mach-types.h>
 #include <asm/prom.h>
@@ -318,19 +317,10 @@ static void arm_memory_present(void)
 }
 #endif
 
-static int __init meminfo_cmp(const void *_a, const void *_b)
-{
-	const struct membank *a = _a, *b = _b;
-	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
-	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
-}
-
 void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
 {
 	int i;
 
-	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
-
 	memblock_init();
 	for (i = 0; i < mi->nr_banks; i++)
 		memblock_add(mi->bank[i].start, mi->bank[i].size);
Signature · 1 line
1.7.7-rc0
#2 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

arch/arm/kernel/setup.c static struct machine_desc * __init setup_machine_tags(unsigned int nr) · line 883

Quoted 9 lines · Nicolas Pitre
arch/arm/kernel/setup.c +5 -0
@@ -875,6 +876,12 @@ static struct machine_desc * __init setup_machine_tags(unsigned int nr)
 	return mdesc;
 }
 
+static int __init meminfo_cmp(const void *_a, const void *_b)
+{
+	const struct membank *a = _a, *b = _b;
+	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
+	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;

This looks like:

    return clamp(bank_pfn_start(a) - bank_pfn_start(b), -1, 1);
Quoted 23 lines
arch/arm/kernel/setup.c +2 -0
+}
 
 void __init setup_arch(char **cmdline_p)
 {
@@ -903,6 +910,7 @@ void __init setup_arch(char **cmdline_p)
 
 	parse_early_param();
 
+	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
 	sanity_check_meminfo();
 	arm_memblock_init(&meminfo, mdesc);
 
arch/arm/mm/init.c +0 -3
index 91bca355cd..7080f10cc2 100644
@@ -318,19 +317,10 @@ static void arm_memory_present(void)
 }
 #endif
 
-static int __init meminfo_cmp(const void *_a, const void *_b)
-{
-	const struct membank *a = _a, *b = _b;

arch/arm/mm/init.c static void arm_memory_present(void) · line 333

Quoted 10 lines
arch/arm/mm/init.c +0 -6
-	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
-	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
-}
-
 void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
 {
 	int i;
 
-	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
-

Why not call sanity_check_meminfo() here?

Quoted 3 lines
arch/arm/mm/init.c +0 -0
 	memblock_init();
 	for (i = 0; i < mi->nr_banks; i++)
 		memblock_add(mi->bank[i].start, mi->bank[i].size);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

Quoted 13 lines · Stephen Boyd

arch/arm/kernel/setup.c static struct machine_desc * __init setup_machine_tags(unsigned int nr) · line 883

Quoted 9 lines · Nicolas Pitre
arch/arm/kernel/setup.c +5 -0
@@ -875,6 +876,12 @@ static struct machine_desc * __init setup_machine_tags(unsigned int nr)
 	return mdesc;
 }
 
+static int __init meminfo_cmp(const void *_a, const void *_b)
+{
+	const struct membank *a = _a, *b = _b;
+	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
+	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;

This looks like:

Quoted 1 line
    return clamp(bank_pfn_start(a) - bank_pfn_start(b), -1, 1);

Won't work. The pfn is of an unsigned type, hence the subtraction result will also be unsigned. The code above looks a bit odd, but there is an implicit cast to a signed result with the result stored into a long.

What would have been even clearer, and possibly more efficient as well, is something like this:

	if (bank_pfn_start(a) < bank_pfn_start(b))
		return -1;
	if (bank_pfn_start(a) > bank_pfn_start(b))
		return 1;
	return 0;

But the goal here was to simply move the code, changing it would warrant a separate patch.

Quoted 19 lines
Quoted 19 lines
arch/arm/mm/init.c +0 -7
index 91bca355cd..7080f10cc2 100644
@@ -318,19 +317,10 @@ static void arm_memory_present(void)
 }
 #endif
 
-static int __init meminfo_cmp(const void *_a, const void *_b)
-{
-	const struct membank *a = _a, *b = _b;
-	long cmp = bank_pfn_start(a) - bank_pfn_start(b);
-	return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
-}
-
 void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
 {
 	int i;
 
Quoted 4 lines

arch/arm/mm/init.c static void arm_memory_present(void) · line 333

Quoted 2 lines
arch/arm/mm/init.c +0 -2
-	sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
-

Why not call sanity_check_meminfo() here?

That could be done as well. However the populating of the meminfo array is done in kernel/setup.c, so it made sense to move the sort there as this could be improved upon eventually to make the memory bank parser a bit more robust against problems such as overlapping memory ranges which was the subject of a somewhat entertaining thread recently. But I don't have a strong opinion about this.

Nicolas

#4 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

Quoted 11 lines · Nicolas Pitre
Quoted 3 lines · Stephen Boyd

This looks like:

    return clamp(bank_pfn_start(a) - bank_pfn_start(b), -1, 1);

Won't work. The pfn is of an unsigned type, hence the subtraction result will also be unsigned. The code above looks a bit odd, but there is an implicit cast to a signed result with the result stored into a long.

Quoted 8 lines

What would have been even clearer, and possibly more efficient as well, is something like this:

	if (bank_pfn_start(a) < bank_pfn_start(b))
		return -1;
	if (bank_pfn_start(a) > bank_pfn_start(b))
		return 1;
	return 0;

Ok so

    return clamp_t(long, bank_pfn_start(a) - bank_pfn_start(b), -1, 1); 

?

Quoted 3 lines

But the goal here was to simply move the code, changing it would warrant a separate patch.

Fair enough.

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#5 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

Quoted 21 lines · Stephen Boyd
Quoted 11 lines · Nicolas Pitre
Quoted 3 lines · Stephen Boyd

This looks like:

    return clamp(bank_pfn_start(a) - bank_pfn_start(b), -1, 1);

Won't work. The pfn is of an unsigned type, hence the subtraction result will also be unsigned. The code above looks a bit odd, but there is an implicit cast to a signed result with the result stored into a long.

Quoted 8 lines

What would have been even clearer, and possibly more efficient as well, is something like this:

	if (bank_pfn_start(a) < bank_pfn_start(b))
		return -1;
	if (bank_pfn_start(a) > bank_pfn_start(b))
		return 1;
	return 0;
Quoted 6 lines

Ok so

    return clamp_t(long, bank_pfn_start(a) - bank_pfn_start(b), -1, 1); 

?

Well...

Given that the pfn range typically fits into an int, having a simple:

	return bank_pfn_start(a) - bank_pfn_start(b);

should be all that is needed here, since the expected return value is either <0, 0, or >0. But that assumes that physical memory will always be representable with less than 44 bits, and that's a bad assumption to make these days. Even your usage of clamp_t() is broken the same way, just like the current code in fact.

So probably using bank_phys_start() instead of bank_pfn_start() would already be slightly more efficient, given that reducing the range with a pfn is not going to help when PHYSADDR_t is a 64-bit type. Then having direct comparisons like I proposed would be the best that can be achieved in C.

Nicolas

#6 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

In reply to Nicolas Pitre
Quoted 4 lines · Nicolas Pitre

From: Nicolas Pitre <[email protected]>

The meminfo array has to be sorted before sanity_check_meminfo() can work properly.

This is unrelated to the patch series, so it should be separate from the series. I don't see anything in the series depending on it.

#7 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

Quoted 8 lines · Russell King - ARM Linux
Quoted 4 lines · Nicolas Pitre

From: Nicolas Pitre <[email protected]>

The meminfo array has to be sorted before sanity_check_meminfo() can work properly.

This is unrelated to the patch series, so it should be separate from the series. I don't see anything in the series depending on it.

True. I just stumbled across this issue while working on the rest.

Nicolas

#8 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

Quoted 5 lines · Nicolas Pitre
Quoted 3 lines · Russell King - ARM Linux
Quoted 2 lines · Nicolas Pitre

From: Nicolas Pitre <[email protected]>

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

The meminfo array has to be sorted before sanity_check_meminfo() can work properly.

This is unrelated to the patch series, so it should be separate from the series. I don't see anything in the series depending on it.

True. I just stumbled across this issue while working on the rest.

Well, I'm about to post some revised patches for this series, and I'm now taking advantage of the sorted array. So here's this patch again which is also revised:

----- >8

#9 lore raw

PATCH 1/19 ARM: sort the meminfo array earlier

Quoted 3 lines · Nicolas Pitre

Well, I'm about to post some revised patches for this series, and I'm now taking advantage of the sorted array. So here's this patch again which is also revised:

Looks fine, thanks.

#10 lore raw

PATCH 2/19 ARM: mach-dove: remove inclusion of <mach/vmalloc.h>

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

---
 arch/arm/mach-dove/include/mach/dove.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/mach-dove/include/mach/dove.h +0 -2
index b20ec9af78..ad1165d488 100644
@@ -11,8 +11,6 @@
 #ifndef __ASM_ARCH_DOVE_H
 #define __ASM_ARCH_DOVE_H
 
-#include <mach/vmalloc.h>
-
 /*
  * Marvell Dove address maps.
  *
Signature · 1 line
1.7.7-rc0
#11 lore raw

PATCH 3/19 ARM: mach-prima2: don't define SIRFSOC_VA in terms of VMALLOC_END

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

... since it is going to change.

---
 arch/arm/mach-prima2/include/mach/map.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/include/mach/map.h +4 -2
index 66b1ae2e55..6f24353257 100644
@@ -9,8 +9,10 @@
 #ifndef __MACH_PRIMA2_MAP_H__
 #define __MACH_PRIMA2_MAP_H__
 
-#include <mach/vmalloc.h>
+#include <linux/const.h>
 
-#define SIRFSOC_VA(x)			(VMALLOC_END + ((x) & 0x00FFF000))
+#define SIRFSOC_VA_BASE		_AC(0xFEC00000, UL)
+
+#define SIRFSOC_VA(x)		(SIRFSOC_VA_BASE + ((x) & 0x00FFF000))
 
 #endif
Signature · 1 line
1.7.7-rc0
#12 lore raw

PATCH 3/19 ARM: mach-prima2: don't define SIRFSOC_VA in terms of VMALLOC_END

2011/9/16 Nicolas Pitre <[email protected]>:

Quoted 5 lines

From: Nicolas Pitre <[email protected]>

... since it is going to change.

Quoted 23 lines

---
?arch/arm/mach-prima2/include/mach/map.h | ? ?6 ++++-- ?1 files changed, 4 insertions(+), 2 deletions(-)

arch/arm/mach-prima2/include/mach/map.h +0 -0
index 66b1ae2e55..6f24353257 100644
@@ -9,8 +9,10 @@

?#ifndef __MACH_PRIMA2_MAP_H__
?#define __MACH_PRIMA2_MAP_H__

arch/arm/mach-prima2/include/mach/map.h +4 -2
-#include <mach/vmalloc.h>
+#include <linux/const.h>
 
-#define SIRFSOC_VA(x) ? ? ? ? ? ? ? ? ?(VMALLOC_END + ((x) & 0x00FFF000))
+#define SIRFSOC_VA_BASE ? ? ? ? ? ? ? ?_AC(0xFEC00000, UL)
+
+#define SIRFSOC_VA(x) ? ? ? ? ?(SIRFSOC_VA_BASE + ((x) & 0x00FFF000))

?#endif
--
1.7.7-rc0

#13 lore raw

PATCH 4/19 ARM: plat-mxc: remove inclusion of <mach/vmalloc.h>

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

---
 arch/arm/plat-mxc/include/mach/mx1.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/plat-mxc/include/mach/mx1.h +0 -2
index 97b19e7800..2b7c08d13e 100644
@@ -12,8 +12,6 @@
 #ifndef __MACH_MX1_H__
 #define __MACH_MX1_H__
 
-#include <mach/vmalloc.h>
-
 /*
  * Memory map
  */
Signature · 1 line
1.7.7-rc0
#14 lore raw

PATCH 5/19 ARM: plat-omap: don't define OMAP1_SRAM_VA in terms of VMALLOC_END

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

... as it is going to move away.

---
 arch/arm/plat-omap/sram.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/sram.c +1 -1
index 363c91e44e..6835b89097 100644
@@ -41,7 +41,7 @@
 #endif
 
 #define OMAP1_SRAM_PA		0x20000000
-#define OMAP1_SRAM_VA		VMALLOC_END
+#define OMAP1_SRAM_VA		0xd8000000
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
 #define OMAP2_SRAM_VA		0xfe400000
 #define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
Signature · 1 line
1.7.7-rc0
#15 lore raw

PATCH 6/19 ARM: mach-at91: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/mach-at91/include/mach/io.h |    8 --------
 arch/arm/mach-at91/setup.c           |   18 ------------------
 2 files changed, 0 insertions(+), 26 deletions(-)
arch/arm/mach-at91/include/mach/io.h +0 -8
index 4298e7806c..4ca09ef7ca 100644
@@ -30,14 +30,6 @@
 
 #ifndef __ASSEMBLY__
 
-#ifndef CONFIG_ARCH_AT91X40
-#define __arch_ioremap	at91_ioremap
-#define __arch_iounmap	at91_iounmap
-#endif
-
-void __iomem *at91_ioremap(unsigned long phys, size_t size, unsigned int type);
-void at91_iounmap(volatile void __iomem *addr);
-
 static inline unsigned int at91_sys_read(unsigned int reg_offset)
 {
 	void __iomem *addr = (void __iomem *)AT91_VA_BASE_SYS;
arch/arm/mach-at91/setup.c +0 -18
index aa64294c7d..cf98a8f94d 100644
@@ -73,24 +73,6 @@ static struct map_desc at91_io_desc __initdata = {
 	.type		= MT_DEVICE,
 };
 
-void __iomem *at91_ioremap(unsigned long p, size_t size, unsigned int type)
-{
-	if (p >= AT91_BASE_SYS && p <= (AT91_BASE_SYS + SZ_16K - 1))
-		return (void __iomem *)AT91_IO_P2V(p);
-
-	return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
-}
-EXPORT_SYMBOL(at91_ioremap);
-
-void at91_iounmap(volatile void __iomem *addr)
-{
-	unsigned long virt = (unsigned long)addr;
-
-	if (virt >= VMALLOC_START && virt < VMALLOC_END)
-		__iounmap(addr);
-}
-EXPORT_SYMBOL(at91_iounmap);
-
 #define AT91_DBGU0	0xfffff200
 #define AT91_DBGU1	0xffffee00
 
Signature · 1 line
1.7.7-rc0
#17 lore raw

PATCH 6/19 ARM: mach-at91: remove arch specific special handling for ioremap

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

Untill the replace will availlable

do not remove it

This patch series is all about adding that replacement.

But yes, as a general point of principle, the replacement should be in place before the old stuff is pulled out. I don't see any reason why that can't be the case, because __arm_ioremap() can be rigged up to use the static mappings first, and then the individual platform interception of ioremap() can be removed afterwards.

#18 lore raw

PATCH 6/19 ARM: mach-at91: remove arch specific special handling for ioremap

Quoted 11 lines · Russell King - ARM Linux
Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

Untill the replace will availlable

do not remove it

Quoted 7 lines

This patch series is all about adding that replacement.

But yes, as a general point of principle, the replacement should be in place before the old stuff is pulled out. I don't see any reason why that can't be the case, because __arm_ioremap() can be rigged up to use the static mappings first, and then the individual platform interception of ioremap() can be removed afterwards.

Some of them were using IOREMAP_END assuming it was below the static mappings, so it was easier to simply remove those first before the IOREMAP_END was redefined. And then it looks strange to remove some of them before, then some others after. Hence I opted for removing them all first. And as I said, this doesn't create any functional regression to have this optimization removed temporarily.

Nicolas

#19 lore raw

PATCH 6/19 ARM: mach-at91: remove arch specific special handling for ioremap

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

Untill the replace will availlable

do not remove it

The replacement is introduced later in the same patch series. Removing this first doesn't cause any functional regression.

Nicolas

#20 lore raw

PATCH 7/19 ARM: mach-davinci: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/mach-davinci/Makefile          |    2 +-
 arch/arm/mach-davinci/include/mach/io.h |    8 -----
 arch/arm/mach-davinci/io.c              |   48 -------------------------------
 3 files changed, 1 insertions(+), 57 deletions(-)
 delete mode 100644 arch/arm/mach-davinci/io.c
arch/arm/mach-davinci/Makefile +1 -1
index 0b87a1ca2b..d6a8879aa6 100644
@@ -4,7 +4,7 @@
 #
 
 # Common objects
-obj-y 			:= time.o clock.o serial.o io.o psc.o \
+obj-y 			:= time.o clock.o serial.o psc.o \
 			   gpio.o dma.o usb.o common.o sram.o aemif.o
 
 obj-$(CONFIG_DAVINCI_MUX)		+= mux.o
arch/arm/mach-davinci/include/mach/io.h +0 -8
index d1b954955c..b2267d1e1a 100644
@@ -21,12 +21,4 @@
 #define __mem_pci(a)		(a)
 #define __mem_isa(a)		(a)
 
-#ifndef __ASSEMBLER__
-#define __arch_ioremap		davinci_ioremap
-#define __arch_iounmap		davinci_iounmap
-
-void __iomem *davinci_ioremap(unsigned long phys, size_t size,
-			      unsigned int type);
-void davinci_iounmap(volatile void __iomem *addr);
-#endif
 #endif /* __ASM_ARCH_IO_H */
arch/arm/mach-davinci/io.c deleted +0 -48

48 lines not on this page · raw message

Signature · 1 line
1.7.7-rc0
#21 lore raw

PATCH 8/19 ARM: mach-tegra: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/mach-tegra/include/mach/io.h |    6 ------
 arch/arm/mach-tegra/io.c              |   21 ---------------------
 2 files changed, 0 insertions(+), 27 deletions(-)
arch/arm/mach-tegra/include/mach/io.h +0 -6
index 4cea2230c8..67fcb38c09 100644
@@ -65,12 +65,6 @@
 
 #ifndef __ASSEMBLER__
 
-#define __arch_ioremap		tegra_ioremap
-#define __arch_iounmap		tegra_iounmap
-
-void __iomem *tegra_ioremap(unsigned long phys, size_t size, unsigned int type);
-void tegra_iounmap(volatile void __iomem *addr);
-
 #define IO_ADDRESS(n) ((void __iomem *) IO_TO_VIRT(n))
 
 #ifdef CONFIG_TEGRA_PCI
arch/arm/mach-tegra/io.c +0 -21
index ea50fe28cf..d9d517dc4c 100644
@@ -60,24 +60,3 @@ void __init tegra_map_common_io(void)
 {
 	iotable_init(tegra_io_desc, ARRAY_SIZE(tegra_io_desc));
 }
-
-/*
- * Intercept ioremap() requests for addresses in our fixed mapping regions.
- */
-void __iomem *tegra_ioremap(unsigned long p, size_t size, unsigned int type)
-{
-	void __iomem *v = IO_ADDRESS(p);
-	if (v == NULL)
-		v = __arm_ioremap(p, size, type);
-	return v;
-}
-EXPORT_SYMBOL(tegra_ioremap);
-
-void tegra_iounmap(volatile void __iomem *addr)
-{
-	unsigned long virt = (unsigned long)addr;
-
-	if (virt >= VMALLOC_START && virt < VMALLOC_END)
-		__iounmap(addr);
-}
-EXPORT_SYMBOL(tegra_iounmap);
Signature · 1 line
1.7.7-rc0
#22 lore raw

PATCH 9/19 ARM: plat-omap: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/plat-omap/Makefile          |    2 +-
 arch/arm/plat-omap/include/plat/io.h |    6 --
 arch/arm/plat-omap/io.c              |  141 ----------------------------------
 3 files changed, 1 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arm/plat-omap/io.c
arch/arm/plat-omap/Makefile +1 -1
index f0233e6abc..1db3f2f88c 100644
@@ -4,7 +4,7 @@
 
 # Common support
 obj-y := common.o sram.o clock.o devices.o dma.o mux.o \
-	 usb.o fb.o io.o counter_32k.o
+	 usb.o fb.o counter_32k.o
 obj-m :=
 obj-n :=
 obj-  :=
arch/arm/plat-omap/include/plat/io.h +0 -6
index d72ec85c97..92e6d53ed5 100644
@@ -303,12 +303,6 @@ extern void omap2_init_common_infrastructure(void);
 extern void omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
 				      struct omap_sdrc_params *sdrc_cs1);
 
-#define __arch_ioremap	omap_ioremap
-#define __arch_iounmap	omap_iounmap
-
-void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type);
-void omap_iounmap(volatile void __iomem *addr);
-
 #endif
 
 #endif
arch/arm/plat-omap/io.c deleted +0 -141

141 lines not on this page · raw message

Signature · 1 line
1.7.7-rc0
#23 lore raw

PATCH 10/19 ARM: mach-bcmring: use proper constant to identify DMA memory area

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

Using VMALLOC_END implies a presumption about the layout which is best avoided, even if in practice this would not change much.

---
 arch/arm/mach-bcmring/dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-bcmring/dma.c +1 -1
index 0ca0005066..42021804b9 100644
@@ -1613,7 +1613,7 @@ DMA_MemType_t dma_mem_type(void *addr)
 {
 	unsigned long addrVal = (unsigned long)addr;
 
-	if (addrVal >= VMALLOC_END) {
+	if (addrVal >= CONSISTENT_BASE) {
 		/* NOTE: DMA virtual memory space starts at 0xFFxxxxxx */
 
 		/* dma_alloc_xxx pages are physically and virtually contiguous */
Signature · 1 line
1.7.7-rc0
#24 lore raw

PATCH 11/19 ARM: mach-orion5x: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/mach-orion5x/include/mach/io.h |   25 -------------------------
 1 files changed, 0 insertions(+), 25 deletions(-)
arch/arm/mach-orion5x/include/mach/io.h +0 -25
index c5196101a2..e9d9afdc26 100644
@@ -15,31 +15,6 @@
 
 #define IO_SPACE_LIMIT		0xffffffff
 
-static inline void __iomem *
-__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
-{
-	void __iomem *retval;
-	unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE;
-	if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE &&
-	    size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) {
-		retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;
-	} else {
-		retval = __arm_ioremap(paddr, size, mtype);
-	}
-
-	return retval;
-}
-
-static inline void
-__arch_iounmap(void __iomem *addr)
-{
-	if (addr < (void __iomem *)ORION5X_REGS_VIRT_BASE ||
-	    addr >= (void __iomem *)(ORION5X_REGS_VIRT_BASE + ORION5X_REGS_SIZE))
-		__iounmap(addr);
-}
-
-#define __arch_ioremap		__arch_ioremap
-#define __arch_iounmap		__arch_iounmap
 #define __io(a)			__typesafe_io(a)
 #define __mem_pci(a)		(a)
 
Signature · 1 line
1.7.7-rc0
#25 lore raw

PATCH 12/19 ARM: mach-kirkwood: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/mach-kirkwood/include/mach/io.h |   25 -------------------------
 1 files changed, 0 insertions(+), 25 deletions(-)
arch/arm/mach-kirkwood/include/mach/io.h +0 -25
index 1aaddc364f..49dd0cb5e1 100644
@@ -19,31 +19,6 @@ static inline void __iomem *__io(unsigned long addr)
 					+ KIRKWOOD_PCIE_IO_VIRT_BASE);
 }
 
-static inline void __iomem *
-__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)
-{
-	void __iomem *retval;
-	unsigned long offs = paddr - KIRKWOOD_REGS_PHYS_BASE;
-	if (mtype == MT_DEVICE && size && offs < KIRKWOOD_REGS_SIZE &&
-	    size <= KIRKWOOD_REGS_SIZE && offs + size <= KIRKWOOD_REGS_SIZE) {
-		retval = (void __iomem *)KIRKWOOD_REGS_VIRT_BASE + offs;
-	} else {
-		retval = __arm_ioremap(paddr, size, mtype);
-	}
-
-	return retval;
-}
-
-static inline void
-__arch_iounmap(void __iomem *addr)
-{
-	if (addr < (void __iomem *)KIRKWOOD_REGS_VIRT_BASE ||
-	    addr >= (void __iomem *)(KIRKWOOD_REGS_VIRT_BASE + KIRKWOOD_REGS_SIZE))
-		__iounmap(addr);
-}
-
-#define __arch_ioremap		__arch_ioremap
-#define __arch_iounmap		__arch_iounmap
 #define __io(a)			__io(a)
 #define __mem_pci(a)		(a)
 
Signature · 1 line
1.7.7-rc0
#26 lore raw

PATCH 13/19 ARM: mach-ixp23xx: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/mach-ixp23xx/include/mach/io.h |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)
arch/arm/mach-ixp23xx/include/mach/io.h +0 -29
index a1749d0fd8..4ce4353b9f 100644
@@ -20,33 +20,4 @@
 #define __io(p)		((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
 #define __mem_pci(a)	(a)
 
-static inline void __iomem *
-ixp23xx_ioremap(unsigned long addr, unsigned long size, unsigned int mtype)
-{
-	if (addr >= IXP23XX_PCI_MEM_START &&
-		addr <= IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE) {
-		if (addr + size > IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE)
-			return NULL;
-
-		return (void __iomem *)
- 			((addr - IXP23XX_PCI_MEM_START) + IXP23XX_PCI_MEM_VIRT);
-	}
-
-	return __arm_ioremap(addr, size, mtype);
-}
-
-static inline void
-ixp23xx_iounmap(void __iomem *addr)
-{
-	if ((((u32)addr) >= IXP23XX_PCI_MEM_VIRT) &&
-	    (((u32)addr) < IXP23XX_PCI_MEM_VIRT + IXP23XX_PCI_MEM_SIZE))
-		return;
-
-	__iounmap(addr);
-}
-
-#define __arch_ioremap	ixp23xx_ioremap
-#define __arch_iounmap	ixp23xx_iounmap
-
-
 #endif
Signature · 1 line
1.7.7-rc0
#27 lore raw

PATCH 14/19 ARM: plat-iop: remove arch specific special handling for ioremap

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

A generic version should replace this later.

---
 arch/arm/mach-iop32x/include/mach/io.h |    7 ----
 arch/arm/mach-iop33x/include/mach/io.h |    7 ----
 arch/arm/plat-iop/Makefile             |    2 -
 arch/arm/plat-iop/io.c                 |   59 --------------------------------
 4 files changed, 0 insertions(+), 75 deletions(-)
 delete mode 100644 arch/arm/plat-iop/io.c
arch/arm/mach-iop32x/include/mach/io.h +0 -7
index 059c783ce0..2d88264b98 100644
@@ -13,15 +13,8 @@
 
 #include <asm/hardware/iop3xx.h>
 
-extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
-	unsigned int mtype);
-extern void __iop3xx_iounmap(void __iomem *addr);
-
 #define IO_SPACE_LIMIT		0xffffffff
 #define __io(p)		((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
 #define __mem_pci(a)		(a)
 
-#define __arch_ioremap	__iop3xx_ioremap
-#define __arch_iounmap	__iop3xx_iounmap
-
 #endif
arch/arm/mach-iop33x/include/mach/io.h +0 -7
index 39e893e97c..a8a66fc8fb 100644
@@ -13,15 +13,8 @@
 
 #include <asm/hardware/iop3xx.h>
 
-extern void __iomem *__iop3xx_ioremap(unsigned long cookie, size_t size,
-	unsigned int mtype);
-extern void __iop3xx_iounmap(void __iomem *addr);
-
 #define IO_SPACE_LIMIT		0xffffffff
 #define __io(p)		((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
 #define __mem_pci(a)		(a)
 
-#define __arch_ioremap	__iop3xx_ioremap
-#define __arch_iounmap	__iop3xx_iounmap
-
 #endif
arch/arm/plat-iop/Makefile +0 -2
index 69b09c1cec..90f7153a8d 100644
@@ -10,7 +10,6 @@ obj-$(CONFIG_ARCH_IOP32X) += i2c.o
 obj-$(CONFIG_ARCH_IOP32X) += pci.o
 obj-$(CONFIG_ARCH_IOP32X) += setup.o
 obj-$(CONFIG_ARCH_IOP32X) += time.o
-obj-$(CONFIG_ARCH_IOP32X) += io.o
 obj-$(CONFIG_ARCH_IOP32X) += cp6.o
 obj-$(CONFIG_ARCH_IOP32X) += adma.o
 obj-$(CONFIG_ARCH_IOP32X) += pmu.o
@@ -21,7 +20,6 @@ obj-$(CONFIG_ARCH_IOP33X) += i2c.o
 obj-$(CONFIG_ARCH_IOP33X) += pci.o
 obj-$(CONFIG_ARCH_IOP33X) += setup.o
 obj-$(CONFIG_ARCH_IOP33X) += time.o
-obj-$(CONFIG_ARCH_IOP33X) += io.o
 obj-$(CONFIG_ARCH_IOP33X) += cp6.o
 obj-$(CONFIG_ARCH_IOP33X) += adma.o
 obj-$(CONFIG_ARCH_IOP33X) += pmu.o
arch/arm/plat-iop/io.c deleted +0 -59

59 lines not on this page · raw message

Signature · 1 line
1.7.7-rc0
#28 lore raw

PATCH 15/19 mm: add vm_area_add_early()

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

The existing vm_area_register_early() allows for early vmalloc space allocation. However upcoming cleanups in the ARM architecture require that some fixed locations in the vmalloc area be reserved also very early.

The name "vm_area_register_early" would have been a good name for the reservation part without the allocation. Since it is already in use with different semantics, let's create vm_area_add_early() instead.

Both vm_area_register_early() and vm_area_add_early() can be used together meaning that the former is now implemented using the later where it is ensured that no conflicting areas are added, but no attempt is made to make the allocation scheme in vm_area_register_early() more sophisticated. After all, you must know what you're doing when using those functions.

Cc linux-mm at kvack.org
---
 include/linux/vmalloc.h |    1 +
 mm/vmalloc.c            |   28 ++++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)
include/linux/vmalloc.h +1 -0
index 9332e52ea8..e7d2cba995 100644
@@ -130,6 +130,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count);
  */
 extern rwlock_t vmlist_lock;
 extern struct vm_struct *vmlist;
+extern __init void vm_area_add_early(struct vm_struct *vm);
 extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
 
 #ifdef CONFIG_SMP
mm/vmalloc.c +26 -2
index 7ef0903058..bf20a0ff95 100644
@@ -1118,6 +1118,31 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t pro
 EXPORT_SYMBOL(vm_map_ram);
 
 /**
+ * vm_area_add_early - add vmap area early during boot
+ * @vm: vm_struct to add
+ *
+ * This function is used to add fixed kernel vm area to vmlist before
+ * vmalloc_init() is called.  @vm->addr, @vm->size, and @vm->flags
+ * should contain proper values and the other fields should be zero.
+ *
+ * DO NOT USE THIS FUNCTION UNLESS YOU KNOW WHAT YOU'RE DOING.
+ */
+void __init vm_area_add_early(struct vm_struct *vm)
+{
+	struct vm_struct *tmp, **p;
+
+	for (p = &vmlist; (tmp = *p) != NULL; p = &tmp->next) {
+		if (tmp->addr >= vm->addr) {
+			BUG_ON(tmp->addr < vm->addr + vm->size);
+			break;
+		} else
+			BUG_ON(tmp->addr + tmp->size > vm->addr);
+	}
+	vm->next = *p;
+	*p = vm;
+}
+
+/**
  * vm_area_register_early - register vmap area early during boot
  * @vm: vm_struct to register
  * @align: requested alignment
@@ -1139,8 +1164,7 @@ void __init vm_area_register_early(struct vm_struct *vm, size_t align)
 
 	vm->addr = (void *)addr;
 
-	vm->next = vmlist;
-	vmlist = vm;
+	vm_area_add_early(vm);
 }
 
 void __init vmalloc_init(void)
Signature · 1 line
1.7.7-rc0
#29 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

In order to remove the build time variation between different SOCs with regards to VMALLOC_END, the iotable mappings are now allocated inside the vmalloc region. This allows for VMALLOC_END to be identical across all machines.

---
 arch/arm/include/asm/pgtable.h |    8 +------
 arch/arm/mm/mmu.c              |   42 +++++++++++++++++++++++++++++----------
 2 files changed, 32 insertions(+), 18 deletions(-)
arch/arm/include/asm/pgtable.h +1 -7
index 5750704e02..950dee3ce2 100644
@@ -21,7 +21,6 @@
 #else
 
 #include <asm/memory.h>
-#include <mach/vmalloc.h>
 #include <asm/pgtable-hwdef.h>
 
 /*
@@ -31,15 +30,10 @@
  * any out-of-bounds memory accesses will hopefully be caught.
  * The vmalloc() routines leaves a hole of 4kB between each vmalloced
  * area for the same reason. ;)
- *
- * Note that platforms may override VMALLOC_START, but they must provide
- * VMALLOC_END.  VMALLOC_END defines the (exclusive) limit of this space,
- * which may not overlap IO space.
  */
-#ifndef VMALLOC_START
 #define VMALLOC_OFFSET		(8*1024*1024)
 #define VMALLOC_START		(((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
-#endif
+#define VMALLOC_END		0xff000000UL
 
 /*
  * Hardware-wise, we have a two level page table structure, where the first
arch/arm/mm/mmu.c +31 -11

94 lines not on this page · raw message

Signature · 1 line
1.7.7-rc0
#30 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

Hi Nicolas,

Quoted 29 lines · Nicolas Pitre

From: Nicolas Pitre <[email protected]>

In order to remove the build time variation between different SOCs with regards to VMALLOC_END, the iotable mappings are now allocated inside the vmalloc region. This allows for VMALLOC_END to be identical across all machines.

---
 arch/arm/include/asm/pgtable.h |    8 +------
 arch/arm/mm/mmu.c              |   42 +++++++++++++++++++++++++++++----------
 2 files changed, 32 insertions(+), 18 deletions(-)
arch/arm/include/asm/pgtable.h +0 -1
index 5750704e02..950dee3ce2 100644
@@ -21,7 +21,6 @@
 #else
 
 #include <asm/memory.h>
-#include <mach/vmalloc.h>
 #include <asm/pgtable-hwdef.h>
 
 /*
@@ -31,15 +30,10 @@
  * any out-of-bounds memory accesses will hopefully be caught.
  * The vmalloc() routines leaves a hole of 4kB between each vmalloced
  * area for the same reason. ;)

arch/arm/include/asm/pgtable.h line 36

Quoted 10 lines
arch/arm/include/asm/pgtable.h +1 -6
- *
- * Note that platforms may override VMALLOC_START, but they must provide
- * VMALLOC_END.  VMALLOC_END defines the (exclusive) limit of this space,
- * which may not overlap IO space.
  */
-#ifndef VMALLOC_START
 #define VMALLOC_OFFSET		(8*1024*1024)
 #define VMALLOC_START		(((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
-#endif
+#define VMALLOC_END		0xff000000UL

Only a minor nit, but I think this requires an update to Documentation/arm/memory.txt as this says that VMALLOC_END -> feffffff is free for platform use but this won't ever be true now.

Jamie

#31 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

In reply to Nicolas Pitre

arch/arm/mm/mmu.c static void __init create_mapping(struct map_desc *md) · line 730

Quoted 8 lines · Nicolas Pitre

void __init iotable_init(struct map_desc *io_desc, int nr) {

arch/arm/mm/mmu.c +5 -1
-	int i;
+	struct map_desc *md;
+	struct vm_struct *vm;
+
+	vm = __va(memblock_alloc(sizeof(*vm) * nr, __alignof__(*vm)));
+	memset(vm, 0, sizeof(*vm) * nr);

Any reason not to adapt early_alloc() ?

Quoted 6 lines
arch/arm/mm/mmu.c +3 -2
-	for (i = 0; i < nr; i++)
-		create_mapping(io_desc + i);
+	for (md = io_desc; nr; md++, nr--) {
+		create_mapping(md);
+		vm->addr = (void *)(md->virtual & PAGE_MASK);

arch/arm/mm/mmu.c static void __init create_mapping(struct map_desc *md) · line 743

Quoted 10 lines
arch/arm/mm/mmu.c +7 -1
+		vm->size = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));
+		vm->phys_addr = __pfn_to_phys(md->pfn); 
+		vm->flags = VM_IOREMAP;
+		vm->caller = iotable_init;
+		vm_area_add_early(vm++);
+	}
 }
 
-static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);
+static void * __initdata vmalloc_min = (void *)(0xf0000000UL - VMALLOC_OFFSET);

This is silly. You're defining VMALLOC_END to be 0xff000000UL, and then defining this to be 0xf0000000UL - 8MB. Why hide the 240MB inside these constants? Why not set it to VMALLOC_END - 240MB - VMALLOC_OFFSET - making the size in their _explicit_ instead of hidden?

arch/arm/mm/mmu.c void __init sanity_check_meminfo(void) · line 869

Quoted 13 lines

/*
* vmalloc=size forces the vmalloc area to be exactly 'size'
* bytes. This can be used to increase (or decrease) the vmalloc
- * area - the default is 128m.
+ * area - the default is 240m.
*/
static int __init early_vmalloc(char *arg)
{

arch/arm/mm/mmu.c +1 -0
@@ -853,6 +866,7 @@ void __init sanity_check_meminfo(void)
 #endif
 	meminfo.nr_banks = j;
 	memblock_set_current_limit(lowmem_limit);
+	high_memory = __va(lowmem_limit - 1) + 1;

NAK. This ends up initializing this setting twice during the boot, potentially leading to bugs because they're both done in different ways. You don't describe why this change is necessary so I assume that it's part of some debugging you were trying and shouldn't be in this patch.

arch/arm/mm/mmu.c static void __init devicemaps_init(struct machine_desc *mdesc) · line 997

Quoted 8 lines
arch/arm/mm/mmu.c +4 -0
@@ -977,6 +991,12 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
 	}
 
 	/*
+	 * Clear the vmalloc area.
+	 */
+	for (addr = VMALLOC_START; addr < VMALLOC_END; addr += PGDIR_SIZE)
+		pmd_clear(pmd_off_k(addr));

Why not combine this with the clearance above:

        for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
                pmd_clear(pmd_off_k(addr));

?

#32 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

Quoted 11 lines · Russell King - ARM Linux

arch/arm/mm/mmu.c static void __init create_mapping(struct map_desc *md) · line 730

Quoted 8 lines · Nicolas Pitre

void __init iotable_init(struct map_desc *io_desc, int nr) {

arch/arm/mm/mmu.c +5 -1
-	int i;
+	struct map_desc *md;
+	struct vm_struct *vm;
+
+	vm = __va(memblock_alloc(sizeof(*vm) * nr, __alignof__(*vm)));
+	memset(vm, 0, sizeof(*vm) * nr);

Any reason not to adapt early_alloc() ?

It uses the size for the alignment argument. This is way too large an alignment in this case. The size as alignment makes perfect sense in the other cases, and providing it explicitly for those cases might look strange. But if you prefer that I'll just do it.

Quoted 14 lines
Quoted 14 lines
arch/arm/mm/mmu.c +9 -2
-	for (i = 0; i < nr; i++)
-		create_mapping(io_desc + i);
+	for (md = io_desc; nr; md++, nr--) {
+		create_mapping(md);
+		vm->addr = (void *)(md->virtual & PAGE_MASK);
+		vm->size = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));
+		vm->phys_addr = __pfn_to_phys(md->pfn); 
+		vm->flags = VM_IOREMAP;
+		vm->caller = iotable_init;
+		vm_area_add_early(vm++);
+	}
 }
Quoted 7 lines

arch/arm/mm/mmu.c static void __init create_mapping(struct map_desc *md) · line 743

Quoted 2 lines
arch/arm/mm/mmu.c +1 -1
-static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);
+static void * __initdata vmalloc_min = (void *)(0xf0000000UL - VMALLOC_OFFSET);

This is silly. You're defining VMALLOC_END to be 0xff000000UL, and then defining this to be 0xf0000000UL - 8MB. Why hide the 240MB inside these constants? Why not set it to VMALLOC_END - 240MB - VMALLOC_OFFSET - making the size in their _explicit_ instead of hidden?

Actually I care more about the absolute start address than the size this ends up creating. This is to accommodate some of the static mappings that starts at 0xf0000000 on machines with a potential to have enough RAM that could map higher than that. It just happens that this corresponds to 240MB.

Quoted 8 lines
Quoted 8 lines

/*
* vmalloc=size forces the vmalloc area to be exactly 'size'
* bytes. This can be used to increase (or decrease) the vmalloc
- * area - the default is 128m.
+ * area - the default is 240m.
*/
static int __init early_vmalloc(char *arg)
{

Quoted 8 lines

arch/arm/mm/mmu.c void __init sanity_check_meminfo(void) · line 869

Quoted 5 lines
arch/arm/mm/mmu.c +1 -0
@@ -853,6 +866,7 @@ void __init sanity_check_meminfo(void)
 #endif
 	meminfo.nr_banks = j;
 	memblock_set_current_limit(lowmem_limit);
+	high_memory = __va(lowmem_limit - 1) + 1;

NAK. This ends up initializing this setting twice during the boot, potentially leading to bugs because they're both done in different ways.

In that case I should remove the other one.

Quoted 2 lines

You don't describe why this change is necessary so I assume that it's part of some debugging you were trying and shouldn't be in this patch.

No, it noe has to be set before create_mapping() is called so the final VMALLOC_START address is known.

Quoted 11 lines

arch/arm/mm/mmu.c static void __init devicemaps_init(struct machine_desc *mdesc) · line 997

Quoted 8 lines
arch/arm/mm/mmu.c +4 -0
@@ -977,6 +991,12 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
 	}
 
 	/*
+	 * Clear the vmalloc area.
+	 */
+	for (addr = VMALLOC_START; addr < VMALLOC_END; addr += PGDIR_SIZE)
+		pmd_clear(pmd_off_k(addr));

Why not combine this with the clearance above:

Quoted 4 lines
        for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
                pmd_clear(pmd_off_k(addr));

?

Because I wanted to keep the mapping for the DEBUG_LL code alive as long as possible.

Nicolas

#33 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

Quoted 14 lines · Nicolas Pitre
Quoted 11 lines · Russell King - ARM Linux

arch/arm/mm/mmu.c static void __init create_mapping(struct map_desc *md) · line 730

Quoted 8 lines · Nicolas Pitre

void __init iotable_init(struct map_desc *io_desc, int nr) {

arch/arm/mm/mmu.c +5 -1
-	int i;
+	struct map_desc *md;
+	struct vm_struct *vm;
+
+	vm = __va(memblock_alloc(sizeof(*vm) * nr, __alignof__(*vm)));
+	memset(vm, 0, sizeof(*vm) * nr);

Any reason not to adapt early_alloc() ?

Quoted 4 lines

It uses the size for the alignment argument. This is way too large an alignment in this case. The size as alignment makes perfect sense in the other cases, and providing it explicitly for those cases might look strange. But if you prefer that I'll just do it.

Just change early_alloc() to also take the alignment and then fix up the existing callers. It's silly to open-code the __va() + memset().

Quoted 10 lines
Quoted 4 lines

This is silly. You're defining VMALLOC_END to be 0xff000000UL, and then defining this to be 0xf0000000UL - 8MB. Why hide the 240MB inside these constants? Why not set it to VMALLOC_END - 240MB - VMALLOC_OFFSET - making the size in their _explicit_ instead of hidden?

Actually I care more about the absolute start address than the size this ends up creating. This is to accommodate some of the static mappings that starts at 0xf0000000 on machines with a potential to have enough RAM that could map higher than that. It just happens that this corresponds to 240MB.

We should stick to dealing with the size of vmalloc area rather than an absolute address range as that's what we present to users via the vmalloc= argument to the kernel.

Quoted 17 lines
Quoted 8 lines
Quoted 8 lines

/*
* vmalloc=size forces the vmalloc area to be exactly 'size'
* bytes. This can be used to increase (or decrease) the vmalloc
- * area - the default is 128m.
+ * area - the default is 240m.
*/
static int __init early_vmalloc(char *arg)
{

Quoted 8 lines

arch/arm/mm/mmu.c void __init sanity_check_meminfo(void) · line 869

Quoted 5 lines
arch/arm/mm/mmu.c +1 -0
@@ -853,6 +866,7 @@ void __init sanity_check_meminfo(void)
 #endif
 	meminfo.nr_banks = j;
 	memblock_set_current_limit(lowmem_limit);
+	high_memory = __va(lowmem_limit - 1) + 1;

NAK. This ends up initializing this setting twice during the boot, potentially leading to bugs because they're both done in different ways.

Quoted 1 line

In that case I should remove the other one.

If you do that, don't forget to fix nommu as well.

Quoted 11 lines
Quoted 11 lines

arch/arm/mm/mmu.c static void __init devicemaps_init(struct machine_desc *mdesc) · line 997

Quoted 8 lines
arch/arm/mm/mmu.c +4 -0
@@ -977,6 +991,12 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
 	}
 
 	/*
+	 * Clear the vmalloc area.
+	 */
+	for (addr = VMALLOC_START; addr < VMALLOC_END; addr += PGDIR_SIZE)
+		pmd_clear(pmd_off_k(addr));

Why not combine this with the clearance above:

Quoted 7 lines
Quoted 4 lines
        for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
                pmd_clear(pmd_off_k(addr));

?

Because I wanted to keep the mapping for the DEBUG_LL code alive as long as possible.

You can't put DEUBG_LL code into create_mapping() anyway because at some point it will be called without the mapping in place, even with your modified code.

It's not like we have a lot of code between those two points - we've done most of the allocation (eg vectors page), so the only failure point is if L2 page table allocation fails - but that's true of almost any create_mapping() call.

So, I don't see the benefit of delaying the clearance.

#34 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

Quoted 12 lines · Russell King - ARM Linux
Quoted 11 lines · Nicolas Pitre
Quoted 8 lines · Russell King - ARM Linux

Review void __init sanity_check_meminfo(void) · line 869

Quoted 5 lines
(quoted diff) +1 -0
@@ -853,6 +866,7 @@ void __init sanity_check_meminfo(void)
 #endif
 	meminfo.nr_banks = j;
 	memblock_set_current_limit(lowmem_limit);
+	high_memory = __va(lowmem_limit - 1) + 1;

NAK. This ends up initializing this setting twice during the boot, potentially leading to bugs because they're both done in different ways.

Quoted 3 lines
Quoted 1 line

In that case I should remove the other one.

If you do that, don't forget to fix nommu as well.

OK, so I moved this into a patch of its own not to confuse things. Here it is:

----- >8

From: Nicolas Pitre <[email protected]>
Subject: [PATCH] ARM: move initialization of the high_memory variable earlier

Some upcoming changes must know the VMALLOC_START value, which is based on high_memory, before bootmem_init() is called.

The best location to set it is in sanity_check_meminfo() where the needed computation is already done, and in the non MMU case it is trivial to do now that the meminfo array is already sorted at that point.

---
 arch/arm/mm/init.c  |    2 --
 arch/arm/mm/mmu.c   |    1 +
 arch/arm/mm/nommu.c |    2 ++
 3 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mm/init.c +0 -2
index c82a817689..b5e953ea58 100644
@@ -380,8 +380,6 @@ void __init bootmem_init(void)
 	 */
 	arm_bootmem_free(min, max_low, max_high);
 
-	high_memory = __va(((phys_addr_t)max_low << PAGE_SHIFT) - 1) + 1;
-
 	/*
 	 * This doesn't seem to be used by the Linux memory manager any
 	 * more, but is used by ll_rw_block.  If we can get rid of it, we
arch/arm/mm/mmu.c +1 -0
index 594d677b92..eefb8ed5de 100644
@@ -852,6 +852,7 @@ void __init sanity_check_meminfo(void)
 	}
 #endif
 	meminfo.nr_banks = j;
+	high_memory = __va(lowmem_limit - 1) + 1;
 	memblock_set_current_limit(lowmem_limit);
 }
 
arch/arm/mm/nommu.c +2 -0
index 941a98c9e8..9348730a6b 100644
@@ -29,6 +29,8 @@ void __init arm_mm_memblock_reserve(void)
 
 void __init sanity_check_meminfo(void)
 {
+	phys_addr_t end = bank_phys_end(&meminfo.bank[meminfo.nr_banks - 1]);
+	high_memory = __va(end - 1) + 1;
 }
 
 /*
#35 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

Quoted 2 lines · Nicolas Pitre

OK, so I moved this into a patch of its own not to confuse things. Here it is:

Looks fine, thanks.

#36 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

In reply to Russell King - ARM Linux
Quoted 51 lines · Russell King - ARM Linux
Quoted 8 lines · Nicolas Pitre
Quoted 1 line · Russell King - ARM Linux

Any reason not to adapt early_alloc() ?

It uses the size for the alignment argument. This is way too large an alignment in this case. The size as alignment makes perfect sense in the other cases, and providing it explicitly for those cases might look strange. But if you prefer that I'll just do it.

Just change early_alloc() to also take the alignment and then fix up the existing callers. It's silly to open-code the __va() + memset().

Quoted 10 lines
Quoted 4 lines

This is silly. You're defining VMALLOC_END to be 0xff000000UL, and then defining this to be 0xf0000000UL - 8MB. Why hide the 240MB inside these constants? Why not set it to VMALLOC_END - 240MB - VMALLOC_OFFSET - making the size in their _explicit_ instead of hidden?

Actually I care more about the absolute start address than the size this ends up creating. This is to accommodate some of the static mappings that starts at 0xf0000000 on machines with a potential to have enough RAM that could map higher than that. It just happens that this corresponds to 240MB.

We should stick to dealing with the size of vmalloc area rather than an absolute address range as that's what we present to users via the vmalloc= argument to the kernel.

Quoted 11 lines
Quoted 11 lines

Review static void __init devicemaps_init(struct machine_desc *mdesc) · line 997

Quoted 8 lines
(quoted diff) +4 -0
@@ -977,6 +991,12 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
 	}
 
 	/*
+	 * Clear the vmalloc area.
+	 */
+	for (addr = VMALLOC_START; addr < VMALLOC_END; addr += PGDIR_SIZE)
+		pmd_clear(pmd_off_k(addr));

Why not combine this with the clearance above:

Quoted 7 lines
Quoted 4 lines
        for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
                pmd_clear(pmd_off_k(addr));

?

Because I wanted to keep the mapping for the DEBUG_LL code alive as long as possible.

You can't put DEUBG_LL code into create_mapping() anyway because at some point it will be called without the mapping in place, even with your modified code.

Quoted 6 lines

It's not like we have a lot of code between those two points - we've done most of the allocation (eg vectors page), so the only failure point is if L2 page table allocation fails - but that's true of almost any create_mapping() call.

So, I don't see the benefit of delaying the clearance.

OK, here we go with version 2:

----- >8

From: Nicolas Pitre <[email protected]>
Subject: [PATCH v2] ARM: move iotable mappings within the vmalloc region

In order to remove the build time variation between different SOCs with regards to VMALLOC_END, the iotable mappings are now allocated inside the vmalloc region. This allows for VMALLOC_END to be identical across all machines.

The value for VMALLOC_END is now set to 0xff000000 which is right where the consistent DMA area starts.

To accommodate all static mappings on machines with possible highmem usage, the default vmalloc area size is changed to 240 MB so that VMALLOC_START is no higher than 0xf0000000 by default in that case.

---
 Documentation/arm/memory.txt   |   11 +++----
 arch/arm/include/asm/pgtable.h |    8 +-----
 arch/arm/mm/mmu.c              |   46 +++++++++++++++++++++++----------
 3 files changed, 38 insertions(+), 27 deletions(-)
Documentation/arm/memory.txt +5 -6
index 771d48d3b3..caee992bb8 100644
@@ -51,15 +51,14 @@ ffc00000	ffefffff	DMA memory mapping region.  Memory returned
 ff000000	ffbfffff	Reserved for future expansion of DMA
 				mapping region.
 
-VMALLOC_END	feffffff	Free for platform use, recommended.
-				VMALLOC_END must be aligned to a 2MB
-				boundary.
-
 VMALLOC_START	VMALLOC_END-1	vmalloc() / ioremap() space.
 				Memory returned by vmalloc/ioremap will
 				be dynamically placed in this region.
-				VMALLOC_START may be based upon the value
-				of the high_memory variable.
+				Machine specific static mappings are also
+				located here through iotable_init().
+				VMALLOC_START is based upon the value
+				of the high_memory variable, and VMALLOC_END
+				is at the beginning of the DMA mapping region.
 
 PAGE_OFFSET	high_memory-1	Kernel direct-mapped RAM region.
 				This maps the platforms RAM, and typically
arch/arm/include/asm/pgtable.h +1 -7
index 5750704e02..950dee3ce2 100644
@@ -21,7 +21,6 @@
 #else
 
 #include <asm/memory.h>
-#include <mach/vmalloc.h>
 #include <asm/pgtable-hwdef.h>
 
 /*
@@ -31,15 +30,10 @@
  * any out-of-bounds memory accesses will hopefully be caught.
  * The vmalloc() routines leaves a hole of 4kB between each vmalloced
  * area for the same reason. ;)
- *
- * Note that platforms may override VMALLOC_START, but they must provide
- * VMALLOC_END.  VMALLOC_END defines the (exclusive) limit of this space,
- * which may not overlap IO space.
  */
-#ifndef VMALLOC_START
 #define VMALLOC_OFFSET		(8*1024*1024)
 #define VMALLOC_START		(((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
-#endif
+#define VMALLOC_END		0xff000000UL
 
 /*
  * Hardware-wise, we have a two level page table structure, where the first
arch/arm/mm/mmu.c +32 -14

103 lines not on this page · raw message

#37 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

Quoted 1 line · Nicolas Pitre

OK, here we go with version 2:

Looks fine, thanks.

#38 lore raw

PATCH 16/19 ARM: move iotable mappings within the vmalloc region

Quoted 4 lines · Russell King - ARM Linux
Quoted 1 line · Nicolas Pitre

OK, here we go with version 2:

Looks fine, thanks.

This is an ACK?

Nicolas

#39 lore raw

PATCH 17/19 ARM: simplify __iounmap() when dealing with section based mapping

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

Firstly, there is no need to have a double pointer here as we're only walking the vmlist and not modifying it.

Secondly, for the same reason, we don't need a write lock but only a read lock here, since the lock only protects the coherency of the list nothing else.

Lastly, the reason for holding a lock is not what the comment says, so let's remove that misleading piece of information.

---
 arch/arm/mm/ioremap.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
arch/arm/mm/ioremap.c +9 -11
index ab506272b2..1ddcd8aa34 100644
@@ -293,26 +293,24 @@ void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
 #ifndef CONFIG_SMP
-	struct vm_struct **p, *tmp;
+	struct vm_struct *vm;
 
 	/*
 	 * If this is a section based mapping we need to handle it
 	 * specially as the VM subsystem does not know how to handle
-	 * such a beast. We need the lock here b/c we need to clear
-	 * all the mappings before the area can be reclaimed
-	 * by someone else.
+	 * such a beast.
 	 */
-	write_lock(&vmlist_lock);
-	for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
-		if ((tmp->flags & VM_IOREMAP) && (tmp->addr == addr)) {
-			if (tmp->flags & VM_ARM_SECTION_MAPPING) {
-				unmap_area_sections((unsigned long)tmp->addr,
-						    tmp->size);
+	read_lock(&vmlist_lock);
+	for (vm = vmlist; vm; vm = vm->next) {
+		if ((vm->flags & VM_IOREMAP) && (vm->addr == addr)) {
+			if (vm->flags & VM_ARM_SECTION_MAPPING) {
+				unmap_area_sections((unsigned long)vm->addr,
+						    vm->size);
 			}
 			break;
 		}
 	}
-	write_unlock(&vmlist_lock);
+	read_unlock(&vmlist_lock);
 #endif
 
 	vunmap(addr);
Signature · 1 line
1.7.7-rc0
#40 lore raw

PATCH 18/19 ARM: add generic ioremap optimization by reusing static mappings

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

Now that we have all the static mappings from iotable_init() located in the vmalloc area, it is trivial to optimize ioremap by reusing those static mappings when the requested physical area fits in one of them, and so in a generic way for all platforms.

---
 arch/arm/mm/ioremap.c |   60 ++++++++++++++++++++++++++++++++++--------------
 arch/arm/mm/mm.h      |   14 +++++++++++
 arch/arm/mm/mmu.c     |    3 +-
 3 files changed, 58 insertions(+), 19 deletions(-)
arch/arm/mm/ioremap.c +42 -18
index 1ddcd8aa34..8a6ceb10d6 100644
@@ -36,12 +36,6 @@
 #include <asm/mach/map.h>
 #include "mm.h"
 
-/*
- * Used by ioremap() and iounmap() code to mark (super)section-mapped
- * I/O regions in vm_struct->flags field.
- */
-#define VM_ARM_SECTION_MAPPING	0x80000000
-
 int ioremap_page(unsigned long virt, unsigned long phys,
 		 const struct mem_type *mtype)
 {
@@ -216,6 +210,28 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
 	 */
 	size = PAGE_ALIGN(offset + size);
 
+	/*
+	 * Try to reuse one of the static mapping whenever possible.
+	 */
+	read_lock(&vmlist_lock);
+	for (area = vmlist; area; area = area->next) {
+		if (!size || (sizeof(phys_addr_t) == 4 && pfn >= 0x100000))
+			break;
+		if (!(area->flags & VM_ARM_STATIC_MAPPING))
+			continue;
+		if ((area->flags & VM_ARM_MTYPE_MASK) != VM_ARM_MTYPE(mtype))
+			continue;
+		if (__phys_to_pfn(area->phys_addr) > pfn ||
+		    __pfn_to_phys(pfn) + size-1 > area->phys_addr + area->size-1)
+			continue;
+		/* we can drop the lock here as we know *area is static */
+		read_unlock(&vmlist_lock);
+		addr = (unsigned long)area->addr;
+		addr += __pfn_to_phys(pfn) - area->phys_addr;
+		return (void __iomem *) (offset + addr);
+	}
+	read_unlock(&vmlist_lock);
+
 	area = get_vm_area_caller(size, VM_IOREMAP, caller);
  	if (!area)
  		return NULL;
@@ -292,26 +308,34 @@ EXPORT_SYMBOL(__arm_ioremap);
 void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
-#ifndef CONFIG_SMP
 	struct vm_struct *vm;
 
-	/*
-	 * If this is a section based mapping we need to handle it
-	 * specially as the VM subsystem does not know how to handle
-	 * such a beast.
-	 */
 	read_lock(&vmlist_lock);
 	for (vm = vmlist; vm; vm = vm->next) {
-		if ((vm->flags & VM_IOREMAP) && (vm->addr == addr)) {
-			if (vm->flags & VM_ARM_SECTION_MAPPING) {
-				unmap_area_sections((unsigned long)vm->addr,
-						    vm->size);
-			}
+		if (vm->addr > addr)
 			break;
+		if (!(vm->flags & VM_IOREMAP))
+			continue;
+		/* If this is a static mapping we must leave it alone */
+		if ((vm->flags & VM_ARM_STATIC_MAPPING) &&
+		    (vm->addr <= addr) && (vm->addr + vm->size > addr)) {
+			read_unlock(&vmlist_lock);
+			return;
 		}
+#ifndef CONFIG_SMP
+		/*
+		 * If this is a section based mapping we need to handle it
+		 * specially as the VM subsystem does not know how to handle
+		 * such a beast.
+		 */
+		if ((vm->addr == addr) &&
+		    (vm->flags & VM_ARM_SECTION_MAPPING)) {
+			unmap_area_sections((unsigned long)vm->addr, vm->size);
+			break;
+		}
+#endif
 	}
 	read_unlock(&vmlist_lock);
-#endif
 
 	vunmap(addr);
 }
arch/arm/mm/mm.h +14 -0
index 010566799c..7b7c9ca079 100644
@@ -21,6 +21,20 @@ const struct mem_type *get_mem_type(unsigned int type);
 
 extern void __flush_dcache_page(struct address_space *mapping, struct page *page);
 
+/*
+ * ARM specific vm_struct->flags bits. field.
+ */
+
+/* (super)section-mapped I/O regions used by ioremap()/iounmap() */
+#define VM_ARM_SECTION_MAPPING	0x80000000
+
+/* permanent static mappings from iotable_init() */
+#define VM_ARM_STATIC_MAPPING	0x40000000
+
+/* mapping type (attributes) for permanent static mappings */
+#define VM_ARM_MTYPE(mt)		((mt) << 20)
+#define VM_ARM_MTYPE_MASK	(0x1f << 20)
+
 #endif
 
 #ifdef CONFIG_ZONE_DMA
arch/arm/mm/mmu.c +2 -1
index 6996576488..b5eddf1fff 100644
@@ -734,7 +734,8 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
 		vm->addr = (void *)(md->virtual & PAGE_MASK);
 		vm->size = PAGE_ALIGN(md->length + (md->virtual & ~PAGE_MASK));
 		vm->phys_addr = __pfn_to_phys(md->pfn); 
-		vm->flags = VM_IOREMAP;
+		vm->flags = VM_IOREMAP | VM_ARM_STATIC_MAPPING; 
+		vm->flags |= VM_ARM_MTYPE(md->type);
 		vm->caller = iotable_init;
 		vm_area_add_early(vm++);
 	}
Signature · 1 line
1.7.7-rc0
#41 lore raw

PATCH 19/19 ARM: big removal of now unused vmalloc.h files

In reply to Nicolas Pitre

From: Nicolas Pitre <[email protected]>

---
 arch/arm/mach-at91/include/mach/vmalloc.h       |   26 ---------------------
 arch/arm/mach-bcmring/include/mach/vmalloc.h    |   25 --------------------
 arch/arm/mach-clps711x/include/mach/vmalloc.h   |   20 ----------------
 arch/arm/mach-cns3xxx/include/mach/vmalloc.h    |   11 ---------
 arch/arm/mach-davinci/include/mach/vmalloc.h    |   14 -----------
 arch/arm/mach-dove/include/mach/vmalloc.h       |    5 ----
 arch/arm/mach-ebsa110/include/mach/vmalloc.h    |   10 --------
 arch/arm/mach-ep93xx/include/mach/vmalloc.h     |    5 ----
 arch/arm/mach-exynos4/include/mach/vmalloc.h    |   22 ------------------
 arch/arm/mach-footbridge/include/mach/vmalloc.h |   10 --------
 arch/arm/mach-gemini/include/mach/vmalloc.h     |   10 --------
 arch/arm/mach-h720x/include/mach/vmalloc.h      |   10 --------
 arch/arm/mach-integrator/include/mach/vmalloc.h |   20 ----------------
 arch/arm/mach-iop13xx/include/mach/vmalloc.h    |    4 ---
 arch/arm/mach-iop32x/include/mach/vmalloc.h     |    5 ----
 arch/arm/mach-iop33x/include/mach/vmalloc.h     |    5 ----
 arch/arm/mach-ixp2000/include/mach/vmalloc.h    |   20 ----------------
 arch/arm/mach-ixp23xx/include/mach/vmalloc.h    |   10 --------
 arch/arm/mach-ixp4xx/include/mach/vmalloc.h     |    5 ----
 arch/arm/mach-kirkwood/include/mach/vmalloc.h   |    5 ----
 arch/arm/mach-ks8695/include/mach/vmalloc.h     |   19 ---------------
 arch/arm/mach-lpc32xx/include/mach/vmalloc.h    |   24 -------------------
 arch/arm/mach-mmp/include/mach/vmalloc.h        |    5 ----
 arch/arm/mach-msm/include/mach/vmalloc.h        |   22 ------------------
 arch/arm/mach-mv78xx0/include/mach/vmalloc.h    |    5 ----
 arch/arm/mach-mxs/include/mach/vmalloc.h        |   22 ------------------
 arch/arm/mach-netx/include/mach/vmalloc.h       |   19 ---------------
 arch/arm/mach-nomadik/include/mach/vmalloc.h    |    2 -
 arch/arm/mach-nuc93x/include/mach/vmalloc.h     |   23 ------------------
 arch/arm/mach-omap1/include/mach/vmalloc.h      |   20 ----------------
 arch/arm/mach-omap2/include/mach/vmalloc.h      |   20 ----------------
 arch/arm/mach-orion5x/include/mach/vmalloc.h    |    5 ----
 arch/arm/mach-pnx4008/include/mach/vmalloc.h    |   20 ----------------
 arch/arm/mach-prima2/include/mach/vmalloc.h     |   16 -------------
 arch/arm/mach-pxa/include/mach/vmalloc.h        |   11 ---------
 arch/arm/mach-realview/include/mach/vmalloc.h   |   21 -----------------
 arch/arm/mach-rpc/include/mach/vmalloc.h        |   10 --------
 arch/arm/mach-s3c2410/include/mach/vmalloc.h    |   20 ----------------
 arch/arm/mach-s3c64xx/include/mach/vmalloc.h    |   20 ----------------
 arch/arm/mach-s5p64x0/include/mach/vmalloc.h    |   20 ----------------
 arch/arm/mach-s5pc100/include/mach/vmalloc.h    |   17 --------------
 arch/arm/mach-s5pv210/include/mach/vmalloc.h    |   22 ------------------
 arch/arm/mach-sa1100/include/mach/vmalloc.h     |    4 ---
 arch/arm/mach-shark/include/mach/vmalloc.h      |    4 ---
 arch/arm/mach-shmobile/include/mach/vmalloc.h   |    7 -----
 arch/arm/mach-spear3xx/include/mach/vmalloc.h   |   19 ---------------
 arch/arm/mach-spear6xx/include/mach/vmalloc.h   |   19 ---------------
 arch/arm/mach-tegra/include/mach/vmalloc.h      |   28 -----------------------
 arch/arm/mach-u300/include/mach/vmalloc.h       |   12 ---------
 arch/arm/mach-ux500/include/mach/vmalloc.h      |   18 --------------
 arch/arm/mach-versatile/include/mach/vmalloc.h  |   21 -----------------
 arch/arm/mach-vexpress/include/mach/vmalloc.h   |   21 -----------------
 arch/arm/mach-vt8500/include/mach/vmalloc.h     |   20 ----------------
 arch/arm/mach-w90x900/include/mach/vmalloc.h    |   23 ------------------
 arch/arm/mach-zynq/include/mach/vmalloc.h       |   20 ----------------
 arch/arm/plat-mxc/include/mach/vmalloc.h        |   22 ------------------
 arch/arm/plat-spear/include/plat/vmalloc.h      |   19 ---------------
 arch/arm/plat-tcc/include/mach/vmalloc.h        |   10 --------
 58 files changed, 0 insertions(+), 872 deletions(-)
 delete mode 100644 arch/arm/mach-at91/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-bcmring/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-clps711x/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-cns3xxx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-davinci/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-dove/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-ebsa110/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-ep93xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-exynos4/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-footbridge/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-gemini/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-h720x/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-integrator/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-iop13xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-iop32x/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-iop33x/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-ixp2000/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-ixp23xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-ixp4xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-kirkwood/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-ks8695/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-lpc32xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-mmp/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-msm/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-mv78xx0/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-mxs/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-netx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-nomadik/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-nuc93x/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-omap1/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-omap2/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-orion5x/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-pnx4008/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-prima2/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-pxa/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-realview/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-rpc/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-s3c2410/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-s3c64xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-s5p64x0/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-s5pc100/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-s5pv210/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-sa1100/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-shark/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-shmobile/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-spear3xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-spear6xx/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-tegra/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-u300/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-ux500/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-versatile/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-vexpress/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-vt8500/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-w90x900/include/mach/vmalloc.h
 delete mode 100644 arch/arm/mach-zynq/include/mach/vmalloc.h
 delete mode 100644 arch/arm/plat-mxc/include/mach/vmalloc.h
 delete mode 100644 arch/arm/plat-spear/include/plat/vmalloc.h
 delete mode 100644 arch/arm/plat-tcc/include/mach/vmalloc.h
arch/arm/mach-at91/include/mach/vmalloc.h deleted +0 -26
deleted file mode 100644
index 8eb459f3f5..0000000000
@@ -1,26 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/vmalloc.h
- *
- *  Copyright (C) 2003 SAN People
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END		(AT91_VIRT_BASE & PGDIR_MASK)
-
-#endif
arch/arm/mach-bcmring/include/mach/vmalloc.h deleted +0 -25
deleted file mode 100644
index 7397bd7817..0000000000
@@ -1,25 +0,0 @@
-/*
- *
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-/*
- * Move VMALLOC_END to 0xf0000000 so that the vm space can range from
- * 0xe0000000 to 0xefffffff. This gives us 256 MB of vm space and handles
- * larger physical memory designs better.
- */
-#define VMALLOC_END       0xf0000000UL
arch/arm/mach-clps711x/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 467b96137e..0000000000
@@ -1,20 +0,0 @@
-/*
- *  arch/arm/mach-clps711x/include/mach/vmalloc.h
- *
- *  Copyright (C) 2000 Deep Blue Solutions Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END       0xd0000000UL
arch/arm/mach-cns3xxx/include/mach/vmalloc.h deleted +0 -11
deleted file mode 100644
index 1dd231d2f7..0000000000
@@ -1,11 +0,0 @@
-/*
- * Copyright 2000 Russell King.
- * Copyright 2003 ARM Limited
- * Copyright 2008 Cavium Networks
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, Version 2, as
- * published by the Free Software Foundation.
- */
-
-#define VMALLOC_END		0xd8000000UL
arch/arm/mach-davinci/include/mach/vmalloc.h deleted +0 -14
deleted file mode 100644
index d49646a8e2..0000000000
@@ -1,14 +0,0 @@
-/*
- * DaVinci vmalloc definitions
- *
- * Author: Kevin Hilman, MontaVista Software, Inc. <[email protected]>
- *
- * 2007 (c) MontaVista Software, Inc. This file is licensed under
- * the terms of the GNU General Public License version 2. This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-#include <mach/hardware.h>
-
-/* Allow vmalloc range until the IO virtual range minus a 2M "hole" */
-#define VMALLOC_END	  (IO_VIRT - (2<<20))
arch/arm/mach-dove/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index a28792cf76..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-dove/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END	0xfd800000UL
arch/arm/mach-ebsa110/include/mach/vmalloc.h deleted +0 -10
deleted file mode 100644
index ea141b7a3e..0000000000
@@ -1,10 +0,0 @@
-/*
- *  arch/arm/mach-ebsa110/include/mach/vmalloc.h
- *
- *  Copyright (C) 1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#define VMALLOC_END       0xdf000000UL
arch/arm/mach-ep93xx/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index 1b3f25d03d..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-ep93xx/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END	0xfe800000UL
arch/arm/mach-exynos4/include/mach/vmalloc.h deleted +0 -22
deleted file mode 100644
index 284330e571..0000000000
@@ -1,22 +0,0 @@
-/* linux/arch/arm/mach-exynos4/include/mach/vmalloc.h
- *
- * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com
- *
- * Copyright 2010 Ben Dooks <[email protected]>
- *
- * Based on arch/arm/mach-s5p6440/include/mach/vmalloc.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * EXYNOS4 vmalloc definition
-*/
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H __FILE__
-
-#define VMALLOC_END	0xF6000000UL
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-footbridge/include/mach/vmalloc.h deleted +0 -10
deleted file mode 100644
index 40ba78e578..0000000000
@@ -1,10 +0,0 @@
-/*
- *  arch/arm/mach-footbridge/include/mach/vmalloc.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-
-#define VMALLOC_END       0xf0000000UL
arch/arm/mach-gemini/include/mach/vmalloc.h deleted +0 -10
deleted file mode 100644
index 45371eb86f..0000000000
@@ -1,10 +0,0 @@
-/*
- *  Copyright (C) 2008-2009 Paulius Zaleckas <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#define VMALLOC_END	0xf0000000UL
arch/arm/mach-h720x/include/mach/vmalloc.h deleted +0 -10
deleted file mode 100644
index 8520b4a4d4..0000000000
@@ -1,10 +0,0 @@
-/*
- * arch/arm/mach-h720x/include/mach/vmalloc.h
- */
-
-#ifndef __ARCH_ARM_VMALLOC_H
-#define __ARCH_ARM_VMALLOC_H
-
-#define VMALLOC_END       0xd0000000UL
-
-#endif
arch/arm/mach-integrator/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 2f5a2bafb1..0000000000
@@ -1,20 +0,0 @@
-/*
- *  arch/arm/mach-integrator/include/mach/vmalloc.h
- *
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END       0xd0000000UL
arch/arm/mach-iop13xx/include/mach/vmalloc.h deleted +0 -4
deleted file mode 100644
index c534567403..0000000000
@@ -1,4 +0,0 @@
-#ifndef _VMALLOC_H_
-#define _VMALLOC_H_
-#define VMALLOC_END 	0xfa000000UL
-#endif
arch/arm/mach-iop32x/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index c4862d48e5..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-iop32x/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END	0xfe000000UL
arch/arm/mach-iop33x/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index 48331dc237..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-iop33x/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END	0xfe000000UL
arch/arm/mach-ixp2000/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 61c8dae24f..0000000000
@@ -1,20 +0,0 @@
-/*
- * arch/arm/mach-ixp2000/include/mach/vmalloc.h
- *
- * Author: Naeem Afzal <[email protected]>
- *
- * Copyright 2002 Intel Corp.
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- * Just any arbitrary offset to the start of the vmalloc VM area: the
- * current 8MB value just means that there will be a 8MB "hole" after the
- * physical memory until the kernel virtual memory starts.  That means that
- * any out-of-bounds memory accesses will hopefully be caught.
- * The vmalloc() routines leaves a hole of 4kB between each vmalloced
- * area for the same reason. ;)
- */
-#define VMALLOC_END	    0xfb000000UL
arch/arm/mach-ixp23xx/include/mach/vmalloc.h deleted +0 -10
deleted file mode 100644
index 896c56a1c0..0000000000
@@ -1,10 +0,0 @@
-/*
- * arch/arm/mach-ixp23xx/include/mach/vmalloc.h
- *
- * Copyright (c) 2005 MontaVista Software, Inc.
- *
- * NPU mappings end at 0xf0000000 and we allocate 64MB for board
- * specific static I/O.
- */
-
-#define VMALLOC_END	(0xec000000UL)
arch/arm/mach-ixp4xx/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index 9bcd64d598..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/include/mach/vmalloc.h
- */
-#define VMALLOC_END       (0xff000000UL)
-
arch/arm/mach-kirkwood/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index bf162ca3d2..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-kirkwood/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END	0xfe800000UL
arch/arm/mach-ks8695/include/mach/vmalloc.h deleted +0 -19
deleted file mode 100644
index 744ac66be3..0000000000
@@ -1,19 +0,0 @@
-/*
- * arch/arm/mach-ks8695/include/mach/vmalloc.h
- *
- * Copyright (C) 2006 Ben Dooks
- * Copyright (C) 2006 Simtec Electronics <[email protected]>
- *
- * KS8695 vmalloc definition
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	  (KS8695_IO_VA & PGDIR_MASK)
-
-#endif
arch/arm/mach-lpc32xx/include/mach/vmalloc.h deleted +0 -24
deleted file mode 100644
index 720fa43a60..0000000000
@@ -1,24 +0,0 @@
-/*
- * arch/arm/mach-lpc32xx/include/mach/vmalloc.h
- *
- * Author: Kevin Wells <[email protected]>
- *
- * Copyright (C) 2010 NXP Semiconductors
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	0xF0000000UL
-
-#endif
arch/arm/mach-mmp/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index 1d0bac003a..0000000000
@@ -1,5 +0,0 @@
-/*
- * linux/arch/arm/mach-mmp/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END	0xfe000000UL
arch/arm/mach-msm/include/mach/vmalloc.h deleted +0 -22
deleted file mode 100644
index d138448eff..0000000000
@@ -1,22 +0,0 @@
-/* arch/arm/mach-msm/include/mach/vmalloc.h
- *
- * Copyright (C) 2007 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __ASM_ARCH_MSM_VMALLOC_H
-#define __ASM_ARCH_MSM_VMALLOC_H
-
-#define VMALLOC_END	  0xd0000000UL
-
-#endif
-
arch/arm/mach-mv78xx0/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index ba26fe98e6..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-mv78xx0/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END	0xfe000000UL
arch/arm/mach-mxs/include/mach/vmalloc.h deleted +0 -22
deleted file mode 100644
index 103b0165ed..0000000000
@@ -1,22 +0,0 @@
-/*
- *  Copyright (C) 2000 Russell King.
- *  Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __MACH_MXS_VMALLOC_H__
-#define __MACH_MXS_VMALLOC_H__
-
-/* vmalloc ending address */
-#define VMALLOC_END       0xf4000000UL
-
-#endif /* __MACH_MXS_VMALLOC_H__ */
arch/arm/mach-netx/include/mach/vmalloc.h deleted +0 -19
deleted file mode 100644
index 871f1ef7bf..0000000000
@@ -1,19 +0,0 @@
-/*
- *  arch/arm/mach-netx/include/mach/vmalloc.h
- *
- * Copyright (C) 2005 Sascha Hauer <[email protected]>, Pengutronix
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END       0xd0000000UL
arch/arm/mach-nomadik/include/mach/vmalloc.h deleted +0 -2
deleted file mode 100644
index f83d574d94..0000000000
@@ -1,2 +0,0 @@
-
-#define VMALLOC_END       0xe8000000UL
arch/arm/mach-nuc93x/include/mach/vmalloc.h deleted +0 -23
deleted file mode 100644
index 7d11a5f076..0000000000
@@ -1,23 +0,0 @@
-/*
- * arch/arm/mach-nuc93x/include/mach/vmalloc.h
- *
- * Copyright (c) 2008 Nuvoton technology corporation
- * All rights reserved.
- *
- * Wan ZongShun <[email protected]>
- *
- * Based on arch/arm/mach-s3c2410/include/mach/vmalloc.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- */
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	  0xE0000000UL
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-omap1/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 22ec4a4795..0000000000
@@ -1,20 +0,0 @@
-/*
- *  arch/arm/mach-omap1/include/mach/vmalloc.h
- *
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-#define VMALLOC_END	0xd8000000UL
arch/arm/mach-omap2/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 8663199477..0000000000
@@ -1,20 +0,0 @@
-/*
- *  arch/arm/plat-omap/include/mach/vmalloc.h
- *
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-#define VMALLOC_END	  0xf8000000UL
arch/arm/mach-orion5x/include/mach/vmalloc.h deleted +0 -5
deleted file mode 100644
index 06b50aeff7..0000000000
@@ -1,5 +0,0 @@
-/*
- * arch/arm/mach-orion5x/include/mach/vmalloc.h
- */
-
-#define VMALLOC_END       0xfd800000UL
arch/arm/mach-pnx4008/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 184913c711..0000000000
@@ -1,20 +0,0 @@
-/*
- * arch/arm/mach-pnx4008/include/mach/vmalloc.h
- *
- * Author: Vitaly Wool <[email protected]>
- *
- * 2006 (c) MontaVista Software, Inc. This file is licensed under
- * the terms of the GNU General Public License version 2. This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-
-/*
- * Just any arbitrary offset to the start of the vmalloc VM area: the
- * current 8MB value just means that there will be a 8MB "hole" after the
- * physical memory until the kernel virtual memory starts.  That means that
- * any out-of-bounds memory accesses will hopefully be caught.
- * The vmalloc() routines leaves a hole of 4kB between each vmalloced
- * area for the same reason. ;)
- */
-#define VMALLOC_END       0xd0000000UL
arch/arm/mach-prima2/include/mach/vmalloc.h deleted +0 -16
deleted file mode 100644
index c9f90fec78..0000000000
@@ -1,16 +0,0 @@
-/*
- * arch/arm/ach-prima2/include/mach/vmalloc.h
- *
- * Copyright (c) 2010 ? 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
- *
- * Licensed under GPLv2 or later.
- */
-
-#ifndef __MACH_VMALLOC_H
-#define __MACH_VMALLOC_H
-
-#include <linux/const.h>
-
-#define VMALLOC_END    _AC(0xFEC00000, UL)
-
-#endif
arch/arm/mach-pxa/include/mach/vmalloc.h deleted +0 -11
deleted file mode 100644
index bfecfbf5f4..0000000000
@@ -1,11 +0,0 @@
-/*
- * arch/arm/mach-pxa/include/mach/vmalloc.h
- *
- * Author:	Nicolas Pitre
- * Copyright:	(C) 2001 MontaVista Software Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#define VMALLOC_END       (0xe8000000UL)
arch/arm/mach-realview/include/mach/vmalloc.h deleted +0 -21
deleted file mode 100644
index a2a4c68614..0000000000
@@ -1,21 +0,0 @@
-/*
- *  arch/arm/mach-realview/include/mach/vmalloc.h
- *
- *  Copyright (C) 2003 ARM Limited
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END		0xf8000000UL
arch/arm/mach-rpc/include/mach/vmalloc.h deleted +0 -10
deleted file mode 100644
index fb70022863..0000000000
@@ -1,10 +0,0 @@
-/*
- *  arch/arm/mach-rpc/include/mach/vmalloc.h
- *
- *  Copyright (C) 1997 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#define VMALLOC_END       0xdc000000UL
arch/arm/mach-s3c2410/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 7a311e8ddd..0000000000
@@ -1,20 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/vmalloc.h
- *
- * from arch/arm/mach-iop3xx/include/mach/vmalloc.h
- *
- * Copyright (c) 2003 Simtec Electronics <[email protected]>
- *		      http://www.simtec.co.uk/products/SWLINUX/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * S3C2410 vmalloc definition
-*/
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	0xF6000000UL
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-s3c64xx/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 23f75e556a..0000000000
@@ -1,20 +0,0 @@
-/* arch/arm/mach-s3c64xx/include/mach/vmalloc.h
- *
- * from arch/arm/mach-iop3xx/include/mach/vmalloc.h
- *
- * Copyright (c) 2003 Simtec Electronics <[email protected]>
- *		      http://www.simtec.co.uk/products/SWLINUX/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * S3C6400 vmalloc definition
-*/
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	0xF6000000UL
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-s5p64x0/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 38dcc71a03..0000000000
@@ -1,20 +0,0 @@
-/* linux/arch/arm/mach-s5p64x0/include/mach/vmalloc.h
- *
- * Copyright (c) 2010 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com
- *
- * Copyright 2010 Ben Dooks <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * S3C6400 vmalloc definition
-*/
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	0xF6000000UL
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-s5pc100/include/mach/vmalloc.h deleted +0 -17
deleted file mode 100644
index 44c8e5726d..0000000000
@@ -1,17 +0,0 @@
-/* arch/arm/mach-s5pc100/include/mach/vmalloc.h
- *
- * Copyright 2010 Ben Dooks <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * S3C6400 vmalloc definition
-*/
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	0xF6000000UL
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-s5pv210/include/mach/vmalloc.h deleted +0 -22
deleted file mode 100644
index a6c659d68a..0000000000
@@ -1,22 +0,0 @@
-/* linux/arch/arm/mach-s5p6442/include/mach/vmalloc.h
- *
- * Copyright 2010 Ben Dooks <[email protected]>
- *
- * Copyright (c) 2010 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com/
- *
- * Based on arch/arm/mach-s5p6442/include/mach/vmalloc.h
- *
- * S5PV210 vmalloc definition
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H __FILE__
-
-#define VMALLOC_END	0xF6000000UL
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-sa1100/include/mach/vmalloc.h deleted +0 -4
deleted file mode 100644
index b3d0023984..0000000000
@@ -1,4 +0,0 @@
-/*
- * arch/arm/mach-sa1100/include/mach/vmalloc.h
- */
-#define VMALLOC_END       (0xe8000000UL)
arch/arm/mach-shark/include/mach/vmalloc.h deleted +0 -4
deleted file mode 100644
index b10df98852..0000000000
@@ -1,4 +0,0 @@
-/*
- * arch/arm/mach-shark/include/mach/vmalloc.h
- */
-#define VMALLOC_END       0xd0000000UL
arch/arm/mach-shmobile/include/mach/vmalloc.h deleted +0 -7
deleted file mode 100644
index 2b8fd8b942..0000000000
@@ -1,7 +0,0 @@
-#ifndef __ASM_MACH_VMALLOC_H
-#define __ASM_MACH_VMALLOC_H
-
-/* Vmalloc at ... - 0xe5ffffff */
-#define VMALLOC_END 0xe6000000UL
-
-#endif /* __ASM_MACH_VMALLOC_H */
arch/arm/mach-spear3xx/include/mach/vmalloc.h deleted +0 -19
deleted file mode 100644
index df977b3c9a..0000000000
@@ -1,19 +0,0 @@
-/*
- * arch/arm/mach-spear3xx/include/mach/vmalloc.h
- *
- * Defining Vmalloc area for SPEAr3xx machine family
- *
- * Copyright (C) 2009 ST Microelectronics
- * Viresh Kumar<[email protected]>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#ifndef __MACH_VMALLOC_H
-#define __MACH_VMALLOC_H
-
-#include <plat/vmalloc.h>
-
-#endif /* __MACH_VMALLOC_H */
arch/arm/mach-spear6xx/include/mach/vmalloc.h deleted +0 -19
deleted file mode 100644
index 4a0b56cb2a..0000000000
@@ -1,19 +0,0 @@
-/*
- * arch/arm/mach-spear6xx/include/mach/vmalloc.h
- *
- * Defining Vmalloc area for SPEAr6xx machine family
- *
- * Copyright (C) 2009 ST Microelectronics
- * Rajeev Kumar<[email protected]>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#ifndef __MACH_VMALLOC_H
-#define __MACH_VMALLOC_H
-
-#include <plat/vmalloc.h>
-
-#endif	/* __MACH_VMALLOC_H */
arch/arm/mach-tegra/include/mach/vmalloc.h deleted +0 -28
deleted file mode 100644
index fd6aa65b2d..0000000000
@@ -1,28 +0,0 @@
-/*
- * arch/arm/mach-tegra/include/mach/vmalloc.h
- *
- * Copyright (C) 2010 Google, Inc.
- *
- * Author:
- *	Colin Cross <[email protected]>
- *	Erik Gilling <[email protected]>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef __MACH_TEGRA_VMALLOC_H
-#define __MACH_TEGRA_VMALLOC_H
-
-#include <asm/sizes.h>
-
-#define VMALLOC_END        0xFE000000UL
-
-#endif
arch/arm/mach-u300/include/mach/vmalloc.h deleted +0 -12
deleted file mode 100644
index ec423b92b8..0000000000
@@ -1,12 +0,0 @@
-/*
- *
- * arch/arm/mach-u300/include/mach/vmalloc.h
- *
- *
- * Copyright (C) 2006-2009 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- * Virtual memory allocations
- * End must be above the I/O registers and on an even 2MiB boundary.
- * Author: Linus Walleij <[email protected]>
- */
-#define VMALLOC_END	0xfe800000UL
arch/arm/mach-ux500/include/mach/vmalloc.h deleted +0 -18
deleted file mode 100644
index a4945cb411..0000000000
@@ -1,18 +0,0 @@
-/*
- *  Copyright (C) 2009 ST-Ericsson
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END	0xf0000000UL
arch/arm/mach-versatile/include/mach/vmalloc.h deleted +0 -21
deleted file mode 100644
index 7d8e069ad5..0000000000
@@ -1,21 +0,0 @@
-/*
- *  arch/arm/mach-versatile/include/mach/vmalloc.h
- *
- *  Copyright (C) 2003 ARM Limited
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END		0xd8000000UL
arch/arm/mach-vexpress/include/mach/vmalloc.h deleted +0 -21
deleted file mode 100644
index f43a36ef67..0000000000
@@ -1,21 +0,0 @@
-/*
- *  arch/arm/mach-vexpress/include/mach/vmalloc.h
- *
- *  Copyright (C) 2003 ARM Limited
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END		0xf8000000UL
arch/arm/mach-vt8500/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 4642290ce4..0000000000
@@ -1,20 +0,0 @@
-/*
- *  arch/arm/mach-vt8500/include/mach/vmalloc.h
- *
- *  Copyright (C) 2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#define VMALLOC_END	0xd0000000UL
arch/arm/mach-w90x900/include/mach/vmalloc.h deleted +0 -23
deleted file mode 100644
index b067e44500..0000000000
@@ -1,23 +0,0 @@
-/*
- * arch/arm/mach-w90x900/include/mach/vmalloc.h
- *
- * Copyright (c) 2008 Nuvoton technology corporation
- * All rights reserved.
- *
- * Wan ZongShun <[email protected]>
- *
- * Based on arch/arm/mach-s3c2410/include/mach/vmalloc.h
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- */
-
-#ifndef __ASM_ARCH_VMALLOC_H
-#define __ASM_ARCH_VMALLOC_H
-
-#define VMALLOC_END	  (0xe0000000UL)
-
-#endif /* __ASM_ARCH_VMALLOC_H */
arch/arm/mach-zynq/include/mach/vmalloc.h deleted +0 -20
deleted file mode 100644
index 2398eff1e8..0000000000
@@ -1,20 +0,0 @@
-/* arch/arm/mach-zynq/include/mach/vmalloc.h
- *
- *  Copyright (C) 2011 Xilinx
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __MACH_VMALLOC_H__
-#define __MACH_VMALLOC_H__
-
-#define VMALLOC_END       0xE0000000UL
-
-#endif
arch/arm/plat-mxc/include/mach/vmalloc.h deleted +0 -22
deleted file mode 100644
index ef6379c474..0000000000
@@ -1,22 +0,0 @@
-/*
- *  Copyright (C) 2000 Russell King.
- *  Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef __ASM_ARCH_MXC_VMALLOC_H__
-#define __ASM_ARCH_MXC_VMALLOC_H__
-
-/* vmalloc ending address */
-#define VMALLOC_END       0xf4000000UL
-
-#endif /* __ASM_ARCH_MXC_VMALLOC_H__ */
arch/arm/plat-spear/include/plat/vmalloc.h deleted +0 -19
deleted file mode 100644
index 8c8b24d070..0000000000
@@ -1,19 +0,0 @@
-/*
- * arch/arm/plat-spear/include/plat/vmalloc.h
- *
- * Defining Vmalloc area for SPEAr platform
- *
- * Copyright (C) 2009 ST Microelectronics
- * Viresh Kumar<[email protected]>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#ifndef __PLAT_VMALLOC_H
-#define __PLAT_VMALLOC_H
-
-#define VMALLOC_END		0xF0000000UL
-
-#endif /* __PLAT_VMALLOC_H */
arch/arm/plat-tcc/include/mach/vmalloc.h deleted +0 -10
deleted file mode 100644
index 99414d9c2b..0000000000
@@ -1,10 +0,0 @@
-/*
- * Author: <[email protected]>
- * Created: June 10, 2008
- *
- * Copyright (C) 2000 Russell King.
- * Copyright (C) 2008-2009 Telechips
- *
- * Licensed under the terms of the GPL v2.
- */
-#define VMALLOC_END	0xf0000000UL
Signature · 1 line
1.7.7-rc0
#42 lore raw

cover removal of mach/vmalloc.h and generic optimizations

In reply to Nicolas Pitre
Quoted 8 lines · Nicolas Pitre

This patch series removes all instances of mach/vmalloc.h in order to have a more unified memory map across all ARM architectures. To do so, the static mappings are moved inside the vmalloc area. And finally this allows for a generic optimization to ioremap where static mappings are reused whenever possible, using common code instead of having this duplicated in a couple places.

This also provides a net reduction of more than 1200 lines of code.

Jamie

#43 lore raw

cover removal of mach/vmalloc.h and generic optimizations

In reply to Nicolas Pitre
Quoted 7 lines · On Friday 16 September 2011 03:07:11 Nicolas Pitre wrote:

This patch series removes all instances of mach/vmalloc.h in order to have a more unified memory map across all ARM architectures. To do so, the static mappings are moved inside the vmalloc area. And finally this allows for a generic optimization to ioremap where static mappings are reused whenever possible, using common code instead of having this duplicated in a couple places.

Quoted 5 lines

This also provides a net reduction of more than 1200 lines of code.

Those patches are also available in the following repository:

git://git.linaro.org/people/nico/linux vmalloc

Hi Nicolas,

I like the series a lot. I had planned to work on this myself, but I guess you did a better job than I could have anyway.

Doing some randconfig tests, I noticed that your series is currently broken on shmobile, which triggers a

	BUILD_BUG_ON(VMALLOC_END > CONSISTENT_BASE);

in mem_init(), because the platform has a CONSISTENT_DMA_SIZE of 158MB. All other platforms have a CONSISTENT_DMA_SIZE of at most 14MB, which works correctly.

My feeling is that a 158MB CONSISTENT_DMA_SIZE causes other problems anyway because we cannot map regular RAM both cached and uncached, but this is still a regression. The problem might be solved using Marek's CMA patches, which should eliminate the need for a huge CONSISTENT_DMA_SIZE.

Arnd

#44 lore raw

cover removal of mach/vmalloc.h and generic optimizations

Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · On Friday 16 September 2011 03:07:11 Nicolas Pitre wrote:

This patch series removes all instances of mach/vmalloc.h in order to have a more unified memory map across all ARM architectures. To do so, the static mappings are moved inside the vmalloc area. And finally this allows for a generic optimization to ioremap where static mappings are reused whenever possible, using common code instead of having this duplicated in a couple places.

This also provides a net reduction of more than 1200 lines of code.

Quoted 8 lines
Quoted 3 lines

Those patches are also available in the following repository:

git://git.linaro.org/people/nico/linux vmalloc

Hi Nicolas,

I like the series a lot. I had planned to work on this myself, but I guess you did a better job than I could have anyway.

Thanks!

Quoted 8 lines

Doing some randconfig tests, I noticed that your series is currently broken on shmobile, which triggers a

	BUILD_BUG_ON(VMALLOC_END > CONSISTENT_BASE);

in mem_init(), because the platform has a CONSISTENT_DMA_SIZE of 158MB. All other platforms have a CONSISTENT_DMA_SIZE of at most 14MB, which works correctly.

Any idea why shmobile requires such an amount of consistent memory?

Quoted 5 lines

My feeling is that a 158MB CONSISTENT_DMA_SIZE causes other problems anyway because we cannot map regular RAM both cached and uncached, but this is still a regression. The problem might be solved using Marek's CMA patches, which should eliminate the need for a huge CONSISTENT_DMA_SIZE.

Maybe. However I don't want for this series to depend on CMA. I'll find some temporary hack in the mean time.

Nicolas

#45 lore raw

cover removal of mach/vmalloc.h and generic optimizations

Quoted 16 lines · On Saturday 17 September 2011 22:46:33 Nicolas Pitre wrote:
Quoted 14 lines · Arnd Bergmann
Quoted 8 lines · On Friday 16 September 2011 03:07:11 Nicolas Pitre wrote:

This patch series removes all instances of mach/vmalloc.h in order to have a more unified memory map across all ARM architectures. To do so, the static mappings are moved inside the vmalloc area. And finally this allows for a generic optimization to ioremap where static mappings are reused whenever possible, using common code instead of having this duplicated in a couple places.

This also provides a net reduction of more than 1200 lines of code.

Doing some randconfig tests, I noticed that your series is currently broken on shmobile, which triggers a

Quoted 7 lines
Quoted 5 lines
	BUILD_BUG_ON(VMALLOC_END > CONSISTENT_BASE);

in mem_init(), because the platform has a CONSISTENT_DMA_SIZE of 158MB. All other platforms have a CONSISTENT_DMA_SIZE of at most 14MB, which works correctly.

Any idea why shmobile requires such an amount of consistent memory?

No, I couldn't find anything in the code or the changelog why this was done. Magnus changed it in this commit:

commit 28f0721a79046056ced3b9bd79c319c5c417ec30

Author: Magnus Damm <[email protected]>
Date:   Wed Apr 28 08:25:30 2010 +0000

ARM: mach-shmobile: Set CONSISTENT_DMA_SIZE to 158 MB

This patch sets CONSISTENT_DMA_SIZE to 158 MB
for all SH-Mobile ARM processors.

The DMA area is mapped at 0xf6000000 - 0xffdfffff, on top of the 256 MB I/O window at 0xe6000000.

Maybe he can give a better explanation and can say whether it's actually required. The patch series introducing it contained the introduction of the shdma dmaengine driver and some changes to video drivers, but I could not tell how they are related to this change.

Quoted 8 lines
Quoted 5 lines

My feeling is that a 158MB CONSISTENT_DMA_SIZE causes other problems anyway because we cannot map regular RAM both cached and uncached, but this is still a regression. The problem might be solved using Marek's CMA patches, which should eliminate the need for a huge CONSISTENT_DMA_SIZE.

Maybe. However I don't want for this series to depend on CMA. I'll find some temporary hack in the mean time.

Ok

Arnd

#46 lore raw

cover removal of mach/vmalloc.h and generic optimizations

Quoted 55 lines · Arnd Bergmann
Quoted 16 lines · On Saturday 17 September 2011 22:46:33 Nicolas Pitre wrote:
Quoted 14 lines · Arnd Bergmann
Quoted 8 lines · On Friday 16 September 2011 03:07:11 Nicolas Pitre wrote:

This patch series removes all instances of mach/vmalloc.h in order to have a more unified memory map across all ARM architectures. To do so, the static mappings are moved inside the vmalloc area. And finally this allows for a generic optimization to ioremap where static mappings are reused whenever possible, using common code instead of having this duplicated in a couple places.

This also provides a net reduction of more than 1200 lines of code.

Doing some randconfig tests, I noticed that your series is currently broken on shmobile, which triggers a

Quoted 7 lines
Quoted 5 lines
	BUILD_BUG_ON(VMALLOC_END > CONSISTENT_BASE);

in mem_init(), because the platform has a CONSISTENT_DMA_SIZE of 158MB. All other platforms have a CONSISTENT_DMA_SIZE of at most 14MB, which works correctly.

Any idea why shmobile requires such an amount of consistent memory?

No, I couldn't find anything in the code or the changelog why this was done. Magnus changed it in this commit:

commit 28f0721a79046056ced3b9bd79c319c5c417ec30

Author: Magnus Damm <[email protected]>
Date:   Wed Apr 28 08:25:30 2010 +0000

ARM: mach-shmobile: Set CONSISTENT_DMA_SIZE to 158 MB

This patch sets CONSISTENT_DMA_SIZE to 158 MB
for all SH-Mobile ARM processors.

The DMA area is mapped at 0xf6000000 - 0xffdfffff, on top of the 256 MB I/O window at 0xe6000000.

Maybe he can give a better explanation and can say whether it's actually required. The patch series introducing it contained the introduction of the shdma dmaengine driver and some changes to video drivers, but I could not tell how they are related to this change.

Quoted 6 lines
Quoted 5 lines

My feeling is that a 158MB CONSISTENT_DMA_SIZE causes other problems anyway because we cannot map regular RAM both cached and uncached, but this is still a regression. The problem might be solved using Marek's CMA patches, which should eliminate the need for a huge CONSISTENT_DMA_SIZE.

Quoted 4 lines
Quoted 2 lines

Maybe. However I don't want for this series to depend on CMA. I'll find some temporary hack in the mean time.

Ok

I queued the patch below for the time being. Alternatively, I could put the consistent DMA area into the vmalloc area too, but I don't really see the benefit of that. I would prefer an explanation for the 158 MB instead.

----- >8

From: Nicolas Pitre <[email protected]>
Subject: [PATCH] ARM: move VMALLOC_END down for shmobile

THIS IS A TEMPORARY HACK. The purpose of this is _only_ to avoid a
regression on an existing machine while a better solution is implemented.

---
 arch/arm/include/asm/pgtable.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/include/asm/pgtable.h +6 -0
index 950dee3ce2..0d4fecf55f 100644
@@ -35,6 +35,12 @@
 #define VMALLOC_START		(((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
 #define VMALLOC_END		0xff000000UL
 
+/* This is a temporary hack until shmobile's DMA area size is sorted out */
+#ifdef CONFIG_ARCH_SHMOBILE
+#undef VMALLOC_END
+#define VMALLOC_END		0xe6000000UL
+#endif
+
 /*
  * Hardware-wise, we have a two level page table structure, where the first
  * level has 4096 entries, and the second level has 256 entries.  Each entry
#47 lore raw

cover removal of mach/vmalloc.h and generic optimizations

In reply to Arnd Bergmann
Quoted 40 lines · Arnd Bergmann
Quoted 16 lines · On Saturday 17 September 2011 22:46:33 Nicolas Pitre wrote:
Quoted 14 lines · Arnd Bergmann
Quoted 8 lines · On Friday 16 September 2011 03:07:11 Nicolas Pitre wrote:

This patch series removes all instances of mach/vmalloc.h in order to have a more unified memory map across all ARM architectures. To do so, the static mappings are moved inside the vmalloc area. And finally this allows for a generic optimization to ioremap where static mappings are reused whenever possible, using common code instead of having this duplicated in a couple places.

This also provides a net reduction of more than 1200 lines of code.

Doing some randconfig tests, I noticed that your series is currently broken on shmobile, which triggers a

Quoted 7 lines
Quoted 5 lines
	BUILD_BUG_ON(VMALLOC_END > CONSISTENT_BASE);

in mem_init(), because the platform has a CONSISTENT_DMA_SIZE of 158MB. All other platforms have a CONSISTENT_DMA_SIZE of at most 14MB, which works correctly.

Any idea why shmobile requires such an amount of consistent memory?

No, I couldn't find anything in the code or the changelog why this was done. Magnus changed it in this commit:

commit 28f0721a79046056ced3b9bd79c319c5c417ec30

Author: Magnus Damm <[email protected]>
Date:   Wed Apr 28 08:25:30 2010 +0000

ARM: mach-shmobile: Set CONSISTENT_DMA_SIZE to 158 MB

This patch sets CONSISTENT_DMA_SIZE to 158 MB
for all SH-Mobile ARM processors.

The DMA area is mapped at 0xf6000000 - 0xffdfffff, on top of the 256 MB I/O window at 0xe6000000.

Quoted 8 lines

Maybe he can give a better explanation and can say whether it's actually required. The patch series introducing it contained the introduction of the shdma dmaengine driver and some changes to video drivers, but I could not tell how they are related to this change.

I found that drivers/video/sh_mobile_lcdcfb.c appears to be a heavy user of dma_alloc_coherent():

                buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len,
                                         &ch->dma_handle, GFP_KERNEL);

...

                info->fix.smem_len = max_size * 2 * cfg->bpp / 8;

...

                        max_size = MAX_XRES * MAX_YRES;

...

#define MAX_XRES 1920
#define MAX_YRES 1080

... and a switch statement on bpp shows it can be up to 32.

So for this particular hypothetical case: 1920 * 1080 * 2 * 32 / 8 = 16MB

We are far from the 158MB figure. Furthermore, the highest allowed amount is 14MB according to the available documentation, and none of the other ARM targets use more than that either.

Magnus and/or Paul: please could you explain where this 158MB comes from?

Nicolas

#48 lore raw

cover removal of mach/vmalloc.h and generic optimizations

Quoted 8 lines · Nicolas Pitre
Quoted 2 lines · Arnd Bergmann

No, I couldn't find anything in the code or the changelog why this was done.

I found that drivers/video/sh_mobile_lcdcfb.c appears to be a heavy user of dma_alloc_coherent():

Quoted 8 lines
                buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len,
                                         &ch->dma_handle, GFP_KERNEL);

So for this particular hypothetical case: 1920 * 1080 * 2 * 32 / 8 = 16MB

We are far from the 158MB figure. Furthermore, the highest allowed amount is 14MB according to the available documentation, and none of the other ARM targets use more than that either.

For the record, here's the patch I'm including in my series:

From: Nicolas Pitre <[email protected]>
Date: Mon, 19 Sep 2011 00:28:45 -0400
Subject: [PATCH] ARM: move VMALLOC_END down temporarily for shmobile

THIS IS A TEMPORARY HACK. The purpose of this is _only_ to avoid a regression on an existing machine while a better fix is implemented.

On shmobile the consistent DMA memory area was set to 158MB in commit 28f0721a79 with no explanation. The documented size for this area should vary between 2MB and 14MB, and none of the other ARM targets exceed that.

The included #warning is therefore meant to be noisy on purpose to get shmobile maintainers attention and this commit reverted once this consistent DMA size conflict is resolved.

Cc Magnus Damm <[email protected]>
Cc Paul Mundt <[email protected]>
arch/arm/include/asm/pgtable.h +7 -0
index 950dee3ce2..35eb517a21 100644
@@ -35,6 +35,13 @@
 #define VMALLOC_START		(((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
 #define VMALLOC_END		0xff000000UL
 
+/* This is a temporary hack until shmobile's DMA area size is sorted out */
+#ifdef CONFIG_ARCH_SHMOBILE
+#warning "SH-Mobile's consistent DMA size conflicts with VMALLOC_END by 144MB"
+#undef VMALLOC_END
+#define VMALLOC_END		0xF6000000UL
+#endif
+
 /*
  * Hardware-wise, we have a two level page table structure, where the first
  * level has 4096 entries, and the second level has 256 entries.  Each entry

Nicolas