diff options
author | Yinghai Lu <yhlu.kernel.send@gmail.com> | 2008-03-21 21:56:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:21 -0400 |
commit | c64df70793a9c344874eb4af19f85e0662d2d3ee (patch) | |
tree | df6ec69fed0d4f4e2192692558dc7dc20bfa9645 | |
parent | 9b967106da0357ef8b08847dce35584a04134f20 (diff) |
x86: memtest bootparam
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | Documentation/kernel-parameters.txt | 5 | ||||
-rw-r--r-- | arch/x86/Kconfig | 29 | ||||
-rw-r--r-- | arch/x86/kernel/e820_64.c | 10 | ||||
-rw-r--r-- | arch/x86/mm/init_64.c | 24 |
4 files changed, 56 insertions, 12 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 43c527d72f2f..f9ea0803d5d6 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1147,6 +1147,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1147 | or | 1147 | or |
1148 | memmap=0x10000$0x18690000 | 1148 | memmap=0x10000$0x18690000 |
1149 | 1149 | ||
1150 | memtest= [KNL,X86_64] Enable memtest | ||
1151 | Format: <integer> | ||
1152 | range: 0,4 : pattern number | ||
1153 | default : 0 <disable> | ||
1154 | |||
1150 | meye.*= [HW] Set MotionEye Camera parameters | 1155 | meye.*= [HW] Set MotionEye Camera parameters |
1151 | See Documentation/video4linux/meye.txt. | 1156 | See Documentation/video4linux/meye.txt. |
1152 | 1157 | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index e50e38e76d9f..a0d7406e8b37 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -382,6 +382,35 @@ config PARAVIRT | |||
382 | 382 | ||
383 | endif | 383 | endif |
384 | 384 | ||
385 | config MEMTEST_BOOTPARAM | ||
386 | bool "Memtest boot parameter" | ||
387 | depends on X86_64 | ||
388 | default y | ||
389 | help | ||
390 | This option adds a kernel parameter 'memtest', which allows memtest | ||
391 | to be disabled at boot. If this option is selected, memtest | ||
392 | functionality can be disabled with memtest=0 on the kernel | ||
393 | command line. The purpose of this option is to allow a single | ||
394 | kernel image to be distributed with memtest built in, but not | ||
395 | necessarily enabled. | ||
396 | |||
397 | If you are unsure how to answer this question, answer Y. | ||
398 | |||
399 | config MEMTEST_BOOTPARAM_VALUE | ||
400 | int "Memtest boot parameter default value (0-4)" | ||
401 | depends on MEMTEST_BOOTPARAM | ||
402 | range 0 4 | ||
403 | default 0 | ||
404 | help | ||
405 | This option sets the default value for the kernel parameter | ||
406 | 'memtest', which allows memtest to be disabled at boot. If this | ||
407 | option is set to 0 (zero), the memtest kernel parameter will | ||
408 | default to 0, disabling memtest at bootup. If this option is | ||
409 | set to 4, the memtest kernel parameter will default to 4, | ||
410 | enabling memtest at bootup, and use that as pattern number. | ||
411 | |||
412 | If you are unsure how to answer this question, answer 0. | ||
413 | |||
385 | config ACPI_SRAT | 414 | config ACPI_SRAT |
386 | def_bool y | 415 | def_bool y |
387 | depends on X86_32 && ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH) | 416 | depends on X86_32 && ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH) |
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c index 9184e6437c4f..d6ada0833876 100644 --- a/arch/x86/kernel/e820_64.c +++ b/arch/x86/kernel/e820_64.c | |||
@@ -241,7 +241,9 @@ unsigned long __init find_e820_area(unsigned long start, unsigned long end, | |||
241 | /* | 241 | /* |
242 | * Find next free range after *start | 242 | * Find next free range after *start |
243 | */ | 243 | */ |
244 | unsigned long __init find_e820_area_size(unsigned long start, unsigned long *sizep, unsigned long align) | 244 | unsigned long __init find_e820_area_size(unsigned long start, |
245 | unsigned long *sizep, | ||
246 | unsigned long align) | ||
245 | { | 247 | { |
246 | int i; | 248 | int i; |
247 | 249 | ||
@@ -254,17 +256,15 @@ unsigned long __init find_e820_area_size(unsigned long start, unsigned long *siz | |||
254 | continue; | 256 | continue; |
255 | addr = round_up(ei->addr, align); | 257 | addr = round_up(ei->addr, align); |
256 | ei_last = ei->addr + ei->size; | 258 | ei_last = ei->addr + ei->size; |
257 | // printk(KERN_DEBUG "find_e820_area_size : e820 %d [%llx, %lx]\n", i, ei->addr, ei_last); | ||
258 | if (addr < start) | 259 | if (addr < start) |
259 | addr = round_up(start, align); | 260 | addr = round_up(start, align); |
260 | // printk(KERN_DEBUG "find_e820_area_size : 0 [%lx, %lx]\n", addr, ei_last); | ||
261 | if (addr >= ei_last) | 261 | if (addr >= ei_last) |
262 | continue; | 262 | continue; |
263 | *sizep = ei_last - addr; | 263 | *sizep = ei_last - addr; |
264 | while (bad_addr_size(&addr, sizep, align) && addr+ *sizep <= ei_last) | 264 | while (bad_addr_size(&addr, sizep, align) && |
265 | addr + *sizep <= ei_last) | ||
265 | ; | 266 | ; |
266 | last = addr + *sizep; | 267 | last = addr + *sizep; |
267 | // printk(KERN_DEBUG "find_e820_area_size : 1 [%lx, %lx]\n", addr, last); | ||
268 | if (last > ei_last) | 268 | if (last > ei_last) |
269 | continue; | 269 | continue; |
270 | return addr; | 270 | return addr; |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 52f54ee4559f..ae225c3ae9a8 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -427,7 +427,10 @@ static void __init init_gbpages(void) | |||
427 | direct_gbpages = 0; | 427 | direct_gbpages = 0; |
428 | } | 428 | } |
429 | 429 | ||
430 | static void __init memtest(unsigned long start_phys, unsigned long size, unsigned pattern) | 430 | #ifdef CONFIG_MEMTEST_BOOTPARAM |
431 | |||
432 | static void __init memtest(unsigned long start_phys, unsigned long size, | ||
433 | unsigned pattern) | ||
431 | { | 434 | { |
432 | unsigned long i; | 435 | unsigned long i; |
433 | unsigned long *start; | 436 | unsigned long *start; |
@@ -486,11 +489,12 @@ static void __init memtest(unsigned long start_phys, unsigned long size, unsigne | |||
486 | 489 | ||
487 | } | 490 | } |
488 | 491 | ||
489 | static int __initdata memtest_pattern; | 492 | static int memtest_pattern __initdata = CONFIG_MEMTEST_BOOTPARAM_VALUE; |
493 | |||
490 | static int __init parse_memtest(char *arg) | 494 | static int __init parse_memtest(char *arg) |
491 | { | 495 | { |
492 | if (arg) | 496 | if (arg) |
493 | memtest_pattern = simple_strtoul(arg, NULL, 0) + 1; | 497 | memtest_pattern = simple_strtoul(arg, NULL, 0); |
494 | return 0; | 498 | return 0; |
495 | } | 499 | } |
496 | 500 | ||
@@ -501,8 +505,10 @@ static void __init early_memtest(unsigned long start, unsigned long end) | |||
501 | unsigned long t_start, t_size; | 505 | unsigned long t_start, t_size; |
502 | unsigned pattern; | 506 | unsigned pattern; |
503 | 507 | ||
504 | if (memtest_pattern) | 508 | if (!memtest_pattern) |
505 | printk(KERN_INFO "early_memtest: pattern num %d", memtest_pattern); | 509 | return; |
510 | |||
511 | printk(KERN_INFO "early_memtest: pattern num %d", memtest_pattern); | ||
506 | for (pattern = 0; pattern < memtest_pattern; pattern++) { | 512 | for (pattern = 0; pattern < memtest_pattern; pattern++) { |
507 | t_start = start; | 513 | t_start = start; |
508 | t_size = 0; | 514 | t_size = 0; |
@@ -523,9 +529,13 @@ static void __init early_memtest(unsigned long start, unsigned long end) | |||
523 | t_start += t_size; | 529 | t_start += t_size; |
524 | } | 530 | } |
525 | } | 531 | } |
526 | if (memtest_pattern) | 532 | printk(KERN_CONT "\n"); |
527 | printk(KERN_CONT "\n"); | ||
528 | } | 533 | } |
534 | #else | ||
535 | static void __init early_memtest(unsigned long start, unsigned long end) | ||
536 | { | ||
537 | } | ||
538 | #endif | ||
529 | 539 | ||
530 | /* | 540 | /* |
531 | * Setup the direct mapping of the physical memory at PAGE_OFFSET. | 541 | * Setup the direct mapping of the physical memory at PAGE_OFFSET. |