x86: Move paravirt pagetable_setup to x86_init_ops
authorThomas Gleixner <tglx@linutronix.de>
Thu, 20 Aug 2009 12:30:02 +0000 (14:30 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 31 Aug 2009 07:35:45 +0000 (09:35 +0200)
Replace more paravirt hackery by proper x86_init_ops.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/paravirt_types.h
arch/x86/include/asm/pgtable.h
arch/x86/include/asm/pgtable_types.h
arch/x86/include/asm/x86_init.h
arch/x86/kernel/paravirt.c
arch/x86/kernel/setup.c
arch/x86/kernel/x86_init.c
arch/x86/xen/enlighten.c
arch/x86/xen/mmu.c
arch/x86/xen/mmu.h

index 3de6435a106ac8e2b0620ec64f08c5b338113b9b..1caf25b91e6b81f56a943dae7475f0b22ce2a76b 100644 (file)
@@ -351,16 +351,6 @@ static inline void paravirt_post_allocator_init(void)
                (*pv_init_ops.post_allocator_init)();
 }
 
-static inline void paravirt_pagetable_setup_start(pgd_t *base)
-{
-       (*pv_mmu_ops.pagetable_setup_start)(base);
-}
-
-static inline void paravirt_pagetable_setup_done(pgd_t *base)
-{
-       (*pv_mmu_ops.pagetable_setup_done)(base);
-}
-
 #ifdef CONFIG_SMP
 static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
                                    unsigned long start_esp)
