Commit 030cb6c0 authored by Thomas Gleixner's avatar Thomas Gleixner

x86: Move paravirt pagetable_setup to x86_init_ops

Replace more paravirt hackery by proper x86_init_ops.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 6f30c1ac
...@@ -351,16 +351,6 @@ static inline void paravirt_post_allocator_init(void) ...@@ -351,16 +351,6 @@ static inline void paravirt_post_allocator_init(void)
(*pv_init_ops.post_allocator_init)(); (*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 #ifdef CONFIG_SMP
static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip, static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
unsigned long start_esp) unsigned long start_esp)
......
...@@ -231,15 +231,6 @@ struct pv_apic_ops { ...@@ -231,15 +231,6 @@ struct pv_apic_ops {
}; };
struct pv_mmu_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); unsigned long (*read_cr2)(void);
void (*write_cr2)(unsigned long); void (*write_cr2)(unsigned long);
......
...@@ -56,16 +56,6 @@ extern struct list_head pgd_list; ...@@ -56,16 +56,6 @@ extern struct list_head pgd_list;
#define pte_update(mm, addr, ptep) do { } while (0) #define pte_update(mm, addr, ptep) do { } while (0)
#define pte_update_defer(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_val(x) native_pgd_val(x)
#define __pgd(x) native_make_pgd(x) #define __pgd(x) native_make_pgd(x)
......
...@@ -299,8 +299,8 @@ void set_pte_vaddr(unsigned long vaddr, pte_t pte); ...@@ -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_start(pgd_t *base);
extern void native_pagetable_setup_done(pgd_t *base); extern void native_pagetable_setup_done(pgd_t *base);
#else #else
static inline void native_pagetable_setup_start(pgd_t *base) {} #define native_pagetable_setup_start x86_init_pgd_noop
static inline void native_pagetable_setup_done(pgd_t *base) {} #define native_pagetable_setup_done x86_init_pgd_noop
#endif #endif
struct seq_file; struct seq_file;
......
#ifndef _ASM_X86_PLATFORM_H #ifndef _ASM_X86_PLATFORM_H
#define _ASM_X86_PLATFORM_H #define _ASM_X86_PLATFORM_H
#include <asm/pgtable_types.h>
struct mpc_bus; struct mpc_bus;
struct mpc_cpu; struct mpc_cpu;
struct mpc_table; struct mpc_table;
...@@ -66,6 +68,16 @@ struct x86_init_oem { ...@@ -66,6 +68,16 @@ struct x86_init_oem {
void (*banner)(void); 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 * struct x86_init_ops - functions for platform specific setup
* *
...@@ -75,6 +87,7 @@ struct x86_init_ops { ...@@ -75,6 +87,7 @@ struct x86_init_ops {
struct x86_init_mpparse mpparse; struct x86_init_mpparse mpparse;
struct x86_init_irqs irqs; struct x86_init_irqs irqs;
struct x86_init_oem oem; struct x86_init_oem oem;
struct x86_init_paging paging;
}; };
extern struct x86_init_ops x86_init; extern struct x86_init_ops x86_init;
......
...@@ -402,13 +402,6 @@ struct pv_apic_ops pv_apic_ops = { ...@@ -402,13 +402,6 @@ struct pv_apic_ops pv_apic_ops = {
#endif #endif
struct pv_mmu_ops pv_mmu_ops = { 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, .read_cr2 = native_read_cr2,
.write_cr2 = native_write_cr2, .write_cr2 = native_write_cr2,
......
...@@ -959,9 +959,9 @@ void __init setup_arch(char **cmdline_p) ...@@ -959,9 +959,9 @@ void __init setup_arch(char **cmdline_p)
kvmclock_init(); kvmclock_init();
#endif #endif
paravirt_pagetable_setup_start(swapper_pg_dir); x86_init.paging.pagetable_setup_start(swapper_pg_dir);
paging_init(); paging_init();
paravirt_pagetable_setup_done(swapper_pg_dir); x86_init.paging.pagetable_setup_done(swapper_pg_dir);
paravirt_post_allocator_init(); paravirt_post_allocator_init();
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
void __cpuinit x86_init_noop(void) { } void __cpuinit x86_init_noop(void) { }
void __init x86_init_uint_noop(unsigned int unused) { } 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 * The platform setup functions are preset with the default functions
...@@ -48,4 +49,9 @@ struct __initdata x86_init_ops x86_init = { ...@@ -48,4 +49,9 @@ struct __initdata x86_init_ops x86_init = {
.arch_setup = x86_init_noop, .arch_setup = x86_init_noop,
.banner = default_banner, .banner = default_banner,
}, },
.paging = {
.pagetable_setup_start = native_pagetable_setup_start,
.pagetable_setup_done = native_pagetable_setup_done,
},
}; };
...@@ -977,7 +977,6 @@ asmlinkage void __init xen_start_kernel(void) ...@@ -977,7 +977,6 @@ asmlinkage void __init xen_start_kernel(void)
pv_time_ops = xen_time_ops; pv_time_ops = xen_time_ops;
pv_cpu_ops = xen_cpu_ops; pv_cpu_ops = xen_cpu_ops;
pv_apic_ops = xen_apic_ops; pv_apic_ops = xen_apic_ops;
pv_mmu_ops = xen_mmu_ops;
x86_init.resources.memory_setup = xen_memory_setup; x86_init.resources.memory_setup = xen_memory_setup;
x86_init.oem.arch_setup = xen_arch_setup; x86_init.oem.arch_setup = xen_arch_setup;
...@@ -991,6 +990,7 @@ asmlinkage void __init xen_start_kernel(void) ...@@ -991,6 +990,7 @@ asmlinkage void __init xen_start_kernel(void)
load_percpu_segment(0); load_percpu_segment(0);
#endif #endif
xen_init_mmu_ops();
xen_init_irq_ops(); xen_init_irq_ops();
xen_init_cpuid_mask(); xen_init_cpuid_mask();
......
...@@ -1875,10 +1875,7 @@ static void xen_leave_lazy_mmu(void) ...@@ -1875,10 +1875,7 @@ static void xen_leave_lazy_mmu(void)
preempt_enable(); preempt_enable();
} }
const struct pv_mmu_ops xen_mmu_ops __initdata = { static const struct pv_mmu_ops xen_mmu_ops __initdata = {
.pagetable_setup_start = xen_pagetable_setup_start,
.pagetable_setup_done = xen_pagetable_setup_done,
.read_cr2 = xen_read_cr2, .read_cr2 = xen_read_cr2,
.write_cr2 = xen_write_cr2, .write_cr2 = xen_write_cr2,
...@@ -1954,6 +1951,12 @@ const struct pv_mmu_ops xen_mmu_ops __initdata = { ...@@ -1954,6 +1951,12 @@ const struct pv_mmu_ops xen_mmu_ops __initdata = {
.set_fixmap = xen_set_fixmap, .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 #ifdef CONFIG_XEN_DEBUG_FS
......
...@@ -59,5 +59,5 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr, ...@@ -59,5 +59,5 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
unsigned long xen_read_cr2_direct(void); 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 */ #endif /* _XEN_MMU_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment