diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-11-16 22:38:57 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2012-11-17 14:59:17 -0500 |
commit | f763ad1d3870abb811ec7520b4c1adc56471a3a4 (patch) | |
tree | 76813c9af94068f1a39d9da83bf50b322db5bde1 /arch/x86/mm/init.c | |
parent | eceb3632ac85bc08fc27f7fc9ab85672681b2635 (diff) |
x86, mm: Break down init_all_memory_mapping
Will replace that with top-down page table initialization.
New API need to take range: init_range_memory_mapping()
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1353123563-3103-21-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm/init.c')
-rw-r--r-- | arch/x86/mm/init.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index da591ebc8d12..c688ea3887f2 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -398,40 +398,30 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, | |||
398 | * Depending on the alignment of E820 ranges, this may possibly result in using | 398 | * Depending on the alignment of E820 ranges, this may possibly result in using |
399 | * smaller size (i.e. 4K instead of 2M or 1G) page tables. | 399 | * smaller size (i.e. 4K instead of 2M or 1G) page tables. |
400 | */ | 400 | */ |
401 | static void __init init_all_memory_mapping(void) | 401 | static void __init init_range_memory_mapping(unsigned long range_start, |
402 | unsigned long range_end) | ||
402 | { | 403 | { |
403 | unsigned long start_pfn, end_pfn; | 404 | unsigned long start_pfn, end_pfn; |
404 | int i; | 405 | int i; |
405 | 406 | ||
406 | /* the ISA range is always mapped regardless of memory holes */ | ||
407 | init_memory_mapping(0, ISA_END_ADDRESS); | ||
408 | |||
409 | for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) { | 407 | for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) { |
410 | u64 start = (u64)start_pfn << PAGE_SHIFT; | 408 | u64 start = (u64)start_pfn << PAGE_SHIFT; |
411 | u64 end = (u64)end_pfn << PAGE_SHIFT; | 409 | u64 end = (u64)end_pfn << PAGE_SHIFT; |
412 | 410 | ||
413 | if (end <= ISA_END_ADDRESS) | 411 | if (end <= range_start) |
414 | continue; | 412 | continue; |
415 | 413 | ||
416 | if (start < ISA_END_ADDRESS) | 414 | if (start < range_start) |
417 | start = ISA_END_ADDRESS; | 415 | start = range_start; |
418 | #ifdef CONFIG_X86_32 | 416 | |
419 | /* on 32 bit, we only map up to max_low_pfn */ | 417 | if (start >= range_end) |
420 | if ((start >> PAGE_SHIFT) >= max_low_pfn) | ||
421 | continue; | 418 | continue; |
422 | 419 | ||
423 | if ((end >> PAGE_SHIFT) > max_low_pfn) | 420 | if (end > range_end) |
424 | end = max_low_pfn << PAGE_SHIFT; | 421 | end = range_end; |
425 | #endif | ||
426 | init_memory_mapping(start, end); | ||
427 | } | ||
428 | 422 | ||
429 | #ifdef CONFIG_X86_64 | 423 | init_memory_mapping(start, end); |
430 | if (max_pfn > max_low_pfn) { | ||
431 | /* can we preseve max_low_pfn ?*/ | ||
432 | max_low_pfn = max_pfn; | ||
433 | } | 424 | } |
434 | #endif | ||
435 | } | 425 | } |
436 | 426 | ||
437 | void __init init_mem_mapping(void) | 427 | void __init init_mem_mapping(void) |
@@ -461,8 +451,15 @@ void __init init_mem_mapping(void) | |||
461 | (pgt_buf_top << PAGE_SHIFT) - 1); | 451 | (pgt_buf_top << PAGE_SHIFT) - 1); |
462 | 452 | ||
463 | max_pfn_mapped = 0; /* will get exact value next */ | 453 | max_pfn_mapped = 0; /* will get exact value next */ |
464 | init_all_memory_mapping(); | 454 | /* the ISA range is always mapped regardless of memory holes */ |
465 | 455 | init_memory_mapping(0, ISA_END_ADDRESS); | |
456 | init_range_memory_mapping(ISA_END_ADDRESS, end); | ||
457 | #ifdef CONFIG_X86_64 | ||
458 | if (max_pfn > max_low_pfn) { | ||
459 | /* can we preseve max_low_pfn ?*/ | ||
460 | max_low_pfn = max_pfn; | ||
461 | } | ||
462 | #endif | ||
466 | /* | 463 | /* |
467 | * Reserve the kernel pagetable pages we used (pgt_buf_start - | 464 | * Reserve the kernel pagetable pages we used (pgt_buf_start - |
468 | * pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top) | 465 | * pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top) |