aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/paravirt.h10
-rw-r--r--arch/x86/include/asm/paravirt_types.h9
-rw-r--r--arch/x86/include/asm/pgtable.h10
-rw-r--r--arch/x86/include/asm/pgtable_types.h4
-rw-r--r--arch/x86/include/asm/x86_init.h13
-rw-r--r--arch/x86/kernel/paravirt.c7
-rw-r--r--arch/x86/kernel/setup.c4
-rw-r--r--arch/x86/kernel/x86_init.c6
-rw-r--r--arch/x86/xen/enlighten.c2
-rw-r--r--arch/x86/xen/mmu.c11
-rw-r--r--arch/x86/xen/mmu.h2
11 files changed, 32 insertions, 46 deletions
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 3de6435a106a..1caf25b91e6b 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -351,16 +351,6 @@ static inline void paravirt_post_allocator_init(void)
351 (*pv_init_ops.post_allocator_init)(); 351 (*pv_init_ops.post_allocator_init)();
352} 352}
353 353
354static inline void paravirt_pagetable_setup_start(pgd_t *base)
355{
356 (*pv_mmu_ops.pagetable_setup_start)(base);
357}
358
359static inline void paravirt_pagetable_setup_done(pgd_t *base)
360{
361 (*pv_mmu_ops.pagetable_setup_done)(base);
362}
363
364#ifdef CONFIG_SMP 354#ifdef CONFIG_SMP
365static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip, 355static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
366 unsigned long start_esp) 356 unsigned long start_esp)
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index ce7723c81a1e..4039eefd3ebc 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -231,15 +231,6 @@ struct pv_apic_ops {
231}; 231};
232 232
233struct pv_mmu_ops { 233struct pv_mmu_ops {
234 /*
235 * Called before/after init_mm pagetable setup. setup_start
236 * may reset %cr3, and may pre-install parts of the pagetable;
237 * pagetable setup is expected to preserve any existing
238 * mapping.
239 */
240 void (*pagetable_setup_start)(pgd_t *pgd_base);
241 void (*pagetable_setup_done)(pgd_t *pgd_base);
242
243 unsigned long (*read_cr2)(void); 234 unsigned long (*read_cr2)(void);
244 void (*write_cr2)(unsigned long); 235 void (*write_cr2)(unsigned long);
245 236
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 16748077559a..60d422adf706 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -56,16 +56,6 @@ extern struct list_head pgd_list;
56#define pte_update(mm, addr, ptep) do { } while (0) 56#define pte_update(mm, addr, ptep) do { } while (0)
57#define pte_update_defer(mm, addr, ptep) do { } while (0) 57#define pte_update_defer(mm, addr, ptep) do { } while (0)
58 58
59static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
60{
61 native_pagetable_setup_start(base);
62}
63
64static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
65{
66 native_pagetable_setup_done(base);
67}
68
69#define pgd_val(x) native_pgd_val(x) 59#define pgd_val(x) native_pgd_val(x)
70#define __pgd(x) native_make_pgd(x) 60#define __pgd(x) native_make_pgd(x)
71 61
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 54cb697f4900..7b467bf3c680 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -299,8 +299,8 @@ void set_pte_vaddr(unsigned long vaddr, pte_t pte);
299extern void native_pagetable_setup_start(pgd_t *base); 299extern void native_pagetable_setup_start(pgd_t *base);
300extern void native_pagetable_setup_done(pgd_t *base); 300extern void native_pagetable_setup_done(pgd_t *base);
301#else 301#else
302static inline void native_pagetable_setup_start(pgd_t *base) {} 302#define native_pagetable_setup_start x86_init_pgd_noop
303static inline void native_pagetable_setup_done(pgd_t *base) {} 303#define native_pagetable_setup_done x86_init_pgd_noop
304#endif 304#endif
305 305
306struct seq_file; 306struct seq_file;
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index ee7c59df7814..b9bb4faefc48 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_X86_PLATFORM_H 1#ifndef _ASM_X86_PLATFORM_H
2#define _ASM_X86_PLATFORM_H 2#define _ASM_X86_PLATFORM_H
3 3
4#include <asm/pgtable_types.h>
5
4struct mpc_bus; 6struct mpc_bus;
5struct mpc_cpu; 7struct mpc_cpu;
6struct mpc_table; 8struct mpc_table;
@@ -67,6 +69,16 @@ struct x86_init_oem {
67}; 69};
68 70
69/** 71/**
72 * struct x86_init_paging - platform specific paging functions
73 * @pagetable_setup_start: platform specific pre paging_init() call
74 * @pagetable_setup_done: platform specific post paging_init() call
75 */
76struct x86_init_paging {
77 void (*pagetable_setup_start)(pgd_t *base);
78 void (*pagetable_setup_done)(pgd_t *base);
79};
80
81/**
70 * struct x86_init_ops - functions for platform specific setup 82 * struct x86_init_ops - functions for platform specific setup
71 * 83 *
72 */ 84 */
@@ -75,6 +87,7 @@ struct x86_init_ops {
75 struct x86_init_mpparse mpparse; 87 struct x86_init_mpparse mpparse;
76 struct x86_init_irqs irqs; 88 struct x86_init_irqs irqs;
77 struct x86_init_oem oem; 89 struct x86_init_oem oem;
90 struct x86_init_paging paging;
78}; 91};
79 92
80extern struct x86_init_ops x86_init; 93extern struct x86_init_ops x86_init;
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index f7a5fb79d18a..8167be0b68ca 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -402,13 +402,6 @@ struct pv_apic_ops pv_apic_ops = {
402#endif 402#endif
403 403
404struct pv_mmu_ops pv_mmu_ops = { 404struct pv_mmu_ops pv_mmu_ops = {
405#ifndef CONFIG_X86_64
406 .pagetable_setup_start = native_pagetable_setup_start,
407 .pagetable_setup_done = native_pagetable_setup_done,
408#else
409 .pagetable_setup_start = paravirt_nop,
410 .pagetable_setup_done = paravirt_nop,
411#endif
412 405
413 .read_cr2 = native_read_cr2, 406 .read_cr2 = native_read_cr2,
414 .write_cr2 = native_write_cr2, 407 .write_cr2 = native_write_cr2,
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index bc5f0e561cfd..4952d63dd67a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -959,9 +959,9 @@ void __init setup_arch(char **cmdline_p)
959 kvmclock_init(); 959 kvmclock_init();
960#endif 960#endif
961 961
962 paravirt_pagetable_setup_start(swapper_pg_dir); 962 x86_init.paging.pagetable_setup_start(swapper_pg_dir);
963 paging_init(); 963 paging_init();
964 paravirt_pagetable_setup_done(swapper_pg_dir); 964 x86_init.paging.pagetable_setup_done(swapper_pg_dir);
965 paravirt_post_allocator_init(); 965 paravirt_post_allocator_init();
966 966
967#ifdef CONFIG_X86_64 967#ifdef CONFIG_X86_64
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 08fea49d59a2..7df020e6740d 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -14,6 +14,7 @@
14 14
15void __cpuinit x86_init_noop(void) { } 15void __cpuinit x86_init_noop(void) { }
16void __init x86_init_uint_noop(unsigned int unused) { } 16void __init x86_init_uint_noop(unsigned int unused) { }
17void __init x86_init_pgd_noop(pgd_t *unused) { }
17 18
18/* 19/*
19 * The platform setup functions are preset with the default functions 20 * The platform setup functions are preset with the default functions
@@ -48,4 +49,9 @@ struct __initdata x86_init_ops x86_init = {
48 .arch_setup = x86_init_noop, 49 .arch_setup = x86_init_noop,
49 .banner = default_banner, 50 .banner = default_banner,
50 }, 51 },
52
53 .paging = {
54 .pagetable_setup_start = native_pagetable_setup_start,
55 .pagetable_setup_done = native_pagetable_setup_done,
56 },
51}; 57};
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 46e23cde143a..12ea09ec39b5 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -977,7 +977,6 @@ asmlinkage void __init xen_start_kernel(void)
977 pv_time_ops = xen_time_ops; 977 pv_time_ops = xen_time_ops;
978 pv_cpu_ops = xen_cpu_ops; 978 pv_cpu_ops = xen_cpu_ops;
979 pv_apic_ops = xen_apic_ops; 979 pv_apic_ops = xen_apic_ops;
980 pv_mmu_ops = xen_mmu_ops;
981 980
982 x86_init.resources.memory_setup = xen_memory_setup; 981 x86_init.resources.memory_setup = xen_memory_setup;
983 x86_init.oem.arch_setup = xen_arch_setup; 982 x86_init.oem.arch_setup = xen_arch_setup;
@@ -991,6 +990,7 @@ asmlinkage void __init xen_start_kernel(void)
991 load_percpu_segment(0); 990 load_percpu_segment(0);
992#endif 991#endif
993 992
993 xen_init_mmu_ops();
994 xen_init_irq_ops(); 994 xen_init_irq_ops();
995 xen_init_cpuid_mask(); 995 xen_init_cpuid_mask();
996 996
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 4ceb28581652..dbec51da930e 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1875,10 +1875,7 @@ static void xen_leave_lazy_mmu(void)
1875 preempt_enable(); 1875 preempt_enable();
1876} 1876}
1877 1877
1878const struct pv_mmu_ops xen_mmu_ops __initdata = { 1878static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1879 .pagetable_setup_start = xen_pagetable_setup_start,
1880 .pagetable_setup_done = xen_pagetable_setup_done,
1881
1882 .read_cr2 = xen_read_cr2, 1879 .read_cr2 = xen_read_cr2,
1883 .write_cr2 = xen_write_cr2, 1880 .write_cr2 = xen_write_cr2,
1884 1881
@@ -1954,6 +1951,12 @@ const struct pv_mmu_ops xen_mmu_ops __initdata = {
1954 .set_fixmap = xen_set_fixmap, 1951 .set_fixmap = xen_set_fixmap,
1955}; 1952};
1956 1953
1954void __init xen_init_mmu_ops(void)
1955{
1956 x86_init.paging.pagetable_setup_start = xen_pagetable_setup_start;
1957 x86_init.paging.pagetable_setup_done = xen_pagetable_setup_done;
1958 pv_mmu_ops = xen_mmu_ops;
1959}
1957 1960
1958#ifdef CONFIG_XEN_DEBUG_FS 1961#ifdef CONFIG_XEN_DEBUG_FS
1959 1962
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index da7302624897..5fe6bc7f5ecf 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -59,5 +59,5 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
59 59
60unsigned long xen_read_cr2_direct(void); 60unsigned long xen_read_cr2_direct(void);
61 61
62extern const struct pv_mmu_ops xen_mmu_ops; 62extern void xen_init_mmu_ops(void);
63#endif /* _XEN_MMU_H */ 63#endif /* _XEN_MMU_H */