diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-05 11:05:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-05 11:05:29 -0400 |
commit | a0abcf2e8f8017051830f738ac1bf5ef42703243 (patch) | |
tree | ef6ff14b5eb9cf14cd135c0f0f09fa0944192ef0 /arch/x86/kernel/cpu/common.c | |
parent | 2071b3e34fd33e496ebd7b90331ac5b3b0ac3b81 (diff) | |
parent | c191920f737a09a7252088f018f6747f0d2f484d (diff) |
Merge branch 'x86/vdso' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next
Pull x86 cdso updates from Peter Anvin:
"Vdso cleanups and improvements largely from Andy Lutomirski. This
makes the vdso a lot less ''special''"
* 'x86/vdso' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/vdso, build: Make LE access macros clearer, host-safe
x86/vdso, build: Fix cross-compilation from big-endian architectures
x86/vdso, build: When vdso2c fails, unlink the output
x86, vdso: Fix an OOPS accessing the HPET mapping w/o an HPET
x86, mm: Replace arch_vma_name with vm_ops->name for vsyscalls
x86, mm: Improve _install_special_mapping and fix x86 vdso naming
mm, fs: Add vm_ops->name as an alternative to arch_vma_name
x86, vdso: Fix an OOPS accessing the HPET mapping w/o an HPET
x86, vdso: Remove vestiges of VDSO_PRELINK and some outdated comments
x86, vdso: Move the vvar and hpet mappings next to the 64-bit vDSO
x86, vdso: Move the 32-bit vdso special pages after the text
x86, vdso: Reimplement vdso.so preparation in build-time C
x86, vdso: Move syscall and sysenter setup into kernel/cpu/common.c
x86, vdso: Clean up 32-bit vs 64-bit vdso params
x86, mm: Ensure correct alignment of the fixmap
Diffstat (limited to 'arch/x86/kernel/cpu/common.c')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index a135239badb7..2cbbf88d8f2c 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
21 | #include <asm/debugreg.h> | 21 | #include <asm/debugreg.h> |
22 | #include <asm/sections.h> | 22 | #include <asm/sections.h> |
23 | #include <asm/vsyscall.h> | ||
23 | #include <linux/topology.h> | 24 | #include <linux/topology.h> |
24 | #include <linux/cpumask.h> | 25 | #include <linux/cpumask.h> |
25 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
@@ -953,6 +954,38 @@ static void vgetcpu_set_mode(void) | |||
953 | else | 954 | else |
954 | vgetcpu_mode = VGETCPU_LSL; | 955 | vgetcpu_mode = VGETCPU_LSL; |
955 | } | 956 | } |
957 | |||
958 | /* May not be __init: called during resume */ | ||
959 | static void syscall32_cpu_init(void) | ||
960 | { | ||
961 | /* Load these always in case some future AMD CPU supports | ||
962 | SYSENTER from compat mode too. */ | ||
963 | wrmsrl_safe(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS); | ||
964 | wrmsrl_safe(MSR_IA32_SYSENTER_ESP, 0ULL); | ||
965 | wrmsrl_safe(MSR_IA32_SYSENTER_EIP, (u64)ia32_sysenter_target); | ||
966 | |||
967 | wrmsrl(MSR_CSTAR, ia32_cstar_target); | ||
968 | } | ||
969 | #endif | ||
970 | |||
971 | #ifdef CONFIG_X86_32 | ||
972 | void enable_sep_cpu(void) | ||
973 | { | ||
974 | int cpu = get_cpu(); | ||
975 | struct tss_struct *tss = &per_cpu(init_tss, cpu); | ||
976 | |||
977 | if (!boot_cpu_has(X86_FEATURE_SEP)) { | ||
978 | put_cpu(); | ||
979 | return; | ||
980 | } | ||
981 | |||
982 | tss->x86_tss.ss1 = __KERNEL_CS; | ||
983 | tss->x86_tss.sp1 = sizeof(struct tss_struct) + (unsigned long) tss; | ||
984 | wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); | ||
985 | wrmsr(MSR_IA32_SYSENTER_ESP, tss->x86_tss.sp1, 0); | ||
986 | wrmsr(MSR_IA32_SYSENTER_EIP, (unsigned long) ia32_sysenter_target, 0); | ||
987 | put_cpu(); | ||
988 | } | ||
956 | #endif | 989 | #endif |
957 | 990 | ||
958 | void __init identify_boot_cpu(void) | 991 | void __init identify_boot_cpu(void) |