Commit 613e396b authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

init: Invoke init_espfix_bsp() from mm_init()

init_espfix_bsp() needs to be invoked before the page table isolation
initialization. Move it into mm_init() which is the place where pti_init()
will be added.

While at it get rid of the #ifdeffery and provide proper stub functions.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 92a0f81d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#ifndef _ASM_X86_ESPFIX_H #ifndef _ASM_X86_ESPFIX_H
#define _ASM_X86_ESPFIX_H #define _ASM_X86_ESPFIX_H
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_ESPFIX64
#include <asm/percpu.h> #include <asm/percpu.h>
...@@ -11,7 +11,8 @@ DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr); ...@@ -11,7 +11,8 @@ DECLARE_PER_CPU_READ_MOSTLY(unsigned long, espfix_waddr);
extern void init_espfix_bsp(void); extern void init_espfix_bsp(void);
extern void init_espfix_ap(int cpu); extern void init_espfix_ap(int cpu);
#else
#endif /* CONFIG_X86_64 */ static inline void init_espfix_ap(int cpu) { }
#endif
#endif /* _ASM_X86_ESPFIX_H */ #endif /* _ASM_X86_ESPFIX_H */
...@@ -990,12 +990,8 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle, ...@@ -990,12 +990,8 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle,
initial_code = (unsigned long)start_secondary; initial_code = (unsigned long)start_secondary;
initial_stack = idle->thread.sp; initial_stack = idle->thread.sp;
/* /* Enable the espfix hack for this CPU */
* Enable the espfix hack for this CPU
*/
#ifdef CONFIG_X86_ESPFIX64
init_espfix_ap(cpu); init_espfix_ap(cpu);
#endif
/* So we see what's up */ /* So we see what's up */
announce_cpu(cpu, apicid); announce_cpu(cpu, apicid);
......
...@@ -1017,6 +1017,11 @@ static inline int pmd_clear_huge(pmd_t *pmd) ...@@ -1017,6 +1017,11 @@ static inline int pmd_clear_huge(pmd_t *pmd)
struct file; struct file;
int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t *vma_prot); unsigned long size, pgprot_t *vma_prot);
#ifndef CONFIG_X86_ESPFIX64
static inline void init_espfix_bsp(void) { }
#endif
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#ifndef io_remap_pfn_range #ifndef io_remap_pfn_range
......
...@@ -504,6 +504,8 @@ static void __init mm_init(void) ...@@ -504,6 +504,8 @@ static void __init mm_init(void)
pgtable_init(); pgtable_init();
vmalloc_init(); vmalloc_init();
ioremap_huge_init(); ioremap_huge_init();
/* Should be run before the first non-init thread is created */
init_espfix_bsp();
} }
asmlinkage __visible void __init start_kernel(void) asmlinkage __visible void __init start_kernel(void)
...@@ -673,10 +675,6 @@ asmlinkage __visible void __init start_kernel(void) ...@@ -673,10 +675,6 @@ asmlinkage __visible void __init start_kernel(void)
#ifdef CONFIG_X86 #ifdef CONFIG_X86
if (efi_enabled(EFI_RUNTIME_SERVICES)) if (efi_enabled(EFI_RUNTIME_SERVICES))
efi_enter_virtual_mode(); efi_enter_virtual_mode();
#endif
#ifdef CONFIG_X86_ESPFIX64
/* Should be run before the first non-init thread is created */
init_espfix_bsp();
#endif #endif
thread_stack_cache_init(); thread_stack_cache_init();
cred_init(); cred_init();
......
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