diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-04-24 14:33:46 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-04-24 14:33:54 -0400 |
commit | 6402c7dc2a19c19bd8cdc7d80878b850da418942 (patch) | |
tree | cda2ea2df40442e2aa016119f3548cc504127ea8 /arch/x86 | |
parent | 77c675ba18836802f6b73d2d773481d06ebc0f04 (diff) | |
parent | 60d509fa6a9c4653a86ad830e4c4b30360b23f0e (diff) |
Merge branch 'linus' into timers/core
Reason: Get upstream fixes before adding conflicting code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
32 files changed, 442 insertions, 131 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 26bd79261532..9f74f523dfc6 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -112,7 +112,7 @@ config X86 | |||
112 | select GENERIC_STRNLEN_USER | 112 | select GENERIC_STRNLEN_USER |
113 | select HAVE_CONTEXT_TRACKING if X86_64 | 113 | select HAVE_CONTEXT_TRACKING if X86_64 |
114 | select HAVE_IRQ_TIME_ACCOUNTING | 114 | select HAVE_IRQ_TIME_ACCOUNTING |
115 | select HAVE_VIRT_TO_BUS | 115 | select VIRT_TO_BUS |
116 | select MODULES_USE_ELF_REL if X86_32 | 116 | select MODULES_USE_ELF_REL if X86_32 |
117 | select MODULES_USE_ELF_RELA if X86_64 | 117 | select MODULES_USE_ELF_RELA if X86_64 |
118 | select CLONE_BACKWARDS if X86_32 | 118 | select CLONE_BACKWARDS if X86_32 |
@@ -1550,6 +1550,7 @@ config X86_SMAP | |||
1550 | config EFI | 1550 | config EFI |
1551 | bool "EFI runtime service support" | 1551 | bool "EFI runtime service support" |
1552 | depends on ACPI | 1552 | depends on ACPI |
1553 | select UCS2_STRING | ||
1553 | ---help--- | 1554 | ---help--- |
1554 | This enables the kernel to use EFI runtime services that are | 1555 | This enables the kernel to use EFI runtime services that are |
1555 | available (such as the EFI variable services). | 1556 | available (such as the EFI variable services). |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 8a84501acb1b..5ef205c5f37b 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | # create a compressed vmlinux image from the original vmlinux | 4 | # create a compressed vmlinux image from the original vmlinux |
5 | # | 5 | # |
6 | 6 | ||
7 | targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o | 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo |
8 | 8 | ||
9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 | 9 | KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 |
10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC | 10 | KBUILD_CFLAGS += -fno-strict-aliasing -fPIC |
@@ -29,7 +29,6 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \ | |||
29 | $(obj)/piggy.o | 29 | $(obj)/piggy.o |
30 | 30 | ||
31 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone | 31 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone |
32 | $(obj)/efi_stub_$(BITS).o: KBUILD_CLFAGS += -fshort-wchar -mno-red-zone | ||
33 | 32 | ||
34 | ifeq ($(CONFIG_EFI_STUB), y) | 33 | ifeq ($(CONFIG_EFI_STUB), y) |
35 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o | 34 | VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o |
@@ -43,7 +42,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S | |||
43 | $(obj)/vmlinux.bin: vmlinux FORCE | 42 | $(obj)/vmlinux.bin: vmlinux FORCE |
44 | $(call if_changed,objcopy) | 43 | $(call if_changed,objcopy) |
45 | 44 | ||
46 | targets += vmlinux.bin.all vmlinux.relocs | 45 | targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs |
47 | 46 | ||
48 | CMD_RELOCS = arch/x86/tools/relocs | 47 | CMD_RELOCS = arch/x86/tools/relocs |
49 | quiet_cmd_relocs = RELOCS $@ | 48 | quiet_cmd_relocs = RELOCS $@ |
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index c205035a6b96..8615f7581820 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -251,6 +251,51 @@ static void find_bits(unsigned long mask, u8 *pos, u8 *size) | |||
251 | *size = len; | 251 | *size = len; |
252 | } | 252 | } |
253 | 253 | ||
254 | static efi_status_t setup_efi_vars(struct boot_params *params) | ||
255 | { | ||
256 | struct setup_data *data; | ||
257 | struct efi_var_bootdata *efidata; | ||
258 | u64 store_size, remaining_size, var_size; | ||
259 | efi_status_t status; | ||
260 | |||
261 | if (!sys_table->runtime->query_variable_info) | ||
262 | return EFI_UNSUPPORTED; | ||
263 | |||
264 | data = (struct setup_data *)(unsigned long)params->hdr.setup_data; | ||
265 | |||
266 | while (data && data->next) | ||
267 | data = (struct setup_data *)(unsigned long)data->next; | ||
268 | |||
269 | status = efi_call_phys4(sys_table->runtime->query_variable_info, | ||
270 | EFI_VARIABLE_NON_VOLATILE | | ||
271 | EFI_VARIABLE_BOOTSERVICE_ACCESS | | ||
272 | EFI_VARIABLE_RUNTIME_ACCESS, &store_size, | ||
273 | &remaining_size, &var_size); | ||
274 | |||
275 | if (status != EFI_SUCCESS) | ||
276 | return status; | ||
277 | |||
278 | status = efi_call_phys3(sys_table->boottime->allocate_pool, | ||
279 | EFI_LOADER_DATA, sizeof(*efidata), &efidata); | ||
280 | |||
281 | if (status != EFI_SUCCESS) | ||
282 | return status; | ||
283 | |||
284 | efidata->data.type = SETUP_EFI_VARS; | ||
285 | efidata->data.len = sizeof(struct efi_var_bootdata) - | ||
286 | sizeof(struct setup_data); | ||
287 | efidata->data.next = 0; | ||
288 | efidata->store_size = store_size; | ||
289 | efidata->remaining_size = remaining_size; | ||
290 | efidata->max_var_size = var_size; | ||
291 | |||
292 | if (data) | ||
293 | data->next = (unsigned long)efidata; | ||
294 | else | ||
295 | params->hdr.setup_data = (unsigned long)efidata; | ||
296 | |||
297 | } | ||
298 | |||
254 | static efi_status_t setup_efi_pci(struct boot_params *params) | 299 | static efi_status_t setup_efi_pci(struct boot_params *params) |
255 | { | 300 | { |
256 | efi_pci_io_protocol *pci; | 301 | efi_pci_io_protocol *pci; |
@@ -1157,6 +1202,8 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table, | |||
1157 | 1202 | ||
1158 | setup_graphics(boot_params); | 1203 | setup_graphics(boot_params); |
1159 | 1204 | ||
1205 | setup_efi_vars(boot_params); | ||
1206 | |||
1160 | setup_efi_pci(boot_params); | 1207 | setup_efi_pci(boot_params); |
1161 | 1208 | ||
1162 | status = efi_call_phys3(sys_table->boottime->allocate_pool, | 1209 | status = efi_call_phys3(sys_table->boottime->allocate_pool, |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 60c89f30c727..2fb5d5884e23 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -102,6 +102,13 @@ extern void efi_call_phys_epilog(void); | |||
102 | extern void efi_unmap_memmap(void); | 102 | extern void efi_unmap_memmap(void); |
103 | extern void efi_memory_uc(u64 addr, unsigned long size); | 103 | extern void efi_memory_uc(u64 addr, unsigned long size); |
104 | 104 | ||
105 | struct efi_var_bootdata { | ||
106 | struct setup_data data; | ||
107 | u64 store_size; | ||
108 | u64 remaining_size; | ||
109 | u64 max_var_size; | ||
110 | }; | ||
111 | |||
105 | #ifdef CONFIG_EFI | 112 | #ifdef CONFIG_EFI |
106 | 113 | ||
107 | static inline bool efi_is_native(void) | 114 | static inline bool efi_is_native(void) |
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h index d3ddd17405d0..5a6d2873f80e 100644 --- a/arch/x86/include/asm/kprobes.h +++ b/arch/x86/include/asm/kprobes.h | |||
@@ -77,6 +77,7 @@ struct arch_specific_insn { | |||
77 | * a post_handler or break_handler). | 77 | * a post_handler or break_handler). |
78 | */ | 78 | */ |
79 | int boostable; | 79 | int boostable; |
80 | bool if_modifier; | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | struct arch_optimized_insn { | 83 | struct arch_optimized_insn { |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 635a74d22409..4979778cc7fb 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -414,8 +414,8 @@ struct kvm_vcpu_arch { | |||
414 | gpa_t time; | 414 | gpa_t time; |
415 | struct pvclock_vcpu_time_info hv_clock; | 415 | struct pvclock_vcpu_time_info hv_clock; |
416 | unsigned int hw_tsc_khz; | 416 | unsigned int hw_tsc_khz; |
417 | unsigned int time_offset; | 417 | struct gfn_to_hva_cache pv_time; |
418 | struct page *time_page; | 418 | bool pv_time_enabled; |
419 | /* set guest stopped flag in pvclock flags field */ | 419 | /* set guest stopped flag in pvclock flags field */ |
420 | bool pvclock_set_guest_stopped_request; | 420 | bool pvclock_set_guest_stopped_request; |
421 | 421 | ||
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index 5edd1742cfd0..7361e47db79f 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
@@ -703,7 +703,10 @@ static inline void arch_leave_lazy_mmu_mode(void) | |||
703 | PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); | 703 | PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave); |
704 | } | 704 | } |
705 | 705 | ||
706 | void arch_flush_lazy_mmu_mode(void); | 706 | static inline void arch_flush_lazy_mmu_mode(void) |
707 | { | ||
708 | PVOP_VCALL0(pv_mmu_ops.lazy_mode.flush); | ||
709 | } | ||
707 | 710 | ||
708 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, | 711 | static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx, |
709 | phys_addr_t phys, pgprot_t flags) | 712 | phys_addr_t phys, pgprot_t flags) |
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 142236ed83af..b3b0ec1dac86 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h | |||
@@ -91,6 +91,7 @@ struct pv_lazy_ops { | |||
91 | /* Set deferred update mode, used for batching operations. */ | 91 | /* Set deferred update mode, used for batching operations. */ |
92 | void (*enter)(void); | 92 | void (*enter)(void); |
93 | void (*leave)(void); | 93 | void (*leave)(void); |
94 | void (*flush)(void); | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | struct pv_time_ops { | 97 | struct pv_time_ops { |
@@ -679,6 +680,7 @@ void paravirt_end_context_switch(struct task_struct *next); | |||
679 | 680 | ||
680 | void paravirt_enter_lazy_mmu(void); | 681 | void paravirt_enter_lazy_mmu(void); |
681 | void paravirt_leave_lazy_mmu(void); | 682 | void paravirt_leave_lazy_mmu(void); |
683 | void paravirt_flush_lazy_mmu(void); | ||
682 | 684 | ||
683 | void _paravirt_nop(void); | 685 | void _paravirt_nop(void); |
684 | u32 _paravirt_ident_32(u32); | 686 | u32 _paravirt_ident_32(u32); |
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h index 1ace47b62592..2e188d68397c 100644 --- a/arch/x86/include/asm/syscall.h +++ b/arch/x86/include/asm/syscall.h | |||
@@ -29,13 +29,13 @@ extern const unsigned long sys_call_table[]; | |||
29 | */ | 29 | */ |
30 | static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) | 30 | static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) |
31 | { | 31 | { |
32 | return regs->orig_ax & __SYSCALL_MASK; | 32 | return regs->orig_ax; |
33 | } | 33 | } |
34 | 34 | ||
35 | static inline void syscall_rollback(struct task_struct *task, | 35 | static inline void syscall_rollback(struct task_struct *task, |
36 | struct pt_regs *regs) | 36 | struct pt_regs *regs) |
37 | { | 37 | { |
38 | regs->ax = regs->orig_ax & __SYSCALL_MASK; | 38 | regs->ax = regs->orig_ax; |
39 | } | 39 | } |
40 | 40 | ||
41 | static inline long syscall_get_error(struct task_struct *task, | 41 | static inline long syscall_get_error(struct task_struct *task, |
diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h index 4fef20773b8f..c7797307fc2b 100644 --- a/arch/x86/include/asm/tlb.h +++ b/arch/x86/include/asm/tlb.h | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | #define tlb_flush(tlb) \ | 8 | #define tlb_flush(tlb) \ |
9 | { \ | 9 | { \ |
10 | if (tlb->fullmm == 0) \ | 10 | if (!tlb->fullmm && !tlb->need_flush_all) \ |
11 | flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end, 0UL); \ | 11 | flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end, 0UL); \ |
12 | else \ | 12 | else \ |
13 | flush_tlb_mm_range(tlb->mm, 0UL, TLB_FLUSH_ALL, 0UL); \ | 13 | flush_tlb_mm_range(tlb->mm, 0UL, TLB_FLUSH_ALL, 0UL); \ |
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h index c20d1ce62dc6..e709884d0ef9 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h | |||
@@ -382,14 +382,14 @@ HYPERVISOR_console_io(int cmd, int count, char *str) | |||
382 | return _hypercall3(int, console_io, cmd, count, str); | 382 | return _hypercall3(int, console_io, cmd, count, str); |
383 | } | 383 | } |
384 | 384 | ||
385 | extern int __must_check HYPERVISOR_physdev_op_compat(int, void *); | 385 | extern int __must_check xen_physdev_op_compat(int, void *); |
386 | 386 | ||
387 | static inline int | 387 | static inline int |
388 | HYPERVISOR_physdev_op(int cmd, void *arg) | 388 | HYPERVISOR_physdev_op(int cmd, void *arg) |
389 | { | 389 | { |
390 | int rc = _hypercall2(int, physdev_op, cmd, arg); | 390 | int rc = _hypercall2(int, physdev_op, cmd, arg); |
391 | if (unlikely(rc == -ENOSYS)) | 391 | if (unlikely(rc == -ENOSYS)) |
392 | rc = HYPERVISOR_physdev_op_compat(cmd, arg); | 392 | rc = xen_physdev_op_compat(cmd, arg); |
393 | return rc; | 393 | return rc; |
394 | } | 394 | } |
395 | 395 | ||
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h index c15ddaf90710..08744242b8d2 100644 --- a/arch/x86/include/uapi/asm/bootparam.h +++ b/arch/x86/include/uapi/asm/bootparam.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #define SETUP_E820_EXT 1 | 6 | #define SETUP_E820_EXT 1 |
7 | #define SETUP_DTB 2 | 7 | #define SETUP_DTB 2 |
8 | #define SETUP_PCI 3 | 8 | #define SETUP_PCI 3 |
9 | #define SETUP_EFI_VARS 4 | ||
9 | 10 | ||
10 | /* ram_size flags */ | 11 | /* ram_size flags */ |
11 | #define RAMDISK_IMAGE_START_MASK 0x07FF | 12 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h index 892ce40a7470..7a060f4b411f 100644 --- a/arch/x86/include/uapi/asm/msr-index.h +++ b/arch/x86/include/uapi/asm/msr-index.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #define SNB_C1_AUTO_UNDEMOTE (1UL << 27) | 44 | #define SNB_C1_AUTO_UNDEMOTE (1UL << 27) |
45 | #define SNB_C3_AUTO_UNDEMOTE (1UL << 28) | 45 | #define SNB_C3_AUTO_UNDEMOTE (1UL << 28) |
46 | 46 | ||
47 | #define MSR_PLATFORM_INFO 0x000000ce | ||
47 | #define MSR_MTRRcap 0x000000fe | 48 | #define MSR_MTRRcap 0x000000fe |
48 | #define MSR_IA32_BBL_CR_CTL 0x00000119 | 49 | #define MSR_IA32_BBL_CR_CTL 0x00000119 |
49 | #define MSR_IA32_BBL_CR_CTL3 0x0000011e | 50 | #define MSR_IA32_BBL_CR_CTL3 0x0000011e |
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index a7d26d83fb70..8f4be53ea04b 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c | |||
@@ -35,13 +35,6 @@ static bool __init ms_hyperv_platform(void) | |||
35 | if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) | 35 | if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) |
36 | return false; | 36 | return false; |
37 | 37 | ||
38 | /* | ||
39 | * Xen emulates Hyper-V to support enlightened Windows. | ||
40 | * Check to see first if we are on a Xen Hypervisor. | ||
41 | */ | ||
42 | if (xen_cpuid_base()) | ||
43 | return false; | ||
44 | |||
45 | cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS, | 38 | cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS, |
46 | &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]); | 39 | &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]); |
47 | 40 | ||
@@ -82,12 +75,6 @@ static void __init ms_hyperv_init_platform(void) | |||
82 | 75 | ||
83 | if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) | 76 | if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) |
84 | clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); | 77 | clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); |
85 | #if IS_ENABLED(CONFIG_HYPERV) | ||
86 | /* | ||
87 | * Setup the IDT for hypervisor callback. | ||
88 | */ | ||
89 | alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector); | ||
90 | #endif | ||
91 | } | 78 | } |
92 | 79 | ||
93 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { | 80 | const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { |
@@ -103,6 +90,11 @@ static irq_handler_t vmbus_isr; | |||
103 | 90 | ||
104 | void hv_register_vmbus_handler(int irq, irq_handler_t handler) | 91 | void hv_register_vmbus_handler(int irq, irq_handler_t handler) |
105 | { | 92 | { |
93 | /* | ||
94 | * Setup the IDT for hypervisor callback. | ||
95 | */ | ||
96 | alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector); | ||
97 | |||
106 | vmbus_irq = irq; | 98 | vmbus_irq = irq; |
107 | vmbus_isr = handler; | 99 | vmbus_isr = handler; |
108 | } | 100 | } |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 529c8931fc02..cc45deb791b0 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -101,6 +101,10 @@ static struct event_constraint intel_snb_event_constraints[] __read_mostly = | |||
101 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 101 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
102 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 102 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
103 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | 103 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ |
104 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), /* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */ | ||
105 | INTEL_UEVENT_CONSTRAINT(0x05a3, 0xf), /* CYCLE_ACTIVITY.STALLS_L2_PENDING */ | ||
106 | INTEL_UEVENT_CONSTRAINT(0x02a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ | ||
107 | INTEL_UEVENT_CONSTRAINT(0x06a3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */ | ||
104 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */ | 108 | INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.PENDING */ |
105 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ | 109 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ |
106 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ | 110 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ |
@@ -149,8 +153,14 @@ static struct event_constraint intel_gen_event_constraints[] __read_mostly = | |||
149 | }; | 153 | }; |
150 | 154 | ||
151 | static struct extra_reg intel_snb_extra_regs[] __read_mostly = { | 155 | static struct extra_reg intel_snb_extra_regs[] __read_mostly = { |
152 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffffffffull, RSP_0), | 156 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0), |
153 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffffffffull, RSP_1), | 157 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1), |
158 | EVENT_EXTRA_END | ||
159 | }; | ||
160 | |||
161 | static struct extra_reg intel_snbep_extra_regs[] __read_mostly = { | ||
162 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0), | ||
163 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1), | ||
154 | EVENT_EXTRA_END | 164 | EVENT_EXTRA_END |
155 | }; | 165 | }; |
156 | 166 | ||
@@ -2093,7 +2103,10 @@ __init int intel_pmu_init(void) | |||
2093 | x86_pmu.event_constraints = intel_snb_event_constraints; | 2103 | x86_pmu.event_constraints = intel_snb_event_constraints; |
2094 | x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints; | 2104 | x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints; |
2095 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | 2105 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; |
2096 | x86_pmu.extra_regs = intel_snb_extra_regs; | 2106 | if (boot_cpu_data.x86_model == 45) |
2107 | x86_pmu.extra_regs = intel_snbep_extra_regs; | ||
2108 | else | ||
2109 | x86_pmu.extra_regs = intel_snb_extra_regs; | ||
2097 | /* all extra regs are per-cpu when HT is on */ | 2110 | /* all extra regs are per-cpu when HT is on */ |
2098 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | 2111 | x86_pmu.er_flags |= ERF_HAS_RSP_1; |
2099 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | 2112 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; |
@@ -2119,7 +2132,10 @@ __init int intel_pmu_init(void) | |||
2119 | x86_pmu.event_constraints = intel_ivb_event_constraints; | 2132 | x86_pmu.event_constraints = intel_ivb_event_constraints; |
2120 | x86_pmu.pebs_constraints = intel_ivb_pebs_event_constraints; | 2133 | x86_pmu.pebs_constraints = intel_ivb_pebs_event_constraints; |
2121 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | 2134 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; |
2122 | x86_pmu.extra_regs = intel_snb_extra_regs; | 2135 | if (boot_cpu_data.x86_model == 62) |
2136 | x86_pmu.extra_regs = intel_snbep_extra_regs; | ||
2137 | else | ||
2138 | x86_pmu.extra_regs = intel_snb_extra_regs; | ||
2123 | /* all extra regs are per-cpu when HT is on */ | 2139 | /* all extra regs are per-cpu when HT is on */ |
2124 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | 2140 | x86_pmu.er_flags |= ERF_HAS_RSP_1; |
2125 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | 2141 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 826054a4f2ee..26830f3af0df 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -314,10 +314,11 @@ int intel_pmu_drain_bts_buffer(void) | |||
314 | if (top <= at) | 314 | if (top <= at) |
315 | return 0; | 315 | return 0; |
316 | 316 | ||
317 | memset(®s, 0, sizeof(regs)); | ||
318 | |||
317 | ds->bts_index = ds->bts_buffer_base; | 319 | ds->bts_index = ds->bts_buffer_base; |
318 | 320 | ||
319 | perf_sample_data_init(&data, 0, event->hw.last_period); | 321 | perf_sample_data_init(&data, 0, event->hw.last_period); |
320 | regs.ip = 0; | ||
321 | 322 | ||
322 | /* | 323 | /* |
323 | * Prepare a generic sample, i.e. fill in the invariant fields. | 324 | * Prepare a generic sample, i.e. fill in the invariant fields. |
@@ -729,3 +730,13 @@ void intel_ds_init(void) | |||
729 | } | 730 | } |
730 | } | 731 | } |
731 | } | 732 | } |
733 | |||
734 | void perf_restore_debug_store(void) | ||
735 | { | ||
736 | struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds); | ||
737 | |||
738 | if (!x86_pmu.bts && !x86_pmu.pebs) | ||
739 | return; | ||
740 | |||
741 | wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds); | ||
742 | } | ||
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 3f06e6149981..7bfe318d3d8a 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -375,6 +375,9 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p) | |||
375 | else | 375 | else |
376 | p->ainsn.boostable = -1; | 376 | p->ainsn.boostable = -1; |
377 | 377 | ||
378 | /* Check whether the instruction modifies Interrupt Flag or not */ | ||
379 | p->ainsn.if_modifier = is_IF_modifier(p->ainsn.insn); | ||
380 | |||
378 | /* Also, displacement change doesn't affect the first byte */ | 381 | /* Also, displacement change doesn't affect the first byte */ |
379 | p->opcode = p->ainsn.insn[0]; | 382 | p->opcode = p->ainsn.insn[0]; |
380 | } | 383 | } |
@@ -434,7 +437,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs, | |||
434 | __this_cpu_write(current_kprobe, p); | 437 | __this_cpu_write(current_kprobe, p); |
435 | kcb->kprobe_saved_flags = kcb->kprobe_old_flags | 438 | kcb->kprobe_saved_flags = kcb->kprobe_old_flags |
436 | = (regs->flags & (X86_EFLAGS_TF | X86_EFLAGS_IF)); | 439 | = (regs->flags & (X86_EFLAGS_TF | X86_EFLAGS_IF)); |
437 | if (is_IF_modifier(p->ainsn.insn)) | 440 | if (p->ainsn.if_modifier) |
438 | kcb->kprobe_saved_flags &= ~X86_EFLAGS_IF; | 441 | kcb->kprobe_saved_flags &= ~X86_EFLAGS_IF; |
439 | } | 442 | } |
440 | 443 | ||
diff --git a/arch/x86/kernel/microcode_core_early.c b/arch/x86/kernel/microcode_core_early.c index 577db8417d15..833d51d6ee06 100644 --- a/arch/x86/kernel/microcode_core_early.c +++ b/arch/x86/kernel/microcode_core_early.c | |||
@@ -45,9 +45,6 @@ static int __cpuinit x86_vendor(void) | |||
45 | u32 eax = 0x00000000; | 45 | u32 eax = 0x00000000; |
46 | u32 ebx, ecx = 0, edx; | 46 | u32 ebx, ecx = 0, edx; |
47 | 47 | ||
48 | if (!have_cpuid_p()) | ||
49 | return X86_VENDOR_UNKNOWN; | ||
50 | |||
51 | native_cpuid(&eax, &ebx, &ecx, &edx); | 48 | native_cpuid(&eax, &ebx, &ecx, &edx); |
52 | 49 | ||
53 | if (CPUID_IS(CPUID_INTEL1, CPUID_INTEL2, CPUID_INTEL3, ebx, ecx, edx)) | 50 | if (CPUID_IS(CPUID_INTEL1, CPUID_INTEL2, CPUID_INTEL3, ebx, ecx, edx)) |
@@ -59,18 +56,45 @@ static int __cpuinit x86_vendor(void) | |||
59 | return X86_VENDOR_UNKNOWN; | 56 | return X86_VENDOR_UNKNOWN; |
60 | } | 57 | } |
61 | 58 | ||
59 | static int __cpuinit x86_family(void) | ||
60 | { | ||
61 | u32 eax = 0x00000001; | ||
62 | u32 ebx, ecx = 0, edx; | ||
63 | int x86; | ||
64 | |||
65 | native_cpuid(&eax, &ebx, &ecx, &edx); | ||
66 | |||
67 | x86 = (eax >> 8) & 0xf; | ||
68 | if (x86 == 15) | ||
69 | x86 += (eax >> 20) & 0xff; | ||
70 | |||
71 | return x86; | ||
72 | } | ||
73 | |||
62 | void __init load_ucode_bsp(void) | 74 | void __init load_ucode_bsp(void) |
63 | { | 75 | { |
64 | int vendor = x86_vendor(); | 76 | int vendor, x86; |
77 | |||
78 | if (!have_cpuid_p()) | ||
79 | return; | ||
65 | 80 | ||
66 | if (vendor == X86_VENDOR_INTEL) | 81 | vendor = x86_vendor(); |
82 | x86 = x86_family(); | ||
83 | |||
84 | if (vendor == X86_VENDOR_INTEL && x86 >= 6) | ||
67 | load_ucode_intel_bsp(); | 85 | load_ucode_intel_bsp(); |
68 | } | 86 | } |
69 | 87 | ||
70 | void __cpuinit load_ucode_ap(void) | 88 | void __cpuinit load_ucode_ap(void) |
71 | { | 89 | { |
72 | int vendor = x86_vendor(); | 90 | int vendor, x86; |
91 | |||
92 | if (!have_cpuid_p()) | ||
93 | return; | ||
94 | |||
95 | vendor = x86_vendor(); | ||
96 | x86 = x86_family(); | ||
73 | 97 | ||
74 | if (vendor == X86_VENDOR_INTEL) | 98 | if (vendor == X86_VENDOR_INTEL && x86 >= 6) |
75 | load_ucode_intel_ap(); | 99 | load_ucode_intel_ap(); |
76 | } | 100 | } |
diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c index 7890bc838952..d893e8ed8ac9 100644 --- a/arch/x86/kernel/microcode_intel_early.c +++ b/arch/x86/kernel/microcode_intel_early.c | |||
@@ -90,13 +90,13 @@ microcode_phys(struct microcode_intel **mc_saved_tmp, | |||
90 | struct microcode_intel ***mc_saved; | 90 | struct microcode_intel ***mc_saved; |
91 | 91 | ||
92 | mc_saved = (struct microcode_intel ***) | 92 | mc_saved = (struct microcode_intel ***) |
93 | __pa_symbol(&mc_saved_data->mc_saved); | 93 | __pa_nodebug(&mc_saved_data->mc_saved); |
94 | for (i = 0; i < mc_saved_data->mc_saved_count; i++) { | 94 | for (i = 0; i < mc_saved_data->mc_saved_count; i++) { |
95 | struct microcode_intel *p; | 95 | struct microcode_intel *p; |
96 | 96 | ||
97 | p = *(struct microcode_intel **) | 97 | p = *(struct microcode_intel **) |
98 | __pa(mc_saved_data->mc_saved + i); | 98 | __pa_nodebug(mc_saved_data->mc_saved + i); |
99 | mc_saved_tmp[i] = (struct microcode_intel *)__pa(p); | 99 | mc_saved_tmp[i] = (struct microcode_intel *)__pa_nodebug(p); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | #endif | 102 | #endif |
@@ -562,7 +562,7 @@ scan_microcode(unsigned long start, unsigned long end, | |||
562 | struct cpio_data cd; | 562 | struct cpio_data cd; |
563 | long offset = 0; | 563 | long offset = 0; |
564 | #ifdef CONFIG_X86_32 | 564 | #ifdef CONFIG_X86_32 |
565 | char *p = (char *)__pa_symbol(ucode_name); | 565 | char *p = (char *)__pa_nodebug(ucode_name); |
566 | #else | 566 | #else |
567 | char *p = ucode_name; | 567 | char *p = ucode_name; |
568 | #endif | 568 | #endif |
@@ -630,8 +630,8 @@ static void __cpuinit print_ucode(struct ucode_cpu_info *uci) | |||
630 | if (mc_intel == NULL) | 630 | if (mc_intel == NULL) |
631 | return; | 631 | return; |
632 | 632 | ||
633 | delay_ucode_info_p = (int *)__pa_symbol(&delay_ucode_info); | 633 | delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info); |
634 | current_mc_date_p = (int *)__pa_symbol(¤t_mc_date); | 634 | current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date); |
635 | 635 | ||
636 | *delay_ucode_info_p = 1; | 636 | *delay_ucode_info_p = 1; |
637 | *current_mc_date_p = mc_intel->hdr.date; | 637 | *current_mc_date_p = mc_intel->hdr.date; |
@@ -659,8 +659,8 @@ static inline void __cpuinit print_ucode(struct ucode_cpu_info *uci) | |||
659 | } | 659 | } |
660 | #endif | 660 | #endif |
661 | 661 | ||
662 | static int apply_microcode_early(struct mc_saved_data *mc_saved_data, | 662 | static int __cpuinit apply_microcode_early(struct mc_saved_data *mc_saved_data, |
663 | struct ucode_cpu_info *uci) | 663 | struct ucode_cpu_info *uci) |
664 | { | 664 | { |
665 | struct microcode_intel *mc_intel; | 665 | struct microcode_intel *mc_intel; |
666 | unsigned int val[2]; | 666 | unsigned int val[2]; |
@@ -741,15 +741,15 @@ load_ucode_intel_bsp(void) | |||
741 | #ifdef CONFIG_X86_32 | 741 | #ifdef CONFIG_X86_32 |
742 | struct boot_params *boot_params_p; | 742 | struct boot_params *boot_params_p; |
743 | 743 | ||
744 | boot_params_p = (struct boot_params *)__pa_symbol(&boot_params); | 744 | boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params); |
745 | ramdisk_image = boot_params_p->hdr.ramdisk_image; | 745 | ramdisk_image = boot_params_p->hdr.ramdisk_image; |
746 | ramdisk_size = boot_params_p->hdr.ramdisk_size; | 746 | ramdisk_size = boot_params_p->hdr.ramdisk_size; |
747 | initrd_start_early = ramdisk_image; | 747 | initrd_start_early = ramdisk_image; |
748 | initrd_end_early = initrd_start_early + ramdisk_size; | 748 | initrd_end_early = initrd_start_early + ramdisk_size; |
749 | 749 | ||
750 | _load_ucode_intel_bsp( | 750 | _load_ucode_intel_bsp( |
751 | (struct mc_saved_data *)__pa_symbol(&mc_saved_data), | 751 | (struct mc_saved_data *)__pa_nodebug(&mc_saved_data), |
752 | (unsigned long *)__pa_symbol(&mc_saved_in_initrd), | 752 | (unsigned long *)__pa_nodebug(&mc_saved_in_initrd), |
753 | initrd_start_early, initrd_end_early, &uci); | 753 | initrd_start_early, initrd_end_early, &uci); |
754 | #else | 754 | #else |
755 | ramdisk_image = boot_params.hdr.ramdisk_image; | 755 | ramdisk_image = boot_params.hdr.ramdisk_image; |
@@ -772,10 +772,10 @@ void __cpuinit load_ucode_intel_ap(void) | |||
772 | unsigned long *initrd_start_p; | 772 | unsigned long *initrd_start_p; |
773 | 773 | ||
774 | mc_saved_in_initrd_p = | 774 | mc_saved_in_initrd_p = |
775 | (unsigned long *)__pa_symbol(mc_saved_in_initrd); | 775 | (unsigned long *)__pa_nodebug(mc_saved_in_initrd); |
776 | mc_saved_data_p = (struct mc_saved_data *)__pa_symbol(&mc_saved_data); | 776 | mc_saved_data_p = (struct mc_saved_data *)__pa_nodebug(&mc_saved_data); |
777 | initrd_start_p = (unsigned long *)__pa_symbol(&initrd_start); | 777 | initrd_start_p = (unsigned long *)__pa_nodebug(&initrd_start); |
778 | initrd_start_addr = (unsigned long)__pa_symbol(*initrd_start_p); | 778 | initrd_start_addr = (unsigned long)__pa_nodebug(*initrd_start_p); |
779 | #else | 779 | #else |
780 | mc_saved_data_p = &mc_saved_data; | 780 | mc_saved_data_p = &mc_saved_data; |
781 | mc_saved_in_initrd_p = mc_saved_in_initrd; | 781 | mc_saved_in_initrd_p = mc_saved_in_initrd; |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 17fff18a1031..8bfb335f74bb 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -263,6 +263,18 @@ void paravirt_leave_lazy_mmu(void) | |||
263 | leave_lazy(PARAVIRT_LAZY_MMU); | 263 | leave_lazy(PARAVIRT_LAZY_MMU); |
264 | } | 264 | } |
265 | 265 | ||
266 | void paravirt_flush_lazy_mmu(void) | ||
267 | { | ||
268 | preempt_disable(); | ||
269 | |||
270 | if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) { | ||
271 | arch_leave_lazy_mmu_mode(); | ||
272 | arch_enter_lazy_mmu_mode(); | ||
273 | } | ||
274 | |||
275 | preempt_enable(); | ||
276 | } | ||
277 | |||
266 | void paravirt_start_context_switch(struct task_struct *prev) | 278 | void paravirt_start_context_switch(struct task_struct *prev) |
267 | { | 279 | { |
268 | BUG_ON(preemptible()); | 280 | BUG_ON(preemptible()); |
@@ -292,18 +304,6 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void) | |||
292 | return this_cpu_read(paravirt_lazy_mode); | 304 | return this_cpu_read(paravirt_lazy_mode); |
293 | } | 305 | } |
294 | 306 | ||
295 | void arch_flush_lazy_mmu_mode(void) | ||
296 | { | ||
297 | preempt_disable(); | ||
298 | |||
299 | if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) { | ||
300 | arch_leave_lazy_mmu_mode(); | ||
301 | arch_enter_lazy_mmu_mode(); | ||
302 | } | ||
303 | |||
304 | preempt_enable(); | ||
305 | } | ||
306 | |||
307 | struct pv_info pv_info = { | 307 | struct pv_info pv_info = { |
308 | .name = "bare hardware", | 308 | .name = "bare hardware", |
309 | .paravirt_enabled = 0, | 309 | .paravirt_enabled = 0, |
@@ -475,6 +475,7 @@ struct pv_mmu_ops pv_mmu_ops = { | |||
475 | .lazy_mode = { | 475 | .lazy_mode = { |
476 | .enter = paravirt_nop, | 476 | .enter = paravirt_nop, |
477 | .leave = paravirt_nop, | 477 | .leave = paravirt_nop, |
478 | .flush = paravirt_nop, | ||
478 | }, | 479 | }, |
479 | 480 | ||
480 | .set_fixmap = native_set_fixmap, | 481 | .set_fixmap = native_set_fixmap, |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 90d8cc930f5e..fae9134a2de9 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -507,11 +507,14 @@ static void __init memblock_x86_reserve_range_setup_data(void) | |||
507 | /* | 507 | /* |
508 | * Keep the crash kernel below this limit. On 32 bits earlier kernels | 508 | * Keep the crash kernel below this limit. On 32 bits earlier kernels |
509 | * would limit the kernel to the low 512 MiB due to mapping restrictions. | 509 | * would limit the kernel to the low 512 MiB due to mapping restrictions. |
510 | * On 64bit, old kexec-tools need to under 896MiB. | ||
510 | */ | 511 | */ |
511 | #ifdef CONFIG_X86_32 | 512 | #ifdef CONFIG_X86_32 |
512 | # define CRASH_KERNEL_ADDR_MAX (512 << 20) | 513 | # define CRASH_KERNEL_ADDR_LOW_MAX (512 << 20) |
514 | # define CRASH_KERNEL_ADDR_HIGH_MAX (512 << 20) | ||
513 | #else | 515 | #else |
514 | # define CRASH_KERNEL_ADDR_MAX MAXMEM | 516 | # define CRASH_KERNEL_ADDR_LOW_MAX (896UL<<20) |
517 | # define CRASH_KERNEL_ADDR_HIGH_MAX MAXMEM | ||
515 | #endif | 518 | #endif |
516 | 519 | ||
517 | static void __init reserve_crashkernel_low(void) | 520 | static void __init reserve_crashkernel_low(void) |
@@ -521,19 +524,35 @@ static void __init reserve_crashkernel_low(void) | |||
521 | unsigned long long low_base = 0, low_size = 0; | 524 | unsigned long long low_base = 0, low_size = 0; |
522 | unsigned long total_low_mem; | 525 | unsigned long total_low_mem; |
523 | unsigned long long base; | 526 | unsigned long long base; |
527 | bool auto_set = false; | ||
524 | int ret; | 528 | int ret; |
525 | 529 | ||
526 | total_low_mem = memblock_mem_size(1UL<<(32-PAGE_SHIFT)); | 530 | total_low_mem = memblock_mem_size(1UL<<(32-PAGE_SHIFT)); |
531 | /* crashkernel=Y,low */ | ||
527 | ret = parse_crashkernel_low(boot_command_line, total_low_mem, | 532 | ret = parse_crashkernel_low(boot_command_line, total_low_mem, |
528 | &low_size, &base); | 533 | &low_size, &base); |
529 | if (ret != 0 || low_size <= 0) | 534 | if (ret != 0) { |
530 | return; | 535 | /* |
536 | * two parts from lib/swiotlb.c: | ||
537 | * swiotlb size: user specified with swiotlb= or default. | ||
538 | * swiotlb overflow buffer: now is hardcoded to 32k. | ||
539 | * We round it to 8M for other buffers that | ||
540 | * may need to stay low too. | ||
541 | */ | ||
542 | low_size = swiotlb_size_or_default() + (8UL<<20); | ||
543 | auto_set = true; | ||
544 | } else { | ||
545 | /* passed with crashkernel=0,low ? */ | ||
546 | if (!low_size) | ||
547 | return; | ||
548 | } | ||
531 | 549 | ||
532 | low_base = memblock_find_in_range(low_size, (1ULL<<32), | 550 | low_base = memblock_find_in_range(low_size, (1ULL<<32), |
533 | low_size, alignment); | 551 | low_size, alignment); |
534 | 552 | ||
535 | if (!low_base) { | 553 | if (!low_base) { |
536 | pr_info("crashkernel low reservation failed - No suitable area found.\n"); | 554 | if (!auto_set) |
555 | pr_info("crashkernel low reservation failed - No suitable area found.\n"); | ||
537 | 556 | ||
538 | return; | 557 | return; |
539 | } | 558 | } |
@@ -554,14 +573,22 @@ static void __init reserve_crashkernel(void) | |||
554 | const unsigned long long alignment = 16<<20; /* 16M */ | 573 | const unsigned long long alignment = 16<<20; /* 16M */ |
555 | unsigned long long total_mem; | 574 | unsigned long long total_mem; |
556 | unsigned long long crash_size, crash_base; | 575 | unsigned long long crash_size, crash_base; |
576 | bool high = false; | ||
557 | int ret; | 577 | int ret; |
558 | 578 | ||
559 | total_mem = memblock_phys_mem_size(); | 579 | total_mem = memblock_phys_mem_size(); |
560 | 580 | ||
581 | /* crashkernel=XM */ | ||
561 | ret = parse_crashkernel(boot_command_line, total_mem, | 582 | ret = parse_crashkernel(boot_command_line, total_mem, |
562 | &crash_size, &crash_base); | 583 | &crash_size, &crash_base); |
563 | if (ret != 0 || crash_size <= 0) | 584 | if (ret != 0 || crash_size <= 0) { |
564 | return; | 585 | /* crashkernel=X,high */ |
586 | ret = parse_crashkernel_high(boot_command_line, total_mem, | ||
587 | &crash_size, &crash_base); | ||
588 | if (ret != 0 || crash_size <= 0) | ||
589 | return; | ||
590 | high = true; | ||
591 | } | ||
565 | 592 | ||
566 | /* 0 means: find the address automatically */ | 593 | /* 0 means: find the address automatically */ |
567 | if (crash_base <= 0) { | 594 | if (crash_base <= 0) { |
@@ -569,7 +596,9 @@ static void __init reserve_crashkernel(void) | |||
569 | * kexec want bzImage is below CRASH_KERNEL_ADDR_MAX | 596 | * kexec want bzImage is below CRASH_KERNEL_ADDR_MAX |
570 | */ | 597 | */ |
571 | crash_base = memblock_find_in_range(alignment, | 598 | crash_base = memblock_find_in_range(alignment, |
572 | CRASH_KERNEL_ADDR_MAX, crash_size, alignment); | 599 | high ? CRASH_KERNEL_ADDR_HIGH_MAX : |
600 | CRASH_KERNEL_ADDR_LOW_MAX, | ||
601 | crash_size, alignment); | ||
573 | 602 | ||
574 | if (!crash_base) { | 603 | if (!crash_base) { |
575 | pr_info("crashkernel reservation failed - No suitable area found.\n"); | 604 | pr_info("crashkernel reservation failed - No suitable area found.\n"); |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 02b51dd4e4ad..f77df1c5de6e 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -1857,7 +1857,7 @@ int kvm_lapic_enable_pv_eoi(struct kvm_vcpu *vcpu, u64 data) | |||
1857 | if (!pv_eoi_enabled(vcpu)) | 1857 | if (!pv_eoi_enabled(vcpu)) |
1858 | return 0; | 1858 | return 0; |
1859 | return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data, | 1859 | return kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.pv_eoi.data, |
1860 | addr); | 1860 | addr, sizeof(u8)); |
1861 | } | 1861 | } |
1862 | 1862 | ||
1863 | void kvm_lapic_init(void) | 1863 | void kvm_lapic_init(void) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f71500af1f81..e1721324c271 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1406,25 +1406,15 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1406 | unsigned long flags, this_tsc_khz; | 1406 | unsigned long flags, this_tsc_khz; |
1407 | struct kvm_vcpu_arch *vcpu = &v->arch; | 1407 | struct kvm_vcpu_arch *vcpu = &v->arch; |
1408 | struct kvm_arch *ka = &v->kvm->arch; | 1408 | struct kvm_arch *ka = &v->kvm->arch; |
1409 | void *shared_kaddr; | ||
1410 | s64 kernel_ns, max_kernel_ns; | 1409 | s64 kernel_ns, max_kernel_ns; |
1411 | u64 tsc_timestamp, host_tsc; | 1410 | u64 tsc_timestamp, host_tsc; |
1412 | struct pvclock_vcpu_time_info *guest_hv_clock; | 1411 | struct pvclock_vcpu_time_info guest_hv_clock; |
1413 | u8 pvclock_flags; | 1412 | u8 pvclock_flags; |
1414 | bool use_master_clock; | 1413 | bool use_master_clock; |
1415 | 1414 | ||
1416 | kernel_ns = 0; | 1415 | kernel_ns = 0; |
1417 | host_tsc = 0; | 1416 | host_tsc = 0; |
1418 | 1417 | ||
1419 | /* Keep irq disabled to prevent changes to the clock */ | ||
1420 | local_irq_save(flags); | ||
1421 | this_tsc_khz = __get_cpu_var(cpu_tsc_khz); | ||
1422 | if (unlikely(this_tsc_khz == 0)) { | ||
1423 | local_irq_restore(flags); | ||
1424 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, v); | ||
1425 | return 1; | ||
1426 | } | ||
1427 | |||
1428 | /* | 1418 | /* |
1429 | * If the host uses TSC clock, then passthrough TSC as stable | 1419 | * If the host uses TSC clock, then passthrough TSC as stable |
1430 | * to the guest. | 1420 | * to the guest. |
@@ -1436,6 +1426,15 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1436 | kernel_ns = ka->master_kernel_ns; | 1426 | kernel_ns = ka->master_kernel_ns; |
1437 | } | 1427 | } |
1438 | spin_unlock(&ka->pvclock_gtod_sync_lock); | 1428 | spin_unlock(&ka->pvclock_gtod_sync_lock); |
1429 | |||
1430 | /* Keep irq disabled to prevent changes to the clock */ | ||
1431 | local_irq_save(flags); | ||
1432 | this_tsc_khz = __get_cpu_var(cpu_tsc_khz); | ||
1433 | if (unlikely(this_tsc_khz == 0)) { | ||
1434 | local_irq_restore(flags); | ||
1435 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, v); | ||
1436 | return 1; | ||
1437 | } | ||
1439 | if (!use_master_clock) { | 1438 | if (!use_master_clock) { |
1440 | host_tsc = native_read_tsc(); | 1439 | host_tsc = native_read_tsc(); |
1441 | kernel_ns = get_kernel_ns(); | 1440 | kernel_ns = get_kernel_ns(); |
@@ -1463,7 +1462,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1463 | 1462 | ||
1464 | local_irq_restore(flags); | 1463 | local_irq_restore(flags); |
1465 | 1464 | ||
1466 | if (!vcpu->time_page) | 1465 | if (!vcpu->pv_time_enabled) |
1467 | return 0; | 1466 | return 0; |
1468 | 1467 | ||
1469 | /* | 1468 | /* |
@@ -1525,12 +1524,12 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1525 | */ | 1524 | */ |
1526 | vcpu->hv_clock.version += 2; | 1525 | vcpu->hv_clock.version += 2; |
1527 | 1526 | ||
1528 | shared_kaddr = kmap_atomic(vcpu->time_page); | 1527 | if (unlikely(kvm_read_guest_cached(v->kvm, &vcpu->pv_time, |
1529 | 1528 | &guest_hv_clock, sizeof(guest_hv_clock)))) | |
1530 | guest_hv_clock = shared_kaddr + vcpu->time_offset; | 1529 | return 0; |
1531 | 1530 | ||
1532 | /* retain PVCLOCK_GUEST_STOPPED if set in guest copy */ | 1531 | /* retain PVCLOCK_GUEST_STOPPED if set in guest copy */ |
1533 | pvclock_flags = (guest_hv_clock->flags & PVCLOCK_GUEST_STOPPED); | 1532 | pvclock_flags = (guest_hv_clock.flags & PVCLOCK_GUEST_STOPPED); |
1534 | 1533 | ||
1535 | if (vcpu->pvclock_set_guest_stopped_request) { | 1534 | if (vcpu->pvclock_set_guest_stopped_request) { |
1536 | pvclock_flags |= PVCLOCK_GUEST_STOPPED; | 1535 | pvclock_flags |= PVCLOCK_GUEST_STOPPED; |
@@ -1543,12 +1542,9 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) | |||
1543 | 1542 | ||
1544 | vcpu->hv_clock.flags = pvclock_flags; | 1543 | vcpu->hv_clock.flags = pvclock_flags; |
1545 | 1544 | ||
1546 | memcpy(shared_kaddr + vcpu->time_offset, &vcpu->hv_clock, | 1545 | kvm_write_guest_cached(v->kvm, &vcpu->pv_time, |
1547 | sizeof(vcpu->hv_clock)); | 1546 | &vcpu->hv_clock, |
1548 | 1547 | sizeof(vcpu->hv_clock)); | |
1549 | kunmap_atomic(shared_kaddr); | ||
1550 | |||
1551 | mark_page_dirty(v->kvm, vcpu->time >> PAGE_SHIFT); | ||
1552 | return 0; | 1548 | return 0; |
1553 | } | 1549 | } |
1554 | 1550 | ||
@@ -1827,7 +1823,8 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) | |||
1827 | return 0; | 1823 | return 0; |
1828 | } | 1824 | } |
1829 | 1825 | ||
1830 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa)) | 1826 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.apf.data, gpa, |
1827 | sizeof(u32))) | ||
1831 | return 1; | 1828 | return 1; |
1832 | 1829 | ||
1833 | vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS); | 1830 | vcpu->arch.apf.send_user_only = !(data & KVM_ASYNC_PF_SEND_ALWAYS); |
@@ -1837,10 +1834,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) | |||
1837 | 1834 | ||
1838 | static void kvmclock_reset(struct kvm_vcpu *vcpu) | 1835 | static void kvmclock_reset(struct kvm_vcpu *vcpu) |
1839 | { | 1836 | { |
1840 | if (vcpu->arch.time_page) { | 1837 | vcpu->arch.pv_time_enabled = false; |
1841 | kvm_release_page_dirty(vcpu->arch.time_page); | ||
1842 | vcpu->arch.time_page = NULL; | ||
1843 | } | ||
1844 | } | 1838 | } |
1845 | 1839 | ||
1846 | static void accumulate_steal_time(struct kvm_vcpu *vcpu) | 1840 | static void accumulate_steal_time(struct kvm_vcpu *vcpu) |
@@ -1947,6 +1941,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1947 | break; | 1941 | break; |
1948 | case MSR_KVM_SYSTEM_TIME_NEW: | 1942 | case MSR_KVM_SYSTEM_TIME_NEW: |
1949 | case MSR_KVM_SYSTEM_TIME: { | 1943 | case MSR_KVM_SYSTEM_TIME: { |
1944 | u64 gpa_offset; | ||
1950 | kvmclock_reset(vcpu); | 1945 | kvmclock_reset(vcpu); |
1951 | 1946 | ||
1952 | vcpu->arch.time = data; | 1947 | vcpu->arch.time = data; |
@@ -1956,14 +1951,14 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1956 | if (!(data & 1)) | 1951 | if (!(data & 1)) |
1957 | break; | 1952 | break; |
1958 | 1953 | ||
1959 | /* ...but clean it before doing the actual write */ | 1954 | gpa_offset = data & ~(PAGE_MASK | 1); |
1960 | vcpu->arch.time_offset = data & ~(PAGE_MASK | 1); | ||
1961 | |||
1962 | vcpu->arch.time_page = | ||
1963 | gfn_to_page(vcpu->kvm, data >> PAGE_SHIFT); | ||
1964 | 1955 | ||
1965 | if (is_error_page(vcpu->arch.time_page)) | 1956 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, |
1966 | vcpu->arch.time_page = NULL; | 1957 | &vcpu->arch.pv_time, data & ~1ULL, |
1958 | sizeof(struct pvclock_vcpu_time_info))) | ||
1959 | vcpu->arch.pv_time_enabled = false; | ||
1960 | else | ||
1961 | vcpu->arch.pv_time_enabled = true; | ||
1967 | 1962 | ||
1968 | break; | 1963 | break; |
1969 | } | 1964 | } |
@@ -1980,7 +1975,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
1980 | return 1; | 1975 | return 1; |
1981 | 1976 | ||
1982 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime, | 1977 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, &vcpu->arch.st.stime, |
1983 | data & KVM_STEAL_VALID_BITS)) | 1978 | data & KVM_STEAL_VALID_BITS, |
1979 | sizeof(struct kvm_steal_time))) | ||
1984 | return 1; | 1980 | return 1; |
1985 | 1981 | ||
1986 | vcpu->arch.st.msr_val = data; | 1982 | vcpu->arch.st.msr_val = data; |
@@ -2967,7 +2963,7 @@ static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu, | |||
2967 | */ | 2963 | */ |
2968 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) | 2964 | static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) |
2969 | { | 2965 | { |
2970 | if (!vcpu->arch.time_page) | 2966 | if (!vcpu->arch.pv_time_enabled) |
2971 | return -EINVAL; | 2967 | return -EINVAL; |
2972 | vcpu->arch.pvclock_set_guest_stopped_request = true; | 2968 | vcpu->arch.pvclock_set_guest_stopped_request = true; |
2973 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); | 2969 | kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); |
@@ -6718,6 +6714,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
6718 | goto fail_free_wbinvd_dirty_mask; | 6714 | goto fail_free_wbinvd_dirty_mask; |
6719 | 6715 | ||
6720 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; | 6716 | vcpu->arch.ia32_tsc_adjust_msr = 0x0; |
6717 | vcpu->arch.pv_time_enabled = false; | ||
6721 | kvm_async_pf_hash_reset(vcpu); | 6718 | kvm_async_pf_hash_reset(vcpu); |
6722 | kvm_pmu_init(vcpu); | 6719 | kvm_pmu_init(vcpu); |
6723 | 6720 | ||
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 1cbd89ca5569..7114c63f047d 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -1334,6 +1334,7 @@ __init void lguest_init(void) | |||
1334 | pv_mmu_ops.read_cr3 = lguest_read_cr3; | 1334 | pv_mmu_ops.read_cr3 = lguest_read_cr3; |
1335 | pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu; | 1335 | pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu; |
1336 | pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mmu_mode; | 1336 | pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mmu_mode; |
1337 | pv_mmu_ops.lazy_mode.flush = paravirt_flush_lazy_mmu; | ||
1337 | pv_mmu_ops.pte_update = lguest_pte_update; | 1338 | pv_mmu_ops.pte_update = lguest_pte_update; |
1338 | pv_mmu_ops.pte_update_defer = lguest_pte_update; | 1339 | pv_mmu_ops.pte_update_defer = lguest_pte_update; |
1339 | 1340 | ||
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c index 05928aae911e..906fea315791 100644 --- a/arch/x86/lib/usercopy_64.c +++ b/arch/x86/lib/usercopy_64.c | |||
@@ -74,10 +74,10 @@ copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest) | |||
74 | char c; | 74 | char c; |
75 | unsigned zero_len; | 75 | unsigned zero_len; |
76 | 76 | ||
77 | for (; len; --len) { | 77 | for (; len; --len, to++) { |
78 | if (__get_user_nocheck(c, from++, sizeof(char))) | 78 | if (__get_user_nocheck(c, from++, sizeof(char))) |
79 | break; | 79 | break; |
80 | if (__put_user_nocheck(c, to++, sizeof(char))) | 80 | if (__put_user_nocheck(c, to, sizeof(char))) |
81 | break; | 81 | break; |
82 | } | 82 | } |
83 | 83 | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 2b97525246d4..0e883364abb5 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -378,10 +378,12 @@ static noinline __kprobes int vmalloc_fault(unsigned long address) | |||
378 | if (pgd_none(*pgd_ref)) | 378 | if (pgd_none(*pgd_ref)) |
379 | return -1; | 379 | return -1; |
380 | 380 | ||
381 | if (pgd_none(*pgd)) | 381 | if (pgd_none(*pgd)) { |
382 | set_pgd(pgd, *pgd_ref); | 382 | set_pgd(pgd, *pgd_ref); |
383 | else | 383 | arch_flush_lazy_mmu_mode(); |
384 | } else { | ||
384 | BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); | 385 | BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref)); |
386 | } | ||
385 | 387 | ||
386 | /* | 388 | /* |
387 | * Below here mismatches are bugs because these lower tables | 389 | * Below here mismatches are bugs because these lower tables |
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index b0086567271c..0e38951e65eb 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c | |||
@@ -68,7 +68,7 @@ static int print_split(struct split_state *s) | |||
68 | s->gpg++; | 68 | s->gpg++; |
69 | i += GPS/PAGE_SIZE; | 69 | i += GPS/PAGE_SIZE; |
70 | } else if (level == PG_LEVEL_2M) { | 70 | } else if (level == PG_LEVEL_2M) { |
71 | if (!(pte_val(*pte) & _PAGE_PSE)) { | 71 | if ((pte_val(*pte) & _PAGE_PRESENT) && !(pte_val(*pte) & _PAGE_PSE)) { |
72 | printk(KERN_ERR | 72 | printk(KERN_ERR |
73 | "%lx level %d but not PSE %Lx\n", | 73 | "%lx level %d but not PSE %Lx\n", |
74 | addr, level, (u64)pte_val(*pte)); | 74 | addr, level, (u64)pte_val(*pte)); |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 091934e1d0d9..fb4e73ec24d8 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -467,7 +467,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
467 | * We are safe now. Check whether the new pgprot is the same: | 467 | * We are safe now. Check whether the new pgprot is the same: |
468 | */ | 468 | */ |
469 | old_pte = *kpte; | 469 | old_pte = *kpte; |
470 | old_prot = new_prot = req_prot = pte_pgprot(old_pte); | 470 | old_prot = req_prot = pte_pgprot(old_pte); |
471 | 471 | ||
472 | pgprot_val(req_prot) &= ~pgprot_val(cpa->mask_clr); | 472 | pgprot_val(req_prot) &= ~pgprot_val(cpa->mask_clr); |
473 | pgprot_val(req_prot) |= pgprot_val(cpa->mask_set); | 473 | pgprot_val(req_prot) |= pgprot_val(cpa->mask_set); |
@@ -478,12 +478,12 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
478 | * a non present pmd. The canon_pgprot will clear _PAGE_GLOBAL | 478 | * a non present pmd. The canon_pgprot will clear _PAGE_GLOBAL |
479 | * for the ancient hardware that doesn't support it. | 479 | * for the ancient hardware that doesn't support it. |
480 | */ | 480 | */ |
481 | if (pgprot_val(new_prot) & _PAGE_PRESENT) | 481 | if (pgprot_val(req_prot) & _PAGE_PRESENT) |
482 | pgprot_val(new_prot) |= _PAGE_PSE | _PAGE_GLOBAL; | 482 | pgprot_val(req_prot) |= _PAGE_PSE | _PAGE_GLOBAL; |
483 | else | 483 | else |
484 | pgprot_val(new_prot) &= ~(_PAGE_PSE | _PAGE_GLOBAL); | 484 | pgprot_val(req_prot) &= ~(_PAGE_PSE | _PAGE_GLOBAL); |
485 | 485 | ||
486 | new_prot = canon_pgprot(new_prot); | 486 | req_prot = canon_pgprot(req_prot); |
487 | 487 | ||
488 | /* | 488 | /* |
489 | * old_pte points to the large page base address. So we need | 489 | * old_pte points to the large page base address. So we need |
@@ -1413,6 +1413,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
1413 | * but that can deadlock->flush only current cpu: | 1413 | * but that can deadlock->flush only current cpu: |
1414 | */ | 1414 | */ |
1415 | __flush_tlb_all(); | 1415 | __flush_tlb_all(); |
1416 | |||
1417 | arch_flush_lazy_mmu_mode(); | ||
1416 | } | 1418 | } |
1417 | 1419 | ||
1418 | #ifdef CONFIG_HIBERNATION | 1420 | #ifdef CONFIG_HIBERNATION |
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 193350b51f90..17fda6a8b3c2 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
@@ -58,6 +58,13 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) | |||
58 | void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) | 58 | void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) |
59 | { | 59 | { |
60 | paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); | 60 | paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT); |
61 | /* | ||
62 | * NOTE! For PAE, any changes to the top page-directory-pointer-table | ||
63 | * entries need a full cr3 reload to flush. | ||
64 | */ | ||
65 | #ifdef CONFIG_X86_PAE | ||
66 | tlb->need_flush_all = 1; | ||
67 | #endif | ||
61 | tlb_remove_page(tlb, virt_to_page(pmd)); | 68 | tlb_remove_page(tlb, virt_to_page(pmd)); |
62 | } | 69 | } |
63 | 70 | ||
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 28d9efacc9b6..b55d174e5034 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/io.h> | 41 | #include <linux/io.h> |
42 | #include <linux/reboot.h> | 42 | #include <linux/reboot.h> |
43 | #include <linux/bcd.h> | 43 | #include <linux/bcd.h> |
44 | #include <linux/ucs2_string.h> | ||
44 | 45 | ||
45 | #include <asm/setup.h> | 46 | #include <asm/setup.h> |
46 | #include <asm/efi.h> | 47 | #include <asm/efi.h> |
@@ -52,6 +53,13 @@ | |||
52 | 53 | ||
53 | #define EFI_DEBUG 1 | 54 | #define EFI_DEBUG 1 |
54 | 55 | ||
56 | /* | ||
57 | * There's some additional metadata associated with each | ||
58 | * variable. Intel's reference implementation is 60 bytes - bump that | ||
59 | * to account for potential alignment constraints | ||
60 | */ | ||
61 | #define VAR_METADATA_SIZE 64 | ||
62 | |||
55 | struct efi __read_mostly efi = { | 63 | struct efi __read_mostly efi = { |
56 | .mps = EFI_INVALID_TABLE_ADDR, | 64 | .mps = EFI_INVALID_TABLE_ADDR, |
57 | .acpi = EFI_INVALID_TABLE_ADDR, | 65 | .acpi = EFI_INVALID_TABLE_ADDR, |
@@ -70,6 +78,13 @@ struct efi_memory_map memmap; | |||
70 | static struct efi efi_phys __initdata; | 78 | static struct efi efi_phys __initdata; |
71 | static efi_system_table_t efi_systab __initdata; | 79 | static efi_system_table_t efi_systab __initdata; |
72 | 80 | ||
81 | static u64 efi_var_store_size; | ||
82 | static u64 efi_var_remaining_size; | ||
83 | static u64 efi_var_max_var_size; | ||
84 | static u64 boot_used_size; | ||
85 | static u64 boot_var_size; | ||
86 | static u64 active_size; | ||
87 | |||
73 | unsigned long x86_efi_facility; | 88 | unsigned long x86_efi_facility; |
74 | 89 | ||
75 | /* | 90 | /* |
@@ -99,6 +114,15 @@ static int __init setup_add_efi_memmap(char *arg) | |||
99 | } | 114 | } |
100 | early_param("add_efi_memmap", setup_add_efi_memmap); | 115 | early_param("add_efi_memmap", setup_add_efi_memmap); |
101 | 116 | ||
117 | static bool efi_no_storage_paranoia; | ||
118 | |||
119 | static int __init setup_storage_paranoia(char *arg) | ||
120 | { | ||
121 | efi_no_storage_paranoia = true; | ||
122 | return 0; | ||
123 | } | ||
124 | early_param("efi_no_storage_paranoia", setup_storage_paranoia); | ||
125 | |||
102 | 126 | ||
103 | static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) | 127 | static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) |
104 | { | 128 | { |
@@ -163,8 +187,53 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size, | |||
163 | efi_char16_t *name, | 187 | efi_char16_t *name, |
164 | efi_guid_t *vendor) | 188 | efi_guid_t *vendor) |
165 | { | 189 | { |
166 | return efi_call_virt3(get_next_variable, | 190 | efi_status_t status; |
167 | name_size, name, vendor); | 191 | static bool finished = false; |
192 | static u64 var_size; | ||
193 | |||
194 | status = efi_call_virt3(get_next_variable, | ||
195 | name_size, name, vendor); | ||
196 | |||
197 | if (status == EFI_NOT_FOUND) { | ||
198 | finished = true; | ||
199 | if (var_size < boot_used_size) { | ||
200 | boot_var_size = boot_used_size - var_size; | ||
201 | active_size += boot_var_size; | ||
202 | } else { | ||
203 | printk(KERN_WARNING FW_BUG "efi: Inconsistent initial sizes\n"); | ||
204 | } | ||
205 | } | ||
206 | |||
207 | if (boot_used_size && !finished) { | ||
208 | unsigned long size; | ||
209 | u32 attr; | ||
210 | efi_status_t s; | ||
211 | void *tmp; | ||
212 | |||
213 | s = virt_efi_get_variable(name, vendor, &attr, &size, NULL); | ||
214 | |||
215 | if (s != EFI_BUFFER_TOO_SMALL || !size) | ||
216 | return status; | ||
217 | |||
218 | tmp = kmalloc(size, GFP_ATOMIC); | ||
219 | |||
220 | if (!tmp) | ||
221 | return status; | ||
222 | |||
223 | s = virt_efi_get_variable(name, vendor, &attr, &size, tmp); | ||
224 | |||
225 | if (s == EFI_SUCCESS && (attr & EFI_VARIABLE_NON_VOLATILE)) { | ||
226 | var_size += size; | ||
227 | var_size += ucs2_strsize(name, 1024); | ||
228 | active_size += size; | ||
229 | active_size += VAR_METADATA_SIZE; | ||
230 | active_size += ucs2_strsize(name, 1024); | ||
231 | } | ||
232 | |||
233 | kfree(tmp); | ||
234 | } | ||
235 | |||
236 | return status; | ||
168 | } | 237 | } |
169 | 238 | ||
170 | static efi_status_t virt_efi_set_variable(efi_char16_t *name, | 239 | static efi_status_t virt_efi_set_variable(efi_char16_t *name, |
@@ -173,9 +242,34 @@ static efi_status_t virt_efi_set_variable(efi_char16_t *name, | |||
173 | unsigned long data_size, | 242 | unsigned long data_size, |
174 | void *data) | 243 | void *data) |
175 | { | 244 | { |
176 | return efi_call_virt5(set_variable, | 245 | efi_status_t status; |
177 | name, vendor, attr, | 246 | u32 orig_attr = 0; |
178 | data_size, data); | 247 | unsigned long orig_size = 0; |
248 | |||
249 | status = virt_efi_get_variable(name, vendor, &orig_attr, &orig_size, | ||
250 | NULL); | ||
251 | |||
252 | if (status != EFI_BUFFER_TOO_SMALL) | ||
253 | orig_size = 0; | ||
254 | |||
255 | status = efi_call_virt5(set_variable, | ||
256 | name, vendor, attr, | ||
257 | data_size, data); | ||
258 | |||
259 | if (status == EFI_SUCCESS) { | ||
260 | if (orig_size) { | ||
261 | active_size -= orig_size; | ||
262 | active_size -= ucs2_strsize(name, 1024); | ||
263 | active_size -= VAR_METADATA_SIZE; | ||
264 | } | ||
265 | if (data_size) { | ||
266 | active_size += data_size; | ||
267 | active_size += ucs2_strsize(name, 1024); | ||
268 | active_size += VAR_METADATA_SIZE; | ||
269 | } | ||
270 | } | ||
271 | |||
272 | return status; | ||
179 | } | 273 | } |
180 | 274 | ||
181 | static efi_status_t virt_efi_query_variable_info(u32 attr, | 275 | static efi_status_t virt_efi_query_variable_info(u32 attr, |
@@ -690,6 +784,9 @@ void __init efi_init(void) | |||
690 | char vendor[100] = "unknown"; | 784 | char vendor[100] = "unknown"; |
691 | int i = 0; | 785 | int i = 0; |
692 | void *tmp; | 786 | void *tmp; |
787 | struct setup_data *data; | ||
788 | struct efi_var_bootdata *efi_var_data; | ||
789 | u64 pa_data; | ||
693 | 790 | ||
694 | #ifdef CONFIG_X86_32 | 791 | #ifdef CONFIG_X86_32 |
695 | if (boot_params.efi_info.efi_systab_hi || | 792 | if (boot_params.efi_info.efi_systab_hi || |
@@ -707,6 +804,22 @@ void __init efi_init(void) | |||
707 | if (efi_systab_init(efi_phys.systab)) | 804 | if (efi_systab_init(efi_phys.systab)) |
708 | return; | 805 | return; |
709 | 806 | ||
807 | pa_data = boot_params.hdr.setup_data; | ||
808 | while (pa_data) { | ||
809 | data = early_ioremap(pa_data, sizeof(*efi_var_data)); | ||
810 | if (data->type == SETUP_EFI_VARS) { | ||
811 | efi_var_data = (struct efi_var_bootdata *)data; | ||
812 | |||
813 | efi_var_store_size = efi_var_data->store_size; | ||
814 | efi_var_remaining_size = efi_var_data->remaining_size; | ||
815 | efi_var_max_var_size = efi_var_data->max_var_size; | ||
816 | } | ||
817 | pa_data = data->next; | ||
818 | early_iounmap(data, sizeof(*efi_var_data)); | ||
819 | } | ||
820 | |||
821 | boot_used_size = efi_var_store_size - efi_var_remaining_size; | ||
822 | |||
710 | set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); | 823 | set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); |
711 | 824 | ||
712 | /* | 825 | /* |
@@ -1007,3 +1120,48 @@ u64 efi_mem_attributes(unsigned long phys_addr) | |||
1007 | } | 1120 | } |
1008 | return 0; | 1121 | return 0; |
1009 | } | 1122 | } |
1123 | |||
1124 | /* | ||
1125 | * Some firmware has serious problems when using more than 50% of the EFI | ||
1126 | * variable store, i.e. it triggers bugs that can brick machines. Ensure that | ||
1127 | * we never use more than this safe limit. | ||
1128 | * | ||
1129 | * Return EFI_SUCCESS if it is safe to write 'size' bytes to the variable | ||
1130 | * store. | ||
1131 | */ | ||
1132 | efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) | ||
1133 | { | ||
1134 | efi_status_t status; | ||
1135 | u64 storage_size, remaining_size, max_size; | ||
1136 | |||
1137 | status = efi.query_variable_info(attributes, &storage_size, | ||
1138 | &remaining_size, &max_size); | ||
1139 | if (status != EFI_SUCCESS) | ||
1140 | return status; | ||
1141 | |||
1142 | if (!max_size && remaining_size > size) | ||
1143 | printk_once(KERN_ERR FW_BUG "Broken EFI implementation" | ||
1144 | " is returning MaxVariableSize=0\n"); | ||
1145 | /* | ||
1146 | * Some firmware implementations refuse to boot if there's insufficient | ||
1147 | * space in the variable store. We account for that by refusing the | ||
1148 | * write if permitting it would reduce the available space to under | ||
1149 | * 50%. However, some firmware won't reclaim variable space until | ||
1150 | * after the used (not merely the actively used) space drops below | ||
1151 | * a threshold. We can approximate that case with the value calculated | ||
1152 | * above. If both the firmware and our calculations indicate that the | ||
1153 | * available space would drop below 50%, refuse the write. | ||
1154 | */ | ||
1155 | |||
1156 | if (!storage_size || size > remaining_size || | ||
1157 | (max_size && size > max_size)) | ||
1158 | return EFI_OUT_OF_RESOURCES; | ||
1159 | |||
1160 | if (!efi_no_storage_paranoia && | ||
1161 | ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) && | ||
1162 | (remaining_size - size < storage_size / 2))) | ||
1163 | return EFI_OUT_OF_RESOURCES; | ||
1164 | |||
1165 | return EFI_SUCCESS; | ||
1166 | } | ||
1167 | EXPORT_SYMBOL_GPL(efi_query_variable_store); | ||
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c index 120cee1c3f8d..3c68768d7a75 100644 --- a/arch/x86/power/cpu.c +++ b/arch/x86/power/cpu.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/suspend.h> | 11 | #include <linux/suspend.h> |
12 | #include <linux/export.h> | 12 | #include <linux/export.h> |
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | #include <linux/perf_event.h> | ||
14 | 15 | ||
15 | #include <asm/pgtable.h> | 16 | #include <asm/pgtable.h> |
16 | #include <asm/proto.h> | 17 | #include <asm/proto.h> |
@@ -228,6 +229,7 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
228 | do_fpu_end(); | 229 | do_fpu_end(); |
229 | x86_platform.restore_sched_clock_state(); | 230 | x86_platform.restore_sched_clock_state(); |
230 | mtrr_bp_restore(); | 231 | mtrr_bp_restore(); |
232 | perf_restore_debug_store(); | ||
231 | } | 233 | } |
232 | 234 | ||
233 | /* Needed by apm.c */ | 235 | /* Needed by apm.c */ |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index e8e34938c57d..e006c18d288a 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1467,8 +1467,6 @@ static void __init xen_write_cr3_init(unsigned long cr3) | |||
1467 | __xen_write_cr3(true, cr3); | 1467 | __xen_write_cr3(true, cr3); |
1468 | 1468 | ||
1469 | xen_mc_issue(PARAVIRT_LAZY_CPU); /* interrupts restored */ | 1469 | xen_mc_issue(PARAVIRT_LAZY_CPU); /* interrupts restored */ |
1470 | |||
1471 | pv_mmu_ops.write_cr3 = &xen_write_cr3; | ||
1472 | } | 1470 | } |
1473 | #endif | 1471 | #endif |
1474 | 1472 | ||
@@ -1750,14 +1748,18 @@ static void *m2v(phys_addr_t maddr) | |||
1750 | } | 1748 | } |
1751 | 1749 | ||
1752 | /* Set the page permissions on an identity-mapped pages */ | 1750 | /* Set the page permissions on an identity-mapped pages */ |
1753 | static void set_page_prot(void *addr, pgprot_t prot) | 1751 | static void set_page_prot_flags(void *addr, pgprot_t prot, unsigned long flags) |
1754 | { | 1752 | { |
1755 | unsigned long pfn = __pa(addr) >> PAGE_SHIFT; | 1753 | unsigned long pfn = __pa(addr) >> PAGE_SHIFT; |
1756 | pte_t pte = pfn_pte(pfn, prot); | 1754 | pte_t pte = pfn_pte(pfn, prot); |
1757 | 1755 | ||
1758 | if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, 0)) | 1756 | if (HYPERVISOR_update_va_mapping((unsigned long)addr, pte, flags)) |
1759 | BUG(); | 1757 | BUG(); |
1760 | } | 1758 | } |
1759 | static void set_page_prot(void *addr, pgprot_t prot) | ||
1760 | { | ||
1761 | return set_page_prot_flags(addr, prot, UVMF_NONE); | ||
1762 | } | ||
1761 | #ifdef CONFIG_X86_32 | 1763 | #ifdef CONFIG_X86_32 |
1762 | static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) | 1764 | static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) |
1763 | { | 1765 | { |
@@ -1841,12 +1843,12 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end, | |||
1841 | unsigned long addr) | 1843 | unsigned long addr) |
1842 | { | 1844 | { |
1843 | if (*pt_base == PFN_DOWN(__pa(addr))) { | 1845 | if (*pt_base == PFN_DOWN(__pa(addr))) { |
1844 | set_page_prot((void *)addr, PAGE_KERNEL); | 1846 | set_page_prot_flags((void *)addr, PAGE_KERNEL, UVMF_INVLPG); |
1845 | clear_page((void *)addr); | 1847 | clear_page((void *)addr); |
1846 | (*pt_base)++; | 1848 | (*pt_base)++; |
1847 | } | 1849 | } |
1848 | if (*pt_end == PFN_DOWN(__pa(addr))) { | 1850 | if (*pt_end == PFN_DOWN(__pa(addr))) { |
1849 | set_page_prot((void *)addr, PAGE_KERNEL); | 1851 | set_page_prot_flags((void *)addr, PAGE_KERNEL, UVMF_INVLPG); |
1850 | clear_page((void *)addr); | 1852 | clear_page((void *)addr); |
1851 | (*pt_end)--; | 1853 | (*pt_end)--; |
1852 | } | 1854 | } |
@@ -2122,6 +2124,7 @@ static void __init xen_post_allocator_init(void) | |||
2122 | #endif | 2124 | #endif |
2123 | 2125 | ||
2124 | #ifdef CONFIG_X86_64 | 2126 | #ifdef CONFIG_X86_64 |
2127 | pv_mmu_ops.write_cr3 = &xen_write_cr3; | ||
2125 | SetPagePinned(virt_to_page(level3_user_vsyscall)); | 2128 | SetPagePinned(virt_to_page(level3_user_vsyscall)); |
2126 | #endif | 2129 | #endif |
2127 | xen_mark_init_mm_pinned(); | 2130 | xen_mark_init_mm_pinned(); |
@@ -2197,6 +2200,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = { | |||
2197 | .lazy_mode = { | 2200 | .lazy_mode = { |
2198 | .enter = paravirt_enter_lazy_mmu, | 2201 | .enter = paravirt_enter_lazy_mmu, |
2199 | .leave = xen_leave_lazy_mmu, | 2202 | .leave = xen_leave_lazy_mmu, |
2203 | .flush = paravirt_flush_lazy_mmu, | ||
2200 | }, | 2204 | }, |
2201 | 2205 | ||
2202 | .set_fixmap = xen_set_fixmap, | 2206 | .set_fixmap = xen_set_fixmap, |