index ce7723c81a1e989bd1eccd136b2fcd172db43066..4039eefd3ebc352a1920ce91e0c602e8f673833b 100644 (file)
@@ -231,15 +231,6 @@ struct pv_apic_ops {
 };
 
 struct pv_mmu_ops {
-       /*
-        * Called before/after init_mm pagetable setup. setup_start
-        * may reset %cr3, and may pre-install parts of the pagetable;
-        * pagetable setup is expected to preserve any existing
-        * mapping.
-        */
-       void (*pagetable_setup_start)(pgd_t *pgd_base);
-       void (*pagetable_setup_done)(pgd_t *pgd_base);
-
        unsigned long (*read_cr2)(void);
        void (*write_cr2)(unsigned long);
 
index 16748077559abf2771ce84ec0ea38eaa82dc8298..60d422adf706136a913399f0db7b67c05bc123dd 100644 (file)
@@ -56,16 +56,6 @@ extern struct list_head pgd_list;
 #define pte_update(mm, addr, ptep)              do { } while (0)
 #define pte_update_defer(mm, addr, ptep)        do { } while (0)
 
-static inline void __init paravirt_pagetable_setup_start(pgd_t *base)
-{
-       native_pagetable_setup_start(base);
-}
-
-static inline void __init paravirt_pagetable_setup_done(pgd_t *base)
-{
-       native_pagetable_setup_done(base);
-}
-
 #define pgd_val(x)     native_pgd_val(x)
 #define __pgd(x)       native_make_pgd(x)
 
index 54cb697f4900e03f1934f784196dc4d167bdd366..7b467bf3c68067218d1a79a40818018b9ed90134 100644 (file)
@@ -299,8 +299,8 @@ void set_pte_vaddr(unsigned long vaddr, pte_t pte);
 extern void native_pagetable_setup_start(pgd_t *base);
 extern void native_pagetable_setup_done(pgd_t *base);
 #else
-static inline void native_pagetable_setup_start(pgd_t *base) {}
-static inline void native_pagetable_setup_done(pgd_t *base) {}
+#define native_pagetable_setup_start x86_init_pgd_noop
+#define native_pagetable_setup_done  x86_init_pgd_noop
 #endif
 
 struct seq_file;
index ee7c59df7814affbc2d499c24fd908fbadc6d31a..b9bb4faefc488d4da294de0233ee9d1bd7e7355b 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _ASM_X86_PLATFORM_H
 #define _ASM_X86_PLATFORM_H
 
+#include <asm/pgtable_types.h>
+
 struct mpc_bus;
 struct mpc_cpu;
 struct mpc_table;
@@ -66,6 +68,16 @@ struct x86_init_oem {
        void (*banner)(void);
 };
 
+/**
+ * struct x86_init_paging - platform specific paging functions
+ * @pagetable_setup_start:     platform specific pre paging_init() call
+ * @pagetable_setup_done:      platform specific post paging_init() call
+ */
+struct x86_init_paging {
+       void (*pagetable_setup_start)(pgd_t *base);
+       void (*pagetable_setup_done)(pgd_t *base);
+};
+
 /**
  * struct x86_init_ops - functions for platform specific setup
  *
@@ -75,6 +87,7 @@ struct x86_init_ops {
        struct x86_init_mpparse         mpparse;
        struct x86_init_irqs            irqs;
        struct x86_init_oem             oem;
+       struct x86_init_paging          paging;
 };
 
 extern struct x86_init_ops x86_init;
index f7a5fb79d18aa9d3e86733797350b9379f263869..8167be0b68ca536d3c787c7ae2a74e9a703db4ab 100644 (file)
@@ -402,13 +402,6 @@ struct pv_apic_ops pv_apic_ops = {
 #endif
 
 struct pv_mmu_ops pv_mmu_ops = {
-#ifndef CONFIG_X86_64
-       .pagetable_setup_start = native_pagetable_setup_start,
-       .pagetable_setup_done = native_pagetable_setup_done,
-#else
-       .pagetable_setup_start = paravirt_nop,
-       .pagetable_setup_done = paravirt_nop,
-#endif
 
        .read_cr2 = native_read_cr2,
        .write_cr2 = native_write_cr2,
index bc5f0e561cfdf1c0a86c901a2c321cee859b691a..4952d63dd67a5a343fd4af91974ad2be2c712f8b 100644 (file)
@@ -959,9 +959,9 @@ void __init setup_arch(char **cmdline_p)
        kvmclock_init();
 #endif
 
-       paravirt_pagetable_setup_start(swapper_pg_dir);
+       x86_init.paging.pagetable_setup_start(swapper_pg_dir);
        paging_init();
-       paravirt_pagetable_setup_done(swapper_pg_dir);
+       x86_init.paging.pagetable_setup_done(swapper_pg_dir);
        paravirt_post_allocator_init();
 
 #ifdef CONFIG_X86_64
index 08fea49d59a2968566d0f97354456629fd01ed3b..7df020e6740df8c331fdc971b088fddb81cbe6bc 100644 (file)
@@ -14,6 +14,7 @@
 
 void __cpuinit x86_init_noop(void) { }
 void __init x86_init_uint_noop(unsigned int unused) { }
+void __init x86_init_pgd_noop(pgd_t *unused) { }
 
 /*
  * The platform setup functions are preset with the default functions
@@ -48,4 +49,9 @@ struct __initdata x86_init_ops x86_init = {
                .arch_setup             = x86_init_noop,
                .banner                 = default_banner,
        },
+
+       .paging = {
+               .pagetable_setup_start  = native_pagetable_setup_start,
+               .pagetable_setup_done   = native_pagetable_setup_done,
+       },
 };
index 46e23cde143a6515126bae9fc46f095f8e8b0117..12ea09ec39b561cca43dc730ede3cad02ec96d67 100644 (file)
@@ -977,7 +977,6 @@ asmlinkage void __init xen_start_kernel(void)
        pv_time_ops = xen_time_ops;
        pv_cpu_ops = xen_cpu_ops;
        pv_apic_ops = xen_apic_ops;
-       pv_mmu_ops = xen_mmu_ops;
 
        x86_init.resources.memory_setup = xen_memory_setup;
        x86_init.oem.arch_setup = xen_arch_setup;
@@ -991,6 +990,7 @@ asmlinkage void __init xen_start_kernel(void)
        load_percpu_segment(0);
 #endif
 
+       xen_init_mmu_ops();
        xen_init_irq_ops();
        xen_init_cpuid_mask();
 
index 4ceb28581652ef0ab7ff7bcc5426dd914954d100..dbec51da930e9ce507e8eef380997df6263523d8 100644 (file)
@@ -1875,10 +1875,7 @@ static void xen_leave_lazy_mmu(void)
        preempt_enable();
 }
 
-const struct pv_mmu_ops xen_mmu_ops __initdata = {
-       .pagetable_setup_start = xen_pagetable_setup_start,
-       .pagetable_setup_done = xen_pagetable_setup_done,
-
+static const struct pv_mmu_ops xen_mmu_ops __initdata = {
        .read_cr2 = xen_read_cr2,
        .write_cr2 = xen_write_cr2,
 
@@ -1954,6 +1951,12 @@ const struct pv_mmu_ops xen_mmu_ops __initdata = {
        .set_fixmap = xen_set_fixmap,
 };
 
+void __init xen_init_mmu_ops(void)
+{
+       x86_init.paging.pagetable_setup_start = xen_pagetable_setup_start;
+       x86_init.paging.pagetable_setup_done = xen_pagetable_setup_done;
+       pv_mmu_ops = xen_mmu_ops;
+}
 
 #ifdef CONFIG_XEN_DEBUG_FS
 
index da7302624897871bb4747ea4fdac50cfffba321e..5fe6bc7f5ecfe6626755183a88959818c3a3981f 100644 (file)
@@ -59,5 +59,5 @@ void  xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
 
 unsigned long xen_read_cr2_direct(void);
 
-extern const struct pv_mmu_ops xen_mmu_ops;
+extern void xen_init_mmu_ops(void);
 #endif /* _XEN_MMU_H */
This page took 0.030513 seconds and 5 git commands to generate.