diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-08-04 19:56:13 -0400 |
---|---|---|
committer | Lennert Buytenhek <buytenh@marvell.com> | 2008-08-09 09:38:15 -0400 |
commit | 60296c71f6c5063e3c1f1d2619ca0b60940162e7 (patch) | |
tree | 9b66e8716d83c3d350829376d75212798b2c72c6 /arch/arm/kernel/setup.c | |
parent | 09c0ed2e6eb87613b2670c15ba771ac671db19d9 (diff) |
[ARM] prevent crashing when too much RAM installed
This patch will truncate and/or ignore memory banks if their kernel
direct mappings would (partially) overlap with the vmalloc area or
the mappings between the vmalloc area and the address space top, to
prevent crashing during early boot if there happens to be more RAM
installed than we are expecting.
Since the start of the vmalloc area is not at a fixed address (but
the vmalloc end address is, via the per-platform VMALLOC_END define),
a default area of 128M is reserved for vmalloc mappings, which can
be shrunk or enlarged by passing an appropriate vmalloc= command line
option as it is done on x86.
On a board with a 3:1 user:kernel split, VMALLOC_END at 0xfe000000,
two 512M RAM banks and vmalloc=128M (the default), this patch gives:
Truncating RAM at 20000000-3fffffff to -35ffffff (vmalloc region overlap).
Memory: 512MB 352MB = 864MB total
On a board with a 3:1 user:kernel split, VMALLOC_END at 0xfe800000,
two 256M RAM banks and vmalloc=768M, this patch gives:
Truncating RAM at 00000000-0fffffff to -0e7fffff (vmalloc region overlap).
Ignoring RAM at 10000000-1fffffff (vmalloc region overlap).
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Tested-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r-- | arch/arm/kernel/setup.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 38f0e7940a13..2ca7038b67a7 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -81,6 +81,8 @@ EXPORT_SYMBOL(system_serial_high); | |||
81 | unsigned int elf_hwcap; | 81 | unsigned int elf_hwcap; |
82 | EXPORT_SYMBOL(elf_hwcap); | 82 | EXPORT_SYMBOL(elf_hwcap); |
83 | 83 | ||
84 | unsigned long __initdata vmalloc_reserve = 128 << 20; | ||
85 | |||
84 | 86 | ||
85 | #ifdef MULTI_CPU | 87 | #ifdef MULTI_CPU |
86 | struct processor processor; | 88 | struct processor processor; |
@@ -501,6 +503,17 @@ static void __init early_mem(char **p) | |||
501 | __early_param("mem=", early_mem); | 503 | __early_param("mem=", early_mem); |
502 | 504 | ||
503 | /* | 505 | /* |
506 | * vmalloc=size forces the vmalloc area to be exactly 'size' | ||
507 | * bytes. This can be used to increase (or decrease) the vmalloc | ||
508 | * area - the default is 128m. | ||
509 | */ | ||
510 | static void __init early_vmalloc(char **arg) | ||
511 | { | ||
512 | vmalloc_reserve = memparse(*arg, arg); | ||
513 | } | ||
514 | __early_param("vmalloc=", early_vmalloc); | ||
515 | |||
516 | /* | ||
504 | * Initial parsing of the command line. | 517 | * Initial parsing of the command line. |
505 | */ | 518 | */ |
506 | static void __init parse_cmdline(char **cmdline_p, char *from) | 519 | static void __init parse_cmdline(char **cmdline_p, char *from) |