Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356187
b: refs/heads/master
c: c14fa0b
h: refs/heads/master
i:
  356185: f2b05c3
  356183: d2482b9
v: v3
  • Loading branch information
Yinghai Lu authored and H. Peter Anvin committed Nov 17, 2012
1 parent 634698f commit 0d40a9b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84f1ae30bb68d8da98bca7ff2c2b825b2ac8c9a5
refs/heads/master: c14fa0b63b5b4234667c03fdc3314c0881caa514
66 changes: 34 additions & 32 deletions trunk/arch/x86/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,6 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
memset(mr, 0, sizeof(mr));
nr_range = split_mem_range(mr, 0, start, end);

/*
* Find space for the kernel direct mapping tables.
*
* Later we should allocate these tables in the local node of the
* memory mapped. Unfortunately this is done currently before the
* nodes are discovered.
*/
if (!after_bootmem)
find_early_table_space(start, end);

for (i = 0; i < nr_range; i++)
ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
mr[i].page_size_mask);
Expand All @@ -296,6 +286,36 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,

__flush_tlb_all();

return ret >> PAGE_SHIFT;
}

void __init init_mem_mapping(void)
{
probe_page_size_mask();

/*
* Find space for the kernel direct mapping tables.
*
* Later we should allocate these tables in the local node of the
* memory mapped. Unfortunately this is done currently before the
* nodes are discovered.
*/
#ifdef CONFIG_X86_64
find_early_table_space(0, max_pfn<<PAGE_SHIFT);
#else
find_early_table_space(0, max_low_pfn<<PAGE_SHIFT);
#endif
max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
max_pfn_mapped = max_low_pfn_mapped;

#ifdef CONFIG_X86_64
if (max_pfn > max_low_pfn) {
max_pfn_mapped = init_memory_mapping(1UL<<32,
max_pfn<<PAGE_SHIFT);
/* can we preseve max_low_pfn ?*/
max_low_pfn = max_pfn;
}
#endif
/*
* Reserve the kernel pagetable pages we used (pgt_buf_start -
* pgt_buf_end) and free the other ones (pgt_buf_end - pgt_buf_top)
Expand All @@ -311,32 +331,14 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
* RO all the pagetable pages, including the ones that are beyond
* pgt_buf_end at that time.
*/
if (!after_bootmem && pgt_buf_end > pgt_buf_start)
if (pgt_buf_end > pgt_buf_start)
x86_init.mapping.pagetable_reserve(PFN_PHYS(pgt_buf_start),
PFN_PHYS(pgt_buf_end));

if (!after_bootmem)
early_memtest(start, end);
/* stop the wrong using */
pgt_buf_top = 0;

return ret >> PAGE_SHIFT;
}

void __init init_mem_mapping(void)
{
probe_page_size_mask();

/* max_pfn_mapped is updated here */
max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
max_pfn_mapped = max_low_pfn_mapped;

#ifdef CONFIG_X86_64
if (max_pfn > max_low_pfn) {
max_pfn_mapped = init_memory_mapping(1UL<<32,
max_pfn<<PAGE_SHIFT);
/* can we preseve max_low_pfn ?*/
max_low_pfn = max_pfn;
}
#endif
early_memtest(0, max_pfn_mapped << PAGE_SHIFT);
}

/*
Expand Down

0 comments on commit 0d40a9b

Please sign in to comment.