diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 10:00:51 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 10:02:35 -0500 |
commit | 716a3dc20084da9b3ab17bd125005a5345e23e3b (patch) | |
tree | f7ba487050d33fc2913fdee81b384f5578ccb105 /arch/arm/mach-omap2/omap4-common.c | |
parent | 4de3a8e101150feaefa1139611a50ff37467f33e (diff) |
ARM: Add arm_memblock_steal() to allocate memory away from the kernel
Several platforms are now using the memblock_alloc+memblock_free+
memblock_remove trick to obtain memory which won't be mapped in the
kernel's page tables. Most platforms do this (correctly) in the
->reserve callback. However, OMAP has started to call these functions
outside of this callback, and this is extremely unsafe - memory will
not be unmapped, and could well be given out after memblock is no
longer responsible for its management.
So, provide arm_memblock_steal() to perform this function, and ensure
that it panic()s if it is used inappropriately. Convert everyone
over, including OMAP.
As a result, OMAP with OMAP4_ERRATA_I688 enabled will panic on boot
with this change. Mark this option as BROKEN and make it depend on
BROKEN. OMAP needs to be fixed, or 137d105d50 (ARM: OMAP4: Fix
errata i688 with MPU interconnect barriers.) reverted until such
time it can be fixed correctly.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap2/omap4-common.c')
-rw-r--r-- | arch/arm/mach-omap2/omap4-common.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index bc16c818c6b7..40a8fbc07e4b 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/hardware/gic.h> | 20 | #include <asm/hardware/gic.h> |
21 | #include <asm/hardware/cache-l2x0.h> | 21 | #include <asm/hardware/cache-l2x0.h> |
22 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
23 | #include <asm/memblock.h> | ||
23 | 24 | ||
24 | #include <plat/irqs.h> | 25 | #include <plat/irqs.h> |
25 | #include <plat/sram.h> | 26 | #include <plat/sram.h> |
@@ -61,13 +62,8 @@ static int __init omap_barriers_init(void) | |||
61 | return -ENODEV; | 62 | return -ENODEV; |
62 | 63 | ||
63 | size = ALIGN(PAGE_SIZE, SZ_1M); | 64 | size = ALIGN(PAGE_SIZE, SZ_1M); |
64 | paddr = memblock_alloc(size, SZ_1M); | 65 | paddr = arm_memblock_steal(size, SZ_1M); |
65 | if (!paddr) { | 66 | |
66 | pr_err("%s: failed to reserve 4 Kbytes\n", __func__); | ||
67 | return -ENOMEM; | ||
68 | } | ||
69 | memblock_free(paddr, size); | ||
70 | memblock_remove(paddr, size); | ||
71 | dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; | 67 | dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; |
72 | dram_io_desc[0].pfn = __phys_to_pfn(paddr); | 68 | dram_io_desc[0].pfn = __phys_to_pfn(paddr); |
73 | dram_io_desc[0].length = size; | 69 | dram_io_desc[0].length = size; |