aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2009-03-05 07:54:59 -0500
committerIngo Molnar <mingo@elte.hu>2009-03-05 08:17:14 -0500
commitcbba65796df99f3ca9bf70d14e5a19384c54b6a1 (patch)
treec1a88f3eb150ab99a8223652f301c3fc64d73fe3
parentc464573cb3d3bdd45eed8f5f59596f84ede95a0c (diff)
x86: unify kernel_physical_mapping_init() call in init_memory_mapping()
Impact: cleanup The 64-bit version of init_memory_mapping() uses the last mapped address returned from kernel_physical_mapping_init() whereas the 32-bit version doesn't. This patch adds relevant ifdefs to both versions of the function to reduce the diff between them. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <1236257708-27269-8-git-send-email-penberg@cs.helsinki.fi> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/mm/init_32.c10
-rw-r--r--arch/x86/mm/init_64.c21
2 files changed, 22 insertions, 9 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index cc5c3992385e..00c1d8508258 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -929,6 +929,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
929 unsigned long page_size_mask = 0; 929 unsigned long page_size_mask = 0;
930 unsigned long start_pfn, end_pfn; 930 unsigned long start_pfn, end_pfn;
931 unsigned long pos; 931 unsigned long pos;
932 unsigned long ret;
932 933
933 struct map_range mr[NR_RANGE_MR]; 934 struct map_range mr[NR_RANGE_MR];
934 int nr_range, i; 935 int nr_range, i;
@@ -1040,11 +1041,18 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
1040 if (!after_bootmem) 1041 if (!after_bootmem)
1041 find_early_table_space(end, use_pse, use_gbpages); 1042 find_early_table_space(end, use_pse, use_gbpages);
1042 1043
1044#ifdef CONFIG_X86_32
1043 for (i = 0; i < nr_range; i++) 1045 for (i = 0; i < nr_range; i++)
1044 kernel_physical_mapping_init( 1046 kernel_physical_mapping_init(
1045 mr[i].start >> PAGE_SHIFT, 1047 mr[i].start >> PAGE_SHIFT,
1046 mr[i].end >> PAGE_SHIFT, 1048 mr[i].end >> PAGE_SHIFT,
1047 mr[i].page_size_mask == (1<<PG_LEVEL_2M)); 1049 mr[i].page_size_mask == (1<<PG_LEVEL_2M));
1050 ret = end;
1051#else /* CONFIG_X86_64 */
1052 for (i = 0; i < nr_range; i++)
1053 ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
1054 mr[i].page_size_mask);
1055#endif
1048 1056
1049 early_ioremap_page_table_range_init(); 1057 early_ioremap_page_table_range_init();
1050 1058
@@ -1059,7 +1067,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
1059 if (!after_bootmem) 1067 if (!after_bootmem)
1060 early_memtest(start, end); 1068 early_memtest(start, end);
1061 1069
1062 return end >> PAGE_SHIFT; 1070 return ret >> PAGE_SHIFT;
1063} 1071}
1064 1072
1065 1073
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index c3c0be5b6373..e4fadea2e521 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -686,10 +686,10 @@ static int save_mr(struct map_range *mr, int nr_range,
686unsigned long __init_refok init_memory_mapping(unsigned long start, 686unsigned long __init_refok init_memory_mapping(unsigned long start,
687 unsigned long end) 687 unsigned long end)
688{ 688{
689 unsigned long last_map_addr = 0;
690 unsigned long page_size_mask = 0; 689 unsigned long page_size_mask = 0;
691 unsigned long start_pfn, end_pfn; 690 unsigned long start_pfn, end_pfn;
692 unsigned long pos; 691 unsigned long pos;
692 unsigned long ret;
693 693
694 struct map_range mr[NR_RANGE_MR]; 694 struct map_range mr[NR_RANGE_MR];
695 int nr_range, i; 695 int nr_range, i;
@@ -819,10 +819,18 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
819 if (!after_bootmem) 819 if (!after_bootmem)
820 find_early_table_space(end, use_pse, use_gbpages); 820 find_early_table_space(end, use_pse, use_gbpages);
821 821
822#ifdef CONFIG_X86_32
823 for (i = 0; i < nr_range; i++)
824 kernel_physical_mapping_init(
825 mr[i].start >> PAGE_SHIFT,
826 mr[i].end >> PAGE_SHIFT,
827 mr[i].page_size_mask == (1<<PG_LEVEL_2M));
828 ret = end;
829#else /* CONFIG_X86_64 */
822 for (i = 0; i < nr_range; i++) 830 for (i = 0; i < nr_range; i++)
823 last_map_addr = kernel_physical_mapping_init( 831 ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
824 mr[i].start, mr[i].end, 832 mr[i].page_size_mask);
825 mr[i].page_size_mask); 833#endif
826 834
827 if (!after_bootmem) 835 if (!after_bootmem)
828 mmu_cr4_features = read_cr4(); 836 mmu_cr4_features = read_cr4();
@@ -832,13 +840,10 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
832 reserve_early(table_start << PAGE_SHIFT, 840 reserve_early(table_start << PAGE_SHIFT,
833 table_end << PAGE_SHIFT, "PGTABLE"); 841 table_end << PAGE_SHIFT, "PGTABLE");
834 842
835 printk(KERN_INFO "last_map_addr: %lx end: %lx\n",
836 last_map_addr, end);
837
838 if (!after_bootmem) 843 if (!after_bootmem)
839 early_memtest(start, end); 844 early_memtest(start, end);
840 845
841 return last_map_addr >> PAGE_SHIFT; 846 return ret >> PAGE_SHIFT;
842} 847}
843 848
844#ifndef CONFIG_NUMA 849#ifndef CONFIG_NUMA