aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/Kbuild4
-rw-r--r--arch/x86/Kconfig19
-rw-r--r--arch/x86/Makefile6
-rw-r--r--arch/x86/boot/compressed/Makefile3
-rw-r--r--arch/x86/boot/compressed/aslr.c15
-rw-r--r--arch/x86/boot/compressed/eboot.c62
-rw-r--r--arch/x86/boot/compressed/eboot.h16
-rw-r--r--arch/x86/crypto/aesni-intel_glue.c4
-rw-r--r--arch/x86/include/asm/bitops.h2
-rw-r--r--arch/x86/include/asm/efi.h24
-rw-r--r--arch/x86/include/asm/fixmap.h6
-rw-r--r--arch/x86/include/asm/io_apic.h3
-rw-r--r--arch/x86/include/asm/kvm_host.h2
-rw-r--r--arch/x86/include/asm/pgtable.h9
-rw-r--r--arch/x86/include/asm/pgtable_64.h1
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/apic/io_apic.c27
-rw-r--r--arch/x86/kernel/crash.c6
-rw-r--r--arch/x86/kernel/entry_32.S2
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/kprobes/opt.c4
-rw-r--r--arch/x86/kernel/machine_kexec_64.c11
-rw-r--r--arch/x86/kernel/smpboot.c3
-rw-r--r--arch/x86/kernel/time.c2
-rw-r--r--arch/x86/kvm/emulate.c11
-rw-r--r--arch/x86/mm/dump_pagetables.c4
-rw-r--r--arch/x86/mm/mmap.c2
-rw-r--r--arch/x86/mm/tlb.c10
-rw-r--r--arch/x86/pci/fixup.c24
-rw-r--r--arch/x86/pci/intel_mid_pci.c2
-rw-r--r--arch/x86/pci/irq.c2
-rw-r--r--arch/x86/purgatory/Makefile6
-rw-r--r--arch/x86/xen/mmu.c27
33 files changed, 188 insertions, 135 deletions
diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index 61b6d51866f8..3942f74c92d7 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -17,6 +17,4 @@ obj-$(CONFIG_IA32_EMULATION) += ia32/
17obj-y += platform/ 17obj-y += platform/
18obj-y += net/ 18obj-y += net/
19 19
20ifeq ($(CONFIG_X86_64),y) 20obj-$(CONFIG_KEXEC_FILE) += purgatory/
21obj-$(CONFIG_KEXEC) += purgatory/
22endif
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a11f27c4266a..e4b1f431c7ed 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -23,6 +23,7 @@ config X86
23 def_bool y 23 def_bool y
24 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI 24 select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI
25 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS 25 select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
26 select ARCH_HAS_FAST_MULTIPLIER
26 select ARCH_MIGHT_HAVE_PC_PARPORT 27 select ARCH_MIGHT_HAVE_PC_PARPORT
27 select ARCH_MIGHT_HAVE_PC_SERIO 28 select ARCH_MIGHT_HAVE_PC_SERIO
28 select HAVE_AOUT if X86_32 29 select HAVE_AOUT if X86_32
@@ -1597,9 +1598,6 @@ source kernel/Kconfig.hz
1597 1598
1598config KEXEC 1599config KEXEC
1599 bool "kexec system call" 1600 bool "kexec system call"
1600 select BUILD_BIN2C
1601 select CRYPTO
1602 select CRYPTO_SHA256
1603 ---help--- 1601 ---help---
1604 kexec is a system call that implements the ability to shutdown your 1602 kexec is a system call that implements the ability to shutdown your
1605 current kernel, and to start another kernel. It is like a reboot 1603 current kernel, and to start another kernel. It is like a reboot
@@ -1614,9 +1612,22 @@ config KEXEC
1614 interface is strongly in flux, so no good recommendation can be 1612 interface is strongly in flux, so no good recommendation can be
1615 made. 1613 made.
1616 1614
1615config KEXEC_FILE
1616 bool "kexec file based system call"
1617 select BUILD_BIN2C
1618 depends on KEXEC
1619 depends on X86_64
1620 depends on CRYPTO=y
1621 depends on CRYPTO_SHA256=y
1622 ---help---
1623 This is new version of kexec system call. This system call is
1624 file based and takes file descriptors as system call argument
1625 for kernel and initramfs as opposed to list of segments as
1626 accepted by previous system call.
1627
1617config KEXEC_VERIFY_SIG 1628config KEXEC_VERIFY_SIG
1618 bool "Verify kernel signature during kexec_file_load() syscall" 1629 bool "Verify kernel signature during kexec_file_load() syscall"
1619 depends on KEXEC 1630 depends on KEXEC_FILE
1620 ---help--- 1631 ---help---
1621 This option makes kernel signature verification mandatory for 1632 This option makes kernel signature verification mandatory for
1622 kexec_file_load() syscall. If kernel is signature can not be 1633 kexec_file_load() syscall. If kernel is signature can not be
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 7705b6f921ac..5692d6ac0f18 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -184,11 +184,8 @@ archheaders:
184 $(Q)$(MAKE) $(build)=arch/x86/syscalls all 184 $(Q)$(MAKE) $(build)=arch/x86/syscalls all
185 185
186archprepare: 186archprepare:
187ifeq ($(CONFIG_KEXEC),y) 187ifeq ($(CONFIG_KEXEC_FILE),y)
188# Build only for 64bit. No loaders for 32bit yet.
189 ifeq ($(CONFIG_X86_64),y)
190 $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c 188 $(Q)$(MAKE) $(build)=arch/x86/purgatory arch/x86/purgatory/kexec-purgatory.c
191 endif
192endif 189endif
193 190
194### 191###
@@ -254,6 +251,7 @@ archclean:
254 $(Q)rm -rf $(objtree)/arch/x86_64 251 $(Q)rm -rf $(objtree)/arch/x86_64
255 $(Q)$(MAKE) $(clean)=$(boot) 252 $(Q)$(MAKE) $(clean)=$(boot)
256 $(Q)$(MAKE) $(clean)=arch/x86/tools 253 $(Q)$(MAKE) $(clean)=arch/x86/tools
254 $(Q)$(MAKE) $(clean)=arch/x86/purgatory
257 255
258define archhelp 256define archhelp
259 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' 257 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 20db5b3609de..704f58aa79cd 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -35,8 +35,7 @@ vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
35 35
36$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 36$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
37 37
38vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \ 38vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
39 $(objtree)/drivers/firmware/efi/libstub/lib.a
40 39
41$(obj)/vmlinux: $(vmlinux-objs-y) FORCE 40$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
42 $(call if_changed,ld) 41 $(call if_changed,ld)
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c
index 913c999b0045..7c68808edeb7 100644
--- a/arch/x86/boot/compressed/aslr.c
+++ b/arch/x86/boot/compressed/aslr.c
@@ -182,12 +182,27 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size,
182static bool mem_avoid_overlap(struct mem_vector *img) 182static bool mem_avoid_overlap(struct mem_vector *img)
183{ 183{
184 int i; 184 int i;
185 struct setup_data *ptr;
185 186
186 for (i = 0; i < MEM_AVOID_MAX; i++) { 187 for (i = 0; i < MEM_AVOID_MAX; i++) {
187 if (mem_overlaps(img, &mem_avoid[i])) 188 if (mem_overlaps(img, &mem_avoid[i]))
188 return true; 189 return true;
189 } 190 }
190 191
192 /* Avoid all entries in the setup_data linked list. */
193 ptr = (struct setup_data *)(unsigned long)real_mode->hdr.setup_data;
194 while (ptr) {
195 struct mem_vector avoid;
196
197 avoid.start = (u64)ptr;
198 avoid.size = sizeof(*ptr) + ptr->len;
199
200 if (mem_overlaps(img, &avoid))
201 return true;
202
203 ptr = (struct setup_data *)(unsigned long)ptr->next;
204 }
205
191 return false; 206 return false;
192} 207}
193 208
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index f277184e2ac1..de8eebd6f67c 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,7 +19,10 @@
19 19
20static efi_system_table_t *sys_table; 20static efi_system_table_t *sys_table;
21 21
22struct efi_config *efi_early; 22static struct efi_config *efi_early;
23
24#define efi_call_early(f, ...) \
25 efi_early->call(efi_early->f, __VA_ARGS__);
23 26
24#define BOOT_SERVICES(bits) \ 27#define BOOT_SERVICES(bits) \
25static void setup_boot_services##bits(struct efi_config *c) \ 28static void setup_boot_services##bits(struct efi_config *c) \
@@ -265,21 +268,25 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
265 268
266 offset = offsetof(typeof(*out), output_string); 269 offset = offsetof(typeof(*out), output_string);
267 output_string = efi_early->text_output + offset; 270 output_string = efi_early->text_output + offset;
271 out = (typeof(out))(unsigned long)efi_early->text_output;
268 func = (u64 *)output_string; 272 func = (u64 *)output_string;
269 273
270 efi_early->call(*func, efi_early->text_output, str); 274 efi_early->call(*func, out, str);
271 } else { 275 } else {
272 struct efi_simple_text_output_protocol_32 *out; 276 struct efi_simple_text_output_protocol_32 *out;
273 u32 *func; 277 u32 *func;
274 278
275 offset = offsetof(typeof(*out), output_string); 279 offset = offsetof(typeof(*out), output_string);
276 output_string = efi_early->text_output + offset; 280 output_string = efi_early->text_output + offset;
281 out = (typeof(out))(unsigned long)efi_early->text_output;
277 func = (u32 *)output_string; 282 func = (u32 *)output_string;
278 283
279 efi_early->call(*func, efi_early->text_output, str); 284 efi_early->call(*func, out, str);
280 } 285 }
281} 286}
282 287
288#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c"
289
283static void find_bits(unsigned long mask, u8 *pos, u8 *size) 290static void find_bits(unsigned long mask, u8 *pos, u8 *size)
284{ 291{
285 u8 first, len; 292 u8 first, len;
@@ -360,7 +367,7 @@ free_struct:
360 return status; 367 return status;
361} 368}
362 369
363static efi_status_t 370static void
364setup_efi_pci32(struct boot_params *params, void **pci_handle, 371setup_efi_pci32(struct boot_params *params, void **pci_handle,
365 unsigned long size) 372 unsigned long size)
366{ 373{
@@ -403,8 +410,6 @@ setup_efi_pci32(struct boot_params *params, void **pci_handle,
403 data = (struct setup_data *)rom; 410 data = (struct setup_data *)rom;
404 411
405 } 412 }
406
407 return status;
408} 413}
409 414
410static efi_status_t 415static efi_status_t
@@ -463,7 +468,7 @@ free_struct:
463 468
464} 469}
465 470
466static efi_status_t 471static void
467setup_efi_pci64(struct boot_params *params, void **pci_handle, 472setup_efi_pci64(struct boot_params *params, void **pci_handle,
468 unsigned long size) 473 unsigned long size)
469{ 474{
@@ -506,11 +511,18 @@ setup_efi_pci64(struct boot_params *params, void **pci_handle,
506 data = (struct setup_data *)rom; 511 data = (struct setup_data *)rom;
507 512
508 } 513 }
509
510 return status;
511} 514}
512 515
513static efi_status_t setup_efi_pci(struct boot_params *params) 516/*
517 * There's no way to return an informative status from this function,
518 * because any analysis (and printing of error messages) needs to be
519 * done directly at the EFI function call-site.
520 *
521 * For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we
522 * just didn't find any PCI devices, but there's no way to tell outside
523 * the context of the call.
524 */
525static void setup_efi_pci(struct boot_params *params)
514{ 526{
515 efi_status_t status; 527 efi_status_t status;
516 void **pci_handle = NULL; 528 void **pci_handle = NULL;
@@ -527,7 +539,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
527 size, (void **)&pci_handle); 539 size, (void **)&pci_handle);
528 540
529 if (status != EFI_SUCCESS) 541 if (status != EFI_SUCCESS)
530 return status; 542 return;
531 543
532 status = efi_call_early(locate_handle, 544 status = efi_call_early(locate_handle,
533 EFI_LOCATE_BY_PROTOCOL, &pci_proto, 545 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
@@ -538,13 +550,12 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
538 goto free_handle; 550 goto free_handle;
539 551
540 if (efi_early->is64) 552 if (efi_early->is64)
541 status = setup_efi_pci64(params, pci_handle, size); 553 setup_efi_pci64(params, pci_handle, size);
542 else 554 else
543 status = setup_efi_pci32(params, pci_handle, size); 555 setup_efi_pci32(params, pci_handle, size);
544 556
545free_handle: 557free_handle:
546 efi_call_early(free_pool, pci_handle); 558 efi_call_early(free_pool, pci_handle);
547 return status;
548} 559}
549 560
550static void 561static void
@@ -1032,7 +1043,6 @@ struct boot_params *make_boot_params(struct efi_config *c)
1032 int i; 1043 int i;
1033 unsigned long ramdisk_addr; 1044 unsigned long ramdisk_addr;
1034 unsigned long ramdisk_size; 1045 unsigned long ramdisk_size;
1035 unsigned long initrd_addr_max;
1036 1046
1037 efi_early = c; 1047 efi_early = c;
1038 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; 1048 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table;
@@ -1095,15 +1105,20 @@ struct boot_params *make_boot_params(struct efi_config *c)
1095 1105
1096 memset(sdt, 0, sizeof(*sdt)); 1106 memset(sdt, 0, sizeof(*sdt));
1097 1107
1098 if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)
1099 initrd_addr_max = -1UL;
1100 else
1101 initrd_addr_max = hdr->initrd_addr_max;
1102
1103 status = handle_cmdline_files(sys_table, image, 1108 status = handle_cmdline_files(sys_table, image,
1104 (char *)(unsigned long)hdr->cmd_line_ptr, 1109 (char *)(unsigned long)hdr->cmd_line_ptr,
1105 "initrd=", initrd_addr_max, 1110 "initrd=", hdr->initrd_addr_max,
1106 &ramdisk_addr, &ramdisk_size); 1111 &ramdisk_addr, &ramdisk_size);
1112
1113 if (status != EFI_SUCCESS &&
1114 hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) {
1115 efi_printk(sys_table, "Trying to load files to higher address\n");
1116 status = handle_cmdline_files(sys_table, image,
1117 (char *)(unsigned long)hdr->cmd_line_ptr,
1118 "initrd=", -1UL,
1119 &ramdisk_addr, &ramdisk_size);
1120 }
1121
1107 if (status != EFI_SUCCESS) 1122 if (status != EFI_SUCCESS)
1108 goto fail2; 1123 goto fail2;
1109 hdr->ramdisk_image = ramdisk_addr & 0xffffffff; 1124 hdr->ramdisk_image = ramdisk_addr & 0xffffffff;
@@ -1376,10 +1391,7 @@ struct boot_params *efi_main(struct efi_config *c,
1376 1391
1377 setup_graphics(boot_params); 1392 setup_graphics(boot_params);
1378 1393
1379 status = setup_efi_pci(boot_params); 1394 setup_efi_pci(boot_params);
1380 if (status != EFI_SUCCESS) {
1381 efi_printk(sys_table, "setup_efi_pci() failed!\n");
1382 }
1383 1395
1384 status = efi_call_early(allocate_pool, EFI_LOADER_DATA, 1396 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
1385 sizeof(*gdt), (void **)&gdt); 1397 sizeof(*gdt), (void **)&gdt);
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index d487e727f1ec..c88c31ecad12 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol {
103 void *blt; 103 void *blt;
104}; 104};
105 105
106struct efi_config {
107 u64 image_handle;
108 u64 table;
109 u64 allocate_pool;
110 u64 allocate_pages;
111 u64 get_memory_map;
112 u64 free_pool;
113 u64 free_pages;
114 u64 locate_handle;
115 u64 handle_protocol;
116 u64 exit_boot_services;
117 u64 text_output;
118 efi_status_t (*call)(unsigned long, ...);
119 bool is64;
120} __packed;
121
106#endif /* BOOT_COMPRESSED_EBOOT_H */ 122#endif /* BOOT_COMPRESSED_EBOOT_H */
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
index 888950f29fd9..a7ccd57f19e4 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -481,7 +481,7 @@ static void ctr_crypt_final(struct crypto_aes_ctx *ctx,
481 crypto_inc(ctrblk, AES_BLOCK_SIZE); 481 crypto_inc(ctrblk, AES_BLOCK_SIZE);
482} 482}
483 483
484#ifdef CONFIG_AS_AVX 484#if 0 /* temporary disabled due to failing crypto tests */
485static void aesni_ctr_enc_avx_tfm(struct crypto_aes_ctx *ctx, u8 *out, 485static void aesni_ctr_enc_avx_tfm(struct crypto_aes_ctx *ctx, u8 *out,
486 const u8 *in, unsigned int len, u8 *iv) 486 const u8 *in, unsigned int len, u8 *iv)
487{ 487{
@@ -1522,7 +1522,7 @@ static int __init aesni_init(void)
1522 aesni_gcm_dec_tfm = aesni_gcm_dec; 1522 aesni_gcm_dec_tfm = aesni_gcm_dec;
1523 } 1523 }
1524 aesni_ctr_enc_tfm = aesni_ctr_enc; 1524 aesni_ctr_enc_tfm = aesni_ctr_enc;
1525#ifdef CONFIG_AS_AVX 1525#if 0 /* temporary disabled due to failing crypto tests */
1526 if (cpu_has_avx) { 1526 if (cpu_has_avx) {
1527 /* optimize performance of ctr mode encryption transform */ 1527 /* optimize performance of ctr mode encryption transform */
1528 aesni_ctr_enc_tfm = aesni_ctr_enc_avx_tfm; 1528 aesni_ctr_enc_tfm = aesni_ctr_enc_avx_tfm;
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index afcd35d331de..cfe3b954d5e4 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -497,8 +497,6 @@ static __always_inline int fls64(__u64 x)
497 497
498#include <asm-generic/bitops/sched.h> 498#include <asm-generic/bitops/sched.h>
499 499
500#define ARCH_HAS_FAST_MULTIPLIER 1
501
502#include <asm/arch_hweight.h> 500#include <asm/arch_hweight.h>
503 501
504#include <asm-generic/bitops/const_hweight.h> 502#include <asm-generic/bitops/const_hweight.h>
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 044a2fd3c5fe..0ec241ede5a2 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
159} 159}
160#endif /* CONFIG_EFI_MIXED */ 160#endif /* CONFIG_EFI_MIXED */
161 161
162
163/* arch specific definitions used by the stub code */
164
165struct efi_config {
166 u64 image_handle;
167 u64 table;
168 u64 allocate_pool;
169 u64 allocate_pages;
170 u64 get_memory_map;
171 u64 free_pool;
172 u64 free_pages;
173 u64 locate_handle;
174 u64 handle_protocol;
175 u64 exit_boot_services;
176 u64 text_output;
177 efi_status_t (*call)(unsigned long, ...);
178 bool is64;
179} __packed;
180
181extern struct efi_config *efi_early;
182
183#define efi_call_early(f, ...) \
184 efi_early->call(efi_early->f, __VA_ARGS__);
185
186extern bool efi_reboot_required(void); 162extern bool efi_reboot_required(void);
187 163
188#else 164#else
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index b0910f97a3ea..ffb1733ac91f 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -106,14 +106,14 @@ enum fixed_addresses {
106 __end_of_permanent_fixed_addresses, 106 __end_of_permanent_fixed_addresses,
107 107
108 /* 108 /*
109 * 256 temporary boot-time mappings, used by early_ioremap(), 109 * 512 temporary boot-time mappings, used by early_ioremap(),
110 * before ioremap() is functional. 110 * before ioremap() is functional.
111 * 111 *
112 * If necessary we round it up to the next 256 pages boundary so 112 * If necessary we round it up to the next 512 pages boundary so
113 * that we can have a single pgd entry and a single pte table: 113 * that we can have a single pgd entry and a single pte table:
114 */ 114 */
115#define NR_FIX_BTMAPS 64 115#define NR_FIX_BTMAPS 64
116#define FIX_BTMAPS_SLOTS 4 116#define FIX_BTMAPS_SLOTS 8
117#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) 117#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
118 FIX_BTMAP_END = 118 FIX_BTMAP_END =
119 (__end_of_permanent_fixed_addresses ^ 119 (__end_of_permanent_fixed_addresses ^
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 0aeed5ca356e..1733ab49ac5e 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -227,6 +227,8 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned
227 227
228extern void io_apic_eoi(unsigned int apic, unsigned int vector); 228extern void io_apic_eoi(unsigned int apic, unsigned int vector);
229 229
230extern bool mp_should_keep_irq(struct device *dev);
231
230#else /* !CONFIG_X86_IO_APIC */ 232#else /* !CONFIG_X86_IO_APIC */
231 233
232#define io_apic_assign_pci_irqs 0 234#define io_apic_assign_pci_irqs 0
@@ -237,6 +239,7 @@ static inline int mp_find_ioapic(u32 gsi) { return 0; }
237static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } 239static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; }
238static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } 240static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; }
239static inline void mp_unmap_irq(int irq) { } 241static inline void mp_unmap_irq(int irq) { }
242static inline bool mp_should_keep_irq(struct device *dev) { return 1; }
240 243
241static inline int save_ioapic_entries(void) 244static inline int save_ioapic_entries(void)
242{ 245{
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 572460175ba5..7c492ed9087b 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -95,7 +95,7 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
95#define KVM_REFILL_PAGES 25 95#define KVM_REFILL_PAGES 25
96#define KVM_MAX_CPUID_ENTRIES 80 96#define KVM_MAX_CPUID_ENTRIES 80
97#define KVM_NR_FIXED_MTRR_REGION 88 97#define KVM_NR_FIXED_MTRR_REGION 88
98#define KVM_NR_VAR_MTRR 10 98#define KVM_NR_VAR_MTRR 8
99 99
100#define ASYNC_PF_PER_VCPU 64 100#define ASYNC_PF_PER_VCPU 64
101 101
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 0ec056012618..aa97a070f09f 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -131,8 +131,13 @@ static inline int pte_exec(pte_t pte)
131 131
132static inline int pte_special(pte_t pte) 132static inline int pte_special(pte_t pte)
133{ 133{
134 return (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_SPECIAL)) == 134 /*
135 (_PAGE_PRESENT|_PAGE_SPECIAL); 135 * See CONFIG_NUMA_BALANCING pte_numa in include/asm-generic/pgtable.h.
136 * On x86 we have _PAGE_BIT_NUMA == _PAGE_BIT_GLOBAL+1 ==
137 * __PAGE_BIT_SOFTW1 == _PAGE_BIT_SPECIAL.
138 */
139 return (pte_flags(pte) & _PAGE_SPECIAL) &&
140 (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_PROTNONE));
136} 141}
137 142
138static inline unsigned long pte_pfn(pte_t pte) 143static inline unsigned long pte_pfn(pte_t pte)
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 5be9063545d2..3874693c0e53 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -19,6 +19,7 @@ extern pud_t level3_ident_pgt[512];
19extern pmd_t level2_kernel_pgt[512]; 19extern pmd_t level2_kernel_pgt[512];
20extern pmd_t level2_fixmap_pgt[512]; 20extern pmd_t level2_fixmap_pgt[512];
21extern pmd_t level2_ident_pgt[512]; 21extern pmd_t level2_ident_pgt[512];
22extern pte_t level1_fixmap_pgt[512];
22extern pgd_t init_level4_pgt[]; 23extern pgd_t init_level4_pgt[];
23 24
24#define swapper_pg_dir init_level4_pgt 25#define swapper_pg_dir init_level4_pgt
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index b5ea75c4a4b4..ada2e2d6be3e 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
71obj-$(CONFIG_X86_TSC) += trace_clock.o 71obj-$(CONFIG_X86_TSC) += trace_clock.o
72obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o 72obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o
73obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o 73obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
74obj-$(CONFIG_KEXEC_FILE) += kexec-bzimage64.o
74obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o 75obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
75obj-y += kprobes/ 76obj-y += kprobes/
76obj-$(CONFIG_MODULES) += module.o 77obj-$(CONFIG_MODULES) += module.o
@@ -118,5 +119,4 @@ ifeq ($(CONFIG_X86_64),y)
118 119
119 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o 120 obj-$(CONFIG_PCI_MMCONFIG) += mmconf-fam10h_64.o
120 obj-y += vsmp_64.o 121 obj-y += vsmp_64.o
121 obj-$(CONFIG_KEXEC) += kexec-bzimage64.o
122endif 122endif
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 29290f554e79..337ce5a9b15c 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1070,6 +1070,11 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin,
1070 } 1070 }
1071 1071
1072 if (flags & IOAPIC_MAP_ALLOC) { 1072 if (flags & IOAPIC_MAP_ALLOC) {
1073 /* special handling for legacy IRQs */
1074 if (irq < nr_legacy_irqs() && info->count == 1 &&
1075 mp_irqdomain_map(domain, irq, pin) != 0)
1076 irq = -1;
1077
1073 if (irq > 0) 1078 if (irq > 0)
1074 info->count++; 1079 info->count++;
1075 else if (info->count == 0) 1080 else if (info->count == 0)
@@ -3896,7 +3901,15 @@ int mp_irqdomain_map(struct irq_domain *domain, unsigned int virq,
3896 info->polarity = 1; 3901 info->polarity = 1;
3897 } 3902 }
3898 info->node = NUMA_NO_NODE; 3903 info->node = NUMA_NO_NODE;
3899 info->set = 1; 3904
3905 /*
3906 * setup_IO_APIC_irqs() programs all legacy IRQs with default
3907 * trigger and polarity attributes. Don't set the flag for that
3908 * case so the first legacy IRQ user could reprogram the pin
3909 * with real trigger and polarity attributes.
3910 */
3911 if (virq >= nr_legacy_irqs() || info->count)
3912 info->set = 1;
3900 } 3913 }
3901 set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger, 3914 set_io_apic_irq_attr(&attr, ioapic, hwirq, info->trigger,
3902 info->polarity); 3915 info->polarity);
@@ -3946,6 +3959,18 @@ int mp_set_gsi_attr(u32 gsi, int trigger, int polarity, int node)
3946 return ret; 3959 return ret;
3947} 3960}
3948 3961
3962bool mp_should_keep_irq(struct device *dev)
3963{
3964 if (dev->power.is_prepared)
3965 return true;
3966#ifdef CONFIG_PM_RUNTIME
3967 if (dev->power.runtime_status == RPM_SUSPENDING)
3968 return true;
3969#endif
3970
3971 return false;
3972}
3973
3949/* Enable IOAPIC early just for system timer */ 3974/* Enable IOAPIC early just for system timer */
3950void __init pre_init_apic_IRQ0(void) 3975void __init pre_init_apic_IRQ0(void)
3951{ 3976{
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 0553a34fa0df..a618fcd2c07d 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -182,8 +182,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs)
182 crash_save_cpu(regs, safe_smp_processor_id()); 182 crash_save_cpu(regs, safe_smp_processor_id());
183} 183}
184 184
185#ifdef CONFIG_X86_64 185#ifdef CONFIG_KEXEC_FILE
186
187static int get_nr_ram_ranges_callback(unsigned long start_pfn, 186static int get_nr_ram_ranges_callback(unsigned long start_pfn,
188 unsigned long nr_pfn, void *arg) 187 unsigned long nr_pfn, void *arg)
189{ 188{
@@ -696,5 +695,4 @@ int crash_load_segments(struct kimage *image)
696 695
697 return ret; 696 return ret;
698} 697}
699 698#endif /* CONFIG_KEXEC_FILE */
700#endif /* CONFIG_X86_64 */
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 47c410d99f5d..4b0e1dfa2226 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -683,7 +683,7 @@ END(syscall_badsys)
683sysenter_badsys: 683sysenter_badsys:
684 movl $-ENOSYS,%eax 684 movl $-ENOSYS,%eax
685 jmp sysenter_after_call 685 jmp sysenter_after_call
686END(syscall_badsys) 686END(sysenter_badsys)
687 CFI_ENDPROC 687 CFI_ENDPROC
688 688
689.macro FIXUP_ESPFIX_STACK 689.macro FIXUP_ESPFIX_STACK
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 1e6cff5814fa..44f1ed42fdf2 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -203,7 +203,7 @@ void __init native_init_IRQ(void)
203 set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); 203 set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]);
204 } 204 }
205 205
206 if (!acpi_ioapic && !of_ioapic) 206 if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs())
207 setup_irq(2, &irq2); 207 setup_irq(2, &irq2);
208 208
209#ifdef CONFIG_X86_32 209#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index f304773285ae..f1314d0bcf0a 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -338,8 +338,10 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
338 * a relative jump. 338 * a relative jump.
339 */ 339 */
340 rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE; 340 rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE;
341 if (abs(rel) > 0x7fffffff) 341 if (abs(rel) > 0x7fffffff) {
342 __arch_remove_optimized_kprobe(op, 0);
342 return -ERANGE; 343 return -ERANGE;
344 }
343 345
344 buf = (u8 *)op->optinsn.insn; 346 buf = (u8 *)op->optinsn.insn;
345 347
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 8b04018e5d1f..485981059a40 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -25,9 +25,11 @@
25#include <asm/debugreg.h> 25#include <asm/debugreg.h>
26#include <asm/kexec-bzimage64.h> 26#include <asm/kexec-bzimage64.h>
27 27
28#ifdef CONFIG_KEXEC_FILE
28static struct kexec_file_ops *kexec_file_loaders[] = { 29static struct kexec_file_ops *kexec_file_loaders[] = {
29 &kexec_bzImage64_ops, 30 &kexec_bzImage64_ops,
30}; 31};
32#endif
31 33
32static void free_transition_pgtable(struct kimage *image) 34static void free_transition_pgtable(struct kimage *image)
33{ 35{
@@ -178,6 +180,7 @@ static void load_segments(void)
178 ); 180 );
179} 181}
180 182
183#ifdef CONFIG_KEXEC_FILE
181/* Update purgatory as needed after various image segments have been prepared */ 184/* Update purgatory as needed after various image segments have been prepared */
182static int arch_update_purgatory(struct kimage *image) 185static int arch_update_purgatory(struct kimage *image)
183{ 186{
@@ -209,6 +212,12 @@ static int arch_update_purgatory(struct kimage *image)
209 212
210 return ret; 213 return ret;
211} 214}
215#else /* !CONFIG_KEXEC_FILE */
216static inline int arch_update_purgatory(struct kimage *image)
217{
218 return 0;
219}
220#endif /* CONFIG_KEXEC_FILE */
212 221
213int machine_kexec_prepare(struct kimage *image) 222int machine_kexec_prepare(struct kimage *image)
214{ 223{
@@ -329,6 +338,7 @@ void arch_crash_save_vmcoreinfo(void)
329 338
330/* arch-dependent functionality related to kexec file-based syscall */ 339/* arch-dependent functionality related to kexec file-based syscall */
331 340
341#ifdef CONFIG_KEXEC_FILE
332int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, 342int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
333 unsigned long buf_len) 343 unsigned long buf_len)
334{ 344{
@@ -522,3 +532,4 @@ overflow:
522 (int)ELF64_R_TYPE(rel[i].r_info), value); 532 (int)ELF64_R_TYPE(rel[i].r_info), value);
523 return -ENOEXEC; 533 return -ENOEXEC;
524} 534}
535#endif /* CONFIG_KEXEC_FILE */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 2d872e08fab9..42a2dca984b3 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1284,6 +1284,9 @@ static void remove_siblinginfo(int cpu)
1284 1284
1285 for_each_cpu(sibling, cpu_sibling_mask(cpu)) 1285 for_each_cpu(sibling, cpu_sibling_mask(cpu))
1286 cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling)); 1286 cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling));
1287 for_each_cpu(sibling, cpu_llc_shared_mask(cpu))
1288 cpumask_clear_cpu(cpu, cpu_llc_shared_mask(sibling));
1289 cpumask_clear(cpu_llc_shared_mask(cpu));
1287 cpumask_clear(cpu_sibling_mask(cpu)); 1290 cpumask_clear(cpu_sibling_mask(cpu));
1288 cpumask_clear(cpu_core_mask(cpu)); 1291 cpumask_clear(cpu_core_mask(cpu));
1289 c->phys_proc_id = 0; 1292 c->phys_proc_id = 0;
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index bf7ef5ce29df..0fa29609b2c4 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -68,6 +68,8 @@ static struct irqaction irq0 = {
68 68
69void __init setup_default_timer_irq(void) 69void __init setup_default_timer_irq(void)
70{ 70{
71 if (!nr_legacy_irqs())
72 return;
71 setup_irq(0, &irq0); 73 setup_irq(0, &irq0);
72} 74}
73 75
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 56657b0bb3bb..03954f7900f5 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1491,9 +1491,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1491 goto exception; 1491 goto exception;
1492 break; 1492 break;
1493 case VCPU_SREG_CS: 1493 case VCPU_SREG_CS:
1494 if (in_task_switch && rpl != dpl)
1495 goto exception;
1496
1497 if (!(seg_desc.type & 8)) 1494 if (!(seg_desc.type & 8))
1498 goto exception; 1495 goto exception;
1499 1496
@@ -4394,8 +4391,11 @@ done_prefixes:
4394 4391
4395 ctxt->execute = opcode.u.execute; 4392 ctxt->execute = opcode.u.execute;
4396 4393
4394 if (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD)))
4395 return EMULATION_FAILED;
4396
4397 if (unlikely(ctxt->d & 4397 if (unlikely(ctxt->d &
4398 (NotImpl|EmulateOnUD|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) { 4398 (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm))) {
4399 /* 4399 /*
4400 * These are copied unconditionally here, and checked unconditionally 4400 * These are copied unconditionally here, and checked unconditionally
4401 * in x86_emulate_insn. 4401 * in x86_emulate_insn.
@@ -4406,9 +4406,6 @@ done_prefixes:
4406 if (ctxt->d & NotImpl) 4406 if (ctxt->d & NotImpl)
4407 return EMULATION_FAILED; 4407 return EMULATION_FAILED;
4408 4408
4409 if (!(ctxt->d & EmulateOnUD) && ctxt->ud)
4410 return EMULATION_FAILED;
4411
4412 if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack)) 4409 if (mode == X86EMUL_MODE_PROT64 && (ctxt->d & Stack))
4413 ctxt->op_bytes = 8; 4410 ctxt->op_bytes = 8;
4414 4411
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 167ffcac16ed..95a427e57887 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -48,7 +48,9 @@ enum address_markers_idx {
48 LOW_KERNEL_NR, 48 LOW_KERNEL_NR,
49 VMALLOC_START_NR, 49 VMALLOC_START_NR,
50 VMEMMAP_START_NR, 50 VMEMMAP_START_NR,
51# ifdef CONFIG_X86_ESPFIX64
51 ESPFIX_START_NR, 52 ESPFIX_START_NR,
53# endif
52 HIGH_KERNEL_NR, 54 HIGH_KERNEL_NR,
53 MODULES_VADDR_NR, 55 MODULES_VADDR_NR,
54 MODULES_END_NR, 56 MODULES_END_NR,
@@ -71,7 +73,9 @@ static struct addr_marker address_markers[] = {
71 { PAGE_OFFSET, "Low Kernel Mapping" }, 73 { PAGE_OFFSET, "Low Kernel Mapping" },
72 { VMALLOC_START, "vmalloc() Area" }, 74 { VMALLOC_START, "vmalloc() Area" },
73 { VMEMMAP_START, "Vmemmap" }, 75 { VMEMMAP_START, "Vmemmap" },
76# ifdef CONFIG_X86_ESPFIX64
74 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, 77 { ESPFIX_BASE_ADDR, "ESPfix Area", 16 },
78# endif
75 { __START_KERNEL_map, "High Kernel Mapping" }, 79 { __START_KERNEL_map, "High Kernel Mapping" },
76 { MODULES_VADDR, "Modules" }, 80 { MODULES_VADDR, "Modules" },
77 { MODULES_END, "End Modules" }, 81 { MODULES_END, "End Modules" },
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 25e7e1372bb2..919b91205cd4 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -31,7 +31,7 @@
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <asm/elf.h> 32#include <asm/elf.h>
33 33
34struct __read_mostly va_alignment va_align = { 34struct va_alignment __read_mostly va_align = {
35 .flags = -1, 35 .flags = -1,
36}; 36};
37 37
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 1fe33987de02..ee61c36d64f8 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -49,7 +49,13 @@ void leave_mm(int cpu)
49 if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) { 49 if (cpumask_test_cpu(cpu, mm_cpumask(active_mm))) {
50 cpumask_clear_cpu(cpu, mm_cpumask(active_mm)); 50 cpumask_clear_cpu(cpu, mm_cpumask(active_mm));
51 load_cr3(swapper_pg_dir); 51 load_cr3(swapper_pg_dir);
52 trace_tlb_flush(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL); 52 /*
53 * This gets called in the idle path where RCU
54 * functions differently. Tracing normally
55 * uses RCU, so we have to call the tracepoint
56 * specially here.
57 */
58 trace_tlb_flush_rcuidle(TLB_FLUSH_ON_TASK_SWITCH, TLB_FLUSH_ALL);
53 } 59 }
54} 60}
55EXPORT_SYMBOL_GPL(leave_mm); 61EXPORT_SYMBOL_GPL(leave_mm);
@@ -174,7 +180,7 @@ void flush_tlb_current_task(void)
174 * 180 *
175 * This is in units of pages. 181 * This is in units of pages.
176 */ 182 */
177unsigned long tlb_single_page_flush_ceiling = 33; 183static unsigned long tlb_single_page_flush_ceiling __read_mostly = 33;
178 184
179void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, 185void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
180 unsigned long end, unsigned long vmflag) 186 unsigned long end, unsigned long vmflag)
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index c61ea57d1ba1..9a2b7101ae8a 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -326,27 +326,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
326 struct pci_bus *bus; 326 struct pci_bus *bus;
327 u16 config; 327 u16 config;
328 328
329 if (!vga_default_device()) {
330 resource_size_t start, end;
331 int i;
332
333 /* Does firmware framebuffer belong to us? */
334 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
335 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM))
336 continue;
337
338 start = pci_resource_start(pdev, i);
339 end = pci_resource_end(pdev, i);
340
341 if (!start || !end)
342 continue;
343
344 if (screen_info.lfb_base >= start &&
345 (screen_info.lfb_base + screen_info.lfb_size) < end)
346 vga_set_default_device(pdev);
347 }
348 }
349
350 /* Is VGA routed to us? */ 329 /* Is VGA routed to us? */
351 bus = pdev->bus; 330 bus = pdev->bus;
352 while (bus) { 331 while (bus) {
@@ -371,8 +350,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
371 pci_read_config_word(pdev, PCI_COMMAND, &config); 350 pci_read_config_word(pdev, PCI_COMMAND, &config);
372 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 351 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
373 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 352 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
374 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 353 dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n");
375 vga_set_default_device(pdev);
376 } 354 }
377 } 355 }
378} 356}
diff --git a/arch/x86/pci/intel_mid_pci.c b/arch/x86/pci/intel_mid_pci.c
index 3865116c51fb..b9958c364075 100644
--- a/arch/x86/pci/intel_mid_pci.c
+++ b/arch/x86/pci/intel_mid_pci.c
@@ -229,7 +229,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
229 229
230static void intel_mid_pci_irq_disable(struct pci_dev *dev) 230static void intel_mid_pci_irq_disable(struct pci_dev *dev)
231{ 231{
232 if (!dev->dev.power.is_prepared && dev->irq > 0) 232 if (!mp_should_keep_irq(&dev->dev) && dev->irq > 0)
233 mp_unmap_irq(dev->irq); 233 mp_unmap_irq(dev->irq);
234} 234}
235 235
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index bc1a2c341891..eb500c2592ad 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -1256,7 +1256,7 @@ static int pirq_enable_irq(struct pci_dev *dev)
1256 1256
1257static void pirq_disable_irq(struct pci_dev *dev) 1257static void pirq_disable_irq(struct pci_dev *dev)
1258{ 1258{
1259 if (io_apic_assign_pci_irqs && !dev->dev.power.is_prepared && 1259 if (io_apic_assign_pci_irqs && !mp_should_keep_irq(&dev->dev) &&
1260 dev->irq) { 1260 dev->irq) {
1261 mp_unmap_irq(dev->irq); 1261 mp_unmap_irq(dev->irq);
1262 dev->irq = 0; 1262 dev->irq = 0;
diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile
index 7fde9ee438a4..899dd2454256 100644
--- a/arch/x86/purgatory/Makefile
+++ b/arch/x86/purgatory/Makefile
@@ -11,6 +11,7 @@ targets += purgatory.ro
11# sure how to relocate those. Like kexec-tools, use custom flags. 11# sure how to relocate those. Like kexec-tools, use custom flags.
12 12
13KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large 13KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large
14KBUILD_CFLAGS += -m$(BITS)
14 15
15$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE 16$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
16 $(call if_changed,ld) 17 $(call if_changed,ld)
@@ -24,7 +25,4 @@ $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
24 $(call if_changed,bin2c) 25 $(call if_changed,bin2c)
25 26
26 27
27# No loaders for 32bits yet. 28obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o
28ifeq ($(CONFIG_X86_64),y)
29 obj-$(CONFIG_KEXEC) += kexec-purgatory.o
30endif
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index e8a1201c3293..16fb0099b7f2 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1866,12 +1866,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end,
1866 * 1866 *
1867 * We can construct this by grafting the Xen provided pagetable into 1867 * We can construct this by grafting the Xen provided pagetable into
1868 * head_64.S's preconstructed pagetables. We copy the Xen L2's into 1868 * head_64.S's preconstructed pagetables. We copy the Xen L2's into
1869 * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt. This 1869 * level2_ident_pgt, and level2_kernel_pgt. This means that only the
1870 * means that only the kernel has a physical mapping to start with - 1870 * kernel has a physical mapping to start with - but that's enough to
1871 * but that's enough to get __va working. We need to fill in the rest 1871 * get __va working. We need to fill in the rest of the physical
1872 * of the physical mapping once some sort of allocator has been set 1872 * mapping once some sort of allocator has been set up. NOTE: for
1873 * up. 1873 * PVH, the page tables are native.
1874 * NOTE: for PVH, the page tables are native.
1875 */ 1874 */
1876void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) 1875void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1877{ 1876{
@@ -1902,8 +1901,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1902 /* L3_i[0] -> level2_ident_pgt */ 1901 /* L3_i[0] -> level2_ident_pgt */
1903 convert_pfn_mfn(level3_ident_pgt); 1902 convert_pfn_mfn(level3_ident_pgt);
1904 /* L3_k[510] -> level2_kernel_pgt 1903 /* L3_k[510] -> level2_kernel_pgt
1905 * L3_i[511] -> level2_fixmap_pgt */ 1904 * L3_k[511] -> level2_fixmap_pgt */
1906 convert_pfn_mfn(level3_kernel_pgt); 1905 convert_pfn_mfn(level3_kernel_pgt);
1906
1907 /* L3_k[511][506] -> level1_fixmap_pgt */
1908 convert_pfn_mfn(level2_fixmap_pgt);
1907 } 1909 }
1908 /* We get [511][511] and have Xen's version of level2_kernel_pgt */ 1910 /* We get [511][511] and have Xen's version of level2_kernel_pgt */
1909 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); 1911 l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);
@@ -1913,21 +1915,15 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1913 addr[1] = (unsigned long)l3; 1915 addr[1] = (unsigned long)l3;
1914 addr[2] = (unsigned long)l2; 1916 addr[2] = (unsigned long)l2;
1915 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: 1917 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem:
1916 * Both L4[272][0] and L4[511][511] have entries that point to the same 1918 * Both L4[272][0] and L4[511][510] have entries that point to the same
1917 * L2 (PMD) tables. Meaning that if you modify it in __va space 1919 * L2 (PMD) tables. Meaning that if you modify it in __va space
1918 * it will be also modified in the __ka space! (But if you just 1920 * it will be also modified in the __ka space! (But if you just
1919 * modify the PMD table to point to other PTE's or none, then you 1921 * modify the PMD table to point to other PTE's or none, then you
1920 * are OK - which is what cleanup_highmap does) */ 1922 * are OK - which is what cleanup_highmap does) */
1921 copy_page(level2_ident_pgt, l2); 1923 copy_page(level2_ident_pgt, l2);
1922 /* Graft it onto L4[511][511] */ 1924 /* Graft it onto L4[511][510] */
1923 copy_page(level2_kernel_pgt, l2); 1925 copy_page(level2_kernel_pgt, l2);
1924 1926
1925 /* Get [511][510] and graft that in level2_fixmap_pgt */
1926 l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd);
1927 l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud);
1928 copy_page(level2_fixmap_pgt, l2);
1929 /* Note that we don't do anything with level1_fixmap_pgt which
1930 * we don't need. */
1931 if (!xen_feature(XENFEAT_auto_translated_physmap)) { 1927 if (!xen_feature(XENFEAT_auto_translated_physmap)) {
1932 /* Make pagetable pieces RO */ 1928 /* Make pagetable pieces RO */
1933 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); 1929 set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
@@ -1937,6 +1933,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1937 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); 1933 set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO);
1938 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); 1934 set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
1939 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); 1935 set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
1936 set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO);
1940 1937
1941 /* Pin down new L4 */ 1938 /* Pin down new L4 */
1942 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, 1939 pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE,