diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 16:00:51 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-13 16:02:35 +0100 |
commit | 716a3dc20084da9b3ab17bd125005a5345e23e3b (patch) | |
tree | f7ba487050d33fc2913fdee81b384f5578ccb105 /arch/arm/plat-omap/devices.c | |
parent | Merge branch 'master' into fixes (diff) | |
download | linux-716a3dc20084da9b3ab17bd125005a5345e23e3b.tar.xz linux-716a3dc20084da9b3ab17bd125005a5345e23e3b.zip |
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/plat-omap/devices.c')
-rw-r--r-- | arch/arm/plat-omap/devices.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index 19719329a47b..60278f47c0bd 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c @@ -20,6 +20,7 @@ #include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/mach/map.h> +#include <asm/memblock.h> #include <plat/tc.h> #include <plat/board.h> @@ -164,14 +165,12 @@ void __init omap_dsp_reserve_sdram_memblock(void) if (!size) return; - paddr = memblock_alloc(size, SZ_1M); + paddr = arm_memblock_steal(size, SZ_1M); if (!paddr) { pr_err("%s: failed to reserve %x bytes\n", __func__, size); return; } - memblock_free(paddr, size); - memblock_remove(paddr, size); omap_dsp_phys_mempool_base = paddr; } |