diff options
author | Borislav Petkov <bp@alien8.de> | 2010-08-28 09:58:33 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-10-20 17:23:55 -0400 |
commit | b40827fa7268fda8a62490728a61c2856f33830b (patch) | |
tree | ae16ce8206c3d72ca672a92a46dc0725faba1ced | |
parent | d25e6b0b326278a1096e8334584c3e64517057a3 (diff) |
x86-32, mm: Add an initial page table for core bootstrapping
This patch adds an initial page table with low mappings used exclusively
for booting APs/resuming after ACPI suspend/machine restart. After this,
there's no need to add low mappings to swapper_pg_dir and zap them later
or create own swsusp PGD page solely for ACPI sleep needs - we have
initial_page_table for that.
Signed-off-by: Borislav Petkov <bp@alien8.de>
LKML-Reference: <20101020070526.GA9588@liondog.tnic>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/include/asm/pgtable_32.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/tlbflush.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/trampoline.h | 3 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/sleep.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/head32.c | 1 | ||||
-rw-r--r-- | arch/x86/kernel/head_32.S | 55 | ||||
-rw-r--r-- | arch/x86/kernel/reboot.c | 10 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 18 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 16 | ||||
-rw-r--r-- | arch/x86/kernel/trampoline.c | 16 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 45 |
11 files changed, 56 insertions, 119 deletions
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h index f686f49e8b7b..8abde9ec90bf 100644 --- a/arch/x86/include/asm/pgtable_32.h +++ b/arch/x86/include/asm/pgtable_32.h | |||
@@ -26,7 +26,7 @@ struct mm_struct; | |||
26 | struct vm_area_struct; | 26 | struct vm_area_struct; |
27 | 27 | ||
28 | extern pgd_t swapper_pg_dir[1024]; | 28 | extern pgd_t swapper_pg_dir[1024]; |
29 | extern pgd_t trampoline_pg_dir[1024]; | 29 | extern pgd_t initial_page_table[1024]; |
30 | 30 | ||
31 | static inline void pgtable_cache_init(void) { } | 31 | static inline void pgtable_cache_init(void) { } |
32 | static inline void check_pgt_cache(void) { } | 32 | static inline void check_pgt_cache(void) { } |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 7f3eba08e7de..169be8938b96 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -172,6 +172,4 @@ static inline void flush_tlb_kernel_range(unsigned long start, | |||
172 | flush_tlb_all(); | 172 | flush_tlb_all(); |
173 | } | 173 | } |
174 | 174 | ||
175 | extern void zap_low_mappings(bool early); | ||
176 | |||
177 | #endif /* _ASM_X86_TLBFLUSH_H */ | 175 | #endif /* _ASM_X86_TLBFLUSH_H */ |
diff --git a/arch/x86/include/asm/trampoline.h b/arch/x86/include/asm/trampoline.h index 4dde797c0578..f4500fb3b485 100644 --- a/arch/x86/include/asm/trampoline.h +++ b/arch/x86/include/asm/trampoline.h | |||
@@ -13,16 +13,13 @@ extern unsigned char *trampoline_base; | |||
13 | 13 | ||
14 | extern unsigned long init_rsp; | 14 | extern unsigned long init_rsp; |
15 | extern unsigned long initial_code; | 15 | extern unsigned long initial_code; |
16 | extern unsigned long initial_page_table; | ||
17 | extern unsigned long initial_gs; | 16 | extern unsigned long initial_gs; |
18 | 17 | ||
19 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) | 18 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) |
20 | 19 | ||
21 | extern unsigned long setup_trampoline(void); | 20 | extern unsigned long setup_trampoline(void); |
22 | extern void __init setup_trampoline_page_table(void); | ||
23 | extern void __init reserve_trampoline_memory(void); | 21 | extern void __init reserve_trampoline_memory(void); |
24 | #else | 22 | #else |
25 | static inline void setup_trampoline_page_table(void) {} | ||
26 | static inline void reserve_trampoline_memory(void) {} | 23 | static inline void reserve_trampoline_memory(void) {} |
27 | #endif /* CONFIG_X86_TRAMPOLINE */ | 24 | #endif /* CONFIG_X86_TRAMPOLINE */ |
28 | 25 | ||
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index 33cec152070d..b35e1ab8ba03 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c | |||
@@ -12,6 +12,11 @@ | |||
12 | #include <asm/segment.h> | 12 | #include <asm/segment.h> |
13 | #include <asm/desc.h> | 13 | #include <asm/desc.h> |
14 | 14 | ||
15 | #ifdef CONFIG_X86_32 | ||
16 | #include <asm/pgtable.h> | ||
17 | #include <asm/pgtable_32.h> | ||
18 | #endif | ||
19 | |||
15 | #include "realmode/wakeup.h" | 20 | #include "realmode/wakeup.h" |
16 | #include "sleep.h" | 21 | #include "sleep.h" |
17 | 22 | ||
@@ -90,7 +95,7 @@ int acpi_save_state_mem(void) | |||
90 | 95 | ||
91 | #ifndef CONFIG_64BIT | 96 | #ifndef CONFIG_64BIT |
92 | header->pmode_entry = (u32)&wakeup_pmode_return; | 97 | header->pmode_entry = (u32)&wakeup_pmode_return; |
93 | header->pmode_cr3 = (u32)(swsusp_pg_dir - __PAGE_OFFSET); | 98 | header->pmode_cr3 = (u32)__pa(&initial_page_table); |
94 | saved_magic = 0x12345678; | 99 | saved_magic = 0x12345678; |
95 | #else /* CONFIG_64BIT */ | 100 | #else /* CONFIG_64BIT */ |
96 | header->trampoline_segment = setup_trampoline() >> 4; | 101 | header->trampoline_segment = setup_trampoline() >> 4; |
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c index 784360c0625c..8b9c2019fc0e 100644 --- a/arch/x86/kernel/head32.c +++ b/arch/x86/kernel/head32.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/apic.h> | 17 | #include <asm/apic.h> |
18 | #include <asm/io_apic.h> | 18 | #include <asm/io_apic.h> |
19 | #include <asm/bios_ebda.h> | 19 | #include <asm/bios_ebda.h> |
20 | #include <asm/tlbflush.h> | ||
20 | 21 | ||
21 | static void __init i386_default_early_setup(void) | 22 | static void __init i386_default_early_setup(void) |
22 | { | 23 | { |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index fa8c1b8e09fb..bcece91dd311 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -183,13 +183,12 @@ default_entry: | |||
183 | #ifdef CONFIG_X86_PAE | 183 | #ifdef CONFIG_X86_PAE |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * In PAE mode swapper_pg_dir is statically defined to contain enough | 186 | * In PAE mode initial_page_table is statically defined to contain |
187 | * entries to cover the VMSPLIT option (that is the top 1, 2 or 3 | 187 | * enough entries to cover the VMSPLIT option (that is the top 1, 2 or 3 |
188 | * entries). The identity mapping is handled by pointing two PGD | 188 | * entries). The identity mapping is handled by pointing two PGD entries |
189 | * entries to the first kernel PMD. | 189 | * to the first kernel PMD. |
190 | * | 190 | * |
191 | * Note the upper half of each PMD or PTE are always zero at | 191 | * Note the upper half of each PMD or PTE are always zero at this stage. |
192 | * this stage. | ||
193 | */ | 192 | */ |
194 | 193 | ||
195 | #define KPMDS (((-__PAGE_OFFSET) >> 30) & 3) /* Number of kernel PMDs */ | 194 | #define KPMDS (((-__PAGE_OFFSET) >> 30) & 3) /* Number of kernel PMDs */ |
@@ -197,7 +196,7 @@ default_entry: | |||
197 | xorl %ebx,%ebx /* %ebx is kept at zero */ | 196 | xorl %ebx,%ebx /* %ebx is kept at zero */ |
198 | 197 | ||
199 | movl $pa(__brk_base), %edi | 198 | movl $pa(__brk_base), %edi |
200 | movl $pa(swapper_pg_pmd), %edx | 199 | movl $pa(initial_pg_pmd), %edx |
201 | movl $PTE_IDENT_ATTR, %eax | 200 | movl $PTE_IDENT_ATTR, %eax |
202 | 10: | 201 | 10: |
203 | leal PDE_IDENT_ATTR(%edi),%ecx /* Create PMD entry */ | 202 | leal PDE_IDENT_ATTR(%edi),%ecx /* Create PMD entry */ |
@@ -226,14 +225,14 @@ default_entry: | |||
226 | movl %eax, pa(max_pfn_mapped) | 225 | movl %eax, pa(max_pfn_mapped) |
227 | 226 | ||
228 | /* Do early initialization of the fixmap area */ | 227 | /* Do early initialization of the fixmap area */ |
229 | movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax | 228 | movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax |
230 | movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8) | 229 | movl %eax,pa(initial_pg_pmd+0x1000*KPMDS-8) |
231 | #else /* Not PAE */ | 230 | #else /* Not PAE */ |
232 | 231 | ||
233 | page_pde_offset = (__PAGE_OFFSET >> 20); | 232 | page_pde_offset = (__PAGE_OFFSET >> 20); |
234 | 233 | ||
235 | movl $pa(__brk_base), %edi | 234 | movl $pa(__brk_base), %edi |
236 | movl $pa(swapper_pg_dir), %edx | 235 | movl $pa(initial_page_table), %edx |
237 | movl $PTE_IDENT_ATTR, %eax | 236 | movl $PTE_IDENT_ATTR, %eax |
238 | 10: | 237 | 10: |
239 | leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry */ | 238 | leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry */ |
@@ -257,8 +256,8 @@ page_pde_offset = (__PAGE_OFFSET >> 20); | |||
257 | movl %eax, pa(max_pfn_mapped) | 256 | movl %eax, pa(max_pfn_mapped) |
258 | 257 | ||
259 | /* Do early initialization of the fixmap area */ | 258 | /* Do early initialization of the fixmap area */ |
260 | movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax | 259 | movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax |
261 | movl %eax,pa(swapper_pg_dir+0xffc) | 260 | movl %eax,pa(initial_page_table+0xffc) |
262 | #endif | 261 | #endif |
263 | jmp 3f | 262 | jmp 3f |
264 | /* | 263 | /* |
@@ -334,7 +333,7 @@ ENTRY(startup_32_smp) | |||
334 | /* | 333 | /* |
335 | * Enable paging | 334 | * Enable paging |
336 | */ | 335 | */ |
337 | movl pa(initial_page_table), %eax | 336 | movl $pa(initial_page_table), %eax |
338 | movl %eax,%cr3 /* set the page table pointer.. */ | 337 | movl %eax,%cr3 /* set the page table pointer.. */ |
339 | movl %cr0,%eax | 338 | movl %cr0,%eax |
340 | orl $X86_CR0_PG,%eax | 339 | orl $X86_CR0_PG,%eax |
@@ -614,8 +613,6 @@ ignore_int: | |||
614 | .align 4 | 613 | .align 4 |
615 | ENTRY(initial_code) | 614 | ENTRY(initial_code) |
616 | .long i386_start_kernel | 615 | .long i386_start_kernel |
617 | ENTRY(initial_page_table) | ||
618 | .long pa(swapper_pg_dir) | ||
619 | 616 | ||
620 | /* | 617 | /* |
621 | * BSS section | 618 | * BSS section |
@@ -623,20 +620,18 @@ ENTRY(initial_page_table) | |||
623 | __PAGE_ALIGNED_BSS | 620 | __PAGE_ALIGNED_BSS |
624 | .align PAGE_SIZE_asm | 621 | .align PAGE_SIZE_asm |
625 | #ifdef CONFIG_X86_PAE | 622 | #ifdef CONFIG_X86_PAE |
626 | swapper_pg_pmd: | 623 | initial_pg_pmd: |
627 | .fill 1024*KPMDS,4,0 | 624 | .fill 1024*KPMDS,4,0 |
628 | #else | 625 | #else |
629 | ENTRY(swapper_pg_dir) | 626 | ENTRY(initial_page_table) |
630 | .fill 1024,4,0 | 627 | .fill 1024,4,0 |
631 | #endif | 628 | #endif |
632 | swapper_pg_fixmap: | 629 | initial_pg_fixmap: |
633 | .fill 1024,4,0 | 630 | .fill 1024,4,0 |
634 | #ifdef CONFIG_X86_TRAMPOLINE | ||
635 | ENTRY(trampoline_pg_dir) | ||
636 | .fill 1024,4,0 | ||
637 | #endif | ||
638 | ENTRY(empty_zero_page) | 631 | ENTRY(empty_zero_page) |
639 | .fill 4096,1,0 | 632 | .fill 4096,1,0 |
633 | ENTRY(swapper_pg_dir) | ||
634 | .fill 1024,4,0 | ||
640 | 635 | ||
641 | /* | 636 | /* |
642 | * This starts the data section. | 637 | * This starts the data section. |
@@ -645,20 +640,20 @@ ENTRY(empty_zero_page) | |||
645 | __PAGE_ALIGNED_DATA | 640 | __PAGE_ALIGNED_DATA |
646 | /* Page-aligned for the benefit of paravirt? */ | 641 | /* Page-aligned for the benefit of paravirt? */ |
647 | .align PAGE_SIZE_asm | 642 | .align PAGE_SIZE_asm |
648 | ENTRY(swapper_pg_dir) | 643 | ENTRY(initial_page_table) |
649 | .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0 /* low identity map */ | 644 | .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0 /* low identity map */ |
650 | # if KPMDS == 3 | 645 | # if KPMDS == 3 |
651 | .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0 | 646 | .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0 |
652 | .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0 | 647 | .long pa(initial_pg_pmd+PGD_IDENT_ATTR+0x1000),0 |
653 | .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x2000),0 | 648 | .long pa(initial_pg_pmd+PGD_IDENT_ATTR+0x2000),0 |
654 | # elif KPMDS == 2 | 649 | # elif KPMDS == 2 |
655 | .long 0,0 | 650 | .long 0,0 |
656 | .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0 | 651 | .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0 |
657 | .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0 | 652 | .long pa(initial_pg_pmd+PGD_IDENT_ATTR+0x1000),0 |
658 | # elif KPMDS == 1 | 653 | # elif KPMDS == 1 |
659 | .long 0,0 | 654 | .long 0,0 |
660 | .long 0,0 | 655 | .long 0,0 |
661 | .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0 | 656 | .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0 |
662 | # else | 657 | # else |
663 | # error "Kernel PMDs should be 1, 2 or 3" | 658 | # error "Kernel PMDs should be 1, 2 or 3" |
664 | # endif | 659 | # endif |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 7a4cf14223ba..f7f53dcd3e0a 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -371,16 +371,10 @@ void machine_real_restart(const unsigned char *code, int length) | |||
371 | CMOS_WRITE(0x00, 0x8f); | 371 | CMOS_WRITE(0x00, 0x8f); |
372 | spin_unlock(&rtc_lock); | 372 | spin_unlock(&rtc_lock); |
373 | 373 | ||
374 | /* Remap the kernel at virtual address zero, as well as offset zero | ||
375 | from the kernel segment. This assumes the kernel segment starts at | ||
376 | virtual address PAGE_OFFSET. */ | ||
377 | memcpy(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY, | ||
378 | sizeof(swapper_pg_dir [0]) * KERNEL_PGD_PTRS); | ||
379 | |||
380 | /* | 374 | /* |
381 | * Use `swapper_pg_dir' as our page directory. | 375 | * Switch back to the initial page table. |
382 | */ | 376 | */ |
383 | load_cr3(swapper_pg_dir); | 377 | load_cr3(initial_page_table); |
384 | 378 | ||
385 | /* Write 0x1234 to absolute memory location 0x472. The BIOS reads | 379 | /* Write 0x1234 to absolute memory location 0x472. The BIOS reads |
386 | this on booting to tell it to "Bypass memory test (also warm | 380 | this on booting to tell it to "Bypass memory test (also warm |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 322b24fbeafd..af6cf2bfceee 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -728,6 +728,17 @@ void __init setup_arch(char **cmdline_p) | |||
728 | #ifdef CONFIG_X86_32 | 728 | #ifdef CONFIG_X86_32 |
729 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); | 729 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); |
730 | visws_early_detect(); | 730 | visws_early_detect(); |
731 | |||
732 | /* | ||
733 | * copy kernel address range established so far and switch | ||
734 | * to the proper swapper page table | ||
735 | */ | ||
736 | clone_pgd_range(swapper_pg_dir + KERNEL_PGD_BOUNDARY, | ||
737 | initial_page_table + KERNEL_PGD_BOUNDARY, | ||
738 | KERNEL_PGD_PTRS); | ||
739 | |||
740 | load_cr3(swapper_pg_dir); | ||
741 | __flush_tlb_all(); | ||
731 | #else | 742 | #else |
732 | printk(KERN_INFO "Command line: %s\n", boot_command_line); | 743 | printk(KERN_INFO "Command line: %s\n", boot_command_line); |
733 | #endif | 744 | #endif |
@@ -1009,7 +1020,12 @@ void __init setup_arch(char **cmdline_p) | |||
1009 | paging_init(); | 1020 | paging_init(); |
1010 | x86_init.paging.pagetable_setup_done(swapper_pg_dir); | 1021 | x86_init.paging.pagetable_setup_done(swapper_pg_dir); |
1011 | 1022 | ||
1012 | setup_trampoline_page_table(); | 1023 | #ifdef CONFIG_X86_32 |
1024 | /* sync back kernel address range */ | ||
1025 | clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, | ||
1026 | swapper_pg_dir + KERNEL_PGD_BOUNDARY, | ||
1027 | KERNEL_PGD_PTRS); | ||
1028 | #endif | ||
1013 | 1029 | ||
1014 | tboot_probe(); | 1030 | tboot_probe(); |
1015 | 1031 | ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 63a1a5596ac0..e63bb5185855 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -298,22 +298,16 @@ notrace static void __cpuinit start_secondary(void *unused) | |||
298 | * fragile that we want to limit the things done here to the | 298 | * fragile that we want to limit the things done here to the |
299 | * most necessary things. | 299 | * most necessary things. |
300 | */ | 300 | */ |
301 | cpu_init(); | ||
302 | preempt_disable(); | ||
303 | smp_callin(); | ||
301 | 304 | ||
302 | #ifdef CONFIG_X86_32 | 305 | #ifdef CONFIG_X86_32 |
303 | /* | 306 | /* switch away from the initial page table */ |
304 | * Switch away from the trampoline page-table | ||
305 | * | ||
306 | * Do this before cpu_init() because it needs to access per-cpu | ||
307 | * data which may not be mapped in the trampoline page-table. | ||
308 | */ | ||
309 | load_cr3(swapper_pg_dir); | 307 | load_cr3(swapper_pg_dir); |
310 | __flush_tlb_all(); | 308 | __flush_tlb_all(); |
311 | #endif | 309 | #endif |
312 | 310 | ||
313 | cpu_init(); | ||
314 | preempt_disable(); | ||
315 | smp_callin(); | ||
316 | |||
317 | /* otherwise gcc will move up smp_processor_id before the cpu_init */ | 311 | /* otherwise gcc will move up smp_processor_id before the cpu_init */ |
318 | barrier(); | 312 | barrier(); |
319 | /* | 313 | /* |
@@ -772,7 +766,6 @@ do_rest: | |||
772 | #ifdef CONFIG_X86_32 | 766 | #ifdef CONFIG_X86_32 |
773 | /* Stack for startup_32 can be just as for start_secondary onwards */ | 767 | /* Stack for startup_32 can be just as for start_secondary onwards */ |
774 | irq_ctx_init(cpu); | 768 | irq_ctx_init(cpu); |
775 | initial_page_table = __pa(&trampoline_pg_dir); | ||
776 | #else | 769 | #else |
777 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); | 770 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); |
778 | initial_gs = per_cpu_offset(cpu); | 771 | initial_gs = per_cpu_offset(cpu); |
@@ -921,7 +914,6 @@ int __cpuinit native_cpu_up(unsigned int cpu) | |||
921 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; | 914 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; |
922 | 915 | ||
923 | err = do_boot_cpu(apicid, cpu); | 916 | err = do_boot_cpu(apicid, cpu); |
924 | |||
925 | if (err) { | 917 | if (err) { |
926 | pr_debug("do_boot_cpu failed %d\n", err); | 918 | pr_debug("do_boot_cpu failed %d\n", err); |
927 | return -EIO; | 919 | return -EIO; |
diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c index e2a595257390..f1488a344cd6 100644 --- a/arch/x86/kernel/trampoline.c +++ b/arch/x86/kernel/trampoline.c | |||
@@ -38,19 +38,3 @@ unsigned long __trampinit setup_trampoline(void) | |||
38 | memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE); | 38 | memcpy(trampoline_base, trampoline_data, TRAMPOLINE_SIZE); |
39 | return virt_to_phys(trampoline_base); | 39 | return virt_to_phys(trampoline_base); |
40 | } | 40 | } |
41 | |||
42 | void __init setup_trampoline_page_table(void) | ||
43 | { | ||
44 | #ifdef CONFIG_X86_32 | ||
45 | /* Copy kernel address range */ | ||
46 | clone_pgd_range(trampoline_pg_dir + KERNEL_PGD_BOUNDARY, | ||
47 | swapper_pg_dir + KERNEL_PGD_BOUNDARY, | ||
48 | KERNEL_PGD_PTRS); | ||
49 | |||
50 | /* Initialize low mappings */ | ||
51 | clone_pgd_range(trampoline_pg_dir, | ||
52 | swapper_pg_dir + KERNEL_PGD_BOUNDARY, | ||
53 | min_t(unsigned long, KERNEL_PGD_PTRS, | ||
54 | KERNEL_PGD_BOUNDARY)); | ||
55 | #endif | ||
56 | } | ||
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 558f2d332076..1aeac2d9df80 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -548,48 +548,6 @@ static void __init pagetable_init(void) | |||
548 | permanent_kmaps_init(pgd_base); | 548 | permanent_kmaps_init(pgd_base); |
549 | } | 549 | } |
550 | 550 | ||
551 | #ifdef CONFIG_ACPI_SLEEP | ||
552 | /* | ||
553 | * ACPI suspend needs this for resume, because things like the intel-agp | ||
554 | * driver might have split up a kernel 4MB mapping. | ||
555 | */ | ||
556 | char swsusp_pg_dir[PAGE_SIZE] | ||
557 | __attribute__ ((aligned(PAGE_SIZE))); | ||
558 | |||
559 | static inline void save_pg_dir(void) | ||
560 | { | ||
561 | copy_page(swsusp_pg_dir, swapper_pg_dir); | ||
562 | } | ||
563 | #else /* !CONFIG_ACPI_SLEEP */ | ||
564 | static inline void save_pg_dir(void) | ||
565 | { | ||
566 | } | ||
567 | #endif /* !CONFIG_ACPI_SLEEP */ | ||
568 | |||
569 | void zap_low_mappings(bool early) | ||
570 | { | ||
571 | int i; | ||
572 | |||
573 | /* | ||
574 | * Zap initial low-memory mappings. | ||
575 | * | ||
576 | * Note that "pgd_clear()" doesn't do it for | ||
577 | * us, because pgd_clear() is a no-op on i386. | ||
578 | */ | ||
579 | for (i = 0; i < KERNEL_PGD_BOUNDARY; i++) { | ||
580 | #ifdef CONFIG_X86_PAE | ||
581 | set_pgd(swapper_pg_dir+i, __pgd(1 + __pa(empty_zero_page))); | ||
582 | #else | ||
583 | set_pgd(swapper_pg_dir+i, __pgd(0)); | ||
584 | #endif | ||
585 | } | ||
586 | |||
587 | if (early) | ||
588 | __flush_tlb(); | ||
589 | else | ||
590 | flush_tlb_all(); | ||
591 | } | ||
592 | |||
593 | pteval_t __supported_pte_mask __read_mostly = ~(_PAGE_NX | _PAGE_GLOBAL | _PAGE_IOMAP); | 551 | pteval_t __supported_pte_mask __read_mostly = ~(_PAGE_NX | _PAGE_GLOBAL | _PAGE_IOMAP); |
594 | EXPORT_SYMBOL_GPL(__supported_pte_mask); | 552 | EXPORT_SYMBOL_GPL(__supported_pte_mask); |
595 | 553 | ||
@@ -958,9 +916,6 @@ void __init mem_init(void) | |||
958 | 916 | ||
959 | if (boot_cpu_data.wp_works_ok < 0) | 917 | if (boot_cpu_data.wp_works_ok < 0) |
960 | test_wp_bit(); | 918 | test_wp_bit(); |
961 | |||
962 | save_pg_dir(); | ||
963 | zap_low_mappings(true); | ||
964 | } | 919 | } |
965 | 920 | ||
966 | #ifdef CONFIG_MEMORY_HOTPLUG | 921 | #ifdef CONFIG_MEMORY_HOTPLUG |