diff options
Diffstat (limited to 'arch/x86')
| -rw-r--r-- | arch/x86/ia32/ia32_aout.c | 22 | ||||
| -rw-r--r-- | arch/x86/include/asm/kvm_host.h | 24 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_amd.c | 9 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/mcheck/therm_throt.c | 3 | ||||
| -rw-r--r-- | arch/x86/kvm/svm.c | 17 | ||||
| -rw-r--r-- | arch/x86/kvm/vmx.c | 24 | ||||
| -rw-r--r-- | arch/x86/mm/srat_64.c | 8 |
7 files changed, 35 insertions, 72 deletions
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index 0350311906ae..2d93bdbc9ac0 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | #include <asm/ia32.h> | 34 | #include <asm/ia32.h> |
| 35 | 35 | ||
| 36 | #undef WARN_OLD | 36 | #undef WARN_OLD |
| 37 | #undef CORE_DUMP /* probably broken */ | 37 | #undef CORE_DUMP /* definitely broken */ |
| 38 | 38 | ||
| 39 | static int load_aout_binary(struct linux_binprm *, struct pt_regs *regs); | 39 | static int load_aout_binary(struct linux_binprm *, struct pt_regs *regs); |
| 40 | static int load_aout_library(struct file *); | 40 | static int load_aout_library(struct file *); |
| @@ -131,21 +131,15 @@ static void set_brk(unsigned long start, unsigned long end) | |||
| 131 | * macros to write out all the necessary info. | 131 | * macros to write out all the necessary info. |
| 132 | */ | 132 | */ |
| 133 | 133 | ||
| 134 | static int dump_write(struct file *file, const void *addr, int nr) | 134 | #include <linux/coredump.h> |
| 135 | { | ||
| 136 | return file->f_op->write(file, addr, nr, &file->f_pos) == nr; | ||
| 137 | } | ||
| 138 | 135 | ||
| 139 | #define DUMP_WRITE(addr, nr) \ | 136 | #define DUMP_WRITE(addr, nr) \ |
| 140 | if (!dump_write(file, (void *)(addr), (nr))) \ | 137 | if (!dump_write(file, (void *)(addr), (nr))) \ |
| 141 | goto end_coredump; | 138 | goto end_coredump; |
| 142 | 139 | ||
| 143 | #define DUMP_SEEK(offset) \ | 140 | #define DUMP_SEEK(offset) \ |
| 144 | if (file->f_op->llseek) { \ | 141 | if (!dump_seek(file, offset)) \ |
| 145 | if (file->f_op->llseek(file, (offset), 0) != (offset)) \ | 142 | goto end_coredump; |
| 146 | goto end_coredump; \ | ||
| 147 | } else \ | ||
| 148 | file->f_pos = (offset) | ||
| 149 | 143 | ||
| 150 | #define START_DATA() (u.u_tsize << PAGE_SHIFT) | 144 | #define START_DATA() (u.u_tsize << PAGE_SHIFT) |
| 151 | #define START_STACK(u) (u.start_stack) | 145 | #define START_STACK(u) (u.start_stack) |
| @@ -217,12 +211,6 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, | |||
| 217 | dump_size = dump.u_ssize << PAGE_SHIFT; | 211 | dump_size = dump.u_ssize << PAGE_SHIFT; |
| 218 | DUMP_WRITE(dump_start, dump_size); | 212 | DUMP_WRITE(dump_start, dump_size); |
| 219 | } | 213 | } |
| 220 | /* | ||
| 221 | * Finally dump the task struct. Not be used by gdb, but | ||
| 222 | * could be useful | ||
| 223 | */ | ||
| 224 | set_fs(KERNEL_DS); | ||
| 225 | DUMP_WRITE(current, sizeof(*current)); | ||
| 226 | end_coredump: | 214 | end_coredump: |
| 227 | set_fs(fs); | 215 | set_fs(fs); |
| 228 | return has_dumped; | 216 | return has_dumped; |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 502e53f999cf..c52e2eb40a1e 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
| @@ -652,20 +652,6 @@ static inline struct kvm_mmu_page *page_header(hpa_t shadow_page) | |||
| 652 | return (struct kvm_mmu_page *)page_private(page); | 652 | return (struct kvm_mmu_page *)page_private(page); |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | static inline u16 kvm_read_fs(void) | ||
| 656 | { | ||
| 657 | u16 seg; | ||
| 658 | asm("mov %%fs, %0" : "=g"(seg)); | ||
| 659 | return seg; | ||
| 660 | } | ||
| 661 | |||
| 662 | static inline u16 kvm_read_gs(void) | ||
| 663 | { | ||
| 664 | u16 seg; | ||
| 665 | asm("mov %%gs, %0" : "=g"(seg)); | ||
| 666 | return seg; | ||
| 667 | } | ||
| 668 | |||
| 669 | static inline u16 kvm_read_ldt(void) | 655 | static inline u16 kvm_read_ldt(void) |
| 670 | { | 656 | { |
| 671 | u16 ldt; | 657 | u16 ldt; |
| @@ -673,16 +659,6 @@ static inline u16 kvm_read_ldt(void) | |||
| 673 | return ldt; | 659 | return ldt; |
| 674 | } | 660 | } |
| 675 | 661 | ||
| 676 | static inline void kvm_load_fs(u16 sel) | ||
| 677 | { | ||
| 678 | asm("mov %0, %%fs" : : "rm"(sel)); | ||
| 679 | } | ||
| 680 | |||
| 681 | static inline void kvm_load_gs(u16 sel) | ||
| 682 | { | ||
| 683 | asm("mov %0, %%gs" : : "rm"(sel)); | ||
| 684 | } | ||
| 685 | |||
| 686 | static inline void kvm_load_ldt(u16 sel) | 662 | static inline void kvm_load_ldt(u16 sel) |
| 687 | { | 663 | { |
| 688 | asm("lldt %0" : : "rm"(sel)); | 664 | asm("lldt %0" : : "rm"(sel)); |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index 5e975298fa81..39aaee5c1ab2 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c | |||
| @@ -141,6 +141,7 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) | |||
| 141 | address = (low & MASK_BLKPTR_LO) >> 21; | 141 | address = (low & MASK_BLKPTR_LO) >> 21; |
| 142 | if (!address) | 142 | if (!address) |
| 143 | break; | 143 | break; |
| 144 | |||
| 144 | address += MCG_XBLK_ADDR; | 145 | address += MCG_XBLK_ADDR; |
| 145 | } else | 146 | } else |
| 146 | ++address; | 147 | ++address; |
| @@ -148,12 +149,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c) | |||
| 148 | if (rdmsr_safe(address, &low, &high)) | 149 | if (rdmsr_safe(address, &low, &high)) |
| 149 | break; | 150 | break; |
| 150 | 151 | ||
| 151 | if (!(high & MASK_VALID_HI)) { | 152 | if (!(high & MASK_VALID_HI)) |
| 152 | if (block) | 153 | continue; |
| 153 | continue; | ||
| 154 | else | ||
| 155 | break; | ||
| 156 | } | ||
| 157 | 154 | ||
| 158 | if (!(high & MASK_CNTP_HI) || | 155 | if (!(high & MASK_CNTP_HI) || |
| 159 | (high & MASK_LOCKED_HI)) | 156 | (high & MASK_LOCKED_HI)) |
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index d9368eeda309..169d8804a9f8 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
| @@ -216,7 +216,7 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, | |||
| 216 | err = sysfs_add_file_to_group(&sys_dev->kobj, | 216 | err = sysfs_add_file_to_group(&sys_dev->kobj, |
| 217 | &attr_core_power_limit_count.attr, | 217 | &attr_core_power_limit_count.attr, |
| 218 | thermal_attr_group.name); | 218 | thermal_attr_group.name); |
| 219 | if (cpu_has(c, X86_FEATURE_PTS)) | 219 | if (cpu_has(c, X86_FEATURE_PTS)) { |
| 220 | err = sysfs_add_file_to_group(&sys_dev->kobj, | 220 | err = sysfs_add_file_to_group(&sys_dev->kobj, |
| 221 | &attr_package_throttle_count.attr, | 221 | &attr_package_throttle_count.attr, |
| 222 | thermal_attr_group.name); | 222 | thermal_attr_group.name); |
| @@ -224,6 +224,7 @@ static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, | |||
| 224 | err = sysfs_add_file_to_group(&sys_dev->kobj, | 224 | err = sysfs_add_file_to_group(&sys_dev->kobj, |
| 225 | &attr_package_power_limit_count.attr, | 225 | &attr_package_power_limit_count.attr, |
| 226 | thermal_attr_group.name); | 226 | thermal_attr_group.name); |
| 227 | } | ||
| 227 | 228 | ||
| 228 | return err; | 229 | return err; |
| 229 | } | 230 | } |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index bc5b9b8d4a33..8a3f9f64f86f 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -766,7 +766,6 @@ static void init_vmcb(struct vcpu_svm *svm) | |||
| 766 | 766 | ||
| 767 | control->iopm_base_pa = iopm_base; | 767 | control->iopm_base_pa = iopm_base; |
| 768 | control->msrpm_base_pa = __pa(svm->msrpm); | 768 | control->msrpm_base_pa = __pa(svm->msrpm); |
| 769 | control->tsc_offset = 0; | ||
| 770 | control->int_ctl = V_INTR_MASKING_MASK; | 769 | control->int_ctl = V_INTR_MASKING_MASK; |
| 771 | 770 | ||
| 772 | init_seg(&save->es); | 771 | init_seg(&save->es); |
| @@ -902,6 +901,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) | |||
| 902 | svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; | 901 | svm->vmcb_pa = page_to_pfn(page) << PAGE_SHIFT; |
| 903 | svm->asid_generation = 0; | 902 | svm->asid_generation = 0; |
| 904 | init_vmcb(svm); | 903 | init_vmcb(svm); |
| 904 | svm->vmcb->control.tsc_offset = 0-native_read_tsc(); | ||
| 905 | 905 | ||
| 906 | err = fx_init(&svm->vcpu); | 906 | err = fx_init(&svm->vcpu); |
| 907 | if (err) | 907 | if (err) |
| @@ -3163,8 +3163,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
| 3163 | sync_lapic_to_cr8(vcpu); | 3163 | sync_lapic_to_cr8(vcpu); |
| 3164 | 3164 | ||
| 3165 | save_host_msrs(vcpu); | 3165 | save_host_msrs(vcpu); |
| 3166 | fs_selector = kvm_read_fs(); | 3166 | savesegment(fs, fs_selector); |
| 3167 | gs_selector = kvm_read_gs(); | 3167 | savesegment(gs, gs_selector); |
| 3168 | ldt_selector = kvm_read_ldt(); | 3168 | ldt_selector = kvm_read_ldt(); |
| 3169 | svm->vmcb->save.cr2 = vcpu->arch.cr2; | 3169 | svm->vmcb->save.cr2 = vcpu->arch.cr2; |
| 3170 | /* required for live migration with NPT */ | 3170 | /* required for live migration with NPT */ |
| @@ -3251,10 +3251,15 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) | |||
| 3251 | vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp; | 3251 | vcpu->arch.regs[VCPU_REGS_RSP] = svm->vmcb->save.rsp; |
| 3252 | vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; | 3252 | vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; |
| 3253 | 3253 | ||
| 3254 | kvm_load_fs(fs_selector); | ||
| 3255 | kvm_load_gs(gs_selector); | ||
| 3256 | kvm_load_ldt(ldt_selector); | ||
| 3257 | load_host_msrs(vcpu); | 3254 | load_host_msrs(vcpu); |
| 3255 | loadsegment(fs, fs_selector); | ||
| 3256 | #ifdef CONFIG_X86_64 | ||
| 3257 | load_gs_index(gs_selector); | ||
| 3258 | wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); | ||
| 3259 | #else | ||
| 3260 | loadsegment(gs, gs_selector); | ||
| 3261 | #endif | ||
| 3262 | kvm_load_ldt(ldt_selector); | ||
| 3258 | 3263 | ||
| 3259 | reload_tss(vcpu); | 3264 | reload_tss(vcpu); |
| 3260 | 3265 | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 49b25eee25ac..7bddfab12013 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -803,7 +803,7 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) | |||
| 803 | */ | 803 | */ |
| 804 | vmx->host_state.ldt_sel = kvm_read_ldt(); | 804 | vmx->host_state.ldt_sel = kvm_read_ldt(); |
| 805 | vmx->host_state.gs_ldt_reload_needed = vmx->host_state.ldt_sel; | 805 | vmx->host_state.gs_ldt_reload_needed = vmx->host_state.ldt_sel; |
| 806 | vmx->host_state.fs_sel = kvm_read_fs(); | 806 | savesegment(fs, vmx->host_state.fs_sel); |
| 807 | if (!(vmx->host_state.fs_sel & 7)) { | 807 | if (!(vmx->host_state.fs_sel & 7)) { |
| 808 | vmcs_write16(HOST_FS_SELECTOR, vmx->host_state.fs_sel); | 808 | vmcs_write16(HOST_FS_SELECTOR, vmx->host_state.fs_sel); |
| 809 | vmx->host_state.fs_reload_needed = 0; | 809 | vmx->host_state.fs_reload_needed = 0; |
| @@ -811,7 +811,7 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) | |||
| 811 | vmcs_write16(HOST_FS_SELECTOR, 0); | 811 | vmcs_write16(HOST_FS_SELECTOR, 0); |
| 812 | vmx->host_state.fs_reload_needed = 1; | 812 | vmx->host_state.fs_reload_needed = 1; |
| 813 | } | 813 | } |
| 814 | vmx->host_state.gs_sel = kvm_read_gs(); | 814 | savesegment(gs, vmx->host_state.gs_sel); |
| 815 | if (!(vmx->host_state.gs_sel & 7)) | 815 | if (!(vmx->host_state.gs_sel & 7)) |
| 816 | vmcs_write16(HOST_GS_SELECTOR, vmx->host_state.gs_sel); | 816 | vmcs_write16(HOST_GS_SELECTOR, vmx->host_state.gs_sel); |
| 817 | else { | 817 | else { |
| @@ -841,27 +841,21 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) | |||
| 841 | 841 | ||
| 842 | static void __vmx_load_host_state(struct vcpu_vmx *vmx) | 842 | static void __vmx_load_host_state(struct vcpu_vmx *vmx) |
| 843 | { | 843 | { |
| 844 | unsigned long flags; | ||
| 845 | |||
| 846 | if (!vmx->host_state.loaded) | 844 | if (!vmx->host_state.loaded) |
| 847 | return; | 845 | return; |
| 848 | 846 | ||
| 849 | ++vmx->vcpu.stat.host_state_reload; | 847 | ++vmx->vcpu.stat.host_state_reload; |
| 850 | vmx->host_state.loaded = 0; | 848 | vmx->host_state.loaded = 0; |
| 851 | if (vmx->host_state.fs_reload_needed) | 849 | if (vmx->host_state.fs_reload_needed) |
| 852 | kvm_load_fs(vmx->host_state.fs_sel); | 850 | loadsegment(fs, vmx->host_state.fs_sel); |
| 853 | if (vmx->host_state.gs_ldt_reload_needed) { | 851 | if (vmx->host_state.gs_ldt_reload_needed) { |
| 854 | kvm_load_ldt(vmx->host_state.ldt_sel); | 852 | kvm_load_ldt(vmx->host_state.ldt_sel); |
| 855 | /* | ||
| 856 | * If we have to reload gs, we must take care to | ||
| 857 | * preserve our gs base. | ||
| 858 | */ | ||
| 859 | local_irq_save(flags); | ||
| 860 | kvm_load_gs(vmx->host_state.gs_sel); | ||
| 861 | #ifdef CONFIG_X86_64 | 853 | #ifdef CONFIG_X86_64 |
| 862 | wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE)); | 854 | load_gs_index(vmx->host_state.gs_sel); |
| 855 | wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); | ||
| 856 | #else | ||
| 857 | loadsegment(gs, vmx->host_state.gs_sel); | ||
| 863 | #endif | 858 | #endif |
| 864 | local_irq_restore(flags); | ||
| 865 | } | 859 | } |
| 866 | reload_tss(); | 860 | reload_tss(); |
| 867 | #ifdef CONFIG_X86_64 | 861 | #ifdef CONFIG_X86_64 |
| @@ -2589,8 +2583,8 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx) | |||
| 2589 | vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */ | 2583 | vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */ |
| 2590 | vmcs_write16(HOST_DS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ | 2584 | vmcs_write16(HOST_DS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ |
| 2591 | vmcs_write16(HOST_ES_SELECTOR, __KERNEL_DS); /* 22.2.4 */ | 2585 | vmcs_write16(HOST_ES_SELECTOR, __KERNEL_DS); /* 22.2.4 */ |
| 2592 | vmcs_write16(HOST_FS_SELECTOR, kvm_read_fs()); /* 22.2.4 */ | 2586 | vmcs_write16(HOST_FS_SELECTOR, 0); /* 22.2.4 */ |
| 2593 | vmcs_write16(HOST_GS_SELECTOR, kvm_read_gs()); /* 22.2.4 */ | 2587 | vmcs_write16(HOST_GS_SELECTOR, 0); /* 22.2.4 */ |
| 2594 | vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ | 2588 | vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ |
| 2595 | #ifdef CONFIG_X86_64 | 2589 | #ifdef CONFIG_X86_64 |
| 2596 | rdmsrl(MSR_FS_BASE, a); | 2590 | rdmsrl(MSR_FS_BASE, a); |
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c index f9897f7a9ef1..9c0d0d399c30 100644 --- a/arch/x86/mm/srat_64.c +++ b/arch/x86/mm/srat_64.c | |||
| @@ -420,9 +420,11 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
| 420 | return -1; | 420 | return -1; |
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | for_each_node_mask(i, nodes_parsed) | 423 | for (i = 0; i < num_node_memblks; i++) |
| 424 | e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, | 424 | e820_register_active_regions(memblk_nodeid[i], |
| 425 | nodes[i].end >> PAGE_SHIFT); | 425 | node_memblk_range[i].start >> PAGE_SHIFT, |
| 426 | node_memblk_range[i].end >> PAGE_SHIFT); | ||
| 427 | |||
| 426 | /* for out of order entries in SRAT */ | 428 | /* for out of order entries in SRAT */ |
| 427 | sort_node_map(); | 429 | sort_node_map(); |
| 428 | if (!nodes_cover_memory(nodes)) { | 430 | if (!nodes_cover_memory(nodes)) { |
