Commit f763ad1d authored by Yinghai Lu's avatar Yinghai Lu Committed by H. Peter Anvin

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: default avatarYinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1353123563-3103-21-git-send-email-yinghai@kernel.orgSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent eceb3632
...@@ -398,40 +398,30 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, ...@@ -398,40 +398,30 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
* Depending on the alignment of E820 ranges, this may possibly result in using * Depending on the alignment of E820 ranges, this may possibly result in using
* smaller size (i.e. 4K instead of 2M or 1G) page tables. * smaller size (i.e. 4K instead of 2M or 1G) page tables.
*/ */
static void __init init_all_memory_mapping(void) static void __init init_range_memory_mapping(unsigned long range_start,
unsigned long range_end)
{ {
unsigned long start_pfn, end_pfn; unsigned long start_pfn, end_pfn;
int i; int i;
/* the ISA range is always mapped regardless of memory holes */
init_memory_mapping(0, ISA_END_ADDRESS);
for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) { for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) {
u64 start = (u64)start_pfn << PAGE_SHIFT; u64 start = (u64)start_pfn << PAGE_SHIFT;
u64 end = (u64)end_pfn << PAGE_SHIFT; u64 end = (u64)end_pfn << PAGE_SHIFT;
if (end <= ISA_END_ADDRESS) if (end <= range_start)
continue; continue;
if (start < ISA_END_ADDRESS) if (start < range_start)
start = ISA_END_ADDRESS; start = range_start;
#ifdef CONFIG_X86_32
/* on 32 bit, we only map up to max_low_pfn */ if (start >= range_end)
if ((start >> PAGE_SHIFT) >= max_low_pfn)
continue; continue;
if ((end >> PAGE_SHIFT) > max_low_pfn) if (end > range_end)
end = max_low_pfn << PAGE_SHIFT; end = range_end;
#endif
init_memory_mapping(start, end);
}
#ifdef CONFIG_X86_64 init_memory_mapping(start, end);
if (max_pfn > max_low_pfn) {
/* can we preseve max_low_pfn ?*/
max_low_pfn = max_pfn;
} }
#endif
} }
void __init init_mem_mapping(void) void __init init_mem_mapping(void)
...@@ -461,8 +451,15 @@ void __init init_mem_mapping(void) ...@@ -461,8 +451,15 @@ void __init init_mem_mapping(void)
(pgt_buf_top << PAGE_SHIFT) - 1); (pgt_buf_top << PAGE_SHIFT) - 1);
max_pfn_mapped = 0; /* will get exact value next */ max_pfn_mapped = 0; /* will get exact value next */
init_all_memory_mapping(); /* the ISA range is always mapped regardless of memory holes */
init_memory_mapping(0, ISA_END_ADDRESS);
init_range_memory_mapping(ISA_END_ADDRESS, end);
#ifdef CONFIG_X86_64
if (max_pfn > max_low_pfn) {
/* can we preseve max_low_pfn ?*/
max_low_pfn = max_pfn;
}
#endif
/* /*
* Reserve the kernel pagetable pages we used (pgt_buf_start - * Reserve the kernel pagetable pages we used (pgt_buf_start -
* pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top) * pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment