diff options
Diffstat (limited to 'arch/x86')
170 files changed, 6135 insertions, 3508 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index b2ddfcf01728..21ef9dd36187 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -23,11 +23,14 @@ config X86 | |||
23 | select HAVE_OPROFILE | 23 | select HAVE_OPROFILE |
24 | select HAVE_IOREMAP_PROT | 24 | select HAVE_IOREMAP_PROT |
25 | select HAVE_KPROBES | 25 | select HAVE_KPROBES |
26 | select ARCH_WANT_OPTIONAL_GPIOLIB | ||
26 | select HAVE_KRETPROBES | 27 | select HAVE_KRETPROBES |
27 | select HAVE_DYNAMIC_FTRACE | 28 | select HAVE_DYNAMIC_FTRACE |
28 | select HAVE_FTRACE | 29 | select HAVE_FTRACE |
29 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) | 30 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) |
30 | select HAVE_ARCH_KGDB if !X86_VOYAGER | 31 | select HAVE_ARCH_KGDB if !X86_VOYAGER |
32 | select HAVE_GENERIC_DMA_COHERENT if X86_32 | ||
33 | select HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
31 | 34 | ||
32 | config ARCH_DEFCONFIG | 35 | config ARCH_DEFCONFIG |
33 | string | 36 | string |
@@ -330,20 +333,6 @@ config X86_BIGSMP | |||
330 | 333 | ||
331 | endif | 334 | endif |
332 | 335 | ||
333 | config X86_RDC321X | ||
334 | bool "RDC R-321x SoC" | ||
335 | depends on X86_32 | ||
336 | select M486 | ||
337 | select X86_REBOOTFIXUPS | ||
338 | select GENERIC_GPIO | ||
339 | select LEDS_CLASS | ||
340 | select LEDS_GPIO | ||
341 | select NEW_LEDS | ||
342 | help | ||
343 | This option is needed for RDC R-321x system-on-chip, also known | ||
344 | as R-8610-(G). | ||
345 | If you don't have one of these chips, you should say N here. | ||
346 | |||
347 | config X86_VSMP | 336 | config X86_VSMP |
348 | bool "Support for ScaleMP vSMP" | 337 | bool "Support for ScaleMP vSMP" |
349 | select PARAVIRT | 338 | select PARAVIRT |
@@ -367,6 +356,16 @@ config X86_VISWS | |||
367 | A kernel compiled for the Visual Workstation will run on general | 356 | A kernel compiled for the Visual Workstation will run on general |
368 | PCs as well. See <file:Documentation/sgi-visws.txt> for details. | 357 | PCs as well. See <file:Documentation/sgi-visws.txt> for details. |
369 | 358 | ||
359 | config X86_RDC321X | ||
360 | bool "RDC R-321x SoC" | ||
361 | depends on X86_32 | ||
362 | select M486 | ||
363 | select X86_REBOOTFIXUPS | ||
364 | help | ||
365 | This option is needed for RDC R-321x system-on-chip, also known | ||
366 | as R-8610-(G). | ||
367 | If you don't have one of these chips, you should say N here. | ||
368 | |||
370 | config SCHED_NO_NO_OMIT_FRAME_POINTER | 369 | config SCHED_NO_NO_OMIT_FRAME_POINTER |
371 | def_bool y | 370 | def_bool y |
372 | prompt "Single-depth WCHAN output" | 371 | prompt "Single-depth WCHAN output" |
@@ -578,35 +577,29 @@ config SWIOTLB | |||
578 | 577 | ||
579 | config IOMMU_HELPER | 578 | config IOMMU_HELPER |
580 | def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU) | 579 | def_bool (CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU) |
580 | |||
581 | config MAXSMP | 581 | config MAXSMP |
582 | bool "Configure Maximum number of SMP Processors and NUMA Nodes" | 582 | bool "Configure Maximum number of SMP Processors and NUMA Nodes" |
583 | depends on X86_64 && SMP | 583 | depends on X86_64 && SMP && BROKEN |
584 | default n | 584 | default n |
585 | help | 585 | help |
586 | Configure maximum number of CPUS and NUMA Nodes for this architecture. | 586 | Configure maximum number of CPUS and NUMA Nodes for this architecture. |
587 | If unsure, say N. | 587 | If unsure, say N. |
588 | 588 | ||
589 | if MAXSMP | ||
590 | config NR_CPUS | 589 | config NR_CPUS |
591 | int | 590 | int "Maximum number of CPUs (2-512)" if !MAXSMP |
592 | default "4096" | 591 | range 2 512 |
593 | endif | ||
594 | |||
595 | if !MAXSMP | ||
596 | config NR_CPUS | ||
597 | int "Maximum number of CPUs (2-4096)" | ||
598 | range 2 4096 | ||
599 | depends on SMP | 592 | depends on SMP |
593 | default "4096" if MAXSMP | ||
600 | default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000 | 594 | default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000 |
601 | default "8" | 595 | default "8" |
602 | help | 596 | help |
603 | This allows you to specify the maximum number of CPUs which this | 597 | This allows you to specify the maximum number of CPUs which this |
604 | kernel will support. The maximum supported value is 4096 and the | 598 | kernel will support. The maximum supported value is 512 and the |
605 | minimum value which makes sense is 2. | 599 | minimum value which makes sense is 2. |
606 | 600 | ||
607 | This is purely to save memory - each supported CPU adds | 601 | This is purely to save memory - each supported CPU adds |
608 | approximately eight kilobytes to the kernel image. | 602 | approximately eight kilobytes to the kernel image. |
609 | endif | ||
610 | 603 | ||
611 | config SCHED_SMT | 604 | config SCHED_SMT |
612 | bool "SMT (Hyperthreading) scheduler support" | 605 | bool "SMT (Hyperthreading) scheduler support" |
@@ -952,9 +945,9 @@ config NUMA | |||
952 | local memory controller of the CPU and add some more | 945 | local memory controller of the CPU and add some more |
953 | NUMA awareness to the kernel. | 946 | NUMA awareness to the kernel. |
954 | 947 | ||
955 | For i386 this is currently highly experimental and should be only | 948 | For 32-bit this is currently highly experimental and should be only |
956 | used for kernel development. It might also cause boot failures. | 949 | used for kernel development. It might also cause boot failures. |
957 | For x86_64 this is recommended on all multiprocessor Opteron systems. | 950 | For 64-bit this is recommended on all multiprocessor Opteron systems. |
958 | If the system is EM64T, you should say N unless your system is | 951 | If the system is EM64T, you should say N unless your system is |
959 | EM64T NUMA. | 952 | EM64T NUMA. |
960 | 953 | ||
@@ -997,17 +990,10 @@ config NUMA_EMU | |||
997 | into virtual nodes when booted with "numa=fake=N", where N is the | 990 | into virtual nodes when booted with "numa=fake=N", where N is the |
998 | number of nodes. This is only useful for debugging. | 991 | number of nodes. This is only useful for debugging. |
999 | 992 | ||
1000 | if MAXSMP | ||
1001 | |||
1002 | config NODES_SHIFT | 993 | config NODES_SHIFT |
1003 | int | 994 | int "Maximum NUMA Nodes (as a power of 2)" if !MAXSMP |
1004 | default "9" | ||
1005 | endif | ||
1006 | |||
1007 | if !MAXSMP | ||
1008 | config NODES_SHIFT | ||
1009 | int "Maximum NUMA Nodes (as a power of 2)" | ||
1010 | range 1 9 if X86_64 | 995 | range 1 9 if X86_64 |
996 | default "9" if MAXSMP | ||
1011 | default "6" if X86_64 | 997 | default "6" if X86_64 |
1012 | default "4" if X86_NUMAQ | 998 | default "4" if X86_NUMAQ |
1013 | default "3" | 999 | default "3" |
@@ -1015,7 +1001,6 @@ config NODES_SHIFT | |||
1015 | help | 1001 | help |
1016 | Specify the maximum number of NUMA Nodes available on the target | 1002 | Specify the maximum number of NUMA Nodes available on the target |
1017 | system. Increases memory reserved to accomodate various tables. | 1003 | system. Increases memory reserved to accomodate various tables. |
1018 | endif | ||
1019 | 1004 | ||
1020 | config HAVE_ARCH_BOOTMEM_NODE | 1005 | config HAVE_ARCH_BOOTMEM_NODE |
1021 | def_bool y | 1006 | def_bool y |
@@ -1264,7 +1249,7 @@ config KEXEC | |||
1264 | strongly in flux, so no good recommendation can be made. | 1249 | strongly in flux, so no good recommendation can be made. |
1265 | 1250 | ||
1266 | config CRASH_DUMP | 1251 | config CRASH_DUMP |
1267 | bool "kernel crash dumps (EXPERIMENTAL)" | 1252 | bool "kernel crash dumps" |
1268 | depends on X86_64 || (X86_32 && HIGHMEM) | 1253 | depends on X86_64 || (X86_32 && HIGHMEM) |
1269 | help | 1254 | help |
1270 | Generate crash dump after being started by kexec. | 1255 | Generate crash dump after being started by kexec. |
@@ -1277,6 +1262,14 @@ config CRASH_DUMP | |||
1277 | (CONFIG_RELOCATABLE=y). | 1262 | (CONFIG_RELOCATABLE=y). |
1278 | For more details see Documentation/kdump/kdump.txt | 1263 | For more details see Documentation/kdump/kdump.txt |
1279 | 1264 | ||
1265 | config KEXEC_JUMP | ||
1266 | bool "kexec jump (EXPERIMENTAL)" | ||
1267 | depends on EXPERIMENTAL | ||
1268 | depends on KEXEC && HIBERNATION && X86_32 | ||
1269 | help | ||
1270 | Jump between original kernel and kexeced kernel and invoke | ||
1271 | code in physical address mode via KEXEC | ||
1272 | |||
1280 | config PHYSICAL_START | 1273 | config PHYSICAL_START |
1281 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) | 1274 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) |
1282 | default "0x1000000" if X86_NUMAQ | 1275 | default "0x1000000" if X86_NUMAQ |
@@ -1650,6 +1643,14 @@ config DMAR_FLOPPY_WA | |||
1650 | workaround will setup a 1:1 mapping for the first | 1643 | workaround will setup a 1:1 mapping for the first |
1651 | 16M to make floppy (an ISA device) work. | 1644 | 16M to make floppy (an ISA device) work. |
1652 | 1645 | ||
1646 | config INTR_REMAP | ||
1647 | bool "Support for Interrupt Remapping (EXPERIMENTAL)" | ||
1648 | depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL | ||
1649 | help | ||
1650 | Supports Interrupt remapping for IO-APIC and MSI devices. | ||
1651 | To use x2apic mode in the CPU's which support x2APIC enhancements or | ||
1652 | to support platforms with CPU's having > 8 bit APIC ID, say Y. | ||
1653 | |||
1653 | source "drivers/pci/pcie/Kconfig" | 1654 | source "drivers/pci/pcie/Kconfig" |
1654 | 1655 | ||
1655 | source "drivers/pci/Kconfig" | 1656 | source "drivers/pci/Kconfig" |
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu index 468ffc2df0e0..1b29d6a87563 100644 --- a/arch/x86/Kconfig.cpu +++ b/arch/x86/Kconfig.cpu | |||
@@ -416,6 +416,68 @@ config X86_DEBUGCTLMSR | |||
416 | def_bool y | 416 | def_bool y |
417 | depends on !(MK6 || MWINCHIPC6 || MWINCHIP2 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) | 417 | depends on !(MK6 || MWINCHIPC6 || MWINCHIP2 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) |
418 | 418 | ||
419 | menuconfig PROCESSOR_SELECT | ||
420 | default y | ||
421 | bool "Supported processor vendors" if EMBEDDED | ||
422 | help | ||
423 | This lets you choose what x86 vendor support code your kernel | ||
424 | will include. | ||
425 | |||
426 | config CPU_SUP_INTEL_32 | ||
427 | default y | ||
428 | bool "Support Intel processors" if PROCESSOR_SELECT | ||
429 | depends on !64BIT | ||
430 | help | ||
431 | This enables extended support for Intel processors | ||
432 | |||
433 | config CPU_SUP_INTEL_64 | ||
434 | default y | ||
435 | bool "Support Intel processors" if PROCESSOR_SELECT | ||
436 | depends on 64BIT | ||
437 | help | ||
438 | This enables extended support for Intel processors | ||
439 | |||
440 | config CPU_SUP_CYRIX_32 | ||
441 | default y | ||
442 | bool "Support Cyrix processors" if PROCESSOR_SELECT | ||
443 | depends on !64BIT | ||
444 | help | ||
445 | This enables extended support for Cyrix processors | ||
446 | |||
447 | config CPU_SUP_AMD | ||
448 | default y | ||
449 | bool "Support AMD processors" if PROCESSOR_SELECT | ||
450 | help | ||
451 | This enables extended support for AMD processors | ||
452 | |||
453 | config CPU_SUP_CENTAUR_32 | ||
454 | default y | ||
455 | bool "Support Centaur processors" if PROCESSOR_SELECT | ||
456 | depends on !64BIT | ||
457 | help | ||
458 | This enables extended support for Centaur processors | ||
459 | |||
460 | config CPU_SUP_CENTAUR_64 | ||
461 | default y | ||
462 | bool "Support Centaur processors" if PROCESSOR_SELECT | ||
463 | depends on 64BIT | ||
464 | help | ||
465 | This enables extended support for Centaur processors | ||
466 | |||
467 | config CPU_SUP_TRANSMETA_32 | ||
468 | default y | ||
469 | bool "Support Transmeta processors" if PROCESSOR_SELECT | ||
470 | depends on !64BIT | ||
471 | help | ||
472 | This enables extended support for Transmeta processors | ||
473 | |||
474 | config CPU_SUP_UMC_32 | ||
475 | default y | ||
476 | bool "Support UMC processors" if PROCESSOR_SELECT | ||
477 | depends on !64BIT | ||
478 | help | ||
479 | This enables extended support for UMC processors | ||
480 | |||
419 | config X86_DS | 481 | config X86_DS |
420 | bool "Debug Store support" | 482 | bool "Debug Store support" |
421 | default y | 483 | default y |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 919ce21ea654..f5631da585b6 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -118,11 +118,6 @@ mflags-$(CONFIG_X86_GENERICARCH):= -Iinclude/asm-x86/mach-generic | |||
118 | fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/ | 118 | fcore-$(CONFIG_X86_GENERICARCH) += arch/x86/mach-generic/ |
119 | mcore-$(CONFIG_X86_GENERICARCH) := arch/x86/mach-default/ | 119 | mcore-$(CONFIG_X86_GENERICARCH) := arch/x86/mach-default/ |
120 | 120 | ||
121 | # RDC R-321x subarch support | ||
122 | mflags-$(CONFIG_X86_RDC321X) := -Iinclude/asm-x86/mach-rdc321x | ||
123 | mcore-$(CONFIG_X86_RDC321X) := arch/x86/mach-default/ | ||
124 | core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/ | ||
125 | |||
126 | # default subarch .h files | 121 | # default subarch .h files |
127 | mflags-y += -Iinclude/asm-x86/mach-default | 122 | mflags-y += -Iinclude/asm-x86/mach-default |
128 | 123 | ||
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index a34b9982c7cb..cc0ef13fba7a 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h | |||
@@ -24,10 +24,14 @@ | |||
24 | #include <linux/edd.h> | 24 | #include <linux/edd.h> |
25 | #include <asm/boot.h> | 25 | #include <asm/boot.h> |
26 | #include <asm/setup.h> | 26 | #include <asm/setup.h> |
27 | #include "bitops.h" | ||
28 | #include <asm/cpufeature.h> | ||
27 | 29 | ||
28 | /* Useful macros */ | 30 | /* Useful macros */ |
29 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | 31 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
30 | 32 | ||
33 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) | ||
34 | |||
31 | extern struct setup_header hdr; | 35 | extern struct setup_header hdr; |
32 | extern struct boot_params boot_params; | 36 | extern struct boot_params boot_params; |
33 | 37 | ||
@@ -242,6 +246,12 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize); | |||
242 | int cmdline_find_option_bool(const char *option); | 246 | int cmdline_find_option_bool(const char *option); |
243 | 247 | ||
244 | /* cpu.c, cpucheck.c */ | 248 | /* cpu.c, cpucheck.c */ |
249 | struct cpu_features { | ||
250 | int level; /* Family, or 64 for x86-64 */ | ||
251 | int model; | ||
252 | u32 flags[NCAPINTS]; | ||
253 | }; | ||
254 | extern struct cpu_features cpu; | ||
245 | int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr); | 255 | int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr); |
246 | int validate_cpu(void); | 256 | int validate_cpu(void); |
247 | 257 | ||
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index bc5553b496f7..aaf5a2131efc 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -16,7 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | #undef CONFIG_PARAVIRT | 17 | #undef CONFIG_PARAVIRT |
18 | #ifdef CONFIG_X86_32 | 18 | #ifdef CONFIG_X86_32 |
19 | #define _ASM_DESC_H_ 1 | 19 | #define ASM_X86__DESC_H 1 |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifdef CONFIG_X86_64 | 22 | #ifdef CONFIG_X86_64 |
@@ -182,8 +182,6 @@ static unsigned outcnt; | |||
182 | static int fill_inbuf(void); | 182 | static int fill_inbuf(void); |
183 | static void flush_window(void); | 183 | static void flush_window(void); |
184 | static void error(char *m); | 184 | static void error(char *m); |
185 | static void gzip_mark(void **); | ||
186 | static void gzip_release(void **); | ||
187 | 185 | ||
188 | /* | 186 | /* |
189 | * This is set up by the setup-routine at boot-time | 187 | * This is set up by the setup-routine at boot-time |
@@ -196,9 +194,6 @@ extern int input_len; | |||
196 | 194 | ||
197 | static long bytes_out; | 195 | static long bytes_out; |
198 | 196 | ||
199 | static void *malloc(int size); | ||
200 | static void free(void *where); | ||
201 | |||
202 | static void *memset(void *s, int c, unsigned n); | 197 | static void *memset(void *s, int c, unsigned n); |
203 | static void *memcpy(void *dest, const void *src, unsigned n); | 198 | static void *memcpy(void *dest, const void *src, unsigned n); |
204 | 199 | ||
@@ -220,40 +215,6 @@ static int lines, cols; | |||
220 | 215 | ||
221 | #include "../../../../lib/inflate.c" | 216 | #include "../../../../lib/inflate.c" |
222 | 217 | ||
223 | static void *malloc(int size) | ||
224 | { | ||
225 | void *p; | ||
226 | |||
227 | if (size < 0) | ||
228 | error("Malloc error"); | ||
229 | if (free_mem_ptr <= 0) | ||
230 | error("Memory error"); | ||
231 | |||
232 | free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ | ||
233 | |||
234 | p = (void *)free_mem_ptr; | ||
235 | free_mem_ptr += size; | ||
236 | |||
237 | if (free_mem_ptr >= free_mem_end_ptr) | ||
238 | error("Out of memory"); | ||
239 | |||
240 | return p; | ||
241 | } | ||
242 | |||
243 | static void free(void *where) | ||
244 | { /* Don't care */ | ||
245 | } | ||
246 | |||
247 | static void gzip_mark(void **ptr) | ||
248 | { | ||
249 | *ptr = (void *) free_mem_ptr; | ||
250 | } | ||
251 | |||
252 | static void gzip_release(void **ptr) | ||
253 | { | ||
254 | free_mem_ptr = (memptr) *ptr; | ||
255 | } | ||
256 | |||
257 | static void scroll(void) | 218 | static void scroll(void) |
258 | { | 219 | { |
259 | int i; | 220 | int i; |
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c index 92d6fd73dc7d..75298fe2edca 100644 --- a/arch/x86/boot/cpu.c +++ b/arch/x86/boot/cpu.c | |||
@@ -16,9 +16,6 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "boot.h" | 18 | #include "boot.h" |
19 | #include "bitops.h" | ||
20 | #include <asm/cpufeature.h> | ||
21 | |||
22 | #include "cpustr.h" | 19 | #include "cpustr.h" |
23 | 20 | ||
24 | static char *cpu_name(int level) | 21 | static char *cpu_name(int level) |
diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c index 7804389ee005..4d3ff037201f 100644 --- a/arch/x86/boot/cpucheck.c +++ b/arch/x86/boot/cpucheck.c | |||
@@ -22,21 +22,13 @@ | |||
22 | 22 | ||
23 | #ifdef _SETUP | 23 | #ifdef _SETUP |
24 | # include "boot.h" | 24 | # include "boot.h" |
25 | # include "bitops.h" | ||
26 | #endif | 25 | #endif |
27 | #include <linux/types.h> | 26 | #include <linux/types.h> |
28 | #include <asm/cpufeature.h> | ||
29 | #include <asm/processor-flags.h> | 27 | #include <asm/processor-flags.h> |
30 | #include <asm/required-features.h> | 28 | #include <asm/required-features.h> |
31 | #include <asm/msr-index.h> | 29 | #include <asm/msr-index.h> |
32 | 30 | ||
33 | struct cpu_features { | 31 | struct cpu_features cpu; |
34 | int level; /* Family, or 64 for x86-64 */ | ||
35 | int model; | ||
36 | u32 flags[NCAPINTS]; | ||
37 | }; | ||
38 | |||
39 | static struct cpu_features cpu; | ||
40 | static u32 cpu_vendor[3]; | 32 | static u32 cpu_vendor[3]; |
41 | static u32 err_flags[NCAPINTS]; | 33 | static u32 err_flags[NCAPINTS]; |
42 | 34 | ||
@@ -46,12 +38,12 @@ static const u32 req_flags[NCAPINTS] = | |||
46 | { | 38 | { |
47 | REQUIRED_MASK0, | 39 | REQUIRED_MASK0, |
48 | REQUIRED_MASK1, | 40 | REQUIRED_MASK1, |
49 | REQUIRED_MASK2, | 41 | 0, /* REQUIRED_MASK2 not implemented in this file */ |
50 | REQUIRED_MASK3, | 42 | 0, /* REQUIRED_MASK3 not implemented in this file */ |
51 | REQUIRED_MASK4, | 43 | REQUIRED_MASK4, |
52 | REQUIRED_MASK5, | 44 | 0, /* REQUIRED_MASK5 not implemented in this file */ |
53 | REQUIRED_MASK6, | 45 | REQUIRED_MASK6, |
54 | REQUIRED_MASK7, | 46 | 0, /* REQUIRED_MASK7 not implemented in this file */ |
55 | }; | 47 | }; |
56 | 48 | ||
57 | #define A32(a, b, c, d) (((d) << 24)+((c) << 16)+((b) << 8)+(a)) | 49 | #define A32(a, b, c, d) (((d) << 24)+((c) << 16)+((b) << 8)+(a)) |
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c index 2296164b54d2..197421db1af1 100644 --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c | |||
@@ -73,6 +73,11 @@ static void keyboard_set_repeat(void) | |||
73 | */ | 73 | */ |
74 | static void query_ist(void) | 74 | static void query_ist(void) |
75 | { | 75 | { |
76 | /* Some older BIOSes apparently crash on this call, so filter | ||
77 | it from machines too old to have SpeedStep at all. */ | ||
78 | if (cpu.level < 6) | ||
79 | return; | ||
80 | |||
76 | asm("int $0x15" | 81 | asm("int $0x15" |
77 | : "=a" (boot_params.ist_info.signature), | 82 | : "=a" (boot_params.ist_info.signature), |
78 | "=b" (boot_params.ist_info.command), | 83 | "=b" (boot_params.ist_info.command), |
diff --git a/arch/x86/boot/memory.c b/arch/x86/boot/memory.c index 53165c97336b..8c3c25f35578 100644 --- a/arch/x86/boot/memory.c +++ b/arch/x86/boot/memory.c | |||
@@ -13,7 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "boot.h" | 15 | #include "boot.h" |
16 | #include <linux/kernel.h> | ||
17 | 16 | ||
18 | #define SMAP 0x534d4150 /* ASCII "SMAP" */ | 17 | #define SMAP 0x534d4150 /* ASCII "SMAP" */ |
19 | 18 | ||
diff --git a/arch/x86/boot/mkcpustr.c b/arch/x86/boot/mkcpustr.c index bbe76953bae9..4589caa3e9d1 100644 --- a/arch/x86/boot/mkcpustr.c +++ b/arch/x86/boot/mkcpustr.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <stdio.h> | 16 | #include <stdio.h> |
17 | 17 | ||
18 | #include "../kernel/cpu/feature_names.c" | 18 | #include "../kernel/cpu/capflags.c" |
19 | 19 | ||
20 | #if NCAPFLAGS > 8 | 20 | #if NCAPFLAGS > 8 |
21 | # error "Need to adjust the boot code handling of CPUID strings" | 21 | # error "Need to adjust the boot code handling of CPUID strings" |
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig index 4d73f53287b6..104275e191a8 100644 --- a/arch/x86/configs/i386_defconfig +++ b/arch/x86/configs/i386_defconfig | |||
@@ -1,13 +1,13 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.26-rc1 | 3 | # Linux kernel version: 2.6.27-rc4 |
4 | # Sun May 4 19:59:02 2008 | 4 | # Mon Aug 25 15:04:00 2008 |
5 | # | 5 | # |
6 | # CONFIG_64BIT is not set | 6 | # CONFIG_64BIT is not set |
7 | CONFIG_X86_32=y | 7 | CONFIG_X86_32=y |
8 | # CONFIG_X86_64 is not set | 8 | # CONFIG_X86_64 is not set |
9 | CONFIG_X86=y | 9 | CONFIG_X86=y |
10 | CONFIG_DEFCONFIG_LIST="arch/x86/configs/i386_defconfig" | 10 | CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" |
11 | # CONFIG_GENERIC_LOCKBREAK is not set | 11 | # CONFIG_GENERIC_LOCKBREAK is not set |
12 | CONFIG_GENERIC_TIME=y | 12 | CONFIG_GENERIC_TIME=y |
13 | CONFIG_GENERIC_CMOS_UPDATE=y | 13 | CONFIG_GENERIC_CMOS_UPDATE=y |
@@ -53,6 +53,7 @@ CONFIG_X86_HT=y | |||
53 | CONFIG_X86_BIOS_REBOOT=y | 53 | CONFIG_X86_BIOS_REBOOT=y |
54 | CONFIG_X86_TRAMPOLINE=y | 54 | CONFIG_X86_TRAMPOLINE=y |
55 | CONFIG_KTIME_SCALAR=y | 55 | CONFIG_KTIME_SCALAR=y |
56 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
56 | 57 | ||
57 | # | 58 | # |
58 | # General setup | 59 | # General setup |
@@ -82,6 +83,7 @@ CONFIG_CGROUPS=y | |||
82 | CONFIG_CGROUP_NS=y | 83 | CONFIG_CGROUP_NS=y |
83 | # CONFIG_CGROUP_DEVICE is not set | 84 | # CONFIG_CGROUP_DEVICE is not set |
84 | CONFIG_CPUSETS=y | 85 | CONFIG_CPUSETS=y |
86 | CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y | ||
85 | CONFIG_GROUP_SCHED=y | 87 | CONFIG_GROUP_SCHED=y |
86 | CONFIG_FAIR_GROUP_SCHED=y | 88 | CONFIG_FAIR_GROUP_SCHED=y |
87 | # CONFIG_RT_GROUP_SCHED is not set | 89 | # CONFIG_RT_GROUP_SCHED is not set |
@@ -105,7 +107,6 @@ CONFIG_SYSCTL=y | |||
105 | # CONFIG_EMBEDDED is not set | 107 | # CONFIG_EMBEDDED is not set |
106 | CONFIG_UID16=y | 108 | CONFIG_UID16=y |
107 | CONFIG_SYSCTL_SYSCALL=y | 109 | CONFIG_SYSCTL_SYSCALL=y |
108 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
109 | CONFIG_KALLSYMS=y | 110 | CONFIG_KALLSYMS=y |
110 | CONFIG_KALLSYMS_ALL=y | 111 | CONFIG_KALLSYMS_ALL=y |
111 | CONFIG_KALLSYMS_EXTRA_PASS=y | 112 | CONFIG_KALLSYMS_EXTRA_PASS=y |
@@ -113,6 +114,7 @@ CONFIG_HOTPLUG=y | |||
113 | CONFIG_PRINTK=y | 114 | CONFIG_PRINTK=y |
114 | CONFIG_BUG=y | 115 | CONFIG_BUG=y |
115 | CONFIG_ELF_CORE=y | 116 | CONFIG_ELF_CORE=y |
117 | CONFIG_PCSPKR_PLATFORM=y | ||
116 | # CONFIG_COMPAT_BRK is not set | 118 | # CONFIG_COMPAT_BRK is not set |
117 | CONFIG_BASE_FULL=y | 119 | CONFIG_BASE_FULL=y |
118 | CONFIG_FUTEX=y | 120 | CONFIG_FUTEX=y |
@@ -132,27 +134,35 @@ CONFIG_MARKERS=y | |||
132 | # CONFIG_OPROFILE is not set | 134 | # CONFIG_OPROFILE is not set |
133 | CONFIG_HAVE_OPROFILE=y | 135 | CONFIG_HAVE_OPROFILE=y |
134 | CONFIG_KPROBES=y | 136 | CONFIG_KPROBES=y |
137 | CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y | ||
135 | CONFIG_KRETPROBES=y | 138 | CONFIG_KRETPROBES=y |
139 | CONFIG_HAVE_IOREMAP_PROT=y | ||
136 | CONFIG_HAVE_KPROBES=y | 140 | CONFIG_HAVE_KPROBES=y |
137 | CONFIG_HAVE_KRETPROBES=y | 141 | CONFIG_HAVE_KRETPROBES=y |
142 | # CONFIG_HAVE_ARCH_TRACEHOOK is not set | ||
138 | # CONFIG_HAVE_DMA_ATTRS is not set | 143 | # CONFIG_HAVE_DMA_ATTRS is not set |
144 | CONFIG_USE_GENERIC_SMP_HELPERS=y | ||
145 | # CONFIG_HAVE_CLK is not set | ||
139 | CONFIG_PROC_PAGE_MONITOR=y | 146 | CONFIG_PROC_PAGE_MONITOR=y |
147 | CONFIG_HAVE_GENERIC_DMA_COHERENT=y | ||
140 | CONFIG_SLABINFO=y | 148 | CONFIG_SLABINFO=y |
141 | CONFIG_RT_MUTEXES=y | 149 | CONFIG_RT_MUTEXES=y |
142 | # CONFIG_TINY_SHMEM is not set | 150 | # CONFIG_TINY_SHMEM is not set |
143 | CONFIG_BASE_SMALL=0 | 151 | CONFIG_BASE_SMALL=0 |
144 | CONFIG_MODULES=y | 152 | CONFIG_MODULES=y |
153 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
145 | CONFIG_MODULE_UNLOAD=y | 154 | CONFIG_MODULE_UNLOAD=y |
146 | CONFIG_MODULE_FORCE_UNLOAD=y | 155 | CONFIG_MODULE_FORCE_UNLOAD=y |
147 | # CONFIG_MODVERSIONS is not set | 156 | # CONFIG_MODVERSIONS is not set |
148 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 157 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
149 | # CONFIG_KMOD is not set | 158 | CONFIG_KMOD=y |
150 | CONFIG_STOP_MACHINE=y | 159 | CONFIG_STOP_MACHINE=y |
151 | CONFIG_BLOCK=y | 160 | CONFIG_BLOCK=y |
152 | # CONFIG_LBD is not set | 161 | # CONFIG_LBD is not set |
153 | CONFIG_BLK_DEV_IO_TRACE=y | 162 | CONFIG_BLK_DEV_IO_TRACE=y |
154 | # CONFIG_LSF is not set | 163 | # CONFIG_LSF is not set |
155 | CONFIG_BLK_DEV_BSG=y | 164 | CONFIG_BLK_DEV_BSG=y |
165 | # CONFIG_BLK_DEV_INTEGRITY is not set | ||
156 | 166 | ||
157 | # | 167 | # |
158 | # IO Schedulers | 168 | # IO Schedulers |
@@ -176,19 +186,17 @@ CONFIG_NO_HZ=y | |||
176 | CONFIG_HIGH_RES_TIMERS=y | 186 | CONFIG_HIGH_RES_TIMERS=y |
177 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | 187 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y |
178 | CONFIG_SMP=y | 188 | CONFIG_SMP=y |
189 | CONFIG_X86_FIND_SMP_CONFIG=y | ||
190 | CONFIG_X86_MPPARSE=y | ||
179 | CONFIG_X86_PC=y | 191 | CONFIG_X86_PC=y |
180 | # CONFIG_X86_ELAN is not set | 192 | # CONFIG_X86_ELAN is not set |
181 | # CONFIG_X86_VOYAGER is not set | 193 | # CONFIG_X86_VOYAGER is not set |
182 | # CONFIG_X86_NUMAQ is not set | ||
183 | # CONFIG_X86_SUMMIT is not set | ||
184 | # CONFIG_X86_BIGSMP is not set | ||
185 | # CONFIG_X86_VISWS is not set | ||
186 | # CONFIG_X86_GENERICARCH is not set | 194 | # CONFIG_X86_GENERICARCH is not set |
187 | # CONFIG_X86_ES7000 is not set | ||
188 | # CONFIG_X86_RDC321X is not set | ||
189 | # CONFIG_X86_VSMP is not set | 195 | # CONFIG_X86_VSMP is not set |
196 | # CONFIG_X86_RDC321X is not set | ||
190 | CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y | 197 | CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y |
191 | # CONFIG_PARAVIRT_GUEST is not set | 198 | # CONFIG_PARAVIRT_GUEST is not set |
199 | # CONFIG_MEMTEST is not set | ||
192 | # CONFIG_M386 is not set | 200 | # CONFIG_M386 is not set |
193 | # CONFIG_M486 is not set | 201 | # CONFIG_M486 is not set |
194 | # CONFIG_M586 is not set | 202 | # CONFIG_M586 is not set |
@@ -215,21 +223,19 @@ CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y | |||
215 | # CONFIG_MPSC is not set | 223 | # CONFIG_MPSC is not set |
216 | CONFIG_MCORE2=y | 224 | CONFIG_MCORE2=y |
217 | # CONFIG_GENERIC_CPU is not set | 225 | # CONFIG_GENERIC_CPU is not set |
218 | # CONFIG_X86_GENERIC is not set | 226 | CONFIG_X86_GENERIC=y |
219 | CONFIG_X86_CPU=y | 227 | CONFIG_X86_CPU=y |
220 | CONFIG_X86_CMPXCHG=y | 228 | CONFIG_X86_CMPXCHG=y |
221 | CONFIG_X86_L1_CACHE_SHIFT=6 | 229 | CONFIG_X86_L1_CACHE_SHIFT=7 |
222 | CONFIG_X86_XADD=y | 230 | CONFIG_X86_XADD=y |
223 | CONFIG_X86_WP_WORKS_OK=y | 231 | CONFIG_X86_WP_WORKS_OK=y |
224 | CONFIG_X86_INVLPG=y | 232 | CONFIG_X86_INVLPG=y |
225 | CONFIG_X86_BSWAP=y | 233 | CONFIG_X86_BSWAP=y |
226 | CONFIG_X86_POPAD_OK=y | 234 | CONFIG_X86_POPAD_OK=y |
227 | CONFIG_X86_GOOD_APIC=y | ||
228 | CONFIG_X86_INTEL_USERCOPY=y | 235 | CONFIG_X86_INTEL_USERCOPY=y |
229 | CONFIG_X86_USE_PPRO_CHECKSUM=y | 236 | CONFIG_X86_USE_PPRO_CHECKSUM=y |
230 | CONFIG_X86_P6_NOP=y | ||
231 | CONFIG_X86_TSC=y | 237 | CONFIG_X86_TSC=y |
232 | CONFIG_X86_MINIMUM_CPU_FAMILY=6 | 238 | CONFIG_X86_MINIMUM_CPU_FAMILY=4 |
233 | CONFIG_X86_DEBUGCTLMSR=y | 239 | CONFIG_X86_DEBUGCTLMSR=y |
234 | CONFIG_HPET_TIMER=y | 240 | CONFIG_HPET_TIMER=y |
235 | CONFIG_HPET_EMULATE_RTC=y | 241 | CONFIG_HPET_EMULATE_RTC=y |
@@ -247,7 +253,7 @@ CONFIG_X86_IO_APIC=y | |||
247 | CONFIG_VM86=y | 253 | CONFIG_VM86=y |
248 | # CONFIG_TOSHIBA is not set | 254 | # CONFIG_TOSHIBA is not set |
249 | # CONFIG_I8K is not set | 255 | # CONFIG_I8K is not set |
250 | # CONFIG_X86_REBOOTFIXUPS is not set | 256 | CONFIG_X86_REBOOTFIXUPS=y |
251 | # CONFIG_MICROCODE is not set | 257 | # CONFIG_MICROCODE is not set |
252 | CONFIG_X86_MSR=y | 258 | CONFIG_X86_MSR=y |
253 | CONFIG_X86_CPUID=y | 259 | CONFIG_X86_CPUID=y |
@@ -256,32 +262,28 @@ CONFIG_HIGHMEM4G=y | |||
256 | # CONFIG_HIGHMEM64G is not set | 262 | # CONFIG_HIGHMEM64G is not set |
257 | CONFIG_PAGE_OFFSET=0xC0000000 | 263 | CONFIG_PAGE_OFFSET=0xC0000000 |
258 | CONFIG_HIGHMEM=y | 264 | CONFIG_HIGHMEM=y |
259 | CONFIG_NEED_NODE_MEMMAP_SIZE=y | ||
260 | CONFIG_ARCH_FLATMEM_ENABLE=y | 265 | CONFIG_ARCH_FLATMEM_ENABLE=y |
261 | CONFIG_ARCH_SPARSEMEM_ENABLE=y | 266 | CONFIG_ARCH_SPARSEMEM_ENABLE=y |
262 | CONFIG_ARCH_SELECT_MEMORY_MODEL=y | 267 | CONFIG_ARCH_SELECT_MEMORY_MODEL=y |
263 | CONFIG_SELECT_MEMORY_MODEL=y | 268 | CONFIG_SELECT_MEMORY_MODEL=y |
264 | # CONFIG_FLATMEM_MANUAL is not set | 269 | CONFIG_FLATMEM_MANUAL=y |
265 | # CONFIG_DISCONTIGMEM_MANUAL is not set | 270 | # CONFIG_DISCONTIGMEM_MANUAL is not set |
266 | CONFIG_SPARSEMEM_MANUAL=y | 271 | # CONFIG_SPARSEMEM_MANUAL is not set |
267 | CONFIG_SPARSEMEM=y | 272 | CONFIG_FLATMEM=y |
268 | CONFIG_HAVE_MEMORY_PRESENT=y | 273 | CONFIG_FLAT_NODE_MEM_MAP=y |
269 | CONFIG_SPARSEMEM_STATIC=y | 274 | CONFIG_SPARSEMEM_STATIC=y |
270 | # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set | 275 | # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set |
271 | |||
272 | # | ||
273 | # Memory hotplug is currently incompatible with Software Suspend | ||
274 | # | ||
275 | CONFIG_PAGEFLAGS_EXTENDED=y | 276 | CONFIG_PAGEFLAGS_EXTENDED=y |
276 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 277 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
277 | CONFIG_RESOURCES_64BIT=y | 278 | CONFIG_RESOURCES_64BIT=y |
278 | CONFIG_ZONE_DMA_FLAG=1 | 279 | CONFIG_ZONE_DMA_FLAG=1 |
279 | CONFIG_BOUNCE=y | 280 | CONFIG_BOUNCE=y |
280 | CONFIG_VIRT_TO_BUS=y | 281 | CONFIG_VIRT_TO_BUS=y |
281 | # CONFIG_HIGHPTE is not set | 282 | CONFIG_HIGHPTE=y |
282 | # CONFIG_MATH_EMULATION is not set | 283 | # CONFIG_MATH_EMULATION is not set |
283 | CONFIG_MTRR=y | 284 | CONFIG_MTRR=y |
284 | # CONFIG_X86_PAT is not set | 285 | # CONFIG_MTRR_SANITIZER is not set |
286 | CONFIG_X86_PAT=y | ||
285 | CONFIG_EFI=y | 287 | CONFIG_EFI=y |
286 | # CONFIG_IRQBALANCE is not set | 288 | # CONFIG_IRQBALANCE is not set |
287 | CONFIG_SECCOMP=y | 289 | CONFIG_SECCOMP=y |
@@ -293,6 +295,7 @@ CONFIG_HZ=1000 | |||
293 | CONFIG_SCHED_HRTICK=y | 295 | CONFIG_SCHED_HRTICK=y |
294 | CONFIG_KEXEC=y | 296 | CONFIG_KEXEC=y |
295 | CONFIG_CRASH_DUMP=y | 297 | CONFIG_CRASH_DUMP=y |
298 | # CONFIG_KEXEC_JUMP is not set | ||
296 | CONFIG_PHYSICAL_START=0x1000000 | 299 | CONFIG_PHYSICAL_START=0x1000000 |
297 | CONFIG_RELOCATABLE=y | 300 | CONFIG_RELOCATABLE=y |
298 | CONFIG_PHYSICAL_ALIGN=0x200000 | 301 | CONFIG_PHYSICAL_ALIGN=0x200000 |
@@ -312,6 +315,7 @@ CONFIG_PM_TRACE_RTC=y | |||
312 | CONFIG_PM_SLEEP_SMP=y | 315 | CONFIG_PM_SLEEP_SMP=y |
313 | CONFIG_PM_SLEEP=y | 316 | CONFIG_PM_SLEEP=y |
314 | CONFIG_SUSPEND=y | 317 | CONFIG_SUSPEND=y |
318 | # CONFIG_PM_TEST_SUSPEND is not set | ||
315 | CONFIG_SUSPEND_FREEZER=y | 319 | CONFIG_SUSPEND_FREEZER=y |
316 | CONFIG_HIBERNATION=y | 320 | CONFIG_HIBERNATION=y |
317 | CONFIG_PM_STD_PARTITION="" | 321 | CONFIG_PM_STD_PARTITION="" |
@@ -337,6 +341,7 @@ CONFIG_ACPI_THERMAL=y | |||
337 | CONFIG_ACPI_BLACKLIST_YEAR=0 | 341 | CONFIG_ACPI_BLACKLIST_YEAR=0 |
338 | # CONFIG_ACPI_DEBUG is not set | 342 | # CONFIG_ACPI_DEBUG is not set |
339 | CONFIG_ACPI_EC=y | 343 | CONFIG_ACPI_EC=y |
344 | # CONFIG_ACPI_PCI_SLOT is not set | ||
340 | CONFIG_ACPI_POWER=y | 345 | CONFIG_ACPI_POWER=y |
341 | CONFIG_ACPI_SYSTEM=y | 346 | CONFIG_ACPI_SYSTEM=y |
342 | CONFIG_X86_PM_TIMER=y | 347 | CONFIG_X86_PM_TIMER=y |
@@ -395,8 +400,8 @@ CONFIG_PCI=y | |||
395 | # CONFIG_PCI_GOBIOS is not set | 400 | # CONFIG_PCI_GOBIOS is not set |
396 | # CONFIG_PCI_GOMMCONFIG is not set | 401 | # CONFIG_PCI_GOMMCONFIG is not set |
397 | # CONFIG_PCI_GODIRECT is not set | 402 | # CONFIG_PCI_GODIRECT is not set |
398 | CONFIG_PCI_GOANY=y | ||
399 | # CONFIG_PCI_GOOLPC is not set | 403 | # CONFIG_PCI_GOOLPC is not set |
404 | CONFIG_PCI_GOANY=y | ||
400 | CONFIG_PCI_BIOS=y | 405 | CONFIG_PCI_BIOS=y |
401 | CONFIG_PCI_DIRECT=y | 406 | CONFIG_PCI_DIRECT=y |
402 | CONFIG_PCI_MMCONFIG=y | 407 | CONFIG_PCI_MMCONFIG=y |
@@ -448,10 +453,6 @@ CONFIG_HOTPLUG_PCI=y | |||
448 | CONFIG_BINFMT_ELF=y | 453 | CONFIG_BINFMT_ELF=y |
449 | # CONFIG_BINFMT_AOUT is not set | 454 | # CONFIG_BINFMT_AOUT is not set |
450 | CONFIG_BINFMT_MISC=y | 455 | CONFIG_BINFMT_MISC=y |
451 | |||
452 | # | ||
453 | # Networking | ||
454 | # | ||
455 | CONFIG_NET=y | 456 | CONFIG_NET=y |
456 | 457 | ||
457 | # | 458 | # |
@@ -475,7 +476,10 @@ CONFIG_IP_FIB_HASH=y | |||
475 | CONFIG_IP_MULTIPLE_TABLES=y | 476 | CONFIG_IP_MULTIPLE_TABLES=y |
476 | CONFIG_IP_ROUTE_MULTIPATH=y | 477 | CONFIG_IP_ROUTE_MULTIPATH=y |
477 | CONFIG_IP_ROUTE_VERBOSE=y | 478 | CONFIG_IP_ROUTE_VERBOSE=y |
478 | # CONFIG_IP_PNP is not set | 479 | CONFIG_IP_PNP=y |
480 | CONFIG_IP_PNP_DHCP=y | ||
481 | CONFIG_IP_PNP_BOOTP=y | ||
482 | CONFIG_IP_PNP_RARP=y | ||
479 | # CONFIG_NET_IPIP is not set | 483 | # CONFIG_NET_IPIP is not set |
480 | # CONFIG_NET_IPGRE is not set | 484 | # CONFIG_NET_IPGRE is not set |
481 | CONFIG_IP_MROUTE=y | 485 | CONFIG_IP_MROUTE=y |
@@ -618,7 +622,6 @@ CONFIG_NET_SCHED=y | |||
618 | # CONFIG_NET_SCH_HTB is not set | 622 | # CONFIG_NET_SCH_HTB is not set |
619 | # CONFIG_NET_SCH_HFSC is not set | 623 | # CONFIG_NET_SCH_HFSC is not set |
620 | # CONFIG_NET_SCH_PRIO is not set | 624 | # CONFIG_NET_SCH_PRIO is not set |
621 | # CONFIG_NET_SCH_RR is not set | ||
622 | # CONFIG_NET_SCH_RED is not set | 625 | # CONFIG_NET_SCH_RED is not set |
623 | # CONFIG_NET_SCH_SFQ is not set | 626 | # CONFIG_NET_SCH_SFQ is not set |
624 | # CONFIG_NET_SCH_TEQL is not set | 627 | # CONFIG_NET_SCH_TEQL is not set |
@@ -680,28 +683,19 @@ CONFIG_FIB_RULES=y | |||
680 | CONFIG_CFG80211=y | 683 | CONFIG_CFG80211=y |
681 | CONFIG_NL80211=y | 684 | CONFIG_NL80211=y |
682 | CONFIG_WIRELESS_EXT=y | 685 | CONFIG_WIRELESS_EXT=y |
686 | CONFIG_WIRELESS_EXT_SYSFS=y | ||
683 | CONFIG_MAC80211=y | 687 | CONFIG_MAC80211=y |
684 | 688 | ||
685 | # | 689 | # |
686 | # Rate control algorithm selection | 690 | # Rate control algorithm selection |
687 | # | 691 | # |
692 | CONFIG_MAC80211_RC_PID=y | ||
688 | CONFIG_MAC80211_RC_DEFAULT_PID=y | 693 | CONFIG_MAC80211_RC_DEFAULT_PID=y |
689 | # CONFIG_MAC80211_RC_DEFAULT_NONE is not set | ||
690 | |||
691 | # | ||
692 | # Selecting 'y' for an algorithm will | ||
693 | # | ||
694 | |||
695 | # | ||
696 | # build the algorithm into mac80211. | ||
697 | # | ||
698 | CONFIG_MAC80211_RC_DEFAULT="pid" | 694 | CONFIG_MAC80211_RC_DEFAULT="pid" |
699 | CONFIG_MAC80211_RC_PID=y | ||
700 | # CONFIG_MAC80211_MESH is not set | 695 | # CONFIG_MAC80211_MESH is not set |
701 | CONFIG_MAC80211_LEDS=y | 696 | CONFIG_MAC80211_LEDS=y |
702 | # CONFIG_MAC80211_DEBUGFS is not set | 697 | # CONFIG_MAC80211_DEBUGFS is not set |
703 | # CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set | 698 | # CONFIG_MAC80211_DEBUG_MENU is not set |
704 | # CONFIG_MAC80211_DEBUG is not set | ||
705 | # CONFIG_IEEE80211 is not set | 699 | # CONFIG_IEEE80211 is not set |
706 | # CONFIG_RFKILL is not set | 700 | # CONFIG_RFKILL is not set |
707 | # CONFIG_NET_9P is not set | 701 | # CONFIG_NET_9P is not set |
@@ -717,6 +711,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
717 | CONFIG_STANDALONE=y | 711 | CONFIG_STANDALONE=y |
718 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 712 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
719 | CONFIG_FW_LOADER=y | 713 | CONFIG_FW_LOADER=y |
714 | CONFIG_FIRMWARE_IN_KERNEL=y | ||
715 | CONFIG_EXTRA_FIRMWARE="" | ||
720 | # CONFIG_DEBUG_DRIVER is not set | 716 | # CONFIG_DEBUG_DRIVER is not set |
721 | CONFIG_DEBUG_DEVRES=y | 717 | CONFIG_DEBUG_DEVRES=y |
722 | # CONFIG_SYS_HYPERVISOR is not set | 718 | # CONFIG_SYS_HYPERVISOR is not set |
@@ -749,6 +745,7 @@ CONFIG_BLK_DEV_RAM_SIZE=16384 | |||
749 | # CONFIG_BLK_DEV_XIP is not set | 745 | # CONFIG_BLK_DEV_XIP is not set |
750 | # CONFIG_CDROM_PKTCDVD is not set | 746 | # CONFIG_CDROM_PKTCDVD is not set |
751 | # CONFIG_ATA_OVER_ETH is not set | 747 | # CONFIG_ATA_OVER_ETH is not set |
748 | # CONFIG_BLK_DEV_HD is not set | ||
752 | CONFIG_MISC_DEVICES=y | 749 | CONFIG_MISC_DEVICES=y |
753 | # CONFIG_IBM_ASM is not set | 750 | # CONFIG_IBM_ASM is not set |
754 | # CONFIG_PHANTOM is not set | 751 | # CONFIG_PHANTOM is not set |
@@ -760,10 +757,12 @@ CONFIG_MISC_DEVICES=y | |||
760 | # CONFIG_FUJITSU_LAPTOP is not set | 757 | # CONFIG_FUJITSU_LAPTOP is not set |
761 | # CONFIG_TC1100_WMI is not set | 758 | # CONFIG_TC1100_WMI is not set |
762 | # CONFIG_MSI_LAPTOP is not set | 759 | # CONFIG_MSI_LAPTOP is not set |
760 | # CONFIG_COMPAL_LAPTOP is not set | ||
763 | # CONFIG_SONY_LAPTOP is not set | 761 | # CONFIG_SONY_LAPTOP is not set |
764 | # CONFIG_THINKPAD_ACPI is not set | 762 | # CONFIG_THINKPAD_ACPI is not set |
765 | # CONFIG_INTEL_MENLOW is not set | 763 | # CONFIG_INTEL_MENLOW is not set |
766 | # CONFIG_ENCLOSURE_SERVICES is not set | 764 | # CONFIG_ENCLOSURE_SERVICES is not set |
765 | # CONFIG_HP_ILO is not set | ||
767 | CONFIG_HAVE_IDE=y | 766 | CONFIG_HAVE_IDE=y |
768 | # CONFIG_IDE is not set | 767 | # CONFIG_IDE is not set |
769 | 768 | ||
@@ -802,12 +801,13 @@ CONFIG_SCSI_WAIT_SCAN=m | |||
802 | # | 801 | # |
803 | CONFIG_SCSI_SPI_ATTRS=y | 802 | CONFIG_SCSI_SPI_ATTRS=y |
804 | # CONFIG_SCSI_FC_ATTRS is not set | 803 | # CONFIG_SCSI_FC_ATTRS is not set |
805 | # CONFIG_SCSI_ISCSI_ATTRS is not set | 804 | CONFIG_SCSI_ISCSI_ATTRS=y |
806 | # CONFIG_SCSI_SAS_ATTRS is not set | 805 | # CONFIG_SCSI_SAS_ATTRS is not set |
807 | # CONFIG_SCSI_SAS_LIBSAS is not set | 806 | # CONFIG_SCSI_SAS_LIBSAS is not set |
808 | # CONFIG_SCSI_SRP_ATTRS is not set | 807 | # CONFIG_SCSI_SRP_ATTRS is not set |
809 | # CONFIG_SCSI_LOWLEVEL is not set | 808 | # CONFIG_SCSI_LOWLEVEL is not set |
810 | # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set | 809 | # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set |
810 | # CONFIG_SCSI_DH is not set | ||
811 | CONFIG_ATA=y | 811 | CONFIG_ATA=y |
812 | # CONFIG_ATA_NONSTANDARD is not set | 812 | # CONFIG_ATA_NONSTANDARD is not set |
813 | CONFIG_ATA_ACPI=y | 813 | CONFIG_ATA_ACPI=y |
@@ -842,7 +842,7 @@ CONFIG_PATA_AMD=y | |||
842 | # CONFIG_PATA_CS5536 is not set | 842 | # CONFIG_PATA_CS5536 is not set |
843 | # CONFIG_PATA_CYPRESS is not set | 843 | # CONFIG_PATA_CYPRESS is not set |
844 | # CONFIG_PATA_EFAR is not set | 844 | # CONFIG_PATA_EFAR is not set |
845 | # CONFIG_ATA_GENERIC is not set | 845 | CONFIG_ATA_GENERIC=y |
846 | # CONFIG_PATA_HPT366 is not set | 846 | # CONFIG_PATA_HPT366 is not set |
847 | # CONFIG_PATA_HPT37X is not set | 847 | # CONFIG_PATA_HPT37X is not set |
848 | # CONFIG_PATA_HPT3X2N is not set | 848 | # CONFIG_PATA_HPT3X2N is not set |
@@ -852,7 +852,7 @@ CONFIG_PATA_AMD=y | |||
852 | # CONFIG_PATA_JMICRON is not set | 852 | # CONFIG_PATA_JMICRON is not set |
853 | # CONFIG_PATA_TRIFLEX is not set | 853 | # CONFIG_PATA_TRIFLEX is not set |
854 | # CONFIG_PATA_MARVELL is not set | 854 | # CONFIG_PATA_MARVELL is not set |
855 | # CONFIG_PATA_MPIIX is not set | 855 | CONFIG_PATA_MPIIX=y |
856 | CONFIG_PATA_OLDPIIX=y | 856 | CONFIG_PATA_OLDPIIX=y |
857 | # CONFIG_PATA_NETCELL is not set | 857 | # CONFIG_PATA_NETCELL is not set |
858 | # CONFIG_PATA_NINJA32 is not set | 858 | # CONFIG_PATA_NINJA32 is not set |
@@ -871,6 +871,7 @@ CONFIG_PATA_OLDPIIX=y | |||
871 | # CONFIG_PATA_SIS is not set | 871 | # CONFIG_PATA_SIS is not set |
872 | # CONFIG_PATA_VIA is not set | 872 | # CONFIG_PATA_VIA is not set |
873 | # CONFIG_PATA_WINBOND is not set | 873 | # CONFIG_PATA_WINBOND is not set |
874 | CONFIG_PATA_SCH=y | ||
874 | CONFIG_MD=y | 875 | CONFIG_MD=y |
875 | CONFIG_BLK_DEV_MD=y | 876 | CONFIG_BLK_DEV_MD=y |
876 | # CONFIG_MD_LINEAR is not set | 877 | # CONFIG_MD_LINEAR is not set |
@@ -894,13 +895,16 @@ CONFIG_DM_ZERO=y | |||
894 | # | 895 | # |
895 | # IEEE 1394 (FireWire) support | 896 | # IEEE 1394 (FireWire) support |
896 | # | 897 | # |
898 | |||
899 | # | ||
900 | # Enable only one of the two stacks, unless you know what you are doing | ||
901 | # | ||
897 | # CONFIG_FIREWIRE is not set | 902 | # CONFIG_FIREWIRE is not set |
898 | # CONFIG_IEEE1394 is not set | 903 | # CONFIG_IEEE1394 is not set |
899 | # CONFIG_I2O is not set | 904 | # CONFIG_I2O is not set |
900 | CONFIG_MACINTOSH_DRIVERS=y | 905 | CONFIG_MACINTOSH_DRIVERS=y |
901 | CONFIG_MAC_EMUMOUSEBTN=y | 906 | CONFIG_MAC_EMUMOUSEBTN=y |
902 | CONFIG_NETDEVICES=y | 907 | CONFIG_NETDEVICES=y |
903 | # CONFIG_NETDEVICES_MULTIQUEUE is not set | ||
904 | # CONFIG_IFB is not set | 908 | # CONFIG_IFB is not set |
905 | # CONFIG_DUMMY is not set | 909 | # CONFIG_DUMMY is not set |
906 | # CONFIG_BONDING is not set | 910 | # CONFIG_BONDING is not set |
@@ -910,7 +914,23 @@ CONFIG_NETDEVICES=y | |||
910 | # CONFIG_VETH is not set | 914 | # CONFIG_VETH is not set |
911 | # CONFIG_NET_SB1000 is not set | 915 | # CONFIG_NET_SB1000 is not set |
912 | # CONFIG_ARCNET is not set | 916 | # CONFIG_ARCNET is not set |
913 | # CONFIG_PHYLIB is not set | 917 | CONFIG_PHYLIB=y |
918 | |||
919 | # | ||
920 | # MII PHY device drivers | ||
921 | # | ||
922 | # CONFIG_MARVELL_PHY is not set | ||
923 | # CONFIG_DAVICOM_PHY is not set | ||
924 | # CONFIG_QSEMI_PHY is not set | ||
925 | # CONFIG_LXT_PHY is not set | ||
926 | # CONFIG_CICADA_PHY is not set | ||
927 | # CONFIG_VITESSE_PHY is not set | ||
928 | # CONFIG_SMSC_PHY is not set | ||
929 | # CONFIG_BROADCOM_PHY is not set | ||
930 | # CONFIG_ICPLUS_PHY is not set | ||
931 | # CONFIG_REALTEK_PHY is not set | ||
932 | # CONFIG_FIXED_PHY is not set | ||
933 | # CONFIG_MDIO_BITBANG is not set | ||
914 | CONFIG_NET_ETHERNET=y | 934 | CONFIG_NET_ETHERNET=y |
915 | CONFIG_MII=y | 935 | CONFIG_MII=y |
916 | # CONFIG_HAPPYMEAL is not set | 936 | # CONFIG_HAPPYMEAL is not set |
@@ -943,10 +963,10 @@ CONFIG_FORCEDETH=y | |||
943 | CONFIG_E100=y | 963 | CONFIG_E100=y |
944 | # CONFIG_FEALNX is not set | 964 | # CONFIG_FEALNX is not set |
945 | # CONFIG_NATSEMI is not set | 965 | # CONFIG_NATSEMI is not set |
946 | # CONFIG_NE2K_PCI is not set | 966 | CONFIG_NE2K_PCI=y |
947 | # CONFIG_8139CP is not set | 967 | # CONFIG_8139CP is not set |
948 | CONFIG_8139TOO=y | 968 | CONFIG_8139TOO=y |
949 | CONFIG_8139TOO_PIO=y | 969 | # CONFIG_8139TOO_PIO is not set |
950 | # CONFIG_8139TOO_TUNE_TWISTER is not set | 970 | # CONFIG_8139TOO_TUNE_TWISTER is not set |
951 | # CONFIG_8139TOO_8129 is not set | 971 | # CONFIG_8139TOO_8129 is not set |
952 | # CONFIG_8139_OLD_RX_RESET is not set | 972 | # CONFIG_8139_OLD_RX_RESET is not set |
@@ -961,25 +981,24 @@ CONFIG_NETDEV_1000=y | |||
961 | # CONFIG_ACENIC is not set | 981 | # CONFIG_ACENIC is not set |
962 | # CONFIG_DL2K is not set | 982 | # CONFIG_DL2K is not set |
963 | CONFIG_E1000=y | 983 | CONFIG_E1000=y |
964 | # CONFIG_E1000_NAPI is not set | ||
965 | # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set | 984 | # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set |
966 | # CONFIG_E1000E is not set | 985 | CONFIG_E1000E=y |
967 | # CONFIG_E1000E_ENABLED is not set | ||
968 | # CONFIG_IP1000 is not set | 986 | # CONFIG_IP1000 is not set |
969 | # CONFIG_IGB is not set | 987 | # CONFIG_IGB is not set |
970 | # CONFIG_NS83820 is not set | 988 | # CONFIG_NS83820 is not set |
971 | # CONFIG_HAMACHI is not set | 989 | # CONFIG_HAMACHI is not set |
972 | # CONFIG_YELLOWFIN is not set | 990 | # CONFIG_YELLOWFIN is not set |
973 | # CONFIG_R8169 is not set | 991 | CONFIG_R8169=y |
974 | # CONFIG_SIS190 is not set | 992 | # CONFIG_SIS190 is not set |
975 | # CONFIG_SKGE is not set | 993 | # CONFIG_SKGE is not set |
976 | CONFIG_SKY2=y | 994 | CONFIG_SKY2=y |
977 | # CONFIG_SKY2_DEBUG is not set | 995 | # CONFIG_SKY2_DEBUG is not set |
978 | # CONFIG_VIA_VELOCITY is not set | 996 | # CONFIG_VIA_VELOCITY is not set |
979 | CONFIG_TIGON3=y | 997 | CONFIG_TIGON3=y |
980 | # CONFIG_BNX2 is not set | 998 | CONFIG_BNX2=y |
981 | # CONFIG_QLA3XXX is not set | 999 | # CONFIG_QLA3XXX is not set |
982 | # CONFIG_ATL1 is not set | 1000 | # CONFIG_ATL1 is not set |
1001 | # CONFIG_ATL1E is not set | ||
983 | CONFIG_NETDEV_10000=y | 1002 | CONFIG_NETDEV_10000=y |
984 | # CONFIG_CHELSIO_T1 is not set | 1003 | # CONFIG_CHELSIO_T1 is not set |
985 | # CONFIG_CHELSIO_T3 is not set | 1004 | # CONFIG_CHELSIO_T3 is not set |
@@ -1019,13 +1038,14 @@ CONFIG_WLAN_80211=y | |||
1019 | # CONFIG_RTL8180 is not set | 1038 | # CONFIG_RTL8180 is not set |
1020 | # CONFIG_RTL8187 is not set | 1039 | # CONFIG_RTL8187 is not set |
1021 | # CONFIG_ADM8211 is not set | 1040 | # CONFIG_ADM8211 is not set |
1041 | # CONFIG_MAC80211_HWSIM is not set | ||
1022 | # CONFIG_P54_COMMON is not set | 1042 | # CONFIG_P54_COMMON is not set |
1023 | CONFIG_ATH5K=y | 1043 | CONFIG_ATH5K=y |
1024 | # CONFIG_ATH5K_DEBUG is not set | 1044 | # CONFIG_ATH5K_DEBUG is not set |
1025 | # CONFIG_IWLWIFI is not set | 1045 | # CONFIG_ATH9K is not set |
1026 | # CONFIG_IWLCORE is not set | 1046 | # CONFIG_IWLCORE is not set |
1027 | # CONFIG_IWLWIFI_LEDS is not set | 1047 | # CONFIG_IWLWIFI_LEDS is not set |
1028 | # CONFIG_IWL4965 is not set | 1048 | # CONFIG_IWLAGN is not set |
1029 | # CONFIG_IWL3945 is not set | 1049 | # CONFIG_IWL3945 is not set |
1030 | # CONFIG_HOSTAP is not set | 1050 | # CONFIG_HOSTAP is not set |
1031 | # CONFIG_B43 is not set | 1051 | # CONFIG_B43 is not set |
@@ -1105,6 +1125,7 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y | |||
1105 | # CONFIG_MOUSE_PS2_TOUCHKIT is not set | 1125 | # CONFIG_MOUSE_PS2_TOUCHKIT is not set |
1106 | # CONFIG_MOUSE_SERIAL is not set | 1126 | # CONFIG_MOUSE_SERIAL is not set |
1107 | # CONFIG_MOUSE_APPLETOUCH is not set | 1127 | # CONFIG_MOUSE_APPLETOUCH is not set |
1128 | # CONFIG_MOUSE_BCM5974 is not set | ||
1108 | # CONFIG_MOUSE_VSXXXAA is not set | 1129 | # CONFIG_MOUSE_VSXXXAA is not set |
1109 | CONFIG_INPUT_JOYSTICK=y | 1130 | CONFIG_INPUT_JOYSTICK=y |
1110 | # CONFIG_JOYSTICK_ANALOG is not set | 1131 | # CONFIG_JOYSTICK_ANALOG is not set |
@@ -1139,12 +1160,14 @@ CONFIG_INPUT_TOUCHSCREEN=y | |||
1139 | # CONFIG_TOUCHSCREEN_GUNZE is not set | 1160 | # CONFIG_TOUCHSCREEN_GUNZE is not set |
1140 | # CONFIG_TOUCHSCREEN_ELO is not set | 1161 | # CONFIG_TOUCHSCREEN_ELO is not set |
1141 | # CONFIG_TOUCHSCREEN_MTOUCH is not set | 1162 | # CONFIG_TOUCHSCREEN_MTOUCH is not set |
1163 | # CONFIG_TOUCHSCREEN_INEXIO is not set | ||
1142 | # CONFIG_TOUCHSCREEN_MK712 is not set | 1164 | # CONFIG_TOUCHSCREEN_MK712 is not set |
1143 | # CONFIG_TOUCHSCREEN_PENMOUNT is not set | 1165 | # CONFIG_TOUCHSCREEN_PENMOUNT is not set |
1144 | # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set | 1166 | # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set |
1145 | # CONFIG_TOUCHSCREEN_TOUCHWIN is not set | 1167 | # CONFIG_TOUCHSCREEN_TOUCHWIN is not set |
1146 | # CONFIG_TOUCHSCREEN_UCB1400 is not set | 1168 | # CONFIG_TOUCHSCREEN_UCB1400 is not set |
1147 | # CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set | 1169 | # CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set |
1170 | # CONFIG_TOUCHSCREEN_TOUCHIT213 is not set | ||
1148 | CONFIG_INPUT_MISC=y | 1171 | CONFIG_INPUT_MISC=y |
1149 | # CONFIG_INPUT_PCSPKR is not set | 1172 | # CONFIG_INPUT_PCSPKR is not set |
1150 | # CONFIG_INPUT_APANEL is not set | 1173 | # CONFIG_INPUT_APANEL is not set |
@@ -1173,6 +1196,7 @@ CONFIG_SERIO_LIBPS2=y | |||
1173 | # Character devices | 1196 | # Character devices |
1174 | # | 1197 | # |
1175 | CONFIG_VT=y | 1198 | CONFIG_VT=y |
1199 | CONFIG_CONSOLE_TRANSLATIONS=y | ||
1176 | CONFIG_VT_CONSOLE=y | 1200 | CONFIG_VT_CONSOLE=y |
1177 | CONFIG_HW_CONSOLE=y | 1201 | CONFIG_HW_CONSOLE=y |
1178 | CONFIG_VT_HW_CONSOLE_BINDING=y | 1202 | CONFIG_VT_HW_CONSOLE_BINDING=y |
@@ -1223,8 +1247,8 @@ CONFIG_UNIX98_PTYS=y | |||
1223 | # CONFIG_LEGACY_PTYS is not set | 1247 | # CONFIG_LEGACY_PTYS is not set |
1224 | # CONFIG_IPMI_HANDLER is not set | 1248 | # CONFIG_IPMI_HANDLER is not set |
1225 | CONFIG_HW_RANDOM=y | 1249 | CONFIG_HW_RANDOM=y |
1226 | # CONFIG_HW_RANDOM_INTEL is not set | 1250 | CONFIG_HW_RANDOM_INTEL=y |
1227 | # CONFIG_HW_RANDOM_AMD is not set | 1251 | CONFIG_HW_RANDOM_AMD=y |
1228 | CONFIG_HW_RANDOM_GEODE=y | 1252 | CONFIG_HW_RANDOM_GEODE=y |
1229 | CONFIG_HW_RANDOM_VIA=y | 1253 | CONFIG_HW_RANDOM_VIA=y |
1230 | CONFIG_NVRAM=y | 1254 | CONFIG_NVRAM=y |
@@ -1245,7 +1269,6 @@ CONFIG_NVRAM=y | |||
1245 | # CONFIG_CS5535_GPIO is not set | 1269 | # CONFIG_CS5535_GPIO is not set |
1246 | # CONFIG_RAW_DRIVER is not set | 1270 | # CONFIG_RAW_DRIVER is not set |
1247 | CONFIG_HPET=y | 1271 | CONFIG_HPET=y |
1248 | # CONFIG_HPET_RTC_IRQ is not set | ||
1249 | # CONFIG_HPET_MMAP is not set | 1272 | # CONFIG_HPET_MMAP is not set |
1250 | # CONFIG_HANGCHECK_TIMER is not set | 1273 | # CONFIG_HANGCHECK_TIMER is not set |
1251 | # CONFIG_TCG_TPM is not set | 1274 | # CONFIG_TCG_TPM is not set |
@@ -1254,43 +1277,64 @@ CONFIG_DEVPORT=y | |||
1254 | CONFIG_I2C=y | 1277 | CONFIG_I2C=y |
1255 | CONFIG_I2C_BOARDINFO=y | 1278 | CONFIG_I2C_BOARDINFO=y |
1256 | # CONFIG_I2C_CHARDEV is not set | 1279 | # CONFIG_I2C_CHARDEV is not set |
1280 | CONFIG_I2C_HELPER_AUTO=y | ||
1257 | 1281 | ||
1258 | # | 1282 | # |
1259 | # I2C Hardware Bus support | 1283 | # I2C Hardware Bus support |
1260 | # | 1284 | # |
1285 | |||
1286 | # | ||
1287 | # PC SMBus host controller drivers | ||
1288 | # | ||
1261 | # CONFIG_I2C_ALI1535 is not set | 1289 | # CONFIG_I2C_ALI1535 is not set |
1262 | # CONFIG_I2C_ALI1563 is not set | 1290 | # CONFIG_I2C_ALI1563 is not set |
1263 | # CONFIG_I2C_ALI15X3 is not set | 1291 | # CONFIG_I2C_ALI15X3 is not set |
1264 | # CONFIG_I2C_AMD756 is not set | 1292 | # CONFIG_I2C_AMD756 is not set |
1265 | # CONFIG_I2C_AMD8111 is not set | 1293 | # CONFIG_I2C_AMD8111 is not set |
1266 | CONFIG_I2C_I801=y | 1294 | CONFIG_I2C_I801=y |
1267 | # CONFIG_I2C_I810 is not set | 1295 | # CONFIG_I2C_ISCH is not set |
1268 | # CONFIG_I2C_PIIX4 is not set | 1296 | # CONFIG_I2C_PIIX4 is not set |
1269 | # CONFIG_I2C_NFORCE2 is not set | 1297 | # CONFIG_I2C_NFORCE2 is not set |
1270 | # CONFIG_I2C_OCORES is not set | ||
1271 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
1272 | # CONFIG_I2C_PROSAVAGE is not set | ||
1273 | # CONFIG_I2C_SAVAGE4 is not set | ||
1274 | # CONFIG_I2C_SIMTEC is not set | ||
1275 | # CONFIG_SCx200_ACB is not set | ||
1276 | # CONFIG_I2C_SIS5595 is not set | 1298 | # CONFIG_I2C_SIS5595 is not set |
1277 | # CONFIG_I2C_SIS630 is not set | 1299 | # CONFIG_I2C_SIS630 is not set |
1278 | # CONFIG_I2C_SIS96X is not set | 1300 | # CONFIG_I2C_SIS96X is not set |
1279 | # CONFIG_I2C_TAOS_EVM is not set | ||
1280 | # CONFIG_I2C_STUB is not set | ||
1281 | # CONFIG_I2C_TINY_USB is not set | ||
1282 | # CONFIG_I2C_VIA is not set | 1301 | # CONFIG_I2C_VIA is not set |
1283 | # CONFIG_I2C_VIAPRO is not set | 1302 | # CONFIG_I2C_VIAPRO is not set |
1303 | |||
1304 | # | ||
1305 | # I2C system bus drivers (mostly embedded / system-on-chip) | ||
1306 | # | ||
1307 | # CONFIG_I2C_OCORES is not set | ||
1308 | # CONFIG_I2C_SIMTEC is not set | ||
1309 | |||
1310 | # | ||
1311 | # External I2C/SMBus adapter drivers | ||
1312 | # | ||
1313 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
1314 | # CONFIG_I2C_TAOS_EVM is not set | ||
1315 | # CONFIG_I2C_TINY_USB is not set | ||
1316 | |||
1317 | # | ||
1318 | # Graphics adapter I2C/DDC channel drivers | ||
1319 | # | ||
1284 | # CONFIG_I2C_VOODOO3 is not set | 1320 | # CONFIG_I2C_VOODOO3 is not set |
1321 | |||
1322 | # | ||
1323 | # Other I2C/SMBus bus drivers | ||
1324 | # | ||
1285 | # CONFIG_I2C_PCA_PLATFORM is not set | 1325 | # CONFIG_I2C_PCA_PLATFORM is not set |
1326 | # CONFIG_I2C_STUB is not set | ||
1327 | # CONFIG_SCx200_ACB is not set | ||
1286 | 1328 | ||
1287 | # | 1329 | # |
1288 | # Miscellaneous I2C Chip support | 1330 | # Miscellaneous I2C Chip support |
1289 | # | 1331 | # |
1290 | # CONFIG_DS1682 is not set | 1332 | # CONFIG_DS1682 is not set |
1333 | # CONFIG_AT24 is not set | ||
1291 | # CONFIG_SENSORS_EEPROM is not set | 1334 | # CONFIG_SENSORS_EEPROM is not set |
1292 | # CONFIG_SENSORS_PCF8574 is not set | 1335 | # CONFIG_SENSORS_PCF8574 is not set |
1293 | # CONFIG_PCF8575 is not set | 1336 | # CONFIG_PCF8575 is not set |
1337 | # CONFIG_SENSORS_PCA9539 is not set | ||
1294 | # CONFIG_SENSORS_PCF8591 is not set | 1338 | # CONFIG_SENSORS_PCF8591 is not set |
1295 | # CONFIG_SENSORS_MAX6875 is not set | 1339 | # CONFIG_SENSORS_MAX6875 is not set |
1296 | # CONFIG_SENSORS_TSL2550 is not set | 1340 | # CONFIG_SENSORS_TSL2550 is not set |
@@ -1299,6 +1343,8 @@ CONFIG_I2C_I801=y | |||
1299 | # CONFIG_I2C_DEBUG_BUS is not set | 1343 | # CONFIG_I2C_DEBUG_BUS is not set |
1300 | # CONFIG_I2C_DEBUG_CHIP is not set | 1344 | # CONFIG_I2C_DEBUG_CHIP is not set |
1301 | # CONFIG_SPI is not set | 1345 | # CONFIG_SPI is not set |
1346 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | ||
1347 | # CONFIG_GPIOLIB is not set | ||
1302 | # CONFIG_W1 is not set | 1348 | # CONFIG_W1 is not set |
1303 | CONFIG_POWER_SUPPLY=y | 1349 | CONFIG_POWER_SUPPLY=y |
1304 | # CONFIG_POWER_SUPPLY_DEBUG is not set | 1350 | # CONFIG_POWER_SUPPLY_DEBUG is not set |
@@ -1360,8 +1406,10 @@ CONFIG_SSB_POSSIBLE=y | |||
1360 | # | 1406 | # |
1361 | # Multifunction device drivers | 1407 | # Multifunction device drivers |
1362 | # | 1408 | # |
1409 | # CONFIG_MFD_CORE is not set | ||
1363 | # CONFIG_MFD_SM501 is not set | 1410 | # CONFIG_MFD_SM501 is not set |
1364 | # CONFIG_HTC_PASIC3 is not set | 1411 | # CONFIG_HTC_PASIC3 is not set |
1412 | # CONFIG_MFD_TMIO is not set | ||
1365 | 1413 | ||
1366 | # | 1414 | # |
1367 | # Multimedia devices | 1415 | # Multimedia devices |
@@ -1372,6 +1420,7 @@ CONFIG_SSB_POSSIBLE=y | |||
1372 | # | 1420 | # |
1373 | # CONFIG_VIDEO_DEV is not set | 1421 | # CONFIG_VIDEO_DEV is not set |
1374 | # CONFIG_DVB_CORE is not set | 1422 | # CONFIG_DVB_CORE is not set |
1423 | # CONFIG_VIDEO_MEDIA is not set | ||
1375 | 1424 | ||
1376 | # | 1425 | # |
1377 | # Multimedia drivers | 1426 | # Multimedia drivers |
@@ -1418,7 +1467,6 @@ CONFIG_FB_CFB_IMAGEBLIT=y | |||
1418 | # CONFIG_FB_SYS_IMAGEBLIT is not set | 1467 | # CONFIG_FB_SYS_IMAGEBLIT is not set |
1419 | # CONFIG_FB_FOREIGN_ENDIAN is not set | 1468 | # CONFIG_FB_FOREIGN_ENDIAN is not set |
1420 | # CONFIG_FB_SYS_FOPS is not set | 1469 | # CONFIG_FB_SYS_FOPS is not set |
1421 | CONFIG_FB_DEFERRED_IO=y | ||
1422 | # CONFIG_FB_SVGALIB is not set | 1470 | # CONFIG_FB_SVGALIB is not set |
1423 | # CONFIG_FB_MACMODES is not set | 1471 | # CONFIG_FB_MACMODES is not set |
1424 | # CONFIG_FB_BACKLIGHT is not set | 1472 | # CONFIG_FB_BACKLIGHT is not set |
@@ -1463,6 +1511,7 @@ CONFIG_FB_EFI=y | |||
1463 | # CONFIG_FB_TRIDENT is not set | 1511 | # CONFIG_FB_TRIDENT is not set |
1464 | # CONFIG_FB_ARK is not set | 1512 | # CONFIG_FB_ARK is not set |
1465 | # CONFIG_FB_PM3 is not set | 1513 | # CONFIG_FB_PM3 is not set |
1514 | # CONFIG_FB_CARMINE is not set | ||
1466 | # CONFIG_FB_GEODE is not set | 1515 | # CONFIG_FB_GEODE is not set |
1467 | # CONFIG_FB_VIRTUAL is not set | 1516 | # CONFIG_FB_VIRTUAL is not set |
1468 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 1517 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
@@ -1470,6 +1519,7 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y | |||
1470 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | 1519 | CONFIG_BACKLIGHT_CLASS_DEVICE=y |
1471 | # CONFIG_BACKLIGHT_CORGI is not set | 1520 | # CONFIG_BACKLIGHT_CORGI is not set |
1472 | # CONFIG_BACKLIGHT_PROGEAR is not set | 1521 | # CONFIG_BACKLIGHT_PROGEAR is not set |
1522 | # CONFIG_BACKLIGHT_MBP_NVIDIA is not set | ||
1473 | 1523 | ||
1474 | # | 1524 | # |
1475 | # Display device support | 1525 | # Display device support |
@@ -1489,15 +1539,7 @@ CONFIG_LOGO=y | |||
1489 | # CONFIG_LOGO_LINUX_MONO is not set | 1539 | # CONFIG_LOGO_LINUX_MONO is not set |
1490 | # CONFIG_LOGO_LINUX_VGA16 is not set | 1540 | # CONFIG_LOGO_LINUX_VGA16 is not set |
1491 | CONFIG_LOGO_LINUX_CLUT224=y | 1541 | CONFIG_LOGO_LINUX_CLUT224=y |
1492 | |||
1493 | # | ||
1494 | # Sound | ||
1495 | # | ||
1496 | CONFIG_SOUND=y | 1542 | CONFIG_SOUND=y |
1497 | |||
1498 | # | ||
1499 | # Advanced Linux Sound Architecture | ||
1500 | # | ||
1501 | CONFIG_SND=y | 1543 | CONFIG_SND=y |
1502 | CONFIG_SND_TIMER=y | 1544 | CONFIG_SND_TIMER=y |
1503 | CONFIG_SND_PCM=y | 1545 | CONFIG_SND_PCM=y |
@@ -1515,20 +1557,14 @@ CONFIG_SND_VERBOSE_PROCFS=y | |||
1515 | # CONFIG_SND_VERBOSE_PRINTK is not set | 1557 | # CONFIG_SND_VERBOSE_PRINTK is not set |
1516 | # CONFIG_SND_DEBUG is not set | 1558 | # CONFIG_SND_DEBUG is not set |
1517 | CONFIG_SND_VMASTER=y | 1559 | CONFIG_SND_VMASTER=y |
1518 | 1560 | CONFIG_SND_DRIVERS=y | |
1519 | # | ||
1520 | # Generic devices | ||
1521 | # | ||
1522 | # CONFIG_SND_PCSP is not set | 1561 | # CONFIG_SND_PCSP is not set |
1523 | # CONFIG_SND_DUMMY is not set | 1562 | # CONFIG_SND_DUMMY is not set |
1524 | # CONFIG_SND_VIRMIDI is not set | 1563 | # CONFIG_SND_VIRMIDI is not set |
1525 | # CONFIG_SND_MTPAV is not set | 1564 | # CONFIG_SND_MTPAV is not set |
1526 | # CONFIG_SND_SERIAL_U16550 is not set | 1565 | # CONFIG_SND_SERIAL_U16550 is not set |
1527 | # CONFIG_SND_MPU401 is not set | 1566 | # CONFIG_SND_MPU401 is not set |
1528 | 1567 | CONFIG_SND_PCI=y | |
1529 | # | ||
1530 | # PCI devices | ||
1531 | # | ||
1532 | # CONFIG_SND_AD1889 is not set | 1568 | # CONFIG_SND_AD1889 is not set |
1533 | # CONFIG_SND_ALS300 is not set | 1569 | # CONFIG_SND_ALS300 is not set |
1534 | # CONFIG_SND_ALS4000 is not set | 1570 | # CONFIG_SND_ALS4000 is not set |
@@ -1603,36 +1639,14 @@ CONFIG_SND_HDA_GENERIC=y | |||
1603 | # CONFIG_SND_VIRTUOSO is not set | 1639 | # CONFIG_SND_VIRTUOSO is not set |
1604 | # CONFIG_SND_VX222 is not set | 1640 | # CONFIG_SND_VX222 is not set |
1605 | # CONFIG_SND_YMFPCI is not set | 1641 | # CONFIG_SND_YMFPCI is not set |
1606 | 1642 | CONFIG_SND_USB=y | |
1607 | # | ||
1608 | # USB devices | ||
1609 | # | ||
1610 | # CONFIG_SND_USB_AUDIO is not set | 1643 | # CONFIG_SND_USB_AUDIO is not set |
1611 | # CONFIG_SND_USB_USX2Y is not set | 1644 | # CONFIG_SND_USB_USX2Y is not set |
1612 | # CONFIG_SND_USB_CAIAQ is not set | 1645 | # CONFIG_SND_USB_CAIAQ is not set |
1613 | 1646 | CONFIG_SND_PCMCIA=y | |
1614 | # | ||
1615 | # PCMCIA devices | ||
1616 | # | ||
1617 | # CONFIG_SND_VXPOCKET is not set | 1647 | # CONFIG_SND_VXPOCKET is not set |
1618 | # CONFIG_SND_PDAUDIOCF is not set | 1648 | # CONFIG_SND_PDAUDIOCF is not set |
1619 | |||
1620 | # | ||
1621 | # System on Chip audio support | ||
1622 | # | ||
1623 | # CONFIG_SND_SOC is not set | 1649 | # CONFIG_SND_SOC is not set |
1624 | |||
1625 | # | ||
1626 | # ALSA SoC audio for Freescale SOCs | ||
1627 | # | ||
1628 | |||
1629 | # | ||
1630 | # SoC Audio for the Texas Instruments OMAP | ||
1631 | # | ||
1632 | |||
1633 | # | ||
1634 | # Open Sound System | ||
1635 | # | ||
1636 | # CONFIG_SOUND_PRIME is not set | 1650 | # CONFIG_SOUND_PRIME is not set |
1637 | CONFIG_HID_SUPPORT=y | 1651 | CONFIG_HID_SUPPORT=y |
1638 | CONFIG_HID=y | 1652 | CONFIG_HID=y |
@@ -1668,6 +1682,7 @@ CONFIG_USB_DEVICEFS=y | |||
1668 | # CONFIG_USB_DYNAMIC_MINORS is not set | 1682 | # CONFIG_USB_DYNAMIC_MINORS is not set |
1669 | CONFIG_USB_SUSPEND=y | 1683 | CONFIG_USB_SUSPEND=y |
1670 | # CONFIG_USB_OTG is not set | 1684 | # CONFIG_USB_OTG is not set |
1685 | CONFIG_USB_MON=y | ||
1671 | 1686 | ||
1672 | # | 1687 | # |
1673 | # USB Host Controller Drivers | 1688 | # USB Host Controller Drivers |
@@ -1691,6 +1706,7 @@ CONFIG_USB_UHCI_HCD=y | |||
1691 | # | 1706 | # |
1692 | # CONFIG_USB_ACM is not set | 1707 | # CONFIG_USB_ACM is not set |
1693 | CONFIG_USB_PRINTER=y | 1708 | CONFIG_USB_PRINTER=y |
1709 | # CONFIG_USB_WDM is not set | ||
1694 | 1710 | ||
1695 | # | 1711 | # |
1696 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | 1712 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' |
@@ -1712,6 +1728,7 @@ CONFIG_USB_STORAGE=y | |||
1712 | # CONFIG_USB_STORAGE_ALAUDA is not set | 1728 | # CONFIG_USB_STORAGE_ALAUDA is not set |
1713 | # CONFIG_USB_STORAGE_ONETOUCH is not set | 1729 | # CONFIG_USB_STORAGE_ONETOUCH is not set |
1714 | # CONFIG_USB_STORAGE_KARMA is not set | 1730 | # CONFIG_USB_STORAGE_KARMA is not set |
1731 | # CONFIG_USB_STORAGE_SIERRA is not set | ||
1715 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set | 1732 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set |
1716 | CONFIG_USB_LIBUSUAL=y | 1733 | CONFIG_USB_LIBUSUAL=y |
1717 | 1734 | ||
@@ -1720,7 +1737,6 @@ CONFIG_USB_LIBUSUAL=y | |||
1720 | # | 1737 | # |
1721 | # CONFIG_USB_MDC800 is not set | 1738 | # CONFIG_USB_MDC800 is not set |
1722 | # CONFIG_USB_MICROTEK is not set | 1739 | # CONFIG_USB_MICROTEK is not set |
1723 | CONFIG_USB_MON=y | ||
1724 | 1740 | ||
1725 | # | 1741 | # |
1726 | # USB port drivers | 1742 | # USB port drivers |
@@ -1733,7 +1749,6 @@ CONFIG_USB_MON=y | |||
1733 | # CONFIG_USB_EMI62 is not set | 1749 | # CONFIG_USB_EMI62 is not set |
1734 | # CONFIG_USB_EMI26 is not set | 1750 | # CONFIG_USB_EMI26 is not set |
1735 | # CONFIG_USB_ADUTUX is not set | 1751 | # CONFIG_USB_ADUTUX is not set |
1736 | # CONFIG_USB_AUERSWALD is not set | ||
1737 | # CONFIG_USB_RIO500 is not set | 1752 | # CONFIG_USB_RIO500 is not set |
1738 | # CONFIG_USB_LEGOTOWER is not set | 1753 | # CONFIG_USB_LEGOTOWER is not set |
1739 | # CONFIG_USB_LCD is not set | 1754 | # CONFIG_USB_LCD is not set |
@@ -1750,6 +1765,7 @@ CONFIG_USB_MON=y | |||
1750 | # CONFIG_USB_TRANCEVIBRATOR is not set | 1765 | # CONFIG_USB_TRANCEVIBRATOR is not set |
1751 | # CONFIG_USB_IOWARRIOR is not set | 1766 | # CONFIG_USB_IOWARRIOR is not set |
1752 | # CONFIG_USB_TEST is not set | 1767 | # CONFIG_USB_TEST is not set |
1768 | # CONFIG_USB_ISIGHTFW is not set | ||
1753 | # CONFIG_USB_GADGET is not set | 1769 | # CONFIG_USB_GADGET is not set |
1754 | # CONFIG_MMC is not set | 1770 | # CONFIG_MMC is not set |
1755 | # CONFIG_MEMSTICK is not set | 1771 | # CONFIG_MEMSTICK is not set |
@@ -1759,7 +1775,9 @@ CONFIG_LEDS_CLASS=y | |||
1759 | # | 1775 | # |
1760 | # LED drivers | 1776 | # LED drivers |
1761 | # | 1777 | # |
1778 | # CONFIG_LEDS_PCA9532 is not set | ||
1762 | # CONFIG_LEDS_CLEVO_MAIL is not set | 1779 | # CONFIG_LEDS_CLEVO_MAIL is not set |
1780 | # CONFIG_LEDS_PCA955X is not set | ||
1763 | 1781 | ||
1764 | # | 1782 | # |
1765 | # LED Triggers | 1783 | # LED Triggers |
@@ -1805,6 +1823,7 @@ CONFIG_RTC_INTF_DEV=y | |||
1805 | # CONFIG_RTC_DRV_PCF8583 is not set | 1823 | # CONFIG_RTC_DRV_PCF8583 is not set |
1806 | # CONFIG_RTC_DRV_M41T80 is not set | 1824 | # CONFIG_RTC_DRV_M41T80 is not set |
1807 | # CONFIG_RTC_DRV_S35390A is not set | 1825 | # CONFIG_RTC_DRV_S35390A is not set |
1826 | # CONFIG_RTC_DRV_FM3130 is not set | ||
1808 | 1827 | ||
1809 | # | 1828 | # |
1810 | # SPI RTC drivers | 1829 | # SPI RTC drivers |
@@ -1837,11 +1856,13 @@ CONFIG_DMADEVICES=y | |||
1837 | # Firmware Drivers | 1856 | # Firmware Drivers |
1838 | # | 1857 | # |
1839 | # CONFIG_EDD is not set | 1858 | # CONFIG_EDD is not set |
1859 | CONFIG_FIRMWARE_MEMMAP=y | ||
1840 | CONFIG_EFI_VARS=y | 1860 | CONFIG_EFI_VARS=y |
1841 | # CONFIG_DELL_RBU is not set | 1861 | # CONFIG_DELL_RBU is not set |
1842 | # CONFIG_DCDBAS is not set | 1862 | # CONFIG_DCDBAS is not set |
1843 | CONFIG_DMIID=y | 1863 | CONFIG_DMIID=y |
1844 | # CONFIG_ISCSI_IBFT_FIND is not set | 1864 | CONFIG_ISCSI_IBFT_FIND=y |
1865 | CONFIG_ISCSI_IBFT=y | ||
1845 | 1866 | ||
1846 | # | 1867 | # |
1847 | # File systems | 1868 | # File systems |
@@ -1920,14 +1941,27 @@ CONFIG_HUGETLB_PAGE=y | |||
1920 | # CONFIG_CRAMFS is not set | 1941 | # CONFIG_CRAMFS is not set |
1921 | # CONFIG_VXFS_FS is not set | 1942 | # CONFIG_VXFS_FS is not set |
1922 | # CONFIG_MINIX_FS is not set | 1943 | # CONFIG_MINIX_FS is not set |
1944 | # CONFIG_OMFS_FS is not set | ||
1923 | # CONFIG_HPFS_FS is not set | 1945 | # CONFIG_HPFS_FS is not set |
1924 | # CONFIG_QNX4FS_FS is not set | 1946 | # CONFIG_QNX4FS_FS is not set |
1925 | # CONFIG_ROMFS_FS is not set | 1947 | # CONFIG_ROMFS_FS is not set |
1926 | # CONFIG_SYSV_FS is not set | 1948 | # CONFIG_SYSV_FS is not set |
1927 | # CONFIG_UFS_FS is not set | 1949 | # CONFIG_UFS_FS is not set |
1928 | CONFIG_NETWORK_FILESYSTEMS=y | 1950 | CONFIG_NETWORK_FILESYSTEMS=y |
1929 | # CONFIG_NFS_FS is not set | 1951 | CONFIG_NFS_FS=y |
1952 | CONFIG_NFS_V3=y | ||
1953 | CONFIG_NFS_V3_ACL=y | ||
1954 | CONFIG_NFS_V4=y | ||
1955 | CONFIG_ROOT_NFS=y | ||
1930 | # CONFIG_NFSD is not set | 1956 | # CONFIG_NFSD is not set |
1957 | CONFIG_LOCKD=y | ||
1958 | CONFIG_LOCKD_V4=y | ||
1959 | CONFIG_NFS_ACL_SUPPORT=y | ||
1960 | CONFIG_NFS_COMMON=y | ||
1961 | CONFIG_SUNRPC=y | ||
1962 | CONFIG_SUNRPC_GSS=y | ||
1963 | CONFIG_RPCSEC_GSS_KRB5=y | ||
1964 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
1931 | # CONFIG_SMB_FS is not set | 1965 | # CONFIG_SMB_FS is not set |
1932 | # CONFIG_CIFS is not set | 1966 | # CONFIG_CIFS is not set |
1933 | # CONFIG_NCP_FS is not set | 1967 | # CONFIG_NCP_FS is not set |
@@ -2001,9 +2035,9 @@ CONFIG_NLS_UTF8=y | |||
2001 | # Kernel hacking | 2035 | # Kernel hacking |
2002 | # | 2036 | # |
2003 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | 2037 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y |
2004 | # CONFIG_PRINTK_TIME is not set | 2038 | CONFIG_PRINTK_TIME=y |
2005 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | 2039 | CONFIG_ENABLE_WARN_DEPRECATED=y |
2006 | # CONFIG_ENABLE_MUST_CHECK is not set | 2040 | CONFIG_ENABLE_MUST_CHECK=y |
2007 | CONFIG_FRAME_WARN=2048 | 2041 | CONFIG_FRAME_WARN=2048 |
2008 | CONFIG_MAGIC_SYSRQ=y | 2042 | CONFIG_MAGIC_SYSRQ=y |
2009 | # CONFIG_UNUSED_SYMBOLS is not set | 2043 | # CONFIG_UNUSED_SYMBOLS is not set |
@@ -2033,6 +2067,7 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
2033 | # CONFIG_DEBUG_INFO is not set | 2067 | # CONFIG_DEBUG_INFO is not set |
2034 | # CONFIG_DEBUG_VM is not set | 2068 | # CONFIG_DEBUG_VM is not set |
2035 | # CONFIG_DEBUG_WRITECOUNT is not set | 2069 | # CONFIG_DEBUG_WRITECOUNT is not set |
2070 | CONFIG_DEBUG_MEMORY_INIT=y | ||
2036 | # CONFIG_DEBUG_LIST is not set | 2071 | # CONFIG_DEBUG_LIST is not set |
2037 | # CONFIG_DEBUG_SG is not set | 2072 | # CONFIG_DEBUG_SG is not set |
2038 | CONFIG_FRAME_POINTER=y | 2073 | CONFIG_FRAME_POINTER=y |
@@ -2043,23 +2078,32 @@ CONFIG_FRAME_POINTER=y | |||
2043 | # CONFIG_LKDTM is not set | 2078 | # CONFIG_LKDTM is not set |
2044 | # CONFIG_FAULT_INJECTION is not set | 2079 | # CONFIG_FAULT_INJECTION is not set |
2045 | # CONFIG_LATENCYTOP is not set | 2080 | # CONFIG_LATENCYTOP is not set |
2081 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
2082 | CONFIG_HAVE_FTRACE=y | ||
2083 | CONFIG_HAVE_DYNAMIC_FTRACE=y | ||
2084 | # CONFIG_FTRACE is not set | ||
2085 | # CONFIG_IRQSOFF_TRACER is not set | ||
2086 | # CONFIG_SYSPROF_TRACER is not set | ||
2087 | # CONFIG_SCHED_TRACER is not set | ||
2088 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | ||
2046 | CONFIG_PROVIDE_OHCI1394_DMA_INIT=y | 2089 | CONFIG_PROVIDE_OHCI1394_DMA_INIT=y |
2047 | # CONFIG_SAMPLES is not set | 2090 | # CONFIG_SAMPLES is not set |
2048 | # CONFIG_KGDB is not set | ||
2049 | CONFIG_HAVE_ARCH_KGDB=y | 2091 | CONFIG_HAVE_ARCH_KGDB=y |
2092 | # CONFIG_KGDB is not set | ||
2050 | # CONFIG_STRICT_DEVMEM is not set | 2093 | # CONFIG_STRICT_DEVMEM is not set |
2094 | CONFIG_X86_VERBOSE_BOOTUP=y | ||
2051 | CONFIG_EARLY_PRINTK=y | 2095 | CONFIG_EARLY_PRINTK=y |
2052 | CONFIG_DEBUG_STACKOVERFLOW=y | 2096 | CONFIG_DEBUG_STACKOVERFLOW=y |
2053 | CONFIG_DEBUG_STACK_USAGE=y | 2097 | CONFIG_DEBUG_STACK_USAGE=y |
2054 | # CONFIG_DEBUG_PAGEALLOC is not set | 2098 | # CONFIG_DEBUG_PAGEALLOC is not set |
2099 | # CONFIG_DEBUG_PER_CPU_MAPS is not set | ||
2055 | # CONFIG_X86_PTDUMP is not set | 2100 | # CONFIG_X86_PTDUMP is not set |
2056 | CONFIG_DEBUG_RODATA=y | 2101 | CONFIG_DEBUG_RODATA=y |
2057 | # CONFIG_DEBUG_RODATA_TEST is not set | 2102 | # CONFIG_DEBUG_RODATA_TEST is not set |
2058 | CONFIG_DEBUG_NX_TEST=m | 2103 | CONFIG_DEBUG_NX_TEST=m |
2059 | # CONFIG_4KSTACKS is not set | 2104 | # CONFIG_4KSTACKS is not set |
2060 | CONFIG_X86_FIND_SMP_CONFIG=y | ||
2061 | CONFIG_X86_MPPARSE=y | ||
2062 | CONFIG_DOUBLEFAULT=y | 2105 | CONFIG_DOUBLEFAULT=y |
2106 | # CONFIG_MMIOTRACE is not set | ||
2063 | CONFIG_IO_DELAY_TYPE_0X80=0 | 2107 | CONFIG_IO_DELAY_TYPE_0X80=0 |
2064 | CONFIG_IO_DELAY_TYPE_0XED=1 | 2108 | CONFIG_IO_DELAY_TYPE_0XED=1 |
2065 | CONFIG_IO_DELAY_TYPE_UDELAY=2 | 2109 | CONFIG_IO_DELAY_TYPE_UDELAY=2 |
@@ -2071,6 +2115,7 @@ CONFIG_IO_DELAY_0X80=y | |||
2071 | CONFIG_DEFAULT_IO_DELAY_TYPE=0 | 2115 | CONFIG_DEFAULT_IO_DELAY_TYPE=0 |
2072 | CONFIG_DEBUG_BOOT_PARAMS=y | 2116 | CONFIG_DEBUG_BOOT_PARAMS=y |
2073 | # CONFIG_CPA_DEBUG is not set | 2117 | # CONFIG_CPA_DEBUG is not set |
2118 | # CONFIG_OPTIMIZE_INLINING is not set | ||
2074 | 2119 | ||
2075 | # | 2120 | # |
2076 | # Security options | 2121 | # Security options |
@@ -2080,7 +2125,6 @@ CONFIG_KEYS_DEBUG_PROC_KEYS=y | |||
2080 | CONFIG_SECURITY=y | 2125 | CONFIG_SECURITY=y |
2081 | CONFIG_SECURITY_NETWORK=y | 2126 | CONFIG_SECURITY_NETWORK=y |
2082 | # CONFIG_SECURITY_NETWORK_XFRM is not set | 2127 | # CONFIG_SECURITY_NETWORK_XFRM is not set |
2083 | CONFIG_SECURITY_CAPABILITIES=y | ||
2084 | CONFIG_SECURITY_FILE_CAPABILITIES=y | 2128 | CONFIG_SECURITY_FILE_CAPABILITIES=y |
2085 | # CONFIG_SECURITY_ROOTPLUG is not set | 2129 | # CONFIG_SECURITY_ROOTPLUG is not set |
2086 | CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=65536 | 2130 | CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=65536 |
@@ -2141,6 +2185,10 @@ CONFIG_CRYPTO_HMAC=y | |||
2141 | # CONFIG_CRYPTO_MD4 is not set | 2185 | # CONFIG_CRYPTO_MD4 is not set |
2142 | CONFIG_CRYPTO_MD5=y | 2186 | CONFIG_CRYPTO_MD5=y |
2143 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | 2187 | # CONFIG_CRYPTO_MICHAEL_MIC is not set |
2188 | # CONFIG_CRYPTO_RMD128 is not set | ||
2189 | # CONFIG_CRYPTO_RMD160 is not set | ||
2190 | # CONFIG_CRYPTO_RMD256 is not set | ||
2191 | # CONFIG_CRYPTO_RMD320 is not set | ||
2144 | CONFIG_CRYPTO_SHA1=y | 2192 | CONFIG_CRYPTO_SHA1=y |
2145 | # CONFIG_CRYPTO_SHA256 is not set | 2193 | # CONFIG_CRYPTO_SHA256 is not set |
2146 | # CONFIG_CRYPTO_SHA512 is not set | 2194 | # CONFIG_CRYPTO_SHA512 is not set |
@@ -2151,7 +2199,7 @@ CONFIG_CRYPTO_SHA1=y | |||
2151 | # Ciphers | 2199 | # Ciphers |
2152 | # | 2200 | # |
2153 | CONFIG_CRYPTO_AES=y | 2201 | CONFIG_CRYPTO_AES=y |
2154 | # CONFIG_CRYPTO_AES_586 is not set | 2202 | CONFIG_CRYPTO_AES_586=y |
2155 | # CONFIG_CRYPTO_ANUBIS is not set | 2203 | # CONFIG_CRYPTO_ANUBIS is not set |
2156 | CONFIG_CRYPTO_ARC4=y | 2204 | CONFIG_CRYPTO_ARC4=y |
2157 | # CONFIG_CRYPTO_BLOWFISH is not set | 2205 | # CONFIG_CRYPTO_BLOWFISH is not set |
@@ -2193,6 +2241,7 @@ CONFIG_GENERIC_FIND_FIRST_BIT=y | |||
2193 | CONFIG_GENERIC_FIND_NEXT_BIT=y | 2241 | CONFIG_GENERIC_FIND_NEXT_BIT=y |
2194 | # CONFIG_CRC_CCITT is not set | 2242 | # CONFIG_CRC_CCITT is not set |
2195 | # CONFIG_CRC16 is not set | 2243 | # CONFIG_CRC16 is not set |
2244 | CONFIG_CRC_T10DIF=y | ||
2196 | # CONFIG_CRC_ITU_T is not set | 2245 | # CONFIG_CRC_ITU_T is not set |
2197 | CONFIG_CRC32=y | 2246 | CONFIG_CRC32=y |
2198 | # CONFIG_CRC7 is not set | 2247 | # CONFIG_CRC7 is not set |
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig index a40452429625..678c8acefe04 100644 --- a/arch/x86/configs/x86_64_defconfig +++ b/arch/x86/configs/x86_64_defconfig | |||
@@ -1,13 +1,13 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.26-rc1 | 3 | # Linux kernel version: 2.6.27-rc4 |
4 | # Sun May 4 19:59:57 2008 | 4 | # Mon Aug 25 14:40:46 2008 |
5 | # | 5 | # |
6 | CONFIG_64BIT=y | 6 | CONFIG_64BIT=y |
7 | # CONFIG_X86_32 is not set | 7 | # CONFIG_X86_32 is not set |
8 | CONFIG_X86_64=y | 8 | CONFIG_X86_64=y |
9 | CONFIG_X86=y | 9 | CONFIG_X86=y |
10 | CONFIG_DEFCONFIG_LIST="arch/x86/configs/x86_64_defconfig" | 10 | CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" |
11 | # CONFIG_GENERIC_LOCKBREAK is not set | 11 | # CONFIG_GENERIC_LOCKBREAK is not set |
12 | CONFIG_GENERIC_TIME=y | 12 | CONFIG_GENERIC_TIME=y |
13 | CONFIG_GENERIC_CMOS_UPDATE=y | 13 | CONFIG_GENERIC_CMOS_UPDATE=y |
@@ -53,6 +53,7 @@ CONFIG_X86_HT=y | |||
53 | CONFIG_X86_BIOS_REBOOT=y | 53 | CONFIG_X86_BIOS_REBOOT=y |
54 | CONFIG_X86_TRAMPOLINE=y | 54 | CONFIG_X86_TRAMPOLINE=y |
55 | # CONFIG_KTIME_SCALAR is not set | 55 | # CONFIG_KTIME_SCALAR is not set |
56 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
56 | 57 | ||
57 | # | 58 | # |
58 | # General setup | 59 | # General setup |
@@ -82,6 +83,7 @@ CONFIG_CGROUPS=y | |||
82 | CONFIG_CGROUP_NS=y | 83 | CONFIG_CGROUP_NS=y |
83 | # CONFIG_CGROUP_DEVICE is not set | 84 | # CONFIG_CGROUP_DEVICE is not set |
84 | CONFIG_CPUSETS=y | 85 | CONFIG_CPUSETS=y |
86 | CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y | ||
85 | CONFIG_GROUP_SCHED=y | 87 | CONFIG_GROUP_SCHED=y |
86 | CONFIG_FAIR_GROUP_SCHED=y | 88 | CONFIG_FAIR_GROUP_SCHED=y |
87 | # CONFIG_RT_GROUP_SCHED is not set | 89 | # CONFIG_RT_GROUP_SCHED is not set |
@@ -105,7 +107,6 @@ CONFIG_SYSCTL=y | |||
105 | # CONFIG_EMBEDDED is not set | 107 | # CONFIG_EMBEDDED is not set |
106 | CONFIG_UID16=y | 108 | CONFIG_UID16=y |
107 | CONFIG_SYSCTL_SYSCALL=y | 109 | CONFIG_SYSCTL_SYSCALL=y |
108 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
109 | CONFIG_KALLSYMS=y | 110 | CONFIG_KALLSYMS=y |
110 | CONFIG_KALLSYMS_ALL=y | 111 | CONFIG_KALLSYMS_ALL=y |
111 | CONFIG_KALLSYMS_EXTRA_PASS=y | 112 | CONFIG_KALLSYMS_EXTRA_PASS=y |
@@ -113,6 +114,7 @@ CONFIG_HOTPLUG=y | |||
113 | CONFIG_PRINTK=y | 114 | CONFIG_PRINTK=y |
114 | CONFIG_BUG=y | 115 | CONFIG_BUG=y |
115 | CONFIG_ELF_CORE=y | 116 | CONFIG_ELF_CORE=y |
117 | CONFIG_PCSPKR_PLATFORM=y | ||
116 | # CONFIG_COMPAT_BRK is not set | 118 | # CONFIG_COMPAT_BRK is not set |
117 | CONFIG_BASE_FULL=y | 119 | CONFIG_BASE_FULL=y |
118 | CONFIG_FUTEX=y | 120 | CONFIG_FUTEX=y |
@@ -132,25 +134,33 @@ CONFIG_MARKERS=y | |||
132 | # CONFIG_OPROFILE is not set | 134 | # CONFIG_OPROFILE is not set |
133 | CONFIG_HAVE_OPROFILE=y | 135 | CONFIG_HAVE_OPROFILE=y |
134 | CONFIG_KPROBES=y | 136 | CONFIG_KPROBES=y |
137 | CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y | ||
135 | CONFIG_KRETPROBES=y | 138 | CONFIG_KRETPROBES=y |
139 | CONFIG_HAVE_IOREMAP_PROT=y | ||
136 | CONFIG_HAVE_KPROBES=y | 140 | CONFIG_HAVE_KPROBES=y |
137 | CONFIG_HAVE_KRETPROBES=y | 141 | CONFIG_HAVE_KRETPROBES=y |
142 | # CONFIG_HAVE_ARCH_TRACEHOOK is not set | ||
138 | # CONFIG_HAVE_DMA_ATTRS is not set | 143 | # CONFIG_HAVE_DMA_ATTRS is not set |
144 | CONFIG_USE_GENERIC_SMP_HELPERS=y | ||
145 | # CONFIG_HAVE_CLK is not set | ||
139 | CONFIG_PROC_PAGE_MONITOR=y | 146 | CONFIG_PROC_PAGE_MONITOR=y |
147 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | ||
140 | CONFIG_SLABINFO=y | 148 | CONFIG_SLABINFO=y |
141 | CONFIG_RT_MUTEXES=y | 149 | CONFIG_RT_MUTEXES=y |
142 | # CONFIG_TINY_SHMEM is not set | 150 | # CONFIG_TINY_SHMEM is not set |
143 | CONFIG_BASE_SMALL=0 | 151 | CONFIG_BASE_SMALL=0 |
144 | CONFIG_MODULES=y | 152 | CONFIG_MODULES=y |
153 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
145 | CONFIG_MODULE_UNLOAD=y | 154 | CONFIG_MODULE_UNLOAD=y |
146 | CONFIG_MODULE_FORCE_UNLOAD=y | 155 | CONFIG_MODULE_FORCE_UNLOAD=y |
147 | # CONFIG_MODVERSIONS is not set | 156 | # CONFIG_MODVERSIONS is not set |
148 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 157 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
149 | # CONFIG_KMOD is not set | 158 | CONFIG_KMOD=y |
150 | CONFIG_STOP_MACHINE=y | 159 | CONFIG_STOP_MACHINE=y |
151 | CONFIG_BLOCK=y | 160 | CONFIG_BLOCK=y |
152 | CONFIG_BLK_DEV_IO_TRACE=y | 161 | CONFIG_BLK_DEV_IO_TRACE=y |
153 | CONFIG_BLK_DEV_BSG=y | 162 | CONFIG_BLK_DEV_BSG=y |
163 | # CONFIG_BLK_DEV_INTEGRITY is not set | ||
154 | CONFIG_BLOCK_COMPAT=y | 164 | CONFIG_BLOCK_COMPAT=y |
155 | 165 | ||
156 | # | 166 | # |
@@ -175,20 +185,15 @@ CONFIG_NO_HZ=y | |||
175 | CONFIG_HIGH_RES_TIMERS=y | 185 | CONFIG_HIGH_RES_TIMERS=y |
176 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | 186 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y |
177 | CONFIG_SMP=y | 187 | CONFIG_SMP=y |
188 | CONFIG_X86_FIND_SMP_CONFIG=y | ||
189 | CONFIG_X86_MPPARSE=y | ||
178 | CONFIG_X86_PC=y | 190 | CONFIG_X86_PC=y |
179 | # CONFIG_X86_ELAN is not set | 191 | # CONFIG_X86_ELAN is not set |
180 | # CONFIG_X86_VOYAGER is not set | 192 | # CONFIG_X86_VOYAGER is not set |
181 | # CONFIG_X86_NUMAQ is not set | ||
182 | # CONFIG_X86_SUMMIT is not set | ||
183 | # CONFIG_X86_BIGSMP is not set | ||
184 | # CONFIG_X86_VISWS is not set | ||
185 | # CONFIG_X86_GENERICARCH is not set | 193 | # CONFIG_X86_GENERICARCH is not set |
186 | # CONFIG_X86_ES7000 is not set | ||
187 | # CONFIG_X86_RDC321X is not set | ||
188 | # CONFIG_X86_VSMP is not set | 194 | # CONFIG_X86_VSMP is not set |
189 | # CONFIG_PARAVIRT_GUEST is not set | 195 | # CONFIG_PARAVIRT_GUEST is not set |
190 | CONFIG_MEMTEST_BOOTPARAM=y | 196 | # CONFIG_MEMTEST is not set |
191 | CONFIG_MEMTEST_BOOTPARAM_VALUE=0 | ||
192 | # CONFIG_M386 is not set | 197 | # CONFIG_M386 is not set |
193 | # CONFIG_M486 is not set | 198 | # CONFIG_M486 is not set |
194 | # CONFIG_M586 is not set | 199 | # CONFIG_M586 is not set |
@@ -220,11 +225,12 @@ CONFIG_X86_L1_CACHE_BYTES=64 | |||
220 | CONFIG_X86_INTERNODE_CACHE_BYTES=64 | 225 | CONFIG_X86_INTERNODE_CACHE_BYTES=64 |
221 | CONFIG_X86_CMPXCHG=y | 226 | CONFIG_X86_CMPXCHG=y |
222 | CONFIG_X86_L1_CACHE_SHIFT=6 | 227 | CONFIG_X86_L1_CACHE_SHIFT=6 |
223 | CONFIG_X86_GOOD_APIC=y | 228 | CONFIG_X86_WP_WORKS_OK=y |
224 | CONFIG_X86_INTEL_USERCOPY=y | 229 | CONFIG_X86_INTEL_USERCOPY=y |
225 | CONFIG_X86_USE_PPRO_CHECKSUM=y | 230 | CONFIG_X86_USE_PPRO_CHECKSUM=y |
226 | CONFIG_X86_P6_NOP=y | 231 | CONFIG_X86_P6_NOP=y |
227 | CONFIG_X86_TSC=y | 232 | CONFIG_X86_TSC=y |
233 | CONFIG_X86_CMPXCHG64=y | ||
228 | CONFIG_X86_CMOV=y | 234 | CONFIG_X86_CMOV=y |
229 | CONFIG_X86_MINIMUM_CPU_FAMILY=64 | 235 | CONFIG_X86_MINIMUM_CPU_FAMILY=64 |
230 | CONFIG_X86_DEBUGCTLMSR=y | 236 | CONFIG_X86_DEBUGCTLMSR=y |
@@ -234,8 +240,10 @@ CONFIG_DMI=y | |||
234 | CONFIG_GART_IOMMU=y | 240 | CONFIG_GART_IOMMU=y |
235 | CONFIG_CALGARY_IOMMU=y | 241 | CONFIG_CALGARY_IOMMU=y |
236 | CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y | 242 | CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y |
243 | CONFIG_AMD_IOMMU=y | ||
237 | CONFIG_SWIOTLB=y | 244 | CONFIG_SWIOTLB=y |
238 | CONFIG_IOMMU_HELPER=y | 245 | CONFIG_IOMMU_HELPER=y |
246 | # CONFIG_MAXSMP is not set | ||
239 | CONFIG_NR_CPUS=4 | 247 | CONFIG_NR_CPUS=4 |
240 | # CONFIG_SCHED_SMT is not set | 248 | # CONFIG_SCHED_SMT is not set |
241 | CONFIG_SCHED_MC=y | 249 | CONFIG_SCHED_MC=y |
@@ -281,6 +289,7 @@ CONFIG_ZONE_DMA_FLAG=1 | |||
281 | CONFIG_BOUNCE=y | 289 | CONFIG_BOUNCE=y |
282 | CONFIG_VIRT_TO_BUS=y | 290 | CONFIG_VIRT_TO_BUS=y |
283 | CONFIG_MTRR=y | 291 | CONFIG_MTRR=y |
292 | # CONFIG_MTRR_SANITIZER is not set | ||
284 | # CONFIG_X86_PAT is not set | 293 | # CONFIG_X86_PAT is not set |
285 | CONFIG_EFI=y | 294 | CONFIG_EFI=y |
286 | CONFIG_SECCOMP=y | 295 | CONFIG_SECCOMP=y |
@@ -313,6 +322,7 @@ CONFIG_PM_TRACE_RTC=y | |||
313 | CONFIG_PM_SLEEP_SMP=y | 322 | CONFIG_PM_SLEEP_SMP=y |
314 | CONFIG_PM_SLEEP=y | 323 | CONFIG_PM_SLEEP=y |
315 | CONFIG_SUSPEND=y | 324 | CONFIG_SUSPEND=y |
325 | # CONFIG_PM_TEST_SUSPEND is not set | ||
316 | CONFIG_SUSPEND_FREEZER=y | 326 | CONFIG_SUSPEND_FREEZER=y |
317 | CONFIG_HIBERNATION=y | 327 | CONFIG_HIBERNATION=y |
318 | CONFIG_PM_STD_PARTITION="" | 328 | CONFIG_PM_STD_PARTITION="" |
@@ -339,6 +349,7 @@ CONFIG_ACPI_NUMA=y | |||
339 | CONFIG_ACPI_BLACKLIST_YEAR=0 | 349 | CONFIG_ACPI_BLACKLIST_YEAR=0 |
340 | # CONFIG_ACPI_DEBUG is not set | 350 | # CONFIG_ACPI_DEBUG is not set |
341 | CONFIG_ACPI_EC=y | 351 | CONFIG_ACPI_EC=y |
352 | # CONFIG_ACPI_PCI_SLOT is not set | ||
342 | CONFIG_ACPI_POWER=y | 353 | CONFIG_ACPI_POWER=y |
343 | CONFIG_ACPI_SYSTEM=y | 354 | CONFIG_ACPI_SYSTEM=y |
344 | CONFIG_X86_PM_TIMER=y | 355 | CONFIG_X86_PM_TIMER=y |
@@ -437,10 +448,6 @@ CONFIG_IA32_EMULATION=y | |||
437 | CONFIG_COMPAT=y | 448 | CONFIG_COMPAT=y |
438 | CONFIG_COMPAT_FOR_U64_ALIGNMENT=y | 449 | CONFIG_COMPAT_FOR_U64_ALIGNMENT=y |
439 | CONFIG_SYSVIPC_COMPAT=y | 450 | CONFIG_SYSVIPC_COMPAT=y |
440 | |||
441 | # | ||
442 | # Networking | ||
443 | # | ||
444 | CONFIG_NET=y | 451 | CONFIG_NET=y |
445 | 452 | ||
446 | # | 453 | # |
@@ -464,7 +471,10 @@ CONFIG_IP_FIB_HASH=y | |||
464 | CONFIG_IP_MULTIPLE_TABLES=y | 471 | CONFIG_IP_MULTIPLE_TABLES=y |
465 | CONFIG_IP_ROUTE_MULTIPATH=y | 472 | CONFIG_IP_ROUTE_MULTIPATH=y |
466 | CONFIG_IP_ROUTE_VERBOSE=y | 473 | CONFIG_IP_ROUTE_VERBOSE=y |
467 | # CONFIG_IP_PNP is not set | 474 | CONFIG_IP_PNP=y |
475 | CONFIG_IP_PNP_DHCP=y | ||
476 | CONFIG_IP_PNP_BOOTP=y | ||
477 | CONFIG_IP_PNP_RARP=y | ||
468 | # CONFIG_NET_IPIP is not set | 478 | # CONFIG_NET_IPIP is not set |
469 | # CONFIG_NET_IPGRE is not set | 479 | # CONFIG_NET_IPGRE is not set |
470 | CONFIG_IP_MROUTE=y | 480 | CONFIG_IP_MROUTE=y |
@@ -607,7 +617,6 @@ CONFIG_NET_SCHED=y | |||
607 | # CONFIG_NET_SCH_HTB is not set | 617 | # CONFIG_NET_SCH_HTB is not set |
608 | # CONFIG_NET_SCH_HFSC is not set | 618 | # CONFIG_NET_SCH_HFSC is not set |
609 | # CONFIG_NET_SCH_PRIO is not set | 619 | # CONFIG_NET_SCH_PRIO is not set |
610 | # CONFIG_NET_SCH_RR is not set | ||
611 | # CONFIG_NET_SCH_RED is not set | 620 | # CONFIG_NET_SCH_RED is not set |
612 | # CONFIG_NET_SCH_SFQ is not set | 621 | # CONFIG_NET_SCH_SFQ is not set |
613 | # CONFIG_NET_SCH_TEQL is not set | 622 | # CONFIG_NET_SCH_TEQL is not set |
@@ -669,28 +678,19 @@ CONFIG_FIB_RULES=y | |||
669 | CONFIG_CFG80211=y | 678 | CONFIG_CFG80211=y |
670 | CONFIG_NL80211=y | 679 | CONFIG_NL80211=y |
671 | CONFIG_WIRELESS_EXT=y | 680 | CONFIG_WIRELESS_EXT=y |
681 | CONFIG_WIRELESS_EXT_SYSFS=y | ||
672 | CONFIG_MAC80211=y | 682 | CONFIG_MAC80211=y |
673 | 683 | ||
674 | # | 684 | # |
675 | # Rate control algorithm selection | 685 | # Rate control algorithm selection |
676 | # | 686 | # |
687 | CONFIG_MAC80211_RC_PID=y | ||
677 | CONFIG_MAC80211_RC_DEFAULT_PID=y | 688 | CONFIG_MAC80211_RC_DEFAULT_PID=y |
678 | # CONFIG_MAC80211_RC_DEFAULT_NONE is not set | ||
679 | |||
680 | # | ||
681 | # Selecting 'y' for an algorithm will | ||
682 | # | ||
683 | |||
684 | # | ||
685 | # build the algorithm into mac80211. | ||
686 | # | ||
687 | CONFIG_MAC80211_RC_DEFAULT="pid" | 689 | CONFIG_MAC80211_RC_DEFAULT="pid" |
688 | CONFIG_MAC80211_RC_PID=y | ||
689 | # CONFIG_MAC80211_MESH is not set | 690 | # CONFIG_MAC80211_MESH is not set |
690 | CONFIG_MAC80211_LEDS=y | 691 | CONFIG_MAC80211_LEDS=y |
691 | # CONFIG_MAC80211_DEBUGFS is not set | 692 | # CONFIG_MAC80211_DEBUGFS is not set |
692 | # CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set | 693 | # CONFIG_MAC80211_DEBUG_MENU is not set |
693 | # CONFIG_MAC80211_DEBUG is not set | ||
694 | # CONFIG_IEEE80211 is not set | 694 | # CONFIG_IEEE80211 is not set |
695 | # CONFIG_RFKILL is not set | 695 | # CONFIG_RFKILL is not set |
696 | # CONFIG_NET_9P is not set | 696 | # CONFIG_NET_9P is not set |
@@ -706,6 +706,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | |||
706 | CONFIG_STANDALONE=y | 706 | CONFIG_STANDALONE=y |
707 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 707 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
708 | CONFIG_FW_LOADER=y | 708 | CONFIG_FW_LOADER=y |
709 | CONFIG_FIRMWARE_IN_KERNEL=y | ||
710 | CONFIG_EXTRA_FIRMWARE="" | ||
709 | # CONFIG_DEBUG_DRIVER is not set | 711 | # CONFIG_DEBUG_DRIVER is not set |
710 | CONFIG_DEBUG_DEVRES=y | 712 | CONFIG_DEBUG_DEVRES=y |
711 | # CONFIG_SYS_HYPERVISOR is not set | 713 | # CONFIG_SYS_HYPERVISOR is not set |
@@ -738,6 +740,7 @@ CONFIG_BLK_DEV_RAM_SIZE=16384 | |||
738 | # CONFIG_BLK_DEV_XIP is not set | 740 | # CONFIG_BLK_DEV_XIP is not set |
739 | # CONFIG_CDROM_PKTCDVD is not set | 741 | # CONFIG_CDROM_PKTCDVD is not set |
740 | # CONFIG_ATA_OVER_ETH is not set | 742 | # CONFIG_ATA_OVER_ETH is not set |
743 | # CONFIG_BLK_DEV_HD is not set | ||
741 | CONFIG_MISC_DEVICES=y | 744 | CONFIG_MISC_DEVICES=y |
742 | # CONFIG_IBM_ASM is not set | 745 | # CONFIG_IBM_ASM is not set |
743 | # CONFIG_PHANTOM is not set | 746 | # CONFIG_PHANTOM is not set |
@@ -748,10 +751,14 @@ CONFIG_MISC_DEVICES=y | |||
748 | # CONFIG_ASUS_LAPTOP is not set | 751 | # CONFIG_ASUS_LAPTOP is not set |
749 | # CONFIG_FUJITSU_LAPTOP is not set | 752 | # CONFIG_FUJITSU_LAPTOP is not set |
750 | # CONFIG_MSI_LAPTOP is not set | 753 | # CONFIG_MSI_LAPTOP is not set |
754 | # CONFIG_COMPAL_LAPTOP is not set | ||
751 | # CONFIG_SONY_LAPTOP is not set | 755 | # CONFIG_SONY_LAPTOP is not set |
752 | # CONFIG_THINKPAD_ACPI is not set | 756 | # CONFIG_THINKPAD_ACPI is not set |
753 | # CONFIG_INTEL_MENLOW is not set | 757 | # CONFIG_INTEL_MENLOW is not set |
754 | # CONFIG_ENCLOSURE_SERVICES is not set | 758 | # CONFIG_ENCLOSURE_SERVICES is not set |
759 | # CONFIG_SGI_XP is not set | ||
760 | # CONFIG_HP_ILO is not set | ||
761 | # CONFIG_SGI_GRU is not set | ||
755 | CONFIG_HAVE_IDE=y | 762 | CONFIG_HAVE_IDE=y |
756 | # CONFIG_IDE is not set | 763 | # CONFIG_IDE is not set |
757 | 764 | ||
@@ -790,12 +797,13 @@ CONFIG_SCSI_WAIT_SCAN=m | |||
790 | # | 797 | # |
791 | CONFIG_SCSI_SPI_ATTRS=y | 798 | CONFIG_SCSI_SPI_ATTRS=y |
792 | # CONFIG_SCSI_FC_ATTRS is not set | 799 | # CONFIG_SCSI_FC_ATTRS is not set |
793 | # CONFIG_SCSI_ISCSI_ATTRS is not set | 800 | CONFIG_SCSI_ISCSI_ATTRS=y |
794 | # CONFIG_SCSI_SAS_ATTRS is not set | 801 | # CONFIG_SCSI_SAS_ATTRS is not set |
795 | # CONFIG_SCSI_SAS_LIBSAS is not set | 802 | # CONFIG_SCSI_SAS_LIBSAS is not set |
796 | # CONFIG_SCSI_SRP_ATTRS is not set | 803 | # CONFIG_SCSI_SRP_ATTRS is not set |
797 | # CONFIG_SCSI_LOWLEVEL is not set | 804 | # CONFIG_SCSI_LOWLEVEL is not set |
798 | # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set | 805 | # CONFIG_SCSI_LOWLEVEL_PCMCIA is not set |
806 | # CONFIG_SCSI_DH is not set | ||
799 | CONFIG_ATA=y | 807 | CONFIG_ATA=y |
800 | # CONFIG_ATA_NONSTANDARD is not set | 808 | # CONFIG_ATA_NONSTANDARD is not set |
801 | CONFIG_ATA_ACPI=y | 809 | CONFIG_ATA_ACPI=y |
@@ -857,6 +865,7 @@ CONFIG_PATA_OLDPIIX=y | |||
857 | # CONFIG_PATA_SIS is not set | 865 | # CONFIG_PATA_SIS is not set |
858 | # CONFIG_PATA_VIA is not set | 866 | # CONFIG_PATA_VIA is not set |
859 | # CONFIG_PATA_WINBOND is not set | 867 | # CONFIG_PATA_WINBOND is not set |
868 | CONFIG_PATA_SCH=y | ||
860 | CONFIG_MD=y | 869 | CONFIG_MD=y |
861 | CONFIG_BLK_DEV_MD=y | 870 | CONFIG_BLK_DEV_MD=y |
862 | # CONFIG_MD_LINEAR is not set | 871 | # CONFIG_MD_LINEAR is not set |
@@ -880,13 +889,16 @@ CONFIG_DM_ZERO=y | |||
880 | # | 889 | # |
881 | # IEEE 1394 (FireWire) support | 890 | # IEEE 1394 (FireWire) support |
882 | # | 891 | # |
892 | |||
893 | # | ||
894 | # Enable only one of the two stacks, unless you know what you are doing | ||
895 | # | ||
883 | # CONFIG_FIREWIRE is not set | 896 | # CONFIG_FIREWIRE is not set |
884 | # CONFIG_IEEE1394 is not set | 897 | # CONFIG_IEEE1394 is not set |
885 | # CONFIG_I2O is not set | 898 | # CONFIG_I2O is not set |
886 | CONFIG_MACINTOSH_DRIVERS=y | 899 | CONFIG_MACINTOSH_DRIVERS=y |
887 | CONFIG_MAC_EMUMOUSEBTN=y | 900 | CONFIG_MAC_EMUMOUSEBTN=y |
888 | CONFIG_NETDEVICES=y | 901 | CONFIG_NETDEVICES=y |
889 | # CONFIG_NETDEVICES_MULTIQUEUE is not set | ||
890 | # CONFIG_IFB is not set | 902 | # CONFIG_IFB is not set |
891 | # CONFIG_DUMMY is not set | 903 | # CONFIG_DUMMY is not set |
892 | # CONFIG_BONDING is not set | 904 | # CONFIG_BONDING is not set |
@@ -896,7 +908,23 @@ CONFIG_NETDEVICES=y | |||
896 | # CONFIG_VETH is not set | 908 | # CONFIG_VETH is not set |
897 | # CONFIG_NET_SB1000 is not set | 909 | # CONFIG_NET_SB1000 is not set |
898 | # CONFIG_ARCNET is not set | 910 | # CONFIG_ARCNET is not set |
899 | # CONFIG_PHYLIB is not set | 911 | CONFIG_PHYLIB=y |
912 | |||
913 | # | ||
914 | # MII PHY device drivers | ||
915 | # | ||
916 | # CONFIG_MARVELL_PHY is not set | ||
917 | # CONFIG_DAVICOM_PHY is not set | ||
918 | # CONFIG_QSEMI_PHY is not set | ||
919 | # CONFIG_LXT_PHY is not set | ||
920 | # CONFIG_CICADA_PHY is not set | ||
921 | # CONFIG_VITESSE_PHY is not set | ||
922 | # CONFIG_SMSC_PHY is not set | ||
923 | # CONFIG_BROADCOM_PHY is not set | ||
924 | # CONFIG_ICPLUS_PHY is not set | ||
925 | # CONFIG_REALTEK_PHY is not set | ||
926 | # CONFIG_FIXED_PHY is not set | ||
927 | # CONFIG_MDIO_BITBANG is not set | ||
900 | CONFIG_NET_ETHERNET=y | 928 | CONFIG_NET_ETHERNET=y |
901 | CONFIG_MII=y | 929 | CONFIG_MII=y |
902 | # CONFIG_HAPPYMEAL is not set | 930 | # CONFIG_HAPPYMEAL is not set |
@@ -940,16 +968,15 @@ CONFIG_8139TOO_PIO=y | |||
940 | # CONFIG_SIS900 is not set | 968 | # CONFIG_SIS900 is not set |
941 | # CONFIG_EPIC100 is not set | 969 | # CONFIG_EPIC100 is not set |
942 | # CONFIG_SUNDANCE is not set | 970 | # CONFIG_SUNDANCE is not set |
971 | # CONFIG_TLAN is not set | ||
943 | # CONFIG_VIA_RHINE is not set | 972 | # CONFIG_VIA_RHINE is not set |
944 | # CONFIG_SC92031 is not set | 973 | # CONFIG_SC92031 is not set |
945 | CONFIG_NETDEV_1000=y | 974 | CONFIG_NETDEV_1000=y |
946 | # CONFIG_ACENIC is not set | 975 | # CONFIG_ACENIC is not set |
947 | # CONFIG_DL2K is not set | 976 | # CONFIG_DL2K is not set |
948 | CONFIG_E1000=y | 977 | CONFIG_E1000=y |
949 | # CONFIG_E1000_NAPI is not set | ||
950 | # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set | 978 | # CONFIG_E1000_DISABLE_PACKET_SPLIT is not set |
951 | # CONFIG_E1000E is not set | 979 | # CONFIG_E1000E is not set |
952 | # CONFIG_E1000E_ENABLED is not set | ||
953 | # CONFIG_IP1000 is not set | 980 | # CONFIG_IP1000 is not set |
954 | # CONFIG_IGB is not set | 981 | # CONFIG_IGB is not set |
955 | # CONFIG_NS83820 is not set | 982 | # CONFIG_NS83820 is not set |
@@ -965,6 +992,7 @@ CONFIG_TIGON3=y | |||
965 | # CONFIG_BNX2 is not set | 992 | # CONFIG_BNX2 is not set |
966 | # CONFIG_QLA3XXX is not set | 993 | # CONFIG_QLA3XXX is not set |
967 | # CONFIG_ATL1 is not set | 994 | # CONFIG_ATL1 is not set |
995 | # CONFIG_ATL1E is not set | ||
968 | CONFIG_NETDEV_10000=y | 996 | CONFIG_NETDEV_10000=y |
969 | # CONFIG_CHELSIO_T1 is not set | 997 | # CONFIG_CHELSIO_T1 is not set |
970 | # CONFIG_CHELSIO_T3 is not set | 998 | # CONFIG_CHELSIO_T3 is not set |
@@ -1003,13 +1031,14 @@ CONFIG_WLAN_80211=y | |||
1003 | # CONFIG_RTL8180 is not set | 1031 | # CONFIG_RTL8180 is not set |
1004 | # CONFIG_RTL8187 is not set | 1032 | # CONFIG_RTL8187 is not set |
1005 | # CONFIG_ADM8211 is not set | 1033 | # CONFIG_ADM8211 is not set |
1034 | # CONFIG_MAC80211_HWSIM is not set | ||
1006 | # CONFIG_P54_COMMON is not set | 1035 | # CONFIG_P54_COMMON is not set |
1007 | CONFIG_ATH5K=y | 1036 | CONFIG_ATH5K=y |
1008 | # CONFIG_ATH5K_DEBUG is not set | 1037 | # CONFIG_ATH5K_DEBUG is not set |
1009 | # CONFIG_IWLWIFI is not set | 1038 | # CONFIG_ATH9K is not set |
1010 | # CONFIG_IWLCORE is not set | 1039 | # CONFIG_IWLCORE is not set |
1011 | # CONFIG_IWLWIFI_LEDS is not set | 1040 | # CONFIG_IWLWIFI_LEDS is not set |
1012 | # CONFIG_IWL4965 is not set | 1041 | # CONFIG_IWLAGN is not set |
1013 | # CONFIG_IWL3945 is not set | 1042 | # CONFIG_IWL3945 is not set |
1014 | # CONFIG_HOSTAP is not set | 1043 | # CONFIG_HOSTAP is not set |
1015 | # CONFIG_B43 is not set | 1044 | # CONFIG_B43 is not set |
@@ -1088,6 +1117,7 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y | |||
1088 | # CONFIG_MOUSE_PS2_TOUCHKIT is not set | 1117 | # CONFIG_MOUSE_PS2_TOUCHKIT is not set |
1089 | # CONFIG_MOUSE_SERIAL is not set | 1118 | # CONFIG_MOUSE_SERIAL is not set |
1090 | # CONFIG_MOUSE_APPLETOUCH is not set | 1119 | # CONFIG_MOUSE_APPLETOUCH is not set |
1120 | # CONFIG_MOUSE_BCM5974 is not set | ||
1091 | # CONFIG_MOUSE_VSXXXAA is not set | 1121 | # CONFIG_MOUSE_VSXXXAA is not set |
1092 | CONFIG_INPUT_JOYSTICK=y | 1122 | CONFIG_INPUT_JOYSTICK=y |
1093 | # CONFIG_JOYSTICK_ANALOG is not set | 1123 | # CONFIG_JOYSTICK_ANALOG is not set |
@@ -1122,12 +1152,14 @@ CONFIG_INPUT_TOUCHSCREEN=y | |||
1122 | # CONFIG_TOUCHSCREEN_GUNZE is not set | 1152 | # CONFIG_TOUCHSCREEN_GUNZE is not set |
1123 | # CONFIG_TOUCHSCREEN_ELO is not set | 1153 | # CONFIG_TOUCHSCREEN_ELO is not set |
1124 | # CONFIG_TOUCHSCREEN_MTOUCH is not set | 1154 | # CONFIG_TOUCHSCREEN_MTOUCH is not set |
1155 | # CONFIG_TOUCHSCREEN_INEXIO is not set | ||
1125 | # CONFIG_TOUCHSCREEN_MK712 is not set | 1156 | # CONFIG_TOUCHSCREEN_MK712 is not set |
1126 | # CONFIG_TOUCHSCREEN_PENMOUNT is not set | 1157 | # CONFIG_TOUCHSCREEN_PENMOUNT is not set |
1127 | # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set | 1158 | # CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set |
1128 | # CONFIG_TOUCHSCREEN_TOUCHWIN is not set | 1159 | # CONFIG_TOUCHSCREEN_TOUCHWIN is not set |
1129 | # CONFIG_TOUCHSCREEN_UCB1400 is not set | 1160 | # CONFIG_TOUCHSCREEN_UCB1400 is not set |
1130 | # CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set | 1161 | # CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set |
1162 | # CONFIG_TOUCHSCREEN_TOUCHIT213 is not set | ||
1131 | CONFIG_INPUT_MISC=y | 1163 | CONFIG_INPUT_MISC=y |
1132 | # CONFIG_INPUT_PCSPKR is not set | 1164 | # CONFIG_INPUT_PCSPKR is not set |
1133 | # CONFIG_INPUT_APANEL is not set | 1165 | # CONFIG_INPUT_APANEL is not set |
@@ -1155,6 +1187,7 @@ CONFIG_SERIO_LIBPS2=y | |||
1155 | # Character devices | 1187 | # Character devices |
1156 | # | 1188 | # |
1157 | CONFIG_VT=y | 1189 | CONFIG_VT=y |
1190 | CONFIG_CONSOLE_TRANSLATIONS=y | ||
1158 | CONFIG_VT_CONSOLE=y | 1191 | CONFIG_VT_CONSOLE=y |
1159 | CONFIG_HW_CONSOLE=y | 1192 | CONFIG_HW_CONSOLE=y |
1160 | CONFIG_VT_HW_CONSOLE_BINDING=y | 1193 | CONFIG_VT_HW_CONSOLE_BINDING=y |
@@ -1222,7 +1255,6 @@ CONFIG_NVRAM=y | |||
1222 | # CONFIG_PC8736x_GPIO is not set | 1255 | # CONFIG_PC8736x_GPIO is not set |
1223 | # CONFIG_RAW_DRIVER is not set | 1256 | # CONFIG_RAW_DRIVER is not set |
1224 | CONFIG_HPET=y | 1257 | CONFIG_HPET=y |
1225 | # CONFIG_HPET_RTC_IRQ is not set | ||
1226 | # CONFIG_HPET_MMAP is not set | 1258 | # CONFIG_HPET_MMAP is not set |
1227 | # CONFIG_HANGCHECK_TIMER is not set | 1259 | # CONFIG_HANGCHECK_TIMER is not set |
1228 | # CONFIG_TCG_TPM is not set | 1260 | # CONFIG_TCG_TPM is not set |
@@ -1231,42 +1263,63 @@ CONFIG_DEVPORT=y | |||
1231 | CONFIG_I2C=y | 1263 | CONFIG_I2C=y |
1232 | CONFIG_I2C_BOARDINFO=y | 1264 | CONFIG_I2C_BOARDINFO=y |
1233 | # CONFIG_I2C_CHARDEV is not set | 1265 | # CONFIG_I2C_CHARDEV is not set |
1266 | CONFIG_I2C_HELPER_AUTO=y | ||
1234 | 1267 | ||
1235 | # | 1268 | # |
1236 | # I2C Hardware Bus support | 1269 | # I2C Hardware Bus support |
1237 | # | 1270 | # |
1271 | |||
1272 | # | ||
1273 | # PC SMBus host controller drivers | ||
1274 | # | ||
1238 | # CONFIG_I2C_ALI1535 is not set | 1275 | # CONFIG_I2C_ALI1535 is not set |
1239 | # CONFIG_I2C_ALI1563 is not set | 1276 | # CONFIG_I2C_ALI1563 is not set |
1240 | # CONFIG_I2C_ALI15X3 is not set | 1277 | # CONFIG_I2C_ALI15X3 is not set |
1241 | # CONFIG_I2C_AMD756 is not set | 1278 | # CONFIG_I2C_AMD756 is not set |
1242 | # CONFIG_I2C_AMD8111 is not set | 1279 | # CONFIG_I2C_AMD8111 is not set |
1243 | CONFIG_I2C_I801=y | 1280 | CONFIG_I2C_I801=y |
1244 | # CONFIG_I2C_I810 is not set | 1281 | # CONFIG_I2C_ISCH is not set |
1245 | # CONFIG_I2C_PIIX4 is not set | 1282 | # CONFIG_I2C_PIIX4 is not set |
1246 | # CONFIG_I2C_NFORCE2 is not set | 1283 | # CONFIG_I2C_NFORCE2 is not set |
1247 | # CONFIG_I2C_OCORES is not set | ||
1248 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
1249 | # CONFIG_I2C_PROSAVAGE is not set | ||
1250 | # CONFIG_I2C_SAVAGE4 is not set | ||
1251 | # CONFIG_I2C_SIMTEC is not set | ||
1252 | # CONFIG_I2C_SIS5595 is not set | 1284 | # CONFIG_I2C_SIS5595 is not set |
1253 | # CONFIG_I2C_SIS630 is not set | 1285 | # CONFIG_I2C_SIS630 is not set |
1254 | # CONFIG_I2C_SIS96X is not set | 1286 | # CONFIG_I2C_SIS96X is not set |
1255 | # CONFIG_I2C_TAOS_EVM is not set | ||
1256 | # CONFIG_I2C_STUB is not set | ||
1257 | # CONFIG_I2C_TINY_USB is not set | ||
1258 | # CONFIG_I2C_VIA is not set | 1287 | # CONFIG_I2C_VIA is not set |
1259 | # CONFIG_I2C_VIAPRO is not set | 1288 | # CONFIG_I2C_VIAPRO is not set |
1289 | |||
1290 | # | ||
1291 | # I2C system bus drivers (mostly embedded / system-on-chip) | ||
1292 | # | ||
1293 | # CONFIG_I2C_OCORES is not set | ||
1294 | # CONFIG_I2C_SIMTEC is not set | ||
1295 | |||
1296 | # | ||
1297 | # External I2C/SMBus adapter drivers | ||
1298 | # | ||
1299 | # CONFIG_I2C_PARPORT_LIGHT is not set | ||
1300 | # CONFIG_I2C_TAOS_EVM is not set | ||
1301 | # CONFIG_I2C_TINY_USB is not set | ||
1302 | |||
1303 | # | ||
1304 | # Graphics adapter I2C/DDC channel drivers | ||
1305 | # | ||
1260 | # CONFIG_I2C_VOODOO3 is not set | 1306 | # CONFIG_I2C_VOODOO3 is not set |
1307 | |||
1308 | # | ||
1309 | # Other I2C/SMBus bus drivers | ||
1310 | # | ||
1261 | # CONFIG_I2C_PCA_PLATFORM is not set | 1311 | # CONFIG_I2C_PCA_PLATFORM is not set |
1312 | # CONFIG_I2C_STUB is not set | ||
1262 | 1313 | ||
1263 | # | 1314 | # |
1264 | # Miscellaneous I2C Chip support | 1315 | # Miscellaneous I2C Chip support |
1265 | # | 1316 | # |
1266 | # CONFIG_DS1682 is not set | 1317 | # CONFIG_DS1682 is not set |
1318 | # CONFIG_AT24 is not set | ||
1267 | # CONFIG_SENSORS_EEPROM is not set | 1319 | # CONFIG_SENSORS_EEPROM is not set |
1268 | # CONFIG_SENSORS_PCF8574 is not set | 1320 | # CONFIG_SENSORS_PCF8574 is not set |
1269 | # CONFIG_PCF8575 is not set | 1321 | # CONFIG_PCF8575 is not set |
1322 | # CONFIG_SENSORS_PCA9539 is not set | ||
1270 | # CONFIG_SENSORS_PCF8591 is not set | 1323 | # CONFIG_SENSORS_PCF8591 is not set |
1271 | # CONFIG_SENSORS_MAX6875 is not set | 1324 | # CONFIG_SENSORS_MAX6875 is not set |
1272 | # CONFIG_SENSORS_TSL2550 is not set | 1325 | # CONFIG_SENSORS_TSL2550 is not set |
@@ -1275,6 +1328,8 @@ CONFIG_I2C_I801=y | |||
1275 | # CONFIG_I2C_DEBUG_BUS is not set | 1328 | # CONFIG_I2C_DEBUG_BUS is not set |
1276 | # CONFIG_I2C_DEBUG_CHIP is not set | 1329 | # CONFIG_I2C_DEBUG_CHIP is not set |
1277 | # CONFIG_SPI is not set | 1330 | # CONFIG_SPI is not set |
1331 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | ||
1332 | # CONFIG_GPIOLIB is not set | ||
1278 | # CONFIG_W1 is not set | 1333 | # CONFIG_W1 is not set |
1279 | CONFIG_POWER_SUPPLY=y | 1334 | CONFIG_POWER_SUPPLY=y |
1280 | # CONFIG_POWER_SUPPLY_DEBUG is not set | 1335 | # CONFIG_POWER_SUPPLY_DEBUG is not set |
@@ -1335,8 +1390,10 @@ CONFIG_SSB_POSSIBLE=y | |||
1335 | # | 1390 | # |
1336 | # Multifunction device drivers | 1391 | # Multifunction device drivers |
1337 | # | 1392 | # |
1393 | # CONFIG_MFD_CORE is not set | ||
1338 | # CONFIG_MFD_SM501 is not set | 1394 | # CONFIG_MFD_SM501 is not set |
1339 | # CONFIG_HTC_PASIC3 is not set | 1395 | # CONFIG_HTC_PASIC3 is not set |
1396 | # CONFIG_MFD_TMIO is not set | ||
1340 | 1397 | ||
1341 | # | 1398 | # |
1342 | # Multimedia devices | 1399 | # Multimedia devices |
@@ -1347,6 +1404,7 @@ CONFIG_SSB_POSSIBLE=y | |||
1347 | # | 1404 | # |
1348 | # CONFIG_VIDEO_DEV is not set | 1405 | # CONFIG_VIDEO_DEV is not set |
1349 | # CONFIG_DVB_CORE is not set | 1406 | # CONFIG_DVB_CORE is not set |
1407 | # CONFIG_VIDEO_MEDIA is not set | ||
1350 | 1408 | ||
1351 | # | 1409 | # |
1352 | # Multimedia drivers | 1410 | # Multimedia drivers |
@@ -1387,7 +1445,6 @@ CONFIG_FB_CFB_IMAGEBLIT=y | |||
1387 | # CONFIG_FB_SYS_IMAGEBLIT is not set | 1445 | # CONFIG_FB_SYS_IMAGEBLIT is not set |
1388 | # CONFIG_FB_FOREIGN_ENDIAN is not set | 1446 | # CONFIG_FB_FOREIGN_ENDIAN is not set |
1389 | # CONFIG_FB_SYS_FOPS is not set | 1447 | # CONFIG_FB_SYS_FOPS is not set |
1390 | CONFIG_FB_DEFERRED_IO=y | ||
1391 | # CONFIG_FB_SVGALIB is not set | 1448 | # CONFIG_FB_SVGALIB is not set |
1392 | # CONFIG_FB_MACMODES is not set | 1449 | # CONFIG_FB_MACMODES is not set |
1393 | # CONFIG_FB_BACKLIGHT is not set | 1450 | # CONFIG_FB_BACKLIGHT is not set |
@@ -1430,6 +1487,7 @@ CONFIG_FB_EFI=y | |||
1430 | # CONFIG_FB_TRIDENT is not set | 1487 | # CONFIG_FB_TRIDENT is not set |
1431 | # CONFIG_FB_ARK is not set | 1488 | # CONFIG_FB_ARK is not set |
1432 | # CONFIG_FB_PM3 is not set | 1489 | # CONFIG_FB_PM3 is not set |
1490 | # CONFIG_FB_CARMINE is not set | ||
1433 | # CONFIG_FB_GEODE is not set | 1491 | # CONFIG_FB_GEODE is not set |
1434 | # CONFIG_FB_VIRTUAL is not set | 1492 | # CONFIG_FB_VIRTUAL is not set |
1435 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | 1493 | CONFIG_BACKLIGHT_LCD_SUPPORT=y |
@@ -1437,6 +1495,7 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y | |||
1437 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | 1495 | CONFIG_BACKLIGHT_CLASS_DEVICE=y |
1438 | # CONFIG_BACKLIGHT_CORGI is not set | 1496 | # CONFIG_BACKLIGHT_CORGI is not set |
1439 | # CONFIG_BACKLIGHT_PROGEAR is not set | 1497 | # CONFIG_BACKLIGHT_PROGEAR is not set |
1498 | # CONFIG_BACKLIGHT_MBP_NVIDIA is not set | ||
1440 | 1499 | ||
1441 | # | 1500 | # |
1442 | # Display device support | 1501 | # Display device support |
@@ -1456,15 +1515,7 @@ CONFIG_LOGO=y | |||
1456 | # CONFIG_LOGO_LINUX_MONO is not set | 1515 | # CONFIG_LOGO_LINUX_MONO is not set |
1457 | # CONFIG_LOGO_LINUX_VGA16 is not set | 1516 | # CONFIG_LOGO_LINUX_VGA16 is not set |
1458 | CONFIG_LOGO_LINUX_CLUT224=y | 1517 | CONFIG_LOGO_LINUX_CLUT224=y |
1459 | |||
1460 | # | ||
1461 | # Sound | ||
1462 | # | ||
1463 | CONFIG_SOUND=y | 1518 | CONFIG_SOUND=y |
1464 | |||
1465 | # | ||
1466 | # Advanced Linux Sound Architecture | ||
1467 | # | ||
1468 | CONFIG_SND=y | 1519 | CONFIG_SND=y |
1469 | CONFIG_SND_TIMER=y | 1520 | CONFIG_SND_TIMER=y |
1470 | CONFIG_SND_PCM=y | 1521 | CONFIG_SND_PCM=y |
@@ -1482,20 +1533,14 @@ CONFIG_SND_VERBOSE_PROCFS=y | |||
1482 | # CONFIG_SND_VERBOSE_PRINTK is not set | 1533 | # CONFIG_SND_VERBOSE_PRINTK is not set |
1483 | # CONFIG_SND_DEBUG is not set | 1534 | # CONFIG_SND_DEBUG is not set |
1484 | CONFIG_SND_VMASTER=y | 1535 | CONFIG_SND_VMASTER=y |
1485 | 1536 | CONFIG_SND_DRIVERS=y | |
1486 | # | ||
1487 | # Generic devices | ||
1488 | # | ||
1489 | # CONFIG_SND_PCSP is not set | 1537 | # CONFIG_SND_PCSP is not set |
1490 | # CONFIG_SND_DUMMY is not set | 1538 | # CONFIG_SND_DUMMY is not set |
1491 | # CONFIG_SND_VIRMIDI is not set | 1539 | # CONFIG_SND_VIRMIDI is not set |
1492 | # CONFIG_SND_MTPAV is not set | 1540 | # CONFIG_SND_MTPAV is not set |
1493 | # CONFIG_SND_SERIAL_U16550 is not set | 1541 | # CONFIG_SND_SERIAL_U16550 is not set |
1494 | # CONFIG_SND_MPU401 is not set | 1542 | # CONFIG_SND_MPU401 is not set |
1495 | 1543 | CONFIG_SND_PCI=y | |
1496 | # | ||
1497 | # PCI devices | ||
1498 | # | ||
1499 | # CONFIG_SND_AD1889 is not set | 1544 | # CONFIG_SND_AD1889 is not set |
1500 | # CONFIG_SND_ALS300 is not set | 1545 | # CONFIG_SND_ALS300 is not set |
1501 | # CONFIG_SND_ALS4000 is not set | 1546 | # CONFIG_SND_ALS4000 is not set |
@@ -1568,36 +1613,14 @@ CONFIG_SND_HDA_GENERIC=y | |||
1568 | # CONFIG_SND_VIRTUOSO is not set | 1613 | # CONFIG_SND_VIRTUOSO is not set |
1569 | # CONFIG_SND_VX222 is not set | 1614 | # CONFIG_SND_VX222 is not set |
1570 | # CONFIG_SND_YMFPCI is not set | 1615 | # CONFIG_SND_YMFPCI is not set |
1571 | 1616 | CONFIG_SND_USB=y | |
1572 | # | ||
1573 | # USB devices | ||
1574 | # | ||
1575 | # CONFIG_SND_USB_AUDIO is not set | 1617 | # CONFIG_SND_USB_AUDIO is not set |
1576 | # CONFIG_SND_USB_USX2Y is not set | 1618 | # CONFIG_SND_USB_USX2Y is not set |
1577 | # CONFIG_SND_USB_CAIAQ is not set | 1619 | # CONFIG_SND_USB_CAIAQ is not set |
1578 | 1620 | CONFIG_SND_PCMCIA=y | |
1579 | # | ||
1580 | # PCMCIA devices | ||
1581 | # | ||
1582 | # CONFIG_SND_VXPOCKET is not set | 1621 | # CONFIG_SND_VXPOCKET is not set |
1583 | # CONFIG_SND_PDAUDIOCF is not set | 1622 | # CONFIG_SND_PDAUDIOCF is not set |
1584 | |||
1585 | # | ||
1586 | # System on Chip audio support | ||
1587 | # | ||
1588 | # CONFIG_SND_SOC is not set | 1623 | # CONFIG_SND_SOC is not set |
1589 | |||
1590 | # | ||
1591 | # ALSA SoC audio for Freescale SOCs | ||
1592 | # | ||
1593 | |||
1594 | # | ||
1595 | # SoC Audio for the Texas Instruments OMAP | ||
1596 | # | ||
1597 | |||
1598 | # | ||
1599 | # Open Sound System | ||
1600 | # | ||
1601 | # CONFIG_SOUND_PRIME is not set | 1624 | # CONFIG_SOUND_PRIME is not set |
1602 | CONFIG_HID_SUPPORT=y | 1625 | CONFIG_HID_SUPPORT=y |
1603 | CONFIG_HID=y | 1626 | CONFIG_HID=y |
@@ -1633,6 +1656,7 @@ CONFIG_USB_DEVICEFS=y | |||
1633 | # CONFIG_USB_DYNAMIC_MINORS is not set | 1656 | # CONFIG_USB_DYNAMIC_MINORS is not set |
1634 | CONFIG_USB_SUSPEND=y | 1657 | CONFIG_USB_SUSPEND=y |
1635 | # CONFIG_USB_OTG is not set | 1658 | # CONFIG_USB_OTG is not set |
1659 | CONFIG_USB_MON=y | ||
1636 | 1660 | ||
1637 | # | 1661 | # |
1638 | # USB Host Controller Drivers | 1662 | # USB Host Controller Drivers |
@@ -1656,6 +1680,7 @@ CONFIG_USB_UHCI_HCD=y | |||
1656 | # | 1680 | # |
1657 | # CONFIG_USB_ACM is not set | 1681 | # CONFIG_USB_ACM is not set |
1658 | CONFIG_USB_PRINTER=y | 1682 | CONFIG_USB_PRINTER=y |
1683 | # CONFIG_USB_WDM is not set | ||
1659 | 1684 | ||
1660 | # | 1685 | # |
1661 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' | 1686 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' |
@@ -1677,6 +1702,7 @@ CONFIG_USB_STORAGE=y | |||
1677 | # CONFIG_USB_STORAGE_ALAUDA is not set | 1702 | # CONFIG_USB_STORAGE_ALAUDA is not set |
1678 | # CONFIG_USB_STORAGE_ONETOUCH is not set | 1703 | # CONFIG_USB_STORAGE_ONETOUCH is not set |
1679 | # CONFIG_USB_STORAGE_KARMA is not set | 1704 | # CONFIG_USB_STORAGE_KARMA is not set |
1705 | # CONFIG_USB_STORAGE_SIERRA is not set | ||
1680 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set | 1706 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set |
1681 | CONFIG_USB_LIBUSUAL=y | 1707 | CONFIG_USB_LIBUSUAL=y |
1682 | 1708 | ||
@@ -1685,7 +1711,6 @@ CONFIG_USB_LIBUSUAL=y | |||
1685 | # | 1711 | # |
1686 | # CONFIG_USB_MDC800 is not set | 1712 | # CONFIG_USB_MDC800 is not set |
1687 | # CONFIG_USB_MICROTEK is not set | 1713 | # CONFIG_USB_MICROTEK is not set |
1688 | CONFIG_USB_MON=y | ||
1689 | 1714 | ||
1690 | # | 1715 | # |
1691 | # USB port drivers | 1716 | # USB port drivers |
@@ -1698,7 +1723,6 @@ CONFIG_USB_MON=y | |||
1698 | # CONFIG_USB_EMI62 is not set | 1723 | # CONFIG_USB_EMI62 is not set |
1699 | # CONFIG_USB_EMI26 is not set | 1724 | # CONFIG_USB_EMI26 is not set |
1700 | # CONFIG_USB_ADUTUX is not set | 1725 | # CONFIG_USB_ADUTUX is not set |
1701 | # CONFIG_USB_AUERSWALD is not set | ||
1702 | # CONFIG_USB_RIO500 is not set | 1726 | # CONFIG_USB_RIO500 is not set |
1703 | # CONFIG_USB_LEGOTOWER is not set | 1727 | # CONFIG_USB_LEGOTOWER is not set |
1704 | # CONFIG_USB_LCD is not set | 1728 | # CONFIG_USB_LCD is not set |
@@ -1715,6 +1739,7 @@ CONFIG_USB_MON=y | |||
1715 | # CONFIG_USB_TRANCEVIBRATOR is not set | 1739 | # CONFIG_USB_TRANCEVIBRATOR is not set |
1716 | # CONFIG_USB_IOWARRIOR is not set | 1740 | # CONFIG_USB_IOWARRIOR is not set |
1717 | # CONFIG_USB_TEST is not set | 1741 | # CONFIG_USB_TEST is not set |
1742 | # CONFIG_USB_ISIGHTFW is not set | ||
1718 | # CONFIG_USB_GADGET is not set | 1743 | # CONFIG_USB_GADGET is not set |
1719 | # CONFIG_MMC is not set | 1744 | # CONFIG_MMC is not set |
1720 | # CONFIG_MEMSTICK is not set | 1745 | # CONFIG_MEMSTICK is not set |
@@ -1724,7 +1749,9 @@ CONFIG_LEDS_CLASS=y | |||
1724 | # | 1749 | # |
1725 | # LED drivers | 1750 | # LED drivers |
1726 | # | 1751 | # |
1752 | # CONFIG_LEDS_PCA9532 is not set | ||
1727 | # CONFIG_LEDS_CLEVO_MAIL is not set | 1753 | # CONFIG_LEDS_CLEVO_MAIL is not set |
1754 | # CONFIG_LEDS_PCA955X is not set | ||
1728 | 1755 | ||
1729 | # | 1756 | # |
1730 | # LED Triggers | 1757 | # LED Triggers |
@@ -1770,6 +1797,7 @@ CONFIG_RTC_INTF_DEV=y | |||
1770 | # CONFIG_RTC_DRV_PCF8583 is not set | 1797 | # CONFIG_RTC_DRV_PCF8583 is not set |
1771 | # CONFIG_RTC_DRV_M41T80 is not set | 1798 | # CONFIG_RTC_DRV_M41T80 is not set |
1772 | # CONFIG_RTC_DRV_S35390A is not set | 1799 | # CONFIG_RTC_DRV_S35390A is not set |
1800 | # CONFIG_RTC_DRV_FM3130 is not set | ||
1773 | 1801 | ||
1774 | # | 1802 | # |
1775 | # SPI RTC drivers | 1803 | # SPI RTC drivers |
@@ -1802,11 +1830,13 @@ CONFIG_DMADEVICES=y | |||
1802 | # Firmware Drivers | 1830 | # Firmware Drivers |
1803 | # | 1831 | # |
1804 | # CONFIG_EDD is not set | 1832 | # CONFIG_EDD is not set |
1833 | CONFIG_FIRMWARE_MEMMAP=y | ||
1805 | CONFIG_EFI_VARS=y | 1834 | CONFIG_EFI_VARS=y |
1806 | # CONFIG_DELL_RBU is not set | 1835 | # CONFIG_DELL_RBU is not set |
1807 | # CONFIG_DCDBAS is not set | 1836 | # CONFIG_DCDBAS is not set |
1808 | CONFIG_DMIID=y | 1837 | CONFIG_DMIID=y |
1809 | # CONFIG_ISCSI_IBFT_FIND is not set | 1838 | CONFIG_ISCSI_IBFT_FIND=y |
1839 | CONFIG_ISCSI_IBFT=y | ||
1810 | 1840 | ||
1811 | # | 1841 | # |
1812 | # File systems | 1842 | # File systems |
@@ -1886,14 +1916,27 @@ CONFIG_HUGETLB_PAGE=y | |||
1886 | # CONFIG_CRAMFS is not set | 1916 | # CONFIG_CRAMFS is not set |
1887 | # CONFIG_VXFS_FS is not set | 1917 | # CONFIG_VXFS_FS is not set |
1888 | # CONFIG_MINIX_FS is not set | 1918 | # CONFIG_MINIX_FS is not set |
1919 | # CONFIG_OMFS_FS is not set | ||
1889 | # CONFIG_HPFS_FS is not set | 1920 | # CONFIG_HPFS_FS is not set |
1890 | # CONFIG_QNX4FS_FS is not set | 1921 | # CONFIG_QNX4FS_FS is not set |
1891 | # CONFIG_ROMFS_FS is not set | 1922 | # CONFIG_ROMFS_FS is not set |
1892 | # CONFIG_SYSV_FS is not set | 1923 | # CONFIG_SYSV_FS is not set |
1893 | # CONFIG_UFS_FS is not set | 1924 | # CONFIG_UFS_FS is not set |
1894 | CONFIG_NETWORK_FILESYSTEMS=y | 1925 | CONFIG_NETWORK_FILESYSTEMS=y |
1895 | # CONFIG_NFS_FS is not set | 1926 | CONFIG_NFS_FS=y |
1927 | CONFIG_NFS_V3=y | ||
1928 | CONFIG_NFS_V3_ACL=y | ||
1929 | CONFIG_NFS_V4=y | ||
1930 | CONFIG_ROOT_NFS=y | ||
1896 | # CONFIG_NFSD is not set | 1931 | # CONFIG_NFSD is not set |
1932 | CONFIG_LOCKD=y | ||
1933 | CONFIG_LOCKD_V4=y | ||
1934 | CONFIG_NFS_ACL_SUPPORT=y | ||
1935 | CONFIG_NFS_COMMON=y | ||
1936 | CONFIG_SUNRPC=y | ||
1937 | CONFIG_SUNRPC_GSS=y | ||
1938 | CONFIG_RPCSEC_GSS_KRB5=y | ||
1939 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
1897 | # CONFIG_SMB_FS is not set | 1940 | # CONFIG_SMB_FS is not set |
1898 | # CONFIG_CIFS is not set | 1941 | # CONFIG_CIFS is not set |
1899 | # CONFIG_NCP_FS is not set | 1942 | # CONFIG_NCP_FS is not set |
@@ -1967,9 +2010,9 @@ CONFIG_NLS_UTF8=y | |||
1967 | # Kernel hacking | 2010 | # Kernel hacking |
1968 | # | 2011 | # |
1969 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | 2012 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y |
1970 | # CONFIG_PRINTK_TIME is not set | 2013 | CONFIG_PRINTK_TIME=y |
1971 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | 2014 | CONFIG_ENABLE_WARN_DEPRECATED=y |
1972 | # CONFIG_ENABLE_MUST_CHECK is not set | 2015 | CONFIG_ENABLE_MUST_CHECK=y |
1973 | CONFIG_FRAME_WARN=2048 | 2016 | CONFIG_FRAME_WARN=2048 |
1974 | CONFIG_MAGIC_SYSRQ=y | 2017 | CONFIG_MAGIC_SYSRQ=y |
1975 | # CONFIG_UNUSED_SYMBOLS is not set | 2018 | # CONFIG_UNUSED_SYMBOLS is not set |
@@ -1998,6 +2041,7 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1998 | # CONFIG_DEBUG_INFO is not set | 2041 | # CONFIG_DEBUG_INFO is not set |
1999 | # CONFIG_DEBUG_VM is not set | 2042 | # CONFIG_DEBUG_VM is not set |
2000 | # CONFIG_DEBUG_WRITECOUNT is not set | 2043 | # CONFIG_DEBUG_WRITECOUNT is not set |
2044 | CONFIG_DEBUG_MEMORY_INIT=y | ||
2001 | # CONFIG_DEBUG_LIST is not set | 2045 | # CONFIG_DEBUG_LIST is not set |
2002 | # CONFIG_DEBUG_SG is not set | 2046 | # CONFIG_DEBUG_SG is not set |
2003 | CONFIG_FRAME_POINTER=y | 2047 | CONFIG_FRAME_POINTER=y |
@@ -2008,11 +2052,20 @@ CONFIG_FRAME_POINTER=y | |||
2008 | # CONFIG_LKDTM is not set | 2052 | # CONFIG_LKDTM is not set |
2009 | # CONFIG_FAULT_INJECTION is not set | 2053 | # CONFIG_FAULT_INJECTION is not set |
2010 | # CONFIG_LATENCYTOP is not set | 2054 | # CONFIG_LATENCYTOP is not set |
2055 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
2056 | CONFIG_HAVE_FTRACE=y | ||
2057 | CONFIG_HAVE_DYNAMIC_FTRACE=y | ||
2058 | # CONFIG_FTRACE is not set | ||
2059 | # CONFIG_IRQSOFF_TRACER is not set | ||
2060 | # CONFIG_SYSPROF_TRACER is not set | ||
2061 | # CONFIG_SCHED_TRACER is not set | ||
2062 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | ||
2011 | CONFIG_PROVIDE_OHCI1394_DMA_INIT=y | 2063 | CONFIG_PROVIDE_OHCI1394_DMA_INIT=y |
2012 | # CONFIG_SAMPLES is not set | 2064 | # CONFIG_SAMPLES is not set |
2013 | # CONFIG_KGDB is not set | ||
2014 | CONFIG_HAVE_ARCH_KGDB=y | 2065 | CONFIG_HAVE_ARCH_KGDB=y |
2066 | # CONFIG_KGDB is not set | ||
2015 | # CONFIG_STRICT_DEVMEM is not set | 2067 | # CONFIG_STRICT_DEVMEM is not set |
2068 | CONFIG_X86_VERBOSE_BOOTUP=y | ||
2016 | CONFIG_EARLY_PRINTK=y | 2069 | CONFIG_EARLY_PRINTK=y |
2017 | CONFIG_DEBUG_STACKOVERFLOW=y | 2070 | CONFIG_DEBUG_STACKOVERFLOW=y |
2018 | CONFIG_DEBUG_STACK_USAGE=y | 2071 | CONFIG_DEBUG_STACK_USAGE=y |
@@ -2023,8 +2076,8 @@ CONFIG_DEBUG_RODATA=y | |||
2023 | # CONFIG_DIRECT_GBPAGES is not set | 2076 | # CONFIG_DIRECT_GBPAGES is not set |
2024 | # CONFIG_DEBUG_RODATA_TEST is not set | 2077 | # CONFIG_DEBUG_RODATA_TEST is not set |
2025 | CONFIG_DEBUG_NX_TEST=m | 2078 | CONFIG_DEBUG_NX_TEST=m |
2026 | CONFIG_X86_MPPARSE=y | ||
2027 | # CONFIG_IOMMU_DEBUG is not set | 2079 | # CONFIG_IOMMU_DEBUG is not set |
2080 | # CONFIG_MMIOTRACE is not set | ||
2028 | CONFIG_IO_DELAY_TYPE_0X80=0 | 2081 | CONFIG_IO_DELAY_TYPE_0X80=0 |
2029 | CONFIG_IO_DELAY_TYPE_0XED=1 | 2082 | CONFIG_IO_DELAY_TYPE_0XED=1 |
2030 | CONFIG_IO_DELAY_TYPE_UDELAY=2 | 2083 | CONFIG_IO_DELAY_TYPE_UDELAY=2 |
@@ -2036,6 +2089,7 @@ CONFIG_IO_DELAY_0X80=y | |||
2036 | CONFIG_DEFAULT_IO_DELAY_TYPE=0 | 2089 | CONFIG_DEFAULT_IO_DELAY_TYPE=0 |
2037 | CONFIG_DEBUG_BOOT_PARAMS=y | 2090 | CONFIG_DEBUG_BOOT_PARAMS=y |
2038 | # CONFIG_CPA_DEBUG is not set | 2091 | # CONFIG_CPA_DEBUG is not set |
2092 | # CONFIG_OPTIMIZE_INLINING is not set | ||
2039 | 2093 | ||
2040 | # | 2094 | # |
2041 | # Security options | 2095 | # Security options |
@@ -2045,7 +2099,6 @@ CONFIG_KEYS_DEBUG_PROC_KEYS=y | |||
2045 | CONFIG_SECURITY=y | 2099 | CONFIG_SECURITY=y |
2046 | CONFIG_SECURITY_NETWORK=y | 2100 | CONFIG_SECURITY_NETWORK=y |
2047 | # CONFIG_SECURITY_NETWORK_XFRM is not set | 2101 | # CONFIG_SECURITY_NETWORK_XFRM is not set |
2048 | CONFIG_SECURITY_CAPABILITIES=y | ||
2049 | CONFIG_SECURITY_FILE_CAPABILITIES=y | 2102 | CONFIG_SECURITY_FILE_CAPABILITIES=y |
2050 | # CONFIG_SECURITY_ROOTPLUG is not set | 2103 | # CONFIG_SECURITY_ROOTPLUG is not set |
2051 | CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=65536 | 2104 | CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=65536 |
@@ -2106,6 +2159,10 @@ CONFIG_CRYPTO_HMAC=y | |||
2106 | # CONFIG_CRYPTO_MD4 is not set | 2159 | # CONFIG_CRYPTO_MD4 is not set |
2107 | CONFIG_CRYPTO_MD5=y | 2160 | CONFIG_CRYPTO_MD5=y |
2108 | # CONFIG_CRYPTO_MICHAEL_MIC is not set | 2161 | # CONFIG_CRYPTO_MICHAEL_MIC is not set |
2162 | # CONFIG_CRYPTO_RMD128 is not set | ||
2163 | # CONFIG_CRYPTO_RMD160 is not set | ||
2164 | # CONFIG_CRYPTO_RMD256 is not set | ||
2165 | # CONFIG_CRYPTO_RMD320 is not set | ||
2109 | CONFIG_CRYPTO_SHA1=y | 2166 | CONFIG_CRYPTO_SHA1=y |
2110 | # CONFIG_CRYPTO_SHA256 is not set | 2167 | # CONFIG_CRYPTO_SHA256 is not set |
2111 | # CONFIG_CRYPTO_SHA512 is not set | 2168 | # CONFIG_CRYPTO_SHA512 is not set |
@@ -2155,6 +2212,7 @@ CONFIG_GENERIC_FIND_FIRST_BIT=y | |||
2155 | CONFIG_GENERIC_FIND_NEXT_BIT=y | 2212 | CONFIG_GENERIC_FIND_NEXT_BIT=y |
2156 | # CONFIG_CRC_CCITT is not set | 2213 | # CONFIG_CRC_CCITT is not set |
2157 | # CONFIG_CRC16 is not set | 2214 | # CONFIG_CRC16 is not set |
2215 | CONFIG_CRC_T10DIF=y | ||
2158 | # CONFIG_CRC_ITU_T is not set | 2216 | # CONFIG_CRC_ITU_T is not set |
2159 | CONFIG_CRC32=y | 2217 | CONFIG_CRC32=y |
2160 | # CONFIG_CRC7 is not set | 2218 | # CONFIG_CRC7 is not set |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index 58cccb6483b0..a0e1dbe67dc1 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -441,12 +441,6 @@ beyond_if: | |||
441 | regs->r8 = regs->r9 = regs->r10 = regs->r11 = | 441 | regs->r8 = regs->r9 = regs->r10 = regs->r11 = |
442 | regs->r12 = regs->r13 = regs->r14 = regs->r15 = 0; | 442 | regs->r12 = regs->r13 = regs->r14 = regs->r15 = 0; |
443 | set_fs(USER_DS); | 443 | set_fs(USER_DS); |
444 | if (unlikely(current->ptrace & PT_PTRACED)) { | ||
445 | if (current->ptrace & PT_TRACE_EXEC) | ||
446 | ptrace_notify((PTRACE_EVENT_EXEC << 8) | SIGTRAP); | ||
447 | else | ||
448 | send_sig(SIGTRAP, current, 0); | ||
449 | } | ||
450 | return 0; | 444 | return 0; |
451 | } | 445 | } |
452 | 446 | ||
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c index 20af4c79579a..f25a10124005 100644 --- a/arch/x86/ia32/ia32_signal.c +++ b/arch/x86/ia32/ia32_signal.c | |||
@@ -179,9 +179,10 @@ struct sigframe | |||
179 | u32 pretcode; | 179 | u32 pretcode; |
180 | int sig; | 180 | int sig; |
181 | struct sigcontext_ia32 sc; | 181 | struct sigcontext_ia32 sc; |
182 | struct _fpstate_ia32 fpstate; | 182 | struct _fpstate_ia32 fpstate_unused; /* look at kernel/sigframe.h */ |
183 | unsigned int extramask[_COMPAT_NSIG_WORDS-1]; | 183 | unsigned int extramask[_COMPAT_NSIG_WORDS-1]; |
184 | char retcode[8]; | 184 | char retcode[8]; |
185 | /* fp state follows here */ | ||
185 | }; | 186 | }; |
186 | 187 | ||
187 | struct rt_sigframe | 188 | struct rt_sigframe |
@@ -192,8 +193,8 @@ struct rt_sigframe | |||
192 | u32 puc; | 193 | u32 puc; |
193 | compat_siginfo_t info; | 194 | compat_siginfo_t info; |
194 | struct ucontext_ia32 uc; | 195 | struct ucontext_ia32 uc; |
195 | struct _fpstate_ia32 fpstate; | ||
196 | char retcode[8]; | 196 | char retcode[8]; |
197 | /* fp state follows here */ | ||
197 | }; | 198 | }; |
198 | 199 | ||
199 | #define COPY(x) { \ | 200 | #define COPY(x) { \ |
@@ -215,7 +216,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
215 | unsigned int *peax) | 216 | unsigned int *peax) |
216 | { | 217 | { |
217 | unsigned int tmpflags, gs, oldgs, err = 0; | 218 | unsigned int tmpflags, gs, oldgs, err = 0; |
218 | struct _fpstate_ia32 __user *buf; | 219 | void __user *buf; |
219 | u32 tmp; | 220 | u32 tmp; |
220 | 221 | ||
221 | /* Always make any pending restarted system calls return -EINTR */ | 222 | /* Always make any pending restarted system calls return -EINTR */ |
@@ -259,26 +260,12 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, | |||
259 | 260 | ||
260 | err |= __get_user(tmp, &sc->fpstate); | 261 | err |= __get_user(tmp, &sc->fpstate); |
261 | buf = compat_ptr(tmp); | 262 | buf = compat_ptr(tmp); |
262 | if (buf) { | 263 | err |= restore_i387_xstate_ia32(buf); |
263 | if (!access_ok(VERIFY_READ, buf, sizeof(*buf))) | ||
264 | goto badframe; | ||
265 | err |= restore_i387_ia32(buf); | ||
266 | } else { | ||
267 | struct task_struct *me = current; | ||
268 | |||
269 | if (used_math()) { | ||
270 | clear_fpu(me); | ||
271 | clear_used_math(); | ||
272 | } | ||
273 | } | ||
274 | 264 | ||
275 | err |= __get_user(tmp, &sc->ax); | 265 | err |= __get_user(tmp, &sc->ax); |
276 | *peax = tmp; | 266 | *peax = tmp; |
277 | 267 | ||
278 | return err; | 268 | return err; |
279 | |||
280 | badframe: | ||
281 | return 1; | ||
282 | } | 269 | } |
283 | 270 | ||
284 | asmlinkage long sys32_sigreturn(struct pt_regs *regs) | 271 | asmlinkage long sys32_sigreturn(struct pt_regs *regs) |
@@ -350,7 +337,7 @@ badframe: | |||
350 | */ | 337 | */ |
351 | 338 | ||
352 | static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | 339 | static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, |
353 | struct _fpstate_ia32 __user *fpstate, | 340 | void __user *fpstate, |
354 | struct pt_regs *regs, unsigned int mask) | 341 | struct pt_regs *regs, unsigned int mask) |
355 | { | 342 | { |
356 | int tmp, err = 0; | 343 | int tmp, err = 0; |
@@ -381,7 +368,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
381 | err |= __put_user((u32)regs->flags, &sc->flags); | 368 | err |= __put_user((u32)regs->flags, &sc->flags); |
382 | err |= __put_user((u32)regs->sp, &sc->sp_at_signal); | 369 | err |= __put_user((u32)regs->sp, &sc->sp_at_signal); |
383 | 370 | ||
384 | tmp = save_i387_ia32(fpstate); | 371 | tmp = save_i387_xstate_ia32(fpstate); |
385 | if (tmp < 0) | 372 | if (tmp < 0) |
386 | err = -EFAULT; | 373 | err = -EFAULT; |
387 | else { | 374 | else { |
@@ -402,7 +389,8 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, | |||
402 | * Determine which stack to use.. | 389 | * Determine which stack to use.. |
403 | */ | 390 | */ |
404 | static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | 391 | static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, |
405 | size_t frame_size) | 392 | size_t frame_size, |
393 | void **fpstate) | ||
406 | { | 394 | { |
407 | unsigned long sp; | 395 | unsigned long sp; |
408 | 396 | ||
@@ -421,6 +409,11 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
421 | ka->sa.sa_restorer) | 409 | ka->sa.sa_restorer) |
422 | sp = (unsigned long) ka->sa.sa_restorer; | 410 | sp = (unsigned long) ka->sa.sa_restorer; |
423 | 411 | ||
412 | if (used_math()) { | ||
413 | sp = sp - sig_xstate_ia32_size; | ||
414 | *fpstate = (struct _fpstate_ia32 *) sp; | ||
415 | } | ||
416 | |||
424 | sp -= frame_size; | 417 | sp -= frame_size; |
425 | /* Align the stack pointer according to the i386 ABI, | 418 | /* Align the stack pointer according to the i386 ABI, |
426 | * i.e. so that on function entry ((sp + 4) & 15) == 0. */ | 419 | * i.e. so that on function entry ((sp + 4) & 15) == 0. */ |
@@ -434,6 +427,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
434 | struct sigframe __user *frame; | 427 | struct sigframe __user *frame; |
435 | void __user *restorer; | 428 | void __user *restorer; |
436 | int err = 0; | 429 | int err = 0; |
430 | void __user *fpstate = NULL; | ||
437 | 431 | ||
438 | /* copy_to_user optimizes that into a single 8 byte store */ | 432 | /* copy_to_user optimizes that into a single 8 byte store */ |
439 | static const struct { | 433 | static const struct { |
@@ -448,7 +442,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
448 | 0, | 442 | 0, |
449 | }; | 443 | }; |
450 | 444 | ||
451 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 445 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
452 | 446 | ||
453 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 447 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
454 | goto give_sigsegv; | 448 | goto give_sigsegv; |
@@ -457,8 +451,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, | |||
457 | if (err) | 451 | if (err) |
458 | goto give_sigsegv; | 452 | goto give_sigsegv; |
459 | 453 | ||
460 | err |= ia32_setup_sigcontext(&frame->sc, &frame->fpstate, regs, | 454 | err |= ia32_setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0]); |
461 | set->sig[0]); | ||
462 | if (err) | 455 | if (err) |
463 | goto give_sigsegv; | 456 | goto give_sigsegv; |
464 | 457 | ||
@@ -522,6 +515,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
522 | struct rt_sigframe __user *frame; | 515 | struct rt_sigframe __user *frame; |
523 | void __user *restorer; | 516 | void __user *restorer; |
524 | int err = 0; | 517 | int err = 0; |
518 | void __user *fpstate = NULL; | ||
525 | 519 | ||
526 | /* __copy_to_user optimizes that into a single 8 byte store */ | 520 | /* __copy_to_user optimizes that into a single 8 byte store */ |
527 | static const struct { | 521 | static const struct { |
@@ -537,7 +531,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
537 | 0, | 531 | 0, |
538 | }; | 532 | }; |
539 | 533 | ||
540 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 534 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
541 | 535 | ||
542 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 536 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
543 | goto give_sigsegv; | 537 | goto give_sigsegv; |
@@ -550,13 +544,16 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
550 | goto give_sigsegv; | 544 | goto give_sigsegv; |
551 | 545 | ||
552 | /* Create the ucontext. */ | 546 | /* Create the ucontext. */ |
553 | err |= __put_user(0, &frame->uc.uc_flags); | 547 | if (cpu_has_xsave) |
548 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | ||
549 | else | ||
550 | err |= __put_user(0, &frame->uc.uc_flags); | ||
554 | err |= __put_user(0, &frame->uc.uc_link); | 551 | err |= __put_user(0, &frame->uc.uc_link); |
555 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 552 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
556 | err |= __put_user(sas_ss_flags(regs->sp), | 553 | err |= __put_user(sas_ss_flags(regs->sp), |
557 | &frame->uc.uc_stack.ss_flags); | 554 | &frame->uc.uc_stack.ss_flags); |
558 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | 555 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); |
559 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate, | 556 | err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, |
560 | regs, set->sig[0]); | 557 | regs, set->sig[0]); |
561 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 558 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
562 | if (err) | 559 | if (err) |
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index e4bd1793a5e4..ffc1bb4fed7d 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -201,7 +201,7 @@ sysexit_from_sys_call: | |||
201 | movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ | 201 | movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ |
202 | .endm | 202 | .endm |
203 | 203 | ||
204 | .macro auditsys_exit exit | 204 | .macro auditsys_exit exit,ebpsave=RBP |
205 | testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10) | 205 | testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10) |
206 | jnz int_ret_from_sys_call | 206 | jnz int_ret_from_sys_call |
207 | TRACE_IRQS_ON | 207 | TRACE_IRQS_ON |
@@ -214,7 +214,7 @@ sysexit_from_sys_call: | |||
214 | call audit_syscall_exit | 214 | call audit_syscall_exit |
215 | GET_THREAD_INFO(%r10) | 215 | GET_THREAD_INFO(%r10) |
216 | movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */ | 216 | movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */ |
217 | movl RBP-ARGOFFSET(%rsp),%ebp /* reload user register value */ | 217 | movl \ebpsave-ARGOFFSET(%rsp),%ebp /* reload user register value */ |
218 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi | 218 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi |
219 | cli | 219 | cli |
220 | TRACE_IRQS_OFF | 220 | TRACE_IRQS_OFF |
@@ -347,7 +347,7 @@ cstar_auditsys: | |||
347 | jmp cstar_dispatch | 347 | jmp cstar_dispatch |
348 | 348 | ||
349 | sysretl_audit: | 349 | sysretl_audit: |
350 | auditsys_exit sysretl_from_sys_call | 350 | auditsys_exit sysretl_from_sys_call, RCX /* user %ebp in RCX slot */ |
351 | #endif | 351 | #endif |
352 | 352 | ||
353 | cstar_tracesys: | 353 | cstar_tracesys: |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 3db651fc8ec5..c9be69fedb70 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -38,7 +38,7 @@ obj-y += tsc.o io_delay.o rtc.o | |||
38 | 38 | ||
39 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o | 39 | obj-$(CONFIG_X86_TRAMPOLINE) += trampoline.o |
40 | obj-y += process.o | 40 | obj-y += process.o |
41 | obj-y += i387.o | 41 | obj-y += i387.o xsave.o |
42 | obj-y += ptrace.o | 42 | obj-y += ptrace.o |
43 | obj-y += ds.o | 43 | obj-y += ds.o |
44 | obj-$(CONFIG_X86_32) += tls.o | 44 | obj-$(CONFIG_X86_32) += tls.o |
@@ -69,6 +69,7 @@ obj-$(CONFIG_KEXEC) += machine_kexec_$(BITS).o | |||
69 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o | 69 | obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o |
70 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o | 70 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o |
71 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o | 71 | obj-$(CONFIG_X86_NUMAQ) += numaq_32.o |
72 | obj-$(CONFIG_X86_ES7000) += es7000_32.o | ||
72 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit_32.o | 73 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit_32.o |
73 | obj-y += vsmp_64.o | 74 | obj-y += vsmp_64.o |
74 | obj-$(CONFIG_KPROBES) += kprobes.o | 75 | obj-$(CONFIG_KPROBES) += kprobes.o |
@@ -104,6 +105,8 @@ obj-$(CONFIG_OLPC) += olpc.o | |||
104 | ifeq ($(CONFIG_X86_64),y) | 105 | ifeq ($(CONFIG_X86_64),y) |
105 | obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o | 106 | obj-y += genapic_64.o genapic_flat_64.o genx2apic_uv_x.o tlb_uv.o |
106 | obj-y += bios_uv.o | 107 | obj-y += bios_uv.o |
108 | obj-y += genx2apic_cluster.o | ||
109 | obj-y += genx2apic_phys.o | ||
107 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o | 110 | obj-$(CONFIG_X86_PM_TIMER) += pmtimer_64.o |
108 | obj-$(CONFIG_AUDIT) += audit_64.o | 111 | obj-$(CONFIG_AUDIT) += audit_64.o |
109 | 112 | ||
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index fa88a1d71290..27ef365e757d 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -97,6 +97,8 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; | |||
97 | #warning ACPI uses CMPXCHG, i486 and later hardware | 97 | #warning ACPI uses CMPXCHG, i486 and later hardware |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | static int acpi_mcfg_64bit_base_addr __initdata = FALSE; | ||
101 | |||
100 | /* -------------------------------------------------------------------------- | 102 | /* -------------------------------------------------------------------------- |
101 | Boot-time Configuration | 103 | Boot-time Configuration |
102 | -------------------------------------------------------------------------- */ | 104 | -------------------------------------------------------------------------- */ |
@@ -158,6 +160,14 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size) | |||
158 | struct acpi_mcfg_allocation *pci_mmcfg_config; | 160 | struct acpi_mcfg_allocation *pci_mmcfg_config; |
159 | int pci_mmcfg_config_num; | 161 | int pci_mmcfg_config_num; |
160 | 162 | ||
163 | static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg) | ||
164 | { | ||
165 | if (!strcmp(mcfg->header.oem_id, "SGI")) | ||
166 | acpi_mcfg_64bit_base_addr = TRUE; | ||
167 | |||
168 | return 0; | ||
169 | } | ||
170 | |||
161 | int __init acpi_parse_mcfg(struct acpi_table_header *header) | 171 | int __init acpi_parse_mcfg(struct acpi_table_header *header) |
162 | { | 172 | { |
163 | struct acpi_table_mcfg *mcfg; | 173 | struct acpi_table_mcfg *mcfg; |
@@ -190,8 +200,12 @@ int __init acpi_parse_mcfg(struct acpi_table_header *header) | |||
190 | } | 200 | } |
191 | 201 | ||
192 | memcpy(pci_mmcfg_config, &mcfg[1], config_size); | 202 | memcpy(pci_mmcfg_config, &mcfg[1], config_size); |
203 | |||
204 | acpi_mcfg_oem_check(mcfg); | ||
205 | |||
193 | for (i = 0; i < pci_mmcfg_config_num; ++i) { | 206 | for (i = 0; i < pci_mmcfg_config_num; ++i) { |
194 | if (pci_mmcfg_config[i].address > 0xFFFFFFFF) { | 207 | if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) && |
208 | !acpi_mcfg_64bit_base_addr) { | ||
195 | printk(KERN_ERR PREFIX | 209 | printk(KERN_ERR PREFIX |
196 | "MMCONFIG not in low 4GB of memory\n"); | 210 | "MMCONFIG not in low 4GB of memory\n"); |
197 | kfree(pci_mmcfg_config); | 211 | kfree(pci_mmcfg_config); |
@@ -761,7 +775,7 @@ static void __init acpi_register_lapic_address(unsigned long address) | |||
761 | 775 | ||
762 | set_fixmap_nocache(FIX_APIC_BASE, address); | 776 | set_fixmap_nocache(FIX_APIC_BASE, address); |
763 | if (boot_cpu_physical_apicid == -1U) { | 777 | if (boot_cpu_physical_apicid == -1U) { |
764 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 778 | boot_cpu_physical_apicid = read_apic_id(); |
765 | #ifdef CONFIG_X86_32 | 779 | #ifdef CONFIG_X86_32 |
766 | apic_version[boot_cpu_physical_apicid] = | 780 | apic_version[boot_cpu_physical_apicid] = |
767 | GET_APIC_VERSION(apic_read(APIC_LVR)); | 781 | GET_APIC_VERSION(apic_read(APIC_LVR)); |
@@ -1337,7 +1351,9 @@ static void __init acpi_process_madt(void) | |||
1337 | acpi_ioapic = 1; | 1351 | acpi_ioapic = 1; |
1338 | 1352 | ||
1339 | smp_found_config = 1; | 1353 | smp_found_config = 1; |
1354 | #ifdef CONFIG_X86_32 | ||
1340 | setup_apic_routing(); | 1355 | setup_apic_routing(); |
1356 | #endif | ||
1341 | } | 1357 | } |
1342 | } | 1358 | } |
1343 | if (error == -EINVAL) { | 1359 | if (error == -EINVAL) { |
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index 9220cf46aa10..c2502eb9aa83 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c | |||
@@ -73,7 +73,6 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, | |||
73 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 73 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
74 | 74 | ||
75 | cpumask_t saved_mask; | 75 | cpumask_t saved_mask; |
76 | cpumask_of_cpu_ptr(new_mask, cpu); | ||
77 | int retval; | 76 | int retval; |
78 | unsigned int eax, ebx, ecx, edx; | 77 | unsigned int eax, ebx, ecx, edx; |
79 | unsigned int edx_part; | 78 | unsigned int edx_part; |
@@ -92,7 +91,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu, | |||
92 | 91 | ||
93 | /* Make sure we are running on right CPU */ | 92 | /* Make sure we are running on right CPU */ |
94 | saved_mask = current->cpus_allowed; | 93 | saved_mask = current->cpus_allowed; |
95 | retval = set_cpus_allowed_ptr(current, new_mask); | 94 | retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
96 | if (retval) | 95 | if (retval) |
97 | return -1; | 96 | return -1; |
98 | 97 | ||
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c index fa2161d5003b..426e5d91b63a 100644 --- a/arch/x86/kernel/acpi/sleep.c +++ b/arch/x86/kernel/acpi/sleep.c | |||
@@ -20,7 +20,7 @@ unsigned long acpi_realmode_flags; | |||
20 | /* address in low memory of the wakeup routine. */ | 20 | /* address in low memory of the wakeup routine. */ |
21 | static unsigned long acpi_realmode; | 21 | static unsigned long acpi_realmode; |
22 | 22 | ||
23 | #ifdef CONFIG_64BIT | 23 | #if defined(CONFIG_SMP) && defined(CONFIG_64BIT) |
24 | static char temp_stack[10240]; | 24 | static char temp_stack[10240]; |
25 | #endif | 25 | #endif |
26 | 26 | ||
@@ -86,7 +86,7 @@ int acpi_save_state_mem(void) | |||
86 | #endif /* !CONFIG_64BIT */ | 86 | #endif /* !CONFIG_64BIT */ |
87 | 87 | ||
88 | header->pmode_cr0 = read_cr0(); | 88 | header->pmode_cr0 = read_cr0(); |
89 | header->pmode_cr4 = read_cr4(); | 89 | header->pmode_cr4 = read_cr4_safe(); |
90 | header->realmode_flags = acpi_realmode_flags; | 90 | header->realmode_flags = acpi_realmode_flags; |
91 | header->real_magic = 0x12345678; | 91 | header->real_magic = 0x12345678; |
92 | 92 | ||
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 2763cb37b553..65a0c1b48696 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c | |||
@@ -145,35 +145,25 @@ static const unsigned char *const p6_nops[ASM_NOP_MAX+1] = { | |||
145 | extern char __vsyscall_0; | 145 | extern char __vsyscall_0; |
146 | const unsigned char *const *find_nop_table(void) | 146 | const unsigned char *const *find_nop_table(void) |
147 | { | 147 | { |
148 | return boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || | 148 | if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && |
149 | boot_cpu_data.x86 < 6 ? k8_nops : p6_nops; | 149 | boot_cpu_has(X86_FEATURE_NOPL)) |
150 | return p6_nops; | ||
151 | else | ||
152 | return k8_nops; | ||
150 | } | 153 | } |
151 | 154 | ||
152 | #else /* CONFIG_X86_64 */ | 155 | #else /* CONFIG_X86_64 */ |
153 | 156 | ||
154 | static const struct nop { | ||
155 | int cpuid; | ||
156 | const unsigned char *const *noptable; | ||
157 | } noptypes[] = { | ||
158 | { X86_FEATURE_K8, k8_nops }, | ||
159 | { X86_FEATURE_K7, k7_nops }, | ||
160 | { X86_FEATURE_P4, p6_nops }, | ||
161 | { X86_FEATURE_P3, p6_nops }, | ||
162 | { -1, NULL } | ||
163 | }; | ||
164 | |||
165 | const unsigned char *const *find_nop_table(void) | 157 | const unsigned char *const *find_nop_table(void) |
166 | { | 158 | { |
167 | const unsigned char *const *noptable = intel_nops; | 159 | if (boot_cpu_has(X86_FEATURE_K8)) |
168 | int i; | 160 | return k8_nops; |
169 | 161 | else if (boot_cpu_has(X86_FEATURE_K7)) | |
170 | for (i = 0; noptypes[i].cpuid >= 0; i++) { | 162 | return k7_nops; |
171 | if (boot_cpu_has(noptypes[i].cpuid)) { | 163 | else if (boot_cpu_has(X86_FEATURE_NOPL)) |
172 | noptable = noptypes[i].noptable; | 164 | return p6_nops; |
173 | break; | 165 | else |
174 | } | 166 | return intel_nops; |
175 | } | ||
176 | return noptable; | ||
177 | } | 167 | } |
178 | 168 | ||
179 | #endif /* CONFIG_X86_64 */ | 169 | #endif /* CONFIG_X86_64 */ |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index c25210e6ac88..69b4d060b21c 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -29,9 +29,6 @@ | |||
29 | 29 | ||
30 | #define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28)) | 30 | #define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28)) |
31 | 31 | ||
32 | #define to_pages(addr, size) \ | ||
33 | (round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT) | ||
34 | |||
35 | #define EXIT_LOOP_COUNT 10000000 | 32 | #define EXIT_LOOP_COUNT 10000000 |
36 | 33 | ||
37 | static DEFINE_RWLOCK(amd_iommu_devtable_lock); | 34 | static DEFINE_RWLOCK(amd_iommu_devtable_lock); |
@@ -68,7 +65,7 @@ static int __iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd) | |||
68 | u8 *target; | 65 | u8 *target; |
69 | 66 | ||
70 | tail = readl(iommu->mmio_base + MMIO_CMD_TAIL_OFFSET); | 67 | tail = readl(iommu->mmio_base + MMIO_CMD_TAIL_OFFSET); |
71 | target = (iommu->cmd_buf + tail); | 68 | target = iommu->cmd_buf + tail; |
72 | memcpy_toio(target, cmd, sizeof(*cmd)); | 69 | memcpy_toio(target, cmd, sizeof(*cmd)); |
73 | tail = (tail + sizeof(*cmd)) % iommu->cmd_buf_size; | 70 | tail = (tail + sizeof(*cmd)) % iommu->cmd_buf_size; |
74 | head = readl(iommu->mmio_base + MMIO_CMD_HEAD_OFFSET); | 71 | head = readl(iommu->mmio_base + MMIO_CMD_HEAD_OFFSET); |
@@ -104,16 +101,13 @@ static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd) | |||
104 | */ | 101 | */ |
105 | static int iommu_completion_wait(struct amd_iommu *iommu) | 102 | static int iommu_completion_wait(struct amd_iommu *iommu) |
106 | { | 103 | { |
107 | int ret; | 104 | int ret, ready = 0; |
105 | unsigned status = 0; | ||
108 | struct iommu_cmd cmd; | 106 | struct iommu_cmd cmd; |
109 | volatile u64 ready = 0; | ||
110 | unsigned long ready_phys = virt_to_phys(&ready); | ||
111 | unsigned long i = 0; | 107 | unsigned long i = 0; |
112 | 108 | ||
113 | memset(&cmd, 0, sizeof(cmd)); | 109 | memset(&cmd, 0, sizeof(cmd)); |
114 | cmd.data[0] = LOW_U32(ready_phys) | CMD_COMPL_WAIT_STORE_MASK; | 110 | cmd.data[0] = CMD_COMPL_WAIT_INT_MASK; |
115 | cmd.data[1] = upper_32_bits(ready_phys); | ||
116 | cmd.data[2] = 1; /* value written to 'ready' */ | ||
117 | CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT); | 111 | CMD_SET_TYPE(&cmd, CMD_COMPL_WAIT); |
118 | 112 | ||
119 | iommu->need_sync = 0; | 113 | iommu->need_sync = 0; |
@@ -125,9 +119,15 @@ static int iommu_completion_wait(struct amd_iommu *iommu) | |||
125 | 119 | ||
126 | while (!ready && (i < EXIT_LOOP_COUNT)) { | 120 | while (!ready && (i < EXIT_LOOP_COUNT)) { |
127 | ++i; | 121 | ++i; |
128 | cpu_relax(); | 122 | /* wait for the bit to become one */ |
123 | status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET); | ||
124 | ready = status & MMIO_STATUS_COM_WAIT_INT_MASK; | ||
129 | } | 125 | } |
130 | 126 | ||
127 | /* set bit back to zero */ | ||
128 | status &= ~MMIO_STATUS_COM_WAIT_INT_MASK; | ||
129 | writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET); | ||
130 | |||
131 | if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit())) | 131 | if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit())) |
132 | printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n"); | 132 | printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n"); |
133 | 133 | ||
@@ -164,7 +164,7 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu, | |||
164 | address &= PAGE_MASK; | 164 | address &= PAGE_MASK; |
165 | CMD_SET_TYPE(&cmd, CMD_INV_IOMMU_PAGES); | 165 | CMD_SET_TYPE(&cmd, CMD_INV_IOMMU_PAGES); |
166 | cmd.data[1] |= domid; | 166 | cmd.data[1] |= domid; |
167 | cmd.data[2] = LOW_U32(address); | 167 | cmd.data[2] = lower_32_bits(address); |
168 | cmd.data[3] = upper_32_bits(address); | 168 | cmd.data[3] = upper_32_bits(address); |
169 | if (s) /* size bit - we flush more than one 4kb page */ | 169 | if (s) /* size bit - we flush more than one 4kb page */ |
170 | cmd.data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK; | 170 | cmd.data[2] |= CMD_INV_IOMMU_PAGES_SIZE_MASK; |
@@ -185,7 +185,7 @@ static int iommu_flush_pages(struct amd_iommu *iommu, u16 domid, | |||
185 | u64 address, size_t size) | 185 | u64 address, size_t size) |
186 | { | 186 | { |
187 | int s = 0; | 187 | int s = 0; |
188 | unsigned pages = to_pages(address, size); | 188 | unsigned pages = iommu_num_pages(address, size); |
189 | 189 | ||
190 | address &= PAGE_MASK; | 190 | address &= PAGE_MASK; |
191 | 191 | ||
@@ -557,8 +557,8 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu, | |||
557 | if (iommu->exclusion_start && | 557 | if (iommu->exclusion_start && |
558 | iommu->exclusion_start < dma_dom->aperture_size) { | 558 | iommu->exclusion_start < dma_dom->aperture_size) { |
559 | unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT; | 559 | unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT; |
560 | int pages = to_pages(iommu->exclusion_start, | 560 | int pages = iommu_num_pages(iommu->exclusion_start, |
561 | iommu->exclusion_length); | 561 | iommu->exclusion_length); |
562 | dma_ops_reserve_addresses(dma_dom, startpage, pages); | 562 | dma_ops_reserve_addresses(dma_dom, startpage, pages); |
563 | } | 563 | } |
564 | 564 | ||
@@ -667,7 +667,7 @@ static int get_device_resources(struct device *dev, | |||
667 | _bdf = calc_devid(pcidev->bus->number, pcidev->devfn); | 667 | _bdf = calc_devid(pcidev->bus->number, pcidev->devfn); |
668 | 668 | ||
669 | /* device not translated by any IOMMU in the system? */ | 669 | /* device not translated by any IOMMU in the system? */ |
670 | if (_bdf >= amd_iommu_last_bdf) { | 670 | if (_bdf > amd_iommu_last_bdf) { |
671 | *iommu = NULL; | 671 | *iommu = NULL; |
672 | *domain = NULL; | 672 | *domain = NULL; |
673 | *bdf = 0xffff; | 673 | *bdf = 0xffff; |
@@ -767,7 +767,7 @@ static dma_addr_t __map_single(struct device *dev, | |||
767 | unsigned int pages; | 767 | unsigned int pages; |
768 | int i; | 768 | int i; |
769 | 769 | ||
770 | pages = to_pages(paddr, size); | 770 | pages = iommu_num_pages(paddr, size); |
771 | paddr &= PAGE_MASK; | 771 | paddr &= PAGE_MASK; |
772 | 772 | ||
773 | address = dma_ops_alloc_addresses(dev, dma_dom, pages); | 773 | address = dma_ops_alloc_addresses(dev, dma_dom, pages); |
@@ -802,7 +802,7 @@ static void __unmap_single(struct amd_iommu *iommu, | |||
802 | if ((dma_addr == 0) || (dma_addr + size > dma_dom->aperture_size)) | 802 | if ((dma_addr == 0) || (dma_addr + size > dma_dom->aperture_size)) |
803 | return; | 803 | return; |
804 | 804 | ||
805 | pages = to_pages(dma_addr, size); | 805 | pages = iommu_num_pages(dma_addr, size); |
806 | dma_addr &= PAGE_MASK; | 806 | dma_addr &= PAGE_MASK; |
807 | start = dma_addr; | 807 | start = dma_addr; |
808 | 808 | ||
@@ -1085,7 +1085,7 @@ void prealloc_protection_domains(void) | |||
1085 | 1085 | ||
1086 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { | 1086 | while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { |
1087 | devid = (dev->bus->number << 8) | dev->devfn; | 1087 | devid = (dev->bus->number << 8) | dev->devfn; |
1088 | if (devid >= amd_iommu_last_bdf) | 1088 | if (devid > amd_iommu_last_bdf) |
1089 | continue; | 1089 | continue; |
1090 | devid = amd_iommu_alias_table[devid]; | 1090 | devid = amd_iommu_alias_table[devid]; |
1091 | if (domain_for_device(devid)) | 1091 | if (domain_for_device(devid)) |
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index c9d8ff2eb130..a69cc0f52042 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -732,7 +732,7 @@ static int __init init_exclusion_range(struct ivmd_header *m) | |||
732 | set_device_exclusion_range(m->devid, m); | 732 | set_device_exclusion_range(m->devid, m); |
733 | break; | 733 | break; |
734 | case ACPI_IVMD_TYPE_ALL: | 734 | case ACPI_IVMD_TYPE_ALL: |
735 | for (i = 0; i < amd_iommu_last_bdf; ++i) | 735 | for (i = 0; i <= amd_iommu_last_bdf; ++i) |
736 | set_device_exclusion_range(i, m); | 736 | set_device_exclusion_range(i, m); |
737 | break; | 737 | break; |
738 | case ACPI_IVMD_TYPE_RANGE: | 738 | case ACPI_IVMD_TYPE_RANGE: |
@@ -801,6 +801,21 @@ static int __init init_memory_definitions(struct acpi_table_header *table) | |||
801 | } | 801 | } |
802 | 802 | ||
803 | /* | 803 | /* |
804 | * Init the device table to not allow DMA access for devices and | ||
805 | * suppress all page faults | ||
806 | */ | ||
807 | static void init_device_table(void) | ||
808 | { | ||
809 | u16 devid; | ||
810 | |||
811 | for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { | ||
812 | set_dev_entry_bit(devid, DEV_ENTRY_VALID); | ||
813 | set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION); | ||
814 | set_dev_entry_bit(devid, DEV_ENTRY_NO_PAGE_FAULT); | ||
815 | } | ||
816 | } | ||
817 | |||
818 | /* | ||
804 | * This function finally enables all IOMMUs found in the system after | 819 | * This function finally enables all IOMMUs found in the system after |
805 | * they have been initialized | 820 | * they have been initialized |
806 | */ | 821 | */ |
@@ -931,10 +946,13 @@ int __init amd_iommu_init(void) | |||
931 | if (amd_iommu_pd_alloc_bitmap == NULL) | 946 | if (amd_iommu_pd_alloc_bitmap == NULL) |
932 | goto free; | 947 | goto free; |
933 | 948 | ||
949 | /* init the device table */ | ||
950 | init_device_table(); | ||
951 | |||
934 | /* | 952 | /* |
935 | * let all alias entries point to itself | 953 | * let all alias entries point to itself |
936 | */ | 954 | */ |
937 | for (i = 0; i < amd_iommu_last_bdf; ++i) | 955 | for (i = 0; i <= amd_iommu_last_bdf; ++i) |
938 | amd_iommu_alias_table[i] = i; | 956 | amd_iommu_alias_table[i] = i; |
939 | 957 | ||
940 | /* | 958 | /* |
@@ -954,15 +972,15 @@ int __init amd_iommu_init(void) | |||
954 | if (acpi_table_parse("IVRS", init_memory_definitions) != 0) | 972 | if (acpi_table_parse("IVRS", init_memory_definitions) != 0) |
955 | goto free; | 973 | goto free; |
956 | 974 | ||
957 | ret = amd_iommu_init_dma_ops(); | 975 | ret = sysdev_class_register(&amd_iommu_sysdev_class); |
958 | if (ret) | 976 | if (ret) |
959 | goto free; | 977 | goto free; |
960 | 978 | ||
961 | ret = sysdev_class_register(&amd_iommu_sysdev_class); | 979 | ret = sysdev_register(&device_amd_iommu); |
962 | if (ret) | 980 | if (ret) |
963 | goto free; | 981 | goto free; |
964 | 982 | ||
965 | ret = sysdev_register(&device_amd_iommu); | 983 | ret = amd_iommu_init_dma_ops(); |
966 | if (ret) | 984 | if (ret) |
967 | goto free; | 985 | goto free; |
968 | 986 | ||
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c index d6c898358371..584272105051 100644 --- a/arch/x86/kernel/apic_32.c +++ b/arch/x86/kernel/apic_32.c | |||
@@ -145,13 +145,18 @@ static int modern_apic(void) | |||
145 | return lapic_get_version() >= 0x14; | 145 | return lapic_get_version() >= 0x14; |
146 | } | 146 | } |
147 | 147 | ||
148 | void apic_wait_icr_idle(void) | 148 | /* |
149 | * Paravirt kernels also might be using these below ops. So we still | ||
150 | * use generic apic_read()/apic_write(), which might be pointing to different | ||
151 | * ops in PARAVIRT case. | ||
152 | */ | ||
153 | void xapic_wait_icr_idle(void) | ||
149 | { | 154 | { |
150 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) | 155 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) |
151 | cpu_relax(); | 156 | cpu_relax(); |
152 | } | 157 | } |
153 | 158 | ||
154 | u32 safe_apic_wait_icr_idle(void) | 159 | u32 safe_xapic_wait_icr_idle(void) |
155 | { | 160 | { |
156 | u32 send_status; | 161 | u32 send_status; |
157 | int timeout; | 162 | int timeout; |
@@ -167,16 +172,48 @@ u32 safe_apic_wait_icr_idle(void) | |||
167 | return send_status; | 172 | return send_status; |
168 | } | 173 | } |
169 | 174 | ||
175 | void xapic_icr_write(u32 low, u32 id) | ||
176 | { | ||
177 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); | ||
178 | apic_write(APIC_ICR, low); | ||
179 | } | ||
180 | |||
181 | u64 xapic_icr_read(void) | ||
182 | { | ||
183 | u32 icr1, icr2; | ||
184 | |||
185 | icr2 = apic_read(APIC_ICR2); | ||
186 | icr1 = apic_read(APIC_ICR); | ||
187 | |||
188 | return icr1 | ((u64)icr2 << 32); | ||
189 | } | ||
190 | |||
191 | static struct apic_ops xapic_ops = { | ||
192 | .read = native_apic_mem_read, | ||
193 | .write = native_apic_mem_write, | ||
194 | .icr_read = xapic_icr_read, | ||
195 | .icr_write = xapic_icr_write, | ||
196 | .wait_icr_idle = xapic_wait_icr_idle, | ||
197 | .safe_wait_icr_idle = safe_xapic_wait_icr_idle, | ||
198 | }; | ||
199 | |||
200 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; | ||
201 | EXPORT_SYMBOL_GPL(apic_ops); | ||
202 | |||
170 | /** | 203 | /** |
171 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | 204 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 |
172 | */ | 205 | */ |
173 | void __cpuinit enable_NMI_through_LVT0(void) | 206 | void __cpuinit enable_NMI_through_LVT0(void) |
174 | { | 207 | { |
175 | unsigned int v = APIC_DM_NMI; | 208 | unsigned int v; |
209 | |||
210 | /* unmask and set to NMI */ | ||
211 | v = APIC_DM_NMI; | ||
176 | 212 | ||
177 | /* Level triggered for 82489DX */ | 213 | /* Level triggered for 82489DX (32bit mode) */ |
178 | if (!lapic_is_integrated()) | 214 | if (!lapic_is_integrated()) |
179 | v |= APIC_LVT_LEVEL_TRIGGER; | 215 | v |= APIC_LVT_LEVEL_TRIGGER; |
216 | |||
180 | apic_write(APIC_LVT0, v); | 217 | apic_write(APIC_LVT0, v); |
181 | } | 218 | } |
182 | 219 | ||
@@ -193,9 +230,13 @@ int get_physical_broadcast(void) | |||
193 | */ | 230 | */ |
194 | int lapic_get_maxlvt(void) | 231 | int lapic_get_maxlvt(void) |
195 | { | 232 | { |
196 | unsigned int v = apic_read(APIC_LVR); | 233 | unsigned int v; |
197 | 234 | ||
198 | /* 82489DXs do not report # of LVT entries. */ | 235 | v = apic_read(APIC_LVR); |
236 | /* | ||
237 | * - we always have APIC integrated on 64bit mode | ||
238 | * - 82489DXs do not report # of LVT entries | ||
239 | */ | ||
199 | return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2; | 240 | return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2; |
200 | } | 241 | } |
201 | 242 | ||
@@ -1205,7 +1246,7 @@ void __init init_apic_mappings(void) | |||
1205 | * default configuration (or the MP table is broken). | 1246 | * default configuration (or the MP table is broken). |
1206 | */ | 1247 | */ |
1207 | if (boot_cpu_physical_apicid == -1U) | 1248 | if (boot_cpu_physical_apicid == -1U) |
1208 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1249 | boot_cpu_physical_apicid = read_apic_id(); |
1209 | 1250 | ||
1210 | } | 1251 | } |
1211 | 1252 | ||
@@ -1242,7 +1283,7 @@ int __init APIC_init_uniprocessor(void) | |||
1242 | * might be zero if read from MP tables. Get it from LAPIC. | 1283 | * might be zero if read from MP tables. Get it from LAPIC. |
1243 | */ | 1284 | */ |
1244 | #ifdef CONFIG_CRASH_DUMP | 1285 | #ifdef CONFIG_CRASH_DUMP |
1245 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1286 | boot_cpu_physical_apicid = read_apic_id(); |
1246 | #endif | 1287 | #endif |
1247 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | 1288 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); |
1248 | 1289 | ||
@@ -1321,54 +1362,6 @@ void smp_error_interrupt(struct pt_regs *regs) | |||
1321 | irq_exit(); | 1362 | irq_exit(); |
1322 | } | 1363 | } |
1323 | 1364 | ||
1324 | #ifdef CONFIG_SMP | ||
1325 | void __init smp_intr_init(void) | ||
1326 | { | ||
1327 | /* | ||
1328 | * IRQ0 must be given a fixed assignment and initialized, | ||
1329 | * because it's used before the IO-APIC is set up. | ||
1330 | */ | ||
1331 | set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]); | ||
1332 | |||
1333 | /* | ||
1334 | * The reschedule interrupt is a CPU-to-CPU reschedule-helper | ||
1335 | * IPI, driven by wakeup. | ||
1336 | */ | ||
1337 | alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); | ||
1338 | |||
1339 | /* IPI for invalidation */ | ||
1340 | alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); | ||
1341 | |||
1342 | /* IPI for generic function call */ | ||
1343 | alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); | ||
1344 | |||
1345 | /* IPI for single call function */ | ||
1346 | set_intr_gate(CALL_FUNCTION_SINGLE_VECTOR, | ||
1347 | call_function_single_interrupt); | ||
1348 | } | ||
1349 | #endif | ||
1350 | |||
1351 | /* | ||
1352 | * Initialize APIC interrupts | ||
1353 | */ | ||
1354 | void __init apic_intr_init(void) | ||
1355 | { | ||
1356 | #ifdef CONFIG_SMP | ||
1357 | smp_intr_init(); | ||
1358 | #endif | ||
1359 | /* self generated IPI for local APIC timer */ | ||
1360 | alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt); | ||
1361 | |||
1362 | /* IPI vectors for APIC spurious and error interrupts */ | ||
1363 | alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); | ||
1364 | alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt); | ||
1365 | |||
1366 | /* thermal monitor LVT interrupt */ | ||
1367 | #ifdef CONFIG_X86_MCE_P4THERMAL | ||
1368 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); | ||
1369 | #endif | ||
1370 | } | ||
1371 | |||
1372 | /** | 1365 | /** |
1373 | * connect_bsp_APIC - attach the APIC to the interrupt system | 1366 | * connect_bsp_APIC - attach the APIC to the interrupt system |
1374 | */ | 1367 | */ |
@@ -1454,8 +1447,6 @@ void disconnect_bsp_APIC(int virt_wire_setup) | |||
1454 | } | 1447 | } |
1455 | } | 1448 | } |
1456 | 1449 | ||
1457 | unsigned int __cpuinitdata maxcpus = NR_CPUS; | ||
1458 | |||
1459 | void __cpuinit generic_processor_info(int apicid, int version) | 1450 | void __cpuinit generic_processor_info(int apicid, int version) |
1460 | { | 1451 | { |
1461 | int cpu; | 1452 | int cpu; |
@@ -1482,12 +1473,6 @@ void __cpuinit generic_processor_info(int apicid, int version) | |||
1482 | return; | 1473 | return; |
1483 | } | 1474 | } |
1484 | 1475 | ||
1485 | if (num_processors >= maxcpus) { | ||
1486 | printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." | ||
1487 | " Processor ignored.\n", maxcpus); | ||
1488 | return; | ||
1489 | } | ||
1490 | |||
1491 | num_processors++; | 1476 | num_processors++; |
1492 | cpus_complement(tmp_map, cpu_present_map); | 1477 | cpus_complement(tmp_map, cpu_present_map); |
1493 | cpu = first_cpu(tmp_map); | 1478 | cpu = first_cpu(tmp_map); |
@@ -1720,15 +1705,19 @@ static int __init parse_lapic_timer_c2_ok(char *arg) | |||
1720 | } | 1705 | } |
1721 | early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok); | 1706 | early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok); |
1722 | 1707 | ||
1723 | static int __init apic_set_verbosity(char *str) | 1708 | static int __init apic_set_verbosity(char *arg) |
1724 | { | 1709 | { |
1725 | if (strcmp("debug", str) == 0) | 1710 | if (!arg) |
1711 | return -EINVAL; | ||
1712 | |||
1713 | if (strcmp(arg, "debug") == 0) | ||
1726 | apic_verbosity = APIC_DEBUG; | 1714 | apic_verbosity = APIC_DEBUG; |
1727 | else if (strcmp("verbose", str) == 0) | 1715 | else if (strcmp(arg, "verbose") == 0) |
1728 | apic_verbosity = APIC_VERBOSE; | 1716 | apic_verbosity = APIC_VERBOSE; |
1729 | return 1; | 1717 | |
1718 | return 0; | ||
1730 | } | 1719 | } |
1731 | __setup("apic=", apic_set_verbosity); | 1720 | early_param("apic", apic_set_verbosity); |
1732 | 1721 | ||
1733 | static int __init lapic_insert_resource(void) | 1722 | static int __init lapic_insert_resource(void) |
1734 | { | 1723 | { |
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index 7f1f030da7ee..1a6011855af3 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/clockchips.h> | 27 | #include <linux/clockchips.h> |
28 | #include <linux/acpi_pmtmr.h> | 28 | #include <linux/acpi_pmtmr.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/dmar.h> | ||
30 | 31 | ||
31 | #include <asm/atomic.h> | 32 | #include <asm/atomic.h> |
32 | #include <asm/smp.h> | 33 | #include <asm/smp.h> |
@@ -39,6 +40,7 @@ | |||
39 | #include <asm/proto.h> | 40 | #include <asm/proto.h> |
40 | #include <asm/timex.h> | 41 | #include <asm/timex.h> |
41 | #include <asm/apic.h> | 42 | #include <asm/apic.h> |
43 | #include <asm/i8259.h> | ||
42 | 44 | ||
43 | #include <mach_ipi.h> | 45 | #include <mach_ipi.h> |
44 | #include <mach_apic.h> | 46 | #include <mach_apic.h> |
@@ -46,6 +48,11 @@ | |||
46 | static int disable_apic_timer __cpuinitdata; | 48 | static int disable_apic_timer __cpuinitdata; |
47 | static int apic_calibrate_pmtmr __initdata; | 49 | static int apic_calibrate_pmtmr __initdata; |
48 | int disable_apic; | 50 | int disable_apic; |
51 | int disable_x2apic; | ||
52 | int x2apic; | ||
53 | |||
54 | /* x2apic enabled before OS handover */ | ||
55 | int x2apic_preenabled; | ||
49 | 56 | ||
50 | /* Local APIC timer works in C2 */ | 57 | /* Local APIC timer works in C2 */ |
51 | int local_apic_timer_c2_ok; | 58 | int local_apic_timer_c2_ok; |
@@ -90,7 +97,6 @@ static unsigned long apic_phys; | |||
90 | 97 | ||
91 | unsigned long mp_lapic_addr; | 98 | unsigned long mp_lapic_addr; |
92 | 99 | ||
93 | unsigned int __cpuinitdata maxcpus = NR_CPUS; | ||
94 | /* | 100 | /* |
95 | * Get the LAPIC version | 101 | * Get the LAPIC version |
96 | */ | 102 | */ |
@@ -119,13 +125,13 @@ static int modern_apic(void) | |||
119 | return lapic_get_version() >= 0x14; | 125 | return lapic_get_version() >= 0x14; |
120 | } | 126 | } |
121 | 127 | ||
122 | void apic_wait_icr_idle(void) | 128 | void xapic_wait_icr_idle(void) |
123 | { | 129 | { |
124 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) | 130 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) |
125 | cpu_relax(); | 131 | cpu_relax(); |
126 | } | 132 | } |
127 | 133 | ||
128 | u32 safe_apic_wait_icr_idle(void) | 134 | u32 safe_xapic_wait_icr_idle(void) |
129 | { | 135 | { |
130 | u32 send_status; | 136 | u32 send_status; |
131 | int timeout; | 137 | int timeout; |
@@ -141,6 +147,69 @@ u32 safe_apic_wait_icr_idle(void) | |||
141 | return send_status; | 147 | return send_status; |
142 | } | 148 | } |
143 | 149 | ||
150 | void xapic_icr_write(u32 low, u32 id) | ||
151 | { | ||
152 | apic_write(APIC_ICR2, id << 24); | ||
153 | apic_write(APIC_ICR, low); | ||
154 | } | ||
155 | |||
156 | u64 xapic_icr_read(void) | ||
157 | { | ||
158 | u32 icr1, icr2; | ||
159 | |||
160 | icr2 = apic_read(APIC_ICR2); | ||
161 | icr1 = apic_read(APIC_ICR); | ||
162 | |||
163 | return (icr1 | ((u64)icr2 << 32)); | ||
164 | } | ||
165 | |||
166 | static struct apic_ops xapic_ops = { | ||
167 | .read = native_apic_mem_read, | ||
168 | .write = native_apic_mem_write, | ||
169 | .icr_read = xapic_icr_read, | ||
170 | .icr_write = xapic_icr_write, | ||
171 | .wait_icr_idle = xapic_wait_icr_idle, | ||
172 | .safe_wait_icr_idle = safe_xapic_wait_icr_idle, | ||
173 | }; | ||
174 | |||
175 | struct apic_ops __read_mostly *apic_ops = &xapic_ops; | ||
176 | |||
177 | EXPORT_SYMBOL_GPL(apic_ops); | ||
178 | |||
179 | static void x2apic_wait_icr_idle(void) | ||
180 | { | ||
181 | /* no need to wait for icr idle in x2apic */ | ||
182 | return; | ||
183 | } | ||
184 | |||
185 | static u32 safe_x2apic_wait_icr_idle(void) | ||
186 | { | ||
187 | /* no need to wait for icr idle in x2apic */ | ||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | void x2apic_icr_write(u32 low, u32 id) | ||
192 | { | ||
193 | wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); | ||
194 | } | ||
195 | |||
196 | u64 x2apic_icr_read(void) | ||
197 | { | ||
198 | unsigned long val; | ||
199 | |||
200 | rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val); | ||
201 | return val; | ||
202 | } | ||
203 | |||
204 | static struct apic_ops x2apic_ops = { | ||
205 | .read = native_apic_msr_read, | ||
206 | .write = native_apic_msr_write, | ||
207 | .icr_read = x2apic_icr_read, | ||
208 | .icr_write = x2apic_icr_write, | ||
209 | .wait_icr_idle = x2apic_wait_icr_idle, | ||
210 | .safe_wait_icr_idle = safe_x2apic_wait_icr_idle, | ||
211 | }; | ||
212 | |||
144 | /** | 213 | /** |
145 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 | 214 | * enable_NMI_through_LVT0 - enable NMI through local vector table 0 |
146 | */ | 215 | */ |
@@ -150,6 +219,11 @@ void __cpuinit enable_NMI_through_LVT0(void) | |||
150 | 219 | ||
151 | /* unmask and set to NMI */ | 220 | /* unmask and set to NMI */ |
152 | v = APIC_DM_NMI; | 221 | v = APIC_DM_NMI; |
222 | |||
223 | /* Level triggered for 82489DX (32bit mode) */ | ||
224 | if (!lapic_is_integrated()) | ||
225 | v |= APIC_LVT_LEVEL_TRIGGER; | ||
226 | |||
153 | apic_write(APIC_LVT0, v); | 227 | apic_write(APIC_LVT0, v); |
154 | } | 228 | } |
155 | 229 | ||
@@ -158,11 +232,14 @@ void __cpuinit enable_NMI_through_LVT0(void) | |||
158 | */ | 232 | */ |
159 | int lapic_get_maxlvt(void) | 233 | int lapic_get_maxlvt(void) |
160 | { | 234 | { |
161 | unsigned int v, maxlvt; | 235 | unsigned int v; |
162 | 236 | ||
163 | v = apic_read(APIC_LVR); | 237 | v = apic_read(APIC_LVR); |
164 | maxlvt = GET_APIC_MAXLVT(v); | 238 | /* |
165 | return maxlvt; | 239 | * - we always have APIC integrated on 64bit mode |
240 | * - 82489DXs do not report # of LVT entries | ||
241 | */ | ||
242 | return APIC_INTEGRATED(GET_APIC_VERSION(v)) ? GET_APIC_MAXLVT(v) : 2; | ||
166 | } | 243 | } |
167 | 244 | ||
168 | /* | 245 | /* |
@@ -630,10 +707,10 @@ int __init verify_local_APIC(void) | |||
630 | /* | 707 | /* |
631 | * The ID register is read/write in a real APIC. | 708 | * The ID register is read/write in a real APIC. |
632 | */ | 709 | */ |
633 | reg0 = read_apic_id(); | 710 | reg0 = apic_read(APIC_ID); |
634 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); | 711 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); |
635 | apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); | 712 | apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); |
636 | reg1 = read_apic_id(); | 713 | reg1 = apic_read(APIC_ID); |
637 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); | 714 | apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); |
638 | apic_write(APIC_ID, reg0); | 715 | apic_write(APIC_ID, reg0); |
639 | if (reg1 != (reg0 ^ APIC_ID_MASK)) | 716 | if (reg1 != (reg0 ^ APIC_ID_MASK)) |
@@ -834,6 +911,125 @@ void __cpuinit end_local_APIC_setup(void) | |||
834 | apic_pm_activate(); | 911 | apic_pm_activate(); |
835 | } | 912 | } |
836 | 913 | ||
914 | void check_x2apic(void) | ||
915 | { | ||
916 | int msr, msr2; | ||
917 | |||
918 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | ||
919 | |||
920 | if (msr & X2APIC_ENABLE) { | ||
921 | printk("x2apic enabled by BIOS, switching to x2apic ops\n"); | ||
922 | x2apic_preenabled = x2apic = 1; | ||
923 | apic_ops = &x2apic_ops; | ||
924 | } | ||
925 | } | ||
926 | |||
927 | void enable_x2apic(void) | ||
928 | { | ||
929 | int msr, msr2; | ||
930 | |||
931 | rdmsr(MSR_IA32_APICBASE, msr, msr2); | ||
932 | if (!(msr & X2APIC_ENABLE)) { | ||
933 | printk("Enabling x2apic\n"); | ||
934 | wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0); | ||
935 | } | ||
936 | } | ||
937 | |||
938 | void enable_IR_x2apic(void) | ||
939 | { | ||
940 | #ifdef CONFIG_INTR_REMAP | ||
941 | int ret; | ||
942 | unsigned long flags; | ||
943 | |||
944 | if (!cpu_has_x2apic) | ||
945 | return; | ||
946 | |||
947 | if (!x2apic_preenabled && disable_x2apic) { | ||
948 | printk(KERN_INFO | ||
949 | "Skipped enabling x2apic and Interrupt-remapping " | ||
950 | "because of nox2apic\n"); | ||
951 | return; | ||
952 | } | ||
953 | |||
954 | if (x2apic_preenabled && disable_x2apic) | ||
955 | panic("Bios already enabled x2apic, can't enforce nox2apic"); | ||
956 | |||
957 | if (!x2apic_preenabled && skip_ioapic_setup) { | ||
958 | printk(KERN_INFO | ||
959 | "Skipped enabling x2apic and Interrupt-remapping " | ||
960 | "because of skipping io-apic setup\n"); | ||
961 | return; | ||
962 | } | ||
963 | |||
964 | ret = dmar_table_init(); | ||
965 | if (ret) { | ||
966 | printk(KERN_INFO | ||
967 | "dmar_table_init() failed with %d:\n", ret); | ||
968 | |||
969 | if (x2apic_preenabled) | ||
970 | panic("x2apic enabled by bios. But IR enabling failed"); | ||
971 | else | ||
972 | printk(KERN_INFO | ||
973 | "Not enabling x2apic,Intr-remapping\n"); | ||
974 | return; | ||
975 | } | ||
976 | |||
977 | local_irq_save(flags); | ||
978 | mask_8259A(); | ||
979 | save_mask_IO_APIC_setup(); | ||
980 | |||
981 | ret = enable_intr_remapping(1); | ||
982 | |||
983 | if (ret && x2apic_preenabled) { | ||
984 | local_irq_restore(flags); | ||
985 | panic("x2apic enabled by bios. But IR enabling failed"); | ||
986 | } | ||
987 | |||
988 | if (ret) | ||
989 | goto end; | ||
990 | |||
991 | if (!x2apic) { | ||
992 | x2apic = 1; | ||
993 | apic_ops = &x2apic_ops; | ||
994 | enable_x2apic(); | ||
995 | } | ||
996 | end: | ||
997 | if (ret) | ||
998 | /* | ||
999 | * IR enabling failed | ||
1000 | */ | ||
1001 | restore_IO_APIC_setup(); | ||
1002 | else | ||
1003 | reinit_intr_remapped_IO_APIC(x2apic_preenabled); | ||
1004 | |||
1005 | unmask_8259A(); | ||
1006 | local_irq_restore(flags); | ||
1007 | |||
1008 | if (!ret) { | ||
1009 | if (!x2apic_preenabled) | ||
1010 | printk(KERN_INFO | ||
1011 | "Enabled x2apic and interrupt-remapping\n"); | ||
1012 | else | ||
1013 | printk(KERN_INFO | ||
1014 | "Enabled Interrupt-remapping\n"); | ||
1015 | } else | ||
1016 | printk(KERN_ERR | ||
1017 | "Failed to enable Interrupt-remapping and x2apic\n"); | ||
1018 | #else | ||
1019 | if (!cpu_has_x2apic) | ||
1020 | return; | ||
1021 | |||
1022 | if (x2apic_preenabled) | ||
1023 | panic("x2apic enabled prior OS handover," | ||
1024 | " enable CONFIG_INTR_REMAP"); | ||
1025 | |||
1026 | printk(KERN_INFO "Enable CONFIG_INTR_REMAP for enabling intr-remapping " | ||
1027 | " and x2apic\n"); | ||
1028 | #endif | ||
1029 | |||
1030 | return; | ||
1031 | } | ||
1032 | |||
837 | /* | 1033 | /* |
838 | * Detect and enable local APICs on non-SMP boards. | 1034 | * Detect and enable local APICs on non-SMP boards. |
839 | * Original code written by Keir Fraser. | 1035 | * Original code written by Keir Fraser. |
@@ -873,7 +1069,7 @@ void __init early_init_lapic_mapping(void) | |||
873 | * Fetch the APIC ID of the BSP in case we have a | 1069 | * Fetch the APIC ID of the BSP in case we have a |
874 | * default configuration (or the MP table is broken). | 1070 | * default configuration (or the MP table is broken). |
875 | */ | 1071 | */ |
876 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1072 | boot_cpu_physical_apicid = read_apic_id(); |
877 | } | 1073 | } |
878 | 1074 | ||
879 | /** | 1075 | /** |
@@ -881,6 +1077,11 @@ void __init early_init_lapic_mapping(void) | |||
881 | */ | 1077 | */ |
882 | void __init init_apic_mappings(void) | 1078 | void __init init_apic_mappings(void) |
883 | { | 1079 | { |
1080 | if (x2apic) { | ||
1081 | boot_cpu_physical_apicid = read_apic_id(); | ||
1082 | return; | ||
1083 | } | ||
1084 | |||
884 | /* | 1085 | /* |
885 | * If no local APIC can be found then set up a fake all | 1086 | * If no local APIC can be found then set up a fake all |
886 | * zeroes page to simulate the local APIC and another | 1087 | * zeroes page to simulate the local APIC and another |
@@ -900,7 +1101,7 @@ void __init init_apic_mappings(void) | |||
900 | * Fetch the APIC ID of the BSP in case we have a | 1101 | * Fetch the APIC ID of the BSP in case we have a |
901 | * default configuration (or the MP table is broken). | 1102 | * default configuration (or the MP table is broken). |
902 | */ | 1103 | */ |
903 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1104 | boot_cpu_physical_apicid = read_apic_id(); |
904 | } | 1105 | } |
905 | 1106 | ||
906 | /* | 1107 | /* |
@@ -919,6 +1120,9 @@ int __init APIC_init_uniprocessor(void) | |||
919 | return -1; | 1120 | return -1; |
920 | } | 1121 | } |
921 | 1122 | ||
1123 | enable_IR_x2apic(); | ||
1124 | setup_apic_routing(); | ||
1125 | |||
922 | verify_local_APIC(); | 1126 | verify_local_APIC(); |
923 | 1127 | ||
924 | connect_bsp_APIC(); | 1128 | connect_bsp_APIC(); |
@@ -1062,12 +1266,6 @@ void __cpuinit generic_processor_info(int apicid, int version) | |||
1062 | return; | 1266 | return; |
1063 | } | 1267 | } |
1064 | 1268 | ||
1065 | if (num_processors >= maxcpus) { | ||
1066 | printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." | ||
1067 | " Processor ignored.\n", maxcpus); | ||
1068 | return; | ||
1069 | } | ||
1070 | |||
1071 | num_processors++; | 1269 | num_processors++; |
1072 | cpus_complement(tmp_map, cpu_present_map); | 1270 | cpus_complement(tmp_map, cpu_present_map); |
1073 | cpu = first_cpu(tmp_map); | 1271 | cpu = first_cpu(tmp_map); |
@@ -1100,6 +1298,11 @@ void __cpuinit generic_processor_info(int apicid, int version) | |||
1100 | cpu_set(cpu, cpu_present_map); | 1298 | cpu_set(cpu, cpu_present_map); |
1101 | } | 1299 | } |
1102 | 1300 | ||
1301 | int hard_smp_processor_id(void) | ||
1302 | { | ||
1303 | return read_apic_id(); | ||
1304 | } | ||
1305 | |||
1103 | /* | 1306 | /* |
1104 | * Power management | 1307 | * Power management |
1105 | */ | 1308 | */ |
@@ -1136,7 +1339,7 @@ static int lapic_suspend(struct sys_device *dev, pm_message_t state) | |||
1136 | 1339 | ||
1137 | maxlvt = lapic_get_maxlvt(); | 1340 | maxlvt = lapic_get_maxlvt(); |
1138 | 1341 | ||
1139 | apic_pm_state.apic_id = read_apic_id(); | 1342 | apic_pm_state.apic_id = apic_read(APIC_ID); |
1140 | apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI); | 1343 | apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI); |
1141 | apic_pm_state.apic_ldr = apic_read(APIC_LDR); | 1344 | apic_pm_state.apic_ldr = apic_read(APIC_LDR); |
1142 | apic_pm_state.apic_dfr = apic_read(APIC_DFR); | 1345 | apic_pm_state.apic_dfr = apic_read(APIC_DFR); |
@@ -1171,10 +1374,14 @@ static int lapic_resume(struct sys_device *dev) | |||
1171 | maxlvt = lapic_get_maxlvt(); | 1374 | maxlvt = lapic_get_maxlvt(); |
1172 | 1375 | ||
1173 | local_irq_save(flags); | 1376 | local_irq_save(flags); |
1174 | rdmsr(MSR_IA32_APICBASE, l, h); | 1377 | if (!x2apic) { |
1175 | l &= ~MSR_IA32_APICBASE_BASE; | 1378 | rdmsr(MSR_IA32_APICBASE, l, h); |
1176 | l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; | 1379 | l &= ~MSR_IA32_APICBASE_BASE; |
1177 | wrmsr(MSR_IA32_APICBASE, l, h); | 1380 | l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; |
1381 | wrmsr(MSR_IA32_APICBASE, l, h); | ||
1382 | } else | ||
1383 | enable_x2apic(); | ||
1384 | |||
1178 | apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); | 1385 | apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); |
1179 | apic_write(APIC_ID, apic_pm_state.apic_id); | 1386 | apic_write(APIC_ID, apic_pm_state.apic_id); |
1180 | apic_write(APIC_DFR, apic_pm_state.apic_dfr); | 1387 | apic_write(APIC_DFR, apic_pm_state.apic_dfr); |
@@ -1314,6 +1521,15 @@ __cpuinit int apic_is_clustered_box(void) | |||
1314 | return (clusters > 2); | 1521 | return (clusters > 2); |
1315 | } | 1522 | } |
1316 | 1523 | ||
1524 | static __init int setup_nox2apic(char *str) | ||
1525 | { | ||
1526 | disable_x2apic = 1; | ||
1527 | clear_cpu_cap(&boot_cpu_data, X86_FEATURE_X2APIC); | ||
1528 | return 0; | ||
1529 | } | ||
1530 | early_param("nox2apic", setup_nox2apic); | ||
1531 | |||
1532 | |||
1317 | /* | 1533 | /* |
1318 | * APIC command line parameters | 1534 | * APIC command line parameters |
1319 | */ | 1535 | */ |
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c index aa89387006fe..505543a75a56 100644 --- a/arch/x86/kernel/asm-offsets_64.c +++ b/arch/x86/kernel/asm-offsets_64.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #define __NO_STUBS 1 | 23 | #define __NO_STUBS 1 |
24 | #undef __SYSCALL | 24 | #undef __SYSCALL |
25 | #undef _ASM_X86_64_UNISTD_H_ | 25 | #undef ASM_X86__UNISTD_64_H |
26 | #define __SYSCALL(nr, sym) [nr] = 1, | 26 | #define __SYSCALL(nr, sym) [nr] = 1, |
27 | static char syscalls[] = { | 27 | static char syscalls[] = { |
28 | #include <asm/unistd.h> | 28 | #include <asm/unistd.h> |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index ee76eaad3001..510d1bcb058a 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -3,22 +3,31 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := intel_cacheinfo.o addon_cpuid_features.o | 5 | obj-y := intel_cacheinfo.o addon_cpuid_features.o |
6 | obj-y += proc.o feature_names.o | 6 | obj-y += proc.o capflags.o powerflags.o common.o |
7 | 7 | ||
8 | obj-$(CONFIG_X86_32) += common.o bugs.o | 8 | obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o |
9 | obj-$(CONFIG_X86_64) += common_64.o bugs_64.o | 9 | obj-$(CONFIG_X86_64) += bugs_64.o |
10 | obj-$(CONFIG_X86_32) += amd.o | 10 | |
11 | obj-$(CONFIG_X86_64) += amd_64.o | 11 | obj-$(CONFIG_CPU_SUP_INTEL_32) += intel.o |
12 | obj-$(CONFIG_X86_32) += cyrix.o | 12 | obj-$(CONFIG_CPU_SUP_INTEL_64) += intel_64.o |
13 | obj-$(CONFIG_X86_32) += centaur.o | 13 | obj-$(CONFIG_CPU_SUP_AMD) += amd.o |
14 | obj-$(CONFIG_X86_64) += centaur_64.o | 14 | obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix.o |
15 | obj-$(CONFIG_X86_32) += transmeta.o | 15 | obj-$(CONFIG_CPU_SUP_CENTAUR_32) += centaur.o |
16 | obj-$(CONFIG_X86_32) += intel.o | 16 | obj-$(CONFIG_CPU_SUP_CENTAUR_64) += centaur_64.o |
17 | obj-$(CONFIG_X86_64) += intel_64.o | 17 | obj-$(CONFIG_CPU_SUP_TRANSMETA_32) += transmeta.o |
18 | obj-$(CONFIG_X86_32) += umc.o | 18 | obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o |
19 | 19 | ||
20 | obj-$(CONFIG_X86_MCE) += mcheck/ | 20 | obj-$(CONFIG_X86_MCE) += mcheck/ |
21 | obj-$(CONFIG_MTRR) += mtrr/ | 21 | obj-$(CONFIG_MTRR) += mtrr/ |
22 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ | 22 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ |
23 | 23 | ||
24 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o | 24 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o |
25 | |||
26 | quiet_cmd_mkcapflags = MKCAP $@ | ||
27 | cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ | ||
28 | |||
29 | cpufeature = $(src)/../../../../include/asm-x86/cpufeature.h | ||
30 | |||
31 | targets += capflags.c | ||
32 | $(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.pl FORCE | ||
33 | $(call if_changed,mkcapflags) | ||
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index 84a8220a6072..0d9c993aa93e 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
@@ -7,6 +7,8 @@ | |||
7 | #include <asm/pat.h> | 7 | #include <asm/pat.h> |
8 | #include <asm/processor.h> | 8 | #include <asm/processor.h> |
9 | 9 | ||
10 | #include <mach_apic.h> | ||
11 | |||
10 | struct cpuid_bit { | 12 | struct cpuid_bit { |
11 | u16 feature; | 13 | u16 feature; |
12 | u8 reg; | 14 | u8 reg; |
@@ -48,6 +50,92 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
48 | } | 50 | } |
49 | } | 51 | } |
50 | 52 | ||
53 | /* leaf 0xb SMT level */ | ||
54 | #define SMT_LEVEL 0 | ||
55 | |||
56 | /* leaf 0xb sub-leaf types */ | ||
57 | #define INVALID_TYPE 0 | ||
58 | #define SMT_TYPE 1 | ||
59 | #define CORE_TYPE 2 | ||
60 | |||
61 | #define LEAFB_SUBTYPE(ecx) (((ecx) >> 8) & 0xff) | ||
62 | #define BITS_SHIFT_NEXT_LEVEL(eax) ((eax) & 0x1f) | ||
63 | #define LEVEL_MAX_SIBLINGS(ebx) ((ebx) & 0xffff) | ||
64 | |||
65 | /* | ||
66 | * Check for extended topology enumeration cpuid leaf 0xb and if it | ||
67 | * exists, use it for populating initial_apicid and cpu topology | ||
68 | * detection. | ||
69 | */ | ||
70 | void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) | ||
71 | { | ||
72 | #ifdef CONFIG_SMP | ||
73 | unsigned int eax, ebx, ecx, edx, sub_index; | ||
74 | unsigned int ht_mask_width, core_plus_mask_width; | ||
75 | unsigned int core_select_mask, core_level_siblings; | ||
76 | |||
77 | if (c->cpuid_level < 0xb) | ||
78 | return; | ||
79 | |||
80 | cpuid_count(0xb, SMT_LEVEL, &eax, &ebx, &ecx, &edx); | ||
81 | |||
82 | /* | ||
83 | * check if the cpuid leaf 0xb is actually implemented. | ||
84 | */ | ||
85 | if (ebx == 0 || (LEAFB_SUBTYPE(ecx) != SMT_TYPE)) | ||
86 | return; | ||
87 | |||
88 | set_cpu_cap(c, X86_FEATURE_XTOPOLOGY); | ||
89 | |||
90 | /* | ||
91 | * initial apic id, which also represents 32-bit extended x2apic id. | ||
92 | */ | ||
93 | c->initial_apicid = edx; | ||
94 | |||
95 | /* | ||
96 | * Populate HT related information from sub-leaf level 0. | ||
97 | */ | ||
98 | core_level_siblings = smp_num_siblings = LEVEL_MAX_SIBLINGS(ebx); | ||
99 | core_plus_mask_width = ht_mask_width = BITS_SHIFT_NEXT_LEVEL(eax); | ||
100 | |||
101 | sub_index = 1; | ||
102 | do { | ||
103 | cpuid_count(0xb, sub_index, &eax, &ebx, &ecx, &edx); | ||
104 | |||
105 | /* | ||
106 | * Check for the Core type in the implemented sub leaves. | ||
107 | */ | ||
108 | if (LEAFB_SUBTYPE(ecx) == CORE_TYPE) { | ||
109 | core_level_siblings = LEVEL_MAX_SIBLINGS(ebx); | ||
110 | core_plus_mask_width = BITS_SHIFT_NEXT_LEVEL(eax); | ||
111 | break; | ||
112 | } | ||
113 | |||
114 | sub_index++; | ||
115 | } while (LEAFB_SUBTYPE(ecx) != INVALID_TYPE); | ||
116 | |||
117 | core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width; | ||
118 | |||
119 | #ifdef CONFIG_X86_32 | ||
120 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width) | ||
121 | & core_select_mask; | ||
122 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width); | ||
123 | #else | ||
124 | c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask; | ||
125 | c->phys_proc_id = phys_pkg_id(core_plus_mask_width); | ||
126 | #endif | ||
127 | c->x86_max_cores = (core_level_siblings / smp_num_siblings); | ||
128 | |||
129 | |||
130 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | ||
131 | c->phys_proc_id); | ||
132 | if (c->x86_max_cores > 1) | ||
133 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | ||
134 | c->cpu_core_id); | ||
135 | return; | ||
136 | #endif | ||
137 | } | ||
138 | |||
51 | #ifdef CONFIG_X86_PAT | 139 | #ifdef CONFIG_X86_PAT |
52 | void __cpuinit validate_pat_support(struct cpuinfo_x86 *c) | 140 | void __cpuinit validate_pat_support(struct cpuinfo_x86 *c) |
53 | { | 141 | { |
@@ -56,9 +144,22 @@ void __cpuinit validate_pat_support(struct cpuinfo_x86 *c) | |||
56 | 144 | ||
57 | switch (c->x86_vendor) { | 145 | switch (c->x86_vendor) { |
58 | case X86_VENDOR_INTEL: | 146 | case X86_VENDOR_INTEL: |
59 | if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15)) | 147 | /* |
148 | * There is a known erratum on Pentium III and Core Solo | ||
149 | * and Core Duo CPUs. | ||
150 | * " Page with PAT set to WC while associated MTRR is UC | ||
151 | * may consolidate to UC " | ||
152 | * Because of this erratum, it is better to stick with | ||
153 | * setting WC in MTRR rather than using PAT on these CPUs. | ||
154 | * | ||
155 | * Enable PAT WC only on P4, Core 2 or later CPUs. | ||
156 | */ | ||
157 | if (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 15)) | ||
60 | return; | 158 | return; |
61 | break; | 159 | |
160 | pat_disable("PAT WC disabled due to known CPU erratum."); | ||
161 | return; | ||
162 | |||
62 | case X86_VENDOR_AMD: | 163 | case X86_VENDOR_AMD: |
63 | case X86_VENDOR_CENTAUR: | 164 | case X86_VENDOR_CENTAUR: |
64 | case X86_VENDOR_TRANSMETA: | 165 | case X86_VENDOR_TRANSMETA: |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index cae9cabc3031..32e73520adf7 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -1,13 +1,22 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/bitops.h> | 2 | #include <linux/bitops.h> |
3 | #include <linux/mm.h> | 3 | #include <linux/mm.h> |
4 | |||
4 | #include <asm/io.h> | 5 | #include <asm/io.h> |
5 | #include <asm/processor.h> | 6 | #include <asm/processor.h> |
6 | #include <asm/apic.h> | 7 | #include <asm/apic.h> |
7 | 8 | ||
9 | #ifdef CONFIG_X86_64 | ||
10 | # include <asm/numa_64.h> | ||
11 | # include <asm/mmconfig.h> | ||
12 | # include <asm/cacheflush.h> | ||
13 | #endif | ||
14 | |||
8 | #include <mach_apic.h> | 15 | #include <mach_apic.h> |
16 | |||
9 | #include "cpu.h" | 17 | #include "cpu.h" |
10 | 18 | ||
19 | #ifdef CONFIG_X86_32 | ||
11 | /* | 20 | /* |
12 | * B step AMD K6 before B 9730xxxx have hardware bugs that can cause | 21 | * B step AMD K6 before B 9730xxxx have hardware bugs that can cause |
13 | * misexecution of code under Linux. Owners of such processors should | 22 | * misexecution of code under Linux. Owners of such processors should |
@@ -24,21 +33,273 @@ | |||
24 | extern void vide(void); | 33 | extern void vide(void); |
25 | __asm__(".align 4\nvide: ret"); | 34 | __asm__(".align 4\nvide: ret"); |
26 | 35 | ||
27 | static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) | 36 | static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c) |
28 | { | 37 | { |
29 | if (cpuid_eax(0x80000000) >= 0x80000007) { | 38 | /* |
30 | c->x86_power = cpuid_edx(0x80000007); | 39 | * General Systems BIOSen alias the cpu frequency registers |
31 | if (c->x86_power & (1<<8)) | 40 | * of the Elan at 0x000df000. Unfortuantly, one of the Linux |
32 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); | 41 | * drivers subsequently pokes it, and changes the CPU speed. |
42 | * Workaround : Remove the unneeded alias. | ||
43 | */ | ||
44 | #define CBAR (0xfffc) /* Configuration Base Address (32-bit) */ | ||
45 | #define CBAR_ENB (0x80000000) | ||
46 | #define CBAR_KEY (0X000000CB) | ||
47 | if (c->x86_model == 9 || c->x86_model == 10) { | ||
48 | if (inl (CBAR) & CBAR_ENB) | ||
49 | outl (0 | CBAR_KEY, CBAR); | ||
33 | } | 50 | } |
34 | } | 51 | } |
35 | 52 | ||
36 | static void __cpuinit init_amd(struct cpuinfo_x86 *c) | 53 | |
54 | static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) | ||
37 | { | 55 | { |
38 | u32 l, h; | 56 | u32 l, h; |
39 | int mbytes = num_physpages >> (20-PAGE_SHIFT); | 57 | int mbytes = num_physpages >> (20-PAGE_SHIFT); |
40 | int r; | ||
41 | 58 | ||
59 | if (c->x86_model < 6) { | ||
60 | /* Based on AMD doc 20734R - June 2000 */ | ||
61 | if (c->x86_model == 0) { | ||
62 | clear_cpu_cap(c, X86_FEATURE_APIC); | ||
63 | set_cpu_cap(c, X86_FEATURE_PGE); | ||
64 | } | ||
65 | return; | ||
66 | } | ||
67 | |||
68 | if (c->x86_model == 6 && c->x86_mask == 1) { | ||
69 | const int K6_BUG_LOOP = 1000000; | ||
70 | int n; | ||
71 | void (*f_vide)(void); | ||
72 | unsigned long d, d2; | ||
73 | |||
74 | printk(KERN_INFO "AMD K6 stepping B detected - "); | ||
75 | |||
76 | /* | ||
77 | * It looks like AMD fixed the 2.6.2 bug and improved indirect | ||
78 | * calls at the same time. | ||
79 | */ | ||
80 | |||
81 | n = K6_BUG_LOOP; | ||
82 | f_vide = vide; | ||
83 | rdtscl(d); | ||
84 | while (n--) | ||
85 | f_vide(); | ||
86 | rdtscl(d2); | ||
87 | d = d2-d; | ||
88 | |||
89 | if (d > 20*K6_BUG_LOOP) | ||
90 | printk("system stability may be impaired when more than 32 MB are used.\n"); | ||
91 | else | ||
92 | printk("probably OK (after B9730xxxx).\n"); | ||
93 | printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n"); | ||
94 | } | ||
95 | |||
96 | /* K6 with old style WHCR */ | ||
97 | if (c->x86_model < 8 || | ||
98 | (c->x86_model == 8 && c->x86_mask < 8)) { | ||
99 | /* We can only write allocate on the low 508Mb */ | ||
100 | if (mbytes > 508) | ||
101 | mbytes = 508; | ||
102 | |||
103 | rdmsr(MSR_K6_WHCR, l, h); | ||
104 | if ((l&0x0000FFFF) == 0) { | ||
105 | unsigned long flags; | ||
106 | l = (1<<0)|((mbytes/4)<<1); | ||
107 | local_irq_save(flags); | ||
108 | wbinvd(); | ||
109 | wrmsr(MSR_K6_WHCR, l, h); | ||
110 | local_irq_restore(flags); | ||
111 | printk(KERN_INFO "Enabling old style K6 write allocation for %d Mb\n", | ||
112 | mbytes); | ||
113 | } | ||
114 | return; | ||
115 | } | ||
116 | |||
117 | if ((c->x86_model == 8 && c->x86_mask > 7) || | ||
118 | c->x86_model == 9 || c->x86_model == 13) { | ||
119 | /* The more serious chips .. */ | ||
120 | |||
121 | if (mbytes > 4092) | ||
122 | mbytes = 4092; | ||
123 | |||
124 | rdmsr(MSR_K6_WHCR, l, h); | ||
125 | if ((l&0xFFFF0000) == 0) { | ||
126 | unsigned long flags; | ||
127 | l = ((mbytes>>2)<<22)|(1<<16); | ||
128 | local_irq_save(flags); | ||
129 | wbinvd(); | ||
130 | wrmsr(MSR_K6_WHCR, l, h); | ||
131 | local_irq_restore(flags); | ||
132 | printk(KERN_INFO "Enabling new style K6 write allocation for %d Mb\n", | ||
133 | mbytes); | ||
134 | } | ||
135 | |||
136 | return; | ||
137 | } | ||
138 | |||
139 | if (c->x86_model == 10) { | ||
140 | /* AMD Geode LX is model 10 */ | ||
141 | /* placeholder for any needed mods */ | ||
142 | return; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) | ||
147 | { | ||
148 | u32 l, h; | ||
149 | |||
150 | /* | ||
151 | * Bit 15 of Athlon specific MSR 15, needs to be 0 | ||
152 | * to enable SSE on Palomino/Morgan/Barton CPU's. | ||
153 | * If the BIOS didn't enable it already, enable it here. | ||
154 | */ | ||
155 | if (c->x86_model >= 6 && c->x86_model <= 10) { | ||
156 | if (!cpu_has(c, X86_FEATURE_XMM)) { | ||
157 | printk(KERN_INFO "Enabling disabled K7/SSE Support.\n"); | ||
158 | rdmsr(MSR_K7_HWCR, l, h); | ||
159 | l &= ~0x00008000; | ||
160 | wrmsr(MSR_K7_HWCR, l, h); | ||
161 | set_cpu_cap(c, X86_FEATURE_XMM); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | /* | ||
166 | * It's been determined by AMD that Athlons since model 8 stepping 1 | ||
167 | * are more robust with CLK_CTL set to 200xxxxx instead of 600xxxxx | ||
168 | * As per AMD technical note 27212 0.2 | ||
169 | */ | ||
170 | if ((c->x86_model == 8 && c->x86_mask >= 1) || (c->x86_model > 8)) { | ||
171 | rdmsr(MSR_K7_CLK_CTL, l, h); | ||
172 | if ((l & 0xfff00000) != 0x20000000) { | ||
173 | printk ("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", l, | ||
174 | ((l & 0x000fffff)|0x20000000)); | ||
175 | wrmsr(MSR_K7_CLK_CTL, (l & 0x000fffff)|0x20000000, h); | ||
176 | } | ||
177 | } | ||
178 | |||
179 | set_cpu_cap(c, X86_FEATURE_K7); | ||
180 | } | ||
181 | #endif | ||
182 | |||
183 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) | ||
184 | static int __cpuinit nearby_node(int apicid) | ||
185 | { | ||
186 | int i, node; | ||
187 | |||
188 | for (i = apicid - 1; i >= 0; i--) { | ||
189 | node = apicid_to_node[i]; | ||
190 | if (node != NUMA_NO_NODE && node_online(node)) | ||
191 | return node; | ||
192 | } | ||
193 | for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) { | ||
194 | node = apicid_to_node[i]; | ||
195 | if (node != NUMA_NO_NODE && node_online(node)) | ||
196 | return node; | ||
197 | } | ||
198 | return first_node(node_online_map); /* Shouldn't happen */ | ||
199 | } | ||
200 | #endif | ||
201 | |||
202 | /* | ||
203 | * On a AMD dual core setup the lower bits of the APIC id distingush the cores. | ||
204 | * Assumes number of cores is a power of two. | ||
205 | */ | ||
206 | static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c) | ||
207 | { | ||
208 | #ifdef CONFIG_X86_HT | ||
209 | unsigned bits; | ||
210 | |||
211 | bits = c->x86_coreid_bits; | ||
212 | |||
213 | /* Low order bits define the core id (index of core in socket) */ | ||
214 | c->cpu_core_id = c->initial_apicid & ((1 << bits)-1); | ||
215 | /* Convert the initial APIC ID into the socket ID */ | ||
216 | c->phys_proc_id = c->initial_apicid >> bits; | ||
217 | #endif | ||
218 | } | ||
219 | |||
220 | static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c) | ||
221 | { | ||
222 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) | ||
223 | int cpu = smp_processor_id(); | ||
224 | int node; | ||
225 | unsigned apicid = hard_smp_processor_id(); | ||
226 | |||
227 | node = c->phys_proc_id; | ||
228 | if (apicid_to_node[apicid] != NUMA_NO_NODE) | ||
229 | node = apicid_to_node[apicid]; | ||
230 | if (!node_online(node)) { | ||
231 | /* Two possibilities here: | ||
232 | - The CPU is missing memory and no node was created. | ||
233 | In that case try picking one from a nearby CPU | ||
234 | - The APIC IDs differ from the HyperTransport node IDs | ||
235 | which the K8 northbridge parsing fills in. | ||
236 | Assume they are all increased by a constant offset, | ||
237 | but in the same order as the HT nodeids. | ||
238 | If that doesn't result in a usable node fall back to the | ||
239 | path for the previous case. */ | ||
240 | |||
241 | int ht_nodeid = c->initial_apicid; | ||
242 | |||
243 | if (ht_nodeid >= 0 && | ||
244 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | ||
245 | node = apicid_to_node[ht_nodeid]; | ||
246 | /* Pick a nearby node */ | ||
247 | if (!node_online(node)) | ||
248 | node = nearby_node(apicid); | ||
249 | } | ||
250 | numa_set_node(cpu, node); | ||
251 | |||
252 | printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node); | ||
253 | #endif | ||
254 | } | ||
255 | |||
256 | static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c) | ||
257 | { | ||
258 | #ifdef CONFIG_X86_HT | ||
259 | unsigned bits, ecx; | ||
260 | |||
261 | /* Multi core CPU? */ | ||
262 | if (c->extended_cpuid_level < 0x80000008) | ||
263 | return; | ||
264 | |||
265 | ecx = cpuid_ecx(0x80000008); | ||
266 | |||
267 | c->x86_max_cores = (ecx & 0xff) + 1; | ||
268 | |||
269 | /* CPU telling us the core id bits shift? */ | ||
270 | bits = (ecx >> 12) & 0xF; | ||
271 | |||
272 | /* Otherwise recompute */ | ||
273 | if (bits == 0) { | ||
274 | while ((1 << bits) < c->x86_max_cores) | ||
275 | bits++; | ||
276 | } | ||
277 | |||
278 | c->x86_coreid_bits = bits; | ||
279 | #endif | ||
280 | } | ||
281 | |||
282 | static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) | ||
283 | { | ||
284 | early_init_amd_mc(c); | ||
285 | |||
286 | /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */ | ||
287 | if (c->x86_power & (1<<8)) | ||
288 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); | ||
289 | |||
290 | #ifdef CONFIG_X86_64 | ||
291 | set_cpu_cap(c, X86_FEATURE_SYSCALL32); | ||
292 | #else | ||
293 | /* Set MTRR capability flag if appropriate */ | ||
294 | if (c->x86 == 5) | ||
295 | if (c->x86_model == 13 || c->x86_model == 9 || | ||
296 | (c->x86_model == 8 && c->x86_mask >= 8)) | ||
297 | set_cpu_cap(c, X86_FEATURE_K6_MTRR); | ||
298 | #endif | ||
299 | } | ||
300 | |||
301 | static void __cpuinit init_amd(struct cpuinfo_x86 *c) | ||
302 | { | ||
42 | #ifdef CONFIG_SMP | 303 | #ifdef CONFIG_SMP |
43 | unsigned long long value; | 304 | unsigned long long value; |
44 | 305 | ||
@@ -49,7 +310,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
49 | * Errata 63 for SH-B3 steppings | 310 | * Errata 63 for SH-B3 steppings |
50 | * Errata 122 for all steppings (F+ have it disabled by default) | 311 | * Errata 122 for all steppings (F+ have it disabled by default) |
51 | */ | 312 | */ |
52 | if (c->x86 == 15) { | 313 | if (c->x86 == 0xf) { |
53 | rdmsrl(MSR_K7_HWCR, value); | 314 | rdmsrl(MSR_K7_HWCR, value); |
54 | value |= 1 << 6; | 315 | value |= 1 << 6; |
55 | wrmsrl(MSR_K7_HWCR, value); | 316 | wrmsrl(MSR_K7_HWCR, value); |
@@ -59,213 +320,119 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
59 | early_init_amd(c); | 320 | early_init_amd(c); |
60 | 321 | ||
61 | /* | 322 | /* |
62 | * FIXME: We should handle the K5 here. Set up the write | ||
63 | * range and also turn on MSR 83 bits 4 and 31 (write alloc, | ||
64 | * no bus pipeline) | ||
65 | */ | ||
66 | |||
67 | /* | ||
68 | * Bit 31 in normal CPUID used for nonstandard 3DNow ID; | 323 | * Bit 31 in normal CPUID used for nonstandard 3DNow ID; |
69 | * 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway | 324 | * 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway |
70 | */ | 325 | */ |
71 | clear_cpu_cap(c, 0*32+31); | 326 | clear_cpu_cap(c, 0*32+31); |
72 | 327 | ||
73 | r = get_model_name(c); | 328 | #ifdef CONFIG_X86_64 |
329 | /* On C+ stepping K8 rep microcode works well for copy/memset */ | ||
330 | if (c->x86 == 0xf) { | ||
331 | u32 level; | ||
74 | 332 | ||
75 | switch (c->x86) { | 333 | level = cpuid_eax(1); |
76 | case 4: | 334 | if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58) |
77 | /* | 335 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); |
78 | * General Systems BIOSen alias the cpu frequency registers | ||
79 | * of the Elan at 0x000df000. Unfortuantly, one of the Linux | ||
80 | * drivers subsequently pokes it, and changes the CPU speed. | ||
81 | * Workaround : Remove the unneeded alias. | ||
82 | */ | ||
83 | #define CBAR (0xfffc) /* Configuration Base Address (32-bit) */ | ||
84 | #define CBAR_ENB (0x80000000) | ||
85 | #define CBAR_KEY (0X000000CB) | ||
86 | if (c->x86_model == 9 || c->x86_model == 10) { | ||
87 | if (inl (CBAR) & CBAR_ENB) | ||
88 | outl (0 | CBAR_KEY, CBAR); | ||
89 | } | ||
90 | break; | ||
91 | case 5: | ||
92 | if (c->x86_model < 6) { | ||
93 | /* Based on AMD doc 20734R - June 2000 */ | ||
94 | if (c->x86_model == 0) { | ||
95 | clear_cpu_cap(c, X86_FEATURE_APIC); | ||
96 | set_cpu_cap(c, X86_FEATURE_PGE); | ||
97 | } | ||
98 | break; | ||
99 | } | ||
100 | |||
101 | if (c->x86_model == 6 && c->x86_mask == 1) { | ||
102 | const int K6_BUG_LOOP = 1000000; | ||
103 | int n; | ||
104 | void (*f_vide)(void); | ||
105 | unsigned long d, d2; | ||
106 | |||
107 | printk(KERN_INFO "AMD K6 stepping B detected - "); | ||
108 | |||
109 | /* | ||
110 | * It looks like AMD fixed the 2.6.2 bug and improved indirect | ||
111 | * calls at the same time. | ||
112 | */ | ||
113 | |||
114 | n = K6_BUG_LOOP; | ||
115 | f_vide = vide; | ||
116 | rdtscl(d); | ||
117 | while (n--) | ||
118 | f_vide(); | ||
119 | rdtscl(d2); | ||
120 | d = d2-d; | ||
121 | |||
122 | if (d > 20*K6_BUG_LOOP) | ||
123 | printk("system stability may be impaired when more than 32 MB are used.\n"); | ||
124 | else | ||
125 | printk("probably OK (after B9730xxxx).\n"); | ||
126 | printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n"); | ||
127 | } | ||
128 | |||
129 | /* K6 with old style WHCR */ | ||
130 | if (c->x86_model < 8 || | ||
131 | (c->x86_model == 8 && c->x86_mask < 8)) { | ||
132 | /* We can only write allocate on the low 508Mb */ | ||
133 | if (mbytes > 508) | ||
134 | mbytes = 508; | ||
135 | |||
136 | rdmsr(MSR_K6_WHCR, l, h); | ||
137 | if ((l&0x0000FFFF) == 0) { | ||
138 | unsigned long flags; | ||
139 | l = (1<<0)|((mbytes/4)<<1); | ||
140 | local_irq_save(flags); | ||
141 | wbinvd(); | ||
142 | wrmsr(MSR_K6_WHCR, l, h); | ||
143 | local_irq_restore(flags); | ||
144 | printk(KERN_INFO "Enabling old style K6 write allocation for %d Mb\n", | ||
145 | mbytes); | ||
146 | } | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | if ((c->x86_model == 8 && c->x86_mask > 7) || | ||
151 | c->x86_model == 9 || c->x86_model == 13) { | ||
152 | /* The more serious chips .. */ | ||
153 | |||
154 | if (mbytes > 4092) | ||
155 | mbytes = 4092; | ||
156 | |||
157 | rdmsr(MSR_K6_WHCR, l, h); | ||
158 | if ((l&0xFFFF0000) == 0) { | ||
159 | unsigned long flags; | ||
160 | l = ((mbytes>>2)<<22)|(1<<16); | ||
161 | local_irq_save(flags); | ||
162 | wbinvd(); | ||
163 | wrmsr(MSR_K6_WHCR, l, h); | ||
164 | local_irq_restore(flags); | ||
165 | printk(KERN_INFO "Enabling new style K6 write allocation for %d Mb\n", | ||
166 | mbytes); | ||
167 | } | ||
168 | |||
169 | /* Set MTRR capability flag if appropriate */ | ||
170 | if (c->x86_model == 13 || c->x86_model == 9 || | ||
171 | (c->x86_model == 8 && c->x86_mask >= 8)) | ||
172 | set_cpu_cap(c, X86_FEATURE_K6_MTRR); | ||
173 | break; | ||
174 | } | ||
175 | |||
176 | if (c->x86_model == 10) { | ||
177 | /* AMD Geode LX is model 10 */ | ||
178 | /* placeholder for any needed mods */ | ||
179 | break; | ||
180 | } | ||
181 | break; | ||
182 | case 6: /* An Athlon/Duron */ | ||
183 | |||
184 | /* | ||
185 | * Bit 15 of Athlon specific MSR 15, needs to be 0 | ||
186 | * to enable SSE on Palomino/Morgan/Barton CPU's. | ||
187 | * If the BIOS didn't enable it already, enable it here. | ||
188 | */ | ||
189 | if (c->x86_model >= 6 && c->x86_model <= 10) { | ||
190 | if (!cpu_has(c, X86_FEATURE_XMM)) { | ||
191 | printk(KERN_INFO "Enabling disabled K7/SSE Support.\n"); | ||
192 | rdmsr(MSR_K7_HWCR, l, h); | ||
193 | l &= ~0x00008000; | ||
194 | wrmsr(MSR_K7_HWCR, l, h); | ||
195 | set_cpu_cap(c, X86_FEATURE_XMM); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * It's been determined by AMD that Athlons since model 8 stepping 1 | ||
201 | * are more robust with CLK_CTL set to 200xxxxx instead of 600xxxxx | ||
202 | * As per AMD technical note 27212 0.2 | ||
203 | */ | ||
204 | if ((c->x86_model == 8 && c->x86_mask >= 1) || (c->x86_model > 8)) { | ||
205 | rdmsr(MSR_K7_CLK_CTL, l, h); | ||
206 | if ((l & 0xfff00000) != 0x20000000) { | ||
207 | printk ("CPU: CLK_CTL MSR was %x. Reprogramming to %x\n", l, | ||
208 | ((l & 0x000fffff)|0x20000000)); | ||
209 | wrmsr(MSR_K7_CLK_CTL, (l & 0x000fffff)|0x20000000, h); | ||
210 | } | ||
211 | } | ||
212 | break; | ||
213 | } | 336 | } |
337 | if (c->x86 == 0x10 || c->x86 == 0x11) | ||
338 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | ||
339 | #else | ||
340 | |||
341 | /* | ||
342 | * FIXME: We should handle the K5 here. Set up the write | ||
343 | * range and also turn on MSR 83 bits 4 and 31 (write alloc, | ||
344 | * no bus pipeline) | ||
345 | */ | ||
214 | 346 | ||
215 | switch (c->x86) { | 347 | switch (c->x86) { |
216 | case 15: | 348 | case 4: |
217 | /* Use K8 tuning for Fam10h and Fam11h */ | 349 | init_amd_k5(c); |
218 | case 0x10: | ||
219 | case 0x11: | ||
220 | set_cpu_cap(c, X86_FEATURE_K8); | ||
221 | break; | 350 | break; |
222 | case 6: | 351 | case 5: |
223 | set_cpu_cap(c, X86_FEATURE_K7); | 352 | init_amd_k6(c); |
353 | break; | ||
354 | case 6: /* An Athlon/Duron */ | ||
355 | init_amd_k7(c); | ||
224 | break; | 356 | break; |
225 | } | 357 | } |
358 | |||
359 | /* K6s reports MCEs but don't actually have all the MSRs */ | ||
360 | if (c->x86 < 6) | ||
361 | clear_cpu_cap(c, X86_FEATURE_MCE); | ||
362 | #endif | ||
363 | |||
364 | /* Enable workaround for FXSAVE leak */ | ||
226 | if (c->x86 >= 6) | 365 | if (c->x86 >= 6) |
227 | set_cpu_cap(c, X86_FEATURE_FXSAVE_LEAK); | 366 | set_cpu_cap(c, X86_FEATURE_FXSAVE_LEAK); |
228 | 367 | ||
229 | display_cacheinfo(c); | 368 | if (!c->x86_model_id[0]) { |
230 | 369 | switch (c->x86) { | |
231 | if (cpuid_eax(0x80000000) >= 0x80000008) | 370 | case 0xf: |
232 | c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; | 371 | /* Should distinguish Models here, but this is only |
372 | a fallback anyways. */ | ||
373 | strcpy(c->x86_model_id, "Hammer"); | ||
374 | break; | ||
375 | } | ||
376 | } | ||
233 | 377 | ||
234 | #ifdef CONFIG_X86_HT | 378 | display_cacheinfo(c); |
235 | /* | ||
236 | * On a AMD multi core setup the lower bits of the APIC id | ||
237 | * distinguish the cores. | ||
238 | */ | ||
239 | if (c->x86_max_cores > 1) { | ||
240 | int cpu = smp_processor_id(); | ||
241 | unsigned bits = (cpuid_ecx(0x80000008) >> 12) & 0xf; | ||
242 | 379 | ||
243 | if (bits == 0) { | 380 | /* Multi core CPU? */ |
244 | while ((1 << bits) < c->x86_max_cores) | 381 | if (c->extended_cpuid_level >= 0x80000008) { |
245 | bits++; | 382 | amd_detect_cmp(c); |
246 | } | 383 | srat_detect_node(c); |
247 | c->cpu_core_id = c->phys_proc_id & ((1<<bits)-1); | ||
248 | c->phys_proc_id >>= bits; | ||
249 | printk(KERN_INFO "CPU %d(%d) -> Core %d\n", | ||
250 | cpu, c->x86_max_cores, c->cpu_core_id); | ||
251 | } | 384 | } |
385 | |||
386 | #ifdef CONFIG_X86_32 | ||
387 | detect_ht(c); | ||
252 | #endif | 388 | #endif |
253 | 389 | ||
254 | if (cpuid_eax(0x80000000) >= 0x80000006) { | 390 | if (c->extended_cpuid_level >= 0x80000006) { |
255 | if ((c->x86 == 0x10) && (cpuid_edx(0x80000006) & 0xf000)) | 391 | if ((c->x86 >= 0x0f) && (cpuid_edx(0x80000006) & 0xf000)) |
256 | num_cache_leaves = 4; | 392 | num_cache_leaves = 4; |
257 | else | 393 | else |
258 | num_cache_leaves = 3; | 394 | num_cache_leaves = 3; |
259 | } | 395 | } |
260 | 396 | ||
261 | /* K6s reports MCEs but don't actually have all the MSRs */ | 397 | if (c->x86 >= 0xf && c->x86 <= 0x11) |
262 | if (c->x86 < 6) | 398 | set_cpu_cap(c, X86_FEATURE_K8); |
263 | clear_cpu_cap(c, X86_FEATURE_MCE); | ||
264 | 399 | ||
265 | if (cpu_has_xmm2) | 400 | if (cpu_has_xmm2) { |
401 | /* MFENCE stops RDTSC speculation */ | ||
266 | set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC); | 402 | set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC); |
403 | } | ||
404 | |||
405 | #ifdef CONFIG_X86_64 | ||
406 | if (c->x86 == 0x10) { | ||
407 | /* do this for boot cpu */ | ||
408 | if (c == &boot_cpu_data) | ||
409 | check_enable_amd_mmconf_dmi(); | ||
410 | |||
411 | fam10h_check_enable_mmcfg(); | ||
412 | } | ||
413 | |||
414 | if (c == &boot_cpu_data && c->x86 >= 0xf && c->x86 <= 0x11) { | ||
415 | unsigned long long tseg; | ||
416 | |||
417 | /* | ||
418 | * Split up direct mapping around the TSEG SMM area. | ||
419 | * Don't do it for gbpages because there seems very little | ||
420 | * benefit in doing so. | ||
421 | */ | ||
422 | if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) { | ||
423 | printk(KERN_DEBUG "tseg: %010llx\n", tseg); | ||
424 | if ((tseg>>PMD_SHIFT) < | ||
425 | (max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) || | ||
426 | ((tseg>>PMD_SHIFT) < | ||
427 | (max_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) && | ||
428 | (tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT)))) | ||
429 | set_memory_4k((unsigned long)__va(tseg), 1); | ||
430 | } | ||
431 | } | ||
432 | #endif | ||
267 | } | 433 | } |
268 | 434 | ||
435 | #ifdef CONFIG_X86_32 | ||
269 | static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int size) | 436 | static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int size) |
270 | { | 437 | { |
271 | /* AMD errata T13 (order #21922) */ | 438 | /* AMD errata T13 (order #21922) */ |
@@ -278,10 +445,12 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, unsigned int | |||
278 | } | 445 | } |
279 | return size; | 446 | return size; |
280 | } | 447 | } |
448 | #endif | ||
281 | 449 | ||
282 | static struct cpu_dev amd_cpu_dev __cpuinitdata = { | 450 | static struct cpu_dev amd_cpu_dev __cpuinitdata = { |
283 | .c_vendor = "AMD", | 451 | .c_vendor = "AMD", |
284 | .c_ident = { "AuthenticAMD" }, | 452 | .c_ident = { "AuthenticAMD" }, |
453 | #ifdef CONFIG_X86_32 | ||
285 | .c_models = { | 454 | .c_models = { |
286 | { .vendor = X86_VENDOR_AMD, .family = 4, .model_names = | 455 | { .vendor = X86_VENDOR_AMD, .family = 4, .model_names = |
287 | { | 456 | { |
@@ -294,9 +463,11 @@ static struct cpu_dev amd_cpu_dev __cpuinitdata = { | |||
294 | } | 463 | } |
295 | }, | 464 | }, |
296 | }, | 465 | }, |
466 | .c_size_cache = amd_size_cache, | ||
467 | #endif | ||
297 | .c_early_init = early_init_amd, | 468 | .c_early_init = early_init_amd, |
298 | .c_init = init_amd, | 469 | .c_init = init_amd, |
299 | .c_size_cache = amd_size_cache, | 470 | .c_x86_vendor = X86_VENDOR_AMD, |
300 | }; | 471 | }; |
301 | 472 | ||
302 | cpu_vendor_dev_register(X86_VENDOR_AMD, &amd_cpu_dev); | 473 | cpu_dev_register(amd_cpu_dev); |
diff --git a/arch/x86/kernel/cpu/amd_64.c b/arch/x86/kernel/cpu/amd_64.c deleted file mode 100644 index d1692b2a41ff..000000000000 --- a/arch/x86/kernel/cpu/amd_64.c +++ /dev/null | |||
@@ -1,224 +0,0 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/mm.h> | ||
3 | |||
4 | #include <asm/numa_64.h> | ||
5 | #include <asm/mmconfig.h> | ||
6 | #include <asm/cacheflush.h> | ||
7 | |||
8 | #include <mach_apic.h> | ||
9 | |||
10 | #include "cpu.h" | ||
11 | |||
12 | int force_mwait __cpuinitdata; | ||
13 | |||
14 | #ifdef CONFIG_NUMA | ||
15 | static int __cpuinit nearby_node(int apicid) | ||
16 | { | ||
17 | int i, node; | ||
18 | |||
19 | for (i = apicid - 1; i >= 0; i--) { | ||
20 | node = apicid_to_node[i]; | ||
21 | if (node != NUMA_NO_NODE && node_online(node)) | ||
22 | return node; | ||
23 | } | ||
24 | for (i = apicid + 1; i < MAX_LOCAL_APIC; i++) { | ||
25 | node = apicid_to_node[i]; | ||
26 | if (node != NUMA_NO_NODE && node_online(node)) | ||
27 | return node; | ||
28 | } | ||
29 | return first_node(node_online_map); /* Shouldn't happen */ | ||
30 | } | ||
31 | #endif | ||
32 | |||
33 | /* | ||
34 | * On a AMD dual core setup the lower bits of the APIC id distingush the cores. | ||
35 | * Assumes number of cores is a power of two. | ||
36 | */ | ||
37 | static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c) | ||
38 | { | ||
39 | #ifdef CONFIG_SMP | ||
40 | unsigned bits; | ||
41 | #ifdef CONFIG_NUMA | ||
42 | int cpu = smp_processor_id(); | ||
43 | int node = 0; | ||
44 | unsigned apicid = hard_smp_processor_id(); | ||
45 | #endif | ||
46 | bits = c->x86_coreid_bits; | ||
47 | |||
48 | /* Low order bits define the core id (index of core in socket) */ | ||
49 | c->cpu_core_id = c->initial_apicid & ((1 << bits)-1); | ||
50 | /* Convert the initial APIC ID into the socket ID */ | ||
51 | c->phys_proc_id = c->initial_apicid >> bits; | ||
52 | |||
53 | #ifdef CONFIG_NUMA | ||
54 | node = c->phys_proc_id; | ||
55 | if (apicid_to_node[apicid] != NUMA_NO_NODE) | ||
56 | node = apicid_to_node[apicid]; | ||
57 | if (!node_online(node)) { | ||
58 | /* Two possibilities here: | ||
59 | - The CPU is missing memory and no node was created. | ||
60 | In that case try picking one from a nearby CPU | ||
61 | - The APIC IDs differ from the HyperTransport node IDs | ||
62 | which the K8 northbridge parsing fills in. | ||
63 | Assume they are all increased by a constant offset, | ||
64 | but in the same order as the HT nodeids. | ||
65 | If that doesn't result in a usable node fall back to the | ||
66 | path for the previous case. */ | ||
67 | |||
68 | int ht_nodeid = c->initial_apicid; | ||
69 | |||
70 | if (ht_nodeid >= 0 && | ||
71 | apicid_to_node[ht_nodeid] != NUMA_NO_NODE) | ||
72 | node = apicid_to_node[ht_nodeid]; | ||
73 | /* Pick a nearby node */ | ||
74 | if (!node_online(node)) | ||
75 | node = nearby_node(apicid); | ||
76 | } | ||
77 | numa_set_node(cpu, node); | ||
78 | |||
79 | printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node); | ||
80 | #endif | ||
81 | #endif | ||
82 | } | ||
83 | |||
84 | static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c) | ||
85 | { | ||
86 | #ifdef CONFIG_SMP | ||
87 | unsigned bits, ecx; | ||
88 | |||
89 | /* Multi core CPU? */ | ||
90 | if (c->extended_cpuid_level < 0x80000008) | ||
91 | return; | ||
92 | |||
93 | ecx = cpuid_ecx(0x80000008); | ||
94 | |||
95 | c->x86_max_cores = (ecx & 0xff) + 1; | ||
96 | |||
97 | /* CPU telling us the core id bits shift? */ | ||
98 | bits = (ecx >> 12) & 0xF; | ||
99 | |||
100 | /* Otherwise recompute */ | ||
101 | if (bits == 0) { | ||
102 | while ((1 << bits) < c->x86_max_cores) | ||
103 | bits++; | ||
104 | } | ||
105 | |||
106 | c->x86_coreid_bits = bits; | ||
107 | |||
108 | #endif | ||
109 | } | ||
110 | |||
111 | static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) | ||
112 | { | ||
113 | early_init_amd_mc(c); | ||
114 | |||
115 | /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */ | ||
116 | if (c->x86_power & (1<<8)) | ||
117 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); | ||
118 | |||
119 | set_cpu_cap(c, X86_FEATURE_SYSCALL32); | ||
120 | } | ||
121 | |||
122 | static void __cpuinit init_amd(struct cpuinfo_x86 *c) | ||
123 | { | ||
124 | unsigned level; | ||
125 | |||
126 | #ifdef CONFIG_SMP | ||
127 | unsigned long value; | ||
128 | |||
129 | /* | ||
130 | * Disable TLB flush filter by setting HWCR.FFDIS on K8 | ||
131 | * bit 6 of msr C001_0015 | ||
132 | * | ||
133 | * Errata 63 for SH-B3 steppings | ||
134 | * Errata 122 for all steppings (F+ have it disabled by default) | ||
135 | */ | ||
136 | if (c->x86 == 0xf) { | ||
137 | rdmsrl(MSR_K8_HWCR, value); | ||
138 | value |= 1 << 6; | ||
139 | wrmsrl(MSR_K8_HWCR, value); | ||
140 | } | ||
141 | #endif | ||
142 | |||
143 | /* Bit 31 in normal CPUID used for nonstandard 3DNow ID; | ||
144 | 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */ | ||
145 | clear_cpu_cap(c, 0*32+31); | ||
146 | |||
147 | /* On C+ stepping K8 rep microcode works well for copy/memset */ | ||
148 | if (c->x86 == 0xf) { | ||
149 | level = cpuid_eax(1); | ||
150 | if((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58) | ||
151 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | ||
152 | } | ||
153 | if (c->x86 == 0x10 || c->x86 == 0x11) | ||
154 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | ||
155 | |||
156 | /* Enable workaround for FXSAVE leak */ | ||
157 | if (c->x86 >= 6) | ||
158 | set_cpu_cap(c, X86_FEATURE_FXSAVE_LEAK); | ||
159 | |||
160 | level = get_model_name(c); | ||
161 | if (!level) { | ||
162 | switch (c->x86) { | ||
163 | case 0xf: | ||
164 | /* Should distinguish Models here, but this is only | ||
165 | a fallback anyways. */ | ||
166 | strcpy(c->x86_model_id, "Hammer"); | ||
167 | break; | ||
168 | } | ||
169 | } | ||
170 | display_cacheinfo(c); | ||
171 | |||
172 | /* Multi core CPU? */ | ||
173 | if (c->extended_cpuid_level >= 0x80000008) | ||
174 | amd_detect_cmp(c); | ||
175 | |||
176 | if (c->extended_cpuid_level >= 0x80000006 && | ||
177 | (cpuid_edx(0x80000006) & 0xf000)) | ||
178 | num_cache_leaves = 4; | ||
179 | else | ||
180 | num_cache_leaves = 3; | ||
181 | |||
182 | if (c->x86 >= 0xf && c->x86 <= 0x11) | ||
183 | set_cpu_cap(c, X86_FEATURE_K8); | ||
184 | |||
185 | /* MFENCE stops RDTSC speculation */ | ||
186 | set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC); | ||
187 | |||
188 | if (c->x86 == 0x10) { | ||
189 | /* do this for boot cpu */ | ||
190 | if (c == &boot_cpu_data) | ||
191 | check_enable_amd_mmconf_dmi(); | ||
192 | |||
193 | fam10h_check_enable_mmcfg(); | ||
194 | } | ||
195 | |||
196 | if (c == &boot_cpu_data && c->x86 >= 0xf && c->x86 <= 0x11) { | ||
197 | unsigned long long tseg; | ||
198 | |||
199 | /* | ||
200 | * Split up direct mapping around the TSEG SMM area. | ||
201 | * Don't do it for gbpages because there seems very little | ||
202 | * benefit in doing so. | ||
203 | */ | ||
204 | if (!rdmsrl_safe(MSR_K8_TSEG_ADDR, &tseg)) { | ||
205 | printk(KERN_DEBUG "tseg: %010llx\n", tseg); | ||
206 | if ((tseg>>PMD_SHIFT) < | ||
207 | (max_low_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) || | ||
208 | ((tseg>>PMD_SHIFT) < | ||
209 | (max_pfn_mapped>>(PMD_SHIFT-PAGE_SHIFT)) && | ||
210 | (tseg>>PMD_SHIFT) >= (1ULL<<(32 - PMD_SHIFT)))) | ||
211 | set_memory_4k((unsigned long)__va(tseg), 1); | ||
212 | } | ||
213 | } | ||
214 | } | ||
215 | |||
216 | static struct cpu_dev amd_cpu_dev __cpuinitdata = { | ||
217 | .c_vendor = "AMD", | ||
218 | .c_ident = { "AuthenticAMD" }, | ||
219 | .c_early_init = early_init_amd, | ||
220 | .c_init = init_amd, | ||
221 | }; | ||
222 | |||
223 | cpu_vendor_dev_register(X86_VENDOR_AMD, &amd_cpu_dev); | ||
224 | |||
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index c9b58a806e85..c8e315f1aa83 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c | |||
@@ -50,6 +50,8 @@ static double __initdata y = 3145727.0; | |||
50 | */ | 50 | */ |
51 | static void __init check_fpu(void) | 51 | static void __init check_fpu(void) |
52 | { | 52 | { |
53 | s32 fdiv_bug; | ||
54 | |||
53 | if (!boot_cpu_data.hard_math) { | 55 | if (!boot_cpu_data.hard_math) { |
54 | #ifndef CONFIG_MATH_EMULATION | 56 | #ifndef CONFIG_MATH_EMULATION |
55 | printk(KERN_EMERG "No coprocessor found and no math emulation present.\n"); | 57 | printk(KERN_EMERG "No coprocessor found and no math emulation present.\n"); |
@@ -74,8 +76,10 @@ static void __init check_fpu(void) | |||
74 | "fistpl %0\n\t" | 76 | "fistpl %0\n\t" |
75 | "fwait\n\t" | 77 | "fwait\n\t" |
76 | "fninit" | 78 | "fninit" |
77 | : "=m" (*&boot_cpu_data.fdiv_bug) | 79 | : "=m" (*&fdiv_bug) |
78 | : "m" (*&x), "m" (*&y)); | 80 | : "m" (*&x), "m" (*&y)); |
81 | |||
82 | boot_cpu_data.fdiv_bug = fdiv_bug; | ||
79 | if (boot_cpu_data.fdiv_bug) | 83 | if (boot_cpu_data.fdiv_bug) |
80 | printk("Hmm, FPU with FDIV bug.\n"); | 84 | printk("Hmm, FPU with FDIV bug.\n"); |
81 | } | 85 | } |
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c index e0f45edd6a55..89bfdd9cacc6 100644 --- a/arch/x86/kernel/cpu/centaur.c +++ b/arch/x86/kernel/cpu/centaur.c | |||
@@ -289,7 +289,6 @@ static void __cpuinit init_c3(struct cpuinfo_x86 *c) | |||
289 | if (c->x86_model >= 6 && c->x86_model < 9) | 289 | if (c->x86_model >= 6 && c->x86_model < 9) |
290 | set_cpu_cap(c, X86_FEATURE_3DNOW); | 290 | set_cpu_cap(c, X86_FEATURE_3DNOW); |
291 | 291 | ||
292 | get_model_name(c); | ||
293 | display_cacheinfo(c); | 292 | display_cacheinfo(c); |
294 | } | 293 | } |
295 | 294 | ||
@@ -314,6 +313,16 @@ enum { | |||
314 | EAMD3D = 1<<20, | 313 | EAMD3D = 1<<20, |
315 | }; | 314 | }; |
316 | 315 | ||
316 | static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c) | ||
317 | { | ||
318 | switch (c->x86) { | ||
319 | case 5: | ||
320 | /* Emulate MTRRs using Centaur's MCR. */ | ||
321 | set_cpu_cap(c, X86_FEATURE_CENTAUR_MCR); | ||
322 | break; | ||
323 | } | ||
324 | } | ||
325 | |||
317 | static void __cpuinit init_centaur(struct cpuinfo_x86 *c) | 326 | static void __cpuinit init_centaur(struct cpuinfo_x86 *c) |
318 | { | 327 | { |
319 | 328 | ||
@@ -462,8 +471,10 @@ centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size) | |||
462 | static struct cpu_dev centaur_cpu_dev __cpuinitdata = { | 471 | static struct cpu_dev centaur_cpu_dev __cpuinitdata = { |
463 | .c_vendor = "Centaur", | 472 | .c_vendor = "Centaur", |
464 | .c_ident = { "CentaurHauls" }, | 473 | .c_ident = { "CentaurHauls" }, |
474 | .c_early_init = early_init_centaur, | ||
465 | .c_init = init_centaur, | 475 | .c_init = init_centaur, |
466 | .c_size_cache = centaur_size_cache, | 476 | .c_size_cache = centaur_size_cache, |
477 | .c_x86_vendor = X86_VENDOR_CENTAUR, | ||
467 | }; | 478 | }; |
468 | 479 | ||
469 | cpu_vendor_dev_register(X86_VENDOR_CENTAUR, ¢aur_cpu_dev); | 480 | cpu_dev_register(centaur_cpu_dev); |
diff --git a/arch/x86/kernel/cpu/centaur_64.c b/arch/x86/kernel/cpu/centaur_64.c index 1d181c40e2e1..0e5cf17a3c89 100644 --- a/arch/x86/kernel/cpu/centaur_64.c +++ b/arch/x86/kernel/cpu/centaur_64.c | |||
@@ -16,6 +16,8 @@ static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c) | |||
16 | 16 | ||
17 | static void __cpuinit init_centaur(struct cpuinfo_x86 *c) | 17 | static void __cpuinit init_centaur(struct cpuinfo_x86 *c) |
18 | { | 18 | { |
19 | early_init_centaur(c); | ||
20 | |||
19 | if (c->x86 == 0x6 && c->x86_model >= 0xf) { | 21 | if (c->x86 == 0x6 && c->x86_model >= 0xf) { |
20 | c->x86_cache_alignment = c->x86_clflush_size * 2; | 22 | c->x86_cache_alignment = c->x86_clflush_size * 2; |
21 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); | 23 | set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); |
@@ -29,7 +31,8 @@ static struct cpu_dev centaur_cpu_dev __cpuinitdata = { | |||
29 | .c_ident = { "CentaurHauls" }, | 31 | .c_ident = { "CentaurHauls" }, |
30 | .c_early_init = early_init_centaur, | 32 | .c_early_init = early_init_centaur, |
31 | .c_init = init_centaur, | 33 | .c_init = init_centaur, |
34 | .c_x86_vendor = X86_VENDOR_CENTAUR, | ||
32 | }; | 35 | }; |
33 | 36 | ||
34 | cpu_vendor_dev_register(X86_VENDOR_CENTAUR, ¢aur_cpu_dev); | 37 | cpu_dev_register(centaur_cpu_dev); |
35 | 38 | ||
diff --git a/arch/x86/kernel/cpu/cmpxchg.c b/arch/x86/kernel/cpu/cmpxchg.c new file mode 100644 index 000000000000..2056ccf572cc --- /dev/null +++ b/arch/x86/kernel/cpu/cmpxchg.c | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * cmpxchg*() fallbacks for CPU not supporting these instructions | ||
3 | */ | ||
4 | |||
5 | #include <linux/kernel.h> | ||
6 | #include <linux/smp.h> | ||
7 | #include <linux/module.h> | ||
8 | |||
9 | #ifndef CONFIG_X86_CMPXCHG | ||
10 | unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new) | ||
11 | { | ||
12 | u8 prev; | ||
13 | unsigned long flags; | ||
14 | |||
15 | /* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
16 | local_irq_save(flags); | ||
17 | prev = *(u8 *)ptr; | ||
18 | if (prev == old) | ||
19 | *(u8 *)ptr = new; | ||
20 | local_irq_restore(flags); | ||
21 | return prev; | ||
22 | } | ||
23 | EXPORT_SYMBOL(cmpxchg_386_u8); | ||
24 | |||
25 | unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new) | ||
26 | { | ||
27 | u16 prev; | ||
28 | unsigned long flags; | ||
29 | |||
30 | /* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
31 | local_irq_save(flags); | ||
32 | prev = *(u16 *)ptr; | ||
33 | if (prev == old) | ||
34 | *(u16 *)ptr = new; | ||
35 | local_irq_restore(flags); | ||
36 | return prev; | ||
37 | } | ||
38 | EXPORT_SYMBOL(cmpxchg_386_u16); | ||
39 | |||
40 | unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new) | ||
41 | { | ||
42 | u32 prev; | ||
43 | unsigned long flags; | ||
44 | |||
45 | /* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
46 | local_irq_save(flags); | ||
47 | prev = *(u32 *)ptr; | ||
48 | if (prev == old) | ||
49 | *(u32 *)ptr = new; | ||
50 | local_irq_restore(flags); | ||
51 | return prev; | ||
52 | } | ||
53 | EXPORT_SYMBOL(cmpxchg_386_u32); | ||
54 | #endif | ||
55 | |||
56 | #ifndef CONFIG_X86_CMPXCHG64 | ||
57 | unsigned long long cmpxchg_486_u64(volatile void *ptr, u64 old, u64 new) | ||
58 | { | ||
59 | u64 prev; | ||
60 | unsigned long flags; | ||
61 | |||
62 | /* Poor man's cmpxchg8b for 386 and 486. Unsuitable for SMP */ | ||
63 | local_irq_save(flags); | ||
64 | prev = *(u64 *)ptr; | ||
65 | if (prev == old) | ||
66 | *(u64 *)ptr = new; | ||
67 | local_irq_restore(flags); | ||
68 | return prev; | ||
69 | } | ||
70 | EXPORT_SYMBOL(cmpxchg_486_u64); | ||
71 | #endif | ||
72 | |||
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 80ab20d4fa39..9a57106c1995 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1,27 +1,62 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/kernel.h> | ||
3 | #include <linux/sched.h> | ||
2 | #include <linux/string.h> | 4 | #include <linux/string.h> |
5 | #include <linux/bootmem.h> | ||
6 | #include <linux/bitops.h> | ||
7 | #include <linux/module.h> | ||
8 | #include <linux/kgdb.h> | ||
9 | #include <linux/topology.h> | ||
3 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
4 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
5 | #include <linux/module.h> | ||
6 | #include <linux/percpu.h> | 12 | #include <linux/percpu.h> |
7 | #include <linux/bootmem.h> | ||
8 | #include <asm/processor.h> | ||
9 | #include <asm/i387.h> | 13 | #include <asm/i387.h> |
10 | #include <asm/msr.h> | 14 | #include <asm/msr.h> |
11 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <asm/linkage.h> | ||
12 | #include <asm/mmu_context.h> | 17 | #include <asm/mmu_context.h> |
13 | #include <asm/mtrr.h> | 18 | #include <asm/mtrr.h> |
14 | #include <asm/mce.h> | 19 | #include <asm/mce.h> |
15 | #include <asm/pat.h> | 20 | #include <asm/pat.h> |
21 | #include <asm/asm.h> | ||
22 | #include <asm/numa.h> | ||
16 | #ifdef CONFIG_X86_LOCAL_APIC | 23 | #ifdef CONFIG_X86_LOCAL_APIC |
17 | #include <asm/mpspec.h> | 24 | #include <asm/mpspec.h> |
18 | #include <asm/apic.h> | 25 | #include <asm/apic.h> |
19 | #include <mach_apic.h> | 26 | #include <mach_apic.h> |
27 | #include <asm/genapic.h> | ||
20 | #endif | 28 | #endif |
21 | 29 | ||
30 | #include <asm/pda.h> | ||
31 | #include <asm/pgtable.h> | ||
32 | #include <asm/processor.h> | ||
33 | #include <asm/desc.h> | ||
34 | #include <asm/atomic.h> | ||
35 | #include <asm/proto.h> | ||
36 | #include <asm/sections.h> | ||
37 | #include <asm/setup.h> | ||
38 | |||
22 | #include "cpu.h" | 39 | #include "cpu.h" |
23 | 40 | ||
41 | static struct cpu_dev *this_cpu __cpuinitdata; | ||
42 | |||
43 | #ifdef CONFIG_X86_64 | ||
44 | /* We need valid kernel segments for data and code in long mode too | ||
45 | * IRET will check the segment types kkeil 2000/10/28 | ||
46 | * Also sysret mandates a special GDT layout | ||
47 | */ | ||
48 | /* The TLS descriptors are currently at a different place compared to i386. | ||
49 | Hopefully nobody expects them at a fixed place (Wine?) */ | ||
24 | DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = { | 50 | DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = { |
51 | [GDT_ENTRY_KERNEL32_CS] = { { { 0x0000ffff, 0x00cf9b00 } } }, | ||
52 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00af9b00 } } }, | ||
53 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9300 } } }, | ||
54 | [GDT_ENTRY_DEFAULT_USER32_CS] = { { { 0x0000ffff, 0x00cffb00 } } }, | ||
55 | [GDT_ENTRY_DEFAULT_USER_DS] = { { { 0x0000ffff, 0x00cff300 } } }, | ||
56 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00affb00 } } }, | ||
57 | } }; | ||
58 | #else | ||
59 | DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { | ||
25 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00cf9a00 } } }, | 60 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00cf9a00 } } }, |
26 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9200 } } }, | 61 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9200 } } }, |
27 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00cffa00 } } }, | 62 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00cffa00 } } }, |
@@ -55,17 +90,150 @@ DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = { | |||
55 | [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } }, | 90 | [GDT_ENTRY_ESPFIX_SS] = { { { 0x00000000, 0x00c09200 } } }, |
56 | [GDT_ENTRY_PERCPU] = { { { 0x00000000, 0x00000000 } } }, | 91 | [GDT_ENTRY_PERCPU] = { { { 0x00000000, 0x00000000 } } }, |
57 | } }; | 92 | } }; |
93 | #endif | ||
58 | EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); | 94 | EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); |
59 | 95 | ||
60 | __u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata; | 96 | #ifdef CONFIG_X86_32 |
61 | |||
62 | static int cachesize_override __cpuinitdata = -1; | 97 | static int cachesize_override __cpuinitdata = -1; |
63 | static int disable_x86_serial_nr __cpuinitdata = 1; | 98 | static int disable_x86_serial_nr __cpuinitdata = 1; |
64 | 99 | ||
65 | struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; | 100 | static int __init cachesize_setup(char *str) |
101 | { | ||
102 | get_option(&str, &cachesize_override); | ||
103 | return 1; | ||
104 | } | ||
105 | __setup("cachesize=", cachesize_setup); | ||
106 | |||
107 | static int __init x86_fxsr_setup(char *s) | ||
108 | { | ||
109 | setup_clear_cpu_cap(X86_FEATURE_FXSR); | ||
110 | setup_clear_cpu_cap(X86_FEATURE_XMM); | ||
111 | return 1; | ||
112 | } | ||
113 | __setup("nofxsr", x86_fxsr_setup); | ||
114 | |||
115 | static int __init x86_sep_setup(char *s) | ||
116 | { | ||
117 | setup_clear_cpu_cap(X86_FEATURE_SEP); | ||
118 | return 1; | ||
119 | } | ||
120 | __setup("nosep", x86_sep_setup); | ||
121 | |||
122 | /* Standard macro to see if a specific flag is changeable */ | ||
123 | static inline int flag_is_changeable_p(u32 flag) | ||
124 | { | ||
125 | u32 f1, f2; | ||
126 | |||
127 | asm("pushfl\n\t" | ||
128 | "pushfl\n\t" | ||
129 | "popl %0\n\t" | ||
130 | "movl %0,%1\n\t" | ||
131 | "xorl %2,%0\n\t" | ||
132 | "pushl %0\n\t" | ||
133 | "popfl\n\t" | ||
134 | "pushfl\n\t" | ||
135 | "popl %0\n\t" | ||
136 | "popfl\n\t" | ||
137 | : "=&r" (f1), "=&r" (f2) | ||
138 | : "ir" (flag)); | ||
139 | |||
140 | return ((f1^f2) & flag) != 0; | ||
141 | } | ||
142 | |||
143 | /* Probe for the CPUID instruction */ | ||
144 | static int __cpuinit have_cpuid_p(void) | ||
145 | { | ||
146 | return flag_is_changeable_p(X86_EFLAGS_ID); | ||
147 | } | ||
148 | |||
149 | static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | ||
150 | { | ||
151 | if (cpu_has(c, X86_FEATURE_PN) && disable_x86_serial_nr) { | ||
152 | /* Disable processor serial number */ | ||
153 | unsigned long lo, hi; | ||
154 | rdmsr(MSR_IA32_BBL_CR_CTL, lo, hi); | ||
155 | lo |= 0x200000; | ||
156 | wrmsr(MSR_IA32_BBL_CR_CTL, lo, hi); | ||
157 | printk(KERN_NOTICE "CPU serial number disabled.\n"); | ||
158 | clear_cpu_cap(c, X86_FEATURE_PN); | ||
159 | |||
160 | /* Disabling the serial number may affect the cpuid level */ | ||
161 | c->cpuid_level = cpuid_eax(0); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | static int __init x86_serial_nr_setup(char *s) | ||
166 | { | ||
167 | disable_x86_serial_nr = 0; | ||
168 | return 1; | ||
169 | } | ||
170 | __setup("serialnumber", x86_serial_nr_setup); | ||
171 | #else | ||
172 | static inline int flag_is_changeable_p(u32 flag) | ||
173 | { | ||
174 | return 1; | ||
175 | } | ||
176 | /* Probe for the CPUID instruction */ | ||
177 | static inline int have_cpuid_p(void) | ||
178 | { | ||
179 | return 1; | ||
180 | } | ||
181 | static inline void squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | ||
182 | { | ||
183 | } | ||
184 | #endif | ||
185 | |||
186 | /* | ||
187 | * Naming convention should be: <Name> [(<Codename>)] | ||
188 | * This table only is used unless init_<vendor>() below doesn't set it; | ||
189 | * in particular, if CPUID levels 0x80000002..4 are supported, this isn't used | ||
190 | * | ||
191 | */ | ||
192 | |||
193 | /* Look up CPU names by table lookup. */ | ||
194 | static char __cpuinit *table_lookup_model(struct cpuinfo_x86 *c) | ||
195 | { | ||
196 | struct cpu_model_info *info; | ||
197 | |||
198 | if (c->x86_model >= 16) | ||
199 | return NULL; /* Range check */ | ||
200 | |||
201 | if (!this_cpu) | ||
202 | return NULL; | ||
203 | |||
204 | info = this_cpu->c_models; | ||
205 | |||
206 | while (info && info->family) { | ||
207 | if (info->family == c->x86) | ||
208 | return info->model_names[c->x86_model]; | ||
209 | info++; | ||
210 | } | ||
211 | return NULL; /* Not found */ | ||
212 | } | ||
213 | |||
214 | __u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata; | ||
215 | |||
216 | /* Current gdt points %fs at the "master" per-cpu area: after this, | ||
217 | * it's on the real one. */ | ||
218 | void switch_to_new_gdt(void) | ||
219 | { | ||
220 | struct desc_ptr gdt_descr; | ||
221 | |||
222 | gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id()); | ||
223 | gdt_descr.size = GDT_SIZE - 1; | ||
224 | load_gdt(&gdt_descr); | ||
225 | #ifdef CONFIG_X86_32 | ||
226 | asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory"); | ||
227 | #endif | ||
228 | } | ||
229 | |||
230 | static struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; | ||
66 | 231 | ||
67 | static void __cpuinit default_init(struct cpuinfo_x86 *c) | 232 | static void __cpuinit default_init(struct cpuinfo_x86 *c) |
68 | { | 233 | { |
234 | #ifdef CONFIG_X86_64 | ||
235 | display_cacheinfo(c); | ||
236 | #else | ||
69 | /* Not much we can do here... */ | 237 | /* Not much we can do here... */ |
70 | /* Check if at least it has cpuid */ | 238 | /* Check if at least it has cpuid */ |
71 | if (c->cpuid_level == -1) { | 239 | if (c->cpuid_level == -1) { |
@@ -75,28 +243,22 @@ static void __cpuinit default_init(struct cpuinfo_x86 *c) | |||
75 | else if (c->x86 == 3) | 243 | else if (c->x86 == 3) |
76 | strcpy(c->x86_model_id, "386"); | 244 | strcpy(c->x86_model_id, "386"); |
77 | } | 245 | } |
246 | #endif | ||
78 | } | 247 | } |
79 | 248 | ||
80 | static struct cpu_dev __cpuinitdata default_cpu = { | 249 | static struct cpu_dev __cpuinitdata default_cpu = { |
81 | .c_init = default_init, | 250 | .c_init = default_init, |
82 | .c_vendor = "Unknown", | 251 | .c_vendor = "Unknown", |
252 | .c_x86_vendor = X86_VENDOR_UNKNOWN, | ||
83 | }; | 253 | }; |
84 | static struct cpu_dev *this_cpu __cpuinitdata = &default_cpu; | ||
85 | |||
86 | static int __init cachesize_setup(char *str) | ||
87 | { | ||
88 | get_option(&str, &cachesize_override); | ||
89 | return 1; | ||
90 | } | ||
91 | __setup("cachesize=", cachesize_setup); | ||
92 | 254 | ||
93 | int __cpuinit get_model_name(struct cpuinfo_x86 *c) | 255 | static void __cpuinit get_model_name(struct cpuinfo_x86 *c) |
94 | { | 256 | { |
95 | unsigned int *v; | 257 | unsigned int *v; |
96 | char *p, *q; | 258 | char *p, *q; |
97 | 259 | ||
98 | if (cpuid_eax(0x80000000) < 0x80000004) | 260 | if (c->extended_cpuid_level < 0x80000004) |
99 | return 0; | 261 | return; |
100 | 262 | ||
101 | v = (unsigned int *) c->x86_model_id; | 263 | v = (unsigned int *) c->x86_model_id; |
102 | cpuid(0x80000002, &v[0], &v[1], &v[2], &v[3]); | 264 | cpuid(0x80000002, &v[0], &v[1], &v[2], &v[3]); |
@@ -115,30 +277,34 @@ int __cpuinit get_model_name(struct cpuinfo_x86 *c) | |||
115 | while (q <= &c->x86_model_id[48]) | 277 | while (q <= &c->x86_model_id[48]) |
116 | *q++ = '\0'; /* Zero-pad the rest */ | 278 | *q++ = '\0'; /* Zero-pad the rest */ |
117 | } | 279 | } |
118 | |||
119 | return 1; | ||
120 | } | 280 | } |
121 | 281 | ||
122 | |||
123 | void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) | 282 | void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) |
124 | { | 283 | { |
125 | unsigned int n, dummy, ecx, edx, l2size; | 284 | unsigned int n, dummy, ebx, ecx, edx, l2size; |
126 | 285 | ||
127 | n = cpuid_eax(0x80000000); | 286 | n = c->extended_cpuid_level; |
128 | 287 | ||
129 | if (n >= 0x80000005) { | 288 | if (n >= 0x80000005) { |
130 | cpuid(0x80000005, &dummy, &dummy, &ecx, &edx); | 289 | cpuid(0x80000005, &dummy, &ebx, &ecx, &edx); |
131 | printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), D cache %dK (%d bytes/line)\n", | 290 | printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), D cache %dK (%d bytes/line)\n", |
132 | edx>>24, edx&0xFF, ecx>>24, ecx&0xFF); | 291 | edx>>24, edx&0xFF, ecx>>24, ecx&0xFF); |
133 | c->x86_cache_size = (ecx>>24)+(edx>>24); | 292 | c->x86_cache_size = (ecx>>24) + (edx>>24); |
293 | #ifdef CONFIG_X86_64 | ||
294 | /* On K8 L1 TLB is inclusive, so don't count it */ | ||
295 | c->x86_tlbsize = 0; | ||
296 | #endif | ||
134 | } | 297 | } |
135 | 298 | ||
136 | if (n < 0x80000006) /* Some chips just has a large L1. */ | 299 | if (n < 0x80000006) /* Some chips just has a large L1. */ |
137 | return; | 300 | return; |
138 | 301 | ||
139 | ecx = cpuid_ecx(0x80000006); | 302 | cpuid(0x80000006, &dummy, &ebx, &ecx, &edx); |
140 | l2size = ecx >> 16; | 303 | l2size = ecx >> 16; |
141 | 304 | ||
305 | #ifdef CONFIG_X86_64 | ||
306 | c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff); | ||
307 | #else | ||
142 | /* do processor-specific cache resizing */ | 308 | /* do processor-specific cache resizing */ |
143 | if (this_cpu->c_size_cache) | 309 | if (this_cpu->c_size_cache) |
144 | l2size = this_cpu->c_size_cache(c, l2size); | 310 | l2size = this_cpu->c_size_cache(c, l2size); |
@@ -149,116 +315,106 @@ void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) | |||
149 | 315 | ||
150 | if (l2size == 0) | 316 | if (l2size == 0) |
151 | return; /* Again, no L2 cache is possible */ | 317 | return; /* Again, no L2 cache is possible */ |
318 | #endif | ||
152 | 319 | ||
153 | c->x86_cache_size = l2size; | 320 | c->x86_cache_size = l2size; |
154 | 321 | ||
155 | printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n", | 322 | printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n", |
156 | l2size, ecx & 0xFF); | 323 | l2size, ecx & 0xFF); |
157 | } | 324 | } |
158 | 325 | ||
159 | /* | 326 | void __cpuinit detect_ht(struct cpuinfo_x86 *c) |
160 | * Naming convention should be: <Name> [(<Codename>)] | ||
161 | * This table only is used unless init_<vendor>() below doesn't set it; | ||
162 | * in particular, if CPUID levels 0x80000002..4 are supported, this isn't used | ||
163 | * | ||
164 | */ | ||
165 | |||
166 | /* Look up CPU names by table lookup. */ | ||
167 | static char __cpuinit *table_lookup_model(struct cpuinfo_x86 *c) | ||
168 | { | 327 | { |
169 | struct cpu_model_info *info; | 328 | #ifdef CONFIG_X86_HT |
329 | u32 eax, ebx, ecx, edx; | ||
330 | int index_msb, core_bits; | ||
170 | 331 | ||
171 | if (c->x86_model >= 16) | 332 | if (!cpu_has(c, X86_FEATURE_HT)) |
172 | return NULL; /* Range check */ | 333 | return; |
173 | 334 | ||
174 | if (!this_cpu) | 335 | if (cpu_has(c, X86_FEATURE_CMP_LEGACY)) |
175 | return NULL; | 336 | goto out; |
176 | 337 | ||
177 | info = this_cpu->c_models; | 338 | if (cpu_has(c, X86_FEATURE_XTOPOLOGY)) |
339 | return; | ||
178 | 340 | ||
179 | while (info && info->family) { | 341 | cpuid(1, &eax, &ebx, &ecx, &edx); |
180 | if (info->family == c->x86) | 342 | |
181 | return info->model_names[c->x86_model]; | 343 | smp_num_siblings = (ebx & 0xff0000) >> 16; |
182 | info++; | 344 | |
345 | if (smp_num_siblings == 1) { | ||
346 | printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); | ||
347 | } else if (smp_num_siblings > 1) { | ||
348 | |||
349 | if (smp_num_siblings > NR_CPUS) { | ||
350 | printk(KERN_WARNING "CPU: Unsupported number of siblings %d", | ||
351 | smp_num_siblings); | ||
352 | smp_num_siblings = 1; | ||
353 | return; | ||
354 | } | ||
355 | |||
356 | index_msb = get_count_order(smp_num_siblings); | ||
357 | #ifdef CONFIG_X86_64 | ||
358 | c->phys_proc_id = phys_pkg_id(index_msb); | ||
359 | #else | ||
360 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb); | ||
361 | #endif | ||
362 | |||
363 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; | ||
364 | |||
365 | index_msb = get_count_order(smp_num_siblings); | ||
366 | |||
367 | core_bits = get_count_order(c->x86_max_cores); | ||
368 | |||
369 | #ifdef CONFIG_X86_64 | ||
370 | c->cpu_core_id = phys_pkg_id(index_msb) & | ||
371 | ((1 << core_bits) - 1); | ||
372 | #else | ||
373 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) & | ||
374 | ((1 << core_bits) - 1); | ||
375 | #endif | ||
183 | } | 376 | } |
184 | return NULL; /* Not found */ | ||
185 | } | ||
186 | 377 | ||
378 | out: | ||
379 | if ((c->x86_max_cores * smp_num_siblings) > 1) { | ||
380 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | ||
381 | c->phys_proc_id); | ||
382 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | ||
383 | c->cpu_core_id); | ||
384 | } | ||
385 | #endif | ||
386 | } | ||
187 | 387 | ||
188 | static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c, int early) | 388 | static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) |
189 | { | 389 | { |
190 | char *v = c->x86_vendor_id; | 390 | char *v = c->x86_vendor_id; |
191 | int i; | 391 | int i; |
192 | static int printed; | 392 | static int printed; |
193 | 393 | ||
194 | for (i = 0; i < X86_VENDOR_NUM; i++) { | 394 | for (i = 0; i < X86_VENDOR_NUM; i++) { |
195 | if (cpu_devs[i]) { | 395 | if (!cpu_devs[i]) |
196 | if (!strcmp(v, cpu_devs[i]->c_ident[0]) || | 396 | break; |
197 | (cpu_devs[i]->c_ident[1] && | 397 | |
198 | !strcmp(v, cpu_devs[i]->c_ident[1]))) { | 398 | if (!strcmp(v, cpu_devs[i]->c_ident[0]) || |
199 | c->x86_vendor = i; | 399 | (cpu_devs[i]->c_ident[1] && |
200 | if (!early) | 400 | !strcmp(v, cpu_devs[i]->c_ident[1]))) { |
201 | this_cpu = cpu_devs[i]; | 401 | this_cpu = cpu_devs[i]; |
202 | return; | 402 | c->x86_vendor = this_cpu->c_x86_vendor; |
203 | } | 403 | return; |
204 | } | 404 | } |
205 | } | 405 | } |
406 | |||
206 | if (!printed) { | 407 | if (!printed) { |
207 | printed++; | 408 | printed++; |
208 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); | 409 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); |
209 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); | 410 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); |
210 | } | 411 | } |
412 | |||
211 | c->x86_vendor = X86_VENDOR_UNKNOWN; | 413 | c->x86_vendor = X86_VENDOR_UNKNOWN; |
212 | this_cpu = &default_cpu; | 414 | this_cpu = &default_cpu; |
213 | } | 415 | } |
214 | 416 | ||
215 | 417 | void __cpuinit cpu_detect(struct cpuinfo_x86 *c) | |
216 | static int __init x86_fxsr_setup(char *s) | ||
217 | { | ||
218 | setup_clear_cpu_cap(X86_FEATURE_FXSR); | ||
219 | setup_clear_cpu_cap(X86_FEATURE_XMM); | ||
220 | return 1; | ||
221 | } | ||
222 | __setup("nofxsr", x86_fxsr_setup); | ||
223 | |||
224 | |||
225 | static int __init x86_sep_setup(char *s) | ||
226 | { | ||
227 | setup_clear_cpu_cap(X86_FEATURE_SEP); | ||
228 | return 1; | ||
229 | } | ||
230 | __setup("nosep", x86_sep_setup); | ||
231 | |||
232 | |||
233 | /* Standard macro to see if a specific flag is changeable */ | ||
234 | static inline int flag_is_changeable_p(u32 flag) | ||
235 | { | ||
236 | u32 f1, f2; | ||
237 | |||
238 | asm("pushfl\n\t" | ||
239 | "pushfl\n\t" | ||
240 | "popl %0\n\t" | ||
241 | "movl %0,%1\n\t" | ||
242 | "xorl %2,%0\n\t" | ||
243 | "pushl %0\n\t" | ||
244 | "popfl\n\t" | ||
245 | "pushfl\n\t" | ||
246 | "popl %0\n\t" | ||
247 | "popfl\n\t" | ||
248 | : "=&r" (f1), "=&r" (f2) | ||
249 | : "ir" (flag)); | ||
250 | |||
251 | return ((f1^f2) & flag) != 0; | ||
252 | } | ||
253 | |||
254 | |||
255 | /* Probe for the CPUID instruction */ | ||
256 | static int __cpuinit have_cpuid_p(void) | ||
257 | { | ||
258 | return flag_is_changeable_p(X86_EFLAGS_ID); | ||
259 | } | ||
260 | |||
261 | void __init cpu_detect(struct cpuinfo_x86 *c) | ||
262 | { | 418 | { |
263 | /* Get vendor name */ | 419 | /* Get vendor name */ |
264 | cpuid(0x00000000, (unsigned int *)&c->cpuid_level, | 420 | cpuid(0x00000000, (unsigned int *)&c->cpuid_level, |
@@ -267,50 +423,68 @@ void __init cpu_detect(struct cpuinfo_x86 *c) | |||
267 | (unsigned int *)&c->x86_vendor_id[4]); | 423 | (unsigned int *)&c->x86_vendor_id[4]); |
268 | 424 | ||
269 | c->x86 = 4; | 425 | c->x86 = 4; |
426 | /* Intel-defined flags: level 0x00000001 */ | ||
270 | if (c->cpuid_level >= 0x00000001) { | 427 | if (c->cpuid_level >= 0x00000001) { |
271 | u32 junk, tfms, cap0, misc; | 428 | u32 junk, tfms, cap0, misc; |
272 | cpuid(0x00000001, &tfms, &misc, &junk, &cap0); | 429 | cpuid(0x00000001, &tfms, &misc, &junk, &cap0); |
273 | c->x86 = (tfms >> 8) & 15; | 430 | c->x86 = (tfms >> 8) & 0xf; |
274 | c->x86_model = (tfms >> 4) & 15; | 431 | c->x86_model = (tfms >> 4) & 0xf; |
432 | c->x86_mask = tfms & 0xf; | ||
275 | if (c->x86 == 0xf) | 433 | if (c->x86 == 0xf) |
276 | c->x86 += (tfms >> 20) & 0xff; | 434 | c->x86 += (tfms >> 20) & 0xff; |
277 | if (c->x86 >= 0x6) | 435 | if (c->x86 >= 0x6) |
278 | c->x86_model += ((tfms >> 16) & 0xF) << 4; | 436 | c->x86_model += ((tfms >> 16) & 0xf) << 4; |
279 | c->x86_mask = tfms & 15; | ||
280 | if (cap0 & (1<<19)) { | 437 | if (cap0 & (1<<19)) { |
281 | c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; | ||
282 | c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; | 438 | c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; |
439 | c->x86_cache_alignment = c->x86_clflush_size; | ||
283 | } | 440 | } |
284 | } | 441 | } |
285 | } | 442 | } |
286 | static void __cpuinit early_get_cap(struct cpuinfo_x86 *c) | 443 | |
444 | static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c) | ||
287 | { | 445 | { |
288 | u32 tfms, xlvl; | 446 | u32 tfms, xlvl; |
289 | unsigned int ebx; | 447 | u32 ebx; |
290 | 448 | ||
291 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | 449 | /* Intel-defined flags: level 0x00000001 */ |
292 | if (have_cpuid_p()) { | 450 | if (c->cpuid_level >= 0x00000001) { |
293 | /* Intel-defined flags: level 0x00000001 */ | 451 | u32 capability, excap; |
294 | if (c->cpuid_level >= 0x00000001) { | 452 | cpuid(0x00000001, &tfms, &ebx, &excap, &capability); |
295 | u32 capability, excap; | 453 | c->x86_capability[0] = capability; |
296 | cpuid(0x00000001, &tfms, &ebx, &excap, &capability); | 454 | c->x86_capability[4] = excap; |
297 | c->x86_capability[0] = capability; | 455 | } |
298 | c->x86_capability[4] = excap; | ||
299 | } | ||
300 | 456 | ||
301 | /* AMD-defined flags: level 0x80000001 */ | 457 | /* AMD-defined flags: level 0x80000001 */ |
302 | xlvl = cpuid_eax(0x80000000); | 458 | xlvl = cpuid_eax(0x80000000); |
303 | if ((xlvl & 0xffff0000) == 0x80000000) { | 459 | c->extended_cpuid_level = xlvl; |
304 | if (xlvl >= 0x80000001) { | 460 | if ((xlvl & 0xffff0000) == 0x80000000) { |
305 | c->x86_capability[1] = cpuid_edx(0x80000001); | 461 | if (xlvl >= 0x80000001) { |
306 | c->x86_capability[6] = cpuid_ecx(0x80000001); | 462 | c->x86_capability[1] = cpuid_edx(0x80000001); |
307 | } | 463 | c->x86_capability[6] = cpuid_ecx(0x80000001); |
308 | } | 464 | } |
465 | } | ||
309 | 466 | ||
467 | #ifdef CONFIG_X86_64 | ||
468 | /* Transmeta-defined flags: level 0x80860001 */ | ||
469 | xlvl = cpuid_eax(0x80860000); | ||
470 | if ((xlvl & 0xffff0000) == 0x80860000) { | ||
471 | /* Don't set x86_cpuid_level here for now to not confuse. */ | ||
472 | if (xlvl >= 0x80860001) | ||
473 | c->x86_capability[2] = cpuid_edx(0x80860001); | ||
310 | } | 474 | } |
311 | 475 | ||
312 | } | 476 | if (c->extended_cpuid_level >= 0x80000008) { |
477 | u32 eax = cpuid_eax(0x80000008); | ||
478 | |||
479 | c->x86_virt_bits = (eax >> 8) & 0xff; | ||
480 | c->x86_phys_bits = eax & 0xff; | ||
481 | } | ||
482 | #endif | ||
313 | 483 | ||
484 | if (c->extended_cpuid_level >= 0x80000007) | ||
485 | c->x86_power = cpuid_edx(0x80000007); | ||
486 | |||
487 | } | ||
314 | /* | 488 | /* |
315 | * Do minimum CPU detection early. | 489 | * Do minimum CPU detection early. |
316 | * Fields really needed: vendor, cpuid_level, family, model, mask, | 490 | * Fields really needed: vendor, cpuid_level, family, model, mask, |
@@ -320,109 +494,126 @@ static void __cpuinit early_get_cap(struct cpuinfo_x86 *c) | |||
320 | * WARNING: this function is only called on the BP. Don't add code here | 494 | * WARNING: this function is only called on the BP. Don't add code here |
321 | * that is supposed to run on all CPUs. | 495 | * that is supposed to run on all CPUs. |
322 | */ | 496 | */ |
323 | static void __init early_cpu_detect(void) | 497 | static void __init early_identify_cpu(struct cpuinfo_x86 *c) |
324 | { | 498 | { |
325 | struct cpuinfo_x86 *c = &boot_cpu_data; | 499 | #ifdef CONFIG_X86_64 |
326 | 500 | c->x86_clflush_size = 64; | |
327 | c->x86_cache_alignment = 32; | 501 | #else |
328 | c->x86_clflush_size = 32; | 502 | c->x86_clflush_size = 32; |
503 | #endif | ||
504 | c->x86_cache_alignment = c->x86_clflush_size; | ||
329 | 505 | ||
330 | if (!have_cpuid_p()) | 506 | if (!have_cpuid_p()) |
331 | return; | 507 | return; |
332 | 508 | ||
509 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | ||
510 | |||
511 | c->extended_cpuid_level = 0; | ||
512 | |||
333 | cpu_detect(c); | 513 | cpu_detect(c); |
334 | 514 | ||
335 | get_cpu_vendor(c, 1); | 515 | get_cpu_vendor(c); |
516 | |||
517 | get_cpu_cap(c); | ||
336 | 518 | ||
337 | if (c->x86_vendor != X86_VENDOR_UNKNOWN && | 519 | if (this_cpu->c_early_init) |
338 | cpu_devs[c->x86_vendor]->c_early_init) | 520 | this_cpu->c_early_init(c); |
339 | cpu_devs[c->x86_vendor]->c_early_init(c); | ||
340 | 521 | ||
341 | early_get_cap(c); | 522 | validate_pat_support(c); |
342 | } | 523 | } |
343 | 524 | ||
344 | static void __cpuinit generic_identify(struct cpuinfo_x86 *c) | 525 | void __init early_cpu_init(void) |
345 | { | 526 | { |
346 | u32 tfms, xlvl; | 527 | struct cpu_dev **cdev; |
347 | unsigned int ebx; | 528 | int count = 0; |
348 | 529 | ||
349 | if (have_cpuid_p()) { | 530 | printk("KERNEL supported cpus:\n"); |
350 | /* Get vendor name */ | 531 | for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) { |
351 | cpuid(0x00000000, (unsigned int *)&c->cpuid_level, | 532 | struct cpu_dev *cpudev = *cdev; |
352 | (unsigned int *)&c->x86_vendor_id[0], | 533 | unsigned int j; |
353 | (unsigned int *)&c->x86_vendor_id[8], | 534 | |
354 | (unsigned int *)&c->x86_vendor_id[4]); | 535 | if (count >= X86_VENDOR_NUM) |
355 | 536 | break; | |
356 | get_cpu_vendor(c, 0); | 537 | cpu_devs[count] = cpudev; |
357 | /* Initialize the standard set of capabilities */ | 538 | count++; |
358 | /* Note that the vendor-specific code below might override */ | 539 | |
359 | /* Intel-defined flags: level 0x00000001 */ | 540 | for (j = 0; j < 2; j++) { |
360 | if (c->cpuid_level >= 0x00000001) { | 541 | if (!cpudev->c_ident[j]) |
361 | u32 capability, excap; | 542 | continue; |
362 | cpuid(0x00000001, &tfms, &ebx, &excap, &capability); | 543 | printk(" %s %s\n", cpudev->c_vendor, |
363 | c->x86_capability[0] = capability; | 544 | cpudev->c_ident[j]); |
364 | c->x86_capability[4] = excap; | ||
365 | c->x86 = (tfms >> 8) & 15; | ||
366 | c->x86_model = (tfms >> 4) & 15; | ||
367 | if (c->x86 == 0xf) | ||
368 | c->x86 += (tfms >> 20) & 0xff; | ||
369 | if (c->x86 >= 0x6) | ||
370 | c->x86_model += ((tfms >> 16) & 0xF) << 4; | ||
371 | c->x86_mask = tfms & 15; | ||
372 | c->initial_apicid = (ebx >> 24) & 0xFF; | ||
373 | #ifdef CONFIG_X86_HT | ||
374 | c->apicid = phys_pkg_id(c->initial_apicid, 0); | ||
375 | c->phys_proc_id = c->initial_apicid; | ||
376 | #else | ||
377 | c->apicid = c->initial_apicid; | ||
378 | #endif | ||
379 | if (test_cpu_cap(c, X86_FEATURE_CLFLSH)) | ||
380 | c->x86_clflush_size = ((ebx >> 8) & 0xff) * 8; | ||
381 | } else { | ||
382 | /* Have CPUID level 0 only - unheard of */ | ||
383 | c->x86 = 4; | ||
384 | } | ||
385 | |||
386 | /* AMD-defined flags: level 0x80000001 */ | ||
387 | xlvl = cpuid_eax(0x80000000); | ||
388 | if ((xlvl & 0xffff0000) == 0x80000000) { | ||
389 | if (xlvl >= 0x80000001) { | ||
390 | c->x86_capability[1] = cpuid_edx(0x80000001); | ||
391 | c->x86_capability[6] = cpuid_ecx(0x80000001); | ||
392 | } | ||
393 | if (xlvl >= 0x80000004) | ||
394 | get_model_name(c); /* Default name */ | ||
395 | } | 545 | } |
396 | |||
397 | init_scattered_cpuid_features(c); | ||
398 | } | 546 | } |
399 | 547 | ||
548 | early_identify_cpu(&boot_cpu_data); | ||
400 | } | 549 | } |
401 | 550 | ||
402 | static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) | 551 | /* |
552 | * The NOPL instruction is supposed to exist on all CPUs with | ||
553 | * family >= 6, unfortunately, that's not true in practice because | ||
554 | * of early VIA chips and (more importantly) broken virtualizers that | ||
555 | * are not easy to detect. Hence, probe for it based on first | ||
556 | * principles. | ||
557 | * | ||
558 | * Note: no 64-bit chip is known to lack these, but put the code here | ||
559 | * for consistency with 32 bits, and to make it utterly trivial to | ||
560 | * diagnose the problem should it ever surface. | ||
561 | */ | ||
562 | static void __cpuinit detect_nopl(struct cpuinfo_x86 *c) | ||
403 | { | 563 | { |
404 | if (cpu_has(c, X86_FEATURE_PN) && disable_x86_serial_nr) { | 564 | const u32 nopl_signature = 0x888c53b1; /* Random number */ |
405 | /* Disable processor serial number */ | 565 | u32 has_nopl = nopl_signature; |
406 | unsigned long lo, hi; | 566 | |
407 | rdmsr(MSR_IA32_BBL_CR_CTL, lo, hi); | 567 | clear_cpu_cap(c, X86_FEATURE_NOPL); |
408 | lo |= 0x200000; | 568 | if (c->x86 >= 6) { |
409 | wrmsr(MSR_IA32_BBL_CR_CTL, lo, hi); | 569 | asm volatile("\n" |
410 | printk(KERN_NOTICE "CPU serial number disabled.\n"); | 570 | "1: .byte 0x0f,0x1f,0xc0\n" /* nopl %eax */ |
411 | clear_cpu_cap(c, X86_FEATURE_PN); | 571 | "2:\n" |
412 | 572 | " .section .fixup,\"ax\"\n" | |
413 | /* Disabling the serial number may affect the cpuid level */ | 573 | "3: xor %0,%0\n" |
414 | c->cpuid_level = cpuid_eax(0); | 574 | " jmp 2b\n" |
575 | " .previous\n" | ||
576 | _ASM_EXTABLE(1b,3b) | ||
577 | : "+a" (has_nopl)); | ||
578 | |||
579 | if (has_nopl == nopl_signature) | ||
580 | set_cpu_cap(c, X86_FEATURE_NOPL); | ||
415 | } | 581 | } |
416 | } | 582 | } |
417 | 583 | ||
418 | static int __init x86_serial_nr_setup(char *s) | 584 | static void __cpuinit generic_identify(struct cpuinfo_x86 *c) |
419 | { | 585 | { |
420 | disable_x86_serial_nr = 0; | 586 | if (!have_cpuid_p()) |
421 | return 1; | 587 | return; |
422 | } | 588 | |
423 | __setup("serialnumber", x86_serial_nr_setup); | 589 | c->extended_cpuid_level = 0; |
590 | |||
591 | cpu_detect(c); | ||
592 | |||
593 | get_cpu_vendor(c); | ||
594 | |||
595 | get_cpu_cap(c); | ||
596 | |||
597 | if (c->cpuid_level >= 0x00000001) { | ||
598 | c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF; | ||
599 | #ifdef CONFIG_X86_32 | ||
600 | # ifdef CONFIG_X86_HT | ||
601 | c->apicid = phys_pkg_id(c->initial_apicid, 0); | ||
602 | # else | ||
603 | c->apicid = c->initial_apicid; | ||
604 | # endif | ||
605 | #endif | ||
606 | |||
607 | #ifdef CONFIG_X86_HT | ||
608 | c->phys_proc_id = c->initial_apicid; | ||
609 | #endif | ||
610 | } | ||
424 | 611 | ||
612 | get_model_name(c); /* Default name */ | ||
425 | 613 | ||
614 | init_scattered_cpuid_features(c); | ||
615 | detect_nopl(c); | ||
616 | } | ||
426 | 617 | ||
427 | /* | 618 | /* |
428 | * This does the hard work of actually picking apart the CPU stuff... | 619 | * This does the hard work of actually picking apart the CPU stuff... |
@@ -434,12 +625,18 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
434 | c->loops_per_jiffy = loops_per_jiffy; | 625 | c->loops_per_jiffy = loops_per_jiffy; |
435 | c->x86_cache_size = -1; | 626 | c->x86_cache_size = -1; |
436 | c->x86_vendor = X86_VENDOR_UNKNOWN; | 627 | c->x86_vendor = X86_VENDOR_UNKNOWN; |
437 | c->cpuid_level = -1; /* CPUID not detected */ | ||
438 | c->x86_model = c->x86_mask = 0; /* So far unknown... */ | 628 | c->x86_model = c->x86_mask = 0; /* So far unknown... */ |
439 | c->x86_vendor_id[0] = '\0'; /* Unset */ | 629 | c->x86_vendor_id[0] = '\0'; /* Unset */ |
440 | c->x86_model_id[0] = '\0'; /* Unset */ | 630 | c->x86_model_id[0] = '\0'; /* Unset */ |
441 | c->x86_max_cores = 1; | 631 | c->x86_max_cores = 1; |
632 | c->x86_coreid_bits = 0; | ||
633 | #ifdef CONFIG_X86_64 | ||
634 | c->x86_clflush_size = 64; | ||
635 | #else | ||
636 | c->cpuid_level = -1; /* CPUID not detected */ | ||
442 | c->x86_clflush_size = 32; | 637 | c->x86_clflush_size = 32; |
638 | #endif | ||
639 | c->x86_cache_alignment = c->x86_clflush_size; | ||
443 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | 640 | memset(&c->x86_capability, 0, sizeof c->x86_capability); |
444 | 641 | ||
445 | if (!have_cpuid_p()) { | 642 | if (!have_cpuid_p()) { |
@@ -458,6 +655,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
458 | if (this_cpu->c_identify) | 655 | if (this_cpu->c_identify) |
459 | this_cpu->c_identify(c); | 656 | this_cpu->c_identify(c); |
460 | 657 | ||
658 | #ifdef CONFIG_X86_64 | ||
659 | c->apicid = phys_pkg_id(0); | ||
660 | #endif | ||
661 | |||
461 | /* | 662 | /* |
462 | * Vendor-specific initialization. In this section we | 663 | * Vendor-specific initialization. In this section we |
463 | * canonicalize the feature flags, meaning if there are | 664 | * canonicalize the feature flags, meaning if there are |
@@ -491,6 +692,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
491 | c->x86, c->x86_model); | 692 | c->x86, c->x86_model); |
492 | } | 693 | } |
493 | 694 | ||
695 | #ifdef CONFIG_X86_64 | ||
696 | detect_ht(c); | ||
697 | #endif | ||
698 | |||
494 | /* | 699 | /* |
495 | * On SMP, boot_cpu_data holds the common feature set between | 700 | * On SMP, boot_cpu_data holds the common feature set between |
496 | * all CPUs; so make sure that we indicate which features are | 701 | * all CPUs; so make sure that we indicate which features are |
@@ -499,7 +704,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
499 | */ | 704 | */ |
500 | if (c != &boot_cpu_data) { | 705 | if (c != &boot_cpu_data) { |
501 | /* AND the already accumulated flags with these */ | 706 | /* AND the already accumulated flags with these */ |
502 | for (i = 0 ; i < NCAPINTS ; i++) | 707 | for (i = 0; i < NCAPINTS; i++) |
503 | boot_cpu_data.x86_capability[i] &= c->x86_capability[i]; | 708 | boot_cpu_data.x86_capability[i] &= c->x86_capability[i]; |
504 | } | 709 | } |
505 | 710 | ||
@@ -507,72 +712,79 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | |||
507 | for (i = 0; i < NCAPINTS; i++) | 712 | for (i = 0; i < NCAPINTS; i++) |
508 | c->x86_capability[i] &= ~cleared_cpu_caps[i]; | 713 | c->x86_capability[i] &= ~cleared_cpu_caps[i]; |
509 | 714 | ||
715 | #ifdef CONFIG_X86_MCE | ||
510 | /* Init Machine Check Exception if available. */ | 716 | /* Init Machine Check Exception if available. */ |
511 | mcheck_init(c); | 717 | mcheck_init(c); |
718 | #endif | ||
512 | 719 | ||
513 | select_idle_routine(c); | 720 | select_idle_routine(c); |
721 | |||
722 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_64) | ||
723 | numa_add_cpu(smp_processor_id()); | ||
724 | #endif | ||
514 | } | 725 | } |
515 | 726 | ||
516 | void __init identify_boot_cpu(void) | 727 | void __init identify_boot_cpu(void) |
517 | { | 728 | { |
518 | identify_cpu(&boot_cpu_data); | 729 | identify_cpu(&boot_cpu_data); |
730 | #ifdef CONFIG_X86_32 | ||
519 | sysenter_setup(); | 731 | sysenter_setup(); |
520 | enable_sep_cpu(); | 732 | enable_sep_cpu(); |
733 | #endif | ||
521 | } | 734 | } |
522 | 735 | ||
523 | void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c) | 736 | void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c) |
524 | { | 737 | { |
525 | BUG_ON(c == &boot_cpu_data); | 738 | BUG_ON(c == &boot_cpu_data); |
526 | identify_cpu(c); | 739 | identify_cpu(c); |
740 | #ifdef CONFIG_X86_32 | ||
527 | enable_sep_cpu(); | 741 | enable_sep_cpu(); |
742 | #endif | ||
528 | mtrr_ap_init(); | 743 | mtrr_ap_init(); |
529 | } | 744 | } |
530 | 745 | ||
531 | #ifdef CONFIG_X86_HT | 746 | struct msr_range { |
532 | void __cpuinit detect_ht(struct cpuinfo_x86 *c) | 747 | unsigned min; |
533 | { | 748 | unsigned max; |
534 | u32 eax, ebx, ecx, edx; | 749 | }; |
535 | int index_msb, core_bits; | ||
536 | |||
537 | cpuid(1, &eax, &ebx, &ecx, &edx); | ||
538 | |||
539 | if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) | ||
540 | return; | ||
541 | |||
542 | smp_num_siblings = (ebx & 0xff0000) >> 16; | ||
543 | 750 | ||
544 | if (smp_num_siblings == 1) { | 751 | static struct msr_range msr_range_array[] __cpuinitdata = { |
545 | printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); | 752 | { 0x00000000, 0x00000418}, |
546 | } else if (smp_num_siblings > 1) { | 753 | { 0xc0000000, 0xc000040b}, |
754 | { 0xc0010000, 0xc0010142}, | ||
755 | { 0xc0011000, 0xc001103b}, | ||
756 | }; | ||
547 | 757 | ||
548 | if (smp_num_siblings > NR_CPUS) { | 758 | static void __cpuinit print_cpu_msr(void) |
549 | printk(KERN_WARNING "CPU: Unsupported number of the " | 759 | { |
550 | "siblings %d", smp_num_siblings); | 760 | unsigned index; |
551 | smp_num_siblings = 1; | 761 | u64 val; |
552 | return; | 762 | int i; |
763 | unsigned index_min, index_max; | ||
764 | |||
765 | for (i = 0; i < ARRAY_SIZE(msr_range_array); i++) { | ||
766 | index_min = msr_range_array[i].min; | ||
767 | index_max = msr_range_array[i].max; | ||
768 | for (index = index_min; index < index_max; index++) { | ||
769 | if (rdmsrl_amd_safe(index, &val)) | ||
770 | continue; | ||
771 | printk(KERN_INFO " MSR%08x: %016llx\n", index, val); | ||
553 | } | 772 | } |
773 | } | ||
774 | } | ||
554 | 775 | ||
555 | index_msb = get_count_order(smp_num_siblings); | 776 | static int show_msr __cpuinitdata; |
556 | c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb); | 777 | static __init int setup_show_msr(char *arg) |
557 | 778 | { | |
558 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | 779 | int num; |
559 | c->phys_proc_id); | ||
560 | |||
561 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; | ||
562 | |||
563 | index_msb = get_count_order(smp_num_siblings) ; | ||
564 | |||
565 | core_bits = get_count_order(c->x86_max_cores); | ||
566 | 780 | ||
567 | c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) & | 781 | get_option(&arg, &num); |
568 | ((1 << core_bits) - 1); | ||
569 | 782 | ||
570 | if (c->x86_max_cores > 1) | 783 | if (num > 0) |
571 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | 784 | show_msr = num; |
572 | c->cpu_core_id); | 785 | return 1; |
573 | } | ||
574 | } | 786 | } |
575 | #endif | 787 | __setup("show_msr=", setup_show_msr); |
576 | 788 | ||
577 | static __init int setup_noclflush(char *arg) | 789 | static __init int setup_noclflush(char *arg) |
578 | { | 790 | { |
@@ -591,17 +803,25 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) | |||
591 | vendor = c->x86_vendor_id; | 803 | vendor = c->x86_vendor_id; |
592 | 804 | ||
593 | if (vendor && strncmp(c->x86_model_id, vendor, strlen(vendor))) | 805 | if (vendor && strncmp(c->x86_model_id, vendor, strlen(vendor))) |
594 | printk("%s ", vendor); | 806 | printk(KERN_CONT "%s ", vendor); |
595 | 807 | ||
596 | if (!c->x86_model_id[0]) | 808 | if (c->x86_model_id[0]) |
597 | printk("%d86", c->x86); | 809 | printk(KERN_CONT "%s", c->x86_model_id); |
598 | else | 810 | else |
599 | printk("%s", c->x86_model_id); | 811 | printk(KERN_CONT "%d86", c->x86); |
600 | 812 | ||
601 | if (c->x86_mask || c->cpuid_level >= 0) | 813 | if (c->x86_mask || c->cpuid_level >= 0) |
602 | printk(" stepping %02x\n", c->x86_mask); | 814 | printk(KERN_CONT " stepping %02x\n", c->x86_mask); |
603 | else | 815 | else |
604 | printk("\n"); | 816 | printk(KERN_CONT "\n"); |
817 | |||
818 | #ifdef CONFIG_SMP | ||
819 | if (c->cpu_index < show_msr) | ||
820 | print_cpu_msr(); | ||
821 | #else | ||
822 | if (show_msr) | ||
823 | print_cpu_msr(); | ||
824 | #endif | ||
605 | } | 825 | } |
606 | 826 | ||
607 | static __init int setup_disablecpuid(char *arg) | 827 | static __init int setup_disablecpuid(char *arg) |
@@ -617,19 +837,89 @@ __setup("clearcpuid=", setup_disablecpuid); | |||
617 | 837 | ||
618 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | 838 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; |
619 | 839 | ||
620 | void __init early_cpu_init(void) | 840 | #ifdef CONFIG_X86_64 |
841 | struct x8664_pda **_cpu_pda __read_mostly; | ||
842 | EXPORT_SYMBOL(_cpu_pda); | ||
843 | |||
844 | struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; | ||
845 | |||
846 | char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss; | ||
847 | |||
848 | void __cpuinit pda_init(int cpu) | ||
621 | { | 849 | { |
622 | struct cpu_vendor_dev *cvdev; | 850 | struct x8664_pda *pda = cpu_pda(cpu); |
851 | |||
852 | /* Setup up data that may be needed in __get_free_pages early */ | ||
853 | loadsegment(fs, 0); | ||
854 | loadsegment(gs, 0); | ||
855 | /* Memory clobbers used to order PDA accessed */ | ||
856 | mb(); | ||
857 | wrmsrl(MSR_GS_BASE, pda); | ||
858 | mb(); | ||
859 | |||
860 | pda->cpunumber = cpu; | ||
861 | pda->irqcount = -1; | ||
862 | pda->kernelstack = (unsigned long)stack_thread_info() - | ||
863 | PDA_STACKOFFSET + THREAD_SIZE; | ||
864 | pda->active_mm = &init_mm; | ||
865 | pda->mmu_state = 0; | ||
866 | |||
867 | if (cpu == 0) { | ||
868 | /* others are initialized in smpboot.c */ | ||
869 | pda->pcurrent = &init_task; | ||
870 | pda->irqstackptr = boot_cpu_stack; | ||
871 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
872 | } else { | ||
873 | if (!pda->irqstackptr) { | ||
874 | pda->irqstackptr = (char *) | ||
875 | __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); | ||
876 | if (!pda->irqstackptr) | ||
877 | panic("cannot allocate irqstack for cpu %d", | ||
878 | cpu); | ||
879 | pda->irqstackptr += IRQSTACKSIZE - 64; | ||
880 | } | ||
881 | |||
882 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) | ||
883 | pda->nodenumber = cpu_to_node(cpu); | ||
884 | } | ||
885 | } | ||
886 | |||
887 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + | ||
888 | DEBUG_STKSZ] __page_aligned_bss; | ||
623 | 889 | ||
624 | for (cvdev = __x86cpuvendor_start ; | 890 | extern asmlinkage void ignore_sysret(void); |
625 | cvdev < __x86cpuvendor_end ; | ||
626 | cvdev++) | ||
627 | cpu_devs[cvdev->vendor] = cvdev->cpu_dev; | ||
628 | 891 | ||
629 | early_cpu_detect(); | 892 | /* May not be marked __init: used by software suspend */ |
630 | validate_pat_support(&boot_cpu_data); | 893 | void syscall_init(void) |
894 | { | ||
895 | /* | ||
896 | * LSTAR and STAR live in a bit strange symbiosis. | ||
897 | * They both write to the same internal register. STAR allows to | ||
898 | * set CS/DS but only a 32bit target. LSTAR sets the 64bit rip. | ||
899 | */ | ||
900 | wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32); | ||
901 | wrmsrl(MSR_LSTAR, system_call); | ||
902 | wrmsrl(MSR_CSTAR, ignore_sysret); | ||
903 | |||
904 | #ifdef CONFIG_IA32_EMULATION | ||
905 | syscall32_cpu_init(); | ||
906 | #endif | ||
907 | |||
908 | /* Flags to clear on syscall */ | ||
909 | wrmsrl(MSR_SYSCALL_MASK, | ||
910 | X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL); | ||
631 | } | 911 | } |
632 | 912 | ||
913 | unsigned long kernel_eflags; | ||
914 | |||
915 | /* | ||
916 | * Copies of the original ist values from the tss are only accessed during | ||
917 | * debugging, no special alignment required. | ||
918 | */ | ||
919 | DEFINE_PER_CPU(struct orig_ist, orig_ist); | ||
920 | |||
921 | #else | ||
922 | |||
633 | /* Make sure %fs is initialized properly in idle threads */ | 923 | /* Make sure %fs is initialized properly in idle threads */ |
634 | struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs) | 924 | struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs) |
635 | { | 925 | { |
@@ -637,25 +927,136 @@ struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs) | |||
637 | regs->fs = __KERNEL_PERCPU; | 927 | regs->fs = __KERNEL_PERCPU; |
638 | return regs; | 928 | return regs; |
639 | } | 929 | } |
640 | 930 | #endif | |
641 | /* Current gdt points %fs at the "master" per-cpu area: after this, | ||
642 | * it's on the real one. */ | ||
643 | void switch_to_new_gdt(void) | ||
644 | { | ||
645 | struct desc_ptr gdt_descr; | ||
646 | |||
647 | gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id()); | ||
648 | gdt_descr.size = GDT_SIZE - 1; | ||
649 | load_gdt(&gdt_descr); | ||
650 | asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory"); | ||
651 | } | ||
652 | 931 | ||
653 | /* | 932 | /* |
654 | * cpu_init() initializes state that is per-CPU. Some data is already | 933 | * cpu_init() initializes state that is per-CPU. Some data is already |
655 | * initialized (naturally) in the bootstrap process, such as the GDT | 934 | * initialized (naturally) in the bootstrap process, such as the GDT |
656 | * and IDT. We reload them nevertheless, this function acts as a | 935 | * and IDT. We reload them nevertheless, this function acts as a |
657 | * 'CPU state barrier', nothing should get across. | 936 | * 'CPU state barrier', nothing should get across. |
937 | * A lot of state is already set up in PDA init for 64 bit | ||
658 | */ | 938 | */ |
939 | #ifdef CONFIG_X86_64 | ||
940 | void __cpuinit cpu_init(void) | ||
941 | { | ||
942 | int cpu = stack_smp_processor_id(); | ||
943 | struct tss_struct *t = &per_cpu(init_tss, cpu); | ||
944 | struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu); | ||
945 | unsigned long v; | ||
946 | char *estacks = NULL; | ||
947 | struct task_struct *me; | ||
948 | int i; | ||
949 | |||
950 | /* CPU 0 is initialised in head64.c */ | ||
951 | if (cpu != 0) | ||
952 | pda_init(cpu); | ||
953 | else | ||
954 | estacks = boot_exception_stacks; | ||
955 | |||
956 | me = current; | ||
957 | |||
958 | if (cpu_test_and_set(cpu, cpu_initialized)) | ||
959 | panic("CPU#%d already initialized!\n", cpu); | ||
960 | |||
961 | printk(KERN_INFO "Initializing CPU#%d\n", cpu); | ||
962 | |||
963 | clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | ||
964 | |||
965 | /* | ||
966 | * Initialize the per-CPU GDT with the boot GDT, | ||
967 | * and set up the GDT descriptor: | ||
968 | */ | ||
969 | |||
970 | switch_to_new_gdt(); | ||
971 | load_idt((const struct desc_ptr *)&idt_descr); | ||
972 | |||
973 | memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); | ||
974 | syscall_init(); | ||
975 | |||
976 | wrmsrl(MSR_FS_BASE, 0); | ||
977 | wrmsrl(MSR_KERNEL_GS_BASE, 0); | ||
978 | barrier(); | ||
979 | |||
980 | check_efer(); | ||
981 | if (cpu != 0 && x2apic) | ||
982 | enable_x2apic(); | ||
983 | |||
984 | /* | ||
985 | * set up and load the per-CPU TSS | ||
986 | */ | ||
987 | if (!orig_ist->ist[0]) { | ||
988 | static const unsigned int order[N_EXCEPTION_STACKS] = { | ||
989 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, | ||
990 | [DEBUG_STACK - 1] = DEBUG_STACK_ORDER | ||
991 | }; | ||
992 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { | ||
993 | if (cpu) { | ||
994 | estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); | ||
995 | if (!estacks) | ||
996 | panic("Cannot allocate exception " | ||
997 | "stack %ld %d\n", v, cpu); | ||
998 | } | ||
999 | estacks += PAGE_SIZE << order[v]; | ||
1000 | orig_ist->ist[v] = t->x86_tss.ist[v] = | ||
1001 | (unsigned long)estacks; | ||
1002 | } | ||
1003 | } | ||
1004 | |||
1005 | t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap); | ||
1006 | /* | ||
1007 | * <= is required because the CPU will access up to | ||
1008 | * 8 bits beyond the end of the IO permission bitmap. | ||
1009 | */ | ||
1010 | for (i = 0; i <= IO_BITMAP_LONGS; i++) | ||
1011 | t->io_bitmap[i] = ~0UL; | ||
1012 | |||
1013 | atomic_inc(&init_mm.mm_count); | ||
1014 | me->active_mm = &init_mm; | ||
1015 | if (me->mm) | ||
1016 | BUG(); | ||
1017 | enter_lazy_tlb(&init_mm, me); | ||
1018 | |||
1019 | load_sp0(t, ¤t->thread); | ||
1020 | set_tss_desc(cpu, t); | ||
1021 | load_TR_desc(); | ||
1022 | load_LDT(&init_mm.context); | ||
1023 | |||
1024 | #ifdef CONFIG_KGDB | ||
1025 | /* | ||
1026 | * If the kgdb is connected no debug regs should be altered. This | ||
1027 | * is only applicable when KGDB and a KGDB I/O module are built | ||
1028 | * into the kernel and you are using early debugging with | ||
1029 | * kgdbwait. KGDB will control the kernel HW breakpoint registers. | ||
1030 | */ | ||
1031 | if (kgdb_connected && arch_kgdb_ops.correct_hw_break) | ||
1032 | arch_kgdb_ops.correct_hw_break(); | ||
1033 | else { | ||
1034 | #endif | ||
1035 | /* | ||
1036 | * Clear all 6 debug registers: | ||
1037 | */ | ||
1038 | |||
1039 | set_debugreg(0UL, 0); | ||
1040 | set_debugreg(0UL, 1); | ||
1041 | set_debugreg(0UL, 2); | ||
1042 | set_debugreg(0UL, 3); | ||
1043 | set_debugreg(0UL, 6); | ||
1044 | set_debugreg(0UL, 7); | ||
1045 | #ifdef CONFIG_KGDB | ||
1046 | /* If the kgdb is connected no debug regs should be altered. */ | ||
1047 | } | ||
1048 | #endif | ||
1049 | |||
1050 | fpu_init(); | ||
1051 | |||
1052 | raw_local_save_flags(kernel_eflags); | ||
1053 | |||
1054 | if (is_uv_system()) | ||
1055 | uv_cpu_init(); | ||
1056 | } | ||
1057 | |||
1058 | #else | ||
1059 | |||
659 | void __cpuinit cpu_init(void) | 1060 | void __cpuinit cpu_init(void) |
660 | { | 1061 | { |
661 | int cpu = smp_processor_id(); | 1062 | int cpu = smp_processor_id(); |
@@ -709,9 +1110,20 @@ void __cpuinit cpu_init(void) | |||
709 | /* | 1110 | /* |
710 | * Force FPU initialization: | 1111 | * Force FPU initialization: |
711 | */ | 1112 | */ |
712 | current_thread_info()->status = 0; | 1113 | if (cpu_has_xsave) |
1114 | current_thread_info()->status = TS_XSAVE; | ||
1115 | else | ||
1116 | current_thread_info()->status = 0; | ||
713 | clear_used_math(); | 1117 | clear_used_math(); |
714 | mxcsr_feature_mask_init(); | 1118 | mxcsr_feature_mask_init(); |
1119 | |||
1120 | /* | ||
1121 | * Boot processor to setup the FP and extended state context info. | ||
1122 | */ | ||
1123 | if (!smp_processor_id()) | ||
1124 | init_thread_xstate(); | ||
1125 | |||
1126 | xsave_init(); | ||
715 | } | 1127 | } |
716 | 1128 | ||
717 | #ifdef CONFIG_HOTPLUG_CPU | 1129 | #ifdef CONFIG_HOTPLUG_CPU |
@@ -725,3 +1137,5 @@ void __cpuinit cpu_uninit(void) | |||
725 | per_cpu(cpu_tlbstate, cpu).active_mm = &init_mm; | 1137 | per_cpu(cpu_tlbstate, cpu).active_mm = &init_mm; |
726 | } | 1138 | } |
727 | #endif | 1139 | #endif |
1140 | |||
1141 | #endif | ||
diff --git a/arch/x86/kernel/cpu/common_64.c b/arch/x86/kernel/cpu/common_64.c deleted file mode 100644 index dd6e3f15017e..000000000000 --- a/arch/x86/kernel/cpu/common_64.c +++ /dev/null | |||
@@ -1,670 +0,0 @@ | |||
1 | #include <linux/init.h> | ||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/sched.h> | ||
4 | #include <linux/string.h> | ||
5 | #include <linux/bootmem.h> | ||
6 | #include <linux/bitops.h> | ||
7 | #include <linux/module.h> | ||
8 | #include <linux/kgdb.h> | ||
9 | #include <linux/topology.h> | ||
10 | #include <linux/delay.h> | ||
11 | #include <linux/smp.h> | ||
12 | #include <linux/percpu.h> | ||
13 | #include <asm/i387.h> | ||
14 | #include <asm/msr.h> | ||
15 | #include <asm/io.h> | ||
16 | #include <asm/linkage.h> | ||
17 | #include <asm/mmu_context.h> | ||
18 | #include <asm/mtrr.h> | ||
19 | #include <asm/mce.h> | ||
20 | #include <asm/pat.h> | ||
21 | #include <asm/numa.h> | ||
22 | #ifdef CONFIG_X86_LOCAL_APIC | ||
23 | #include <asm/mpspec.h> | ||
24 | #include <asm/apic.h> | ||
25 | #include <mach_apic.h> | ||
26 | #endif | ||
27 | #include <asm/pda.h> | ||
28 | #include <asm/pgtable.h> | ||
29 | #include <asm/processor.h> | ||
30 | #include <asm/desc.h> | ||
31 | #include <asm/atomic.h> | ||
32 | #include <asm/proto.h> | ||
33 | #include <asm/sections.h> | ||
34 | #include <asm/setup.h> | ||
35 | #include <asm/genapic.h> | ||
36 | |||
37 | #include "cpu.h" | ||
38 | |||
39 | /* We need valid kernel segments for data and code in long mode too | ||
40 | * IRET will check the segment types kkeil 2000/10/28 | ||
41 | * Also sysret mandates a special GDT layout | ||
42 | */ | ||
43 | /* The TLS descriptors are currently at a different place compared to i386. | ||
44 | Hopefully nobody expects them at a fixed place (Wine?) */ | ||
45 | DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = { | ||
46 | [GDT_ENTRY_KERNEL32_CS] = { { { 0x0000ffff, 0x00cf9b00 } } }, | ||
47 | [GDT_ENTRY_KERNEL_CS] = { { { 0x0000ffff, 0x00af9b00 } } }, | ||
48 | [GDT_ENTRY_KERNEL_DS] = { { { 0x0000ffff, 0x00cf9300 } } }, | ||
49 | [GDT_ENTRY_DEFAULT_USER32_CS] = { { { 0x0000ffff, 0x00cffb00 } } }, | ||
50 | [GDT_ENTRY_DEFAULT_USER_DS] = { { { 0x0000ffff, 0x00cff300 } } }, | ||
51 | [GDT_ENTRY_DEFAULT_USER_CS] = { { { 0x0000ffff, 0x00affb00 } } }, | ||
52 | } }; | ||
53 | EXPORT_PER_CPU_SYMBOL_GPL(gdt_page); | ||
54 | |||
55 | __u32 cleared_cpu_caps[NCAPINTS] __cpuinitdata; | ||
56 | |||
57 | /* Current gdt points %fs at the "master" per-cpu area: after this, | ||
58 | * it's on the real one. */ | ||
59 | void switch_to_new_gdt(void) | ||
60 | { | ||
61 | struct desc_ptr gdt_descr; | ||
62 | |||
63 | gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id()); | ||
64 | gdt_descr.size = GDT_SIZE - 1; | ||
65 | load_gdt(&gdt_descr); | ||
66 | } | ||
67 | |||
68 | struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {}; | ||
69 | |||
70 | static void __cpuinit default_init(struct cpuinfo_x86 *c) | ||
71 | { | ||
72 | display_cacheinfo(c); | ||
73 | } | ||
74 | |||
75 | static struct cpu_dev __cpuinitdata default_cpu = { | ||
76 | .c_init = default_init, | ||
77 | .c_vendor = "Unknown", | ||
78 | }; | ||
79 | static struct cpu_dev *this_cpu __cpuinitdata = &default_cpu; | ||
80 | |||
81 | int __cpuinit get_model_name(struct cpuinfo_x86 *c) | ||
82 | { | ||
83 | unsigned int *v; | ||
84 | |||
85 | if (c->extended_cpuid_level < 0x80000004) | ||
86 | return 0; | ||
87 | |||
88 | v = (unsigned int *) c->x86_model_id; | ||
89 | cpuid(0x80000002, &v[0], &v[1], &v[2], &v[3]); | ||
90 | cpuid(0x80000003, &v[4], &v[5], &v[6], &v[7]); | ||
91 | cpuid(0x80000004, &v[8], &v[9], &v[10], &v[11]); | ||
92 | c->x86_model_id[48] = 0; | ||
93 | return 1; | ||
94 | } | ||
95 | |||
96 | |||
97 | void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c) | ||
98 | { | ||
99 | unsigned int n, dummy, ebx, ecx, edx; | ||
100 | |||
101 | n = c->extended_cpuid_level; | ||
102 | |||
103 | if (n >= 0x80000005) { | ||
104 | cpuid(0x80000005, &dummy, &ebx, &ecx, &edx); | ||
105 | printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), " | ||
106 | "D cache %dK (%d bytes/line)\n", | ||
107 | edx>>24, edx&0xFF, ecx>>24, ecx&0xFF); | ||
108 | c->x86_cache_size = (ecx>>24) + (edx>>24); | ||
109 | /* On K8 L1 TLB is inclusive, so don't count it */ | ||
110 | c->x86_tlbsize = 0; | ||
111 | } | ||
112 | |||
113 | if (n >= 0x80000006) { | ||
114 | cpuid(0x80000006, &dummy, &ebx, &ecx, &edx); | ||
115 | ecx = cpuid_ecx(0x80000006); | ||
116 | c->x86_cache_size = ecx >> 16; | ||
117 | c->x86_tlbsize += ((ebx >> 16) & 0xfff) + (ebx & 0xfff); | ||
118 | |||
119 | printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n", | ||
120 | c->x86_cache_size, ecx & 0xFF); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | void __cpuinit detect_ht(struct cpuinfo_x86 *c) | ||
125 | { | ||
126 | #ifdef CONFIG_SMP | ||
127 | u32 eax, ebx, ecx, edx; | ||
128 | int index_msb, core_bits; | ||
129 | |||
130 | cpuid(1, &eax, &ebx, &ecx, &edx); | ||
131 | |||
132 | |||
133 | if (!cpu_has(c, X86_FEATURE_HT)) | ||
134 | return; | ||
135 | if (cpu_has(c, X86_FEATURE_CMP_LEGACY)) | ||
136 | goto out; | ||
137 | |||
138 | smp_num_siblings = (ebx & 0xff0000) >> 16; | ||
139 | |||
140 | if (smp_num_siblings == 1) { | ||
141 | printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); | ||
142 | } else if (smp_num_siblings > 1) { | ||
143 | |||
144 | if (smp_num_siblings > NR_CPUS) { | ||
145 | printk(KERN_WARNING "CPU: Unsupported number of " | ||
146 | "siblings %d", smp_num_siblings); | ||
147 | smp_num_siblings = 1; | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | index_msb = get_count_order(smp_num_siblings); | ||
152 | c->phys_proc_id = phys_pkg_id(index_msb); | ||
153 | |||
154 | smp_num_siblings = smp_num_siblings / c->x86_max_cores; | ||
155 | |||
156 | index_msb = get_count_order(smp_num_siblings); | ||
157 | |||
158 | core_bits = get_count_order(c->x86_max_cores); | ||
159 | |||
160 | c->cpu_core_id = phys_pkg_id(index_msb) & | ||
161 | ((1 << core_bits) - 1); | ||
162 | } | ||
163 | out: | ||
164 | if ((c->x86_max_cores * smp_num_siblings) > 1) { | ||
165 | printk(KERN_INFO "CPU: Physical Processor ID: %d\n", | ||
166 | c->phys_proc_id); | ||
167 | printk(KERN_INFO "CPU: Processor Core ID: %d\n", | ||
168 | c->cpu_core_id); | ||
169 | } | ||
170 | |||
171 | #endif | ||
172 | } | ||
173 | |||
174 | static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) | ||
175 | { | ||
176 | char *v = c->x86_vendor_id; | ||
177 | int i; | ||
178 | static int printed; | ||
179 | |||
180 | for (i = 0; i < X86_VENDOR_NUM; i++) { | ||
181 | if (cpu_devs[i]) { | ||
182 | if (!strcmp(v, cpu_devs[i]->c_ident[0]) || | ||
183 | (cpu_devs[i]->c_ident[1] && | ||
184 | !strcmp(v, cpu_devs[i]->c_ident[1]))) { | ||
185 | c->x86_vendor = i; | ||
186 | this_cpu = cpu_devs[i]; | ||
187 | return; | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | if (!printed) { | ||
192 | printed++; | ||
193 | printk(KERN_ERR "CPU: Vendor unknown, using generic init.\n"); | ||
194 | printk(KERN_ERR "CPU: Your system may be unstable.\n"); | ||
195 | } | ||
196 | c->x86_vendor = X86_VENDOR_UNKNOWN; | ||
197 | } | ||
198 | |||
199 | static void __init early_cpu_support_print(void) | ||
200 | { | ||
201 | int i,j; | ||
202 | struct cpu_dev *cpu_devx; | ||
203 | |||
204 | printk("KERNEL supported cpus:\n"); | ||
205 | for (i = 0; i < X86_VENDOR_NUM; i++) { | ||
206 | cpu_devx = cpu_devs[i]; | ||
207 | if (!cpu_devx) | ||
208 | continue; | ||
209 | for (j = 0; j < 2; j++) { | ||
210 | if (!cpu_devx->c_ident[j]) | ||
211 | continue; | ||
212 | printk(" %s %s\n", cpu_devx->c_vendor, | ||
213 | cpu_devx->c_ident[j]); | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | |||
218 | static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c); | ||
219 | |||
220 | void __init early_cpu_init(void) | ||
221 | { | ||
222 | struct cpu_vendor_dev *cvdev; | ||
223 | |||
224 | for (cvdev = __x86cpuvendor_start ; | ||
225 | cvdev < __x86cpuvendor_end ; | ||
226 | cvdev++) | ||
227 | cpu_devs[cvdev->vendor] = cvdev->cpu_dev; | ||
228 | early_cpu_support_print(); | ||
229 | early_identify_cpu(&boot_cpu_data); | ||
230 | } | ||
231 | |||
232 | /* Do some early cpuid on the boot CPU to get some parameter that are | ||
233 | needed before check_bugs. Everything advanced is in identify_cpu | ||
234 | below. */ | ||
235 | static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | ||
236 | { | ||
237 | u32 tfms, xlvl; | ||
238 | |||
239 | c->loops_per_jiffy = loops_per_jiffy; | ||
240 | c->x86_cache_size = -1; | ||
241 | c->x86_vendor = X86_VENDOR_UNKNOWN; | ||
242 | c->x86_model = c->x86_mask = 0; /* So far unknown... */ | ||
243 | c->x86_vendor_id[0] = '\0'; /* Unset */ | ||
244 | c->x86_model_id[0] = '\0'; /* Unset */ | ||
245 | c->x86_clflush_size = 64; | ||
246 | c->x86_cache_alignment = c->x86_clflush_size; | ||
247 | c->x86_max_cores = 1; | ||
248 | c->x86_coreid_bits = 0; | ||
249 | c->extended_cpuid_level = 0; | ||
250 | memset(&c->x86_capability, 0, sizeof c->x86_capability); | ||
251 | |||
252 | /* Get vendor name */ | ||
253 | cpuid(0x00000000, (unsigned int *)&c->cpuid_level, | ||
254 | (unsigned int *)&c->x86_vendor_id[0], | ||
255 | (unsigned int *)&c->x86_vendor_id[8], | ||
256 | (unsigned int *)&c->x86_vendor_id[4]); | ||
257 | |||
258 | get_cpu_vendor(c); | ||
259 | |||
260 | /* Initialize the standard set of capabilities */ | ||
261 | /* Note that the vendor-specific code below might override */ | ||
262 | |||
263 | /* Intel-defined flags: level 0x00000001 */ | ||
264 | if (c->cpuid_level >= 0x00000001) { | ||
265 | __u32 misc; | ||
266 | cpuid(0x00000001, &tfms, &misc, &c->x86_capability[4], | ||
267 | &c->x86_capability[0]); | ||
268 | c->x86 = (tfms >> 8) & 0xf; | ||
269 | c->x86_model = (tfms >> 4) & 0xf; | ||
270 | c->x86_mask = tfms & 0xf; | ||
271 | if (c->x86 == 0xf) | ||
272 | c->x86 += (tfms >> 20) & 0xff; | ||
273 | if (c->x86 >= 0x6) | ||
274 | c->x86_model += ((tfms >> 16) & 0xF) << 4; | ||
275 | if (test_cpu_cap(c, X86_FEATURE_CLFLSH)) | ||
276 | c->x86_clflush_size = ((misc >> 8) & 0xff) * 8; | ||
277 | } else { | ||
278 | /* Have CPUID level 0 only - unheard of */ | ||
279 | c->x86 = 4; | ||
280 | } | ||
281 | |||
282 | c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xff; | ||
283 | #ifdef CONFIG_SMP | ||
284 | c->phys_proc_id = c->initial_apicid; | ||
285 | #endif | ||
286 | /* AMD-defined flags: level 0x80000001 */ | ||
287 | xlvl = cpuid_eax(0x80000000); | ||
288 | c->extended_cpuid_level = xlvl; | ||
289 | if ((xlvl & 0xffff0000) == 0x80000000) { | ||
290 | if (xlvl >= 0x80000001) { | ||
291 | c->x86_capability[1] = cpuid_edx(0x80000001); | ||
292 | c->x86_capability[6] = cpuid_ecx(0x80000001); | ||
293 | } | ||
294 | if (xlvl >= 0x80000004) | ||
295 | get_model_name(c); /* Default name */ | ||
296 | } | ||
297 | |||
298 | /* Transmeta-defined flags: level 0x80860001 */ | ||
299 | xlvl = cpuid_eax(0x80860000); | ||
300 | if ((xlvl & 0xffff0000) == 0x80860000) { | ||
301 | /* Don't set x86_cpuid_level here for now to not confuse. */ | ||
302 | if (xlvl >= 0x80860001) | ||
303 | c->x86_capability[2] = cpuid_edx(0x80860001); | ||
304 | } | ||
305 | |||
306 | if (c->extended_cpuid_level >= 0x80000007) | ||
307 | c->x86_power = cpuid_edx(0x80000007); | ||
308 | |||
309 | if (c->extended_cpuid_level >= 0x80000008) { | ||
310 | u32 eax = cpuid_eax(0x80000008); | ||
311 | |||
312 | c->x86_virt_bits = (eax >> 8) & 0xff; | ||
313 | c->x86_phys_bits = eax & 0xff; | ||
314 | } | ||
315 | |||
316 | if (c->x86_vendor != X86_VENDOR_UNKNOWN && | ||
317 | cpu_devs[c->x86_vendor]->c_early_init) | ||
318 | cpu_devs[c->x86_vendor]->c_early_init(c); | ||
319 | |||
320 | validate_pat_support(c); | ||
321 | } | ||
322 | |||
323 | /* | ||
324 | * This does the hard work of actually picking apart the CPU stuff... | ||
325 | */ | ||
326 | static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) | ||
327 | { | ||
328 | int i; | ||
329 | |||
330 | early_identify_cpu(c); | ||
331 | |||
332 | init_scattered_cpuid_features(c); | ||
333 | |||
334 | c->apicid = phys_pkg_id(0); | ||
335 | |||
336 | /* | ||
337 | * Vendor-specific initialization. In this section we | ||
338 | * canonicalize the feature flags, meaning if there are | ||
339 | * features a certain CPU supports which CPUID doesn't | ||
340 | * tell us, CPUID claiming incorrect flags, or other bugs, | ||
341 | * we handle them here. | ||
342 | * | ||
343 | * At the end of this section, c->x86_capability better | ||
344 | * indicate the features this CPU genuinely supports! | ||
345 | */ | ||
346 | if (this_cpu->c_init) | ||
347 | this_cpu->c_init(c); | ||
348 | |||
349 | detect_ht(c); | ||
350 | |||
351 | /* | ||
352 | * On SMP, boot_cpu_data holds the common feature set between | ||
353 | * all CPUs; so make sure that we indicate which features are | ||
354 | * common between the CPUs. The first time this routine gets | ||
355 | * executed, c == &boot_cpu_data. | ||
356 | */ | ||
357 | if (c != &boot_cpu_data) { | ||
358 | /* AND the already accumulated flags with these */ | ||
359 | for (i = 0; i < NCAPINTS; i++) | ||
360 | boot_cpu_data.x86_capability[i] &= c->x86_capability[i]; | ||
361 | } | ||
362 | |||
363 | /* Clear all flags overriden by options */ | ||
364 | for (i = 0; i < NCAPINTS; i++) | ||
365 | c->x86_capability[i] &= ~cleared_cpu_caps[i]; | ||
366 | |||
367 | #ifdef CONFIG_X86_MCE | ||
368 | mcheck_init(c); | ||
369 | #endif | ||
370 | select_idle_routine(c); | ||
371 | |||
372 | #ifdef CONFIG_NUMA | ||
373 | numa_add_cpu(smp_processor_id()); | ||
374 | #endif | ||
375 | |||
376 | } | ||
377 | |||
378 | void __cpuinit identify_boot_cpu(void) | ||
379 | { | ||
380 | identify_cpu(&boot_cpu_data); | ||
381 | } | ||
382 | |||
383 | void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c) | ||
384 | { | ||
385 | BUG_ON(c == &boot_cpu_data); | ||
386 | identify_cpu(c); | ||
387 | mtrr_ap_init(); | ||
388 | } | ||
389 | |||
390 | static __init int setup_noclflush(char *arg) | ||
391 | { | ||
392 | setup_clear_cpu_cap(X86_FEATURE_CLFLSH); | ||
393 | return 1; | ||
394 | } | ||
395 | __setup("noclflush", setup_noclflush); | ||
396 | |||
397 | void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) | ||
398 | { | ||
399 | if (c->x86_model_id[0]) | ||
400 | printk(KERN_CONT "%s", c->x86_model_id); | ||
401 | |||
402 | if (c->x86_mask || c->cpuid_level >= 0) | ||
403 | printk(KERN_CONT " stepping %02x\n", c->x86_mask); | ||
404 | else | ||
405 | printk(KERN_CONT "\n"); | ||
406 | } | ||
407 | |||
408 | static __init int setup_disablecpuid(char *arg) | ||
409 | { | ||
410 | int bit; | ||
411 | if (get_option(&arg, &bit) && bit < NCAPINTS*32) | ||
412 | setup_clear_cpu_cap(bit); | ||
413 | else | ||
414 | return 0; | ||
415 | return 1; | ||
416 | } | ||
417 | __setup("clearcpuid=", setup_disablecpuid); | ||
418 | |||
419 | cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; | ||
420 | |||
421 | struct x8664_pda **_cpu_pda __read_mostly; | ||
422 | EXPORT_SYMBOL(_cpu_pda); | ||
423 | |||
424 | struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table }; | ||
425 | |||
426 | char boot_cpu_stack[IRQSTACKSIZE] __page_aligned_bss; | ||
427 | |||
428 | unsigned long __supported_pte_mask __read_mostly = ~0UL; | ||
429 | EXPORT_SYMBOL_GPL(__supported_pte_mask); | ||
430 | |||
431 | static int do_not_nx __cpuinitdata; | ||
432 | |||
433 | /* noexec=on|off | ||
434 | Control non executable mappings for 64bit processes. | ||
435 | |||
436 | on Enable(default) | ||
437 | off Disable | ||
438 | */ | ||
439 | static int __init nonx_setup(char *str) | ||
440 | { | ||
441 | if (!str) | ||
442 | return -EINVAL; | ||
443 | if (!strncmp(str, "on", 2)) { | ||
444 | __supported_pte_mask |= _PAGE_NX; | ||
445 | do_not_nx = 0; | ||
446 | } else if (!strncmp(str, "off", 3)) { | ||
447 | do_not_nx = 1; | ||
448 | __supported_pte_mask &= ~_PAGE_NX; | ||
449 | } | ||
450 | return 0; | ||
451 | } | ||
452 | early_param("noexec", nonx_setup); | ||
453 | |||
454 | int force_personality32; | ||
455 | |||
456 | /* noexec32=on|off | ||
457 | Control non executable heap for 32bit processes. | ||
458 | To control the stack too use noexec=off | ||
459 | |||
460 | on PROT_READ does not imply PROT_EXEC for 32bit processes (default) | ||
461 | off PROT_READ implies PROT_EXEC | ||
462 | */ | ||
463 | static int __init nonx32_setup(char *str) | ||
464 | { | ||
465 | if (!strcmp(str, "on")) | ||
466 | force_personality32 &= ~READ_IMPLIES_EXEC; | ||
467 | else if (!strcmp(str, "off")) | ||
468 | force_personality32 |= READ_IMPLIES_EXEC; | ||
469 | return 1; | ||
470 | } | ||
471 | __setup("noexec32=", nonx32_setup); | ||
472 | |||
473 | void pda_init(int cpu) | ||
474 | { | ||
475 | struct x8664_pda *pda = cpu_pda(cpu); | ||
476 | |||
477 | /* Setup up data that may be needed in __get_free_pages early */ | ||
478 | loadsegment(fs, 0); | ||
479 | loadsegment(gs, 0); | ||
480 | /* Memory clobbers used to order PDA accessed */ | ||
481 | mb(); | ||
482 | wrmsrl(MSR_GS_BASE, pda); | ||
483 | mb(); | ||
484 | |||
485 | pda->cpunumber = cpu; | ||
486 | pda->irqcount = -1; | ||
487 | pda->kernelstack = (unsigned long)stack_thread_info() - | ||
488 | PDA_STACKOFFSET + THREAD_SIZE; | ||
489 | pda->active_mm = &init_mm; | ||
490 | pda->mmu_state = 0; | ||
491 | |||
492 | if (cpu == 0) { | ||
493 | /* others are initialized in smpboot.c */ | ||
494 | pda->pcurrent = &init_task; | ||
495 | pda->irqstackptr = boot_cpu_stack; | ||
496 | } else { | ||
497 | pda->irqstackptr = (char *) | ||
498 | __get_free_pages(GFP_ATOMIC, IRQSTACK_ORDER); | ||
499 | if (!pda->irqstackptr) | ||
500 | panic("cannot allocate irqstack for cpu %d", cpu); | ||
501 | |||
502 | if (pda->nodenumber == 0 && cpu_to_node(cpu) != NUMA_NO_NODE) | ||
503 | pda->nodenumber = cpu_to_node(cpu); | ||
504 | } | ||
505 | |||
506 | pda->irqstackptr += IRQSTACKSIZE-64; | ||
507 | } | ||
508 | |||
509 | char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + | ||
510 | DEBUG_STKSZ] __page_aligned_bss; | ||
511 | |||
512 | extern asmlinkage void ignore_sysret(void); | ||
513 | |||
514 | /* May not be marked __init: used by software suspend */ | ||
515 | void syscall_init(void) | ||
516 | { | ||
517 | /* | ||
518 | * LSTAR and STAR live in a bit strange symbiosis. | ||
519 | * They both write to the same internal register. STAR allows to | ||
520 | * set CS/DS but only a 32bit target. LSTAR sets the 64bit rip. | ||
521 | */ | ||
522 | wrmsrl(MSR_STAR, ((u64)__USER32_CS)<<48 | ((u64)__KERNEL_CS)<<32); | ||
523 | wrmsrl(MSR_LSTAR, system_call); | ||
524 | wrmsrl(MSR_CSTAR, ignore_sysret); | ||
525 | |||
526 | #ifdef CONFIG_IA32_EMULATION | ||
527 | syscall32_cpu_init(); | ||
528 | #endif | ||
529 | |||
530 | /* Flags to clear on syscall */ | ||
531 | wrmsrl(MSR_SYSCALL_MASK, | ||
532 | X86_EFLAGS_TF|X86_EFLAGS_DF|X86_EFLAGS_IF|X86_EFLAGS_IOPL); | ||
533 | } | ||
534 | |||
535 | void __cpuinit check_efer(void) | ||
536 | { | ||
537 | unsigned long efer; | ||
538 | |||
539 | rdmsrl(MSR_EFER, efer); | ||
540 | if (!(efer & EFER_NX) || do_not_nx) | ||
541 | __supported_pte_mask &= ~_PAGE_NX; | ||
542 | } | ||
543 | |||
544 | unsigned long kernel_eflags; | ||
545 | |||
546 | /* | ||
547 | * Copies of the original ist values from the tss are only accessed during | ||
548 | * debugging, no special alignment required. | ||
549 | */ | ||
550 | DEFINE_PER_CPU(struct orig_ist, orig_ist); | ||
551 | |||
552 | /* | ||
553 | * cpu_init() initializes state that is per-CPU. Some data is already | ||
554 | * initialized (naturally) in the bootstrap process, such as the GDT | ||
555 | * and IDT. We reload them nevertheless, this function acts as a | ||
556 | * 'CPU state barrier', nothing should get across. | ||
557 | * A lot of state is already set up in PDA init. | ||
558 | */ | ||
559 | void __cpuinit cpu_init(void) | ||
560 | { | ||
561 | int cpu = stack_smp_processor_id(); | ||
562 | struct tss_struct *t = &per_cpu(init_tss, cpu); | ||
563 | struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu); | ||
564 | unsigned long v; | ||
565 | char *estacks = NULL; | ||
566 | struct task_struct *me; | ||
567 | int i; | ||
568 | |||
569 | /* CPU 0 is initialised in head64.c */ | ||
570 | if (cpu != 0) | ||
571 | pda_init(cpu); | ||
572 | else | ||
573 | estacks = boot_exception_stacks; | ||
574 | |||
575 | me = current; | ||
576 | |||
577 | if (cpu_test_and_set(cpu, cpu_initialized)) | ||
578 | panic("CPU#%d already initialized!\n", cpu); | ||
579 | |||
580 | printk(KERN_INFO "Initializing CPU#%d\n", cpu); | ||
581 | |||
582 | clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | ||
583 | |||
584 | /* | ||
585 | * Initialize the per-CPU GDT with the boot GDT, | ||
586 | * and set up the GDT descriptor: | ||
587 | */ | ||
588 | |||
589 | switch_to_new_gdt(); | ||
590 | load_idt((const struct desc_ptr *)&idt_descr); | ||
591 | |||
592 | memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); | ||
593 | syscall_init(); | ||
594 | |||
595 | wrmsrl(MSR_FS_BASE, 0); | ||
596 | wrmsrl(MSR_KERNEL_GS_BASE, 0); | ||
597 | barrier(); | ||
598 | |||
599 | check_efer(); | ||
600 | |||
601 | /* | ||
602 | * set up and load the per-CPU TSS | ||
603 | */ | ||
604 | for (v = 0; v < N_EXCEPTION_STACKS; v++) { | ||
605 | static const unsigned int order[N_EXCEPTION_STACKS] = { | ||
606 | [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER, | ||
607 | [DEBUG_STACK - 1] = DEBUG_STACK_ORDER | ||
608 | }; | ||
609 | if (cpu) { | ||
610 | estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]); | ||
611 | if (!estacks) | ||
612 | panic("Cannot allocate exception stack %ld %d\n", | ||
613 | v, cpu); | ||
614 | } | ||
615 | estacks += PAGE_SIZE << order[v]; | ||
616 | orig_ist->ist[v] = t->x86_tss.ist[v] = (unsigned long)estacks; | ||
617 | } | ||
618 | |||
619 | t->x86_tss.io_bitmap_base = offsetof(struct tss_struct, io_bitmap); | ||
620 | /* | ||
621 | * <= is required because the CPU will access up to | ||
622 | * 8 bits beyond the end of the IO permission bitmap. | ||
623 | */ | ||
624 | for (i = 0; i <= IO_BITMAP_LONGS; i++) | ||
625 | t->io_bitmap[i] = ~0UL; | ||
626 | |||
627 | atomic_inc(&init_mm.mm_count); | ||
628 | me->active_mm = &init_mm; | ||
629 | if (me->mm) | ||
630 | BUG(); | ||
631 | enter_lazy_tlb(&init_mm, me); | ||
632 | |||
633 | load_sp0(t, ¤t->thread); | ||
634 | set_tss_desc(cpu, t); | ||
635 | load_TR_desc(); | ||
636 | load_LDT(&init_mm.context); | ||
637 | |||
638 | #ifdef CONFIG_KGDB | ||
639 | /* | ||
640 | * If the kgdb is connected no debug regs should be altered. This | ||
641 | * is only applicable when KGDB and a KGDB I/O module are built | ||
642 | * into the kernel and you are using early debugging with | ||
643 | * kgdbwait. KGDB will control the kernel HW breakpoint registers. | ||
644 | */ | ||
645 | if (kgdb_connected && arch_kgdb_ops.correct_hw_break) | ||
646 | arch_kgdb_ops.correct_hw_break(); | ||
647 | else { | ||
648 | #endif | ||
649 | /* | ||
650 | * Clear all 6 debug registers: | ||
651 | */ | ||
652 | |||
653 | set_debugreg(0UL, 0); | ||
654 | set_debugreg(0UL, 1); | ||
655 | set_debugreg(0UL, 2); | ||
656 | set_debugreg(0UL, 3); | ||
657 | set_debugreg(0UL, 6); | ||
658 | set_debugreg(0UL, 7); | ||
659 | #ifdef CONFIG_KGDB | ||
660 | /* If the kgdb is connected no debug regs should be altered. */ | ||
661 | } | ||
662 | #endif | ||
663 | |||
664 | fpu_init(); | ||
665 | |||
666 | raw_local_save_flags(kernel_eflags); | ||
667 | |||
668 | if (is_uv_system()) | ||
669 | uv_cpu_init(); | ||
670 | } | ||
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h index 4d894e8565fe..de4094a39210 100644 --- a/arch/x86/kernel/cpu/cpu.h +++ b/arch/x86/kernel/cpu/cpu.h | |||
@@ -21,23 +21,16 @@ struct cpu_dev { | |||
21 | void (*c_init)(struct cpuinfo_x86 * c); | 21 | void (*c_init)(struct cpuinfo_x86 * c); |
22 | void (*c_identify)(struct cpuinfo_x86 * c); | 22 | void (*c_identify)(struct cpuinfo_x86 * c); |
23 | unsigned int (*c_size_cache)(struct cpuinfo_x86 * c, unsigned int size); | 23 | unsigned int (*c_size_cache)(struct cpuinfo_x86 * c, unsigned int size); |
24 | int c_x86_vendor; | ||
24 | }; | 25 | }; |
25 | 26 | ||
26 | extern struct cpu_dev * cpu_devs [X86_VENDOR_NUM]; | 27 | #define cpu_dev_register(cpu_devX) \ |
28 | static struct cpu_dev *__cpu_dev_##cpu_devX __used \ | ||
29 | __attribute__((__section__(".x86_cpu_dev.init"))) = \ | ||
30 | &cpu_devX; | ||
27 | 31 | ||
28 | struct cpu_vendor_dev { | 32 | extern struct cpu_dev *__x86_cpu_dev_start[], *__x86_cpu_dev_end[]; |
29 | int vendor; | ||
30 | struct cpu_dev *cpu_dev; | ||
31 | }; | ||
32 | |||
33 | #define cpu_vendor_dev_register(cpu_vendor_id, cpu_dev) \ | ||
34 | static struct cpu_vendor_dev __cpu_vendor_dev_##cpu_vendor_id __used \ | ||
35 | __attribute__((__section__(".x86cpuvendor.init"))) = \ | ||
36 | { cpu_vendor_id, cpu_dev } | ||
37 | |||
38 | extern struct cpu_vendor_dev __x86cpuvendor_start[], __x86cpuvendor_end[]; | ||
39 | 33 | ||
40 | extern int get_model_name(struct cpuinfo_x86 *c); | ||
41 | extern void display_cacheinfo(struct cpuinfo_x86 *c); | 34 | extern void display_cacheinfo(struct cpuinfo_x86 *c); |
42 | 35 | ||
43 | #endif | 36 | #endif |
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig b/arch/x86/kernel/cpu/cpufreq/Kconfig index cb7a5715596d..efae3b22a0ff 100644 --- a/arch/x86/kernel/cpu/cpufreq/Kconfig +++ b/arch/x86/kernel/cpu/cpufreq/Kconfig | |||
@@ -235,9 +235,9 @@ config X86_LONGHAUL | |||
235 | If in doubt, say N. | 235 | If in doubt, say N. |
236 | 236 | ||
237 | config X86_E_POWERSAVER | 237 | config X86_E_POWERSAVER |
238 | tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)" | 238 | tristate "VIA C7 Enhanced PowerSaver" |
239 | select CPU_FREQ_TABLE | 239 | select CPU_FREQ_TABLE |
240 | depends on X86_32 && EXPERIMENTAL | 240 | depends on X86_32 |
241 | help | 241 | help |
242 | This adds the CPUFreq driver for VIA C7 processors. | 242 | This adds the CPUFreq driver for VIA C7 processors. |
243 | 243 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index ff2fff56f0a8..dd097b835839 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -200,12 +200,10 @@ static void drv_read(struct drv_cmd *cmd) | |||
200 | static void drv_write(struct drv_cmd *cmd) | 200 | static void drv_write(struct drv_cmd *cmd) |
201 | { | 201 | { |
202 | cpumask_t saved_mask = current->cpus_allowed; | 202 | cpumask_t saved_mask = current->cpus_allowed; |
203 | cpumask_of_cpu_ptr_declare(cpu_mask); | ||
204 | unsigned int i; | 203 | unsigned int i; |
205 | 204 | ||
206 | for_each_cpu_mask_nr(i, cmd->mask) { | 205 | for_each_cpu_mask_nr(i, cmd->mask) { |
207 | cpumask_of_cpu_ptr_next(cpu_mask, i); | 206 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(i)); |
208 | set_cpus_allowed_ptr(current, cpu_mask); | ||
209 | do_drv_write(cmd); | 207 | do_drv_write(cmd); |
210 | } | 208 | } |
211 | 209 | ||
@@ -269,12 +267,11 @@ static unsigned int get_measured_perf(unsigned int cpu) | |||
269 | } aperf_cur, mperf_cur; | 267 | } aperf_cur, mperf_cur; |
270 | 268 | ||
271 | cpumask_t saved_mask; | 269 | cpumask_t saved_mask; |
272 | cpumask_of_cpu_ptr(cpu_mask, cpu); | ||
273 | unsigned int perf_percent; | 270 | unsigned int perf_percent; |
274 | unsigned int retval; | 271 | unsigned int retval; |
275 | 272 | ||
276 | saved_mask = current->cpus_allowed; | 273 | saved_mask = current->cpus_allowed; |
277 | set_cpus_allowed_ptr(current, cpu_mask); | 274 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
278 | if (get_cpu() != cpu) { | 275 | if (get_cpu() != cpu) { |
279 | /* We were not able to run on requested processor */ | 276 | /* We were not able to run on requested processor */ |
280 | put_cpu(); | 277 | put_cpu(); |
@@ -340,7 +337,6 @@ static unsigned int get_measured_perf(unsigned int cpu) | |||
340 | 337 | ||
341 | static unsigned int get_cur_freq_on_cpu(unsigned int cpu) | 338 | static unsigned int get_cur_freq_on_cpu(unsigned int cpu) |
342 | { | 339 | { |
343 | cpumask_of_cpu_ptr(cpu_mask, cpu); | ||
344 | struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu); | 340 | struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu); |
345 | unsigned int freq; | 341 | unsigned int freq; |
346 | unsigned int cached_freq; | 342 | unsigned int cached_freq; |
@@ -353,7 +349,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu) | |||
353 | } | 349 | } |
354 | 350 | ||
355 | cached_freq = data->freq_table[data->acpi_data->state].frequency; | 351 | cached_freq = data->freq_table[data->acpi_data->state].frequency; |
356 | freq = extract_freq(get_cur_val(cpu_mask), data); | 352 | freq = extract_freq(get_cur_val(&cpumask_of_cpu(cpu)), data); |
357 | if (freq != cached_freq) { | 353 | if (freq != cached_freq) { |
358 | /* | 354 | /* |
359 | * The dreaded BIOS frequency change behind our back. | 355 | * The dreaded BIOS frequency change behind our back. |
diff --git a/arch/x86/kernel/cpu/cpufreq/elanfreq.c b/arch/x86/kernel/cpu/cpufreq/elanfreq.c index 94619c22f563..e4a4bf870e94 100644 --- a/arch/x86/kernel/cpu/cpufreq/elanfreq.c +++ b/arch/x86/kernel/cpu/cpufreq/elanfreq.c | |||
@@ -44,7 +44,7 @@ struct s_elan_multiplier { | |||
44 | * It is important that the frequencies | 44 | * It is important that the frequencies |
45 | * are listed in ascending order here! | 45 | * are listed in ascending order here! |
46 | */ | 46 | */ |
47 | struct s_elan_multiplier elan_multiplier[] = { | 47 | static struct s_elan_multiplier elan_multiplier[] = { |
48 | {1000, 0x02, 0x18}, | 48 | {1000, 0x02, 0x18}, |
49 | {2000, 0x02, 0x10}, | 49 | {2000, 0x02, 0x10}, |
50 | {4000, 0x02, 0x08}, | 50 | {4000, 0x02, 0x08}, |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index 53c7b6936973..84bb395038d8 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -66,7 +66,6 @@ static u32 find_freq_from_fid(u32 fid) | |||
66 | return 800 + (fid * 100); | 66 | return 800 + (fid * 100); |
67 | } | 67 | } |
68 | 68 | ||
69 | |||
70 | /* Return a frequency in KHz, given an input fid */ | 69 | /* Return a frequency in KHz, given an input fid */ |
71 | static u32 find_khz_freq_from_fid(u32 fid) | 70 | static u32 find_khz_freq_from_fid(u32 fid) |
72 | { | 71 | { |
@@ -78,7 +77,6 @@ static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data, u32 p | |||
78 | return data[pstate].frequency; | 77 | return data[pstate].frequency; |
79 | } | 78 | } |
80 | 79 | ||
81 | |||
82 | /* Return the vco fid for an input fid | 80 | /* Return the vco fid for an input fid |
83 | * | 81 | * |
84 | * Each "low" fid has corresponding "high" fid, and you can get to "low" fids | 82 | * Each "low" fid has corresponding "high" fid, and you can get to "low" fids |
@@ -166,7 +164,6 @@ static void fidvid_msr_init(void) | |||
166 | wrmsr(MSR_FIDVID_CTL, lo, hi); | 164 | wrmsr(MSR_FIDVID_CTL, lo, hi); |
167 | } | 165 | } |
168 | 166 | ||
169 | |||
170 | /* write the new fid value along with the other control fields to the msr */ | 167 | /* write the new fid value along with the other control fields to the msr */ |
171 | static int write_new_fid(struct powernow_k8_data *data, u32 fid) | 168 | static int write_new_fid(struct powernow_k8_data *data, u32 fid) |
172 | { | 169 | { |
@@ -479,12 +476,11 @@ static int core_voltage_post_transition(struct powernow_k8_data *data, u32 reqvi | |||
479 | static int check_supported_cpu(unsigned int cpu) | 476 | static int check_supported_cpu(unsigned int cpu) |
480 | { | 477 | { |
481 | cpumask_t oldmask; | 478 | cpumask_t oldmask; |
482 | cpumask_of_cpu_ptr(cpu_mask, cpu); | ||
483 | u32 eax, ebx, ecx, edx; | 479 | u32 eax, ebx, ecx, edx; |
484 | unsigned int rc = 0; | 480 | unsigned int rc = 0; |
485 | 481 | ||
486 | oldmask = current->cpus_allowed; | 482 | oldmask = current->cpus_allowed; |
487 | set_cpus_allowed_ptr(current, cpu_mask); | 483 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
488 | 484 | ||
489 | if (smp_processor_id() != cpu) { | 485 | if (smp_processor_id() != cpu) { |
490 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu); | 486 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu); |
@@ -1017,7 +1013,6 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i | |||
1017 | static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation) | 1013 | static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation) |
1018 | { | 1014 | { |
1019 | cpumask_t oldmask; | 1015 | cpumask_t oldmask; |
1020 | cpumask_of_cpu_ptr(cpu_mask, pol->cpu); | ||
1021 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); | 1016 | struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); |
1022 | u32 checkfid; | 1017 | u32 checkfid; |
1023 | u32 checkvid; | 1018 | u32 checkvid; |
@@ -1032,7 +1027,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
1032 | 1027 | ||
1033 | /* only run on specific CPU from here on */ | 1028 | /* only run on specific CPU from here on */ |
1034 | oldmask = current->cpus_allowed; | 1029 | oldmask = current->cpus_allowed; |
1035 | set_cpus_allowed_ptr(current, cpu_mask); | 1030 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(pol->cpu)); |
1036 | 1031 | ||
1037 | if (smp_processor_id() != pol->cpu) { | 1032 | if (smp_processor_id() != pol->cpu) { |
1038 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); | 1033 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
@@ -1107,7 +1102,6 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1107 | { | 1102 | { |
1108 | struct powernow_k8_data *data; | 1103 | struct powernow_k8_data *data; |
1109 | cpumask_t oldmask; | 1104 | cpumask_t oldmask; |
1110 | cpumask_of_cpu_ptr_declare(newmask); | ||
1111 | int rc; | 1105 | int rc; |
1112 | 1106 | ||
1113 | if (!cpu_online(pol->cpu)) | 1107 | if (!cpu_online(pol->cpu)) |
@@ -1159,8 +1153,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1159 | 1153 | ||
1160 | /* only run on specific CPU from here on */ | 1154 | /* only run on specific CPU from here on */ |
1161 | oldmask = current->cpus_allowed; | 1155 | oldmask = current->cpus_allowed; |
1162 | cpumask_of_cpu_ptr_next(newmask, pol->cpu); | 1156 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(pol->cpu)); |
1163 | set_cpus_allowed_ptr(current, newmask); | ||
1164 | 1157 | ||
1165 | if (smp_processor_id() != pol->cpu) { | 1158 | if (smp_processor_id() != pol->cpu) { |
1166 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); | 1159 | printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); |
@@ -1182,7 +1175,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1182 | set_cpus_allowed_ptr(current, &oldmask); | 1175 | set_cpus_allowed_ptr(current, &oldmask); |
1183 | 1176 | ||
1184 | if (cpu_family == CPU_HW_PSTATE) | 1177 | if (cpu_family == CPU_HW_PSTATE) |
1185 | pol->cpus = *newmask; | 1178 | pol->cpus = cpumask_of_cpu(pol->cpu); |
1186 | else | 1179 | else |
1187 | pol->cpus = per_cpu(cpu_core_map, pol->cpu); | 1180 | pol->cpus = per_cpu(cpu_core_map, pol->cpu); |
1188 | data->available_cores = &(pol->cpus); | 1181 | data->available_cores = &(pol->cpus); |
@@ -1248,7 +1241,6 @@ static unsigned int powernowk8_get (unsigned int cpu) | |||
1248 | { | 1241 | { |
1249 | struct powernow_k8_data *data; | 1242 | struct powernow_k8_data *data; |
1250 | cpumask_t oldmask = current->cpus_allowed; | 1243 | cpumask_t oldmask = current->cpus_allowed; |
1251 | cpumask_of_cpu_ptr(newmask, cpu); | ||
1252 | unsigned int khz = 0; | 1244 | unsigned int khz = 0; |
1253 | unsigned int first; | 1245 | unsigned int first; |
1254 | 1246 | ||
@@ -1258,7 +1250,7 @@ static unsigned int powernowk8_get (unsigned int cpu) | |||
1258 | if (!data) | 1250 | if (!data) |
1259 | return -EINVAL; | 1251 | return -EINVAL; |
1260 | 1252 | ||
1261 | set_cpus_allowed_ptr(current, newmask); | 1253 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
1262 | if (smp_processor_id() != cpu) { | 1254 | if (smp_processor_id() != cpu) { |
1263 | printk(KERN_ERR PFX | 1255 | printk(KERN_ERR PFX |
1264 | "limiting to CPU %d failed in powernowk8_get\n", cpu); | 1256 | "limiting to CPU %d failed in powernowk8_get\n", cpu); |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index ca2ac13b7af2..15e13c01cc36 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -324,10 +324,9 @@ static unsigned int get_cur_freq(unsigned int cpu) | |||
324 | unsigned l, h; | 324 | unsigned l, h; |
325 | unsigned clock_freq; | 325 | unsigned clock_freq; |
326 | cpumask_t saved_mask; | 326 | cpumask_t saved_mask; |
327 | cpumask_of_cpu_ptr(new_mask, cpu); | ||
328 | 327 | ||
329 | saved_mask = current->cpus_allowed; | 328 | saved_mask = current->cpus_allowed; |
330 | set_cpus_allowed_ptr(current, new_mask); | 329 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
331 | if (smp_processor_id() != cpu) | 330 | if (smp_processor_id() != cpu) |
332 | return 0; | 331 | return 0; |
333 | 332 | ||
@@ -585,15 +584,12 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
585 | * Best effort undo.. | 584 | * Best effort undo.. |
586 | */ | 585 | */ |
587 | 586 | ||
588 | if (!cpus_empty(*covered_cpus)) { | 587 | if (!cpus_empty(*covered_cpus)) |
589 | cpumask_of_cpu_ptr_declare(new_mask); | ||
590 | |||
591 | for_each_cpu_mask_nr(j, *covered_cpus) { | 588 | for_each_cpu_mask_nr(j, *covered_cpus) { |
592 | cpumask_of_cpu_ptr_next(new_mask, j); | 589 | set_cpus_allowed_ptr(current, |
593 | set_cpus_allowed_ptr(current, new_mask); | 590 | &cpumask_of_cpu(j)); |
594 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); | 591 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); |
595 | } | 592 | } |
596 | } | ||
597 | 593 | ||
598 | tmp = freqs.new; | 594 | tmp = freqs.new; |
599 | freqs.new = freqs.old; | 595 | freqs.new = freqs.old; |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c index 2f3728dc24f6..191f7263c61d 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | |||
@@ -244,8 +244,7 @@ static unsigned int _speedstep_get(const cpumask_t *cpus) | |||
244 | 244 | ||
245 | static unsigned int speedstep_get(unsigned int cpu) | 245 | static unsigned int speedstep_get(unsigned int cpu) |
246 | { | 246 | { |
247 | cpumask_of_cpu_ptr(newmask, cpu); | 247 | return _speedstep_get(&cpumask_of_cpu(cpu)); |
248 | return _speedstep_get(newmask); | ||
249 | } | 248 | } |
250 | 249 | ||
251 | /** | 250 | /** |
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c index 3fd7a67bb06a..ffd0f5ed071a 100644 --- a/arch/x86/kernel/cpu/cyrix.c +++ b/arch/x86/kernel/cpu/cyrix.c | |||
@@ -15,13 +15,11 @@ | |||
15 | /* | 15 | /* |
16 | * Read NSC/Cyrix DEVID registers (DIR) to get more detailed info. about the CPU | 16 | * Read NSC/Cyrix DEVID registers (DIR) to get more detailed info. about the CPU |
17 | */ | 17 | */ |
18 | static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) | 18 | static void __cpuinit __do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) |
19 | { | 19 | { |
20 | unsigned char ccr2, ccr3; | 20 | unsigned char ccr2, ccr3; |
21 | unsigned long flags; | ||
22 | 21 | ||
23 | /* we test for DEVID by checking whether CCR3 is writable */ | 22 | /* we test for DEVID by checking whether CCR3 is writable */ |
24 | local_irq_save(flags); | ||
25 | ccr3 = getCx86(CX86_CCR3); | 23 | ccr3 = getCx86(CX86_CCR3); |
26 | setCx86(CX86_CCR3, ccr3 ^ 0x80); | 24 | setCx86(CX86_CCR3, ccr3 ^ 0x80); |
27 | getCx86(0xc0); /* dummy to change bus */ | 25 | getCx86(0xc0); /* dummy to change bus */ |
@@ -44,9 +42,16 @@ static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) | |||
44 | *dir0 = getCx86(CX86_DIR0); | 42 | *dir0 = getCx86(CX86_DIR0); |
45 | *dir1 = getCx86(CX86_DIR1); | 43 | *dir1 = getCx86(CX86_DIR1); |
46 | } | 44 | } |
47 | local_irq_restore(flags); | ||
48 | } | 45 | } |
49 | 46 | ||
47 | static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) | ||
48 | { | ||
49 | unsigned long flags; | ||
50 | |||
51 | local_irq_save(flags); | ||
52 | __do_cyrix_devid(dir0, dir1); | ||
53 | local_irq_restore(flags); | ||
54 | } | ||
50 | /* | 55 | /* |
51 | * Cx86_dir0_msb is a HACK needed by check_cx686_cpuid/slop in bugs.h in | 56 | * Cx86_dir0_msb is a HACK needed by check_cx686_cpuid/slop in bugs.h in |
52 | * order to identify the Cyrix CPU model after we're out of setup.c | 57 | * order to identify the Cyrix CPU model after we're out of setup.c |
@@ -116,7 +121,7 @@ static void __cpuinit set_cx86_reorder(void) | |||
116 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | 121 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ |
117 | 122 | ||
118 | /* Load/Store Serialize to mem access disable (=reorder it) */ | 123 | /* Load/Store Serialize to mem access disable (=reorder it) */ |
119 | setCx86(CX86_PCR0, getCx86(CX86_PCR0) & ~0x80); | 124 | setCx86_old(CX86_PCR0, getCx86_old(CX86_PCR0) & ~0x80); |
120 | /* set load/store serialize from 1GB to 4GB */ | 125 | /* set load/store serialize from 1GB to 4GB */ |
121 | ccr3 |= 0xe0; | 126 | ccr3 |= 0xe0; |
122 | setCx86(CX86_CCR3, ccr3); | 127 | setCx86(CX86_CCR3, ccr3); |
@@ -127,28 +132,11 @@ static void __cpuinit set_cx86_memwb(void) | |||
127 | printk(KERN_INFO "Enable Memory-Write-back mode on Cyrix/NSC processor.\n"); | 132 | printk(KERN_INFO "Enable Memory-Write-back mode on Cyrix/NSC processor.\n"); |
128 | 133 | ||
129 | /* CCR2 bit 2: unlock NW bit */ | 134 | /* CCR2 bit 2: unlock NW bit */ |
130 | setCx86(CX86_CCR2, getCx86(CX86_CCR2) & ~0x04); | 135 | setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) & ~0x04); |
131 | /* set 'Not Write-through' */ | 136 | /* set 'Not Write-through' */ |
132 | write_cr0(read_cr0() | X86_CR0_NW); | 137 | write_cr0(read_cr0() | X86_CR0_NW); |
133 | /* CCR2 bit 2: lock NW bit and set WT1 */ | 138 | /* CCR2 bit 2: lock NW bit and set WT1 */ |
134 | setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14); | 139 | setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x14); |
135 | } | ||
136 | |||
137 | static void __cpuinit set_cx86_inc(void) | ||
138 | { | ||
139 | unsigned char ccr3; | ||
140 | |||
141 | printk(KERN_INFO "Enable Incrementor on Cyrix/NSC processor.\n"); | ||
142 | |||
143 | ccr3 = getCx86(CX86_CCR3); | ||
144 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | ||
145 | /* PCR1 -- Performance Control */ | ||
146 | /* Incrementor on, whatever that is */ | ||
147 | setCx86(CX86_PCR1, getCx86(CX86_PCR1) | 0x02); | ||
148 | /* PCR0 -- Performance Control */ | ||
149 | /* Incrementor Margin 10 */ | ||
150 | setCx86(CX86_PCR0, getCx86(CX86_PCR0) | 0x04); | ||
151 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ | ||
152 | } | 140 | } |
153 | 141 | ||
154 | /* | 142 | /* |
@@ -162,23 +150,40 @@ static void __cpuinit geode_configure(void) | |||
162 | local_irq_save(flags); | 150 | local_irq_save(flags); |
163 | 151 | ||
164 | /* Suspend on halt power saving and enable #SUSP pin */ | 152 | /* Suspend on halt power saving and enable #SUSP pin */ |
165 | setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88); | 153 | setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x88); |
166 | 154 | ||
167 | ccr3 = getCx86(CX86_CCR3); | 155 | ccr3 = getCx86(CX86_CCR3); |
168 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | 156 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ |
169 | 157 | ||
170 | 158 | ||
171 | /* FPU fast, DTE cache, Mem bypass */ | 159 | /* FPU fast, DTE cache, Mem bypass */ |
172 | setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x38); | 160 | setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x38); |
173 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ | 161 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ |
174 | 162 | ||
175 | set_cx86_memwb(); | 163 | set_cx86_memwb(); |
176 | set_cx86_reorder(); | 164 | set_cx86_reorder(); |
177 | set_cx86_inc(); | ||
178 | 165 | ||
179 | local_irq_restore(flags); | 166 | local_irq_restore(flags); |
180 | } | 167 | } |
181 | 168 | ||
169 | static void __cpuinit early_init_cyrix(struct cpuinfo_x86 *c) | ||
170 | { | ||
171 | unsigned char dir0, dir0_msn, dir1 = 0; | ||
172 | |||
173 | __do_cyrix_devid(&dir0, &dir1); | ||
174 | dir0_msn = dir0 >> 4; /* identifies CPU "family" */ | ||
175 | |||
176 | switch (dir0_msn) { | ||
177 | case 3: /* 6x86/6x86L */ | ||
178 | /* Emulate MTRRs using Cyrix's ARRs. */ | ||
179 | set_cpu_cap(c, X86_FEATURE_CYRIX_ARR); | ||
180 | break; | ||
181 | case 5: /* 6x86MX/M II */ | ||
182 | /* Emulate MTRRs using Cyrix's ARRs. */ | ||
183 | set_cpu_cap(c, X86_FEATURE_CYRIX_ARR); | ||
184 | break; | ||
185 | } | ||
186 | } | ||
182 | 187 | ||
183 | static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) | 188 | static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) |
184 | { | 189 | { |
@@ -286,7 +291,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) | |||
286 | /* GXm supports extended cpuid levels 'ala' AMD */ | 291 | /* GXm supports extended cpuid levels 'ala' AMD */ |
287 | if (c->cpuid_level == 2) { | 292 | if (c->cpuid_level == 2) { |
288 | /* Enable cxMMX extensions (GX1 Datasheet 54) */ | 293 | /* Enable cxMMX extensions (GX1 Datasheet 54) */ |
289 | setCx86(CX86_CCR7, getCx86(CX86_CCR7) | 1); | 294 | setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7) | 1); |
290 | 295 | ||
291 | /* | 296 | /* |
292 | * GXm : 0x30 ... 0x5f GXm datasheet 51 | 297 | * GXm : 0x30 ... 0x5f GXm datasheet 51 |
@@ -296,7 +301,6 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) | |||
296 | */ | 301 | */ |
297 | if ((0x30 <= dir1 && dir1 <= 0x6f) || (0x80 <= dir1 && dir1 <= 0x8f)) | 302 | if ((0x30 <= dir1 && dir1 <= 0x6f) || (0x80 <= dir1 && dir1 <= 0x8f)) |
298 | geode_configure(); | 303 | geode_configure(); |
299 | get_model_name(c); /* get CPU marketing name */ | ||
300 | return; | 304 | return; |
301 | } else { /* MediaGX */ | 305 | } else { /* MediaGX */ |
302 | Cx86_cb[2] = (dir0_lsn & 1) ? '3' : '4'; | 306 | Cx86_cb[2] = (dir0_lsn & 1) ? '3' : '4'; |
@@ -309,7 +313,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) | |||
309 | if (dir1 > 7) { | 313 | if (dir1 > 7) { |
310 | dir0_msn++; /* M II */ | 314 | dir0_msn++; /* M II */ |
311 | /* Enable MMX extensions (App note 108) */ | 315 | /* Enable MMX extensions (App note 108) */ |
312 | setCx86(CX86_CCR7, getCx86(CX86_CCR7)|1); | 316 | setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7)|1); |
313 | } else { | 317 | } else { |
314 | c->coma_bug = 1; /* 6x86MX, it has the bug. */ | 318 | c->coma_bug = 1; /* 6x86MX, it has the bug. */ |
315 | } | 319 | } |
@@ -424,7 +428,7 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c) | |||
424 | local_irq_save(flags); | 428 | local_irq_save(flags); |
425 | ccr3 = getCx86(CX86_CCR3); | 429 | ccr3 = getCx86(CX86_CCR3); |
426 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ | 430 | setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ |
427 | setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x80); /* enable cpuid */ | 431 | setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80); /* enable cpuid */ |
428 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ | 432 | setCx86(CX86_CCR3, ccr3); /* disable MAPEN */ |
429 | local_irq_restore(flags); | 433 | local_irq_restore(flags); |
430 | } | 434 | } |
@@ -434,16 +438,19 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c) | |||
434 | static struct cpu_dev cyrix_cpu_dev __cpuinitdata = { | 438 | static struct cpu_dev cyrix_cpu_dev __cpuinitdata = { |
435 | .c_vendor = "Cyrix", | 439 | .c_vendor = "Cyrix", |
436 | .c_ident = { "CyrixInstead" }, | 440 | .c_ident = { "CyrixInstead" }, |
441 | .c_early_init = early_init_cyrix, | ||
437 | .c_init = init_cyrix, | 442 | .c_init = init_cyrix, |
438 | .c_identify = cyrix_identify, | 443 | .c_identify = cyrix_identify, |
444 | .c_x86_vendor = X86_VENDOR_CYRIX, | ||
439 | }; | 445 | }; |
440 | 446 | ||
441 | cpu_vendor_dev_register(X86_VENDOR_CYRIX, &cyrix_cpu_dev); | 447 | cpu_dev_register(cyrix_cpu_dev); |
442 | 448 | ||
443 | static struct cpu_dev nsc_cpu_dev __cpuinitdata = { | 449 | static struct cpu_dev nsc_cpu_dev __cpuinitdata = { |
444 | .c_vendor = "NSC", | 450 | .c_vendor = "NSC", |
445 | .c_ident = { "Geode by NSC" }, | 451 | .c_ident = { "Geode by NSC" }, |
446 | .c_init = init_nsc, | 452 | .c_init = init_nsc, |
453 | .c_x86_vendor = X86_VENDOR_NSC, | ||
447 | }; | 454 | }; |
448 | 455 | ||
449 | cpu_vendor_dev_register(X86_VENDOR_NSC, &nsc_cpu_dev); | 456 | cpu_dev_register(nsc_cpu_dev); |
diff --git a/arch/x86/kernel/cpu/feature_names.c b/arch/x86/kernel/cpu/feature_names.c deleted file mode 100644 index e43ad4ad4cba..000000000000 --- a/arch/x86/kernel/cpu/feature_names.c +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* | ||
2 | * Strings for the various x86 capability flags. | ||
3 | * | ||
4 | * This file must not contain any executable code. | ||
5 | */ | ||
6 | |||
7 | #include <asm/cpufeature.h> | ||
8 | |||
9 | /* | ||
10 | * These flag bits must match the definitions in <asm/cpufeature.h>. | ||
11 | * NULL means this bit is undefined or reserved; either way it doesn't | ||
12 | * have meaning as far as Linux is concerned. Note that it's important | ||
13 | * to realize there is a difference between this table and CPUID -- if | ||
14 | * applications want to get the raw CPUID data, they should access | ||
15 | * /dev/cpu/<cpu_nr>/cpuid instead. | ||
16 | */ | ||
17 | const char * const x86_cap_flags[NCAPINTS*32] = { | ||
18 | /* Intel-defined */ | ||
19 | "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", | ||
20 | "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", | ||
21 | "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx", | ||
22 | "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe", | ||
23 | |||
24 | /* AMD-defined */ | ||
25 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
26 | NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, | ||
27 | NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, | ||
28 | NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", | ||
29 | "3dnowext", "3dnow", | ||
30 | |||
31 | /* Transmeta-defined */ | ||
32 | "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, | ||
33 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
34 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
35 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
36 | |||
37 | /* Other (Linux-defined) */ | ||
38 | "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", | ||
39 | NULL, NULL, NULL, NULL, | ||
40 | "constant_tsc", "up", NULL, "arch_perfmon", | ||
41 | "pebs", "bts", NULL, NULL, | ||
42 | "rep_good", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
43 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
44 | |||
45 | /* Intel-defined (#2) */ | ||
46 | "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", | ||
47 | "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, | ||
48 | NULL, NULL, "dca", "sse4_1", "sse4_2", NULL, NULL, "popcnt", | ||
49 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
50 | |||
51 | /* VIA/Cyrix/Centaur-defined */ | ||
52 | NULL, NULL, "rng", "rng_en", NULL, NULL, "ace", "ace_en", | ||
53 | "ace2", "ace2_en", "phe", "phe_en", "pmm", "pmm_en", NULL, NULL, | ||
54 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
55 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
56 | |||
57 | /* AMD-defined (#2) */ | ||
58 | "lahf_lm", "cmp_legacy", "svm", "extapic", | ||
59 | "cr8_legacy", "abm", "sse4a", "misalignsse", | ||
60 | "3dnowprefetch", "osvw", "ibs", "sse5", | ||
61 | "skinit", "wdt", NULL, NULL, | ||
62 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
63 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
64 | |||
65 | /* Auxiliary (Linux-defined) */ | ||
66 | "ida", NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
67 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
68 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
69 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | ||
70 | }; | ||
71 | |||
72 | const char *const x86_power_flags[32] = { | ||
73 | "ts", /* temperature sensor */ | ||
74 | "fid", /* frequency id control */ | ||
75 | "vid", /* voltage id control */ | ||
76 | "ttp", /* thermal trip */ | ||
77 | "tm", | ||
78 | "stc", | ||
79 | "100mhzsteps", | ||
80 | "hwpstate", | ||
81 | "", /* tsc invariant mapped to constant_tsc */ | ||
82 | /* nothing */ | ||
83 | }; | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index f113ef4595f6..a66989586a84 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -23,13 +23,6 @@ | |||
23 | #include <mach_apic.h> | 23 | #include <mach_apic.h> |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #ifdef CONFIG_X86_INTEL_USERCOPY | ||
27 | /* | ||
28 | * Alignment at which movsl is preferred for bulk memory copies. | ||
29 | */ | ||
30 | struct movsl_mask movsl_mask __read_mostly; | ||
31 | #endif | ||
32 | |||
33 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) | 26 | static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) |
34 | { | 27 | { |
35 | /* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */ | 28 | /* Netburst reports 64 bytes clflush size, but does IO in 128 bytes */ |
@@ -83,7 +76,7 @@ static void __cpuinit Intel_errata_workarounds(struct cpuinfo_x86 *c) | |||
83 | /* | 76 | /* |
84 | * find out the number of processor cores on the die | 77 | * find out the number of processor cores on the die |
85 | */ | 78 | */ |
86 | static int __cpuinit num_cpu_cores(struct cpuinfo_x86 *c) | 79 | static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c) |
87 | { | 80 | { |
88 | unsigned int eax, ebx, ecx, edx; | 81 | unsigned int eax, ebx, ecx, edx; |
89 | 82 | ||
@@ -183,9 +176,16 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
183 | if (p) | 176 | if (p) |
184 | strcpy(c->x86_model_id, p); | 177 | strcpy(c->x86_model_id, p); |
185 | 178 | ||
186 | c->x86_max_cores = num_cpu_cores(c); | 179 | detect_extended_topology(c); |
187 | 180 | ||
188 | detect_ht(c); | 181 | if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { |
182 | /* | ||
183 | * let's use the legacy cpuid vector 0x1 and 0x4 for topology | ||
184 | * detection. | ||
185 | */ | ||
186 | c->x86_max_cores = intel_num_cpu_cores(c); | ||
187 | detect_ht(c); | ||
188 | } | ||
189 | 189 | ||
190 | /* Work around errata */ | 190 | /* Work around errata */ |
191 | Intel_errata_workarounds(c); | 191 | Intel_errata_workarounds(c); |
@@ -210,9 +210,8 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
210 | 210 | ||
211 | if (cpu_has_xmm2) | 211 | if (cpu_has_xmm2) |
212 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); | 212 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); |
213 | if (c->x86 == 15) { | 213 | if (c->x86 == 15) |
214 | set_cpu_cap(c, X86_FEATURE_P4); | 214 | set_cpu_cap(c, X86_FEATURE_P4); |
215 | } | ||
216 | if (c->x86 == 6) | 215 | if (c->x86 == 6) |
217 | set_cpu_cap(c, X86_FEATURE_P3); | 216 | set_cpu_cap(c, X86_FEATURE_P3); |
218 | if (cpu_has_ds) { | 217 | if (cpu_has_ds) { |
@@ -311,73 +310,10 @@ static struct cpu_dev intel_cpu_dev __cpuinitdata = { | |||
311 | .c_early_init = early_init_intel, | 310 | .c_early_init = early_init_intel, |
312 | .c_init = init_intel, | 311 | .c_init = init_intel, |
313 | .c_size_cache = intel_size_cache, | 312 | .c_size_cache = intel_size_cache, |
313 | .c_x86_vendor = X86_VENDOR_INTEL, | ||
314 | }; | 314 | }; |
315 | 315 | ||
316 | cpu_vendor_dev_register(X86_VENDOR_INTEL, &intel_cpu_dev); | 316 | cpu_dev_register(intel_cpu_dev); |
317 | |||
318 | #ifndef CONFIG_X86_CMPXCHG | ||
319 | unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new) | ||
320 | { | ||
321 | u8 prev; | ||
322 | unsigned long flags; | ||
323 | |||
324 | /* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
325 | local_irq_save(flags); | ||
326 | prev = *(u8 *)ptr; | ||
327 | if (prev == old) | ||
328 | *(u8 *)ptr = new; | ||
329 | local_irq_restore(flags); | ||
330 | return prev; | ||
331 | } | ||
332 | EXPORT_SYMBOL(cmpxchg_386_u8); | ||
333 | |||
334 | unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new) | ||
335 | { | ||
336 | u16 prev; | ||
337 | unsigned long flags; | ||
338 | |||
339 | /* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
340 | local_irq_save(flags); | ||
341 | prev = *(u16 *)ptr; | ||
342 | if (prev == old) | ||
343 | *(u16 *)ptr = new; | ||
344 | local_irq_restore(flags); | ||
345 | return prev; | ||
346 | } | ||
347 | EXPORT_SYMBOL(cmpxchg_386_u16); | ||
348 | |||
349 | unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new) | ||
350 | { | ||
351 | u32 prev; | ||
352 | unsigned long flags; | ||
353 | |||
354 | /* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
355 | local_irq_save(flags); | ||
356 | prev = *(u32 *)ptr; | ||
357 | if (prev == old) | ||
358 | *(u32 *)ptr = new; | ||
359 | local_irq_restore(flags); | ||
360 | return prev; | ||
361 | } | ||
362 | EXPORT_SYMBOL(cmpxchg_386_u32); | ||
363 | #endif | ||
364 | |||
365 | #ifndef CONFIG_X86_CMPXCHG64 | ||
366 | unsigned long long cmpxchg_486_u64(volatile void *ptr, u64 old, u64 new) | ||
367 | { | ||
368 | u64 prev; | ||
369 | unsigned long flags; | ||
370 | |||
371 | /* Poor man's cmpxchg8b for 386 and 486. Unsuitable for SMP */ | ||
372 | local_irq_save(flags); | ||
373 | prev = *(u64 *)ptr; | ||
374 | if (prev == old) | ||
375 | *(u64 *)ptr = new; | ||
376 | local_irq_restore(flags); | ||
377 | return prev; | ||
378 | } | ||
379 | EXPORT_SYMBOL(cmpxchg_486_u64); | ||
380 | #endif | ||
381 | 317 | ||
382 | /* arch_initcall(intel_cpu_init); */ | 318 | /* arch_initcall(intel_cpu_init); */ |
383 | 319 | ||
diff --git a/arch/x86/kernel/cpu/intel_64.c b/arch/x86/kernel/cpu/intel_64.c index 1019c58d39f0..aef4f2826313 100644 --- a/arch/x86/kernel/cpu/intel_64.c +++ b/arch/x86/kernel/cpu/intel_64.c | |||
@@ -54,6 +54,8 @@ static void __cpuinit srat_detect_node(void) | |||
54 | 54 | ||
55 | static void __cpuinit init_intel(struct cpuinfo_x86 *c) | 55 | static void __cpuinit init_intel(struct cpuinfo_x86 *c) |
56 | { | 56 | { |
57 | early_init_intel(c); | ||
58 | |||
57 | init_intel_cacheinfo(c); | 59 | init_intel_cacheinfo(c); |
58 | if (c->cpuid_level > 9) { | 60 | if (c->cpuid_level > 9) { |
59 | unsigned eax = cpuid_eax(10); | 61 | unsigned eax = cpuid_eax(10); |
@@ -69,18 +71,19 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
69 | set_cpu_cap(c, X86_FEATURE_BTS); | 71 | set_cpu_cap(c, X86_FEATURE_BTS); |
70 | if (!(l1 & (1<<12))) | 72 | if (!(l1 & (1<<12))) |
71 | set_cpu_cap(c, X86_FEATURE_PEBS); | 73 | set_cpu_cap(c, X86_FEATURE_PEBS); |
72 | } | ||
73 | |||
74 | |||
75 | if (cpu_has_bts) | ||
76 | ds_init_intel(c); | 74 | ds_init_intel(c); |
75 | } | ||
77 | 76 | ||
78 | if (c->x86 == 15) | 77 | if (c->x86 == 15) |
79 | c->x86_cache_alignment = c->x86_clflush_size * 2; | 78 | c->x86_cache_alignment = c->x86_clflush_size * 2; |
80 | if (c->x86 == 6) | 79 | if (c->x86 == 6) |
81 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); | 80 | set_cpu_cap(c, X86_FEATURE_REP_GOOD); |
82 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); | 81 | if (cpu_has_xmm2) |
83 | c->x86_max_cores = intel_num_cpu_cores(c); | 82 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); |
83 | |||
84 | detect_extended_topology(c); | ||
85 | if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) | ||
86 | c->x86_max_cores = intel_num_cpu_cores(c); | ||
84 | 87 | ||
85 | srat_detect_node(); | 88 | srat_detect_node(); |
86 | } | 89 | } |
@@ -90,6 +93,7 @@ static struct cpu_dev intel_cpu_dev __cpuinitdata = { | |||
90 | .c_ident = { "GenuineIntel" }, | 93 | .c_ident = { "GenuineIntel" }, |
91 | .c_early_init = early_init_intel, | 94 | .c_early_init = early_init_intel, |
92 | .c_init = init_intel, | 95 | .c_init = init_intel, |
96 | .c_x86_vendor = X86_VENDOR_INTEL, | ||
93 | }; | 97 | }; |
94 | cpu_vendor_dev_register(X86_VENDOR_INTEL, &intel_cpu_dev); | ||
95 | 98 | ||
99 | cpu_dev_register(intel_cpu_dev); | ||
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 650d40f7912b..3f46afbb1cf1 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Routines to indentify caches on Intel CPU. | 2 | * Routines to indentify caches on Intel CPU. |
3 | * | 3 | * |
4 | * Changes: | 4 | * Changes: |
5 | * Venkatesh Pallipadi : Adding cache identification through cpuid(4) | 5 | * Venkatesh Pallipadi : Adding cache identification through cpuid(4) |
6 | * Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure. | 6 | * Ashok Raj <ashok.raj@intel.com>: Work with CPU hotplug infrastructure. |
7 | * Andi Kleen / Andreas Herrmann : CPUID4 emulation on AMD. | 7 | * Andi Kleen / Andreas Herrmann : CPUID4 emulation on AMD. |
8 | */ | 8 | */ |
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
14 | #include <linux/cpu.h> | 14 | #include <linux/cpu.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/pci.h> | ||
16 | 17 | ||
17 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
18 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
@@ -130,9 +131,18 @@ struct _cpuid4_info { | |||
130 | union _cpuid4_leaf_ebx ebx; | 131 | union _cpuid4_leaf_ebx ebx; |
131 | union _cpuid4_leaf_ecx ecx; | 132 | union _cpuid4_leaf_ecx ecx; |
132 | unsigned long size; | 133 | unsigned long size; |
134 | unsigned long can_disable; | ||
133 | cpumask_t shared_cpu_map; /* future?: only cpus/node is needed */ | 135 | cpumask_t shared_cpu_map; /* future?: only cpus/node is needed */ |
134 | }; | 136 | }; |
135 | 137 | ||
138 | #ifdef CONFIG_PCI | ||
139 | static struct pci_device_id k8_nb_id[] = { | ||
140 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1103) }, | ||
141 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1203) }, | ||
142 | {} | ||
143 | }; | ||
144 | #endif | ||
145 | |||
136 | unsigned short num_cache_leaves; | 146 | unsigned short num_cache_leaves; |
137 | 147 | ||
138 | /* AMD doesn't have CPUID4. Emulate it here to report the same | 148 | /* AMD doesn't have CPUID4. Emulate it here to report the same |
@@ -182,9 +192,10 @@ static unsigned short assocs[] __cpuinitdata = { | |||
182 | static unsigned char levels[] __cpuinitdata = { 1, 1, 2, 3 }; | 192 | static unsigned char levels[] __cpuinitdata = { 1, 1, 2, 3 }; |
183 | static unsigned char types[] __cpuinitdata = { 1, 2, 3, 3 }; | 193 | static unsigned char types[] __cpuinitdata = { 1, 2, 3, 3 }; |
184 | 194 | ||
185 | static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, | 195 | static void __cpuinit |
186 | union _cpuid4_leaf_ebx *ebx, | 196 | amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, |
187 | union _cpuid4_leaf_ecx *ecx) | 197 | union _cpuid4_leaf_ebx *ebx, |
198 | union _cpuid4_leaf_ecx *ecx) | ||
188 | { | 199 | { |
189 | unsigned dummy; | 200 | unsigned dummy; |
190 | unsigned line_size, lines_per_tag, assoc, size_in_kb; | 201 | unsigned line_size, lines_per_tag, assoc, size_in_kb; |
@@ -251,27 +262,40 @@ static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, | |||
251 | (ebx->split.ways_of_associativity + 1) - 1; | 262 | (ebx->split.ways_of_associativity + 1) - 1; |
252 | } | 263 | } |
253 | 264 | ||
254 | static int __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | 265 | static void __cpuinit |
266 | amd_check_l3_disable(int index, struct _cpuid4_info *this_leaf) | ||
267 | { | ||
268 | if (index < 3) | ||
269 | return; | ||
270 | this_leaf->can_disable = 1; | ||
271 | } | ||
272 | |||
273 | static int | ||
274 | __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | ||
255 | { | 275 | { |
256 | union _cpuid4_leaf_eax eax; | 276 | union _cpuid4_leaf_eax eax; |
257 | union _cpuid4_leaf_ebx ebx; | 277 | union _cpuid4_leaf_ebx ebx; |
258 | union _cpuid4_leaf_ecx ecx; | 278 | union _cpuid4_leaf_ecx ecx; |
259 | unsigned edx; | 279 | unsigned edx; |
260 | 280 | ||
261 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) | 281 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { |
262 | amd_cpuid4(index, &eax, &ebx, &ecx); | 282 | amd_cpuid4(index, &eax, &ebx, &ecx); |
263 | else | 283 | if (boot_cpu_data.x86 >= 0x10) |
264 | cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); | 284 | amd_check_l3_disable(index, this_leaf); |
285 | } else { | ||
286 | cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); | ||
287 | } | ||
288 | |||
265 | if (eax.split.type == CACHE_TYPE_NULL) | 289 | if (eax.split.type == CACHE_TYPE_NULL) |
266 | return -EIO; /* better error ? */ | 290 | return -EIO; /* better error ? */ |
267 | 291 | ||
268 | this_leaf->eax = eax; | 292 | this_leaf->eax = eax; |
269 | this_leaf->ebx = ebx; | 293 | this_leaf->ebx = ebx; |
270 | this_leaf->ecx = ecx; | 294 | this_leaf->ecx = ecx; |
271 | this_leaf->size = (ecx.split.number_of_sets + 1) * | 295 | this_leaf->size = (ecx.split.number_of_sets + 1) * |
272 | (ebx.split.coherency_line_size + 1) * | 296 | (ebx.split.coherency_line_size + 1) * |
273 | (ebx.split.physical_line_partition + 1) * | 297 | (ebx.split.physical_line_partition + 1) * |
274 | (ebx.split.ways_of_associativity + 1); | 298 | (ebx.split.ways_of_associativity + 1); |
275 | return 0; | 299 | return 0; |
276 | } | 300 | } |
277 | 301 | ||
@@ -453,7 +477,7 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
453 | 477 | ||
454 | /* pointer to _cpuid4_info array (for each cache leaf) */ | 478 | /* pointer to _cpuid4_info array (for each cache leaf) */ |
455 | static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info); | 479 | static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info); |
456 | #define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y])) | 480 | #define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y])) |
457 | 481 | ||
458 | #ifdef CONFIG_SMP | 482 | #ifdef CONFIG_SMP |
459 | static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | 483 | static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) |
@@ -490,7 +514,7 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) | |||
490 | 514 | ||
491 | this_leaf = CPUID4_INFO_IDX(cpu, index); | 515 | this_leaf = CPUID4_INFO_IDX(cpu, index); |
492 | for_each_cpu_mask_nr(sibling, this_leaf->shared_cpu_map) { | 516 | for_each_cpu_mask_nr(sibling, this_leaf->shared_cpu_map) { |
493 | sibling_leaf = CPUID4_INFO_IDX(sibling, index); | 517 | sibling_leaf = CPUID4_INFO_IDX(sibling, index); |
494 | cpu_clear(cpu, sibling_leaf->shared_cpu_map); | 518 | cpu_clear(cpu, sibling_leaf->shared_cpu_map); |
495 | } | 519 | } |
496 | } | 520 | } |
@@ -516,7 +540,6 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu) | |||
516 | unsigned long j; | 540 | unsigned long j; |
517 | int retval; | 541 | int retval; |
518 | cpumask_t oldmask; | 542 | cpumask_t oldmask; |
519 | cpumask_of_cpu_ptr(newmask, cpu); | ||
520 | 543 | ||
521 | if (num_cache_leaves == 0) | 544 | if (num_cache_leaves == 0) |
522 | return -ENOENT; | 545 | return -ENOENT; |
@@ -527,7 +550,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu) | |||
527 | return -ENOMEM; | 550 | return -ENOMEM; |
528 | 551 | ||
529 | oldmask = current->cpus_allowed; | 552 | oldmask = current->cpus_allowed; |
530 | retval = set_cpus_allowed_ptr(current, newmask); | 553 | retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
531 | if (retval) | 554 | if (retval) |
532 | goto out; | 555 | goto out; |
533 | 556 | ||
@@ -573,7 +596,7 @@ struct _index_kobject { | |||
573 | 596 | ||
574 | /* pointer to array of kobjects for cpuX/cache/indexY */ | 597 | /* pointer to array of kobjects for cpuX/cache/indexY */ |
575 | static DEFINE_PER_CPU(struct _index_kobject *, index_kobject); | 598 | static DEFINE_PER_CPU(struct _index_kobject *, index_kobject); |
576 | #define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(index_kobject, x))[y])) | 599 | #define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(index_kobject, x))[y])) |
577 | 600 | ||
578 | #define show_one_plus(file_name, object, val) \ | 601 | #define show_one_plus(file_name, object, val) \ |
579 | static ssize_t show_##file_name \ | 602 | static ssize_t show_##file_name \ |
@@ -638,6 +661,99 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf) { | |||
638 | } | 661 | } |
639 | } | 662 | } |
640 | 663 | ||
664 | #define to_object(k) container_of(k, struct _index_kobject, kobj) | ||
665 | #define to_attr(a) container_of(a, struct _cache_attr, attr) | ||
666 | |||
667 | #ifdef CONFIG_PCI | ||
668 | static struct pci_dev *get_k8_northbridge(int node) | ||
669 | { | ||
670 | struct pci_dev *dev = NULL; | ||
671 | int i; | ||
672 | |||
673 | for (i = 0; i <= node; i++) { | ||
674 | do { | ||
675 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); | ||
676 | if (!dev) | ||
677 | break; | ||
678 | } while (!pci_match_id(&k8_nb_id[0], dev)); | ||
679 | if (!dev) | ||
680 | break; | ||
681 | } | ||
682 | return dev; | ||
683 | } | ||
684 | #else | ||
685 | static struct pci_dev *get_k8_northbridge(int node) | ||
686 | { | ||
687 | return NULL; | ||
688 | } | ||
689 | #endif | ||
690 | |||
691 | static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf) | ||
692 | { | ||
693 | int node = cpu_to_node(first_cpu(this_leaf->shared_cpu_map)); | ||
694 | struct pci_dev *dev = NULL; | ||
695 | ssize_t ret = 0; | ||
696 | int i; | ||
697 | |||
698 | if (!this_leaf->can_disable) | ||
699 | return sprintf(buf, "Feature not enabled\n"); | ||
700 | |||
701 | dev = get_k8_northbridge(node); | ||
702 | if (!dev) { | ||
703 | printk(KERN_ERR "Attempting AMD northbridge operation on a system with no northbridge\n"); | ||
704 | return -EINVAL; | ||
705 | } | ||
706 | |||
707 | for (i = 0; i < 2; i++) { | ||
708 | unsigned int reg; | ||
709 | |||
710 | pci_read_config_dword(dev, 0x1BC + i * 4, ®); | ||
711 | |||
712 | ret += sprintf(buf, "%sEntry: %d\n", buf, i); | ||
713 | ret += sprintf(buf, "%sReads: %s\tNew Entries: %s\n", | ||
714 | buf, | ||
715 | reg & 0x80000000 ? "Disabled" : "Allowed", | ||
716 | reg & 0x40000000 ? "Disabled" : "Allowed"); | ||
717 | ret += sprintf(buf, "%sSubCache: %x\tIndex: %x\n", | ||
718 | buf, (reg & 0x30000) >> 16, reg & 0xfff); | ||
719 | } | ||
720 | return ret; | ||
721 | } | ||
722 | |||
723 | static ssize_t | ||
724 | store_cache_disable(struct _cpuid4_info *this_leaf, const char *buf, | ||
725 | size_t count) | ||
726 | { | ||
727 | int node = cpu_to_node(first_cpu(this_leaf->shared_cpu_map)); | ||
728 | struct pci_dev *dev = NULL; | ||
729 | unsigned int ret, index, val; | ||
730 | |||
731 | if (!this_leaf->can_disable) | ||
732 | return 0; | ||
733 | |||
734 | if (strlen(buf) > 15) | ||
735 | return -EINVAL; | ||
736 | |||
737 | ret = sscanf(buf, "%x %x", &index, &val); | ||
738 | if (ret != 2) | ||
739 | return -EINVAL; | ||
740 | if (index > 1) | ||
741 | return -EINVAL; | ||
742 | |||
743 | val |= 0xc0000000; | ||
744 | dev = get_k8_northbridge(node); | ||
745 | if (!dev) { | ||
746 | printk(KERN_ERR "Attempting AMD northbridge operation on a system with no northbridge\n"); | ||
747 | return -EINVAL; | ||
748 | } | ||
749 | |||
750 | pci_write_config_dword(dev, 0x1BC + index * 4, val & ~0x40000000); | ||
751 | wbinvd(); | ||
752 | pci_write_config_dword(dev, 0x1BC + index * 4, val); | ||
753 | |||
754 | return 1; | ||
755 | } | ||
756 | |||
641 | struct _cache_attr { | 757 | struct _cache_attr { |
642 | struct attribute attr; | 758 | struct attribute attr; |
643 | ssize_t (*show)(struct _cpuid4_info *, char *); | 759 | ssize_t (*show)(struct _cpuid4_info *, char *); |
@@ -658,6 +774,8 @@ define_one_ro(size); | |||
658 | define_one_ro(shared_cpu_map); | 774 | define_one_ro(shared_cpu_map); |
659 | define_one_ro(shared_cpu_list); | 775 | define_one_ro(shared_cpu_list); |
660 | 776 | ||
777 | static struct _cache_attr cache_disable = __ATTR(cache_disable, 0644, show_cache_disable, store_cache_disable); | ||
778 | |||
661 | static struct attribute * default_attrs[] = { | 779 | static struct attribute * default_attrs[] = { |
662 | &type.attr, | 780 | &type.attr, |
663 | &level.attr, | 781 | &level.attr, |
@@ -668,12 +786,10 @@ static struct attribute * default_attrs[] = { | |||
668 | &size.attr, | 786 | &size.attr, |
669 | &shared_cpu_map.attr, | 787 | &shared_cpu_map.attr, |
670 | &shared_cpu_list.attr, | 788 | &shared_cpu_list.attr, |
789 | &cache_disable.attr, | ||
671 | NULL | 790 | NULL |
672 | }; | 791 | }; |
673 | 792 | ||
674 | #define to_object(k) container_of(k, struct _index_kobject, kobj) | ||
675 | #define to_attr(a) container_of(a, struct _cache_attr, attr) | ||
676 | |||
677 | static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf) | 793 | static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf) |
678 | { | 794 | { |
679 | struct _cache_attr *fattr = to_attr(attr); | 795 | struct _cache_attr *fattr = to_attr(attr); |
@@ -683,14 +799,22 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr, char * buf) | |||
683 | ret = fattr->show ? | 799 | ret = fattr->show ? |
684 | fattr->show(CPUID4_INFO_IDX(this_leaf->cpu, this_leaf->index), | 800 | fattr->show(CPUID4_INFO_IDX(this_leaf->cpu, this_leaf->index), |
685 | buf) : | 801 | buf) : |
686 | 0; | 802 | 0; |
687 | return ret; | 803 | return ret; |
688 | } | 804 | } |
689 | 805 | ||
690 | static ssize_t store(struct kobject * kobj, struct attribute * attr, | 806 | static ssize_t store(struct kobject * kobj, struct attribute * attr, |
691 | const char * buf, size_t count) | 807 | const char * buf, size_t count) |
692 | { | 808 | { |
693 | return 0; | 809 | struct _cache_attr *fattr = to_attr(attr); |
810 | struct _index_kobject *this_leaf = to_object(kobj); | ||
811 | ssize_t ret; | ||
812 | |||
813 | ret = fattr->store ? | ||
814 | fattr->store(CPUID4_INFO_IDX(this_leaf->cpu, this_leaf->index), | ||
815 | buf, count) : | ||
816 | 0; | ||
817 | return ret; | ||
694 | } | 818 | } |
695 | 819 | ||
696 | static struct sysfs_ops sysfs_ops = { | 820 | static struct sysfs_ops sysfs_ops = { |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index 65a339678ece..4b031a4ac856 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
@@ -759,6 +759,7 @@ static struct sysdev_class mce_sysclass = { | |||
759 | }; | 759 | }; |
760 | 760 | ||
761 | DEFINE_PER_CPU(struct sys_device, device_mce); | 761 | DEFINE_PER_CPU(struct sys_device, device_mce); |
762 | void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu) __cpuinitdata; | ||
762 | 763 | ||
763 | /* Why are there no generic functions for this? */ | 764 | /* Why are there no generic functions for this? */ |
764 | #define ACCESSOR(name, var, start) \ | 765 | #define ACCESSOR(name, var, start) \ |
@@ -859,7 +860,7 @@ error: | |||
859 | return err; | 860 | return err; |
860 | } | 861 | } |
861 | 862 | ||
862 | static void mce_remove_device(unsigned int cpu) | 863 | static __cpuinit void mce_remove_device(unsigned int cpu) |
863 | { | 864 | { |
864 | int i; | 865 | int i; |
865 | 866 | ||
@@ -883,9 +884,13 @@ static int __cpuinit mce_cpu_callback(struct notifier_block *nfb, | |||
883 | case CPU_ONLINE: | 884 | case CPU_ONLINE: |
884 | case CPU_ONLINE_FROZEN: | 885 | case CPU_ONLINE_FROZEN: |
885 | mce_create_device(cpu); | 886 | mce_create_device(cpu); |
887 | if (threshold_cpu_callback) | ||
888 | threshold_cpu_callback(action, cpu); | ||
886 | break; | 889 | break; |
887 | case CPU_DEAD: | 890 | case CPU_DEAD: |
888 | case CPU_DEAD_FROZEN: | 891 | case CPU_DEAD_FROZEN: |
892 | if (threshold_cpu_callback) | ||
893 | threshold_cpu_callback(action, cpu); | ||
889 | mce_remove_device(cpu); | 894 | mce_remove_device(cpu); |
890 | break; | 895 | break; |
891 | } | 896 | } |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c index 88736cadbaa6..5eb390a4b2e9 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c | |||
@@ -628,6 +628,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank) | |||
628 | deallocate_threshold_block(cpu, bank); | 628 | deallocate_threshold_block(cpu, bank); |
629 | 629 | ||
630 | free_out: | 630 | free_out: |
631 | kobject_del(b->kobj); | ||
631 | kobject_put(b->kobj); | 632 | kobject_put(b->kobj); |
632 | kfree(b); | 633 | kfree(b); |
633 | per_cpu(threshold_banks, cpu)[bank] = NULL; | 634 | per_cpu(threshold_banks, cpu)[bank] = NULL; |
@@ -645,14 +646,11 @@ static void threshold_remove_device(unsigned int cpu) | |||
645 | } | 646 | } |
646 | 647 | ||
647 | /* get notified when a cpu comes on/off */ | 648 | /* get notified when a cpu comes on/off */ |
648 | static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb, | 649 | static void __cpuinit amd_64_threshold_cpu_callback(unsigned long action, |
649 | unsigned long action, void *hcpu) | 650 | unsigned int cpu) |
650 | { | 651 | { |
651 | /* cpu was unsigned int to begin with */ | ||
652 | unsigned int cpu = (unsigned long)hcpu; | ||
653 | |||
654 | if (cpu >= NR_CPUS) | 652 | if (cpu >= NR_CPUS) |
655 | goto out; | 653 | return; |
656 | 654 | ||
657 | switch (action) { | 655 | switch (action) { |
658 | case CPU_ONLINE: | 656 | case CPU_ONLINE: |
@@ -666,14 +664,8 @@ static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb, | |||
666 | default: | 664 | default: |
667 | break; | 665 | break; |
668 | } | 666 | } |
669 | out: | ||
670 | return NOTIFY_OK; | ||
671 | } | 667 | } |
672 | 668 | ||
673 | static struct notifier_block threshold_cpu_notifier __cpuinitdata = { | ||
674 | .notifier_call = threshold_cpu_callback, | ||
675 | }; | ||
676 | |||
677 | static __init int threshold_init_device(void) | 669 | static __init int threshold_init_device(void) |
678 | { | 670 | { |
679 | unsigned lcpu = 0; | 671 | unsigned lcpu = 0; |
@@ -684,7 +676,7 @@ static __init int threshold_init_device(void) | |||
684 | if (err) | 676 | if (err) |
685 | return err; | 677 | return err; |
686 | } | 678 | } |
687 | register_hotcpu_notifier(&threshold_cpu_notifier); | 679 | threshold_cpu_callback = amd_64_threshold_cpu_callback; |
688 | return 0; | 680 | return 0; |
689 | } | 681 | } |
690 | 682 | ||
diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl new file mode 100644 index 000000000000..dfea390e1608 --- /dev/null +++ b/arch/x86/kernel/cpu/mkcapflags.pl | |||
@@ -0,0 +1,32 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # Generate the x86_cap_flags[] array from include/asm-x86/cpufeature.h | ||
4 | # | ||
5 | |||
6 | ($in, $out) = @ARGV; | ||
7 | |||
8 | open(IN, "< $in\0") or die "$0: cannot open: $in: $!\n"; | ||
9 | open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n"; | ||
10 | |||
11 | print OUT "#include <asm/cpufeature.h>\n\n"; | ||
12 | print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n"; | ||
13 | |||
14 | while (defined($line = <IN>)) { | ||
15 | if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) { | ||
16 | $macro = $1; | ||
17 | $feature = $2; | ||
18 | $tail = $3; | ||
19 | if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) { | ||
20 | $feature = $1; | ||
21 | } | ||
22 | |||
23 | if ($feature ne '') { | ||
24 | printf OUT "\t%-32s = \"%s\",\n", | ||
25 | "[$macro]", "\L$feature"; | ||
26 | } | ||
27 | } | ||
28 | } | ||
29 | print OUT "};\n"; | ||
30 | |||
31 | close(IN); | ||
32 | close(OUT); | ||
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index 509bd3d9eacd..cb7d3b6a80eb 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -379,6 +379,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base, | |||
379 | unsigned long *size, mtrr_type *type) | 379 | unsigned long *size, mtrr_type *type) |
380 | { | 380 | { |
381 | unsigned int mask_lo, mask_hi, base_lo, base_hi; | 381 | unsigned int mask_lo, mask_hi, base_lo, base_hi; |
382 | unsigned int tmp, hi; | ||
382 | 383 | ||
383 | rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi); | 384 | rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi); |
384 | if ((mask_lo & 0x800) == 0) { | 385 | if ((mask_lo & 0x800) == 0) { |
@@ -392,8 +393,23 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base, | |||
392 | rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi); | 393 | rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi); |
393 | 394 | ||
394 | /* Work out the shifted address mask. */ | 395 | /* Work out the shifted address mask. */ |
395 | mask_lo = size_or_mask | mask_hi << (32 - PAGE_SHIFT) | 396 | tmp = mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT; |
396 | | mask_lo >> PAGE_SHIFT; | 397 | mask_lo = size_or_mask | tmp; |
398 | /* Expand tmp with high bits to all 1s*/ | ||
399 | hi = fls(tmp); | ||
400 | if (hi > 0) { | ||
401 | tmp |= ~((1<<(hi - 1)) - 1); | ||
402 | |||
403 | if (tmp != mask_lo) { | ||
404 | static int once = 1; | ||
405 | |||
406 | if (once) { | ||
407 | printk(KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n"); | ||
408 | once = 0; | ||
409 | } | ||
410 | mask_lo = tmp; | ||
411 | } | ||
412 | } | ||
397 | 413 | ||
398 | /* This works correctly if size is a power of two, i.e. a | 414 | /* This works correctly if size is a power of two, i.e. a |
399 | contiguous range. */ | 415 | contiguous range. */ |
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c index 6f23969c8faf..58ac5d3d4361 100644 --- a/arch/x86/kernel/cpu/mtrr/main.c +++ b/arch/x86/kernel/cpu/mtrr/main.c | |||
@@ -729,7 +729,7 @@ struct var_mtrr_range_state { | |||
729 | mtrr_type type; | 729 | mtrr_type type; |
730 | }; | 730 | }; |
731 | 731 | ||
732 | struct var_mtrr_range_state __initdata range_state[RANGE_NUM]; | 732 | static struct var_mtrr_range_state __initdata range_state[RANGE_NUM]; |
733 | static int __initdata debug_print; | 733 | static int __initdata debug_print; |
734 | 734 | ||
735 | static int __init | 735 | static int __init |
@@ -1496,11 +1496,8 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn) | |||
1496 | 1496 | ||
1497 | /* kvm/qemu doesn't have mtrr set right, don't trim them all */ | 1497 | /* kvm/qemu doesn't have mtrr set right, don't trim them all */ |
1498 | if (!highest_pfn) { | 1498 | if (!highest_pfn) { |
1499 | if (!kvm_para_available()) { | 1499 | WARN(!kvm_para_available(), KERN_WARNING |
1500 | printk(KERN_WARNING | ||
1501 | "WARNING: strange, CPU MTRRs all blank?\n"); | 1500 | "WARNING: strange, CPU MTRRs all blank?\n"); |
1502 | WARN_ON(1); | ||
1503 | } | ||
1504 | return 0; | 1501 | return 0; |
1505 | } | 1502 | } |
1506 | 1503 | ||
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c index de7439f82b92..05cc22dbd4ff 100644 --- a/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c | |||
@@ -478,7 +478,13 @@ static int setup_p4_watchdog(unsigned nmi_hz) | |||
478 | perfctr_msr = MSR_P4_IQ_PERFCTR1; | 478 | perfctr_msr = MSR_P4_IQ_PERFCTR1; |
479 | evntsel_msr = MSR_P4_CRU_ESCR0; | 479 | evntsel_msr = MSR_P4_CRU_ESCR0; |
480 | cccr_msr = MSR_P4_IQ_CCCR1; | 480 | cccr_msr = MSR_P4_IQ_CCCR1; |
481 | cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); | 481 | |
482 | /* Pentium 4 D processors don't support P4_CCCR_OVF_PMI1 */ | ||
483 | if (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_mask == 4) | ||
484 | cccr_val = P4_CCCR_OVF_PMI0; | ||
485 | else | ||
486 | cccr_val = P4_CCCR_OVF_PMI1; | ||
487 | cccr_val |= P4_CCCR_ESCR_SELECT(4); | ||
482 | } | 488 | } |
483 | 489 | ||
484 | evntsel = P4_ESCR_EVENT_SELECT(0x3F) | 490 | evntsel = P4_ESCR_EVENT_SELECT(0x3F) |
diff --git a/arch/x86/kernel/cpu/powerflags.c b/arch/x86/kernel/cpu/powerflags.c new file mode 100644 index 000000000000..5abbea297e0c --- /dev/null +++ b/arch/x86/kernel/cpu/powerflags.c | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Strings for the various x86 power flags | ||
3 | * | ||
4 | * This file must not contain any executable code. | ||
5 | */ | ||
6 | |||
7 | #include <asm/cpufeature.h> | ||
8 | |||
9 | const char *const x86_power_flags[32] = { | ||
10 | "ts", /* temperature sensor */ | ||
11 | "fid", /* frequency id control */ | ||
12 | "vid", /* voltage id control */ | ||
13 | "ttp", /* thermal trip */ | ||
14 | "tm", | ||
15 | "stc", | ||
16 | "100mhzsteps", | ||
17 | "hwpstate", | ||
18 | "", /* tsc invariant mapped to constant_tsc */ | ||
19 | /* nothing */ | ||
20 | }; | ||
diff --git a/arch/x86/kernel/cpu/transmeta.c b/arch/x86/kernel/cpu/transmeta.c index b911a2c61b8f..738e03244f95 100644 --- a/arch/x86/kernel/cpu/transmeta.c +++ b/arch/x86/kernel/cpu/transmeta.c | |||
@@ -12,7 +12,6 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c) | |||
12 | unsigned int cpu_rev, cpu_freq = 0, cpu_flags, new_cpu_rev; | 12 | unsigned int cpu_rev, cpu_freq = 0, cpu_flags, new_cpu_rev; |
13 | char cpu_info[65]; | 13 | char cpu_info[65]; |
14 | 14 | ||
15 | get_model_name(c); /* Same as AMD/Cyrix */ | ||
16 | display_cacheinfo(c); | 15 | display_cacheinfo(c); |
17 | 16 | ||
18 | /* Print CMS and CPU revision */ | 17 | /* Print CMS and CPU revision */ |
@@ -102,6 +101,7 @@ static struct cpu_dev transmeta_cpu_dev __cpuinitdata = { | |||
102 | .c_ident = { "GenuineTMx86", "TransmetaCPU" }, | 101 | .c_ident = { "GenuineTMx86", "TransmetaCPU" }, |
103 | .c_init = init_transmeta, | 102 | .c_init = init_transmeta, |
104 | .c_identify = transmeta_identify, | 103 | .c_identify = transmeta_identify, |
104 | .c_x86_vendor = X86_VENDOR_TRANSMETA, | ||
105 | }; | 105 | }; |
106 | 106 | ||
107 | cpu_vendor_dev_register(X86_VENDOR_TRANSMETA, &transmeta_cpu_dev); | 107 | cpu_dev_register(transmeta_cpu_dev); |
diff --git a/arch/x86/kernel/cpu/umc.c b/arch/x86/kernel/cpu/umc.c index b1fc90989d75..e777f79e0960 100644 --- a/arch/x86/kernel/cpu/umc.c +++ b/arch/x86/kernel/cpu/umc.c | |||
@@ -19,7 +19,8 @@ static struct cpu_dev umc_cpu_dev __cpuinitdata = { | |||
19 | } | 19 | } |
20 | }, | 20 | }, |
21 | }, | 21 | }, |
22 | .c_x86_vendor = X86_VENDOR_UMC, | ||
22 | }; | 23 | }; |
23 | 24 | ||
24 | cpu_vendor_dev_register(X86_VENDOR_UMC, &umc_cpu_dev); | 25 | cpu_dev_register(umc_cpu_dev); |
25 | 26 | ||
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 14b11b3be31c..8e9cd6a8ec12 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -89,6 +89,8 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
89 | struct cpuid_regs cmd; | 89 | struct cpuid_regs cmd; |
90 | int cpu = iminor(file->f_path.dentry->d_inode); | 90 | int cpu = iminor(file->f_path.dentry->d_inode); |
91 | u64 pos = *ppos; | 91 | u64 pos = *ppos; |
92 | ssize_t bytes = 0; | ||
93 | int err = 0; | ||
92 | 94 | ||
93 | if (count % 16) | 95 | if (count % 16) |
94 | return -EINVAL; /* Invalid chunk size */ | 96 | return -EINVAL; /* Invalid chunk size */ |
@@ -96,14 +98,19 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
96 | for (; count; count -= 16) { | 98 | for (; count; count -= 16) { |
97 | cmd.eax = pos; | 99 | cmd.eax = pos; |
98 | cmd.ecx = pos >> 32; | 100 | cmd.ecx = pos >> 32; |
99 | smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); | 101 | err = smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1); |
100 | if (copy_to_user(tmp, &cmd, 16)) | 102 | if (err) |
101 | return -EFAULT; | 103 | break; |
104 | if (copy_to_user(tmp, &cmd, 16)) { | ||
105 | err = -EFAULT; | ||
106 | break; | ||
107 | } | ||
102 | tmp += 16; | 108 | tmp += 16; |
109 | bytes += 16; | ||
103 | *ppos = ++pos; | 110 | *ppos = ++pos; |
104 | } | 111 | } |
105 | 112 | ||
106 | return tmp - buf; | 113 | return bytes ? bytes : err; |
107 | } | 114 | } |
108 | 115 | ||
109 | static int cpuid_open(struct inode *inode, struct file *file) | 116 | static int cpuid_open(struct inode *inode, struct file *file) |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 9af89078f7bb..e24d1bc47b46 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -148,6 +148,9 @@ void __init e820_print_map(char *who) | |||
148 | case E820_NVS: | 148 | case E820_NVS: |
149 | printk(KERN_CONT "(ACPI NVS)\n"); | 149 | printk(KERN_CONT "(ACPI NVS)\n"); |
150 | break; | 150 | break; |
151 | case E820_UNUSABLE: | ||
152 | printk("(unusable)\n"); | ||
153 | break; | ||
151 | default: | 154 | default: |
152 | printk(KERN_CONT "type %u\n", e820.map[i].type); | 155 | printk(KERN_CONT "type %u\n", e820.map[i].type); |
153 | break; | 156 | break; |
@@ -1260,6 +1263,7 @@ static inline const char *e820_type_to_string(int e820_type) | |||
1260 | case E820_RAM: return "System RAM"; | 1263 | case E820_RAM: return "System RAM"; |
1261 | case E820_ACPI: return "ACPI Tables"; | 1264 | case E820_ACPI: return "ACPI Tables"; |
1262 | case E820_NVS: return "ACPI Non-volatile Storage"; | 1265 | case E820_NVS: return "ACPI Non-volatile Storage"; |
1266 | case E820_UNUSABLE: return "Unusable memory"; | ||
1263 | default: return "reserved"; | 1267 | default: return "reserved"; |
1264 | } | 1268 | } |
1265 | } | 1269 | } |
@@ -1267,6 +1271,7 @@ static inline const char *e820_type_to_string(int e820_type) | |||
1267 | /* | 1271 | /* |
1268 | * Mark e820 reserved areas as busy for the resource manager. | 1272 | * Mark e820 reserved areas as busy for the resource manager. |
1269 | */ | 1273 | */ |
1274 | static struct resource __initdata *e820_res; | ||
1270 | void __init e820_reserve_resources(void) | 1275 | void __init e820_reserve_resources(void) |
1271 | { | 1276 | { |
1272 | int i; | 1277 | int i; |
@@ -1274,6 +1279,7 @@ void __init e820_reserve_resources(void) | |||
1274 | u64 end; | 1279 | u64 end; |
1275 | 1280 | ||
1276 | res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map); | 1281 | res = alloc_bootmem_low(sizeof(struct resource) * e820.nr_map); |
1282 | e820_res = res; | ||
1277 | for (i = 0; i < e820.nr_map; i++) { | 1283 | for (i = 0; i < e820.nr_map; i++) { |
1278 | end = e820.map[i].addr + e820.map[i].size - 1; | 1284 | end = e820.map[i].addr + e820.map[i].size - 1; |
1279 | #ifndef CONFIG_RESOURCES_64BIT | 1285 | #ifndef CONFIG_RESOURCES_64BIT |
@@ -1287,7 +1293,14 @@ void __init e820_reserve_resources(void) | |||
1287 | res->end = end; | 1293 | res->end = end; |
1288 | 1294 | ||
1289 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | 1295 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
1290 | insert_resource(&iomem_resource, res); | 1296 | |
1297 | /* | ||
1298 | * don't register the region that could be conflicted with | ||
1299 | * pci device BAR resource and insert them later in | ||
1300 | * pcibios_resource_survey() | ||
1301 | */ | ||
1302 | if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20)) | ||
1303 | insert_resource(&iomem_resource, res); | ||
1291 | res++; | 1304 | res++; |
1292 | } | 1305 | } |
1293 | 1306 | ||
@@ -1299,6 +1312,19 @@ void __init e820_reserve_resources(void) | |||
1299 | } | 1312 | } |
1300 | } | 1313 | } |
1301 | 1314 | ||
1315 | void __init e820_reserve_resources_late(void) | ||
1316 | { | ||
1317 | int i; | ||
1318 | struct resource *res; | ||
1319 | |||
1320 | res = e820_res; | ||
1321 | for (i = 0; i < e820.nr_map; i++) { | ||
1322 | if (!res->parent && res->end) | ||
1323 | reserve_region_with_split(&iomem_resource, res->start, res->end, res->name); | ||
1324 | res++; | ||
1325 | } | ||
1326 | } | ||
1327 | |||
1302 | char *__init default_machine_specific_memory_setup(void) | 1328 | char *__init default_machine_specific_memory_setup(void) |
1303 | { | 1329 | { |
1304 | char *who = "BIOS-e820"; | 1330 | char *who = "BIOS-e820"; |
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c index 4b63c8e1f13b..5cab48ee61a4 100644 --- a/arch/x86/kernel/efi_32.c +++ b/arch/x86/kernel/efi_32.c | |||
@@ -53,7 +53,7 @@ void efi_call_phys_prelog(void) | |||
53 | * directory. If I have PAE, I just need to duplicate one entry in | 53 | * directory. If I have PAE, I just need to duplicate one entry in |
54 | * page directory. | 54 | * page directory. |
55 | */ | 55 | */ |
56 | cr4 = read_cr4(); | 56 | cr4 = read_cr4_safe(); |
57 | 57 | ||
58 | if (cr4 & X86_CR4_PAE) { | 58 | if (cr4 & X86_CR4_PAE) { |
59 | efi_bak_pg_dir_pointer[0].pgd = | 59 | efi_bak_pg_dir_pointer[0].pgd = |
@@ -91,7 +91,7 @@ void efi_call_phys_epilog(void) | |||
91 | gdt_descr.size = GDT_SIZE - 1; | 91 | gdt_descr.size = GDT_SIZE - 1; |
92 | load_gdt(&gdt_descr); | 92 | load_gdt(&gdt_descr); |
93 | 93 | ||
94 | cr4 = read_cr4(); | 94 | cr4 = read_cr4_safe(); |
95 | 95 | ||
96 | if (cr4 & X86_CR4_PAE) { | 96 | if (cr4 & X86_CR4_PAE) { |
97 | swapper_pg_dir[pgd_index(0)].pgd = | 97 | swapper_pg_dir[pgd_index(0)].pgd = |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index 89434d439605..cf3a0b2d0059 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -275,9 +275,9 @@ ENTRY(native_usergs_sysret64) | |||
275 | ENTRY(ret_from_fork) | 275 | ENTRY(ret_from_fork) |
276 | CFI_DEFAULT_STACK | 276 | CFI_DEFAULT_STACK |
277 | push kernel_eflags(%rip) | 277 | push kernel_eflags(%rip) |
278 | CFI_ADJUST_CFA_OFFSET 4 | 278 | CFI_ADJUST_CFA_OFFSET 8 |
279 | popf # reset kernel eflags | 279 | popf # reset kernel eflags |
280 | CFI_ADJUST_CFA_OFFSET -4 | 280 | CFI_ADJUST_CFA_OFFSET -8 |
281 | call schedule_tail | 281 | call schedule_tail |
282 | GET_THREAD_INFO(%rcx) | 282 | GET_THREAD_INFO(%rcx) |
283 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx) | 283 | testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx) |
diff --git a/arch/x86/mach-es7000/es7000plat.c b/arch/x86/kernel/es7000_32.c index 50189af14b85..849e5cd485b8 100644 --- a/arch/x86/mach-es7000/es7000plat.c +++ b/arch/x86/kernel/es7000_32.c | |||
@@ -39,10 +39,93 @@ | |||
39 | #include <asm/nmi.h> | 39 | #include <asm/nmi.h> |
40 | #include <asm/smp.h> | 40 | #include <asm/smp.h> |
41 | #include <asm/apicdef.h> | 41 | #include <asm/apicdef.h> |
42 | #include "es7000.h" | ||
43 | #include <mach_mpparse.h> | 42 | #include <mach_mpparse.h> |
44 | 43 | ||
45 | /* | 44 | /* |
45 | * ES7000 chipsets | ||
46 | */ | ||
47 | |||
48 | #define NON_UNISYS 0 | ||
49 | #define ES7000_CLASSIC 1 | ||
50 | #define ES7000_ZORRO 2 | ||
51 | |||
52 | |||
53 | #define MIP_REG 1 | ||
54 | #define MIP_PSAI_REG 4 | ||
55 | |||
56 | #define MIP_BUSY 1 | ||
57 | #define MIP_SPIN 0xf0000 | ||
58 | #define MIP_VALID 0x0100000000000000ULL | ||
59 | #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff) | ||
60 | |||
61 | #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff) | ||
62 | |||
63 | struct mip_reg_info { | ||
64 | unsigned long long mip_info; | ||
65 | unsigned long long delivery_info; | ||
66 | unsigned long long host_reg; | ||
67 | unsigned long long mip_reg; | ||
68 | }; | ||
69 | |||
70 | struct part_info { | ||
71 | unsigned char type; | ||
72 | unsigned char length; | ||
73 | unsigned char part_id; | ||
74 | unsigned char apic_mode; | ||
75 | unsigned long snum; | ||
76 | char ptype[16]; | ||
77 | char sname[64]; | ||
78 | char pname[64]; | ||
79 | }; | ||
80 | |||
81 | struct psai { | ||
82 | unsigned long long entry_type; | ||
83 | unsigned long long addr; | ||
84 | unsigned long long bep_addr; | ||
85 | }; | ||
86 | |||
87 | struct es7000_mem_info { | ||
88 | unsigned char type; | ||
89 | unsigned char length; | ||
90 | unsigned char resv[6]; | ||
91 | unsigned long long start; | ||
92 | unsigned long long size; | ||
93 | }; | ||
94 | |||
95 | struct es7000_oem_table { | ||
96 | unsigned long long hdr; | ||
97 | struct mip_reg_info mip; | ||
98 | struct part_info pif; | ||
99 | struct es7000_mem_info shm; | ||
100 | struct psai psai; | ||
101 | }; | ||
102 | |||
103 | #ifdef CONFIG_ACPI | ||
104 | |||
105 | struct oem_table { | ||
106 | struct acpi_table_header Header; | ||
107 | u32 OEMTableAddr; | ||
108 | u32 OEMTableSize; | ||
109 | }; | ||
110 | |||
111 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
112 | #endif | ||
113 | |||
114 | struct mip_reg { | ||
115 | unsigned long long off_0; | ||
116 | unsigned long long off_8; | ||
117 | unsigned long long off_10; | ||
118 | unsigned long long off_18; | ||
119 | unsigned long long off_20; | ||
120 | unsigned long long off_28; | ||
121 | unsigned long long off_30; | ||
122 | unsigned long long off_38; | ||
123 | }; | ||
124 | |||
125 | #define MIP_SW_APIC 0x1020b | ||
126 | #define MIP_FUNC(VALUE) (VALUE & 0xff) | ||
127 | |||
128 | /* | ||
46 | * ES7000 Globals | 129 | * ES7000 Globals |
47 | */ | 130 | */ |
48 | 131 | ||
@@ -72,7 +155,7 @@ es7000_rename_gsi(int ioapic, int gsi) | |||
72 | base += nr_ioapic_registers[i]; | 155 | base += nr_ioapic_registers[i]; |
73 | } | 156 | } |
74 | 157 | ||
75 | if (!ioapic && (gsi < 16)) | 158 | if (!ioapic && (gsi < 16)) |
76 | gsi += base; | 159 | gsi += base; |
77 | return gsi; | 160 | return gsi; |
78 | } | 161 | } |
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c index 1fa8be5bd217..6c9bfc9e1e95 100644 --- a/arch/x86/kernel/genapic_64.c +++ b/arch/x86/kernel/genapic_64.c | |||
@@ -16,86 +16,63 @@ | |||
16 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/hardirq.h> | 18 | #include <linux/hardirq.h> |
19 | #include <linux/dmar.h> | ||
19 | 20 | ||
20 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
21 | #include <asm/ipi.h> | 22 | #include <asm/ipi.h> |
22 | #include <asm/genapic.h> | 23 | #include <asm/genapic.h> |
23 | 24 | ||
24 | #ifdef CONFIG_ACPI | 25 | extern struct genapic apic_flat; |
25 | #include <acpi/acpi_bus.h> | 26 | extern struct genapic apic_physflat; |
26 | #endif | 27 | extern struct genapic apic_x2xpic_uv_x; |
27 | 28 | extern struct genapic apic_x2apic_phys; | |
28 | DEFINE_PER_CPU(int, x2apic_extra_bits); | 29 | extern struct genapic apic_x2apic_cluster; |
29 | 30 | ||
30 | struct genapic __read_mostly *genapic = &apic_flat; | 31 | struct genapic __read_mostly *genapic = &apic_flat; |
31 | 32 | ||
32 | static enum uv_system_type uv_system_type; | 33 | static struct genapic *apic_probe[] __initdata = { |
34 | &apic_x2apic_uv_x, | ||
35 | &apic_x2apic_phys, | ||
36 | &apic_x2apic_cluster, | ||
37 | &apic_physflat, | ||
38 | NULL, | ||
39 | }; | ||
33 | 40 | ||
34 | /* | 41 | /* |
35 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. | 42 | * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode. |
36 | */ | 43 | */ |
37 | void __init setup_apic_routing(void) | 44 | void __init setup_apic_routing(void) |
38 | { | 45 | { |
39 | if (uv_system_type == UV_NON_UNIQUE_APIC) | 46 | if (genapic == &apic_x2apic_phys || genapic == &apic_x2apic_cluster) { |
40 | genapic = &apic_x2apic_uv_x; | 47 | if (!intr_remapping_enabled) |
41 | else | 48 | genapic = &apic_flat; |
42 | #ifdef CONFIG_ACPI | 49 | } |
43 | /* | ||
44 | * Quirk: some x86_64 machines can only use physical APIC mode | ||
45 | * regardless of how many processors are present (x86_64 ES7000 | ||
46 | * is an example). | ||
47 | */ | ||
48 | if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID && | ||
49 | (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL)) | ||
50 | genapic = &apic_physflat; | ||
51 | else | ||
52 | #endif | ||
53 | |||
54 | if (max_physical_apicid < 8) | ||
55 | genapic = &apic_flat; | ||
56 | else | ||
57 | genapic = &apic_physflat; | ||
58 | 50 | ||
59 | printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name); | 51 | if (genapic == &apic_flat) { |
52 | if (max_physical_apicid >= 8) | ||
53 | genapic = &apic_physflat; | ||
54 | printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name); | ||
55 | } | ||
60 | } | 56 | } |
61 | 57 | ||
62 | /* Same for both flat and physical. */ | 58 | /* Same for both flat and physical. */ |
63 | 59 | ||
64 | void send_IPI_self(int vector) | 60 | void apic_send_IPI_self(int vector) |
65 | { | 61 | { |
66 | __send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); | 62 | __send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL); |
67 | } | 63 | } |
68 | 64 | ||
69 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 65 | int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
70 | { | 66 | { |
71 | if (!strcmp(oem_id, "SGI")) { | 67 | int i; |
72 | if (!strcmp(oem_table_id, "UVL")) | 68 | |
73 | uv_system_type = UV_LEGACY_APIC; | 69 | for (i = 0; apic_probe[i]; ++i) { |
74 | else if (!strcmp(oem_table_id, "UVX")) | 70 | if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) { |
75 | uv_system_type = UV_X2APIC; | 71 | genapic = apic_probe[i]; |
76 | else if (!strcmp(oem_table_id, "UVH")) | 72 | printk(KERN_INFO "Setting APIC routing to %s.\n", |
77 | uv_system_type = UV_NON_UNIQUE_APIC; | 73 | genapic->name); |
74 | return 1; | ||
75 | } | ||
78 | } | 76 | } |
79 | return 0; | 77 | return 0; |
80 | } | 78 | } |
81 | |||
82 | unsigned int read_apic_id(void) | ||
83 | { | ||
84 | unsigned int id; | ||
85 | |||
86 | WARN_ON(preemptible() && num_online_cpus() > 1); | ||
87 | id = apic_read(APIC_ID); | ||
88 | if (uv_system_type >= UV_X2APIC) | ||
89 | id |= __get_cpu_var(x2apic_extra_bits); | ||
90 | return id; | ||
91 | } | ||
92 | |||
93 | enum uv_system_type get_uv_system_type(void) | ||
94 | { | ||
95 | return uv_system_type; | ||
96 | } | ||
97 | |||
98 | int is_uv_system(void) | ||
99 | { | ||
100 | return uv_system_type != UV_NONE; | ||
101 | } | ||
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c index 786548a62d38..9eca5ba7a6b1 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/genapic_flat_64.c | |||
@@ -15,9 +15,20 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/ctype.h> | 16 | #include <linux/ctype.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/hardirq.h> | ||
18 | #include <asm/smp.h> | 19 | #include <asm/smp.h> |
19 | #include <asm/ipi.h> | 20 | #include <asm/ipi.h> |
20 | #include <asm/genapic.h> | 21 | #include <asm/genapic.h> |
22 | #include <mach_apicdef.h> | ||
23 | |||
24 | #ifdef CONFIG_ACPI | ||
25 | #include <acpi/acpi_bus.h> | ||
26 | #endif | ||
27 | |||
28 | static int __init flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
29 | { | ||
30 | return 1; | ||
31 | } | ||
21 | 32 | ||
22 | static cpumask_t flat_target_cpus(void) | 33 | static cpumask_t flat_target_cpus(void) |
23 | { | 34 | { |
@@ -95,9 +106,33 @@ static void flat_send_IPI_all(int vector) | |||
95 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); | 106 | __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL); |
96 | } | 107 | } |
97 | 108 | ||
109 | static unsigned int get_apic_id(unsigned long x) | ||
110 | { | ||
111 | unsigned int id; | ||
112 | |||
113 | id = (((x)>>24) & 0xFFu); | ||
114 | return id; | ||
115 | } | ||
116 | |||
117 | static unsigned long set_apic_id(unsigned int id) | ||
118 | { | ||
119 | unsigned long x; | ||
120 | |||
121 | x = ((id & 0xFFu)<<24); | ||
122 | return x; | ||
123 | } | ||
124 | |||
125 | static unsigned int read_xapic_id(void) | ||
126 | { | ||
127 | unsigned int id; | ||
128 | |||
129 | id = get_apic_id(apic_read(APIC_ID)); | ||
130 | return id; | ||
131 | } | ||
132 | |||
98 | static int flat_apic_id_registered(void) | 133 | static int flat_apic_id_registered(void) |
99 | { | 134 | { |
100 | return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map); | 135 | return physid_isset(read_xapic_id(), phys_cpu_present_map); |
101 | } | 136 | } |
102 | 137 | ||
103 | static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask) | 138 | static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask) |
@@ -112,6 +147,7 @@ static unsigned int phys_pkg_id(int index_msb) | |||
112 | 147 | ||
113 | struct genapic apic_flat = { | 148 | struct genapic apic_flat = { |
114 | .name = "flat", | 149 | .name = "flat", |
150 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, | ||
115 | .int_delivery_mode = dest_LowestPrio, | 151 | .int_delivery_mode = dest_LowestPrio, |
116 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), | 152 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), |
117 | .target_cpus = flat_target_cpus, | 153 | .target_cpus = flat_target_cpus, |
@@ -121,8 +157,12 @@ struct genapic apic_flat = { | |||
121 | .send_IPI_all = flat_send_IPI_all, | 157 | .send_IPI_all = flat_send_IPI_all, |
122 | .send_IPI_allbutself = flat_send_IPI_allbutself, | 158 | .send_IPI_allbutself = flat_send_IPI_allbutself, |
123 | .send_IPI_mask = flat_send_IPI_mask, | 159 | .send_IPI_mask = flat_send_IPI_mask, |
160 | .send_IPI_self = apic_send_IPI_self, | ||
124 | .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, | 161 | .cpu_mask_to_apicid = flat_cpu_mask_to_apicid, |
125 | .phys_pkg_id = phys_pkg_id, | 162 | .phys_pkg_id = phys_pkg_id, |
163 | .get_apic_id = get_apic_id, | ||
164 | .set_apic_id = set_apic_id, | ||
165 | .apic_id_mask = (0xFFu<<24), | ||
126 | }; | 166 | }; |
127 | 167 | ||
128 | /* | 168 | /* |
@@ -130,6 +170,21 @@ struct genapic apic_flat = { | |||
130 | * We cannot use logical delivery in this case because the mask | 170 | * We cannot use logical delivery in this case because the mask |
131 | * overflows, so use physical mode. | 171 | * overflows, so use physical mode. |
132 | */ | 172 | */ |
173 | static int __init physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
174 | { | ||
175 | #ifdef CONFIG_ACPI | ||
176 | /* | ||
177 | * Quirk: some x86_64 machines can only use physical APIC mode | ||
178 | * regardless of how many processors are present (x86_64 ES7000 | ||
179 | * is an example). | ||
180 | */ | ||
181 | if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID && | ||
182 | (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL)) | ||
183 | return 1; | ||
184 | #endif | ||
185 | |||
186 | return 0; | ||
187 | } | ||
133 | 188 | ||
134 | static cpumask_t physflat_target_cpus(void) | 189 | static cpumask_t physflat_target_cpus(void) |
135 | { | 190 | { |
@@ -176,6 +231,7 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask) | |||
176 | 231 | ||
177 | struct genapic apic_physflat = { | 232 | struct genapic apic_physflat = { |
178 | .name = "physical flat", | 233 | .name = "physical flat", |
234 | .acpi_madt_oem_check = physflat_acpi_madt_oem_check, | ||
179 | .int_delivery_mode = dest_Fixed, | 235 | .int_delivery_mode = dest_Fixed, |
180 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 236 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), |
181 | .target_cpus = physflat_target_cpus, | 237 | .target_cpus = physflat_target_cpus, |
@@ -185,6 +241,10 @@ struct genapic apic_physflat = { | |||
185 | .send_IPI_all = physflat_send_IPI_all, | 241 | .send_IPI_all = physflat_send_IPI_all, |
186 | .send_IPI_allbutself = physflat_send_IPI_allbutself, | 242 | .send_IPI_allbutself = physflat_send_IPI_allbutself, |
187 | .send_IPI_mask = physflat_send_IPI_mask, | 243 | .send_IPI_mask = physflat_send_IPI_mask, |
244 | .send_IPI_self = apic_send_IPI_self, | ||
188 | .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, | 245 | .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid, |
189 | .phys_pkg_id = phys_pkg_id, | 246 | .phys_pkg_id = phys_pkg_id, |
247 | .get_apic_id = get_apic_id, | ||
248 | .set_apic_id = set_apic_id, | ||
249 | .apic_id_mask = (0xFFu<<24), | ||
190 | }; | 250 | }; |
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c new file mode 100644 index 000000000000..e4bf2cc0d743 --- /dev/null +++ b/arch/x86/kernel/genx2apic_cluster.c | |||
@@ -0,0 +1,159 @@ | |||
1 | #include <linux/threads.h> | ||
2 | #include <linux/cpumask.h> | ||
3 | #include <linux/string.h> | ||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/ctype.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/dmar.h> | ||
8 | |||
9 | #include <asm/smp.h> | ||
10 | #include <asm/ipi.h> | ||
11 | #include <asm/genapic.h> | ||
12 | |||
13 | DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid); | ||
14 | |||
15 | static int __init x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
16 | { | ||
17 | if (cpu_has_x2apic) | ||
18 | return 1; | ||
19 | |||
20 | return 0; | ||
21 | } | ||
22 | |||
23 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ | ||
24 | |||
25 | static cpumask_t x2apic_target_cpus(void) | ||
26 | { | ||
27 | return cpumask_of_cpu(0); | ||
28 | } | ||
29 | |||
30 | /* | ||
31 | * for now each logical cpu is in its own vector allocation domain. | ||
32 | */ | ||
33 | static cpumask_t x2apic_vector_allocation_domain(int cpu) | ||
34 | { | ||
35 | cpumask_t domain = CPU_MASK_NONE; | ||
36 | cpu_set(cpu, domain); | ||
37 | return domain; | ||
38 | } | ||
39 | |||
40 | static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | ||
41 | unsigned int dest) | ||
42 | { | ||
43 | unsigned long cfg; | ||
44 | |||
45 | cfg = __prepare_ICR(0, vector, dest); | ||
46 | |||
47 | /* | ||
48 | * send the IPI. | ||
49 | */ | ||
50 | x2apic_icr_write(cfg, apicid); | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * for now, we send the IPI's one by one in the cpumask. | ||
55 | * TBD: Based on the cpu mask, we can send the IPI's to the cluster group | ||
56 | * at once. We have 16 cpu's in a cluster. This will minimize IPI register | ||
57 | * writes. | ||
58 | */ | ||
59 | static void x2apic_send_IPI_mask(cpumask_t mask, int vector) | ||
60 | { | ||
61 | unsigned long flags; | ||
62 | unsigned long query_cpu; | ||
63 | |||
64 | local_irq_save(flags); | ||
65 | for_each_cpu_mask(query_cpu, mask) { | ||
66 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_logical_apicid, query_cpu), | ||
67 | vector, APIC_DEST_LOGICAL); | ||
68 | } | ||
69 | local_irq_restore(flags); | ||
70 | } | ||
71 | |||
72 | static void x2apic_send_IPI_allbutself(int vector) | ||
73 | { | ||
74 | cpumask_t mask = cpu_online_map; | ||
75 | |||
76 | cpu_clear(smp_processor_id(), mask); | ||
77 | |||
78 | if (!cpus_empty(mask)) | ||
79 | x2apic_send_IPI_mask(mask, vector); | ||
80 | } | ||
81 | |||
82 | static void x2apic_send_IPI_all(int vector) | ||
83 | { | ||
84 | x2apic_send_IPI_mask(cpu_online_map, vector); | ||
85 | } | ||
86 | |||
87 | static int x2apic_apic_id_registered(void) | ||
88 | { | ||
89 | return 1; | ||
90 | } | ||
91 | |||
92 | static unsigned int x2apic_cpu_mask_to_apicid(cpumask_t cpumask) | ||
93 | { | ||
94 | int cpu; | ||
95 | |||
96 | /* | ||
97 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
98 | * May as well be the first. | ||
99 | */ | ||
100 | cpu = first_cpu(cpumask); | ||
101 | if ((unsigned)cpu < NR_CPUS) | ||
102 | return per_cpu(x86_cpu_to_logical_apicid, cpu); | ||
103 | else | ||
104 | return BAD_APICID; | ||
105 | } | ||
106 | |||
107 | static unsigned int get_apic_id(unsigned long x) | ||
108 | { | ||
109 | unsigned int id; | ||
110 | |||
111 | id = x; | ||
112 | return id; | ||
113 | } | ||
114 | |||
115 | static unsigned long set_apic_id(unsigned int id) | ||
116 | { | ||
117 | unsigned long x; | ||
118 | |||
119 | x = id; | ||
120 | return x; | ||
121 | } | ||
122 | |||
123 | static unsigned int phys_pkg_id(int index_msb) | ||
124 | { | ||
125 | return current_cpu_data.initial_apicid >> index_msb; | ||
126 | } | ||
127 | |||
128 | static void x2apic_send_IPI_self(int vector) | ||
129 | { | ||
130 | apic_write(APIC_SELF_IPI, vector); | ||
131 | } | ||
132 | |||
133 | static void init_x2apic_ldr(void) | ||
134 | { | ||
135 | int cpu = smp_processor_id(); | ||
136 | |||
137 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | struct genapic apic_x2apic_cluster = { | ||
142 | .name = "cluster x2apic", | ||
143 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | ||
144 | .int_delivery_mode = dest_LowestPrio, | ||
145 | .int_dest_mode = (APIC_DEST_LOGICAL != 0), | ||
146 | .target_cpus = x2apic_target_cpus, | ||
147 | .vector_allocation_domain = x2apic_vector_allocation_domain, | ||
148 | .apic_id_registered = x2apic_apic_id_registered, | ||
149 | .init_apic_ldr = init_x2apic_ldr, | ||
150 | .send_IPI_all = x2apic_send_IPI_all, | ||
151 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | ||
152 | .send_IPI_mask = x2apic_send_IPI_mask, | ||
153 | .send_IPI_self = x2apic_send_IPI_self, | ||
154 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | ||
155 | .phys_pkg_id = phys_pkg_id, | ||
156 | .get_apic_id = get_apic_id, | ||
157 | .set_apic_id = set_apic_id, | ||
158 | .apic_id_mask = (0xFFFFFFFFu), | ||
159 | }; | ||
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c new file mode 100644 index 000000000000..8f1343df2627 --- /dev/null +++ b/arch/x86/kernel/genx2apic_phys.c | |||
@@ -0,0 +1,154 @@ | |||
1 | #include <linux/threads.h> | ||
2 | #include <linux/cpumask.h> | ||
3 | #include <linux/string.h> | ||
4 | #include <linux/kernel.h> | ||
5 | #include <linux/ctype.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/dmar.h> | ||
8 | |||
9 | #include <asm/smp.h> | ||
10 | #include <asm/ipi.h> | ||
11 | #include <asm/genapic.h> | ||
12 | |||
13 | static int x2apic_phys; | ||
14 | |||
15 | static int set_x2apic_phys_mode(char *arg) | ||
16 | { | ||
17 | x2apic_phys = 1; | ||
18 | return 0; | ||
19 | } | ||
20 | early_param("x2apic_phys", set_x2apic_phys_mode); | ||
21 | |||
22 | static int __init x2apic_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
23 | { | ||
24 | if (cpu_has_x2apic && x2apic_phys) | ||
25 | return 1; | ||
26 | |||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | /* Start with all IRQs pointing to boot CPU. IRQ balancing will shift them. */ | ||
31 | |||
32 | static cpumask_t x2apic_target_cpus(void) | ||
33 | { | ||
34 | return cpumask_of_cpu(0); | ||
35 | } | ||
36 | |||
37 | static cpumask_t x2apic_vector_allocation_domain(int cpu) | ||
38 | { | ||
39 | cpumask_t domain = CPU_MASK_NONE; | ||
40 | cpu_set(cpu, domain); | ||
41 | return domain; | ||
42 | } | ||
43 | |||
44 | static void __x2apic_send_IPI_dest(unsigned int apicid, int vector, | ||
45 | unsigned int dest) | ||
46 | { | ||
47 | unsigned long cfg; | ||
48 | |||
49 | cfg = __prepare_ICR(0, vector, dest); | ||
50 | |||
51 | /* | ||
52 | * send the IPI. | ||
53 | */ | ||
54 | x2apic_icr_write(cfg, apicid); | ||
55 | } | ||
56 | |||
57 | static void x2apic_send_IPI_mask(cpumask_t mask, int vector) | ||
58 | { | ||
59 | unsigned long flags; | ||
60 | unsigned long query_cpu; | ||
61 | |||
62 | local_irq_save(flags); | ||
63 | for_each_cpu_mask(query_cpu, mask) { | ||
64 | __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu), | ||
65 | vector, APIC_DEST_PHYSICAL); | ||
66 | } | ||
67 | local_irq_restore(flags); | ||
68 | } | ||
69 | |||
70 | static void x2apic_send_IPI_allbutself(int vector) | ||
71 | { | ||
72 | cpumask_t mask = cpu_online_map; | ||
73 | |||
74 | cpu_clear(smp_processor_id(), mask); | ||
75 | |||
76 | if (!cpus_empty(mask)) | ||
77 | x2apic_send_IPI_mask(mask, vector); | ||
78 | } | ||
79 | |||
80 | static void x2apic_send_IPI_all(int vector) | ||
81 | { | ||
82 | x2apic_send_IPI_mask(cpu_online_map, vector); | ||
83 | } | ||
84 | |||
85 | static int x2apic_apic_id_registered(void) | ||
86 | { | ||
87 | return 1; | ||
88 | } | ||
89 | |||
90 | static unsigned int x2apic_cpu_mask_to_apicid(cpumask_t cpumask) | ||
91 | { | ||
92 | int cpu; | ||
93 | |||
94 | /* | ||
95 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
96 | * May as well be the first. | ||
97 | */ | ||
98 | cpu = first_cpu(cpumask); | ||
99 | if ((unsigned)cpu < NR_CPUS) | ||
100 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
101 | else | ||
102 | return BAD_APICID; | ||
103 | } | ||
104 | |||
105 | static unsigned int get_apic_id(unsigned long x) | ||
106 | { | ||
107 | unsigned int id; | ||
108 | |||
109 | id = x; | ||
110 | return id; | ||
111 | } | ||
112 | |||
113 | static unsigned long set_apic_id(unsigned int id) | ||
114 | { | ||
115 | unsigned long x; | ||
116 | |||
117 | x = id; | ||
118 | return x; | ||
119 | } | ||
120 | |||
121 | static unsigned int phys_pkg_id(int index_msb) | ||
122 | { | ||
123 | return current_cpu_data.initial_apicid >> index_msb; | ||
124 | } | ||
125 | |||
126 | void x2apic_send_IPI_self(int vector) | ||
127 | { | ||
128 | apic_write(APIC_SELF_IPI, vector); | ||
129 | } | ||
130 | |||
131 | void init_x2apic_ldr(void) | ||
132 | { | ||
133 | return; | ||
134 | } | ||
135 | |||
136 | struct genapic apic_x2apic_phys = { | ||
137 | .name = "physical x2apic", | ||
138 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | ||
139 | .int_delivery_mode = dest_Fixed, | ||
140 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | ||
141 | .target_cpus = x2apic_target_cpus, | ||
142 | .vector_allocation_domain = x2apic_vector_allocation_domain, | ||
143 | .apic_id_registered = x2apic_apic_id_registered, | ||
144 | .init_apic_ldr = init_x2apic_ldr, | ||
145 | .send_IPI_all = x2apic_send_IPI_all, | ||
146 | .send_IPI_allbutself = x2apic_send_IPI_allbutself, | ||
147 | .send_IPI_mask = x2apic_send_IPI_mask, | ||
148 | .send_IPI_self = x2apic_send_IPI_self, | ||
149 | .cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid, | ||
150 | .phys_pkg_id = phys_pkg_id, | ||
151 | .get_apic_id = get_apic_id, | ||
152 | .set_apic_id = set_apic_id, | ||
153 | .apic_id_mask = (0xFFFFFFFFu), | ||
154 | }; | ||
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c index 2cfcbded888a..ae2ffc8a400c 100644 --- a/arch/x86/kernel/genx2apic_uv_x.c +++ b/arch/x86/kernel/genx2apic_uv_x.c | |||
@@ -12,12 +12,12 @@ | |||
12 | #include <linux/threads.h> | 12 | #include <linux/threads.h> |
13 | #include <linux/cpumask.h> | 13 | #include <linux/cpumask.h> |
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/kernel.h> | ||
16 | #include <linux/ctype.h> | 15 | #include <linux/ctype.h> |
17 | #include <linux/init.h> | 16 | #include <linux/init.h> |
18 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
19 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/hardirq.h> | ||
21 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
22 | #include <asm/ipi.h> | 22 | #include <asm/ipi.h> |
23 | #include <asm/genapic.h> | 23 | #include <asm/genapic.h> |
@@ -26,6 +26,36 @@ | |||
26 | #include <asm/uv/uv_hub.h> | 26 | #include <asm/uv/uv_hub.h> |
27 | #include <asm/uv/bios.h> | 27 | #include <asm/uv/bios.h> |
28 | 28 | ||
29 | DEFINE_PER_CPU(int, x2apic_extra_bits); | ||
30 | |||
31 | static enum uv_system_type uv_system_type; | ||
32 | |||
33 | static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | ||
34 | { | ||
35 | if (!strcmp(oem_id, "SGI")) { | ||
36 | if (!strcmp(oem_table_id, "UVL")) | ||
37 | uv_system_type = UV_LEGACY_APIC; | ||
38 | else if (!strcmp(oem_table_id, "UVX")) | ||
39 | uv_system_type = UV_X2APIC; | ||
40 | else if (!strcmp(oem_table_id, "UVH")) { | ||
41 | uv_system_type = UV_NON_UNIQUE_APIC; | ||
42 | return 1; | ||
43 | } | ||
44 | } | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | enum uv_system_type get_uv_system_type(void) | ||
49 | { | ||
50 | return uv_system_type; | ||
51 | } | ||
52 | |||
53 | int is_uv_system(void) | ||
54 | { | ||
55 | return uv_system_type != UV_NONE; | ||
56 | } | ||
57 | EXPORT_SYMBOL_GPL(is_uv_system); | ||
58 | |||
29 | DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); | 59 | DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); |
30 | EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info); | 60 | EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info); |
31 | 61 | ||
@@ -123,6 +153,10 @@ static int uv_apic_id_registered(void) | |||
123 | return 1; | 153 | return 1; |
124 | } | 154 | } |
125 | 155 | ||
156 | static void uv_init_apic_ldr(void) | ||
157 | { | ||
158 | } | ||
159 | |||
126 | static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask) | 160 | static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask) |
127 | { | 161 | { |
128 | int cpu; | 162 | int cpu; |
@@ -138,9 +172,34 @@ static unsigned int uv_cpu_mask_to_apicid(cpumask_t cpumask) | |||
138 | return BAD_APICID; | 172 | return BAD_APICID; |
139 | } | 173 | } |
140 | 174 | ||
175 | static unsigned int get_apic_id(unsigned long x) | ||
176 | { | ||
177 | unsigned int id; | ||
178 | |||
179 | WARN_ON(preemptible() && num_online_cpus() > 1); | ||
180 | id = x | __get_cpu_var(x2apic_extra_bits); | ||
181 | |||
182 | return id; | ||
183 | } | ||
184 | |||
185 | static unsigned long set_apic_id(unsigned int id) | ||
186 | { | ||
187 | unsigned long x; | ||
188 | |||
189 | /* maskout x2apic_extra_bits ? */ | ||
190 | x = id; | ||
191 | return x; | ||
192 | } | ||
193 | |||
194 | static unsigned int uv_read_apic_id(void) | ||
195 | { | ||
196 | |||
197 | return get_apic_id(apic_read(APIC_ID)); | ||
198 | } | ||
199 | |||
141 | static unsigned int phys_pkg_id(int index_msb) | 200 | static unsigned int phys_pkg_id(int index_msb) |
142 | { | 201 | { |
143 | return GET_APIC_ID(read_apic_id()) >> index_msb; | 202 | return uv_read_apic_id() >> index_msb; |
144 | } | 203 | } |
145 | 204 | ||
146 | #ifdef ZZZ /* Needs x2apic patch */ | 205 | #ifdef ZZZ /* Needs x2apic patch */ |
@@ -152,17 +211,22 @@ static void uv_send_IPI_self(int vector) | |||
152 | 211 | ||
153 | struct genapic apic_x2apic_uv_x = { | 212 | struct genapic apic_x2apic_uv_x = { |
154 | .name = "UV large system", | 213 | .name = "UV large system", |
214 | .acpi_madt_oem_check = uv_acpi_madt_oem_check, | ||
155 | .int_delivery_mode = dest_Fixed, | 215 | .int_delivery_mode = dest_Fixed, |
156 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), | 216 | .int_dest_mode = (APIC_DEST_PHYSICAL != 0), |
157 | .target_cpus = uv_target_cpus, | 217 | .target_cpus = uv_target_cpus, |
158 | .vector_allocation_domain = uv_vector_allocation_domain,/* Fixme ZZZ */ | 218 | .vector_allocation_domain = uv_vector_allocation_domain,/* Fixme ZZZ */ |
159 | .apic_id_registered = uv_apic_id_registered, | 219 | .apic_id_registered = uv_apic_id_registered, |
220 | .init_apic_ldr = uv_init_apic_ldr, | ||
160 | .send_IPI_all = uv_send_IPI_all, | 221 | .send_IPI_all = uv_send_IPI_all, |
161 | .send_IPI_allbutself = uv_send_IPI_allbutself, | 222 | .send_IPI_allbutself = uv_send_IPI_allbutself, |
162 | .send_IPI_mask = uv_send_IPI_mask, | 223 | .send_IPI_mask = uv_send_IPI_mask, |
163 | /* ZZZ.send_IPI_self = uv_send_IPI_self, */ | 224 | /* ZZZ.send_IPI_self = uv_send_IPI_self, */ |
164 | .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, | 225 | .cpu_mask_to_apicid = uv_cpu_mask_to_apicid, |
165 | .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */ | 226 | .phys_pkg_id = phys_pkg_id, /* Fixme ZZZ */ |
227 | .get_apic_id = get_apic_id, | ||
228 | .set_apic_id = set_apic_id, | ||
229 | .apic_id_mask = (0xFFFFFFFFu), | ||
166 | }; | 230 | }; |
167 | 231 | ||
168 | static __cpuinit void set_x2apic_extra_bits(int pnode) | 232 | static __cpuinit void set_x2apic_extra_bits(int pnode) |
@@ -222,7 +286,7 @@ static __init void map_low_mmrs(void) | |||
222 | 286 | ||
223 | enum map_type {map_wb, map_uc}; | 287 | enum map_type {map_wb, map_uc}; |
224 | 288 | ||
225 | static void map_high(char *id, unsigned long base, int shift, enum map_type map_type) | 289 | static __init void map_high(char *id, unsigned long base, int shift, enum map_type map_type) |
226 | { | 290 | { |
227 | unsigned long bytes, paddr; | 291 | unsigned long bytes, paddr; |
228 | 292 | ||
@@ -293,7 +357,9 @@ static __init void uv_rtc_init(void) | |||
293 | sn_rtc_cycles_per_second = ticks_per_sec; | 357 | sn_rtc_cycles_per_second = ticks_per_sec; |
294 | } | 358 | } |
295 | 359 | ||
296 | static __init void uv_system_init(void) | 360 | static bool uv_system_inited; |
361 | |||
362 | void __init uv_system_init(void) | ||
297 | { | 363 | { |
298 | union uvh_si_addr_map_config_u m_n_config; | 364 | union uvh_si_addr_map_config_u m_n_config; |
299 | union uvh_node_id_u node_id; | 365 | union uvh_node_id_u node_id; |
@@ -383,6 +449,7 @@ static __init void uv_system_init(void) | |||
383 | map_mmr_high(max_pnode); | 449 | map_mmr_high(max_pnode); |
384 | map_config_high(max_pnode); | 450 | map_config_high(max_pnode); |
385 | map_mmioh_high(max_pnode); | 451 | map_mmioh_high(max_pnode); |
452 | uv_system_inited = true; | ||
386 | } | 453 | } |
387 | 454 | ||
388 | /* | 455 | /* |
@@ -391,11 +458,12 @@ static __init void uv_system_init(void) | |||
391 | */ | 458 | */ |
392 | void __cpuinit uv_cpu_init(void) | 459 | void __cpuinit uv_cpu_init(void) |
393 | { | 460 | { |
394 | if (!uv_node_to_blade) | 461 | BUG_ON(!uv_system_inited); |
395 | uv_system_init(); | ||
396 | 462 | ||
397 | uv_blade_info[uv_numa_blade_id()].nr_online_cpus++; | 463 | uv_blade_info[uv_numa_blade_id()].nr_online_cpus++; |
398 | 464 | ||
399 | if (get_uv_system_type() == UV_NON_UNIQUE_APIC) | 465 | if (get_uv_system_type() == UV_NON_UNIQUE_APIC) |
400 | set_x2apic_extra_bits(uv_hub_info->pnode); | 466 | set_x2apic_extra_bits(uv_hub_info->pnode); |
401 | } | 467 | } |
468 | |||
469 | |||
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 1b318e903bf6..9bfc4d72fb2e 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -88,6 +88,7 @@ void __init x86_64_start_kernel(char * real_mode_data) | |||
88 | BUILD_BUG_ON(!(MODULES_VADDR > __START_KERNEL)); | 88 | BUILD_BUG_ON(!(MODULES_VADDR > __START_KERNEL)); |
89 | BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == | 89 | BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == |
90 | (__START_KERNEL & PGDIR_MASK))); | 90 | (__START_KERNEL & PGDIR_MASK))); |
91 | BUILD_BUG_ON(__fix_to_virt(__end_of_fixed_addresses) <= MODULES_END); | ||
91 | 92 | ||
92 | /* clear bss before set_intr_gate with early_idt_handler */ | 93 | /* clear bss before set_intr_gate with early_idt_handler */ |
93 | clear_bss(); | 94 | clear_bss(); |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index f67e93441caf..a7010c3a377a 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -456,9 +456,6 @@ is386: movl $2,%ecx # set MP | |||
456 | 1: | 456 | 1: |
457 | #endif /* CONFIG_SMP */ | 457 | #endif /* CONFIG_SMP */ |
458 | jmp *(initial_code) | 458 | jmp *(initial_code) |
459 | .align 4 | ||
460 | ENTRY(initial_code) | ||
461 | .long i386_start_kernel | ||
462 | 459 | ||
463 | /* | 460 | /* |
464 | * We depend on ET to be correct. This checks for 287/387. | 461 | * We depend on ET to be correct. This checks for 287/387. |
@@ -601,6 +598,11 @@ ignore_int: | |||
601 | #endif | 598 | #endif |
602 | iret | 599 | iret |
603 | 600 | ||
601 | .section .cpuinit.data,"wa" | ||
602 | .align 4 | ||
603 | ENTRY(initial_code) | ||
604 | .long i386_start_kernel | ||
605 | |||
604 | .section .text | 606 | .section .text |
605 | /* | 607 | /* |
606 | * Real beginning of normal "text" segment | 608 | * Real beginning of normal "text" segment |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index ad2b15a1334d..59fd3b6b1303 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -359,6 +359,7 @@ static int hpet_clocksource_register(void) | |||
359 | int __init hpet_enable(void) | 359 | int __init hpet_enable(void) |
360 | { | 360 | { |
361 | unsigned long id; | 361 | unsigned long id; |
362 | int i; | ||
362 | 363 | ||
363 | if (!is_hpet_capable()) | 364 | if (!is_hpet_capable()) |
364 | return 0; | 365 | return 0; |
@@ -369,6 +370,29 @@ int __init hpet_enable(void) | |||
369 | * Read the period and check for a sane value: | 370 | * Read the period and check for a sane value: |
370 | */ | 371 | */ |
371 | hpet_period = hpet_readl(HPET_PERIOD); | 372 | hpet_period = hpet_readl(HPET_PERIOD); |
373 | |||
374 | /* | ||
375 | * AMD SB700 based systems with spread spectrum enabled use a | ||
376 | * SMM based HPET emulation to provide proper frequency | ||
377 | * setting. The SMM code is initialized with the first HPET | ||
378 | * register access and takes some time to complete. During | ||
379 | * this time the config register reads 0xffffffff. We check | ||
380 | * for max. 1000 loops whether the config register reads a non | ||
381 | * 0xffffffff value to make sure that HPET is up and running | ||
382 | * before we go further. A counting loop is safe, as the HPET | ||
383 | * access takes thousands of CPU cycles. On non SB700 based | ||
384 | * machines this check is only done once and has no side | ||
385 | * effects. | ||
386 | */ | ||
387 | for (i = 0; hpet_readl(HPET_CFG) == 0xFFFFFFFF; i++) { | ||
388 | if (i == 1000) { | ||
389 | printk(KERN_WARNING | ||
390 | "HPET config register value = 0xFFFFFFFF. " | ||
391 | "Disabling HPET\n"); | ||
392 | goto out_nohpet; | ||
393 | } | ||
394 | } | ||
395 | |||
372 | if (hpet_period < HPET_MIN_PERIOD || hpet_period > HPET_MAX_PERIOD) | 396 | if (hpet_period < HPET_MIN_PERIOD || hpet_period > HPET_MAX_PERIOD) |
373 | goto out_nohpet; | 397 | goto out_nohpet; |
374 | 398 | ||
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index eb9ddd8efb82..45723f1fe198 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -21,9 +21,12 @@ | |||
21 | # include <asm/sigcontext32.h> | 21 | # include <asm/sigcontext32.h> |
22 | # include <asm/user32.h> | 22 | # include <asm/user32.h> |
23 | #else | 23 | #else |
24 | # define save_i387_ia32 save_i387 | 24 | # define save_i387_xstate_ia32 save_i387_xstate |
25 | # define restore_i387_ia32 restore_i387 | 25 | # define restore_i387_xstate_ia32 restore_i387_xstate |
26 | # define _fpstate_ia32 _fpstate | 26 | # define _fpstate_ia32 _fpstate |
27 | # define _xstate_ia32 _xstate | ||
28 | # define sig_xstate_ia32_size sig_xstate_size | ||
29 | # define fx_sw_reserved_ia32 fx_sw_reserved | ||
27 | # define user_i387_ia32_struct user_i387_struct | 30 | # define user_i387_ia32_struct user_i387_struct |
28 | # define user32_fxsr_struct user_fxsr_struct | 31 | # define user32_fxsr_struct user_fxsr_struct |
29 | #endif | 32 | #endif |
@@ -36,6 +39,7 @@ | |||
36 | 39 | ||
37 | static unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; | 40 | static unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; |
38 | unsigned int xstate_size; | 41 | unsigned int xstate_size; |
42 | unsigned int sig_xstate_ia32_size = sizeof(struct _fpstate_ia32); | ||
39 | static struct i387_fxsave_struct fx_scratch __cpuinitdata; | 43 | static struct i387_fxsave_struct fx_scratch __cpuinitdata; |
40 | 44 | ||
41 | void __cpuinit mxcsr_feature_mask_init(void) | 45 | void __cpuinit mxcsr_feature_mask_init(void) |
@@ -61,6 +65,11 @@ void __init init_thread_xstate(void) | |||
61 | return; | 65 | return; |
62 | } | 66 | } |
63 | 67 | ||
68 | if (cpu_has_xsave) { | ||
69 | xsave_cntxt_init(); | ||
70 | return; | ||
71 | } | ||
72 | |||
64 | if (cpu_has_fxsr) | 73 | if (cpu_has_fxsr) |
65 | xstate_size = sizeof(struct i387_fxsave_struct); | 74 | xstate_size = sizeof(struct i387_fxsave_struct); |
66 | #ifdef CONFIG_X86_32 | 75 | #ifdef CONFIG_X86_32 |
@@ -83,9 +92,19 @@ void __cpuinit fpu_init(void) | |||
83 | 92 | ||
84 | write_cr0(oldcr0 & ~(X86_CR0_TS|X86_CR0_EM)); /* clear TS and EM */ | 93 | write_cr0(oldcr0 & ~(X86_CR0_TS|X86_CR0_EM)); /* clear TS and EM */ |
85 | 94 | ||
95 | /* | ||
96 | * Boot processor to setup the FP and extended state context info. | ||
97 | */ | ||
98 | if (!smp_processor_id()) | ||
99 | init_thread_xstate(); | ||
100 | xsave_init(); | ||
101 | |||
86 | mxcsr_feature_mask_init(); | 102 | mxcsr_feature_mask_init(); |
87 | /* clean state in init */ | 103 | /* clean state in init */ |
88 | current_thread_info()->status = 0; | 104 | if (cpu_has_xsave) |
105 | current_thread_info()->status = TS_XSAVE; | ||
106 | else | ||
107 | current_thread_info()->status = 0; | ||
89 | clear_used_math(); | 108 | clear_used_math(); |
90 | } | 109 | } |
91 | #endif /* CONFIG_X86_64 */ | 110 | #endif /* CONFIG_X86_64 */ |
@@ -195,6 +214,13 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
195 | */ | 214 | */ |
196 | target->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; | 215 | target->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; |
197 | 216 | ||
217 | /* | ||
218 | * update the header bits in the xsave header, indicating the | ||
219 | * presence of FP and SSE state. | ||
220 | */ | ||
221 | if (cpu_has_xsave) | ||
222 | target->thread.xstate->xsave.xsave_hdr.xstate_bv |= XSTATE_FPSSE; | ||
223 | |||
198 | return ret; | 224 | return ret; |
199 | } | 225 | } |
200 | 226 | ||
@@ -395,6 +421,12 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset, | |||
395 | if (!ret) | 421 | if (!ret) |
396 | convert_to_fxsr(target, &env); | 422 | convert_to_fxsr(target, &env); |
397 | 423 | ||
424 | /* | ||
425 | * update the header bit in the xsave header, indicating the | ||
426 | * presence of FP. | ||
427 | */ | ||
428 | if (cpu_has_xsave) | ||
429 | target->thread.xstate->xsave.xsave_hdr.xstate_bv |= XSTATE_FP; | ||
398 | return ret; | 430 | return ret; |
399 | } | 431 | } |
400 | 432 | ||
@@ -407,7 +439,6 @@ static inline int save_i387_fsave(struct _fpstate_ia32 __user *buf) | |||
407 | struct task_struct *tsk = current; | 439 | struct task_struct *tsk = current; |
408 | struct i387_fsave_struct *fp = &tsk->thread.xstate->fsave; | 440 | struct i387_fsave_struct *fp = &tsk->thread.xstate->fsave; |
409 | 441 | ||
410 | unlazy_fpu(tsk); | ||
411 | fp->status = fp->swd; | 442 | fp->status = fp->swd; |
412 | if (__copy_to_user(buf, fp, sizeof(struct i387_fsave_struct))) | 443 | if (__copy_to_user(buf, fp, sizeof(struct i387_fsave_struct))) |
413 | return -1; | 444 | return -1; |
@@ -421,8 +452,6 @@ static int save_i387_fxsave(struct _fpstate_ia32 __user *buf) | |||
421 | struct user_i387_ia32_struct env; | 452 | struct user_i387_ia32_struct env; |
422 | int err = 0; | 453 | int err = 0; |
423 | 454 | ||
424 | unlazy_fpu(tsk); | ||
425 | |||
426 | convert_from_fxsr(&env, tsk); | 455 | convert_from_fxsr(&env, tsk); |
427 | if (__copy_to_user(buf, &env, sizeof(env))) | 456 | if (__copy_to_user(buf, &env, sizeof(env))) |
428 | return -1; | 457 | return -1; |
@@ -432,16 +461,40 @@ static int save_i387_fxsave(struct _fpstate_ia32 __user *buf) | |||
432 | if (err) | 461 | if (err) |
433 | return -1; | 462 | return -1; |
434 | 463 | ||
435 | if (__copy_to_user(&buf->_fxsr_env[0], fx, | 464 | if (__copy_to_user(&buf->_fxsr_env[0], fx, xstate_size)) |
436 | sizeof(struct i387_fxsave_struct))) | ||
437 | return -1; | 465 | return -1; |
438 | return 1; | 466 | return 1; |
439 | } | 467 | } |
440 | 468 | ||
441 | int save_i387_ia32(struct _fpstate_ia32 __user *buf) | 469 | static int save_i387_xsave(void __user *buf) |
470 | { | ||
471 | struct _fpstate_ia32 __user *fx = buf; | ||
472 | int err = 0; | ||
473 | |||
474 | if (save_i387_fxsave(fx) < 0) | ||
475 | return -1; | ||
476 | |||
477 | err = __copy_to_user(&fx->sw_reserved, &fx_sw_reserved_ia32, | ||
478 | sizeof(struct _fpx_sw_bytes)); | ||
479 | err |= __put_user(FP_XSTATE_MAGIC2, | ||
480 | (__u32 __user *) (buf + sig_xstate_ia32_size | ||
481 | - FP_XSTATE_MAGIC2_SIZE)); | ||
482 | if (err) | ||
483 | return -1; | ||
484 | |||
485 | return 1; | ||
486 | } | ||
487 | |||
488 | int save_i387_xstate_ia32(void __user *buf) | ||
442 | { | 489 | { |
490 | struct _fpstate_ia32 __user *fp = (struct _fpstate_ia32 __user *) buf; | ||
491 | struct task_struct *tsk = current; | ||
492 | |||
443 | if (!used_math()) | 493 | if (!used_math()) |
444 | return 0; | 494 | return 0; |
495 | |||
496 | if (!access_ok(VERIFY_WRITE, buf, sig_xstate_ia32_size)) | ||
497 | return -EACCES; | ||
445 | /* | 498 | /* |
446 | * This will cause a "finit" to be triggered by the next | 499 | * This will cause a "finit" to be triggered by the next |
447 | * attempted FPU operation by the 'current' process. | 500 | * attempted FPU operation by the 'current' process. |
@@ -451,13 +504,17 @@ int save_i387_ia32(struct _fpstate_ia32 __user *buf) | |||
451 | if (!HAVE_HWFP) { | 504 | if (!HAVE_HWFP) { |
452 | return fpregs_soft_get(current, NULL, | 505 | return fpregs_soft_get(current, NULL, |
453 | 0, sizeof(struct user_i387_ia32_struct), | 506 | 0, sizeof(struct user_i387_ia32_struct), |
454 | NULL, buf) ? -1 : 1; | 507 | NULL, fp) ? -1 : 1; |
455 | } | 508 | } |
456 | 509 | ||
510 | unlazy_fpu(tsk); | ||
511 | |||
512 | if (cpu_has_xsave) | ||
513 | return save_i387_xsave(fp); | ||
457 | if (cpu_has_fxsr) | 514 | if (cpu_has_fxsr) |
458 | return save_i387_fxsave(buf); | 515 | return save_i387_fxsave(fp); |
459 | else | 516 | else |
460 | return save_i387_fsave(buf); | 517 | return save_i387_fsave(fp); |
461 | } | 518 | } |
462 | 519 | ||
463 | static inline int restore_i387_fsave(struct _fpstate_ia32 __user *buf) | 520 | static inline int restore_i387_fsave(struct _fpstate_ia32 __user *buf) |
@@ -468,14 +525,15 @@ static inline int restore_i387_fsave(struct _fpstate_ia32 __user *buf) | |||
468 | sizeof(struct i387_fsave_struct)); | 525 | sizeof(struct i387_fsave_struct)); |
469 | } | 526 | } |
470 | 527 | ||
471 | static int restore_i387_fxsave(struct _fpstate_ia32 __user *buf) | 528 | static int restore_i387_fxsave(struct _fpstate_ia32 __user *buf, |
529 | unsigned int size) | ||
472 | { | 530 | { |
473 | struct task_struct *tsk = current; | 531 | struct task_struct *tsk = current; |
474 | struct user_i387_ia32_struct env; | 532 | struct user_i387_ia32_struct env; |
475 | int err; | 533 | int err; |
476 | 534 | ||
477 | err = __copy_from_user(&tsk->thread.xstate->fxsave, &buf->_fxsr_env[0], | 535 | err = __copy_from_user(&tsk->thread.xstate->fxsave, &buf->_fxsr_env[0], |
478 | sizeof(struct i387_fxsave_struct)); | 536 | size); |
479 | /* mxcsr reserved bits must be masked to zero for security reasons */ | 537 | /* mxcsr reserved bits must be masked to zero for security reasons */ |
480 | tsk->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; | 538 | tsk->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; |
481 | if (err || __copy_from_user(&env, buf, sizeof(env))) | 539 | if (err || __copy_from_user(&env, buf, sizeof(env))) |
@@ -485,14 +543,69 @@ static int restore_i387_fxsave(struct _fpstate_ia32 __user *buf) | |||
485 | return 0; | 543 | return 0; |
486 | } | 544 | } |
487 | 545 | ||
488 | int restore_i387_ia32(struct _fpstate_ia32 __user *buf) | 546 | static int restore_i387_xsave(void __user *buf) |
547 | { | ||
548 | struct _fpx_sw_bytes fx_sw_user; | ||
549 | struct _fpstate_ia32 __user *fx_user = | ||
550 | ((struct _fpstate_ia32 __user *) buf); | ||
551 | struct i387_fxsave_struct __user *fx = | ||
552 | (struct i387_fxsave_struct __user *) &fx_user->_fxsr_env[0]; | ||
553 | struct xsave_hdr_struct *xsave_hdr = | ||
554 | ¤t->thread.xstate->xsave.xsave_hdr; | ||
555 | u64 mask; | ||
556 | int err; | ||
557 | |||
558 | if (check_for_xstate(fx, buf, &fx_sw_user)) | ||
559 | goto fx_only; | ||
560 | |||
561 | mask = fx_sw_user.xstate_bv; | ||
562 | |||
563 | err = restore_i387_fxsave(buf, fx_sw_user.xstate_size); | ||
564 | |||
565 | xsave_hdr->xstate_bv &= pcntxt_mask; | ||
566 | /* | ||
567 | * These bits must be zero. | ||
568 | */ | ||
569 | xsave_hdr->reserved1[0] = xsave_hdr->reserved1[1] = 0; | ||
570 | |||
571 | /* | ||
572 | * Init the state that is not present in the memory layout | ||
573 | * and enabled by the OS. | ||
574 | */ | ||
575 | mask = ~(pcntxt_mask & ~mask); | ||
576 | xsave_hdr->xstate_bv &= mask; | ||
577 | |||
578 | return err; | ||
579 | fx_only: | ||
580 | /* | ||
581 | * Couldn't find the extended state information in the memory | ||
582 | * layout. Restore the FP/SSE and init the other extended state | ||
583 | * enabled by the OS. | ||
584 | */ | ||
585 | xsave_hdr->xstate_bv = XSTATE_FPSSE; | ||
586 | return restore_i387_fxsave(buf, sizeof(struct i387_fxsave_struct)); | ||
587 | } | ||
588 | |||
589 | int restore_i387_xstate_ia32(void __user *buf) | ||
489 | { | 590 | { |
490 | int err; | 591 | int err; |
491 | struct task_struct *tsk = current; | 592 | struct task_struct *tsk = current; |
593 | struct _fpstate_ia32 __user *fp = (struct _fpstate_ia32 __user *) buf; | ||
492 | 594 | ||
493 | if (HAVE_HWFP) | 595 | if (HAVE_HWFP) |
494 | clear_fpu(tsk); | 596 | clear_fpu(tsk); |
495 | 597 | ||
598 | if (!buf) { | ||
599 | if (used_math()) { | ||
600 | clear_fpu(tsk); | ||
601 | clear_used_math(); | ||
602 | } | ||
603 | |||
604 | return 0; | ||
605 | } else | ||
606 | if (!access_ok(VERIFY_READ, buf, sig_xstate_ia32_size)) | ||
607 | return -EACCES; | ||
608 | |||
496 | if (!used_math()) { | 609 | if (!used_math()) { |
497 | err = init_fpu(tsk); | 610 | err = init_fpu(tsk); |
498 | if (err) | 611 | if (err) |
@@ -500,14 +613,17 @@ int restore_i387_ia32(struct _fpstate_ia32 __user *buf) | |||
500 | } | 613 | } |
501 | 614 | ||
502 | if (HAVE_HWFP) { | 615 | if (HAVE_HWFP) { |
503 | if (cpu_has_fxsr) | 616 | if (cpu_has_xsave) |
504 | err = restore_i387_fxsave(buf); | 617 | err = restore_i387_xsave(buf); |
618 | else if (cpu_has_fxsr) | ||
619 | err = restore_i387_fxsave(fp, sizeof(struct | ||
620 | i387_fxsave_struct)); | ||
505 | else | 621 | else |
506 | err = restore_i387_fsave(buf); | 622 | err = restore_i387_fsave(fp); |
507 | } else { | 623 | } else { |
508 | err = fpregs_soft_set(current, NULL, | 624 | err = fpregs_soft_set(current, NULL, |
509 | 0, sizeof(struct user_i387_ia32_struct), | 625 | 0, sizeof(struct user_i387_ia32_struct), |
510 | NULL, buf) != 0; | 626 | NULL, fp) != 0; |
511 | } | 627 | } |
512 | set_used_math(); | 628 | set_used_math(); |
513 | 629 | ||
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index dc92b49d9204..4b8a53d841f7 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c | |||
@@ -282,6 +282,30 @@ static int __init i8259A_init_sysfs(void) | |||
282 | 282 | ||
283 | device_initcall(i8259A_init_sysfs); | 283 | device_initcall(i8259A_init_sysfs); |
284 | 284 | ||
285 | void mask_8259A(void) | ||
286 | { | ||
287 | unsigned long flags; | ||
288 | |||
289 | spin_lock_irqsave(&i8259A_lock, flags); | ||
290 | |||
291 | outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ | ||
292 | outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ | ||
293 | |||
294 | spin_unlock_irqrestore(&i8259A_lock, flags); | ||
295 | } | ||
296 | |||
297 | void unmask_8259A(void) | ||
298 | { | ||
299 | unsigned long flags; | ||
300 | |||
301 | spin_lock_irqsave(&i8259A_lock, flags); | ||
302 | |||
303 | outb(cached_master_mask, PIC_MASTER_IMR); /* restore master IRQ mask */ | ||
304 | outb(cached_slave_mask, PIC_SLAVE_IMR); /* restore slave IRQ mask */ | ||
305 | |||
306 | spin_unlock_irqrestore(&i8259A_lock, flags); | ||
307 | } | ||
308 | |||
285 | void init_8259A(int auto_eoi) | 309 | void init_8259A(int auto_eoi) |
286 | { | 310 | { |
287 | unsigned long flags; | 311 | unsigned long flags; |
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c index de9aa0e3a9c5..e710289f673e 100644 --- a/arch/x86/kernel/io_apic_32.c +++ b/arch/x86/kernel/io_apic_32.c | |||
@@ -46,10 +46,13 @@ | |||
46 | #include <asm/nmi.h> | 46 | #include <asm/nmi.h> |
47 | #include <asm/msidef.h> | 47 | #include <asm/msidef.h> |
48 | #include <asm/hypertransport.h> | 48 | #include <asm/hypertransport.h> |
49 | #include <asm/setup.h> | ||
49 | 50 | ||
50 | #include <mach_apic.h> | 51 | #include <mach_apic.h> |
51 | #include <mach_apicdef.h> | 52 | #include <mach_apicdef.h> |
52 | 53 | ||
54 | #define __apicdebuginit(type) static type __init | ||
55 | |||
53 | int (*ioapic_renumber_irq)(int ioapic, int irq); | 56 | int (*ioapic_renumber_irq)(int ioapic, int irq); |
54 | atomic_t irq_mis_count; | 57 | atomic_t irq_mis_count; |
55 | 58 | ||
@@ -57,7 +60,7 @@ atomic_t irq_mis_count; | |||
57 | static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; | 60 | static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; |
58 | 61 | ||
59 | static DEFINE_SPINLOCK(ioapic_lock); | 62 | static DEFINE_SPINLOCK(ioapic_lock); |
60 | static DEFINE_SPINLOCK(vector_lock); | 63 | DEFINE_SPINLOCK(vector_lock); |
61 | 64 | ||
62 | int timer_through_8259 __initdata; | 65 | int timer_through_8259 __initdata; |
63 | 66 | ||
@@ -1209,10 +1212,6 @@ static int assign_irq_vector(int irq) | |||
1209 | return vector; | 1212 | return vector; |
1210 | } | 1213 | } |
1211 | 1214 | ||
1212 | void setup_vector_irq(int cpu) | ||
1213 | { | ||
1214 | } | ||
1215 | |||
1216 | static struct irq_chip ioapic_chip; | 1215 | static struct irq_chip ioapic_chip; |
1217 | 1216 | ||
1218 | #define IOAPIC_AUTO -1 | 1217 | #define IOAPIC_AUTO -1 |
@@ -1345,7 +1344,8 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin, | |||
1345 | ioapic_write_entry(apic, pin, entry); | 1344 | ioapic_write_entry(apic, pin, entry); |
1346 | } | 1345 | } |
1347 | 1346 | ||
1348 | void __init print_IO_APIC(void) | 1347 | |
1348 | __apicdebuginit(void) print_IO_APIC(void) | ||
1349 | { | 1349 | { |
1350 | int apic, i; | 1350 | int apic, i; |
1351 | union IO_APIC_reg_00 reg_00; | 1351 | union IO_APIC_reg_00 reg_00; |
@@ -1460,9 +1460,7 @@ void __init print_IO_APIC(void) | |||
1460 | return; | 1460 | return; |
1461 | } | 1461 | } |
1462 | 1462 | ||
1463 | #if 0 | 1463 | __apicdebuginit(void) print_APIC_bitfield(int base) |
1464 | |||
1465 | static void print_APIC_bitfield(int base) | ||
1466 | { | 1464 | { |
1467 | unsigned int v; | 1465 | unsigned int v; |
1468 | int i, j; | 1466 | int i, j; |
@@ -1483,9 +1481,10 @@ static void print_APIC_bitfield(int base) | |||
1483 | } | 1481 | } |
1484 | } | 1482 | } |
1485 | 1483 | ||
1486 | void /*__init*/ print_local_APIC(void *dummy) | 1484 | __apicdebuginit(void) print_local_APIC(void *dummy) |
1487 | { | 1485 | { |
1488 | unsigned int v, ver, maxlvt; | 1486 | unsigned int v, ver, maxlvt; |
1487 | u64 icr; | ||
1489 | 1488 | ||
1490 | if (apic_verbosity == APIC_QUIET) | 1489 | if (apic_verbosity == APIC_QUIET) |
1491 | return; | 1490 | return; |
@@ -1494,7 +1493,7 @@ void /*__init*/ print_local_APIC(void *dummy) | |||
1494 | smp_processor_id(), hard_smp_processor_id()); | 1493 | smp_processor_id(), hard_smp_processor_id()); |
1495 | v = apic_read(APIC_ID); | 1494 | v = apic_read(APIC_ID); |
1496 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, | 1495 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, |
1497 | GET_APIC_ID(read_apic_id())); | 1496 | GET_APIC_ID(v)); |
1498 | v = apic_read(APIC_LVR); | 1497 | v = apic_read(APIC_LVR); |
1499 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); | 1498 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); |
1500 | ver = GET_APIC_VERSION(v); | 1499 | ver = GET_APIC_VERSION(v); |
@@ -1536,10 +1535,9 @@ void /*__init*/ print_local_APIC(void *dummy) | |||
1536 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); | 1535 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); |
1537 | } | 1536 | } |
1538 | 1537 | ||
1539 | v = apic_read(APIC_ICR); | 1538 | icr = apic_icr_read(); |
1540 | printk(KERN_DEBUG "... APIC ICR: %08x\n", v); | 1539 | printk(KERN_DEBUG "... APIC ICR: %08x\n", icr); |
1541 | v = apic_read(APIC_ICR2); | 1540 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", icr >> 32); |
1542 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", v); | ||
1543 | 1541 | ||
1544 | v = apic_read(APIC_LVTT); | 1542 | v = apic_read(APIC_LVTT); |
1545 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); | 1543 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); |
@@ -1567,12 +1565,12 @@ void /*__init*/ print_local_APIC(void *dummy) | |||
1567 | printk("\n"); | 1565 | printk("\n"); |
1568 | } | 1566 | } |
1569 | 1567 | ||
1570 | void print_all_local_APICs(void) | 1568 | __apicdebuginit(void) print_all_local_APICs(void) |
1571 | { | 1569 | { |
1572 | on_each_cpu(print_local_APIC, NULL, 1); | 1570 | on_each_cpu(print_local_APIC, NULL, 1); |
1573 | } | 1571 | } |
1574 | 1572 | ||
1575 | void /*__init*/ print_PIC(void) | 1573 | __apicdebuginit(void) print_PIC(void) |
1576 | { | 1574 | { |
1577 | unsigned int v; | 1575 | unsigned int v; |
1578 | unsigned long flags; | 1576 | unsigned long flags; |
@@ -1604,7 +1602,17 @@ void /*__init*/ print_PIC(void) | |||
1604 | printk(KERN_DEBUG "... PIC ELCR: %04x\n", v); | 1602 | printk(KERN_DEBUG "... PIC ELCR: %04x\n", v); |
1605 | } | 1603 | } |
1606 | 1604 | ||
1607 | #endif /* 0 */ | 1605 | __apicdebuginit(int) print_all_ICs(void) |
1606 | { | ||
1607 | print_PIC(); | ||
1608 | print_all_local_APICs(); | ||
1609 | print_IO_APIC(); | ||
1610 | |||
1611 | return 0; | ||
1612 | } | ||
1613 | |||
1614 | fs_initcall(print_all_ICs); | ||
1615 | |||
1608 | 1616 | ||
1609 | static void __init enable_IO_APIC(void) | 1617 | static void __init enable_IO_APIC(void) |
1610 | { | 1618 | { |
@@ -1702,8 +1710,7 @@ void disable_IO_APIC(void) | |||
1702 | entry.dest_mode = 0; /* Physical */ | 1710 | entry.dest_mode = 0; /* Physical */ |
1703 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ | 1711 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1704 | entry.vector = 0; | 1712 | entry.vector = 0; |
1705 | entry.dest.physical.physical_dest = | 1713 | entry.dest.physical.physical_dest = read_apic_id(); |
1706 | GET_APIC_ID(read_apic_id()); | ||
1707 | 1714 | ||
1708 | /* | 1715 | /* |
1709 | * Add it to the IO-APIC irq-routing table: | 1716 | * Add it to the IO-APIC irq-routing table: |
@@ -1729,10 +1736,8 @@ static void __init setup_ioapic_ids_from_mpc(void) | |||
1729 | unsigned char old_id; | 1736 | unsigned char old_id; |
1730 | unsigned long flags; | 1737 | unsigned long flags; |
1731 | 1738 | ||
1732 | #ifdef CONFIG_X86_NUMAQ | 1739 | if (x86_quirks->setup_ioapic_ids && x86_quirks->setup_ioapic_ids()) |
1733 | if (found_numaq) | ||
1734 | return; | 1740 | return; |
1735 | #endif | ||
1736 | 1741 | ||
1737 | /* | 1742 | /* |
1738 | * Don't check I/O APIC IDs for xAPIC systems. They have | 1743 | * Don't check I/O APIC IDs for xAPIC systems. They have |
@@ -2333,8 +2338,6 @@ void __init setup_IO_APIC(void) | |||
2333 | setup_IO_APIC_irqs(); | 2338 | setup_IO_APIC_irqs(); |
2334 | init_IO_APIC_traps(); | 2339 | init_IO_APIC_traps(); |
2335 | check_timer(); | 2340 | check_timer(); |
2336 | if (!acpi_ioapic) | ||
2337 | print_IO_APIC(); | ||
2338 | } | 2341 | } |
2339 | 2342 | ||
2340 | /* | 2343 | /* |
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c index 8269434d1707..a1bec2969c6a 100644 --- a/arch/x86/kernel/io_apic_64.c +++ b/arch/x86/kernel/io_apic_64.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <acpi/acpi_bus.h> | 37 | #include <acpi/acpi_bus.h> |
38 | #endif | 38 | #endif |
39 | #include <linux/bootmem.h> | 39 | #include <linux/bootmem.h> |
40 | #include <linux/dmar.h> | ||
40 | 41 | ||
41 | #include <asm/idle.h> | 42 | #include <asm/idle.h> |
42 | #include <asm/io.h> | 43 | #include <asm/io.h> |
@@ -49,10 +50,13 @@ | |||
49 | #include <asm/nmi.h> | 50 | #include <asm/nmi.h> |
50 | #include <asm/msidef.h> | 51 | #include <asm/msidef.h> |
51 | #include <asm/hypertransport.h> | 52 | #include <asm/hypertransport.h> |
53 | #include <asm/irq_remapping.h> | ||
52 | 54 | ||
53 | #include <mach_ipi.h> | 55 | #include <mach_ipi.h> |
54 | #include <mach_apic.h> | 56 | #include <mach_apic.h> |
55 | 57 | ||
58 | #define __apicdebuginit(type) static type __init | ||
59 | |||
56 | struct irq_cfg { | 60 | struct irq_cfg { |
57 | cpumask_t domain; | 61 | cpumask_t domain; |
58 | cpumask_t old_domain; | 62 | cpumask_t old_domain; |
@@ -87,8 +91,6 @@ int first_system_vector = 0xfe; | |||
87 | 91 | ||
88 | char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE}; | 92 | char system_vectors[NR_VECTORS] = { [0 ... NR_VECTORS-1] = SYS_VECTOR_FREE}; |
89 | 93 | ||
90 | #define __apicdebuginit __init | ||
91 | |||
92 | int sis_apic_bug; /* not actually supported, dummy for compile */ | 94 | int sis_apic_bug; /* not actually supported, dummy for compile */ |
93 | 95 | ||
94 | static int no_timer_check; | 96 | static int no_timer_check; |
@@ -101,13 +103,16 @@ int timer_through_8259 __initdata; | |||
101 | static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; | 103 | static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; |
102 | 104 | ||
103 | static DEFINE_SPINLOCK(ioapic_lock); | 105 | static DEFINE_SPINLOCK(ioapic_lock); |
104 | DEFINE_SPINLOCK(vector_lock); | 106 | static DEFINE_SPINLOCK(vector_lock); |
105 | 107 | ||
106 | /* | 108 | /* |
107 | * # of IRQ routing registers | 109 | * # of IRQ routing registers |
108 | */ | 110 | */ |
109 | int nr_ioapic_registers[MAX_IO_APICS]; | 111 | int nr_ioapic_registers[MAX_IO_APICS]; |
110 | 112 | ||
113 | /* I/O APIC RTE contents at the OS boot up */ | ||
114 | struct IO_APIC_route_entry *early_ioapic_entries[MAX_IO_APICS]; | ||
115 | |||
111 | /* I/O APIC entries */ | 116 | /* I/O APIC entries */ |
112 | struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; | 117 | struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; |
113 | int nr_ioapics; | 118 | int nr_ioapics; |
@@ -303,7 +308,12 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector) | |||
303 | pin = entry->pin; | 308 | pin = entry->pin; |
304 | if (pin == -1) | 309 | if (pin == -1) |
305 | break; | 310 | break; |
306 | io_apic_write(apic, 0x11 + pin*2, dest); | 311 | /* |
312 | * With interrupt-remapping, destination information comes | ||
313 | * from interrupt-remapping table entry. | ||
314 | */ | ||
315 | if (!irq_remapped(irq)) | ||
316 | io_apic_write(apic, 0x11 + pin*2, dest); | ||
307 | reg = io_apic_read(apic, 0x10 + pin*2); | 317 | reg = io_apic_read(apic, 0x10 + pin*2); |
308 | reg &= ~IO_APIC_REDIR_VECTOR_MASK; | 318 | reg &= ~IO_APIC_REDIR_VECTOR_MASK; |
309 | reg |= vector; | 319 | reg |= vector; |
@@ -440,6 +450,69 @@ static void clear_IO_APIC (void) | |||
440 | clear_IO_APIC_pin(apic, pin); | 450 | clear_IO_APIC_pin(apic, pin); |
441 | } | 451 | } |
442 | 452 | ||
453 | /* | ||
454 | * Saves and masks all the unmasked IO-APIC RTE's | ||
455 | */ | ||
456 | int save_mask_IO_APIC_setup(void) | ||
457 | { | ||
458 | union IO_APIC_reg_01 reg_01; | ||
459 | unsigned long flags; | ||
460 | int apic, pin; | ||
461 | |||
462 | /* | ||
463 | * The number of IO-APIC IRQ registers (== #pins): | ||
464 | */ | ||
465 | for (apic = 0; apic < nr_ioapics; apic++) { | ||
466 | spin_lock_irqsave(&ioapic_lock, flags); | ||
467 | reg_01.raw = io_apic_read(apic, 1); | ||
468 | spin_unlock_irqrestore(&ioapic_lock, flags); | ||
469 | nr_ioapic_registers[apic] = reg_01.bits.entries+1; | ||
470 | } | ||
471 | |||
472 | for (apic = 0; apic < nr_ioapics; apic++) { | ||
473 | early_ioapic_entries[apic] = | ||
474 | kzalloc(sizeof(struct IO_APIC_route_entry) * | ||
475 | nr_ioapic_registers[apic], GFP_KERNEL); | ||
476 | if (!early_ioapic_entries[apic]) | ||
477 | return -ENOMEM; | ||
478 | } | ||
479 | |||
480 | for (apic = 0; apic < nr_ioapics; apic++) | ||
481 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) { | ||
482 | struct IO_APIC_route_entry entry; | ||
483 | |||
484 | entry = early_ioapic_entries[apic][pin] = | ||
485 | ioapic_read_entry(apic, pin); | ||
486 | if (!entry.mask) { | ||
487 | entry.mask = 1; | ||
488 | ioapic_write_entry(apic, pin, entry); | ||
489 | } | ||
490 | } | ||
491 | return 0; | ||
492 | } | ||
493 | |||
494 | void restore_IO_APIC_setup(void) | ||
495 | { | ||
496 | int apic, pin; | ||
497 | |||
498 | for (apic = 0; apic < nr_ioapics; apic++) | ||
499 | for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) | ||
500 | ioapic_write_entry(apic, pin, | ||
501 | early_ioapic_entries[apic][pin]); | ||
502 | } | ||
503 | |||
504 | void reinit_intr_remapped_IO_APIC(int intr_remapping) | ||
505 | { | ||
506 | /* | ||
507 | * for now plain restore of previous settings. | ||
508 | * TBD: In the case of OS enabling interrupt-remapping, | ||
509 | * IO-APIC RTE's need to be setup to point to interrupt-remapping | ||
510 | * table entries. for now, do a plain restore, and wait for | ||
511 | * the setup_IO_APIC_irqs() to do proper initialization. | ||
512 | */ | ||
513 | restore_IO_APIC_setup(); | ||
514 | } | ||
515 | |||
443 | int skip_ioapic_setup; | 516 | int skip_ioapic_setup; |
444 | int ioapic_force; | 517 | int ioapic_force; |
445 | 518 | ||
@@ -697,6 +770,19 @@ static int pin_2_irq(int idx, int apic, int pin) | |||
697 | return irq; | 770 | return irq; |
698 | } | 771 | } |
699 | 772 | ||
773 | void lock_vector_lock(void) | ||
774 | { | ||
775 | /* Used to the online set of cpus does not change | ||
776 | * during assign_irq_vector. | ||
777 | */ | ||
778 | spin_lock(&vector_lock); | ||
779 | } | ||
780 | |||
781 | void unlock_vector_lock(void) | ||
782 | { | ||
783 | spin_unlock(&vector_lock); | ||
784 | } | ||
785 | |||
700 | static int __assign_irq_vector(int irq, cpumask_t mask) | 786 | static int __assign_irq_vector(int irq, cpumask_t mask) |
701 | { | 787 | { |
702 | /* | 788 | /* |
@@ -802,7 +888,7 @@ static void __clear_irq_vector(int irq) | |||
802 | cpus_clear(cfg->domain); | 888 | cpus_clear(cfg->domain); |
803 | } | 889 | } |
804 | 890 | ||
805 | static void __setup_vector_irq(int cpu) | 891 | void __setup_vector_irq(int cpu) |
806 | { | 892 | { |
807 | /* Initialize vector_irq on a new cpu */ | 893 | /* Initialize vector_irq on a new cpu */ |
808 | /* This function must be called with vector_lock held */ | 894 | /* This function must be called with vector_lock held */ |
@@ -825,27 +911,99 @@ static void __setup_vector_irq(int cpu) | |||
825 | } | 911 | } |
826 | } | 912 | } |
827 | 913 | ||
828 | void setup_vector_irq(int cpu) | ||
829 | { | ||
830 | spin_lock(&vector_lock); | ||
831 | __setup_vector_irq(smp_processor_id()); | ||
832 | spin_unlock(&vector_lock); | ||
833 | } | ||
834 | |||
835 | |||
836 | static struct irq_chip ioapic_chip; | 914 | static struct irq_chip ioapic_chip; |
915 | #ifdef CONFIG_INTR_REMAP | ||
916 | static struct irq_chip ir_ioapic_chip; | ||
917 | #endif | ||
837 | 918 | ||
838 | static void ioapic_register_intr(int irq, unsigned long trigger) | 919 | static void ioapic_register_intr(int irq, unsigned long trigger) |
839 | { | 920 | { |
840 | if (trigger) { | 921 | if (trigger) |
841 | irq_desc[irq].status |= IRQ_LEVEL; | 922 | irq_desc[irq].status |= IRQ_LEVEL; |
842 | set_irq_chip_and_handler_name(irq, &ioapic_chip, | 923 | else |
843 | handle_fasteoi_irq, "fasteoi"); | ||
844 | } else { | ||
845 | irq_desc[irq].status &= ~IRQ_LEVEL; | 924 | irq_desc[irq].status &= ~IRQ_LEVEL; |
925 | |||
926 | #ifdef CONFIG_INTR_REMAP | ||
927 | if (irq_remapped(irq)) { | ||
928 | irq_desc[irq].status |= IRQ_MOVE_PCNTXT; | ||
929 | if (trigger) | ||
930 | set_irq_chip_and_handler_name(irq, &ir_ioapic_chip, | ||
931 | handle_fasteoi_irq, | ||
932 | "fasteoi"); | ||
933 | else | ||
934 | set_irq_chip_and_handler_name(irq, &ir_ioapic_chip, | ||
935 | handle_edge_irq, "edge"); | ||
936 | return; | ||
937 | } | ||
938 | #endif | ||
939 | if (trigger) | ||
940 | set_irq_chip_and_handler_name(irq, &ioapic_chip, | ||
941 | handle_fasteoi_irq, | ||
942 | "fasteoi"); | ||
943 | else | ||
846 | set_irq_chip_and_handler_name(irq, &ioapic_chip, | 944 | set_irq_chip_and_handler_name(irq, &ioapic_chip, |
847 | handle_edge_irq, "edge"); | 945 | handle_edge_irq, "edge"); |
946 | } | ||
947 | |||
948 | static int setup_ioapic_entry(int apic, int irq, | ||
949 | struct IO_APIC_route_entry *entry, | ||
950 | unsigned int destination, int trigger, | ||
951 | int polarity, int vector) | ||
952 | { | ||
953 | /* | ||
954 | * add it to the IO-APIC irq-routing table: | ||
955 | */ | ||
956 | memset(entry,0,sizeof(*entry)); | ||
957 | |||
958 | #ifdef CONFIG_INTR_REMAP | ||
959 | if (intr_remapping_enabled) { | ||
960 | struct intel_iommu *iommu = map_ioapic_to_ir(apic); | ||
961 | struct irte irte; | ||
962 | struct IR_IO_APIC_route_entry *ir_entry = | ||
963 | (struct IR_IO_APIC_route_entry *) entry; | ||
964 | int index; | ||
965 | |||
966 | if (!iommu) | ||
967 | panic("No mapping iommu for ioapic %d\n", apic); | ||
968 | |||
969 | index = alloc_irte(iommu, irq, 1); | ||
970 | if (index < 0) | ||
971 | panic("Failed to allocate IRTE for ioapic %d\n", apic); | ||
972 | |||
973 | memset(&irte, 0, sizeof(irte)); | ||
974 | |||
975 | irte.present = 1; | ||
976 | irte.dst_mode = INT_DEST_MODE; | ||
977 | irte.trigger_mode = trigger; | ||
978 | irte.dlvry_mode = INT_DELIVERY_MODE; | ||
979 | irte.vector = vector; | ||
980 | irte.dest_id = IRTE_DEST(destination); | ||
981 | |||
982 | modify_irte(irq, &irte); | ||
983 | |||
984 | ir_entry->index2 = (index >> 15) & 0x1; | ||
985 | ir_entry->zero = 0; | ||
986 | ir_entry->format = 1; | ||
987 | ir_entry->index = (index & 0x7fff); | ||
988 | } else | ||
989 | #endif | ||
990 | { | ||
991 | entry->delivery_mode = INT_DELIVERY_MODE; | ||
992 | entry->dest_mode = INT_DEST_MODE; | ||
993 | entry->dest = destination; | ||
848 | } | 994 | } |
995 | |||
996 | entry->mask = 0; /* enable IRQ */ | ||
997 | entry->trigger = trigger; | ||
998 | entry->polarity = polarity; | ||
999 | entry->vector = vector; | ||
1000 | |||
1001 | /* Mask level triggered irqs. | ||
1002 | * Use IRQ_DELAYED_DISABLE for edge triggered irqs. | ||
1003 | */ | ||
1004 | if (trigger) | ||
1005 | entry->mask = 1; | ||
1006 | return 0; | ||
849 | } | 1007 | } |
850 | 1008 | ||
851 | static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, | 1009 | static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, |
@@ -870,24 +1028,15 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, | |||
870 | apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector, | 1028 | apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector, |
871 | irq, trigger, polarity); | 1029 | irq, trigger, polarity); |
872 | 1030 | ||
873 | /* | ||
874 | * add it to the IO-APIC irq-routing table: | ||
875 | */ | ||
876 | memset(&entry,0,sizeof(entry)); | ||
877 | |||
878 | entry.delivery_mode = INT_DELIVERY_MODE; | ||
879 | entry.dest_mode = INT_DEST_MODE; | ||
880 | entry.dest = cpu_mask_to_apicid(mask); | ||
881 | entry.mask = 0; /* enable IRQ */ | ||
882 | entry.trigger = trigger; | ||
883 | entry.polarity = polarity; | ||
884 | entry.vector = cfg->vector; | ||
885 | 1031 | ||
886 | /* Mask level triggered irqs. | 1032 | if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry, |
887 | * Use IRQ_DELAYED_DISABLE for edge triggered irqs. | 1033 | cpu_mask_to_apicid(mask), trigger, polarity, |
888 | */ | 1034 | cfg->vector)) { |
889 | if (trigger) | 1035 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", |
890 | entry.mask = 1; | 1036 | mp_ioapics[apic].mp_apicid, pin); |
1037 | __clear_irq_vector(irq); | ||
1038 | return; | ||
1039 | } | ||
891 | 1040 | ||
892 | ioapic_register_intr(irq, trigger); | 1041 | ioapic_register_intr(irq, trigger); |
893 | if (irq < 16) | 1042 | if (irq < 16) |
@@ -939,6 +1088,9 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin, | |||
939 | { | 1088 | { |
940 | struct IO_APIC_route_entry entry; | 1089 | struct IO_APIC_route_entry entry; |
941 | 1090 | ||
1091 | if (intr_remapping_enabled) | ||
1092 | return; | ||
1093 | |||
942 | memset(&entry, 0, sizeof(entry)); | 1094 | memset(&entry, 0, sizeof(entry)); |
943 | 1095 | ||
944 | /* | 1096 | /* |
@@ -965,7 +1117,8 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic, unsigned int pin, | |||
965 | ioapic_write_entry(apic, pin, entry); | 1117 | ioapic_write_entry(apic, pin, entry); |
966 | } | 1118 | } |
967 | 1119 | ||
968 | void __apicdebuginit print_IO_APIC(void) | 1120 | |
1121 | __apicdebuginit(void) print_IO_APIC(void) | ||
969 | { | 1122 | { |
970 | int apic, i; | 1123 | int apic, i; |
971 | union IO_APIC_reg_00 reg_00; | 1124 | union IO_APIC_reg_00 reg_00; |
@@ -1059,9 +1212,7 @@ void __apicdebuginit print_IO_APIC(void) | |||
1059 | return; | 1212 | return; |
1060 | } | 1213 | } |
1061 | 1214 | ||
1062 | #if 0 | 1215 | __apicdebuginit(void) print_APIC_bitfield(int base) |
1063 | |||
1064 | static __apicdebuginit void print_APIC_bitfield (int base) | ||
1065 | { | 1216 | { |
1066 | unsigned int v; | 1217 | unsigned int v; |
1067 | int i, j; | 1218 | int i, j; |
@@ -1082,9 +1233,10 @@ static __apicdebuginit void print_APIC_bitfield (int base) | |||
1082 | } | 1233 | } |
1083 | } | 1234 | } |
1084 | 1235 | ||
1085 | void __apicdebuginit print_local_APIC(void * dummy) | 1236 | __apicdebuginit(void) print_local_APIC(void *dummy) |
1086 | { | 1237 | { |
1087 | unsigned int v, ver, maxlvt; | 1238 | unsigned int v, ver, maxlvt; |
1239 | unsigned long icr; | ||
1088 | 1240 | ||
1089 | if (apic_verbosity == APIC_QUIET) | 1241 | if (apic_verbosity == APIC_QUIET) |
1090 | return; | 1242 | return; |
@@ -1092,7 +1244,7 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1092 | printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", | 1244 | printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", |
1093 | smp_processor_id(), hard_smp_processor_id()); | 1245 | smp_processor_id(), hard_smp_processor_id()); |
1094 | v = apic_read(APIC_ID); | 1246 | v = apic_read(APIC_ID); |
1095 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(read_apic_id())); | 1247 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id()); |
1096 | v = apic_read(APIC_LVR); | 1248 | v = apic_read(APIC_LVR); |
1097 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); | 1249 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); |
1098 | ver = GET_APIC_VERSION(v); | 1250 | ver = GET_APIC_VERSION(v); |
@@ -1128,10 +1280,9 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1128 | v = apic_read(APIC_ESR); | 1280 | v = apic_read(APIC_ESR); |
1129 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); | 1281 | printk(KERN_DEBUG "... APIC ESR: %08x\n", v); |
1130 | 1282 | ||
1131 | v = apic_read(APIC_ICR); | 1283 | icr = apic_icr_read(); |
1132 | printk(KERN_DEBUG "... APIC ICR: %08x\n", v); | 1284 | printk(KERN_DEBUG "... APIC ICR: %08x\n", icr); |
1133 | v = apic_read(APIC_ICR2); | 1285 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", icr >> 32); |
1134 | printk(KERN_DEBUG "... APIC ICR2: %08x\n", v); | ||
1135 | 1286 | ||
1136 | v = apic_read(APIC_LVTT); | 1287 | v = apic_read(APIC_LVTT); |
1137 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); | 1288 | printk(KERN_DEBUG "... APIC LVTT: %08x\n", v); |
@@ -1159,12 +1310,12 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1159 | printk("\n"); | 1310 | printk("\n"); |
1160 | } | 1311 | } |
1161 | 1312 | ||
1162 | void print_all_local_APICs (void) | 1313 | __apicdebuginit(void) print_all_local_APICs(void) |
1163 | { | 1314 | { |
1164 | on_each_cpu(print_local_APIC, NULL, 1); | 1315 | on_each_cpu(print_local_APIC, NULL, 1); |
1165 | } | 1316 | } |
1166 | 1317 | ||
1167 | void __apicdebuginit print_PIC(void) | 1318 | __apicdebuginit(void) print_PIC(void) |
1168 | { | 1319 | { |
1169 | unsigned int v; | 1320 | unsigned int v; |
1170 | unsigned long flags; | 1321 | unsigned long flags; |
@@ -1196,7 +1347,17 @@ void __apicdebuginit print_PIC(void) | |||
1196 | printk(KERN_DEBUG "... PIC ELCR: %04x\n", v); | 1347 | printk(KERN_DEBUG "... PIC ELCR: %04x\n", v); |
1197 | } | 1348 | } |
1198 | 1349 | ||
1199 | #endif /* 0 */ | 1350 | __apicdebuginit(int) print_all_ICs(void) |
1351 | { | ||
1352 | print_PIC(); | ||
1353 | print_all_local_APICs(); | ||
1354 | print_IO_APIC(); | ||
1355 | |||
1356 | return 0; | ||
1357 | } | ||
1358 | |||
1359 | fs_initcall(print_all_ICs); | ||
1360 | |||
1200 | 1361 | ||
1201 | void __init enable_IO_APIC(void) | 1362 | void __init enable_IO_APIC(void) |
1202 | { | 1363 | { |
@@ -1286,7 +1447,7 @@ void disable_IO_APIC(void) | |||
1286 | entry.dest_mode = 0; /* Physical */ | 1447 | entry.dest_mode = 0; /* Physical */ |
1287 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ | 1448 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1288 | entry.vector = 0; | 1449 | entry.vector = 0; |
1289 | entry.dest = GET_APIC_ID(read_apic_id()); | 1450 | entry.dest = read_apic_id(); |
1290 | 1451 | ||
1291 | /* | 1452 | /* |
1292 | * Add it to the IO-APIC irq-routing table: | 1453 | * Add it to the IO-APIC irq-routing table: |
@@ -1392,6 +1553,147 @@ static int ioapic_retrigger_irq(unsigned int irq) | |||
1392 | */ | 1553 | */ |
1393 | 1554 | ||
1394 | #ifdef CONFIG_SMP | 1555 | #ifdef CONFIG_SMP |
1556 | |||
1557 | #ifdef CONFIG_INTR_REMAP | ||
1558 | static void ir_irq_migration(struct work_struct *work); | ||
1559 | |||
1560 | static DECLARE_DELAYED_WORK(ir_migration_work, ir_irq_migration); | ||
1561 | |||
1562 | /* | ||
1563 | * Migrate the IO-APIC irq in the presence of intr-remapping. | ||
1564 | * | ||
1565 | * For edge triggered, irq migration is a simple atomic update(of vector | ||
1566 | * and cpu destination) of IRTE and flush the hardware cache. | ||
1567 | * | ||
1568 | * For level triggered, we need to modify the io-apic RTE aswell with the update | ||
1569 | * vector information, along with modifying IRTE with vector and destination. | ||
1570 | * So irq migration for level triggered is little bit more complex compared to | ||
1571 | * edge triggered migration. But the good news is, we use the same algorithm | ||
1572 | * for level triggered migration as we have today, only difference being, | ||
1573 | * we now initiate the irq migration from process context instead of the | ||
1574 | * interrupt context. | ||
1575 | * | ||
1576 | * In future, when we do a directed EOI (combined with cpu EOI broadcast | ||
1577 | * suppression) to the IO-APIC, level triggered irq migration will also be | ||
1578 | * as simple as edge triggered migration and we can do the irq migration | ||
1579 | * with a simple atomic update to IO-APIC RTE. | ||
1580 | */ | ||
1581 | static void migrate_ioapic_irq(int irq, cpumask_t mask) | ||
1582 | { | ||
1583 | struct irq_cfg *cfg = irq_cfg + irq; | ||
1584 | struct irq_desc *desc = irq_desc + irq; | ||
1585 | cpumask_t tmp, cleanup_mask; | ||
1586 | struct irte irte; | ||
1587 | int modify_ioapic_rte = desc->status & IRQ_LEVEL; | ||
1588 | unsigned int dest; | ||
1589 | unsigned long flags; | ||
1590 | |||
1591 | cpus_and(tmp, mask, cpu_online_map); | ||
1592 | if (cpus_empty(tmp)) | ||
1593 | return; | ||
1594 | |||
1595 | if (get_irte(irq, &irte)) | ||
1596 | return; | ||
1597 | |||
1598 | if (assign_irq_vector(irq, mask)) | ||
1599 | return; | ||
1600 | |||
1601 | cpus_and(tmp, cfg->domain, mask); | ||
1602 | dest = cpu_mask_to_apicid(tmp); | ||
1603 | |||
1604 | if (modify_ioapic_rte) { | ||
1605 | spin_lock_irqsave(&ioapic_lock, flags); | ||
1606 | __target_IO_APIC_irq(irq, dest, cfg->vector); | ||
1607 | spin_unlock_irqrestore(&ioapic_lock, flags); | ||
1608 | } | ||
1609 | |||
1610 | irte.vector = cfg->vector; | ||
1611 | irte.dest_id = IRTE_DEST(dest); | ||
1612 | |||
1613 | /* | ||
1614 | * Modified the IRTE and flushes the Interrupt entry cache. | ||
1615 | */ | ||
1616 | modify_irte(irq, &irte); | ||
1617 | |||
1618 | if (cfg->move_in_progress) { | ||
1619 | cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); | ||
1620 | cfg->move_cleanup_count = cpus_weight(cleanup_mask); | ||
1621 | send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); | ||
1622 | cfg->move_in_progress = 0; | ||
1623 | } | ||
1624 | |||
1625 | irq_desc[irq].affinity = mask; | ||
1626 | } | ||
1627 | |||
1628 | static int migrate_irq_remapped_level(int irq) | ||
1629 | { | ||
1630 | int ret = -1; | ||
1631 | |||
1632 | mask_IO_APIC_irq(irq); | ||
1633 | |||
1634 | if (io_apic_level_ack_pending(irq)) { | ||
1635 | /* | ||
1636 | * Interrupt in progress. Migrating irq now will change the | ||
1637 | * vector information in the IO-APIC RTE and that will confuse | ||
1638 | * the EOI broadcast performed by cpu. | ||
1639 | * So, delay the irq migration to the next instance. | ||
1640 | */ | ||
1641 | schedule_delayed_work(&ir_migration_work, 1); | ||
1642 | goto unmask; | ||
1643 | } | ||
1644 | |||
1645 | /* everthing is clear. we have right of way */ | ||
1646 | migrate_ioapic_irq(irq, irq_desc[irq].pending_mask); | ||
1647 | |||
1648 | ret = 0; | ||
1649 | irq_desc[irq].status &= ~IRQ_MOVE_PENDING; | ||
1650 | cpus_clear(irq_desc[irq].pending_mask); | ||
1651 | |||
1652 | unmask: | ||
1653 | unmask_IO_APIC_irq(irq); | ||
1654 | return ret; | ||
1655 | } | ||
1656 | |||
1657 | static void ir_irq_migration(struct work_struct *work) | ||
1658 | { | ||
1659 | int irq; | ||
1660 | |||
1661 | for (irq = 0; irq < NR_IRQS; irq++) { | ||
1662 | struct irq_desc *desc = irq_desc + irq; | ||
1663 | if (desc->status & IRQ_MOVE_PENDING) { | ||
1664 | unsigned long flags; | ||
1665 | |||
1666 | spin_lock_irqsave(&desc->lock, flags); | ||
1667 | if (!desc->chip->set_affinity || | ||
1668 | !(desc->status & IRQ_MOVE_PENDING)) { | ||
1669 | desc->status &= ~IRQ_MOVE_PENDING; | ||
1670 | spin_unlock_irqrestore(&desc->lock, flags); | ||
1671 | continue; | ||
1672 | } | ||
1673 | |||
1674 | desc->chip->set_affinity(irq, | ||
1675 | irq_desc[irq].pending_mask); | ||
1676 | spin_unlock_irqrestore(&desc->lock, flags); | ||
1677 | } | ||
1678 | } | ||
1679 | } | ||
1680 | |||
1681 | /* | ||
1682 | * Migrates the IRQ destination in the process context. | ||
1683 | */ | ||
1684 | static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) | ||
1685 | { | ||
1686 | if (irq_desc[irq].status & IRQ_LEVEL) { | ||
1687 | irq_desc[irq].status |= IRQ_MOVE_PENDING; | ||
1688 | irq_desc[irq].pending_mask = mask; | ||
1689 | migrate_irq_remapped_level(irq); | ||
1690 | return; | ||
1691 | } | ||
1692 | |||
1693 | migrate_ioapic_irq(irq, mask); | ||
1694 | } | ||
1695 | #endif | ||
1696 | |||
1395 | asmlinkage void smp_irq_move_cleanup_interrupt(void) | 1697 | asmlinkage void smp_irq_move_cleanup_interrupt(void) |
1396 | { | 1698 | { |
1397 | unsigned vector, me; | 1699 | unsigned vector, me; |
@@ -1448,6 +1750,17 @@ static void irq_complete_move(unsigned int irq) | |||
1448 | #else | 1750 | #else |
1449 | static inline void irq_complete_move(unsigned int irq) {} | 1751 | static inline void irq_complete_move(unsigned int irq) {} |
1450 | #endif | 1752 | #endif |
1753 | #ifdef CONFIG_INTR_REMAP | ||
1754 | static void ack_x2apic_level(unsigned int irq) | ||
1755 | { | ||
1756 | ack_x2APIC_irq(); | ||
1757 | } | ||
1758 | |||
1759 | static void ack_x2apic_edge(unsigned int irq) | ||
1760 | { | ||
1761 | ack_x2APIC_irq(); | ||
1762 | } | ||
1763 | #endif | ||
1451 | 1764 | ||
1452 | static void ack_apic_edge(unsigned int irq) | 1765 | static void ack_apic_edge(unsigned int irq) |
1453 | { | 1766 | { |
@@ -1522,6 +1835,21 @@ static struct irq_chip ioapic_chip __read_mostly = { | |||
1522 | .retrigger = ioapic_retrigger_irq, | 1835 | .retrigger = ioapic_retrigger_irq, |
1523 | }; | 1836 | }; |
1524 | 1837 | ||
1838 | #ifdef CONFIG_INTR_REMAP | ||
1839 | static struct irq_chip ir_ioapic_chip __read_mostly = { | ||
1840 | .name = "IR-IO-APIC", | ||
1841 | .startup = startup_ioapic_irq, | ||
1842 | .mask = mask_IO_APIC_irq, | ||
1843 | .unmask = unmask_IO_APIC_irq, | ||
1844 | .ack = ack_x2apic_edge, | ||
1845 | .eoi = ack_x2apic_level, | ||
1846 | #ifdef CONFIG_SMP | ||
1847 | .set_affinity = set_ir_ioapic_affinity_irq, | ||
1848 | #endif | ||
1849 | .retrigger = ioapic_retrigger_irq, | ||
1850 | }; | ||
1851 | #endif | ||
1852 | |||
1525 | static inline void init_IO_APIC_traps(void) | 1853 | static inline void init_IO_APIC_traps(void) |
1526 | { | 1854 | { |
1527 | int irq; | 1855 | int irq; |
@@ -1707,6 +2035,8 @@ static inline void __init check_timer(void) | |||
1707 | * 8259A. | 2035 | * 8259A. |
1708 | */ | 2036 | */ |
1709 | if (pin1 == -1) { | 2037 | if (pin1 == -1) { |
2038 | if (intr_remapping_enabled) | ||
2039 | panic("BIOS bug: timer not connected to IO-APIC"); | ||
1710 | pin1 = pin2; | 2040 | pin1 = pin2; |
1711 | apic1 = apic2; | 2041 | apic1 = apic2; |
1712 | no_pin1 = 1; | 2042 | no_pin1 = 1; |
@@ -1733,6 +2063,8 @@ static inline void __init check_timer(void) | |||
1733 | clear_IO_APIC_pin(0, pin1); | 2063 | clear_IO_APIC_pin(0, pin1); |
1734 | goto out; | 2064 | goto out; |
1735 | } | 2065 | } |
2066 | if (intr_remapping_enabled) | ||
2067 | panic("timer doesn't work through Interrupt-remapped IO-APIC"); | ||
1736 | clear_IO_APIC_pin(apic1, pin1); | 2068 | clear_IO_APIC_pin(apic1, pin1); |
1737 | if (!no_pin1) | 2069 | if (!no_pin1) |
1738 | apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: " | 2070 | apic_printk(APIC_QUIET, KERN_ERR "..MP-BIOS bug: " |
@@ -1849,8 +2181,6 @@ void __init setup_IO_APIC(void) | |||
1849 | setup_IO_APIC_irqs(); | 2181 | setup_IO_APIC_irqs(); |
1850 | init_IO_APIC_traps(); | 2182 | init_IO_APIC_traps(); |
1851 | check_timer(); | 2183 | check_timer(); |
1852 | if (!acpi_ioapic) | ||
1853 | print_IO_APIC(); | ||
1854 | } | 2184 | } |
1855 | 2185 | ||
1856 | struct sysfs_ioapic_data { | 2186 | struct sysfs_ioapic_data { |
@@ -1972,6 +2302,9 @@ void destroy_irq(unsigned int irq) | |||
1972 | 2302 | ||
1973 | dynamic_irq_cleanup(irq); | 2303 | dynamic_irq_cleanup(irq); |
1974 | 2304 | ||
2305 | #ifdef CONFIG_INTR_REMAP | ||
2306 | free_irte(irq); | ||
2307 | #endif | ||
1975 | spin_lock_irqsave(&vector_lock, flags); | 2308 | spin_lock_irqsave(&vector_lock, flags); |
1976 | __clear_irq_vector(irq); | 2309 | __clear_irq_vector(irq); |
1977 | spin_unlock_irqrestore(&vector_lock, flags); | 2310 | spin_unlock_irqrestore(&vector_lock, flags); |
@@ -1990,10 +2323,41 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
1990 | 2323 | ||
1991 | tmp = TARGET_CPUS; | 2324 | tmp = TARGET_CPUS; |
1992 | err = assign_irq_vector(irq, tmp); | 2325 | err = assign_irq_vector(irq, tmp); |
1993 | if (!err) { | 2326 | if (err) |
1994 | cpus_and(tmp, cfg->domain, tmp); | 2327 | return err; |
1995 | dest = cpu_mask_to_apicid(tmp); | 2328 | |
2329 | cpus_and(tmp, cfg->domain, tmp); | ||
2330 | dest = cpu_mask_to_apicid(tmp); | ||
2331 | |||
2332 | #ifdef CONFIG_INTR_REMAP | ||
2333 | if (irq_remapped(irq)) { | ||
2334 | struct irte irte; | ||
2335 | int ir_index; | ||
2336 | u16 sub_handle; | ||
2337 | |||
2338 | ir_index = map_irq_to_irte_handle(irq, &sub_handle); | ||
2339 | BUG_ON(ir_index == -1); | ||
1996 | 2340 | ||
2341 | memset (&irte, 0, sizeof(irte)); | ||
2342 | |||
2343 | irte.present = 1; | ||
2344 | irte.dst_mode = INT_DEST_MODE; | ||
2345 | irte.trigger_mode = 0; /* edge */ | ||
2346 | irte.dlvry_mode = INT_DELIVERY_MODE; | ||
2347 | irte.vector = cfg->vector; | ||
2348 | irte.dest_id = IRTE_DEST(dest); | ||
2349 | |||
2350 | modify_irte(irq, &irte); | ||
2351 | |||
2352 | msg->address_hi = MSI_ADDR_BASE_HI; | ||
2353 | msg->data = sub_handle; | ||
2354 | msg->address_lo = MSI_ADDR_BASE_LO | MSI_ADDR_IR_EXT_INT | | ||
2355 | MSI_ADDR_IR_SHV | | ||
2356 | MSI_ADDR_IR_INDEX1(ir_index) | | ||
2357 | MSI_ADDR_IR_INDEX2(ir_index); | ||
2358 | } else | ||
2359 | #endif | ||
2360 | { | ||
1997 | msg->address_hi = MSI_ADDR_BASE_HI; | 2361 | msg->address_hi = MSI_ADDR_BASE_HI; |
1998 | msg->address_lo = | 2362 | msg->address_lo = |
1999 | MSI_ADDR_BASE_LO | | 2363 | MSI_ADDR_BASE_LO | |
@@ -2044,6 +2408,55 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | |||
2044 | write_msi_msg(irq, &msg); | 2408 | write_msi_msg(irq, &msg); |
2045 | irq_desc[irq].affinity = mask; | 2409 | irq_desc[irq].affinity = mask; |
2046 | } | 2410 | } |
2411 | |||
2412 | #ifdef CONFIG_INTR_REMAP | ||
2413 | /* | ||
2414 | * Migrate the MSI irq to another cpumask. This migration is | ||
2415 | * done in the process context using interrupt-remapping hardware. | ||
2416 | */ | ||
2417 | static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | ||
2418 | { | ||
2419 | struct irq_cfg *cfg = irq_cfg + irq; | ||
2420 | unsigned int dest; | ||
2421 | cpumask_t tmp, cleanup_mask; | ||
2422 | struct irte irte; | ||
2423 | |||
2424 | cpus_and(tmp, mask, cpu_online_map); | ||
2425 | if (cpus_empty(tmp)) | ||
2426 | return; | ||
2427 | |||
2428 | if (get_irte(irq, &irte)) | ||
2429 | return; | ||
2430 | |||
2431 | if (assign_irq_vector(irq, mask)) | ||
2432 | return; | ||
2433 | |||
2434 | cpus_and(tmp, cfg->domain, mask); | ||
2435 | dest = cpu_mask_to_apicid(tmp); | ||
2436 | |||
2437 | irte.vector = cfg->vector; | ||
2438 | irte.dest_id = IRTE_DEST(dest); | ||
2439 | |||
2440 | /* | ||
2441 | * atomically update the IRTE with the new destination and vector. | ||
2442 | */ | ||
2443 | modify_irte(irq, &irte); | ||
2444 | |||
2445 | /* | ||
2446 | * After this point, all the interrupts will start arriving | ||
2447 | * at the new destination. So, time to cleanup the previous | ||
2448 | * vector allocation. | ||
2449 | */ | ||
2450 | if (cfg->move_in_progress) { | ||
2451 | cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); | ||
2452 | cfg->move_cleanup_count = cpus_weight(cleanup_mask); | ||
2453 | send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR); | ||
2454 | cfg->move_in_progress = 0; | ||
2455 | } | ||
2456 | |||
2457 | irq_desc[irq].affinity = mask; | ||
2458 | } | ||
2459 | #endif | ||
2047 | #endif /* CONFIG_SMP */ | 2460 | #endif /* CONFIG_SMP */ |
2048 | 2461 | ||
2049 | /* | 2462 | /* |
@@ -2061,26 +2474,157 @@ static struct irq_chip msi_chip = { | |||
2061 | .retrigger = ioapic_retrigger_irq, | 2474 | .retrigger = ioapic_retrigger_irq, |
2062 | }; | 2475 | }; |
2063 | 2476 | ||
2064 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) | 2477 | #ifdef CONFIG_INTR_REMAP |
2478 | static struct irq_chip msi_ir_chip = { | ||
2479 | .name = "IR-PCI-MSI", | ||
2480 | .unmask = unmask_msi_irq, | ||
2481 | .mask = mask_msi_irq, | ||
2482 | .ack = ack_x2apic_edge, | ||
2483 | #ifdef CONFIG_SMP | ||
2484 | .set_affinity = ir_set_msi_irq_affinity, | ||
2485 | #endif | ||
2486 | .retrigger = ioapic_retrigger_irq, | ||
2487 | }; | ||
2488 | |||
2489 | /* | ||
2490 | * Map the PCI dev to the corresponding remapping hardware unit | ||
2491 | * and allocate 'nvec' consecutive interrupt-remapping table entries | ||
2492 | * in it. | ||
2493 | */ | ||
2494 | static int msi_alloc_irte(struct pci_dev *dev, int irq, int nvec) | ||
2065 | { | 2495 | { |
2496 | struct intel_iommu *iommu; | ||
2497 | int index; | ||
2498 | |||
2499 | iommu = map_dev_to_ir(dev); | ||
2500 | if (!iommu) { | ||
2501 | printk(KERN_ERR | ||
2502 | "Unable to map PCI %s to iommu\n", pci_name(dev)); | ||
2503 | return -ENOENT; | ||
2504 | } | ||
2505 | |||
2506 | index = alloc_irte(iommu, irq, nvec); | ||
2507 | if (index < 0) { | ||
2508 | printk(KERN_ERR | ||
2509 | "Unable to allocate %d IRTE for PCI %s\n", nvec, | ||
2510 | pci_name(dev)); | ||
2511 | return -ENOSPC; | ||
2512 | } | ||
2513 | return index; | ||
2514 | } | ||
2515 | #endif | ||
2516 | |||
2517 | static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc, int irq) | ||
2518 | { | ||
2519 | int ret; | ||
2066 | struct msi_msg msg; | 2520 | struct msi_msg msg; |
2521 | |||
2522 | ret = msi_compose_msg(dev, irq, &msg); | ||
2523 | if (ret < 0) | ||
2524 | return ret; | ||
2525 | |||
2526 | set_irq_msi(irq, desc); | ||
2527 | write_msi_msg(irq, &msg); | ||
2528 | |||
2529 | #ifdef CONFIG_INTR_REMAP | ||
2530 | if (irq_remapped(irq)) { | ||
2531 | struct irq_desc *desc = irq_desc + irq; | ||
2532 | /* | ||
2533 | * irq migration in process context | ||
2534 | */ | ||
2535 | desc->status |= IRQ_MOVE_PCNTXT; | ||
2536 | set_irq_chip_and_handler_name(irq, &msi_ir_chip, handle_edge_irq, "edge"); | ||
2537 | } else | ||
2538 | #endif | ||
2539 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); | ||
2540 | |||
2541 | return 0; | ||
2542 | } | ||
2543 | |||
2544 | int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) | ||
2545 | { | ||
2067 | int irq, ret; | 2546 | int irq, ret; |
2547 | |||
2068 | irq = create_irq(); | 2548 | irq = create_irq(); |
2069 | if (irq < 0) | 2549 | if (irq < 0) |
2070 | return irq; | 2550 | return irq; |
2071 | 2551 | ||
2072 | ret = msi_compose_msg(dev, irq, &msg); | 2552 | #ifdef CONFIG_INTR_REMAP |
2553 | if (!intr_remapping_enabled) | ||
2554 | goto no_ir; | ||
2555 | |||
2556 | ret = msi_alloc_irte(dev, irq, 1); | ||
2557 | if (ret < 0) | ||
2558 | goto error; | ||
2559 | no_ir: | ||
2560 | #endif | ||
2561 | ret = setup_msi_irq(dev, desc, irq); | ||
2073 | if (ret < 0) { | 2562 | if (ret < 0) { |
2074 | destroy_irq(irq); | 2563 | destroy_irq(irq); |
2075 | return ret; | 2564 | return ret; |
2076 | } | 2565 | } |
2566 | return 0; | ||
2077 | 2567 | ||
2078 | set_irq_msi(irq, desc); | 2568 | #ifdef CONFIG_INTR_REMAP |
2079 | write_msi_msg(irq, &msg); | 2569 | error: |
2570 | destroy_irq(irq); | ||
2571 | return ret; | ||
2572 | #endif | ||
2573 | } | ||
2574 | |||
2575 | int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | ||
2576 | { | ||
2577 | int irq, ret, sub_handle; | ||
2578 | struct msi_desc *desc; | ||
2579 | #ifdef CONFIG_INTR_REMAP | ||
2580 | struct intel_iommu *iommu = 0; | ||
2581 | int index = 0; | ||
2582 | #endif | ||
2080 | 2583 | ||
2081 | set_irq_chip_and_handler_name(irq, &msi_chip, handle_edge_irq, "edge"); | 2584 | sub_handle = 0; |
2585 | list_for_each_entry(desc, &dev->msi_list, list) { | ||
2586 | irq = create_irq(); | ||
2587 | if (irq < 0) | ||
2588 | return irq; | ||
2589 | #ifdef CONFIG_INTR_REMAP | ||
2590 | if (!intr_remapping_enabled) | ||
2591 | goto no_ir; | ||
2082 | 2592 | ||
2593 | if (!sub_handle) { | ||
2594 | /* | ||
2595 | * allocate the consecutive block of IRTE's | ||
2596 | * for 'nvec' | ||
2597 | */ | ||
2598 | index = msi_alloc_irte(dev, irq, nvec); | ||
2599 | if (index < 0) { | ||
2600 | ret = index; | ||
2601 | goto error; | ||
2602 | } | ||
2603 | } else { | ||
2604 | iommu = map_dev_to_ir(dev); | ||
2605 | if (!iommu) { | ||
2606 | ret = -ENOENT; | ||
2607 | goto error; | ||
2608 | } | ||
2609 | /* | ||
2610 | * setup the mapping between the irq and the IRTE | ||
2611 | * base index, the sub_handle pointing to the | ||
2612 | * appropriate interrupt remap table entry. | ||
2613 | */ | ||
2614 | set_irte_irq(irq, iommu, index, sub_handle); | ||
2615 | } | ||
2616 | no_ir: | ||
2617 | #endif | ||
2618 | ret = setup_msi_irq(dev, desc, irq); | ||
2619 | if (ret < 0) | ||
2620 | goto error; | ||
2621 | sub_handle++; | ||
2622 | } | ||
2083 | return 0; | 2623 | return 0; |
2624 | |||
2625 | error: | ||
2626 | destroy_irq(irq); | ||
2627 | return ret; | ||
2084 | } | 2628 | } |
2085 | 2629 | ||
2086 | void arch_teardown_msi_irq(unsigned int irq) | 2630 | void arch_teardown_msi_irq(unsigned int irq) |
@@ -2328,6 +2872,10 @@ void __init setup_ioapic_dest(void) | |||
2328 | setup_IO_APIC_irq(ioapic, pin, irq, | 2872 | setup_IO_APIC_irq(ioapic, pin, irq, |
2329 | irq_trigger(irq_entry), | 2873 | irq_trigger(irq_entry), |
2330 | irq_polarity(irq_entry)); | 2874 | irq_polarity(irq_entry)); |
2875 | #ifdef CONFIG_INTR_REMAP | ||
2876 | else if (intr_remapping_enabled) | ||
2877 | set_ir_ioapic_affinity_irq(irq, TARGET_CPUS); | ||
2878 | #endif | ||
2331 | else | 2879 | else |
2332 | set_ioapic_affinity_irq(irq, TARGET_CPUS); | 2880 | set_ioapic_affinity_irq(irq, TARGET_CPUS); |
2333 | } | 2881 | } |
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c index 50e5e4a31c85..191914302744 100644 --- a/arch/x86/kernel/ioport.c +++ b/arch/x86/kernel/ioport.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/thread_info.h> | 15 | #include <linux/thread_info.h> |
16 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
17 | #include <asm/syscalls.h> | ||
17 | 18 | ||
18 | /* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */ | 19 | /* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */ |
19 | static void set_bitmap(unsigned long *bitmap, unsigned int base, | 20 | static void set_bitmap(unsigned long *bitmap, unsigned int base, |
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/ipi.c index 3f7537b669d3..f1c688e46f35 100644 --- a/arch/x86/kernel/ipi.c +++ b/arch/x86/kernel/ipi.c | |||
@@ -20,6 +20,8 @@ | |||
20 | 20 | ||
21 | #ifdef CONFIG_X86_32 | 21 | #ifdef CONFIG_X86_32 |
22 | #include <mach_apic.h> | 22 | #include <mach_apic.h> |
23 | #include <mach_ipi.h> | ||
24 | |||
23 | /* | 25 | /* |
24 | * the following functions deal with sending IPIs between CPUs. | 26 | * the following functions deal with sending IPIs between CPUs. |
25 | * | 27 | * |
@@ -147,7 +149,6 @@ void send_IPI_mask_sequence(cpumask_t mask, int vector) | |||
147 | } | 149 | } |
148 | 150 | ||
149 | /* must come after the send_IPI functions above for inlining */ | 151 | /* must come after the send_IPI functions above for inlining */ |
150 | #include <mach_ipi.h> | ||
151 | static int convert_apicid_to_cpu(int apic_id) | 152 | static int convert_apicid_to_cpu(int apic_id) |
152 | { | 153 | { |
153 | int i; | 154 | int i; |
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c index d66914287ee1..9200a1e2752d 100644 --- a/arch/x86/kernel/irqinit_32.c +++ b/arch/x86/kernel/irqinit_32.c | |||
@@ -74,6 +74,15 @@ void __init init_ISA_irqs (void) | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /* | ||
78 | * IRQ2 is cascade interrupt to second interrupt controller | ||
79 | */ | ||
80 | static struct irqaction irq2 = { | ||
81 | .handler = no_action, | ||
82 | .mask = CPU_MASK_NONE, | ||
83 | .name = "cascade", | ||
84 | }; | ||
85 | |||
77 | /* Overridden in paravirt.c */ | 86 | /* Overridden in paravirt.c */ |
78 | void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ"))); | 87 | void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ"))); |
79 | 88 | ||
@@ -98,6 +107,46 @@ void __init native_init_IRQ(void) | |||
98 | set_intr_gate(vector, interrupt[i]); | 107 | set_intr_gate(vector, interrupt[i]); |
99 | } | 108 | } |
100 | 109 | ||
110 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_SMP) | ||
111 | /* | ||
112 | * IRQ0 must be given a fixed assignment and initialized, | ||
113 | * because it's used before the IO-APIC is set up. | ||
114 | */ | ||
115 | set_intr_gate(FIRST_DEVICE_VECTOR, interrupt[0]); | ||
116 | |||
117 | /* | ||
118 | * The reschedule interrupt is a CPU-to-CPU reschedule-helper | ||
119 | * IPI, driven by wakeup. | ||
120 | */ | ||
121 | alloc_intr_gate(RESCHEDULE_VECTOR, reschedule_interrupt); | ||
122 | |||
123 | /* IPI for invalidation */ | ||
124 | alloc_intr_gate(INVALIDATE_TLB_VECTOR, invalidate_interrupt); | ||
125 | |||
126 | /* IPI for generic function call */ | ||
127 | alloc_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); | ||
128 | |||
129 | /* IPI for single call function */ | ||
130 | set_intr_gate(CALL_FUNCTION_SINGLE_VECTOR, call_function_single_interrupt); | ||
131 | #endif | ||
132 | |||
133 | #ifdef CONFIG_X86_LOCAL_APIC | ||
134 | /* self generated IPI for local APIC timer */ | ||
135 | alloc_intr_gate(LOCAL_TIMER_VECTOR, apic_timer_interrupt); | ||
136 | |||
137 | /* IPI vectors for APIC spurious and error interrupts */ | ||
138 | alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt); | ||
139 | alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt); | ||
140 | #endif | ||
141 | |||
142 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_MCE_P4THERMAL) | ||
143 | /* thermal monitor LVT interrupt */ | ||
144 | alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt); | ||
145 | #endif | ||
146 | |||
147 | if (!acpi_ioapic) | ||
148 | setup_irq(2, &irq2); | ||
149 | |||
101 | /* setup after call gates are initialised (usually add in | 150 | /* setup after call gates are initialised (usually add in |
102 | * the architecture specific gates) | 151 | * the architecture specific gates) |
103 | */ | 152 | */ |
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index 43c019f85f0d..6c27679ec6aa 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c | |||
@@ -431,7 +431,6 @@ static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) | |||
431 | regs->ip = (unsigned long)p->ainsn.insn; | 431 | regs->ip = (unsigned long)p->ainsn.insn; |
432 | } | 432 | } |
433 | 433 | ||
434 | /* Called with kretprobe_lock held */ | ||
435 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | 434 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, |
436 | struct pt_regs *regs) | 435 | struct pt_regs *regs) |
437 | { | 436 | { |
@@ -682,8 +681,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs) | |||
682 | unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; | 681 | unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; |
683 | 682 | ||
684 | INIT_HLIST_HEAD(&empty_rp); | 683 | INIT_HLIST_HEAD(&empty_rp); |
685 | spin_lock_irqsave(&kretprobe_lock, flags); | 684 | kretprobe_hash_lock(current, &head, &flags); |
686 | head = kretprobe_inst_table_head(current); | ||
687 | /* fixup registers */ | 685 | /* fixup registers */ |
688 | #ifdef CONFIG_X86_64 | 686 | #ifdef CONFIG_X86_64 |
689 | regs->cs = __KERNEL_CS; | 687 | regs->cs = __KERNEL_CS; |
@@ -732,7 +730,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs) | |||
732 | 730 | ||
733 | kretprobe_assert(ri, orig_ret_address, trampoline_address); | 731 | kretprobe_assert(ri, orig_ret_address, trampoline_address); |
734 | 732 | ||
735 | spin_unlock_irqrestore(&kretprobe_lock, flags); | 733 | kretprobe_hash_unlock(current, &flags); |
736 | 734 | ||
737 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { | 735 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { |
738 | hlist_del(&ri->hlist); | 736 | hlist_del(&ri->hlist); |
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index 3fee2aa50f3f..0ed5f939b905 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/ldt.h> | 18 | #include <asm/ldt.h> |
19 | #include <asm/desc.h> | 19 | #include <asm/desc.h> |
20 | #include <asm/mmu_context.h> | 20 | #include <asm/mmu_context.h> |
21 | #include <asm/syscalls.h> | ||
21 | 22 | ||
22 | #ifdef CONFIG_SMP | 23 | #ifdef CONFIG_SMP |
23 | static void flush_ldt(void *current_mm) | 24 | static void flush_ldt(void *current_mm) |
@@ -62,12 +63,10 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload) | |||
62 | 63 | ||
63 | if (reload) { | 64 | if (reload) { |
64 | #ifdef CONFIG_SMP | 65 | #ifdef CONFIG_SMP |
65 | cpumask_of_cpu_ptr_declare(mask); | ||
66 | |||
67 | preempt_disable(); | 66 | preempt_disable(); |
68 | load_LDT(pc); | 67 | load_LDT(pc); |
69 | cpumask_of_cpu_ptr_next(mask, smp_processor_id()); | 68 | if (!cpus_equal(current->mm->cpu_vm_mask, |
70 | if (!cpus_equal(current->mm->cpu_vm_mask, *mask)) | 69 | cpumask_of_cpu(smp_processor_id()))) |
71 | smp_call_function(flush_ldt, current->mm, 1); | 70 | smp_call_function(flush_ldt, current->mm, 1); |
72 | preempt_enable(); | 71 | preempt_enable(); |
73 | #else | 72 | #else |
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c index 8864230d55af..0732adba05ca 100644 --- a/arch/x86/kernel/machine_kexec_32.c +++ b/arch/x86/kernel/machine_kexec_32.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/numa.h> | 13 | #include <linux/numa.h> |
14 | #include <linux/ftrace.h> | 14 | #include <linux/ftrace.h> |
15 | #include <linux/suspend.h> | ||
15 | 16 | ||
16 | #include <asm/pgtable.h> | 17 | #include <asm/pgtable.h> |
17 | #include <asm/pgalloc.h> | 18 | #include <asm/pgalloc.h> |
@@ -22,6 +23,7 @@ | |||
22 | #include <asm/cpufeature.h> | 23 | #include <asm/cpufeature.h> |
23 | #include <asm/desc.h> | 24 | #include <asm/desc.h> |
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
26 | #include <asm/cacheflush.h> | ||
25 | 27 | ||
26 | #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE))) | 28 | #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE))) |
27 | static u32 kexec_pgd[1024] PAGE_ALIGNED; | 29 | static u32 kexec_pgd[1024] PAGE_ALIGNED; |
@@ -77,7 +79,7 @@ static void load_segments(void) | |||
77 | /* | 79 | /* |
78 | * A architecture hook called to validate the | 80 | * A architecture hook called to validate the |
79 | * proposed image and prepare the control pages | 81 | * proposed image and prepare the control pages |
80 | * as needed. The pages for KEXEC_CONTROL_CODE_SIZE | 82 | * as needed. The pages for KEXEC_CONTROL_PAGE_SIZE |
81 | * have been allocated, but the segments have yet | 83 | * have been allocated, but the segments have yet |
82 | * been copied into the kernel. | 84 | * been copied into the kernel. |
83 | * | 85 | * |
@@ -85,10 +87,12 @@ static void load_segments(void) | |||
85 | * reboot code buffer to allow us to avoid allocations | 87 | * reboot code buffer to allow us to avoid allocations |
86 | * later. | 88 | * later. |
87 | * | 89 | * |
88 | * Currently nothing. | 90 | * Make control page executable. |
89 | */ | 91 | */ |
90 | int machine_kexec_prepare(struct kimage *image) | 92 | int machine_kexec_prepare(struct kimage *image) |
91 | { | 93 | { |
94 | if (nx_enabled) | ||
95 | set_pages_x(image->control_code_page, 1); | ||
92 | return 0; | 96 | return 0; |
93 | } | 97 | } |
94 | 98 | ||
@@ -98,27 +102,54 @@ int machine_kexec_prepare(struct kimage *image) | |||
98 | */ | 102 | */ |
99 | void machine_kexec_cleanup(struct kimage *image) | 103 | void machine_kexec_cleanup(struct kimage *image) |
100 | { | 104 | { |
105 | if (nx_enabled) | ||
106 | set_pages_nx(image->control_code_page, 1); | ||
101 | } | 107 | } |
102 | 108 | ||
103 | /* | 109 | /* |
104 | * Do not allocate memory (or fail in any way) in machine_kexec(). | 110 | * Do not allocate memory (or fail in any way) in machine_kexec(). |
105 | * We are past the point of no return, committed to rebooting now. | 111 | * We are past the point of no return, committed to rebooting now. |
106 | */ | 112 | */ |
107 | NORET_TYPE void machine_kexec(struct kimage *image) | 113 | void machine_kexec(struct kimage *image) |
108 | { | 114 | { |
109 | unsigned long page_list[PAGES_NR]; | 115 | unsigned long page_list[PAGES_NR]; |
110 | void *control_page; | 116 | void *control_page; |
117 | int save_ftrace_enabled; | ||
118 | asmlinkage unsigned long | ||
119 | (*relocate_kernel_ptr)(unsigned long indirection_page, | ||
120 | unsigned long control_page, | ||
121 | unsigned long start_address, | ||
122 | unsigned int has_pae, | ||
123 | unsigned int preserve_context); | ||
124 | |||
125 | #ifdef CONFIG_KEXEC_JUMP | ||
126 | if (kexec_image->preserve_context) | ||
127 | save_processor_state(); | ||
128 | #endif | ||
111 | 129 | ||
112 | tracer_disable(); | 130 | save_ftrace_enabled = __ftrace_enabled_save(); |
113 | 131 | ||
114 | /* Interrupts aren't acceptable while we reboot */ | 132 | /* Interrupts aren't acceptable while we reboot */ |
115 | local_irq_disable(); | 133 | local_irq_disable(); |
116 | 134 | ||
135 | if (image->preserve_context) { | ||
136 | #ifdef CONFIG_X86_IO_APIC | ||
137 | /* We need to put APICs in legacy mode so that we can | ||
138 | * get timer interrupts in second kernel. kexec/kdump | ||
139 | * paths already have calls to disable_IO_APIC() in | ||
140 | * one form or other. kexec jump path also need | ||
141 | * one. | ||
142 | */ | ||
143 | disable_IO_APIC(); | ||
144 | #endif | ||
145 | } | ||
146 | |||
117 | control_page = page_address(image->control_code_page); | 147 | control_page = page_address(image->control_code_page); |
118 | memcpy(control_page, relocate_kernel, PAGE_SIZE); | 148 | memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE); |
119 | 149 | ||
150 | relocate_kernel_ptr = control_page; | ||
120 | page_list[PA_CONTROL_PAGE] = __pa(control_page); | 151 | page_list[PA_CONTROL_PAGE] = __pa(control_page); |
121 | page_list[VA_CONTROL_PAGE] = (unsigned long)relocate_kernel; | 152 | page_list[VA_CONTROL_PAGE] = (unsigned long)control_page; |
122 | page_list[PA_PGD] = __pa(kexec_pgd); | 153 | page_list[PA_PGD] = __pa(kexec_pgd); |
123 | page_list[VA_PGD] = (unsigned long)kexec_pgd; | 154 | page_list[VA_PGD] = (unsigned long)kexec_pgd; |
124 | #ifdef CONFIG_X86_PAE | 155 | #ifdef CONFIG_X86_PAE |
@@ -131,6 +162,7 @@ NORET_TYPE void machine_kexec(struct kimage *image) | |||
131 | page_list[VA_PTE_0] = (unsigned long)kexec_pte0; | 162 | page_list[VA_PTE_0] = (unsigned long)kexec_pte0; |
132 | page_list[PA_PTE_1] = __pa(kexec_pte1); | 163 | page_list[PA_PTE_1] = __pa(kexec_pte1); |
133 | page_list[VA_PTE_1] = (unsigned long)kexec_pte1; | 164 | page_list[VA_PTE_1] = (unsigned long)kexec_pte1; |
165 | page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT); | ||
134 | 166 | ||
135 | /* The segment registers are funny things, they have both a | 167 | /* The segment registers are funny things, they have both a |
136 | * visible and an invisible part. Whenever the visible part is | 168 | * visible and an invisible part. Whenever the visible part is |
@@ -149,8 +181,17 @@ NORET_TYPE void machine_kexec(struct kimage *image) | |||
149 | set_idt(phys_to_virt(0),0); | 181 | set_idt(phys_to_virt(0),0); |
150 | 182 | ||
151 | /* now call it */ | 183 | /* now call it */ |
152 | relocate_kernel((unsigned long)image->head, (unsigned long)page_list, | 184 | image->start = relocate_kernel_ptr((unsigned long)image->head, |
153 | image->start, cpu_has_pae); | 185 | (unsigned long)page_list, |
186 | image->start, cpu_has_pae, | ||
187 | image->preserve_context); | ||
188 | |||
189 | #ifdef CONFIG_KEXEC_JUMP | ||
190 | if (kexec_image->preserve_context) | ||
191 | restore_processor_state(); | ||
192 | #endif | ||
193 | |||
194 | __ftrace_enabled_restore(save_ftrace_enabled); | ||
154 | } | 195 | } |
155 | 196 | ||
156 | void arch_crash_save_vmcoreinfo(void) | 197 | void arch_crash_save_vmcoreinfo(void) |
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 9dd9262693a3..c43caa3a91f3 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c | |||
@@ -181,7 +181,7 @@ void machine_kexec_cleanup(struct kimage *image) | |||
181 | * Do not allocate memory (or fail in any way) in machine_kexec(). | 181 | * Do not allocate memory (or fail in any way) in machine_kexec(). |
182 | * We are past the point of no return, committed to rebooting now. | 182 | * We are past the point of no return, committed to rebooting now. |
183 | */ | 183 | */ |
184 | NORET_TYPE void machine_kexec(struct kimage *image) | 184 | void machine_kexec(struct kimage *image) |
185 | { | 185 | { |
186 | unsigned long page_list[PAGES_NR]; | 186 | unsigned long page_list[PAGES_NR]; |
187 | void *control_page; | 187 | void *control_page; |
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c index 07c0f828f488..3b599518c322 100644 --- a/arch/x86/kernel/mfgpt_32.c +++ b/arch/x86/kernel/mfgpt_32.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <asm/geode.h> | 34 | #include <asm/geode.h> |
35 | 35 | ||
36 | #define MFGPT_DEFAULT_IRQ 7 | ||
37 | |||
36 | static struct mfgpt_timer_t { | 38 | static struct mfgpt_timer_t { |
37 | unsigned int avail:1; | 39 | unsigned int avail:1; |
38 | } mfgpt_timers[MFGPT_MAX_TIMERS]; | 40 | } mfgpt_timers[MFGPT_MAX_TIMERS]; |
@@ -157,29 +159,48 @@ int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable) | |||
157 | } | 159 | } |
158 | EXPORT_SYMBOL_GPL(geode_mfgpt_toggle_event); | 160 | EXPORT_SYMBOL_GPL(geode_mfgpt_toggle_event); |
159 | 161 | ||
160 | int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable) | 162 | int geode_mfgpt_set_irq(int timer, int cmp, int *irq, int enable) |
161 | { | 163 | { |
162 | u32 val, dummy; | 164 | u32 zsel, lpc, dummy; |
163 | int offset; | 165 | int shift; |
164 | 166 | ||
165 | if (timer < 0 || timer >= MFGPT_MAX_TIMERS) | 167 | if (timer < 0 || timer >= MFGPT_MAX_TIMERS) |
166 | return -EIO; | 168 | return -EIO; |
167 | 169 | ||
168 | if (geode_mfgpt_toggle_event(timer, cmp, MFGPT_EVENT_IRQ, enable)) | 170 | /* |
171 | * Unfortunately, MFGPTs come in pairs sharing their IRQ lines. If VSA | ||
172 | * is using the same CMP of the timer's Siamese twin, the IRQ is set to | ||
173 | * 2, and we mustn't use nor change it. | ||
174 | * XXX: Likewise, 2 Linux drivers might clash if the 2nd overwrites the | ||
175 | * IRQ of the 1st. This can only happen if forcing an IRQ, calling this | ||
176 | * with *irq==0 is safe. Currently there _are_ no 2 drivers. | ||
177 | */ | ||
178 | rdmsr(MSR_PIC_ZSEL_LOW, zsel, dummy); | ||
179 | shift = ((cmp == MFGPT_CMP1 ? 0 : 4) + timer % 4) * 4; | ||
180 | if (((zsel >> shift) & 0xF) == 2) | ||
169 | return -EIO; | 181 | return -EIO; |
170 | 182 | ||
171 | rdmsr(MSR_PIC_ZSEL_LOW, val, dummy); | 183 | /* Choose IRQ: if none supplied, keep IRQ already set or use default */ |
184 | if (!*irq) | ||
185 | *irq = (zsel >> shift) & 0xF; | ||
186 | if (!*irq) | ||
187 | *irq = MFGPT_DEFAULT_IRQ; | ||
172 | 188 | ||
173 | offset = (timer % 4) * 4; | 189 | /* Can't use IRQ if it's 0 (=disabled), 2, or routed to LPC */ |
174 | 190 | if (*irq < 1 || *irq == 2 || *irq > 15) | |
175 | val &= ~((0xF << offset) | (0xF << (offset + 16))); | 191 | return -EIO; |
192 | rdmsr(MSR_PIC_IRQM_LPC, lpc, dummy); | ||
193 | if (lpc & (1 << *irq)) | ||
194 | return -EIO; | ||
176 | 195 | ||
196 | /* All chosen and checked - go for it */ | ||
197 | if (geode_mfgpt_toggle_event(timer, cmp, MFGPT_EVENT_IRQ, enable)) | ||
198 | return -EIO; | ||
177 | if (enable) { | 199 | if (enable) { |
178 | val |= (irq & 0x0F) << (offset); | 200 | zsel = (zsel & ~(0xF << shift)) | (*irq << shift); |
179 | val |= (irq & 0x0F) << (offset + 16); | 201 | wrmsr(MSR_PIC_ZSEL_LOW, zsel, dummy); |
180 | } | 202 | } |
181 | 203 | ||
182 | wrmsr(MSR_PIC_ZSEL_LOW, val, dummy); | ||
183 | return 0; | 204 | return 0; |
184 | } | 205 | } |
185 | 206 | ||
@@ -242,7 +263,7 @@ EXPORT_SYMBOL_GPL(geode_mfgpt_alloc_timer); | |||
242 | static unsigned int mfgpt_tick_mode = CLOCK_EVT_MODE_SHUTDOWN; | 263 | static unsigned int mfgpt_tick_mode = CLOCK_EVT_MODE_SHUTDOWN; |
243 | static u16 mfgpt_event_clock; | 264 | static u16 mfgpt_event_clock; |
244 | 265 | ||
245 | static int irq = 7; | 266 | static int irq; |
246 | static int __init mfgpt_setup(char *str) | 267 | static int __init mfgpt_setup(char *str) |
247 | { | 268 | { |
248 | get_option(&str, &irq); | 269 | get_option(&str, &irq); |
@@ -346,7 +367,7 @@ int __init mfgpt_timer_setup(void) | |||
346 | mfgpt_event_clock = timer; | 367 | mfgpt_event_clock = timer; |
347 | 368 | ||
348 | /* Set up the IRQ on the MFGPT side */ | 369 | /* Set up the IRQ on the MFGPT side */ |
349 | if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, irq)) { | 370 | if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, &irq)) { |
350 | printk(KERN_ERR "mfgpt-timer: Could not set up IRQ %d\n", irq); | 371 | printk(KERN_ERR "mfgpt-timer: Could not set up IRQ %d\n", irq); |
351 | return -EIO; | 372 | return -EIO; |
352 | } | 373 | } |
@@ -374,13 +395,14 @@ int __init mfgpt_timer_setup(void) | |||
374 | &mfgpt_clockevent); | 395 | &mfgpt_clockevent); |
375 | 396 | ||
376 | printk(KERN_INFO | 397 | printk(KERN_INFO |
377 | "mfgpt-timer: registering the MFGPT timer as a clock event.\n"); | 398 | "mfgpt-timer: Registering MFGPT timer %d as a clock event, using IRQ %d\n", |
399 | timer, irq); | ||
378 | clockevents_register_device(&mfgpt_clockevent); | 400 | clockevents_register_device(&mfgpt_clockevent); |
379 | 401 | ||
380 | return 0; | 402 | return 0; |
381 | 403 | ||
382 | err: | 404 | err: |
383 | geode_mfgpt_release_irq(mfgpt_event_clock, MFGPT_CMP2, irq); | 405 | geode_mfgpt_release_irq(mfgpt_event_clock, MFGPT_CMP2, &irq); |
384 | printk(KERN_ERR | 406 | printk(KERN_ERR |
385 | "mfgpt-timer: Unable to set up the MFGPT clock source\n"); | 407 | "mfgpt-timer: Unable to set up the MFGPT clock source\n"); |
386 | return -EIO; | 408 | return -EIO; |
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c index 6994c751590e..652fa5c38ebe 100644 --- a/arch/x86/kernel/microcode.c +++ b/arch/x86/kernel/microcode.c | |||
@@ -388,7 +388,6 @@ static int do_microcode_update (void) | |||
388 | void *new_mc = NULL; | 388 | void *new_mc = NULL; |
389 | int cpu; | 389 | int cpu; |
390 | cpumask_t old; | 390 | cpumask_t old; |
391 | cpumask_of_cpu_ptr_declare(newmask); | ||
392 | 391 | ||
393 | old = current->cpus_allowed; | 392 | old = current->cpus_allowed; |
394 | 393 | ||
@@ -405,8 +404,7 @@ static int do_microcode_update (void) | |||
405 | 404 | ||
406 | if (!uci->valid) | 405 | if (!uci->valid) |
407 | continue; | 406 | continue; |
408 | cpumask_of_cpu_ptr_next(newmask, cpu); | 407 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
409 | set_cpus_allowed_ptr(current, newmask); | ||
410 | error = get_maching_microcode(new_mc, cpu); | 408 | error = get_maching_microcode(new_mc, cpu); |
411 | if (error < 0) | 409 | if (error < 0) |
412 | goto out; | 410 | goto out; |
@@ -576,7 +574,6 @@ static int apply_microcode_check_cpu(int cpu) | |||
576 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 574 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
577 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 575 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
578 | cpumask_t old; | 576 | cpumask_t old; |
579 | cpumask_of_cpu_ptr(newmask, cpu); | ||
580 | unsigned int val[2]; | 577 | unsigned int val[2]; |
581 | int err = 0; | 578 | int err = 0; |
582 | 579 | ||
@@ -585,7 +582,7 @@ static int apply_microcode_check_cpu(int cpu) | |||
585 | return 0; | 582 | return 0; |
586 | 583 | ||
587 | old = current->cpus_allowed; | 584 | old = current->cpus_allowed; |
588 | set_cpus_allowed_ptr(current, newmask); | 585 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
589 | 586 | ||
590 | /* Check if the microcode we have in memory matches the CPU */ | 587 | /* Check if the microcode we have in memory matches the CPU */ |
591 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || | 588 | if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || |
@@ -623,12 +620,11 @@ static int apply_microcode_check_cpu(int cpu) | |||
623 | static void microcode_init_cpu(int cpu, int resume) | 620 | static void microcode_init_cpu(int cpu, int resume) |
624 | { | 621 | { |
625 | cpumask_t old; | 622 | cpumask_t old; |
626 | cpumask_of_cpu_ptr(newmask, cpu); | ||
627 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; | 623 | struct ucode_cpu_info *uci = ucode_cpu_info + cpu; |
628 | 624 | ||
629 | old = current->cpus_allowed; | 625 | old = current->cpus_allowed; |
630 | 626 | ||
631 | set_cpus_allowed_ptr(current, newmask); | 627 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
632 | mutex_lock(µcode_mutex); | 628 | mutex_lock(µcode_mutex); |
633 | collect_cpu_info(cpu); | 629 | collect_cpu_info(cpu); |
634 | if (uci->valid && system_state == SYSTEM_RUNNING && !resume) | 630 | if (uci->valid && system_state == SYSTEM_RUNNING && !resume) |
@@ -661,13 +657,10 @@ static ssize_t reload_store(struct sys_device *dev, | |||
661 | if (end == buf) | 657 | if (end == buf) |
662 | return -EINVAL; | 658 | return -EINVAL; |
663 | if (val == 1) { | 659 | if (val == 1) { |
664 | cpumask_t old; | 660 | cpumask_t old = current->cpus_allowed; |
665 | cpumask_of_cpu_ptr(newmask, cpu); | ||
666 | |||
667 | old = current->cpus_allowed; | ||
668 | 661 | ||
669 | get_online_cpus(); | 662 | get_online_cpus(); |
670 | set_cpus_allowed_ptr(current, newmask); | 663 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); |
671 | 664 | ||
672 | mutex_lock(µcode_mutex); | 665 | mutex_lock(µcode_mutex); |
673 | if (uci->valid) | 666 | if (uci->valid) |
diff --git a/arch/x86/kernel/mmconf-fam10h_64.c b/arch/x86/kernel/mmconf-fam10h_64.c index fdfdc550b366..efc2f361fe85 100644 --- a/arch/x86/kernel/mmconf-fam10h_64.c +++ b/arch/x86/kernel/mmconf-fam10h_64.c | |||
@@ -238,7 +238,7 @@ static struct dmi_system_id __devinitdata mmconf_dmi_table[] = { | |||
238 | {} | 238 | {} |
239 | }; | 239 | }; |
240 | 240 | ||
241 | void __init check_enable_amd_mmconf_dmi(void) | 241 | void __cpuinit check_enable_amd_mmconf_dmi(void) |
242 | { | 242 | { |
243 | dmi_check_system(mmconf_dmi_table); | 243 | dmi_check_system(mmconf_dmi_table); |
244 | } | 244 | } |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 6ae005ccaed8..f98f4e1dba09 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -49,7 +49,7 @@ static int __init mpf_checksum(unsigned char *mp, int len) | |||
49 | return sum & 0xFF; | 49 | return sum & 0xFF; |
50 | } | 50 | } |
51 | 51 | ||
52 | static void __cpuinit MP_processor_info(struct mpc_config_processor *m) | 52 | static void __init MP_processor_info(struct mpc_config_processor *m) |
53 | { | 53 | { |
54 | int apicid; | 54 | int apicid; |
55 | char *bootup_cpu = ""; | 55 | char *bootup_cpu = ""; |
@@ -83,7 +83,7 @@ static void __init MP_bus_info(struct mpc_config_bus *m) | |||
83 | if (x86_quirks->mpc_oem_bus_info) | 83 | if (x86_quirks->mpc_oem_bus_info) |
84 | x86_quirks->mpc_oem_bus_info(m, str); | 84 | x86_quirks->mpc_oem_bus_info(m, str); |
85 | else | 85 | else |
86 | printk(KERN_INFO "Bus #%d is %s\n", m->mpc_busid, str); | 86 | apic_printk(APIC_VERBOSE, "Bus #%d is %s\n", m->mpc_busid, str); |
87 | 87 | ||
88 | #if MAX_MP_BUSSES < 256 | 88 | #if MAX_MP_BUSSES < 256 |
89 | if (m->mpc_busid >= MAX_MP_BUSSES) { | 89 | if (m->mpc_busid >= MAX_MP_BUSSES) { |
@@ -154,7 +154,7 @@ static void __init MP_ioapic_info(struct mpc_config_ioapic *m) | |||
154 | 154 | ||
155 | static void print_MP_intsrc_info(struct mpc_config_intsrc *m) | 155 | static void print_MP_intsrc_info(struct mpc_config_intsrc *m) |
156 | { | 156 | { |
157 | printk(KERN_CONT "Int: type %d, pol %d, trig %d, bus %02x," | 157 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," |
158 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", | 158 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", |
159 | m->mpc_irqtype, m->mpc_irqflag & 3, | 159 | m->mpc_irqtype, m->mpc_irqflag & 3, |
160 | (m->mpc_irqflag >> 2) & 3, m->mpc_srcbus, | 160 | (m->mpc_irqflag >> 2) & 3, m->mpc_srcbus, |
@@ -163,7 +163,7 @@ static void print_MP_intsrc_info(struct mpc_config_intsrc *m) | |||
163 | 163 | ||
164 | static void __init print_mp_irq_info(struct mp_config_intsrc *mp_irq) | 164 | static void __init print_mp_irq_info(struct mp_config_intsrc *mp_irq) |
165 | { | 165 | { |
166 | printk(KERN_CONT "Int: type %d, pol %d, trig %d, bus %02x," | 166 | apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," |
167 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", | 167 | " IRQ %02x, APIC ID %x, APIC INT %02x\n", |
168 | mp_irq->mp_irqtype, mp_irq->mp_irqflag & 3, | 168 | mp_irq->mp_irqtype, mp_irq->mp_irqflag & 3, |
169 | (mp_irq->mp_irqflag >> 2) & 3, mp_irq->mp_srcbus, | 169 | (mp_irq->mp_irqflag >> 2) & 3, mp_irq->mp_srcbus, |
@@ -235,7 +235,7 @@ static void __init MP_intsrc_info(struct mpc_config_intsrc *m) | |||
235 | 235 | ||
236 | static void __init MP_lintsrc_info(struct mpc_config_lintsrc *m) | 236 | static void __init MP_lintsrc_info(struct mpc_config_lintsrc *m) |
237 | { | 237 | { |
238 | printk(KERN_INFO "Lint: type %d, pol %d, trig %d, bus %02x," | 238 | apic_printk(APIC_VERBOSE, "Lint: type %d, pol %d, trig %d, bus %02x," |
239 | " IRQ %02x, APIC ID %x, APIC LINT %02x\n", | 239 | " IRQ %02x, APIC ID %x, APIC LINT %02x\n", |
240 | m->mpc_irqtype, m->mpc_irqflag & 3, | 240 | m->mpc_irqtype, m->mpc_irqflag & 3, |
241 | (m->mpc_irqflag >> 2) & 3, m->mpc_srcbusid, | 241 | (m->mpc_irqflag >> 2) & 3, m->mpc_srcbusid, |
@@ -397,7 +397,9 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early) | |||
397 | generic_bigsmp_probe(); | 397 | generic_bigsmp_probe(); |
398 | #endif | 398 | #endif |
399 | 399 | ||
400 | #ifdef CONFIG_X86_32 | ||
400 | setup_apic_routing(); | 401 | setup_apic_routing(); |
402 | #endif | ||
401 | if (!num_processors) | 403 | if (!num_processors) |
402 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); | 404 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); |
403 | return num_processors; | 405 | return num_processors; |
@@ -484,7 +486,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type) | |||
484 | } | 486 | } |
485 | 487 | ||
486 | 488 | ||
487 | static void construct_ioapic_table(int mpc_default_type) | 489 | static void __init construct_ioapic_table(int mpc_default_type) |
488 | { | 490 | { |
489 | struct mpc_config_ioapic ioapic; | 491 | struct mpc_config_ioapic ioapic; |
490 | struct mpc_config_bus bus; | 492 | struct mpc_config_bus bus; |
@@ -529,7 +531,7 @@ static void construct_ioapic_table(int mpc_default_type) | |||
529 | construct_default_ioirq_mptable(mpc_default_type); | 531 | construct_default_ioirq_mptable(mpc_default_type); |
530 | } | 532 | } |
531 | #else | 533 | #else |
532 | static inline void construct_ioapic_table(int mpc_default_type) { } | 534 | static inline void __init construct_ioapic_table(int mpc_default_type) { } |
533 | #endif | 535 | #endif |
534 | 536 | ||
535 | static inline void __init construct_default_ISA_mptable(int mpc_default_type) | 537 | static inline void __init construct_default_ISA_mptable(int mpc_default_type) |
@@ -695,7 +697,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
695 | unsigned int *bp = phys_to_virt(base); | 697 | unsigned int *bp = phys_to_virt(base); |
696 | struct intel_mp_floating *mpf; | 698 | struct intel_mp_floating *mpf; |
697 | 699 | ||
698 | printk(KERN_DEBUG "Scan SMP from %p for %ld bytes.\n", bp, length); | 700 | apic_printk(APIC_VERBOSE, "Scan SMP from %p for %ld bytes.\n", |
701 | bp, length); | ||
699 | BUILD_BUG_ON(sizeof(*mpf) != 16); | 702 | BUILD_BUG_ON(sizeof(*mpf) != 16); |
700 | 703 | ||
701 | while (length > 0) { | 704 | while (length > 0) { |
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 9fd809552447..2e2af5d18191 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c | |||
@@ -72,21 +72,28 @@ static ssize_t msr_read(struct file *file, char __user *buf, | |||
72 | u32 data[2]; | 72 | u32 data[2]; |
73 | u32 reg = *ppos; | 73 | u32 reg = *ppos; |
74 | int cpu = iminor(file->f_path.dentry->d_inode); | 74 | int cpu = iminor(file->f_path.dentry->d_inode); |
75 | int err; | 75 | int err = 0; |
76 | ssize_t bytes = 0; | ||
76 | 77 | ||
77 | if (count % 8) | 78 | if (count % 8) |
78 | return -EINVAL; /* Invalid chunk size */ | 79 | return -EINVAL; /* Invalid chunk size */ |
79 | 80 | ||
80 | for (; count; count -= 8) { | 81 | for (; count; count -= 8) { |
81 | err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]); | 82 | err = rdmsr_safe_on_cpu(cpu, reg, &data[0], &data[1]); |
82 | if (err) | 83 | if (err) { |
83 | return -EIO; | 84 | if (err == -EFAULT) /* Fix idiotic error code */ |
84 | if (copy_to_user(tmp, &data, 8)) | 85 | err = -EIO; |
85 | return -EFAULT; | 86 | break; |
87 | } | ||
88 | if (copy_to_user(tmp, &data, 8)) { | ||
89 | err = -EFAULT; | ||
90 | break; | ||
91 | } | ||
86 | tmp += 2; | 92 | tmp += 2; |
93 | bytes += 8; | ||
87 | } | 94 | } |
88 | 95 | ||
89 | return ((char __user *)tmp) - buf; | 96 | return bytes ? bytes : err; |
90 | } | 97 | } |
91 | 98 | ||
92 | static ssize_t msr_write(struct file *file, const char __user *buf, | 99 | static ssize_t msr_write(struct file *file, const char __user *buf, |
@@ -96,21 +103,28 @@ static ssize_t msr_write(struct file *file, const char __user *buf, | |||
96 | u32 data[2]; | 103 | u32 data[2]; |
97 | u32 reg = *ppos; | 104 | u32 reg = *ppos; |
98 | int cpu = iminor(file->f_path.dentry->d_inode); | 105 | int cpu = iminor(file->f_path.dentry->d_inode); |
99 | int err; | 106 | int err = 0; |
107 | ssize_t bytes = 0; | ||
100 | 108 | ||
101 | if (count % 8) | 109 | if (count % 8) |
102 | return -EINVAL; /* Invalid chunk size */ | 110 | return -EINVAL; /* Invalid chunk size */ |
103 | 111 | ||
104 | for (; count; count -= 8) { | 112 | for (; count; count -= 8) { |
105 | if (copy_from_user(&data, tmp, 8)) | 113 | if (copy_from_user(&data, tmp, 8)) { |
106 | return -EFAULT; | 114 | err = -EFAULT; |
115 | break; | ||
116 | } | ||
107 | err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]); | 117 | err = wrmsr_safe_on_cpu(cpu, reg, data[0], data[1]); |
108 | if (err) | 118 | if (err) { |
109 | return -EIO; | 119 | if (err == -EFAULT) /* Fix idiotic error code */ |
120 | err = -EIO; | ||
121 | break; | ||
122 | } | ||
110 | tmp += 2; | 123 | tmp += 2; |
124 | bytes += 8; | ||
111 | } | 125 | } |
112 | 126 | ||
113 | return ((char __user *)tmp) - buf; | 127 | return bytes ? bytes : err; |
114 | } | 128 | } |
115 | 129 | ||
116 | static int msr_open(struct inode *inode, struct file *file) | 130 | static int msr_open(struct inode *inode, struct file *file) |
@@ -131,7 +145,7 @@ static int msr_open(struct inode *inode, struct file *file) | |||
131 | ret = -EIO; /* MSR not supported */ | 145 | ret = -EIO; /* MSR not supported */ |
132 | out: | 146 | out: |
133 | unlock_kernel(); | 147 | unlock_kernel(); |
134 | return 0; | 148 | return ret; |
135 | } | 149 | } |
136 | 150 | ||
137 | /* | 151 | /* |
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index ac6d51222e7d..abb78a2cc4ad 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c | |||
@@ -114,6 +114,23 @@ static __init void nmi_cpu_busy(void *data) | |||
114 | } | 114 | } |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | static void report_broken_nmi(int cpu, int *prev_nmi_count) | ||
118 | { | ||
119 | printk(KERN_CONT "\n"); | ||
120 | |||
121 | printk(KERN_WARNING | ||
122 | "WARNING: CPU#%d: NMI appears to be stuck (%d->%d)!\n", | ||
123 | cpu, prev_nmi_count[cpu], get_nmi_count(cpu)); | ||
124 | |||
125 | printk(KERN_WARNING | ||
126 | "Please report this to bugzilla.kernel.org,\n"); | ||
127 | printk(KERN_WARNING | ||
128 | "and attach the output of the 'dmesg' command.\n"); | ||
129 | |||
130 | per_cpu(wd_enabled, cpu) = 0; | ||
131 | atomic_dec(&nmi_active); | ||
132 | } | ||
133 | |||
117 | int __init check_nmi_watchdog(void) | 134 | int __init check_nmi_watchdog(void) |
118 | { | 135 | { |
119 | unsigned int *prev_nmi_count; | 136 | unsigned int *prev_nmi_count; |
@@ -141,15 +158,8 @@ int __init check_nmi_watchdog(void) | |||
141 | for_each_online_cpu(cpu) { | 158 | for_each_online_cpu(cpu) { |
142 | if (!per_cpu(wd_enabled, cpu)) | 159 | if (!per_cpu(wd_enabled, cpu)) |
143 | continue; | 160 | continue; |
144 | if (get_nmi_count(cpu) - prev_nmi_count[cpu] <= 5) { | 161 | if (get_nmi_count(cpu) - prev_nmi_count[cpu] <= 5) |
145 | printk(KERN_WARNING "WARNING: CPU#%d: NMI " | 162 | report_broken_nmi(cpu, prev_nmi_count); |
146 | "appears to be stuck (%d->%d)!\n", | ||
147 | cpu, | ||
148 | prev_nmi_count[cpu], | ||
149 | get_nmi_count(cpu)); | ||
150 | per_cpu(wd_enabled, cpu) = 0; | ||
151 | atomic_dec(&nmi_active); | ||
152 | } | ||
153 | } | 163 | } |
154 | endflag = 1; | 164 | endflag = 1; |
155 | if (!atomic_read(&nmi_active)) { | 165 | if (!atomic_read(&nmi_active)) { |
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c index b8c45610b20a..4caff39078e0 100644 --- a/arch/x86/kernel/numaq_32.c +++ b/arch/x86/kernel/numaq_32.c | |||
@@ -73,7 +73,7 @@ static void __init smp_dump_qct(void) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | void __init numaq_tsc_disable(void) | 76 | void __cpuinit numaq_tsc_disable(void) |
77 | { | 77 | { |
78 | if (!found_numaq) | 78 | if (!found_numaq) |
79 | return; | 79 | return; |
@@ -229,6 +229,12 @@ static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable, | |||
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | static int __init numaq_setup_ioapic_ids(void) | ||
233 | { | ||
234 | /* so can skip it */ | ||
235 | return 1; | ||
236 | } | ||
237 | |||
232 | static struct x86_quirks numaq_x86_quirks __initdata = { | 238 | static struct x86_quirks numaq_x86_quirks __initdata = { |
233 | .arch_pre_time_init = numaq_pre_time_init, | 239 | .arch_pre_time_init = numaq_pre_time_init, |
234 | .arch_time_init = NULL, | 240 | .arch_time_init = NULL, |
@@ -243,6 +249,7 @@ static struct x86_quirks numaq_x86_quirks __initdata = { | |||
243 | .mpc_oem_bus_info = mpc_oem_bus_info, | 249 | .mpc_oem_bus_info = mpc_oem_bus_info, |
244 | .mpc_oem_pci_bus = mpc_oem_pci_bus, | 250 | .mpc_oem_pci_bus = mpc_oem_pci_bus, |
245 | .smp_read_mpc_oem = smp_read_mpc_oem, | 251 | .smp_read_mpc_oem = smp_read_mpc_oem, |
252 | .setup_ioapic_ids = numaq_setup_ioapic_ids, | ||
246 | }; | 253 | }; |
247 | 254 | ||
248 | void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, | 255 | void numaq_mps_oem_check(struct mp_config_table *mpc, char *oem, |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 94da4d52d798..6b0bb73998dd 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -330,6 +330,7 @@ struct pv_cpu_ops pv_cpu_ops = { | |||
330 | #endif | 330 | #endif |
331 | .wbinvd = native_wbinvd, | 331 | .wbinvd = native_wbinvd, |
332 | .read_msr = native_read_msr_safe, | 332 | .read_msr = native_read_msr_safe, |
333 | .read_msr_amd = native_read_msr_amd_safe, | ||
333 | .write_msr = native_write_msr_safe, | 334 | .write_msr = native_write_msr_safe, |
334 | .read_tsc = native_read_tsc, | 335 | .read_tsc = native_read_tsc, |
335 | .read_pmc = native_read_pmc, | 336 | .read_pmc = native_read_pmc, |
@@ -373,8 +374,6 @@ struct pv_cpu_ops pv_cpu_ops = { | |||
373 | 374 | ||
374 | struct pv_apic_ops pv_apic_ops = { | 375 | struct pv_apic_ops pv_apic_ops = { |
375 | #ifdef CONFIG_X86_LOCAL_APIC | 376 | #ifdef CONFIG_X86_LOCAL_APIC |
376 | .apic_write = native_apic_write, | ||
377 | .apic_read = native_apic_read, | ||
378 | .setup_boot_clock = setup_boot_APIC_clock, | 377 | .setup_boot_clock = setup_boot_APIC_clock, |
379 | .setup_secondary_clock = setup_secondary_APIC_clock, | 378 | .setup_secondary_clock = setup_secondary_APIC_clock, |
380 | .startup_ipi_hook = paravirt_nop, | 379 | .startup_ipi_hook = paravirt_nop, |
@@ -471,7 +470,7 @@ struct pv_lock_ops pv_lock_ops = { | |||
471 | .spin_unlock = __ticket_spin_unlock, | 470 | .spin_unlock = __ticket_spin_unlock, |
472 | #endif | 471 | #endif |
473 | }; | 472 | }; |
474 | EXPORT_SYMBOL_GPL(pv_lock_ops); | 473 | EXPORT_SYMBOL(pv_lock_ops); |
475 | 474 | ||
476 | EXPORT_SYMBOL_GPL(pv_time_ops); | 475 | EXPORT_SYMBOL_GPL(pv_time_ops); |
477 | EXPORT_SYMBOL (pv_cpu_ops); | 476 | EXPORT_SYMBOL (pv_cpu_ops); |
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 151f2d171f7c..dcdac6c826e9 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/crash_dump.h> | ||
32 | #include <linux/dma-mapping.h> | 33 | #include <linux/dma-mapping.h> |
33 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
34 | #include <linux/pci_ids.h> | 35 | #include <linux/pci_ids.h> |
@@ -36,6 +37,7 @@ | |||
36 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
37 | #include <linux/scatterlist.h> | 38 | #include <linux/scatterlist.h> |
38 | #include <linux/iommu-helper.h> | 39 | #include <linux/iommu-helper.h> |
40 | |||
39 | #include <asm/iommu.h> | 41 | #include <asm/iommu.h> |
40 | #include <asm/calgary.h> | 42 | #include <asm/calgary.h> |
41 | #include <asm/tce.h> | 43 | #include <asm/tce.h> |
@@ -167,6 +169,8 @@ static void calgary_dump_error_regs(struct iommu_table *tbl); | |||
167 | static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev); | 169 | static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev); |
168 | static void calioc2_tce_cache_blast(struct iommu_table *tbl); | 170 | static void calioc2_tce_cache_blast(struct iommu_table *tbl); |
169 | static void calioc2_dump_error_regs(struct iommu_table *tbl); | 171 | static void calioc2_dump_error_regs(struct iommu_table *tbl); |
172 | static void calgary_init_bitmap_from_tce_table(struct iommu_table *tbl); | ||
173 | static void get_tce_space_from_tar(void); | ||
170 | 174 | ||
171 | static struct cal_chipset_ops calgary_chip_ops = { | 175 | static struct cal_chipset_ops calgary_chip_ops = { |
172 | .handle_quirks = calgary_handle_quirks, | 176 | .handle_quirks = calgary_handle_quirks, |
@@ -339,9 +343,8 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, | |||
339 | /* were we called with bad_dma_address? */ | 343 | /* were we called with bad_dma_address? */ |
340 | badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE); | 344 | badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE); |
341 | if (unlikely((dma_addr >= bad_dma_address) && (dma_addr < badend))) { | 345 | if (unlikely((dma_addr >= bad_dma_address) && (dma_addr < badend))) { |
342 | printk(KERN_ERR "Calgary: driver tried unmapping bad DMA " | 346 | WARN(1, KERN_ERR "Calgary: driver tried unmapping bad DMA " |
343 | "address 0x%Lx\n", dma_addr); | 347 | "address 0x%Lx\n", dma_addr); |
344 | WARN_ON(1); | ||
345 | return; | 348 | return; |
346 | } | 349 | } |
347 | 350 | ||
@@ -410,22 +413,6 @@ static void calgary_unmap_sg(struct device *dev, | |||
410 | } | 413 | } |
411 | } | 414 | } |
412 | 415 | ||
413 | static int calgary_nontranslate_map_sg(struct device* dev, | ||
414 | struct scatterlist *sg, int nelems, int direction) | ||
415 | { | ||
416 | struct scatterlist *s; | ||
417 | int i; | ||
418 | |||
419 | for_each_sg(sg, s, nelems, i) { | ||
420 | struct page *p = sg_page(s); | ||
421 | |||
422 | BUG_ON(!p); | ||
423 | s->dma_address = virt_to_bus(sg_virt(s)); | ||
424 | s->dma_length = s->length; | ||
425 | } | ||
426 | return nelems; | ||
427 | } | ||
428 | |||
429 | static int calgary_map_sg(struct device *dev, struct scatterlist *sg, | 416 | static int calgary_map_sg(struct device *dev, struct scatterlist *sg, |
430 | int nelems, int direction) | 417 | int nelems, int direction) |
431 | { | 418 | { |
@@ -436,9 +423,6 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg, | |||
436 | unsigned long entry; | 423 | unsigned long entry; |
437 | int i; | 424 | int i; |
438 | 425 | ||
439 | if (!translation_enabled(tbl)) | ||
440 | return calgary_nontranslate_map_sg(dev, sg, nelems, direction); | ||
441 | |||
442 | for_each_sg(sg, s, nelems, i) { | 426 | for_each_sg(sg, s, nelems, i) { |
443 | BUG_ON(!sg_page(s)); | 427 | BUG_ON(!sg_page(s)); |
444 | 428 | ||
@@ -474,7 +458,6 @@ error: | |||
474 | static dma_addr_t calgary_map_single(struct device *dev, phys_addr_t paddr, | 458 | static dma_addr_t calgary_map_single(struct device *dev, phys_addr_t paddr, |
475 | size_t size, int direction) | 459 | size_t size, int direction) |
476 | { | 460 | { |
477 | dma_addr_t dma_handle = bad_dma_address; | ||
478 | void *vaddr = phys_to_virt(paddr); | 461 | void *vaddr = phys_to_virt(paddr); |
479 | unsigned long uaddr; | 462 | unsigned long uaddr; |
480 | unsigned int npages; | 463 | unsigned int npages; |
@@ -483,12 +466,7 @@ static dma_addr_t calgary_map_single(struct device *dev, phys_addr_t paddr, | |||
483 | uaddr = (unsigned long)vaddr; | 466 | uaddr = (unsigned long)vaddr; |
484 | npages = num_dma_pages(uaddr, size); | 467 | npages = num_dma_pages(uaddr, size); |
485 | 468 | ||
486 | if (translation_enabled(tbl)) | 469 | return iommu_alloc(dev, tbl, vaddr, npages, direction); |
487 | dma_handle = iommu_alloc(dev, tbl, vaddr, npages, direction); | ||
488 | else | ||
489 | dma_handle = virt_to_bus(vaddr); | ||
490 | |||
491 | return dma_handle; | ||
492 | } | 470 | } |
493 | 471 | ||
494 | static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle, | 472 | static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle, |
@@ -497,9 +475,6 @@ static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle, | |||
497 | struct iommu_table *tbl = find_iommu_table(dev); | 475 | struct iommu_table *tbl = find_iommu_table(dev); |
498 | unsigned int npages; | 476 | unsigned int npages; |
499 | 477 | ||
500 | if (!translation_enabled(tbl)) | ||
501 | return; | ||
502 | |||
503 | npages = num_dma_pages(dma_handle, size); | 478 | npages = num_dma_pages(dma_handle, size); |
504 | iommu_free(tbl, dma_handle, npages); | 479 | iommu_free(tbl, dma_handle, npages); |
505 | } | 480 | } |
@@ -522,18 +497,12 @@ static void* calgary_alloc_coherent(struct device *dev, size_t size, | |||
522 | goto error; | 497 | goto error; |
523 | memset(ret, 0, size); | 498 | memset(ret, 0, size); |
524 | 499 | ||
525 | if (translation_enabled(tbl)) { | 500 | /* set up tces to cover the allocated range */ |
526 | /* set up tces to cover the allocated range */ | 501 | mapping = iommu_alloc(dev, tbl, ret, npages, DMA_BIDIRECTIONAL); |
527 | mapping = iommu_alloc(dev, tbl, ret, npages, DMA_BIDIRECTIONAL); | 502 | if (mapping == bad_dma_address) |
528 | if (mapping == bad_dma_address) | 503 | goto free; |
529 | goto free; | 504 | *dma_handle = mapping; |
530 | |||
531 | *dma_handle = mapping; | ||
532 | } else /* non translated slot */ | ||
533 | *dma_handle = virt_to_bus(ret); | ||
534 | |||
535 | return ret; | 505 | return ret; |
536 | |||
537 | free: | 506 | free: |
538 | free_pages((unsigned long)ret, get_order(size)); | 507 | free_pages((unsigned long)ret, get_order(size)); |
539 | ret = NULL; | 508 | ret = NULL; |
@@ -541,7 +510,7 @@ error: | |||
541 | return ret; | 510 | return ret; |
542 | } | 511 | } |
543 | 512 | ||
544 | static const struct dma_mapping_ops calgary_dma_ops = { | 513 | static struct dma_mapping_ops calgary_dma_ops = { |
545 | .alloc_coherent = calgary_alloc_coherent, | 514 | .alloc_coherent = calgary_alloc_coherent, |
546 | .map_single = calgary_map_single, | 515 | .map_single = calgary_map_single, |
547 | .unmap_single = calgary_unmap_single, | 516 | .unmap_single = calgary_unmap_single, |
@@ -830,7 +799,11 @@ static int __init calgary_setup_tar(struct pci_dev *dev, void __iomem *bbar) | |||
830 | 799 | ||
831 | tbl = pci_iommu(dev->bus); | 800 | tbl = pci_iommu(dev->bus); |
832 | tbl->it_base = (unsigned long)bus_info[dev->bus->number].tce_space; | 801 | tbl->it_base = (unsigned long)bus_info[dev->bus->number].tce_space; |
833 | tce_free(tbl, 0, tbl->it_size); | 802 | |
803 | if (is_kdump_kernel()) | ||
804 | calgary_init_bitmap_from_tce_table(tbl); | ||
805 | else | ||
806 | tce_free(tbl, 0, tbl->it_size); | ||
834 | 807 | ||
835 | if (is_calgary(dev->device)) | 808 | if (is_calgary(dev->device)) |
836 | tbl->chip_ops = &calgary_chip_ops; | 809 | tbl->chip_ops = &calgary_chip_ops; |
@@ -1209,6 +1182,10 @@ static int __init calgary_init(void) | |||
1209 | if (ret) | 1182 | if (ret) |
1210 | return ret; | 1183 | return ret; |
1211 | 1184 | ||
1185 | /* Purely for kdump kernel case */ | ||
1186 | if (is_kdump_kernel()) | ||
1187 | get_tce_space_from_tar(); | ||
1188 | |||
1212 | do { | 1189 | do { |
1213 | dev = pci_get_device(PCI_VENDOR_ID_IBM, PCI_ANY_ID, dev); | 1190 | dev = pci_get_device(PCI_VENDOR_ID_IBM, PCI_ANY_ID, dev); |
1214 | if (!dev) | 1191 | if (!dev) |
@@ -1230,6 +1207,16 @@ static int __init calgary_init(void) | |||
1230 | goto error; | 1207 | goto error; |
1231 | } while (1); | 1208 | } while (1); |
1232 | 1209 | ||
1210 | dev = NULL; | ||
1211 | for_each_pci_dev(dev) { | ||
1212 | struct iommu_table *tbl; | ||
1213 | |||
1214 | tbl = find_iommu_table(&dev->dev); | ||
1215 | |||
1216 | if (translation_enabled(tbl)) | ||
1217 | dev->dev.archdata.dma_ops = &calgary_dma_ops; | ||
1218 | } | ||
1219 | |||
1233 | return ret; | 1220 | return ret; |
1234 | 1221 | ||
1235 | error: | 1222 | error: |
@@ -1251,6 +1238,7 @@ error: | |||
1251 | calgary_disable_translation(dev); | 1238 | calgary_disable_translation(dev); |
1252 | calgary_free_bus(dev); | 1239 | calgary_free_bus(dev); |
1253 | pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */ | 1240 | pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */ |
1241 | dev->dev.archdata.dma_ops = NULL; | ||
1254 | } while (1); | 1242 | } while (1); |
1255 | 1243 | ||
1256 | return ret; | 1244 | return ret; |
@@ -1280,13 +1268,15 @@ static inline int __init determine_tce_table_size(u64 ram) | |||
1280 | static int __init build_detail_arrays(void) | 1268 | static int __init build_detail_arrays(void) |
1281 | { | 1269 | { |
1282 | unsigned long ptr; | 1270 | unsigned long ptr; |
1283 | int i, scal_detail_size, rio_detail_size; | 1271 | unsigned numnodes, i; |
1272 | int scal_detail_size, rio_detail_size; | ||
1284 | 1273 | ||
1285 | if (rio_table_hdr->num_scal_dev > MAX_NUMNODES){ | 1274 | numnodes = rio_table_hdr->num_scal_dev; |
1275 | if (numnodes > MAX_NUMNODES){ | ||
1286 | printk(KERN_WARNING | 1276 | printk(KERN_WARNING |
1287 | "Calgary: MAX_NUMNODES too low! Defined as %d, " | 1277 | "Calgary: MAX_NUMNODES too low! Defined as %d, " |
1288 | "but system has %d nodes.\n", | 1278 | "but system has %d nodes.\n", |
1289 | MAX_NUMNODES, rio_table_hdr->num_scal_dev); | 1279 | MAX_NUMNODES, numnodes); |
1290 | return -ENODEV; | 1280 | return -ENODEV; |
1291 | } | 1281 | } |
1292 | 1282 | ||
@@ -1307,8 +1297,7 @@ static int __init build_detail_arrays(void) | |||
1307 | } | 1297 | } |
1308 | 1298 | ||
1309 | ptr = ((unsigned long)rio_table_hdr) + 3; | 1299 | ptr = ((unsigned long)rio_table_hdr) + 3; |
1310 | for (i = 0; i < rio_table_hdr->num_scal_dev; | 1300 | for (i = 0; i < numnodes; i++, ptr += scal_detail_size) |
1311 | i++, ptr += scal_detail_size) | ||
1312 | scal_devs[i] = (struct scal_detail *)ptr; | 1301 | scal_devs[i] = (struct scal_detail *)ptr; |
1313 | 1302 | ||
1314 | for (i = 0; i < rio_table_hdr->num_rio_dev; | 1303 | for (i = 0; i < rio_table_hdr->num_rio_dev; |
@@ -1339,6 +1328,61 @@ static int __init calgary_bus_has_devices(int bus, unsigned short pci_dev) | |||
1339 | return (val != 0xffffffff); | 1328 | return (val != 0xffffffff); |
1340 | } | 1329 | } |
1341 | 1330 | ||
1331 | /* | ||
1332 | * calgary_init_bitmap_from_tce_table(): | ||
1333 | * Funtion for kdump case. In the second/kdump kernel initialize | ||
1334 | * the bitmap based on the tce table entries obtained from first kernel | ||
1335 | */ | ||
1336 | static void calgary_init_bitmap_from_tce_table(struct iommu_table *tbl) | ||
1337 | { | ||
1338 | u64 *tp; | ||
1339 | unsigned int index; | ||
1340 | tp = ((u64 *)tbl->it_base); | ||
1341 | for (index = 0 ; index < tbl->it_size; index++) { | ||
1342 | if (*tp != 0x0) | ||
1343 | set_bit(index, tbl->it_map); | ||
1344 | tp++; | ||
1345 | } | ||
1346 | } | ||
1347 | |||
1348 | /* | ||
1349 | * get_tce_space_from_tar(): | ||
1350 | * Function for kdump case. Get the tce tables from first kernel | ||
1351 | * by reading the contents of the base adress register of calgary iommu | ||
1352 | */ | ||
1353 | static void __init get_tce_space_from_tar(void) | ||
1354 | { | ||
1355 | int bus; | ||
1356 | void __iomem *target; | ||
1357 | unsigned long tce_space; | ||
1358 | |||
1359 | for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) { | ||
1360 | struct calgary_bus_info *info = &bus_info[bus]; | ||
1361 | unsigned short pci_device; | ||
1362 | u32 val; | ||
1363 | |||
1364 | val = read_pci_config(bus, 0, 0, 0); | ||
1365 | pci_device = (val & 0xFFFF0000) >> 16; | ||
1366 | |||
1367 | if (!is_cal_pci_dev(pci_device)) | ||
1368 | continue; | ||
1369 | if (info->translation_disabled) | ||
1370 | continue; | ||
1371 | |||
1372 | if (calgary_bus_has_devices(bus, pci_device) || | ||
1373 | translate_empty_slots) { | ||
1374 | target = calgary_reg(bus_info[bus].bbar, | ||
1375 | tar_offset(bus)); | ||
1376 | tce_space = be64_to_cpu(readq(target)); | ||
1377 | tce_space = tce_space & TAR_SW_BITS; | ||
1378 | |||
1379 | tce_space = tce_space & (~specified_table_size); | ||
1380 | info->tce_space = (u64 *)__va(tce_space); | ||
1381 | } | ||
1382 | } | ||
1383 | return; | ||
1384 | } | ||
1385 | |||
1342 | void __init detect_calgary(void) | 1386 | void __init detect_calgary(void) |
1343 | { | 1387 | { |
1344 | int bus; | 1388 | int bus; |
@@ -1394,7 +1438,8 @@ void __init detect_calgary(void) | |||
1394 | return; | 1438 | return; |
1395 | } | 1439 | } |
1396 | 1440 | ||
1397 | specified_table_size = determine_tce_table_size(max_pfn * PAGE_SIZE); | 1441 | specified_table_size = determine_tce_table_size((is_kdump_kernel() ? |
1442 | saved_max_pfn : max_pfn) * PAGE_SIZE); | ||
1398 | 1443 | ||
1399 | for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) { | 1444 | for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) { |
1400 | struct calgary_bus_info *info = &bus_info[bus]; | 1445 | struct calgary_bus_info *info = &bus_info[bus]; |
@@ -1412,10 +1457,16 @@ void __init detect_calgary(void) | |||
1412 | 1457 | ||
1413 | if (calgary_bus_has_devices(bus, pci_device) || | 1458 | if (calgary_bus_has_devices(bus, pci_device) || |
1414 | translate_empty_slots) { | 1459 | translate_empty_slots) { |
1415 | tbl = alloc_tce_table(); | 1460 | /* |
1416 | if (!tbl) | 1461 | * If it is kdump kernel, find and use tce tables |
1417 | goto cleanup; | 1462 | * from first kernel, else allocate tce tables here |
1418 | info->tce_space = tbl; | 1463 | */ |
1464 | if (!is_kdump_kernel()) { | ||
1465 | tbl = alloc_tce_table(); | ||
1466 | if (!tbl) | ||
1467 | goto cleanup; | ||
1468 | info->tce_space = tbl; | ||
1469 | } | ||
1419 | calgary_found = 1; | 1470 | calgary_found = 1; |
1420 | } | 1471 | } |
1421 | } | 1472 | } |
@@ -1430,6 +1481,10 @@ void __init detect_calgary(void) | |||
1430 | printk(KERN_INFO "PCI-DMA: Calgary TCE table spec is %d, " | 1481 | printk(KERN_INFO "PCI-DMA: Calgary TCE table spec is %d, " |
1431 | "CONFIG_IOMMU_DEBUG is %s.\n", specified_table_size, | 1482 | "CONFIG_IOMMU_DEBUG is %s.\n", specified_table_size, |
1432 | debugging ? "enabled" : "disabled"); | 1483 | debugging ? "enabled" : "disabled"); |
1484 | |||
1485 | /* swiotlb for devices that aren't behind the Calgary. */ | ||
1486 | if (max_pfn > MAX_DMA32_PFN) | ||
1487 | swiotlb = 1; | ||
1433 | } | 1488 | } |
1434 | return; | 1489 | return; |
1435 | 1490 | ||
@@ -1446,7 +1501,7 @@ int __init calgary_iommu_init(void) | |||
1446 | { | 1501 | { |
1447 | int ret; | 1502 | int ret; |
1448 | 1503 | ||
1449 | if (no_iommu || swiotlb) | 1504 | if (no_iommu || (swiotlb && !calgary_detected)) |
1450 | return -ENODEV; | 1505 | return -ENODEV; |
1451 | 1506 | ||
1452 | if (!calgary_detected) | 1507 | if (!calgary_detected) |
@@ -1459,15 +1514,14 @@ int __init calgary_iommu_init(void) | |||
1459 | if (ret) { | 1514 | if (ret) { |
1460 | printk(KERN_ERR "PCI-DMA: Calgary init failed %d, " | 1515 | printk(KERN_ERR "PCI-DMA: Calgary init failed %d, " |
1461 | "falling back to no_iommu\n", ret); | 1516 | "falling back to no_iommu\n", ret); |
1462 | if (max_pfn > MAX_DMA32_PFN) | ||
1463 | printk(KERN_ERR "WARNING more than 4GB of memory, " | ||
1464 | "32bit PCI may malfunction.\n"); | ||
1465 | return ret; | 1517 | return ret; |
1466 | } | 1518 | } |
1467 | 1519 | ||
1468 | force_iommu = 1; | 1520 | force_iommu = 1; |
1469 | bad_dma_address = 0x0; | 1521 | bad_dma_address = 0x0; |
1470 | dma_ops = &calgary_dma_ops; | 1522 | /* dma_ops is set to swiotlb or nommu */ |
1523 | if (!dma_ops) | ||
1524 | dma_ops = &nommu_dma_ops; | ||
1471 | 1525 | ||
1472 | return 0; | 1526 | return 0; |
1473 | } | 1527 | } |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index cbecb05551bb..87d4d6964ec2 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | static int forbid_dac __read_mostly; | 12 | static int forbid_dac __read_mostly; |
13 | 13 | ||
14 | const struct dma_mapping_ops *dma_ops; | 14 | struct dma_mapping_ops *dma_ops; |
15 | EXPORT_SYMBOL(dma_ops); | 15 | EXPORT_SYMBOL(dma_ops); |
16 | 16 | ||
17 | static int iommu_sac_force __read_mostly; | 17 | static int iommu_sac_force __read_mostly; |
@@ -123,6 +123,14 @@ void __init pci_iommu_alloc(void) | |||
123 | 123 | ||
124 | pci_swiotlb_init(); | 124 | pci_swiotlb_init(); |
125 | } | 125 | } |
126 | |||
127 | unsigned long iommu_num_pages(unsigned long addr, unsigned long len) | ||
128 | { | ||
129 | unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE); | ||
130 | |||
131 | return size >> PAGE_SHIFT; | ||
132 | } | ||
133 | EXPORT_SYMBOL(iommu_num_pages); | ||
126 | #endif | 134 | #endif |
127 | 135 | ||
128 | /* | 136 | /* |
@@ -192,126 +200,10 @@ static __init int iommu_setup(char *p) | |||
192 | } | 200 | } |
193 | early_param("iommu", iommu_setup); | 201 | early_param("iommu", iommu_setup); |
194 | 202 | ||
195 | #ifdef CONFIG_X86_32 | ||
196 | int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, | ||
197 | dma_addr_t device_addr, size_t size, int flags) | ||
198 | { | ||
199 | void __iomem *mem_base = NULL; | ||
200 | int pages = size >> PAGE_SHIFT; | ||
201 | int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); | ||
202 | |||
203 | if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0) | ||
204 | goto out; | ||
205 | if (!size) | ||
206 | goto out; | ||
207 | if (dev->dma_mem) | ||
208 | goto out; | ||
209 | |||
210 | /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */ | ||
211 | |||
212 | mem_base = ioremap(bus_addr, size); | ||
213 | if (!mem_base) | ||
214 | goto out; | ||
215 | |||
216 | dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); | ||
217 | if (!dev->dma_mem) | ||
218 | goto out; | ||
219 | dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); | ||
220 | if (!dev->dma_mem->bitmap) | ||
221 | goto free1_out; | ||
222 | |||
223 | dev->dma_mem->virt_base = mem_base; | ||
224 | dev->dma_mem->device_base = device_addr; | ||
225 | dev->dma_mem->size = pages; | ||
226 | dev->dma_mem->flags = flags; | ||
227 | |||
228 | if (flags & DMA_MEMORY_MAP) | ||
229 | return DMA_MEMORY_MAP; | ||
230 | |||
231 | return DMA_MEMORY_IO; | ||
232 | |||
233 | free1_out: | ||
234 | kfree(dev->dma_mem); | ||
235 | out: | ||
236 | if (mem_base) | ||
237 | iounmap(mem_base); | ||
238 | return 0; | ||
239 | } | ||
240 | EXPORT_SYMBOL(dma_declare_coherent_memory); | ||
241 | |||
242 | void dma_release_declared_memory(struct device *dev) | ||
243 | { | ||
244 | struct dma_coherent_mem *mem = dev->dma_mem; | ||
245 | |||
246 | if (!mem) | ||
247 | return; | ||
248 | dev->dma_mem = NULL; | ||
249 | iounmap(mem->virt_base); | ||
250 | kfree(mem->bitmap); | ||
251 | kfree(mem); | ||
252 | } | ||
253 | EXPORT_SYMBOL(dma_release_declared_memory); | ||
254 | |||
255 | void *dma_mark_declared_memory_occupied(struct device *dev, | ||
256 | dma_addr_t device_addr, size_t size) | ||
257 | { | ||
258 | struct dma_coherent_mem *mem = dev->dma_mem; | ||
259 | int pos, err; | ||
260 | int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1); | ||
261 | |||
262 | pages >>= PAGE_SHIFT; | ||
263 | |||
264 | if (!mem) | ||
265 | return ERR_PTR(-EINVAL); | ||
266 | |||
267 | pos = (device_addr - mem->device_base) >> PAGE_SHIFT; | ||
268 | err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages)); | ||
269 | if (err != 0) | ||
270 | return ERR_PTR(err); | ||
271 | return mem->virt_base + (pos << PAGE_SHIFT); | ||
272 | } | ||
273 | EXPORT_SYMBOL(dma_mark_declared_memory_occupied); | ||
274 | |||
275 | static int dma_alloc_from_coherent_mem(struct device *dev, ssize_t size, | ||
276 | dma_addr_t *dma_handle, void **ret) | ||
277 | { | ||
278 | struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; | ||
279 | int order = get_order(size); | ||
280 | |||
281 | if (mem) { | ||
282 | int page = bitmap_find_free_region(mem->bitmap, mem->size, | ||
283 | order); | ||
284 | if (page >= 0) { | ||
285 | *dma_handle = mem->device_base + (page << PAGE_SHIFT); | ||
286 | *ret = mem->virt_base + (page << PAGE_SHIFT); | ||
287 | memset(*ret, 0, size); | ||
288 | } | ||
289 | if (mem->flags & DMA_MEMORY_EXCLUSIVE) | ||
290 | *ret = NULL; | ||
291 | } | ||
292 | return (mem != NULL); | ||
293 | } | ||
294 | |||
295 | static int dma_release_coherent(struct device *dev, int order, void *vaddr) | ||
296 | { | ||
297 | struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; | ||
298 | |||
299 | if (mem && vaddr >= mem->virt_base && vaddr < | ||
300 | (mem->virt_base + (mem->size << PAGE_SHIFT))) { | ||
301 | int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; | ||
302 | |||
303 | bitmap_release_region(mem->bitmap, page, order); | ||
304 | return 1; | ||
305 | } | ||
306 | return 0; | ||
307 | } | ||
308 | #else | ||
309 | #define dma_alloc_from_coherent_mem(dev, size, handle, ret) (0) | ||
310 | #define dma_release_coherent(dev, order, vaddr) (0) | ||
311 | #endif /* CONFIG_X86_32 */ | ||
312 | |||
313 | int dma_supported(struct device *dev, u64 mask) | 203 | int dma_supported(struct device *dev, u64 mask) |
314 | { | 204 | { |
205 | struct dma_mapping_ops *ops = get_dma_ops(dev); | ||
206 | |||
315 | #ifdef CONFIG_PCI | 207 | #ifdef CONFIG_PCI |
316 | if (mask > 0xffffffff && forbid_dac > 0) { | 208 | if (mask > 0xffffffff && forbid_dac > 0) { |
317 | dev_info(dev, "PCI: Disallowing DAC for device\n"); | 209 | dev_info(dev, "PCI: Disallowing DAC for device\n"); |
@@ -319,8 +211,8 @@ int dma_supported(struct device *dev, u64 mask) | |||
319 | } | 211 | } |
320 | #endif | 212 | #endif |
321 | 213 | ||
322 | if (dma_ops->dma_supported) | 214 | if (ops->dma_supported) |
323 | return dma_ops->dma_supported(dev, mask); | 215 | return ops->dma_supported(dev, mask); |
324 | 216 | ||
325 | /* Copied from i386. Doesn't make much sense, because it will | 217 | /* Copied from i386. Doesn't make much sense, because it will |
326 | only work for pci_alloc_coherent. | 218 | only work for pci_alloc_coherent. |
@@ -367,6 +259,7 @@ void * | |||
367 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | 259 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, |
368 | gfp_t gfp) | 260 | gfp_t gfp) |
369 | { | 261 | { |
262 | struct dma_mapping_ops *ops = get_dma_ops(dev); | ||
370 | void *memory = NULL; | 263 | void *memory = NULL; |
371 | struct page *page; | 264 | struct page *page; |
372 | unsigned long dma_mask = 0; | 265 | unsigned long dma_mask = 0; |
@@ -376,7 +269,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
376 | /* ignore region specifiers */ | 269 | /* ignore region specifiers */ |
377 | gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); | 270 | gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); |
378 | 271 | ||
379 | if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) | 272 | if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) |
380 | return memory; | 273 | return memory; |
381 | 274 | ||
382 | if (!dev) { | 275 | if (!dev) { |
@@ -435,8 +328,8 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
435 | /* Let low level make its own zone decisions */ | 328 | /* Let low level make its own zone decisions */ |
436 | gfp &= ~(GFP_DMA32|GFP_DMA); | 329 | gfp &= ~(GFP_DMA32|GFP_DMA); |
437 | 330 | ||
438 | if (dma_ops->alloc_coherent) | 331 | if (ops->alloc_coherent) |
439 | return dma_ops->alloc_coherent(dev, size, | 332 | return ops->alloc_coherent(dev, size, |
440 | dma_handle, gfp); | 333 | dma_handle, gfp); |
441 | return NULL; | 334 | return NULL; |
442 | } | 335 | } |
@@ -448,14 +341,14 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
448 | } | 341 | } |
449 | } | 342 | } |
450 | 343 | ||
451 | if (dma_ops->alloc_coherent) { | 344 | if (ops->alloc_coherent) { |
452 | free_pages((unsigned long)memory, get_order(size)); | 345 | free_pages((unsigned long)memory, get_order(size)); |
453 | gfp &= ~(GFP_DMA|GFP_DMA32); | 346 | gfp &= ~(GFP_DMA|GFP_DMA32); |
454 | return dma_ops->alloc_coherent(dev, size, dma_handle, gfp); | 347 | return ops->alloc_coherent(dev, size, dma_handle, gfp); |
455 | } | 348 | } |
456 | 349 | ||
457 | if (dma_ops->map_simple) { | 350 | if (ops->map_simple) { |
458 | *dma_handle = dma_ops->map_simple(dev, virt_to_phys(memory), | 351 | *dma_handle = ops->map_simple(dev, virt_to_phys(memory), |
459 | size, | 352 | size, |
460 | PCI_DMA_BIDIRECTIONAL); | 353 | PCI_DMA_BIDIRECTIONAL); |
461 | if (*dma_handle != bad_dma_address) | 354 | if (*dma_handle != bad_dma_address) |
@@ -477,12 +370,14 @@ EXPORT_SYMBOL(dma_alloc_coherent); | |||
477 | void dma_free_coherent(struct device *dev, size_t size, | 370 | void dma_free_coherent(struct device *dev, size_t size, |
478 | void *vaddr, dma_addr_t bus) | 371 | void *vaddr, dma_addr_t bus) |
479 | { | 372 | { |
373 | struct dma_mapping_ops *ops = get_dma_ops(dev); | ||
374 | |||
480 | int order = get_order(size); | 375 | int order = get_order(size); |
481 | WARN_ON(irqs_disabled()); /* for portability */ | 376 | WARN_ON(irqs_disabled()); /* for portability */ |
482 | if (dma_release_coherent(dev, order, vaddr)) | 377 | if (dma_release_from_coherent(dev, order, vaddr)) |
483 | return; | 378 | return; |
484 | if (dma_ops->unmap_single) | 379 | if (ops->unmap_single) |
485 | dma_ops->unmap_single(dev, bus, size, 0); | 380 | ops->unmap_single(dev, bus, size, 0); |
486 | free_pages((unsigned long)vaddr, order); | 381 | free_pages((unsigned long)vaddr, order); |
487 | } | 382 | } |
488 | EXPORT_SYMBOL(dma_free_coherent); | 383 | EXPORT_SYMBOL(dma_free_coherent); |
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index df5f142657d2..49285f8fd4d5 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -67,9 +67,6 @@ static u32 gart_unmapped_entry; | |||
67 | (((x) & 0xfffff000) | (((x) >> 32) << 4) | GPTE_VALID | GPTE_COHERENT) | 67 | (((x) & 0xfffff000) | (((x) >> 32) << 4) | GPTE_VALID | GPTE_COHERENT) |
68 | #define GPTE_DECODE(x) (((x) & 0xfffff000) | (((u64)(x) & 0xff0) << 28)) | 68 | #define GPTE_DECODE(x) (((x) & 0xfffff000) | (((u64)(x) & 0xff0) << 28)) |
69 | 69 | ||
70 | #define to_pages(addr, size) \ | ||
71 | (round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT) | ||
72 | |||
73 | #define EMERGENCY_PAGES 32 /* = 128KB */ | 70 | #define EMERGENCY_PAGES 32 /* = 128KB */ |
74 | 71 | ||
75 | #ifdef CONFIG_AGP | 72 | #ifdef CONFIG_AGP |
@@ -241,7 +238,7 @@ nonforced_iommu(struct device *dev, unsigned long addr, size_t size) | |||
241 | static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, | 238 | static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, |
242 | size_t size, int dir) | 239 | size_t size, int dir) |
243 | { | 240 | { |
244 | unsigned long npages = to_pages(phys_mem, size); | 241 | unsigned long npages = iommu_num_pages(phys_mem, size); |
245 | unsigned long iommu_page = alloc_iommu(dev, npages); | 242 | unsigned long iommu_page = alloc_iommu(dev, npages); |
246 | int i; | 243 | int i; |
247 | 244 | ||
@@ -304,7 +301,7 @@ static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, | |||
304 | return; | 301 | return; |
305 | 302 | ||
306 | iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT; | 303 | iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT; |
307 | npages = to_pages(dma_addr, size); | 304 | npages = iommu_num_pages(dma_addr, size); |
308 | for (i = 0; i < npages; i++) { | 305 | for (i = 0; i < npages; i++) { |
309 | iommu_gatt_base[iommu_page + i] = gart_unmapped_entry; | 306 | iommu_gatt_base[iommu_page + i] = gart_unmapped_entry; |
310 | CLEAR_LEAK(iommu_page + i); | 307 | CLEAR_LEAK(iommu_page + i); |
@@ -387,7 +384,7 @@ static int __dma_map_cont(struct device *dev, struct scatterlist *start, | |||
387 | } | 384 | } |
388 | 385 | ||
389 | addr = phys_addr; | 386 | addr = phys_addr; |
390 | pages = to_pages(s->offset, s->length); | 387 | pages = iommu_num_pages(s->offset, s->length); |
391 | while (pages--) { | 388 | while (pages--) { |
392 | iommu_gatt_base[iommu_page] = GPTE_ENCODE(addr); | 389 | iommu_gatt_base[iommu_page] = GPTE_ENCODE(addr); |
393 | SET_LEAK(iommu_page); | 390 | SET_LEAK(iommu_page); |
@@ -470,7 +467,7 @@ gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) | |||
470 | 467 | ||
471 | seg_size += s->length; | 468 | seg_size += s->length; |
472 | need = nextneed; | 469 | need = nextneed; |
473 | pages += to_pages(s->offset, s->length); | 470 | pages += iommu_num_pages(s->offset, s->length); |
474 | ps = s; | 471 | ps = s; |
475 | } | 472 | } |
476 | if (dma_map_cont(dev, start_sg, i - start, sgmap, pages, need) < 0) | 473 | if (dma_map_cont(dev, start_sg, i - start, sgmap, pages, need) < 0) |
@@ -692,8 +689,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info) | |||
692 | 689 | ||
693 | extern int agp_amd64_init(void); | 690 | extern int agp_amd64_init(void); |
694 | 691 | ||
695 | static const struct dma_mapping_ops gart_dma_ops = { | 692 | static struct dma_mapping_ops gart_dma_ops = { |
696 | .mapping_error = NULL, | ||
697 | .map_single = gart_map_single, | 693 | .map_single = gart_map_single, |
698 | .map_simple = gart_map_simple, | 694 | .map_simple = gart_map_simple, |
699 | .unmap_single = gart_unmap_single, | 695 | .unmap_single = gart_unmap_single, |
diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c index 792b9179eff3..3f91f71cdc3e 100644 --- a/arch/x86/kernel/pci-nommu.c +++ b/arch/x86/kernel/pci-nommu.c | |||
@@ -72,21 +72,9 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, | |||
72 | return nents; | 72 | return nents; |
73 | } | 73 | } |
74 | 74 | ||
75 | /* Make sure we keep the same behaviour */ | 75 | struct dma_mapping_ops nommu_dma_ops = { |
76 | static int nommu_mapping_error(dma_addr_t dma_addr) | ||
77 | { | ||
78 | #ifdef CONFIG_X86_32 | ||
79 | return 0; | ||
80 | #else | ||
81 | return (dma_addr == bad_dma_address); | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | |||
86 | const struct dma_mapping_ops nommu_dma_ops = { | ||
87 | .map_single = nommu_map_single, | 76 | .map_single = nommu_map_single, |
88 | .map_sg = nommu_map_sg, | 77 | .map_sg = nommu_map_sg, |
89 | .mapping_error = nommu_mapping_error, | ||
90 | .is_phys = 1, | 78 | .is_phys = 1, |
91 | }; | 79 | }; |
92 | 80 | ||
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c index 20df839b9c20..c4ce0332759e 100644 --- a/arch/x86/kernel/pci-swiotlb_64.c +++ b/arch/x86/kernel/pci-swiotlb_64.c | |||
@@ -18,7 +18,7 @@ swiotlb_map_single_phys(struct device *hwdev, phys_addr_t paddr, size_t size, | |||
18 | return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction); | 18 | return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction); |
19 | } | 19 | } |
20 | 20 | ||
21 | const struct dma_mapping_ops swiotlb_dma_ops = { | 21 | struct dma_mapping_ops swiotlb_dma_ops = { |
22 | .mapping_error = swiotlb_dma_mapping_error, | 22 | .mapping_error = swiotlb_dma_mapping_error, |
23 | .alloc_coherent = swiotlb_alloc_coherent, | 23 | .alloc_coherent = swiotlb_alloc_coherent, |
24 | .free_coherent = swiotlb_free_coherent, | 24 | .free_coherent = swiotlb_free_coherent, |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 7fc4d5b0a6a0..9f94bb1c8117 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -15,7 +15,6 @@ unsigned long idle_nomwait; | |||
15 | EXPORT_SYMBOL(idle_nomwait); | 15 | EXPORT_SYMBOL(idle_nomwait); |
16 | 16 | ||
17 | struct kmem_cache *task_xstate_cachep; | 17 | struct kmem_cache *task_xstate_cachep; |
18 | static int force_mwait __cpuinitdata; | ||
19 | 18 | ||
20 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | 19 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
21 | { | 20 | { |
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 68f4ae2ac99a..1962d27c6b82 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c | |||
@@ -55,6 +55,8 @@ | |||
55 | #include <asm/tlbflush.h> | 55 | #include <asm/tlbflush.h> |
56 | #include <asm/cpu.h> | 56 | #include <asm/cpu.h> |
57 | #include <asm/kdebug.h> | 57 | #include <asm/kdebug.h> |
58 | #include <asm/syscalls.h> | ||
59 | #include <asm/smp.h> | ||
58 | 60 | ||
59 | asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); | 61 | asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); |
60 | 62 | ||
@@ -95,7 +97,6 @@ static inline void play_dead(void) | |||
95 | { | 97 | { |
96 | /* This must be done before dead CPU ack */ | 98 | /* This must be done before dead CPU ack */ |
97 | cpu_exit_clear(); | 99 | cpu_exit_clear(); |
98 | wbinvd(); | ||
99 | mb(); | 100 | mb(); |
100 | /* Ack it */ | 101 | /* Ack it */ |
101 | __get_cpu_var(cpu_state) = CPU_DEAD; | 102 | __get_cpu_var(cpu_state) = CPU_DEAD; |
@@ -104,8 +105,8 @@ static inline void play_dead(void) | |||
104 | * With physical CPU hotplug, we should halt the cpu | 105 | * With physical CPU hotplug, we should halt the cpu |
105 | */ | 106 | */ |
106 | local_irq_disable(); | 107 | local_irq_disable(); |
107 | while (1) | 108 | /* mask all interrupts, flush any and all caches, and halt */ |
108 | halt(); | 109 | wbinvd_halt(); |
109 | } | 110 | } |
110 | #else | 111 | #else |
111 | static inline void play_dead(void) | 112 | static inline void play_dead(void) |
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 91ffce47af8e..08a9df08adba 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <asm/proto.h> | 51 | #include <asm/proto.h> |
52 | #include <asm/ia32.h> | 52 | #include <asm/ia32.h> |
53 | #include <asm/idle.h> | 53 | #include <asm/idle.h> |
54 | #include <asm/syscalls.h> | ||
54 | 55 | ||
55 | asmlinkage extern void ret_from_fork(void); | 56 | asmlinkage extern void ret_from_fork(void); |
56 | 57 | ||
@@ -93,14 +94,13 @@ DECLARE_PER_CPU(int, cpu_state); | |||
93 | static inline void play_dead(void) | 94 | static inline void play_dead(void) |
94 | { | 95 | { |
95 | idle_task_exit(); | 96 | idle_task_exit(); |
96 | wbinvd(); | ||
97 | mb(); | 97 | mb(); |
98 | /* Ack it */ | 98 | /* Ack it */ |
99 | __get_cpu_var(cpu_state) = CPU_DEAD; | 99 | __get_cpu_var(cpu_state) = CPU_DEAD; |
100 | 100 | ||
101 | local_irq_disable(); | 101 | local_irq_disable(); |
102 | while (1) | 102 | /* mask all interrupts, flush any and all caches, and halt */ |
103 | halt(); | 103 | wbinvd_halt(); |
104 | } | 104 | } |
105 | #else | 105 | #else |
106 | static inline void play_dead(void) | 106 | static inline void play_dead(void) |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index ba19bb49bd09..58ce4b50211b 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -69,7 +69,7 @@ static inline bool invalid_selector(u16 value) | |||
69 | 69 | ||
70 | #define FLAG_MASK FLAG_MASK_32 | 70 | #define FLAG_MASK FLAG_MASK_32 |
71 | 71 | ||
72 | static long *pt_regs_access(struct pt_regs *regs, unsigned long regno) | 72 | static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno) |
73 | { | 73 | { |
74 | BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0); | 74 | BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0); |
75 | regno >>= 2; | 75 | regno >>= 2; |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 06a9f643817e..724adfc63cb9 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -414,25 +414,20 @@ void native_machine_shutdown(void) | |||
414 | 414 | ||
415 | /* The boot cpu is always logical cpu 0 */ | 415 | /* The boot cpu is always logical cpu 0 */ |
416 | int reboot_cpu_id = 0; | 416 | int reboot_cpu_id = 0; |
417 | cpumask_of_cpu_ptr(newmask, reboot_cpu_id); | ||
418 | 417 | ||
419 | #ifdef CONFIG_X86_32 | 418 | #ifdef CONFIG_X86_32 |
420 | /* See if there has been given a command line override */ | 419 | /* See if there has been given a command line override */ |
421 | if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) && | 420 | if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) && |
422 | cpu_online(reboot_cpu)) { | 421 | cpu_online(reboot_cpu)) |
423 | reboot_cpu_id = reboot_cpu; | 422 | reboot_cpu_id = reboot_cpu; |
424 | cpumask_of_cpu_ptr_next(newmask, reboot_cpu_id); | ||
425 | } | ||
426 | #endif | 423 | #endif |
427 | 424 | ||
428 | /* Make certain the cpu I'm about to reboot on is online */ | 425 | /* Make certain the cpu I'm about to reboot on is online */ |
429 | if (!cpu_online(reboot_cpu_id)) { | 426 | if (!cpu_online(reboot_cpu_id)) |
430 | reboot_cpu_id = smp_processor_id(); | 427 | reboot_cpu_id = smp_processor_id(); |
431 | cpumask_of_cpu_ptr_next(newmask, reboot_cpu_id); | ||
432 | } | ||
433 | 428 | ||
434 | /* Make certain I only run on the appropriate processor */ | 429 | /* Make certain I only run on the appropriate processor */ |
435 | set_cpus_allowed_ptr(current, newmask); | 430 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(reboot_cpu_id)); |
436 | 431 | ||
437 | /* O.K Now that I'm on the appropriate processor, | 432 | /* O.K Now that I'm on the appropriate processor, |
438 | * stop all of the others. | 433 | * stop all of the others. |
diff --git a/arch/x86/kernel/relocate_kernel_32.S b/arch/x86/kernel/relocate_kernel_32.S index c30fe25d470d..6f50664b2ba5 100644 --- a/arch/x86/kernel/relocate_kernel_32.S +++ b/arch/x86/kernel/relocate_kernel_32.S | |||
@@ -20,11 +20,45 @@ | |||
20 | #define PAGE_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | 20 | #define PAGE_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) |
21 | #define PAE_PGD_ATTR (_PAGE_PRESENT) | 21 | #define PAE_PGD_ATTR (_PAGE_PRESENT) |
22 | 22 | ||
23 | /* control_page + KEXEC_CONTROL_CODE_MAX_SIZE | ||
24 | * ~ control_page + PAGE_SIZE are used as data storage and stack for | ||
25 | * jumping back | ||
26 | */ | ||
27 | #define DATA(offset) (KEXEC_CONTROL_CODE_MAX_SIZE+(offset)) | ||
28 | |||
29 | /* Minimal CPU state */ | ||
30 | #define ESP DATA(0x0) | ||
31 | #define CR0 DATA(0x4) | ||
32 | #define CR3 DATA(0x8) | ||
33 | #define CR4 DATA(0xc) | ||
34 | |||
35 | /* other data */ | ||
36 | #define CP_VA_CONTROL_PAGE DATA(0x10) | ||
37 | #define CP_PA_PGD DATA(0x14) | ||
38 | #define CP_PA_SWAP_PAGE DATA(0x18) | ||
39 | #define CP_PA_BACKUP_PAGES_MAP DATA(0x1c) | ||
40 | |||
23 | .text | 41 | .text |
24 | .align PAGE_SIZE | 42 | .align PAGE_SIZE |
25 | .globl relocate_kernel | 43 | .globl relocate_kernel |
26 | relocate_kernel: | 44 | relocate_kernel: |
27 | movl 8(%esp), %ebp /* list of pages */ | 45 | /* Save the CPU context, used for jumping back */ |
46 | |||
47 | pushl %ebx | ||
48 | pushl %esi | ||
49 | pushl %edi | ||
50 | pushl %ebp | ||
51 | pushf | ||
52 | |||
53 | movl 20+8(%esp), %ebp /* list of pages */ | ||
54 | movl PTR(VA_CONTROL_PAGE)(%ebp), %edi | ||
55 | movl %esp, ESP(%edi) | ||
56 | movl %cr0, %eax | ||
57 | movl %eax, CR0(%edi) | ||
58 | movl %cr3, %eax | ||
59 | movl %eax, CR3(%edi) | ||
60 | movl %cr4, %eax | ||
61 | movl %eax, CR4(%edi) | ||
28 | 62 | ||
29 | #ifdef CONFIG_X86_PAE | 63 | #ifdef CONFIG_X86_PAE |
30 | /* map the control page at its virtual address */ | 64 | /* map the control page at its virtual address */ |
@@ -138,15 +172,25 @@ relocate_kernel: | |||
138 | 172 | ||
139 | relocate_new_kernel: | 173 | relocate_new_kernel: |
140 | /* read the arguments and say goodbye to the stack */ | 174 | /* read the arguments and say goodbye to the stack */ |
141 | movl 4(%esp), %ebx /* page_list */ | 175 | movl 20+4(%esp), %ebx /* page_list */ |
142 | movl 8(%esp), %ebp /* list of pages */ | 176 | movl 20+8(%esp), %ebp /* list of pages */ |
143 | movl 12(%esp), %edx /* start address */ | 177 | movl 20+12(%esp), %edx /* start address */ |
144 | movl 16(%esp), %ecx /* cpu_has_pae */ | 178 | movl 20+16(%esp), %ecx /* cpu_has_pae */ |
179 | movl 20+20(%esp), %esi /* preserve_context */ | ||
145 | 180 | ||
146 | /* zero out flags, and disable interrupts */ | 181 | /* zero out flags, and disable interrupts */ |
147 | pushl $0 | 182 | pushl $0 |
148 | popfl | 183 | popfl |
149 | 184 | ||
185 | /* save some information for jumping back */ | ||
186 | movl PTR(VA_CONTROL_PAGE)(%ebp), %edi | ||
187 | movl %edi, CP_VA_CONTROL_PAGE(%edi) | ||
188 | movl PTR(PA_PGD)(%ebp), %eax | ||
189 | movl %eax, CP_PA_PGD(%edi) | ||
190 | movl PTR(PA_SWAP_PAGE)(%ebp), %eax | ||
191 | movl %eax, CP_PA_SWAP_PAGE(%edi) | ||
192 | movl %ebx, CP_PA_BACKUP_PAGES_MAP(%edi) | ||
193 | |||
150 | /* get physical address of control page now */ | 194 | /* get physical address of control page now */ |
151 | /* this is impossible after page table switch */ | 195 | /* this is impossible after page table switch */ |
152 | movl PTR(PA_CONTROL_PAGE)(%ebp), %edi | 196 | movl PTR(PA_CONTROL_PAGE)(%ebp), %edi |
@@ -197,8 +241,90 @@ identity_mapped: | |||
197 | xorl %eax, %eax | 241 | xorl %eax, %eax |
198 | movl %eax, %cr3 | 242 | movl %eax, %cr3 |
199 | 243 | ||
244 | movl CP_PA_SWAP_PAGE(%edi), %eax | ||
245 | pushl %eax | ||
246 | pushl %ebx | ||
247 | call swap_pages | ||
248 | addl $8, %esp | ||
249 | |||
250 | /* To be certain of avoiding problems with self-modifying code | ||
251 | * I need to execute a serializing instruction here. | ||
252 | * So I flush the TLB, it's handy, and not processor dependent. | ||
253 | */ | ||
254 | xorl %eax, %eax | ||
255 | movl %eax, %cr3 | ||
256 | |||
257 | /* set all of the registers to known values */ | ||
258 | /* leave %esp alone */ | ||
259 | |||
260 | testl %esi, %esi | ||
261 | jnz 1f | ||
262 | xorl %edi, %edi | ||
263 | xorl %eax, %eax | ||
264 | xorl %ebx, %ebx | ||
265 | xorl %ecx, %ecx | ||
266 | xorl %edx, %edx | ||
267 | xorl %esi, %esi | ||
268 | xorl %ebp, %ebp | ||
269 | ret | ||
270 | 1: | ||
271 | popl %edx | ||
272 | movl CP_PA_SWAP_PAGE(%edi), %esp | ||
273 | addl $PAGE_SIZE, %esp | ||
274 | 2: | ||
275 | call *%edx | ||
276 | |||
277 | /* get the re-entry point of the peer system */ | ||
278 | movl 0(%esp), %ebp | ||
279 | call 1f | ||
280 | 1: | ||
281 | popl %ebx | ||
282 | subl $(1b - relocate_kernel), %ebx | ||
283 | movl CP_VA_CONTROL_PAGE(%ebx), %edi | ||
284 | lea PAGE_SIZE(%ebx), %esp | ||
285 | movl CP_PA_SWAP_PAGE(%ebx), %eax | ||
286 | movl CP_PA_BACKUP_PAGES_MAP(%ebx), %edx | ||
287 | pushl %eax | ||
288 | pushl %edx | ||
289 | call swap_pages | ||
290 | addl $8, %esp | ||
291 | movl CP_PA_PGD(%ebx), %eax | ||
292 | movl %eax, %cr3 | ||
293 | movl %cr0, %eax | ||
294 | orl $(1<<31), %eax | ||
295 | movl %eax, %cr0 | ||
296 | lea PAGE_SIZE(%edi), %esp | ||
297 | movl %edi, %eax | ||
298 | addl $(virtual_mapped - relocate_kernel), %eax | ||
299 | pushl %eax | ||
300 | ret | ||
301 | |||
302 | virtual_mapped: | ||
303 | movl CR4(%edi), %eax | ||
304 | movl %eax, %cr4 | ||
305 | movl CR3(%edi), %eax | ||
306 | movl %eax, %cr3 | ||
307 | movl CR0(%edi), %eax | ||
308 | movl %eax, %cr0 | ||
309 | movl ESP(%edi), %esp | ||
310 | movl %ebp, %eax | ||
311 | |||
312 | popf | ||
313 | popl %ebp | ||
314 | popl %edi | ||
315 | popl %esi | ||
316 | popl %ebx | ||
317 | ret | ||
318 | |||
200 | /* Do the copies */ | 319 | /* Do the copies */ |
201 | movl %ebx, %ecx | 320 | swap_pages: |
321 | movl 8(%esp), %edx | ||
322 | movl 4(%esp), %ecx | ||
323 | pushl %ebp | ||
324 | pushl %ebx | ||
325 | pushl %edi | ||
326 | pushl %esi | ||
327 | movl %ecx, %ebx | ||
202 | jmp 1f | 328 | jmp 1f |
203 | 329 | ||
204 | 0: /* top, read another word from the indirection page */ | 330 | 0: /* top, read another word from the indirection page */ |
@@ -226,27 +352,31 @@ identity_mapped: | |||
226 | movl %ecx, %esi /* For every source page do a copy */ | 352 | movl %ecx, %esi /* For every source page do a copy */ |
227 | andl $0xfffff000, %esi | 353 | andl $0xfffff000, %esi |
228 | 354 | ||
355 | movl %edi, %eax | ||
356 | movl %esi, %ebp | ||
357 | |||
358 | movl %edx, %edi | ||
229 | movl $1024, %ecx | 359 | movl $1024, %ecx |
230 | rep ; movsl | 360 | rep ; movsl |
231 | jmp 0b | ||
232 | |||
233 | 3: | ||
234 | 361 | ||
235 | /* To be certain of avoiding problems with self-modifying code | 362 | movl %ebp, %edi |
236 | * I need to execute a serializing instruction here. | 363 | movl %eax, %esi |
237 | * So I flush the TLB, it's handy, and not processor dependent. | 364 | movl $1024, %ecx |
238 | */ | 365 | rep ; movsl |
239 | xorl %eax, %eax | ||
240 | movl %eax, %cr3 | ||
241 | 366 | ||
242 | /* set all of the registers to known values */ | 367 | movl %eax, %edi |
243 | /* leave %esp alone */ | 368 | movl %edx, %esi |
369 | movl $1024, %ecx | ||
370 | rep ; movsl | ||
244 | 371 | ||
245 | xorl %eax, %eax | 372 | lea PAGE_SIZE(%ebp), %esi |
246 | xorl %ebx, %ebx | 373 | jmp 0b |
247 | xorl %ecx, %ecx | 374 | 3: |
248 | xorl %edx, %edx | 375 | popl %esi |
249 | xorl %esi, %esi | 376 | popl %edi |
250 | xorl %edi, %edi | 377 | popl %ebx |
251 | xorl %ebp, %ebp | 378 | popl %ebp |
252 | ret | 379 | ret |
380 | |||
381 | .globl kexec_control_code_size | ||
382 | .set kexec_control_code_size, . - relocate_kernel | ||
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index b520dae02bf4..673f12cf6eb0 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -445,7 +445,7 @@ static void __init reserve_early_setup_data(void) | |||
445 | * @size: Size of the crashkernel memory to reserve. | 445 | * @size: Size of the crashkernel memory to reserve. |
446 | * Returns the base address on success, and -1ULL on failure. | 446 | * Returns the base address on success, and -1ULL on failure. |
447 | */ | 447 | */ |
448 | unsigned long long find_and_reserve_crashkernel(unsigned long long size) | 448 | unsigned long long __init find_and_reserve_crashkernel(unsigned long long size) |
449 | { | 449 | { |
450 | const unsigned long long alignment = 16<<20; /* 16M */ | 450 | const unsigned long long alignment = 16<<20; /* 16M */ |
451 | unsigned long long start = 0LL; | 451 | unsigned long long start = 0LL; |
@@ -670,6 +670,14 @@ void __init setup_arch(char **cmdline_p) | |||
670 | 670 | ||
671 | parse_early_param(); | 671 | parse_early_param(); |
672 | 672 | ||
673 | #if defined(CONFIG_VMI) && defined(CONFIG_X86_32) | ||
674 | /* | ||
675 | * Must be before kernel pagetables are setup | ||
676 | * or fixmap area is touched. | ||
677 | */ | ||
678 | vmi_init(); | ||
679 | #endif | ||
680 | |||
673 | /* after early param, so could get panic from serial */ | 681 | /* after early param, so could get panic from serial */ |
674 | reserve_early_setup_data(); | 682 | reserve_early_setup_data(); |
675 | 683 | ||
@@ -731,6 +739,8 @@ void __init setup_arch(char **cmdline_p) | |||
731 | num_physpages = max_pfn; | 739 | num_physpages = max_pfn; |
732 | 740 | ||
733 | check_efer(); | 741 | check_efer(); |
742 | if (cpu_has_x2apic) | ||
743 | check_x2apic(); | ||
734 | 744 | ||
735 | /* How many end-of-memory variables you have, grandma! */ | 745 | /* How many end-of-memory variables you have, grandma! */ |
736 | /* need this before calling reserve_initrd */ | 746 | /* need this before calling reserve_initrd */ |
@@ -788,10 +798,6 @@ void __init setup_arch(char **cmdline_p) | |||
788 | 798 | ||
789 | initmem_init(0, max_pfn); | 799 | initmem_init(0, max_pfn); |
790 | 800 | ||
791 | #ifdef CONFIG_X86_64 | ||
792 | dma32_reserve_bootmem(); | ||
793 | #endif | ||
794 | |||
795 | #ifdef CONFIG_ACPI_SLEEP | 801 | #ifdef CONFIG_ACPI_SLEEP |
796 | /* | 802 | /* |
797 | * Reserve low memory region for sleep support. | 803 | * Reserve low memory region for sleep support. |
@@ -806,20 +812,21 @@ void __init setup_arch(char **cmdline_p) | |||
806 | #endif | 812 | #endif |
807 | reserve_crashkernel(); | 813 | reserve_crashkernel(); |
808 | 814 | ||
815 | #ifdef CONFIG_X86_64 | ||
816 | /* | ||
817 | * dma32_reserve_bootmem() allocates bootmem which may conflict | ||
818 | * with the crashkernel command line, so do that after | ||
819 | * reserve_crashkernel() | ||
820 | */ | ||
821 | dma32_reserve_bootmem(); | ||
822 | #endif | ||
823 | |||
809 | reserve_ibft_region(); | 824 | reserve_ibft_region(); |
810 | 825 | ||
811 | #ifdef CONFIG_KVM_CLOCK | 826 | #ifdef CONFIG_KVM_CLOCK |
812 | kvmclock_init(); | 827 | kvmclock_init(); |
813 | #endif | 828 | #endif |
814 | 829 | ||
815 | #if defined(CONFIG_VMI) && defined(CONFIG_X86_32) | ||
816 | /* | ||
817 | * Must be after max_low_pfn is determined, and before kernel | ||
818 | * pagetables are setup. | ||
819 | */ | ||
820 | vmi_init(); | ||
821 | #endif | ||
822 | |||
823 | paravirt_pagetable_setup_start(swapper_pg_dir); | 830 | paravirt_pagetable_setup_start(swapper_pg_dir); |
824 | paging_init(); | 831 | paging_init(); |
825 | paravirt_pagetable_setup_done(swapper_pg_dir); | 832 | paravirt_pagetable_setup_done(swapper_pg_dir); |
@@ -856,12 +863,6 @@ void __init setup_arch(char **cmdline_p) | |||
856 | init_apic_mappings(); | 863 | init_apic_mappings(); |
857 | ioapic_init_mappings(); | 864 | ioapic_init_mappings(); |
858 | 865 | ||
859 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) && defined(CONFIG_X86_32) | ||
860 | if (def_to_bigsmp) | ||
861 | printk(KERN_WARNING "More than 8 CPUs detected and " | ||
862 | "CONFIG_X86_PC cannot handle it.\nUse " | ||
863 | "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n"); | ||
864 | #endif | ||
865 | kvm_guest_init(); | 866 | kvm_guest_init(); |
866 | 867 | ||
867 | e820_reserve_resources(); | 868 | e820_reserve_resources(); |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index f7745f94c006..0e67f72d9316 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -80,24 +80,6 @@ static void __init setup_per_cpu_maps(void) | |||
80 | #endif | 80 | #endif |
81 | } | 81 | } |
82 | 82 | ||
83 | #ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP | ||
84 | cpumask_t *cpumask_of_cpu_map __read_mostly; | ||
85 | EXPORT_SYMBOL(cpumask_of_cpu_map); | ||
86 | |||
87 | /* requires nr_cpu_ids to be initialized */ | ||
88 | static void __init setup_cpumask_of_cpu(void) | ||
89 | { | ||
90 | int i; | ||
91 | |||
92 | /* alloc_bootmem zeroes memory */ | ||
93 | cpumask_of_cpu_map = alloc_bootmem_low(sizeof(cpumask_t) * nr_cpu_ids); | ||
94 | for (i = 0; i < nr_cpu_ids; i++) | ||
95 | cpu_set(i, cpumask_of_cpu_map[i]); | ||
96 | } | ||
97 | #else | ||
98 | static inline void setup_cpumask_of_cpu(void) { } | ||
99 | #endif | ||
100 | |||
101 | #ifdef CONFIG_X86_32 | 83 | #ifdef CONFIG_X86_32 |
102 | /* | 84 | /* |
103 | * Great future not-so-futuristic plan: make i386 and x86_64 do it | 85 | * Great future not-so-futuristic plan: make i386 and x86_64 do it |
@@ -180,9 +162,16 @@ void __init setup_per_cpu_areas(void) | |||
180 | printk(KERN_INFO | 162 | printk(KERN_INFO |
181 | "cpu %d has no node %d or node-local memory\n", | 163 | "cpu %d has no node %d or node-local memory\n", |
182 | cpu, node); | 164 | cpu, node); |
165 | if (ptr) | ||
166 | printk(KERN_DEBUG "per cpu data for cpu%d at %016lx\n", | ||
167 | cpu, __pa(ptr)); | ||
183 | } | 168 | } |
184 | else | 169 | else { |
185 | ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); | 170 | ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); |
171 | if (ptr) | ||
172 | printk(KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n", | ||
173 | cpu, node, __pa(ptr)); | ||
174 | } | ||
186 | #endif | 175 | #endif |
187 | per_cpu_offset(cpu) = ptr - __per_cpu_start; | 176 | per_cpu_offset(cpu) = ptr - __per_cpu_start; |
188 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); | 177 | memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); |
@@ -197,9 +186,6 @@ void __init setup_per_cpu_areas(void) | |||
197 | 186 | ||
198 | /* Setup node to cpumask map */ | 187 | /* Setup node to cpumask map */ |
199 | setup_node_to_cpumask_map(); | 188 | setup_node_to_cpumask_map(); |
200 | |||
201 | /* Setup cpumask_of_cpu map */ | ||
202 | setup_cpumask_of_cpu(); | ||
203 | } | 189 | } |
204 | 190 | ||
205 | #endif | 191 | #endif |
diff --git a/arch/x86/kernel/sigframe.h b/arch/x86/kernel/sigframe.h index 72bbb519d2dc..6dd7e2b70a4b 100644 --- a/arch/x86/kernel/sigframe.h +++ b/arch/x86/kernel/sigframe.h | |||
@@ -3,9 +3,18 @@ struct sigframe { | |||
3 | char __user *pretcode; | 3 | char __user *pretcode; |
4 | int sig; | 4 | int sig; |
5 | struct sigcontext sc; | 5 | struct sigcontext sc; |
6 | struct _fpstate fpstate; | 6 | /* |
7 | * fpstate is unused. fpstate is moved/allocated after | ||
8 | * retcode[] below. This movement allows to have the FP state and the | ||
9 | * future state extensions (xsave) stay together. | ||
10 | * And at the same time retaining the unused fpstate, prevents changing | ||
11 | * the offset of extramask[] in the sigframe and thus prevent any | ||
12 | * legacy application accessing/modifying it. | ||
13 | */ | ||
14 | struct _fpstate fpstate_unused; | ||
7 | unsigned long extramask[_NSIG_WORDS-1]; | 15 | unsigned long extramask[_NSIG_WORDS-1]; |
8 | char retcode[8]; | 16 | char retcode[8]; |
17 | /* fp state follows here */ | ||
9 | }; | 18 | }; |
10 | 19 | ||
11 | struct rt_sigframe { | 20 | struct rt_sigframe { |
@@ -15,13 +24,14 @@ struct rt_sigframe { | |||
15 | void __user *puc; | 24 | void __user *puc; |
16 | struct siginfo info; | 25 | struct siginfo info; |
17 | struct ucontext uc; | 26 | struct ucontext uc; |
18 | struct _fpstate fpstate; | ||
19 | char retcode[8]; | 27 | char retcode[8]; |
28 | /* fp state follows here */ | ||
20 | }; | 29 | }; |
21 | #else | 30 | #else |
22 | struct rt_sigframe { | 31 | struct rt_sigframe { |
23 | char __user *pretcode; | 32 | char __user *pretcode; |
24 | struct ucontext uc; | 33 | struct ucontext uc; |
25 | struct siginfo info; | 34 | struct siginfo info; |
35 | /* fp state follows here */ | ||
26 | }; | 36 | }; |
27 | #endif | 37 | #endif |
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c index 6fb5bcdd8933..8d380b699c0c 100644 --- a/arch/x86/kernel/signal_32.c +++ b/arch/x86/kernel/signal_32.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
27 | #include <asm/i387.h> | 27 | #include <asm/i387.h> |
28 | #include <asm/vdso.h> | 28 | #include <asm/vdso.h> |
29 | #include <asm/syscalls.h> | ||
29 | 30 | ||
30 | #include "sigframe.h" | 31 | #include "sigframe.h" |
31 | 32 | ||
@@ -159,28 +160,14 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
159 | } | 160 | } |
160 | 161 | ||
161 | { | 162 | { |
162 | struct _fpstate __user *buf; | 163 | void __user *buf; |
163 | 164 | ||
164 | err |= __get_user(buf, &sc->fpstate); | 165 | err |= __get_user(buf, &sc->fpstate); |
165 | if (buf) { | 166 | err |= restore_i387_xstate(buf); |
166 | if (!access_ok(VERIFY_READ, buf, sizeof(*buf))) | ||
167 | goto badframe; | ||
168 | err |= restore_i387(buf); | ||
169 | } else { | ||
170 | struct task_struct *me = current; | ||
171 | |||
172 | if (used_math()) { | ||
173 | clear_fpu(me); | ||
174 | clear_used_math(); | ||
175 | } | ||
176 | } | ||
177 | } | 167 | } |
178 | 168 | ||
179 | err |= __get_user(*pax, &sc->ax); | 169 | err |= __get_user(*pax, &sc->ax); |
180 | return err; | 170 | return err; |
181 | |||
182 | badframe: | ||
183 | return 1; | ||
184 | } | 171 | } |
185 | 172 | ||
186 | asmlinkage unsigned long sys_sigreturn(unsigned long __unused) | 173 | asmlinkage unsigned long sys_sigreturn(unsigned long __unused) |
@@ -262,7 +249,7 @@ badframe: | |||
262 | * Set up a signal frame. | 249 | * Set up a signal frame. |
263 | */ | 250 | */ |
264 | static int | 251 | static int |
265 | setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate, | 252 | setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, |
266 | struct pt_regs *regs, unsigned long mask) | 253 | struct pt_regs *regs, unsigned long mask) |
267 | { | 254 | { |
268 | int tmp, err = 0; | 255 | int tmp, err = 0; |
@@ -289,7 +276,7 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate, | |||
289 | err |= __put_user(regs->sp, &sc->sp_at_signal); | 276 | err |= __put_user(regs->sp, &sc->sp_at_signal); |
290 | err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); | 277 | err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); |
291 | 278 | ||
292 | tmp = save_i387(fpstate); | 279 | tmp = save_i387_xstate(fpstate); |
293 | if (tmp < 0) | 280 | if (tmp < 0) |
294 | err = 1; | 281 | err = 1; |
295 | else | 282 | else |
@@ -306,7 +293,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate, | |||
306 | * Determine which stack to use.. | 293 | * Determine which stack to use.. |
307 | */ | 294 | */ |
308 | static inline void __user * | 295 | static inline void __user * |
309 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | 296 | get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size, |
297 | void **fpstate) | ||
310 | { | 298 | { |
311 | unsigned long sp; | 299 | unsigned long sp; |
312 | 300 | ||
@@ -332,6 +320,11 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) | |||
332 | sp = (unsigned long) ka->sa.sa_restorer; | 320 | sp = (unsigned long) ka->sa.sa_restorer; |
333 | } | 321 | } |
334 | 322 | ||
323 | if (used_math()) { | ||
324 | sp = sp - sig_xstate_size; | ||
325 | *fpstate = (struct _fpstate *) sp; | ||
326 | } | ||
327 | |||
335 | sp -= frame_size; | 328 | sp -= frame_size; |
336 | /* | 329 | /* |
337 | * Align the stack pointer according to the i386 ABI, | 330 | * Align the stack pointer according to the i386 ABI, |
@@ -350,8 +343,9 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | |||
350 | void __user *restorer; | 343 | void __user *restorer; |
351 | int err = 0; | 344 | int err = 0; |
352 | int usig; | 345 | int usig; |
346 | void __user *fpstate = NULL; | ||
353 | 347 | ||
354 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 348 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
355 | 349 | ||
356 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 350 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
357 | goto give_sigsegv; | 351 | goto give_sigsegv; |
@@ -366,7 +360,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, | |||
366 | if (err) | 360 | if (err) |
367 | goto give_sigsegv; | 361 | goto give_sigsegv; |
368 | 362 | ||
369 | err = setup_sigcontext(&frame->sc, &frame->fpstate, regs, set->sig[0]); | 363 | err = setup_sigcontext(&frame->sc, fpstate, regs, set->sig[0]); |
370 | if (err) | 364 | if (err) |
371 | goto give_sigsegv; | 365 | goto give_sigsegv; |
372 | 366 | ||
@@ -427,8 +421,9 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
427 | void __user *restorer; | 421 | void __user *restorer; |
428 | int err = 0; | 422 | int err = 0; |
429 | int usig; | 423 | int usig; |
424 | void __user *fpstate = NULL; | ||
430 | 425 | ||
431 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 426 | frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); |
432 | 427 | ||
433 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 428 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
434 | goto give_sigsegv; | 429 | goto give_sigsegv; |
@@ -447,13 +442,16 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
447 | goto give_sigsegv; | 442 | goto give_sigsegv; |
448 | 443 | ||
449 | /* Create the ucontext. */ | 444 | /* Create the ucontext. */ |
450 | err |= __put_user(0, &frame->uc.uc_flags); | 445 | if (cpu_has_xsave) |
446 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | ||
447 | else | ||
448 | err |= __put_user(0, &frame->uc.uc_flags); | ||
451 | err |= __put_user(0, &frame->uc.uc_link); | 449 | err |= __put_user(0, &frame->uc.uc_link); |
452 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 450 | err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
453 | err |= __put_user(sas_ss_flags(regs->sp), | 451 | err |= __put_user(sas_ss_flags(regs->sp), |
454 | &frame->uc.uc_stack.ss_flags); | 452 | &frame->uc.uc_stack.ss_flags); |
455 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); | 453 | err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size); |
456 | err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate, | 454 | err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, |
457 | regs, set->sig[0]); | 455 | regs, set->sig[0]); |
458 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 456 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
459 | if (err) | 457 | if (err) |
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c index b45ef8ddd651..4665b598a376 100644 --- a/arch/x86/kernel/signal_64.c +++ b/arch/x86/kernel/signal_64.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/proto.h> | 26 | #include <asm/proto.h> |
27 | #include <asm/ia32_unistd.h> | 27 | #include <asm/ia32_unistd.h> |
28 | #include <asm/mce.h> | 28 | #include <asm/mce.h> |
29 | #include <asm/syscalls.h> | ||
29 | #include "sigframe.h" | 30 | #include "sigframe.h" |
30 | 31 | ||
31 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | 32 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
@@ -54,60 +55,6 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | |||
54 | } | 55 | } |
55 | 56 | ||
56 | /* | 57 | /* |
57 | * Signal frame handlers. | ||
58 | */ | ||
59 | |||
60 | static inline int save_i387(struct _fpstate __user *buf) | ||
61 | { | ||
62 | struct task_struct *tsk = current; | ||
63 | int err = 0; | ||
64 | |||
65 | BUILD_BUG_ON(sizeof(struct user_i387_struct) != | ||
66 | sizeof(tsk->thread.xstate->fxsave)); | ||
67 | |||
68 | if ((unsigned long)buf % 16) | ||
69 | printk("save_i387: bad fpstate %p\n", buf); | ||
70 | |||
71 | if (!used_math()) | ||
72 | return 0; | ||
73 | clear_used_math(); /* trigger finit */ | ||
74 | if (task_thread_info(tsk)->status & TS_USEDFPU) { | ||
75 | err = save_i387_checking((struct i387_fxsave_struct __user *) | ||
76 | buf); | ||
77 | if (err) | ||
78 | return err; | ||
79 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
80 | stts(); | ||
81 | } else { | ||
82 | if (__copy_to_user(buf, &tsk->thread.xstate->fxsave, | ||
83 | sizeof(struct i387_fxsave_struct))) | ||
84 | return -1; | ||
85 | } | ||
86 | return 1; | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * This restores directly out of user space. Exceptions are handled. | ||
91 | */ | ||
92 | static inline int restore_i387(struct _fpstate __user *buf) | ||
93 | { | ||
94 | struct task_struct *tsk = current; | ||
95 | int err; | ||
96 | |||
97 | if (!used_math()) { | ||
98 | err = init_fpu(tsk); | ||
99 | if (err) | ||
100 | return err; | ||
101 | } | ||
102 | |||
103 | if (!(task_thread_info(current)->status & TS_USEDFPU)) { | ||
104 | clts(); | ||
105 | task_thread_info(current)->status |= TS_USEDFPU; | ||
106 | } | ||
107 | return restore_fpu_checking((__force struct i387_fxsave_struct *)buf); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Do a signal return; undo the signal stack. | 58 | * Do a signal return; undo the signal stack. |
112 | */ | 59 | */ |
113 | static int | 60 | static int |
@@ -151,25 +98,11 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, | |||
151 | { | 98 | { |
152 | struct _fpstate __user * buf; | 99 | struct _fpstate __user * buf; |
153 | err |= __get_user(buf, &sc->fpstate); | 100 | err |= __get_user(buf, &sc->fpstate); |
154 | 101 | err |= restore_i387_xstate(buf); | |
155 | if (buf) { | ||
156 | if (!access_ok(VERIFY_READ, buf, sizeof(*buf))) | ||
157 | goto badframe; | ||
158 | err |= restore_i387(buf); | ||
159 | } else { | ||
160 | struct task_struct *me = current; | ||
161 | if (used_math()) { | ||
162 | clear_fpu(me); | ||
163 | clear_used_math(); | ||
164 | } | ||
165 | } | ||
166 | } | 102 | } |
167 | 103 | ||
168 | err |= __get_user(*pax, &sc->ax); | 104 | err |= __get_user(*pax, &sc->ax); |
169 | return err; | 105 | return err; |
170 | |||
171 | badframe: | ||
172 | return 1; | ||
173 | } | 106 | } |
174 | 107 | ||
175 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) | 108 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) |
@@ -260,26 +193,23 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size) | |||
260 | sp = current->sas_ss_sp + current->sas_ss_size; | 193 | sp = current->sas_ss_sp + current->sas_ss_size; |
261 | } | 194 | } |
262 | 195 | ||
263 | return (void __user *)round_down(sp - size, 16); | 196 | return (void __user *)round_down(sp - size, 64); |
264 | } | 197 | } |
265 | 198 | ||
266 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 199 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
267 | sigset_t *set, struct pt_regs * regs) | 200 | sigset_t *set, struct pt_regs * regs) |
268 | { | 201 | { |
269 | struct rt_sigframe __user *frame; | 202 | struct rt_sigframe __user *frame; |
270 | struct _fpstate __user *fp = NULL; | 203 | void __user *fp = NULL; |
271 | int err = 0; | 204 | int err = 0; |
272 | struct task_struct *me = current; | 205 | struct task_struct *me = current; |
273 | 206 | ||
274 | if (used_math()) { | 207 | if (used_math()) { |
275 | fp = get_stack(ka, regs, sizeof(struct _fpstate)); | 208 | fp = get_stack(ka, regs, sig_xstate_size); |
276 | frame = (void __user *)round_down( | 209 | frame = (void __user *)round_down( |
277 | (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8; | 210 | (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8; |
278 | 211 | ||
279 | if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) | 212 | if (save_i387_xstate(fp) < 0) |
280 | goto give_sigsegv; | ||
281 | |||
282 | if (save_i387(fp) < 0) | ||
283 | err |= -1; | 213 | err |= -1; |
284 | } else | 214 | } else |
285 | frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8; | 215 | frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8; |
@@ -294,7 +224,10 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
294 | } | 224 | } |
295 | 225 | ||
296 | /* Create the ucontext. */ | 226 | /* Create the ucontext. */ |
297 | err |= __put_user(0, &frame->uc.uc_flags); | 227 | if (cpu_has_xsave) |
228 | err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); | ||
229 | else | ||
230 | err |= __put_user(0, &frame->uc.uc_flags); | ||
298 | err |= __put_user(0, &frame->uc.uc_link); | 231 | err |= __put_user(0, &frame->uc.uc_link); |
299 | err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); | 232 | err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); |
300 | err |= __put_user(sas_ss_flags(regs->sp), | 233 | err |= __put_user(sas_ss_flags(regs->sp), |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 332512767f4f..aa804c64b167 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -88,7 +88,7 @@ static DEFINE_PER_CPU(struct task_struct *, idle_thread_array); | |||
88 | #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x)) | 88 | #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x)) |
89 | #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p)) | 89 | #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p)) |
90 | #else | 90 | #else |
91 | struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; | 91 | static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; |
92 | #define get_idle_for_cpu(x) (idle_thread_array[(x)]) | 92 | #define get_idle_for_cpu(x) (idle_thread_array[(x)]) |
93 | #define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p)) | 93 | #define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p)) |
94 | #endif | 94 | #endif |
@@ -123,13 +123,12 @@ EXPORT_PER_CPU_SYMBOL(cpu_info); | |||
123 | 123 | ||
124 | static atomic_t init_deasserted; | 124 | static atomic_t init_deasserted; |
125 | 125 | ||
126 | static int boot_cpu_logical_apicid; | ||
127 | 126 | ||
128 | /* representing cpus for which sibling maps can be computed */ | 127 | /* representing cpus for which sibling maps can be computed */ |
129 | static cpumask_t cpu_sibling_setup_map; | 128 | static cpumask_t cpu_sibling_setup_map; |
130 | 129 | ||
131 | /* Set if we find a B stepping CPU */ | 130 | /* Set if we find a B stepping CPU */ |
132 | int __cpuinitdata smp_b_stepping; | 131 | static int __cpuinitdata smp_b_stepping; |
133 | 132 | ||
134 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) | 133 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) |
135 | 134 | ||
@@ -165,6 +164,8 @@ static void unmap_cpu_to_node(int cpu) | |||
165 | #endif | 164 | #endif |
166 | 165 | ||
167 | #ifdef CONFIG_X86_32 | 166 | #ifdef CONFIG_X86_32 |
167 | static int boot_cpu_logical_apicid; | ||
168 | |||
168 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = | 169 | u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = |
169 | { [0 ... NR_CPUS-1] = BAD_APICID }; | 170 | { [0 ... NR_CPUS-1] = BAD_APICID }; |
170 | 171 | ||
@@ -210,7 +211,7 @@ static void __cpuinit smp_callin(void) | |||
210 | /* | 211 | /* |
211 | * (This works even if the APIC is not enabled.) | 212 | * (This works even if the APIC is not enabled.) |
212 | */ | 213 | */ |
213 | phys_id = GET_APIC_ID(read_apic_id()); | 214 | phys_id = read_apic_id(); |
214 | cpuid = smp_processor_id(); | 215 | cpuid = smp_processor_id(); |
215 | if (cpu_isset(cpuid, cpu_callin_map)) { | 216 | if (cpu_isset(cpuid, cpu_callin_map)) { |
216 | panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, | 217 | panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, |
@@ -326,12 +327,16 @@ static void __cpuinit start_secondary(void *unused) | |||
326 | * for which cpus receive the IPI. Holding this | 327 | * for which cpus receive the IPI. Holding this |
327 | * lock helps us to not include this cpu in a currently in progress | 328 | * lock helps us to not include this cpu in a currently in progress |
328 | * smp_call_function(). | 329 | * smp_call_function(). |
330 | * | ||
331 | * We need to hold vector_lock so there the set of online cpus | ||
332 | * does not change while we are assigning vectors to cpus. Holding | ||
333 | * this lock ensures we don't half assign or remove an irq from a cpu. | ||
329 | */ | 334 | */ |
330 | ipi_call_lock_irq(); | 335 | ipi_call_lock_irq(); |
331 | #ifdef CONFIG_X86_IO_APIC | 336 | lock_vector_lock(); |
332 | setup_vector_irq(smp_processor_id()); | 337 | __setup_vector_irq(smp_processor_id()); |
333 | #endif | ||
334 | cpu_set(smp_processor_id(), cpu_online_map); | 338 | cpu_set(smp_processor_id(), cpu_online_map); |
339 | unlock_vector_lock(); | ||
335 | ipi_call_unlock_irq(); | 340 | ipi_call_unlock_irq(); |
336 | per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; | 341 | per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; |
337 | 342 | ||
@@ -546,8 +551,7 @@ static inline void __inquire_remote_apic(int apicid) | |||
546 | printk(KERN_CONT | 551 | printk(KERN_CONT |
547 | "a previous APIC delivery may have failed\n"); | 552 | "a previous APIC delivery may have failed\n"); |
548 | 553 | ||
549 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(apicid)); | 554 | apic_icr_write(APIC_DM_REMRD | regs[i], apicid); |
550 | apic_write(APIC_ICR, APIC_DM_REMRD | regs[i]); | ||
551 | 555 | ||
552 | timeout = 0; | 556 | timeout = 0; |
553 | do { | 557 | do { |
@@ -579,11 +583,9 @@ wakeup_secondary_cpu(int logical_apicid, unsigned long start_eip) | |||
579 | int maxlvt; | 583 | int maxlvt; |
580 | 584 | ||
581 | /* Target chip */ | 585 | /* Target chip */ |
582 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(logical_apicid)); | ||
583 | |||
584 | /* Boot on the stack */ | 586 | /* Boot on the stack */ |
585 | /* Kick the second */ | 587 | /* Kick the second */ |
586 | apic_write(APIC_ICR, APIC_DM_NMI | APIC_DEST_LOGICAL); | 588 | apic_icr_write(APIC_DM_NMI | APIC_DEST_LOGICAL, logical_apicid); |
587 | 589 | ||
588 | pr_debug("Waiting for send to finish...\n"); | 590 | pr_debug("Waiting for send to finish...\n"); |
589 | send_status = safe_apic_wait_icr_idle(); | 591 | send_status = safe_apic_wait_icr_idle(); |
@@ -636,13 +638,11 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) | |||
636 | /* | 638 | /* |
637 | * Turn INIT on target chip | 639 | * Turn INIT on target chip |
638 | */ | 640 | */ |
639 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | ||
640 | |||
641 | /* | 641 | /* |
642 | * Send IPI | 642 | * Send IPI |
643 | */ | 643 | */ |
644 | apic_write(APIC_ICR, | 644 | apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT, |
645 | APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT); | 645 | phys_apicid); |
646 | 646 | ||
647 | pr_debug("Waiting for send to finish...\n"); | 647 | pr_debug("Waiting for send to finish...\n"); |
648 | send_status = safe_apic_wait_icr_idle(); | 648 | send_status = safe_apic_wait_icr_idle(); |
@@ -652,10 +652,8 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) | |||
652 | pr_debug("Deasserting INIT.\n"); | 652 | pr_debug("Deasserting INIT.\n"); |
653 | 653 | ||
654 | /* Target chip */ | 654 | /* Target chip */ |
655 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | ||
656 | |||
657 | /* Send IPI */ | 655 | /* Send IPI */ |
658 | apic_write(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT); | 656 | apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid); |
659 | 657 | ||
660 | pr_debug("Waiting for send to finish...\n"); | 658 | pr_debug("Waiting for send to finish...\n"); |
661 | send_status = safe_apic_wait_icr_idle(); | 659 | send_status = safe_apic_wait_icr_idle(); |
@@ -698,11 +696,10 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip) | |||
698 | */ | 696 | */ |
699 | 697 | ||
700 | /* Target chip */ | 698 | /* Target chip */ |
701 | apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); | ||
702 | |||
703 | /* Boot on the stack */ | 699 | /* Boot on the stack */ |
704 | /* Kick the second */ | 700 | /* Kick the second */ |
705 | apic_write(APIC_ICR, APIC_DM_STARTUP | (start_eip >> 12)); | 701 | apic_icr_write(APIC_DM_STARTUP | (start_eip >> 12), |
702 | phys_apicid); | ||
706 | 703 | ||
707 | /* | 704 | /* |
708 | * Give the other CPU some time to accept the IPI. | 705 | * Give the other CPU some time to accept the IPI. |
@@ -752,6 +749,14 @@ static void __cpuinit do_fork_idle(struct work_struct *work) | |||
752 | } | 749 | } |
753 | 750 | ||
754 | #ifdef CONFIG_X86_64 | 751 | #ifdef CONFIG_X86_64 |
752 | |||
753 | /* __ref because it's safe to call free_bootmem when after_bootmem == 0. */ | ||
754 | static void __ref free_bootmem_pda(struct x8664_pda *oldpda) | ||
755 | { | ||
756 | if (!after_bootmem) | ||
757 | free_bootmem((unsigned long)oldpda, sizeof(*oldpda)); | ||
758 | } | ||
759 | |||
755 | /* | 760 | /* |
756 | * Allocate node local memory for the AP pda. | 761 | * Allocate node local memory for the AP pda. |
757 | * | 762 | * |
@@ -780,8 +785,7 @@ int __cpuinit get_local_pda(int cpu) | |||
780 | 785 | ||
781 | if (oldpda) { | 786 | if (oldpda) { |
782 | memcpy(newpda, oldpda, size); | 787 | memcpy(newpda, oldpda, size); |
783 | if (!after_bootmem) | 788 | free_bootmem_pda(oldpda); |
784 | free_bootmem((unsigned long)oldpda, size); | ||
785 | } | 789 | } |
786 | 790 | ||
787 | newpda->in_bootmem = 0; | 791 | newpda->in_bootmem = 0; |
@@ -1044,6 +1048,34 @@ static __init void disable_smp(void) | |||
1044 | static int __init smp_sanity_check(unsigned max_cpus) | 1048 | static int __init smp_sanity_check(unsigned max_cpus) |
1045 | { | 1049 | { |
1046 | preempt_disable(); | 1050 | preempt_disable(); |
1051 | |||
1052 | #if defined(CONFIG_X86_PC) && defined(CONFIG_X86_32) | ||
1053 | if (def_to_bigsmp && nr_cpu_ids > 8) { | ||
1054 | unsigned int cpu; | ||
1055 | unsigned nr; | ||
1056 | |||
1057 | printk(KERN_WARNING | ||
1058 | "More than 8 CPUs detected - skipping them.\n" | ||
1059 | "Use CONFIG_X86_GENERICARCH and CONFIG_X86_BIGSMP.\n"); | ||
1060 | |||
1061 | nr = 0; | ||
1062 | for_each_present_cpu(cpu) { | ||
1063 | if (nr >= 8) | ||
1064 | cpu_clear(cpu, cpu_present_map); | ||
1065 | nr++; | ||
1066 | } | ||
1067 | |||
1068 | nr = 0; | ||
1069 | for_each_possible_cpu(cpu) { | ||
1070 | if (nr >= 8) | ||
1071 | cpu_clear(cpu, cpu_possible_map); | ||
1072 | nr++; | ||
1073 | } | ||
1074 | |||
1075 | nr_cpu_ids = 8; | ||
1076 | } | ||
1077 | #endif | ||
1078 | |||
1047 | if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) { | 1079 | if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) { |
1048 | printk(KERN_WARNING "weird, boot CPU (#%d) not listed" | 1080 | printk(KERN_WARNING "weird, boot CPU (#%d) not listed" |
1049 | "by the BIOS.\n", hard_smp_processor_id()); | 1081 | "by the BIOS.\n", hard_smp_processor_id()); |
@@ -1136,10 +1168,17 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1136 | * Setup boot CPU information | 1168 | * Setup boot CPU information |
1137 | */ | 1169 | */ |
1138 | smp_store_cpu_info(0); /* Final full version of the data */ | 1170 | smp_store_cpu_info(0); /* Final full version of the data */ |
1171 | #ifdef CONFIG_X86_32 | ||
1139 | boot_cpu_logical_apicid = logical_smp_processor_id(); | 1172 | boot_cpu_logical_apicid = logical_smp_processor_id(); |
1173 | #endif | ||
1140 | current_thread_info()->cpu = 0; /* needed? */ | 1174 | current_thread_info()->cpu = 0; /* needed? */ |
1141 | set_cpu_sibling_map(0); | 1175 | set_cpu_sibling_map(0); |
1142 | 1176 | ||
1177 | #ifdef CONFIG_X86_64 | ||
1178 | enable_IR_x2apic(); | ||
1179 | setup_apic_routing(); | ||
1180 | #endif | ||
1181 | |||
1143 | if (smp_sanity_check(max_cpus) < 0) { | 1182 | if (smp_sanity_check(max_cpus) < 0) { |
1144 | printk(KERN_INFO "SMP disabled\n"); | 1183 | printk(KERN_INFO "SMP disabled\n"); |
1145 | disable_smp(); | 1184 | disable_smp(); |
@@ -1147,9 +1186,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1147 | } | 1186 | } |
1148 | 1187 | ||
1149 | preempt_disable(); | 1188 | preempt_disable(); |
1150 | if (GET_APIC_ID(read_apic_id()) != boot_cpu_physical_apicid) { | 1189 | if (read_apic_id() != boot_cpu_physical_apicid) { |
1151 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", | 1190 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", |
1152 | GET_APIC_ID(read_apic_id()), boot_cpu_physical_apicid); | 1191 | read_apic_id(), boot_cpu_physical_apicid); |
1153 | /* Or can we switch back to PIC here? */ | 1192 | /* Or can we switch back to PIC here? */ |
1154 | } | 1193 | } |
1155 | preempt_enable(); | 1194 | preempt_enable(); |
@@ -1182,6 +1221,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1182 | printk(KERN_INFO "CPU%d: ", 0); | 1221 | printk(KERN_INFO "CPU%d: ", 0); |
1183 | print_cpu_info(&cpu_data(0)); | 1222 | print_cpu_info(&cpu_data(0)); |
1184 | setup_boot_clock(); | 1223 | setup_boot_clock(); |
1224 | |||
1225 | if (is_uv_system()) | ||
1226 | uv_system_init(); | ||
1185 | out: | 1227 | out: |
1186 | preempt_enable(); | 1228 | preempt_enable(); |
1187 | } | 1229 | } |
@@ -1336,7 +1378,9 @@ int __cpu_disable(void) | |||
1336 | remove_siblinginfo(cpu); | 1378 | remove_siblinginfo(cpu); |
1337 | 1379 | ||
1338 | /* It's now safe to remove this processor from the online map */ | 1380 | /* It's now safe to remove this processor from the online map */ |
1381 | lock_vector_lock(); | ||
1339 | remove_cpu_from_maps(cpu); | 1382 | remove_cpu_from_maps(cpu); |
1383 | unlock_vector_lock(); | ||
1340 | fixup_irqs(cpu_online_map); | 1384 | fixup_irqs(cpu_online_map); |
1341 | return 0; | 1385 | return 0; |
1342 | } | 1386 | } |
@@ -1370,17 +1414,3 @@ void __cpu_die(unsigned int cpu) | |||
1370 | BUG(); | 1414 | BUG(); |
1371 | } | 1415 | } |
1372 | #endif | 1416 | #endif |
1373 | |||
1374 | /* | ||
1375 | * If the BIOS enumerates physical processors before logical, | ||
1376 | * maxcpus=N at enumeration-time can be used to disable HT. | ||
1377 | */ | ||
1378 | static int __init parse_maxcpus(char *arg) | ||
1379 | { | ||
1380 | extern unsigned int maxcpus; | ||
1381 | |||
1382 | if (arg) | ||
1383 | maxcpus = simple_strtoul(arg, NULL, 0); | ||
1384 | return 0; | ||
1385 | } | ||
1386 | early_param("maxcpus", parse_maxcpus); | ||
diff --git a/arch/x86/kernel/smpcommon.c b/arch/x86/kernel/smpcommon.c index 99941b37eca0..397e309839dd 100644 --- a/arch/x86/kernel/smpcommon.c +++ b/arch/x86/kernel/smpcommon.c | |||
@@ -8,18 +8,21 @@ | |||
8 | DEFINE_PER_CPU(unsigned long, this_cpu_off); | 8 | DEFINE_PER_CPU(unsigned long, this_cpu_off); |
9 | EXPORT_PER_CPU_SYMBOL(this_cpu_off); | 9 | EXPORT_PER_CPU_SYMBOL(this_cpu_off); |
10 | 10 | ||
11 | /* Initialize the CPU's GDT. This is either the boot CPU doing itself | 11 | /* |
12 | (still using the master per-cpu area), or a CPU doing it for a | 12 | * Initialize the CPU's GDT. This is either the boot CPU doing itself |
13 | secondary which will soon come up. */ | 13 | * (still using the master per-cpu area), or a CPU doing it for a |
14 | * secondary which will soon come up. | ||
15 | */ | ||
14 | __cpuinit void init_gdt(int cpu) | 16 | __cpuinit void init_gdt(int cpu) |
15 | { | 17 | { |
16 | struct desc_struct *gdt = get_cpu_gdt_table(cpu); | 18 | struct desc_struct gdt; |
17 | 19 | ||
18 | pack_descriptor(&gdt[GDT_ENTRY_PERCPU], | 20 | pack_descriptor(&gdt, __per_cpu_offset[cpu], 0xFFFFF, |
19 | __per_cpu_offset[cpu], 0xFFFFF, | ||
20 | 0x2 | DESCTYPE_S, 0x8); | 21 | 0x2 | DESCTYPE_S, 0x8); |
22 | gdt.s = 1; | ||
21 | 23 | ||
22 | gdt[GDT_ENTRY_PERCPU].s = 1; | 24 | write_gdt_entry(get_cpu_gdt_table(cpu), |
25 | GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S); | ||
23 | 26 | ||
24 | per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu]; | 27 | per_cpu(this_cpu_off, cpu) = __per_cpu_offset[cpu]; |
25 | per_cpu(cpu_number, cpu) = cpu; | 28 | per_cpu(cpu_number, cpu) = cpu; |
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c index d67ce5f044ba..7b987852e876 100644 --- a/arch/x86/kernel/summit_32.c +++ b/arch/x86/kernel/summit_32.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | #include <asm/bios_ebda.h> | 32 | #include <asm/bios_ebda.h> |
33 | #include <asm/mach-summit/mach_mpparse.h> | 33 | #include <asm/summit/mpparse.h> |
34 | 34 | ||
35 | static struct rio_table_hdr *rio_table_hdr __initdata; | 35 | static struct rio_table_hdr *rio_table_hdr __initdata; |
36 | static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata; | 36 | static struct scal_detail *scal_devs[MAX_NUMNODES] __initdata; |
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c index 7066cb855a60..1884a8d12bfa 100644 --- a/arch/x86/kernel/sys_i386_32.c +++ b/arch/x86/kernel/sys_i386_32.c | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/uaccess.h> | 22 | #include <linux/uaccess.h> |
23 | #include <linux/unistd.h> | 23 | #include <linux/unistd.h> |
24 | 24 | ||
25 | #include <asm/syscalls.h> | ||
26 | |||
25 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | 27 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, |
26 | unsigned long prot, unsigned long flags, | 28 | unsigned long prot, unsigned long flags, |
27 | unsigned long fd, unsigned long pgoff) | 29 | unsigned long fd, unsigned long pgoff) |
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index 3b360ef33817..c9288c883e20 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
18 | #include <asm/ia32.h> | 18 | #include <asm/ia32.h> |
19 | #include <asm/syscalls.h> | ||
19 | 20 | ||
20 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, | 21 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, |
21 | unsigned long fd, unsigned long off) | 22 | unsigned long fd, unsigned long off) |
diff --git a/arch/x86/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c index 170d43c17487..3d1be4f0fac5 100644 --- a/arch/x86/kernel/syscall_64.c +++ b/arch/x86/kernel/syscall_64.c | |||
@@ -8,12 +8,12 @@ | |||
8 | #define __NO_STUBS | 8 | #define __NO_STUBS |
9 | 9 | ||
10 | #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; | 10 | #define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ; |
11 | #undef _ASM_X86_64_UNISTD_H_ | 11 | #undef ASM_X86__UNISTD_64_H |
12 | #include <asm/unistd_64.h> | 12 | #include <asm/unistd_64.h> |
13 | 13 | ||
14 | #undef __SYSCALL | 14 | #undef __SYSCALL |
15 | #define __SYSCALL(nr, sym) [nr] = sym, | 15 | #define __SYSCALL(nr, sym) [nr] = sym, |
16 | #undef _ASM_X86_64_UNISTD_H_ | 16 | #undef ASM_X86__UNISTD_64_H |
17 | 17 | ||
18 | typedef void (*sys_call_ptr_t)(void); | 18 | typedef void (*sys_call_ptr_t)(void); |
19 | 19 | ||
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c index ffe3c664afc0..bbecf8b6bf96 100644 --- a/arch/x86/kernel/time_32.c +++ b/arch/x86/kernel/time_32.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/arch_hooks.h> | 36 | #include <asm/arch_hooks.h> |
37 | #include <asm/hpet.h> | 37 | #include <asm/hpet.h> |
38 | #include <asm/time.h> | 38 | #include <asm/time.h> |
39 | #include <asm/timer.h> | ||
39 | 40 | ||
40 | #include "do_timer.h" | 41 | #include "do_timer.h" |
41 | 42 | ||
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c index d0fbb7712ab0..8b8c0d6640fa 100644 --- a/arch/x86/kernel/tlb_uv.c +++ b/arch/x86/kernel/tlb_uv.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/genapic.h> | 17 | #include <asm/genapic.h> |
18 | #include <asm/idle.h> | 18 | #include <asm/idle.h> |
19 | #include <asm/tsc.h> | 19 | #include <asm/tsc.h> |
20 | #include <asm/irq_vectors.h> | ||
20 | 21 | ||
21 | #include <mach_apic.h> | 22 | #include <mach_apic.h> |
22 | 23 | ||
@@ -783,7 +784,7 @@ static int __init uv_bau_init(void) | |||
783 | uv_init_blade(blade, node, cur_cpu); | 784 | uv_init_blade(blade, node, cur_cpu); |
784 | cur_cpu += uv_blade_nr_possible_cpus(blade); | 785 | cur_cpu += uv_blade_nr_possible_cpus(blade); |
785 | } | 786 | } |
786 | set_intr_gate(UV_BAU_MESSAGE, uv_bau_message_intr1); | 787 | alloc_intr_gate(UV_BAU_MESSAGE, uv_bau_message_intr1); |
787 | uv_enable_timeouts(); | 788 | uv_enable_timeouts(); |
788 | 789 | ||
789 | return 0; | 790 | return 0; |
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c index ab6bf375a307..6bb7b8579e70 100644 --- a/arch/x86/kernel/tls.c +++ b/arch/x86/kernel/tls.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm/ldt.h> | 10 | #include <asm/ldt.h> |
11 | #include <asm/processor.h> | 11 | #include <asm/processor.h> |
12 | #include <asm/proto.h> | 12 | #include <asm/proto.h> |
13 | #include <asm/syscalls.h> | ||
13 | 14 | ||
14 | #include "tls.h" | 15 | #include "tls.h" |
15 | 16 | ||
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c index 03df8e45e5a1..da5a5964fccb 100644 --- a/arch/x86/kernel/traps_32.c +++ b/arch/x86/kernel/traps_32.c | |||
@@ -1228,7 +1228,6 @@ void __init trap_init(void) | |||
1228 | 1228 | ||
1229 | set_bit(SYSCALL_VECTOR, used_vectors); | 1229 | set_bit(SYSCALL_VECTOR, used_vectors); |
1230 | 1230 | ||
1231 | init_thread_xstate(); | ||
1232 | /* | 1231 | /* |
1233 | * Should be a barrier for any external CPU state: | 1232 | * Should be a barrier for any external CPU state: |
1234 | */ | 1233 | */ |
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index 3f18d73f420c..b42068fb7b76 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c | |||
@@ -339,9 +339,8 @@ static void | |||
339 | show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, | 339 | show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, |
340 | unsigned long *stack, unsigned long bp, char *log_lvl) | 340 | unsigned long *stack, unsigned long bp, char *log_lvl) |
341 | { | 341 | { |
342 | printk("\nCall Trace:\n"); | 342 | printk("Call Trace:\n"); |
343 | dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl); | 343 | dump_trace(task, regs, stack, bp, &print_trace_ops, log_lvl); |
344 | printk("\n"); | ||
345 | } | 344 | } |
346 | 345 | ||
347 | void show_trace(struct task_struct *task, struct pt_regs *regs, | 346 | void show_trace(struct task_struct *task, struct pt_regs *regs, |
@@ -386,6 +385,7 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs, | |||
386 | printk(" %016lx", *stack++); | 385 | printk(" %016lx", *stack++); |
387 | touch_nmi_watchdog(); | 386 | touch_nmi_watchdog(); |
388 | } | 387 | } |
388 | printk("\n"); | ||
389 | show_trace_log_lvl(task, regs, sp, bp, log_lvl); | 389 | show_trace_log_lvl(task, regs, sp, bp, log_lvl); |
390 | } | 390 | } |
391 | 391 | ||
@@ -443,7 +443,6 @@ void show_registers(struct pt_regs *regs) | |||
443 | printk("Stack: "); | 443 | printk("Stack: "); |
444 | show_stack_log_lvl(NULL, regs, (unsigned long *)sp, | 444 | show_stack_log_lvl(NULL, regs, (unsigned long *)sp, |
445 | regs->bp, ""); | 445 | regs->bp, ""); |
446 | printk("\n"); | ||
447 | 446 | ||
448 | printk(KERN_EMERG "Code: "); | 447 | printk(KERN_EMERG "Code: "); |
449 | 448 | ||
@@ -1131,7 +1130,14 @@ asmlinkage void math_state_restore(void) | |||
1131 | } | 1130 | } |
1132 | 1131 | ||
1133 | clts(); /* Allow maths ops (or we recurse) */ | 1132 | clts(); /* Allow maths ops (or we recurse) */ |
1134 | restore_fpu_checking(&me->thread.xstate->fxsave); | 1133 | /* |
1134 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
1135 | */ | ||
1136 | if (unlikely(restore_fpu_checking(me))) { | ||
1137 | stts(); | ||
1138 | force_sig(SIGSEGV, me); | ||
1139 | return; | ||
1140 | } | ||
1135 | task_thread_info(me)->status |= TS_USEDFPU; | 1141 | task_thread_info(me)->status |= TS_USEDFPU; |
1136 | me->fpu_counter++; | 1142 | me->fpu_counter++; |
1137 | } | 1143 | } |
@@ -1166,10 +1172,6 @@ void __init trap_init(void) | |||
1166 | set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall); | 1172 | set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall); |
1167 | #endif | 1173 | #endif |
1168 | /* | 1174 | /* |
1169 | * initialize the per thread extended state: | ||
1170 | */ | ||
1171 | init_thread_xstate(); | ||
1172 | /* | ||
1173 | * Should be a barrier for any external CPU state: | 1175 | * Should be a barrier for any external CPU state: |
1174 | */ | 1176 | */ |
1175 | cpu_init(); | 1177 | cpu_init(); |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 7603c0553909..8f98e9de1b82 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -104,7 +104,7 @@ __setup("notsc", notsc_setup); | |||
104 | /* | 104 | /* |
105 | * Read TSC and the reference counters. Take care of SMI disturbance | 105 | * Read TSC and the reference counters. Take care of SMI disturbance |
106 | */ | 106 | */ |
107 | static u64 __init tsc_read_refs(u64 *pm, u64 *hpet) | 107 | static u64 tsc_read_refs(u64 *pm, u64 *hpet) |
108 | { | 108 | { |
109 | u64 t1, t2; | 109 | u64 t1, t2; |
110 | int i; | 110 | int i; |
@@ -122,80 +122,216 @@ static u64 __init tsc_read_refs(u64 *pm, u64 *hpet) | |||
122 | return ULLONG_MAX; | 122 | return ULLONG_MAX; |
123 | } | 123 | } |
124 | 124 | ||
125 | /** | 125 | /* |
126 | * native_calibrate_tsc - calibrate the tsc on boot | 126 | * Try to calibrate the TSC against the Programmable |
127 | * Interrupt Timer and return the frequency of the TSC | ||
128 | * in kHz. | ||
129 | * | ||
130 | * Return ULONG_MAX on failure to calibrate. | ||
127 | */ | 131 | */ |
128 | unsigned long native_calibrate_tsc(void) | 132 | static unsigned long pit_calibrate_tsc(void) |
129 | { | 133 | { |
130 | unsigned long flags; | 134 | u64 tsc, t1, t2, delta; |
131 | u64 tsc1, tsc2, tr1, tr2, delta, pm1, pm2, hpet1, hpet2; | 135 | unsigned long tscmin, tscmax; |
132 | int hpet = is_hpet_enabled(); | 136 | int pitcnt; |
133 | unsigned int tsc_khz_val = 0; | ||
134 | |||
135 | local_irq_save(flags); | ||
136 | |||
137 | tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL); | ||
138 | 137 | ||
138 | /* Set the Gate high, disable speaker */ | ||
139 | outb((inb(0x61) & ~0x02) | 0x01, 0x61); | 139 | outb((inb(0x61) & ~0x02) | 0x01, 0x61); |
140 | 140 | ||
141 | /* | ||
142 | * Setup CTC channel 2* for mode 0, (interrupt on terminal | ||
143 | * count mode), binary count. Set the latch register to 50ms | ||
144 | * (LSB then MSB) to begin countdown. | ||
145 | */ | ||
141 | outb(0xb0, 0x43); | 146 | outb(0xb0, 0x43); |
142 | outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42); | 147 | outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42); |
143 | outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42); | 148 | outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42); |
144 | tr1 = get_cycles(); | ||
145 | while ((inb(0x61) & 0x20) == 0); | ||
146 | tr2 = get_cycles(); | ||
147 | 149 | ||
148 | tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL); | 150 | tsc = t1 = t2 = get_cycles(); |
149 | 151 | ||
150 | local_irq_restore(flags); | 152 | pitcnt = 0; |
153 | tscmax = 0; | ||
154 | tscmin = ULONG_MAX; | ||
155 | while ((inb(0x61) & 0x20) == 0) { | ||
156 | t2 = get_cycles(); | ||
157 | delta = t2 - tsc; | ||
158 | tsc = t2; | ||
159 | if ((unsigned long) delta < tscmin) | ||
160 | tscmin = (unsigned int) delta; | ||
161 | if ((unsigned long) delta > tscmax) | ||
162 | tscmax = (unsigned int) delta; | ||
163 | pitcnt++; | ||
164 | } | ||
151 | 165 | ||
152 | /* | 166 | /* |
153 | * Preset the result with the raw and inaccurate PIT | 167 | * Sanity checks: |
154 | * calibration value | 168 | * |
169 | * If we were not able to read the PIT more than 5000 | ||
170 | * times, then we have been hit by a massive SMI | ||
171 | * | ||
172 | * If the maximum is 10 times larger than the minimum, | ||
173 | * then we got hit by an SMI as well. | ||
155 | */ | 174 | */ |
156 | delta = (tr2 - tr1); | 175 | if (pitcnt < 5000 || tscmax > 10 * tscmin) |
176 | return ULONG_MAX; | ||
177 | |||
178 | /* Calculate the PIT value */ | ||
179 | delta = t2 - t1; | ||
157 | do_div(delta, 50); | 180 | do_div(delta, 50); |
158 | tsc_khz_val = delta; | 181 | return delta; |
182 | } | ||
183 | |||
184 | |||
185 | /** | ||
186 | * native_calibrate_tsc - calibrate the tsc on boot | ||
187 | */ | ||
188 | unsigned long native_calibrate_tsc(void) | ||
189 | { | ||
190 | u64 tsc1, tsc2, delta, pm1, pm2, hpet1, hpet2; | ||
191 | unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX; | ||
192 | unsigned long flags; | ||
193 | int hpet = is_hpet_enabled(), i; | ||
194 | |||
195 | /* | ||
196 | * Run 5 calibration loops to get the lowest frequency value | ||
197 | * (the best estimate). We use two different calibration modes | ||
198 | * here: | ||
199 | * | ||
200 | * 1) PIT loop. We set the PIT Channel 2 to oneshot mode and | ||
201 | * load a timeout of 50ms. We read the time right after we | ||
202 | * started the timer and wait until the PIT count down reaches | ||
203 | * zero. In each wait loop iteration we read the TSC and check | ||
204 | * the delta to the previous read. We keep track of the min | ||
205 | * and max values of that delta. The delta is mostly defined | ||
206 | * by the IO time of the PIT access, so we can detect when a | ||
207 | * SMI/SMM disturbance happend between the two reads. If the | ||
208 | * maximum time is significantly larger than the minimum time, | ||
209 | * then we discard the result and have another try. | ||
210 | * | ||
211 | * 2) Reference counter. If available we use the HPET or the | ||
212 | * PMTIMER as a reference to check the sanity of that value. | ||
213 | * We use separate TSC readouts and check inside of the | ||
214 | * reference read for a SMI/SMM disturbance. We dicard | ||
215 | * disturbed values here as well. We do that around the PIT | ||
216 | * calibration delay loop as we have to wait for a certain | ||
217 | * amount of time anyway. | ||
218 | */ | ||
219 | for (i = 0; i < 5; i++) { | ||
220 | unsigned long tsc_pit_khz; | ||
221 | |||
222 | /* | ||
223 | * Read the start value and the reference count of | ||
224 | * hpet/pmtimer when available. Then do the PIT | ||
225 | * calibration, which will take at least 50ms, and | ||
226 | * read the end value. | ||
227 | */ | ||
228 | local_irq_save(flags); | ||
229 | tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL); | ||
230 | tsc_pit_khz = pit_calibrate_tsc(); | ||
231 | tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL); | ||
232 | local_irq_restore(flags); | ||
233 | |||
234 | /* Pick the lowest PIT TSC calibration so far */ | ||
235 | tsc_pit_min = min(tsc_pit_min, tsc_pit_khz); | ||
236 | |||
237 | /* hpet or pmtimer available ? */ | ||
238 | if (!hpet && !pm1 && !pm2) | ||
239 | continue; | ||
240 | |||
241 | /* Check, whether the sampling was disturbed by an SMI */ | ||
242 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) | ||
243 | continue; | ||
244 | |||
245 | tsc2 = (tsc2 - tsc1) * 1000000LL; | ||
246 | |||
247 | if (hpet) { | ||
248 | if (hpet2 < hpet1) | ||
249 | hpet2 += 0x100000000ULL; | ||
250 | hpet2 -= hpet1; | ||
251 | tsc1 = ((u64)hpet2 * hpet_readl(HPET_PERIOD)); | ||
252 | do_div(tsc1, 1000000); | ||
253 | } else { | ||
254 | if (pm2 < pm1) | ||
255 | pm2 += (u64)ACPI_PM_OVRRUN; | ||
256 | pm2 -= pm1; | ||
257 | tsc1 = pm2 * 1000000000LL; | ||
258 | do_div(tsc1, PMTMR_TICKS_PER_SEC); | ||
259 | } | ||
260 | |||
261 | do_div(tsc2, tsc1); | ||
262 | tsc_ref_min = min(tsc_ref_min, (unsigned long) tsc2); | ||
263 | } | ||
264 | |||
265 | /* | ||
266 | * Now check the results. | ||
267 | */ | ||
268 | if (tsc_pit_min == ULONG_MAX) { | ||
269 | /* PIT gave no useful value */ | ||
270 | printk(KERN_WARNING "TSC: Unable to calibrate against PIT\n"); | ||
271 | |||
272 | /* We don't have an alternative source, disable TSC */ | ||
273 | if (!hpet && !pm1 && !pm2) { | ||
274 | printk("TSC: No reference (HPET/PMTIMER) available\n"); | ||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | /* The alternative source failed as well, disable TSC */ | ||
279 | if (tsc_ref_min == ULONG_MAX) { | ||
280 | printk(KERN_WARNING "TSC: HPET/PMTIMER calibration " | ||
281 | "failed due to SMI disturbance.\n"); | ||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | /* Use the alternative source */ | ||
286 | printk(KERN_INFO "TSC: using %s reference calibration\n", | ||
287 | hpet ? "HPET" : "PMTIMER"); | ||
288 | |||
289 | return tsc_ref_min; | ||
290 | } | ||
159 | 291 | ||
160 | /* hpet or pmtimer available ? */ | 292 | /* We don't have an alternative source, use the PIT calibration value */ |
161 | if (!hpet && !pm1 && !pm2) { | 293 | if (!hpet && !pm1 && !pm2) { |
162 | printk(KERN_INFO "TSC calibrated against PIT\n"); | 294 | printk(KERN_INFO "TSC: Using PIT calibration value\n"); |
163 | goto out; | 295 | return tsc_pit_min; |
164 | } | 296 | } |
165 | 297 | ||
166 | /* Check, whether the sampling was disturbed by an SMI */ | 298 | /* The alternative source failed, use the PIT calibration value */ |
167 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) { | 299 | if (tsc_ref_min == ULONG_MAX) { |
168 | printk(KERN_WARNING "TSC calibration disturbed by SMI, " | 300 | printk(KERN_WARNING "TSC: HPET/PMTIMER calibration failed due " |
169 | "using PIT calibration result\n"); | 301 | "to SMI disturbance. Using PIT calibration\n"); |
170 | goto out; | 302 | return tsc_pit_min; |
171 | } | 303 | } |
172 | 304 | ||
173 | tsc2 = (tsc2 - tsc1) * 1000000LL; | 305 | /* Check the reference deviation */ |
174 | 306 | delta = ((u64) tsc_pit_min) * 100; | |
175 | if (hpet) { | 307 | do_div(delta, tsc_ref_min); |
176 | printk(KERN_INFO "TSC calibrated against HPET\n"); | 308 | |
177 | if (hpet2 < hpet1) | 309 | /* |
178 | hpet2 += 0x100000000ULL; | 310 | * If both calibration results are inside a 5% window, the we |
179 | hpet2 -= hpet1; | 311 | * use the lower frequency of those as it is probably the |
180 | tsc1 = ((u64)hpet2 * hpet_readl(HPET_PERIOD)); | 312 | * closest estimate. |
181 | do_div(tsc1, 1000000); | 313 | */ |
182 | } else { | 314 | if (delta >= 95 && delta <= 105) { |
183 | printk(KERN_INFO "TSC calibrated against PM_TIMER\n"); | 315 | printk(KERN_INFO "TSC: PIT calibration confirmed by %s.\n", |
184 | if (pm2 < pm1) | 316 | hpet ? "HPET" : "PMTIMER"); |
185 | pm2 += (u64)ACPI_PM_OVRRUN; | 317 | printk(KERN_INFO "TSC: using %s calibration value\n", |
186 | pm2 -= pm1; | 318 | tsc_pit_min <= tsc_ref_min ? "PIT" : |
187 | tsc1 = pm2 * 1000000000LL; | 319 | hpet ? "HPET" : "PMTIMER"); |
188 | do_div(tsc1, PMTMR_TICKS_PER_SEC); | 320 | return tsc_pit_min <= tsc_ref_min ? tsc_pit_min : tsc_ref_min; |
189 | } | 321 | } |
190 | 322 | ||
191 | do_div(tsc2, tsc1); | 323 | printk(KERN_WARNING "TSC: PIT calibration deviates from %s: %lu %lu.\n", |
192 | tsc_khz_val = tsc2; | 324 | hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min); |
193 | 325 | ||
194 | out: | 326 | /* |
195 | return tsc_khz_val; | 327 | * The calibration values differ too much. In doubt, we use |
328 | * the PIT value as we know that there are PMTIMERs around | ||
329 | * running at double speed. | ||
330 | */ | ||
331 | printk(KERN_INFO "TSC: Using PIT calibration value\n"); | ||
332 | return tsc_pit_min; | ||
196 | } | 333 | } |
197 | 334 | ||
198 | |||
199 | #ifdef CONFIG_X86_32 | 335 | #ifdef CONFIG_X86_32 |
200 | /* Only called from the Powernow K7 cpu freq driver */ | 336 | /* Only called from the Powernow K7 cpu freq driver */ |
201 | int recalibrate_cpu_khz(void) | 337 | int recalibrate_cpu_khz(void) |
@@ -314,7 +450,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
314 | mark_tsc_unstable("cpufreq changes"); | 450 | mark_tsc_unstable("cpufreq changes"); |
315 | } | 451 | } |
316 | 452 | ||
317 | set_cyc2ns_scale(tsc_khz_ref, freq->cpu); | 453 | set_cyc2ns_scale(tsc_khz, freq->cpu); |
318 | 454 | ||
319 | return 0; | 455 | return 0; |
320 | } | 456 | } |
@@ -325,6 +461,10 @@ static struct notifier_block time_cpufreq_notifier_block = { | |||
325 | 461 | ||
326 | static int __init cpufreq_tsc(void) | 462 | static int __init cpufreq_tsc(void) |
327 | { | 463 | { |
464 | if (!cpu_has_tsc) | ||
465 | return 0; | ||
466 | if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) | ||
467 | return 0; | ||
328 | cpufreq_register_notifier(&time_cpufreq_notifier_block, | 468 | cpufreq_register_notifier(&time_cpufreq_notifier_block, |
329 | CPUFREQ_TRANSITION_NOTIFIER); | 469 | CPUFREQ_TRANSITION_NOTIFIER); |
330 | return 0; | 470 | return 0; |
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c index 0577825cf89b..9ffb01c31c40 100644 --- a/arch/x86/kernel/tsc_sync.c +++ b/arch/x86/kernel/tsc_sync.c | |||
@@ -88,11 +88,9 @@ static __cpuinit void check_tsc_warp(void) | |||
88 | __raw_spin_unlock(&sync_lock); | 88 | __raw_spin_unlock(&sync_lock); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | if (!(now-start)) { | 91 | WARN(!(now-start), |
92 | printk("Warning: zero tsc calibration delta: %Ld [max: %Ld]\n", | 92 | "Warning: zero tsc calibration delta: %Ld [max: %Ld]\n", |
93 | now-start, end-start); | 93 | now-start, end-start); |
94 | WARN_ON(1); | ||
95 | } | ||
96 | } | 94 | } |
97 | 95 | ||
98 | /* | 96 | /* |
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c index 41e01b145c48..594ef47f0a63 100644 --- a/arch/x86/kernel/visws_quirks.c +++ b/arch/x86/kernel/visws_quirks.c | |||
@@ -184,8 +184,6 @@ static int __init visws_get_smp_config(unsigned int early) | |||
184 | return 1; | 184 | return 1; |
185 | } | 185 | } |
186 | 186 | ||
187 | extern unsigned int __cpuinitdata maxcpus; | ||
188 | |||
189 | /* | 187 | /* |
190 | * The Visual Workstation is Intel MP compliant in the hardware | 188 | * The Visual Workstation is Intel MP compliant in the hardware |
191 | * sense, but it doesn't have a BIOS(-configuration table). | 189 | * sense, but it doesn't have a BIOS(-configuration table). |
@@ -244,8 +242,8 @@ static int __init visws_find_smp_config(unsigned int reserve) | |||
244 | ncpus = CO_CPU_MAX; | 242 | ncpus = CO_CPU_MAX; |
245 | } | 243 | } |
246 | 244 | ||
247 | if (ncpus > maxcpus) | 245 | if (ncpus > setup_max_cpus) |
248 | ncpus = maxcpus; | 246 | ncpus = setup_max_cpus; |
249 | 247 | ||
250 | #ifdef CONFIG_X86_LOCAL_APIC | 248 | #ifdef CONFIG_X86_LOCAL_APIC |
251 | smp_found_config = 1; | 249 | smp_found_config = 1; |
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c index 38f566fa27d2..4eeb5cf9720d 100644 --- a/arch/x86/kernel/vm86_32.c +++ b/arch/x86/kernel/vm86_32.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
47 | #include <asm/tlbflush.h> | 47 | #include <asm/tlbflush.h> |
48 | #include <asm/irq.h> | 48 | #include <asm/irq.h> |
49 | #include <asm/syscalls.h> | ||
49 | 50 | ||
50 | /* | 51 | /* |
51 | * Known problems: | 52 | * Known problems: |
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c index 0a1b1a9d922d..61531d5c9507 100644 --- a/arch/x86/kernel/vmi_32.c +++ b/arch/x86/kernel/vmi_32.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <asm/timer.h> | 37 | #include <asm/timer.h> |
38 | #include <asm/vmi_time.h> | 38 | #include <asm/vmi_time.h> |
39 | #include <asm/kmap_types.h> | 39 | #include <asm/kmap_types.h> |
40 | #include <asm/setup.h> | ||
40 | 41 | ||
41 | /* Convenient for calling VMI functions indirectly in the ROM */ | 42 | /* Convenient for calling VMI functions indirectly in the ROM */ |
42 | typedef u32 __attribute__((regparm(1))) (VROMFUNC)(void); | 43 | typedef u32 __attribute__((regparm(1))) (VROMFUNC)(void); |
@@ -683,7 +684,7 @@ void vmi_bringup(void) | |||
683 | { | 684 | { |
684 | /* We must establish the lowmem mapping for MMU ops to work */ | 685 | /* We must establish the lowmem mapping for MMU ops to work */ |
685 | if (vmi_ops.set_linear_mapping) | 686 | if (vmi_ops.set_linear_mapping) |
686 | vmi_ops.set_linear_mapping(0, (void *)__PAGE_OFFSET, max_low_pfn, 0); | 687 | vmi_ops.set_linear_mapping(0, (void *)__PAGE_OFFSET, MAXMEM_PFN, 0); |
687 | } | 688 | } |
688 | 689 | ||
689 | /* | 690 | /* |
@@ -904,8 +905,8 @@ static inline int __init activate_vmi(void) | |||
904 | #endif | 905 | #endif |
905 | 906 | ||
906 | #ifdef CONFIG_X86_LOCAL_APIC | 907 | #ifdef CONFIG_X86_LOCAL_APIC |
907 | para_fill(pv_apic_ops.apic_read, APICRead); | 908 | para_fill(apic_ops->read, APICRead); |
908 | para_fill(pv_apic_ops.apic_write, APICWrite); | 909 | para_fill(apic_ops->write, APICWrite); |
909 | #endif | 910 | #endif |
910 | 911 | ||
911 | /* | 912 | /* |
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S index cdb2363697d2..a9b8560adbc2 100644 --- a/arch/x86/kernel/vmlinux_32.lds.S +++ b/arch/x86/kernel/vmlinux_32.lds.S | |||
@@ -140,10 +140,10 @@ SECTIONS | |||
140 | *(.con_initcall.init) | 140 | *(.con_initcall.init) |
141 | __con_initcall_end = .; | 141 | __con_initcall_end = .; |
142 | } | 142 | } |
143 | .x86cpuvendor.init : AT(ADDR(.x86cpuvendor.init) - LOAD_OFFSET) { | 143 | .x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) { |
144 | __x86cpuvendor_start = .; | 144 | __x86_cpu_dev_start = .; |
145 | *(.x86cpuvendor.init) | 145 | *(.x86_cpu_dev.init) |
146 | __x86cpuvendor_end = .; | 146 | __x86_cpu_dev_end = .; |
147 | } | 147 | } |
148 | SECURITY_INIT | 148 | SECURITY_INIT |
149 | . = ALIGN(4); | 149 | . = ALIGN(4); |
@@ -180,6 +180,7 @@ SECTIONS | |||
180 | . = ALIGN(PAGE_SIZE); | 180 | . = ALIGN(PAGE_SIZE); |
181 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { | 181 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { |
182 | __per_cpu_start = .; | 182 | __per_cpu_start = .; |
183 | *(.data.percpu.page_aligned) | ||
183 | *(.data.percpu) | 184 | *(.data.percpu) |
184 | *(.data.percpu.shared_aligned) | 185 | *(.data.percpu.shared_aligned) |
185 | __per_cpu_end = .; | 186 | __per_cpu_end = .; |
@@ -209,3 +210,11 @@ SECTIONS | |||
209 | 210 | ||
210 | DWARF_DEBUG | 211 | DWARF_DEBUG |
211 | } | 212 | } |
213 | |||
214 | #ifdef CONFIG_KEXEC | ||
215 | /* Link time checks */ | ||
216 | #include <asm/kexec.h> | ||
217 | |||
218 | ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE, | ||
219 | "kexec control code size is too big") | ||
220 | #endif | ||
diff --git a/arch/x86/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S index 63e5c1a22e88..201e81a91a95 100644 --- a/arch/x86/kernel/vmlinux_64.lds.S +++ b/arch/x86/kernel/vmlinux_64.lds.S | |||
@@ -168,13 +168,12 @@ SECTIONS | |||
168 | *(.con_initcall.init) | 168 | *(.con_initcall.init) |
169 | } | 169 | } |
170 | __con_initcall_end = .; | 170 | __con_initcall_end = .; |
171 | . = ALIGN(16); | 171 | __x86_cpu_dev_start = .; |
172 | __x86cpuvendor_start = .; | 172 | .x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) { |
173 | .x86cpuvendor.init : AT(ADDR(.x86cpuvendor.init) - LOAD_OFFSET) { | 173 | *(.x86_cpu_dev.init) |
174 | *(.x86cpuvendor.init) | ||
175 | } | 174 | } |
176 | __x86cpuvendor_end = .; | ||
177 | SECURITY_INIT | 175 | SECURITY_INIT |
176 | __x86_cpu_dev_end = .; | ||
178 | 177 | ||
179 | . = ALIGN(8); | 178 | . = ALIGN(8); |
180 | .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) { | 179 | .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) { |
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c new file mode 100644 index 000000000000..07713d64debe --- /dev/null +++ b/arch/x86/kernel/xsave.c | |||
@@ -0,0 +1,316 @@ | |||
1 | /* | ||
2 | * xsave/xrstor support. | ||
3 | * | ||
4 | * Author: Suresh Siddha <suresh.b.siddha@intel.com> | ||
5 | */ | ||
6 | #include <linux/bootmem.h> | ||
7 | #include <linux/compat.h> | ||
8 | #include <asm/i387.h> | ||
9 | #ifdef CONFIG_IA32_EMULATION | ||
10 | #include <asm/sigcontext32.h> | ||
11 | #endif | ||
12 | #include <asm/xcr.h> | ||
13 | |||
14 | /* | ||
15 | * Supported feature mask by the CPU and the kernel. | ||
16 | */ | ||
17 | u64 pcntxt_mask; | ||
18 | |||
19 | struct _fpx_sw_bytes fx_sw_reserved; | ||
20 | #ifdef CONFIG_IA32_EMULATION | ||
21 | struct _fpx_sw_bytes fx_sw_reserved_ia32; | ||
22 | #endif | ||
23 | |||
24 | /* | ||
25 | * Check for the presence of extended state information in the | ||
26 | * user fpstate pointer in the sigcontext. | ||
27 | */ | ||
28 | int check_for_xstate(struct i387_fxsave_struct __user *buf, | ||
29 | void __user *fpstate, | ||
30 | struct _fpx_sw_bytes *fx_sw_user) | ||
31 | { | ||
32 | int min_xstate_size = sizeof(struct i387_fxsave_struct) + | ||
33 | sizeof(struct xsave_hdr_struct); | ||
34 | unsigned int magic2; | ||
35 | int err; | ||
36 | |||
37 | err = __copy_from_user(fx_sw_user, &buf->sw_reserved[0], | ||
38 | sizeof(struct _fpx_sw_bytes)); | ||
39 | |||
40 | if (err) | ||
41 | return err; | ||
42 | |||
43 | /* | ||
44 | * First Magic check failed. | ||
45 | */ | ||
46 | if (fx_sw_user->magic1 != FP_XSTATE_MAGIC1) | ||
47 | return -1; | ||
48 | |||
49 | /* | ||
50 | * Check for error scenarios. | ||
51 | */ | ||
52 | if (fx_sw_user->xstate_size < min_xstate_size || | ||
53 | fx_sw_user->xstate_size > xstate_size || | ||
54 | fx_sw_user->xstate_size > fx_sw_user->extended_size) | ||
55 | return -1; | ||
56 | |||
57 | err = __get_user(magic2, (__u32 *) (((void *)fpstate) + | ||
58 | fx_sw_user->extended_size - | ||
59 | FP_XSTATE_MAGIC2_SIZE)); | ||
60 | /* | ||
61 | * Check for the presence of second magic word at the end of memory | ||
62 | * layout. This detects the case where the user just copied the legacy | ||
63 | * fpstate layout with out copying the extended state information | ||
64 | * in the memory layout. | ||
65 | */ | ||
66 | if (err || magic2 != FP_XSTATE_MAGIC2) | ||
67 | return -1; | ||
68 | |||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | #ifdef CONFIG_X86_64 | ||
73 | /* | ||
74 | * Signal frame handlers. | ||
75 | */ | ||
76 | |||
77 | int save_i387_xstate(void __user *buf) | ||
78 | { | ||
79 | struct task_struct *tsk = current; | ||
80 | int err = 0; | ||
81 | |||
82 | if (!access_ok(VERIFY_WRITE, buf, sig_xstate_size)) | ||
83 | return -EACCES; | ||
84 | |||
85 | BUG_ON(sig_xstate_size < xstate_size); | ||
86 | |||
87 | if ((unsigned long)buf % 64) | ||
88 | printk("save_i387_xstate: bad fpstate %p\n", buf); | ||
89 | |||
90 | if (!used_math()) | ||
91 | return 0; | ||
92 | clear_used_math(); /* trigger finit */ | ||
93 | if (task_thread_info(tsk)->status & TS_USEDFPU) { | ||
94 | /* | ||
95 | * Start with clearing the user buffer. This will present a | ||
96 | * clean context for the bytes not touched by the fxsave/xsave. | ||
97 | */ | ||
98 | __clear_user(buf, sig_xstate_size); | ||
99 | |||
100 | if (task_thread_info(tsk)->status & TS_XSAVE) | ||
101 | err = xsave_user(buf); | ||
102 | else | ||
103 | err = fxsave_user(buf); | ||
104 | |||
105 | if (err) | ||
106 | return err; | ||
107 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
108 | stts(); | ||
109 | } else { | ||
110 | if (__copy_to_user(buf, &tsk->thread.xstate->fxsave, | ||
111 | xstate_size)) | ||
112 | return -1; | ||
113 | } | ||
114 | |||
115 | if (task_thread_info(tsk)->status & TS_XSAVE) { | ||
116 | struct _fpstate __user *fx = buf; | ||
117 | |||
118 | err = __copy_to_user(&fx->sw_reserved, &fx_sw_reserved, | ||
119 | sizeof(struct _fpx_sw_bytes)); | ||
120 | |||
121 | err |= __put_user(FP_XSTATE_MAGIC2, | ||
122 | (__u32 __user *) (buf + sig_xstate_size | ||
123 | - FP_XSTATE_MAGIC2_SIZE)); | ||
124 | } | ||
125 | |||
126 | return 1; | ||
127 | } | ||
128 | |||
129 | /* | ||
130 | * Restore the extended state if present. Otherwise, restore the FP/SSE | ||
131 | * state. | ||
132 | */ | ||
133 | int restore_user_xstate(void __user *buf) | ||
134 | { | ||
135 | struct _fpx_sw_bytes fx_sw_user; | ||
136 | u64 mask; | ||
137 | int err; | ||
138 | |||
139 | if (((unsigned long)buf % 64) || | ||
140 | check_for_xstate(buf, buf, &fx_sw_user)) | ||
141 | goto fx_only; | ||
142 | |||
143 | mask = fx_sw_user.xstate_bv; | ||
144 | |||
145 | /* | ||
146 | * restore the state passed by the user. | ||
147 | */ | ||
148 | err = xrestore_user(buf, mask); | ||
149 | if (err) | ||
150 | return err; | ||
151 | |||
152 | /* | ||
153 | * init the state skipped by the user. | ||
154 | */ | ||
155 | mask = pcntxt_mask & ~mask; | ||
156 | |||
157 | xrstor_state(init_xstate_buf, mask); | ||
158 | |||
159 | return 0; | ||
160 | |||
161 | fx_only: | ||
162 | /* | ||
163 | * couldn't find the extended state information in the | ||
164 | * memory layout. Restore just the FP/SSE and init all | ||
165 | * the other extended state. | ||
166 | */ | ||
167 | xrstor_state(init_xstate_buf, pcntxt_mask & ~XSTATE_FPSSE); | ||
168 | return fxrstor_checking((__force struct i387_fxsave_struct *)buf); | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * This restores directly out of user space. Exceptions are handled. | ||
173 | */ | ||
174 | int restore_i387_xstate(void __user *buf) | ||
175 | { | ||
176 | struct task_struct *tsk = current; | ||
177 | int err = 0; | ||
178 | |||
179 | if (!buf) { | ||
180 | if (used_math()) | ||
181 | goto clear; | ||
182 | return 0; | ||
183 | } else | ||
184 | if (!access_ok(VERIFY_READ, buf, sig_xstate_size)) | ||
185 | return -EACCES; | ||
186 | |||
187 | if (!used_math()) { | ||
188 | err = init_fpu(tsk); | ||
189 | if (err) | ||
190 | return err; | ||
191 | } | ||
192 | |||
193 | if (!(task_thread_info(current)->status & TS_USEDFPU)) { | ||
194 | clts(); | ||
195 | task_thread_info(current)->status |= TS_USEDFPU; | ||
196 | } | ||
197 | if (task_thread_info(tsk)->status & TS_XSAVE) | ||
198 | err = restore_user_xstate(buf); | ||
199 | else | ||
200 | err = fxrstor_checking((__force struct i387_fxsave_struct *) | ||
201 | buf); | ||
202 | if (unlikely(err)) { | ||
203 | /* | ||
204 | * Encountered an error while doing the restore from the | ||
205 | * user buffer, clear the fpu state. | ||
206 | */ | ||
207 | clear: | ||
208 | clear_fpu(tsk); | ||
209 | clear_used_math(); | ||
210 | } | ||
211 | return err; | ||
212 | } | ||
213 | #endif | ||
214 | |||
215 | /* | ||
216 | * Prepare the SW reserved portion of the fxsave memory layout, indicating | ||
217 | * the presence of the extended state information in the memory layout | ||
218 | * pointed by the fpstate pointer in the sigcontext. | ||
219 | * This will be saved when ever the FP and extended state context is | ||
220 | * saved on the user stack during the signal handler delivery to the user. | ||
221 | */ | ||
222 | void prepare_fx_sw_frame(void) | ||
223 | { | ||
224 | int size_extended = (xstate_size - sizeof(struct i387_fxsave_struct)) + | ||
225 | FP_XSTATE_MAGIC2_SIZE; | ||
226 | |||
227 | sig_xstate_size = sizeof(struct _fpstate) + size_extended; | ||
228 | |||
229 | #ifdef CONFIG_IA32_EMULATION | ||
230 | sig_xstate_ia32_size = sizeof(struct _fpstate_ia32) + size_extended; | ||
231 | #endif | ||
232 | |||
233 | memset(&fx_sw_reserved, 0, sizeof(fx_sw_reserved)); | ||
234 | |||
235 | fx_sw_reserved.magic1 = FP_XSTATE_MAGIC1; | ||
236 | fx_sw_reserved.extended_size = sig_xstate_size; | ||
237 | fx_sw_reserved.xstate_bv = pcntxt_mask; | ||
238 | fx_sw_reserved.xstate_size = xstate_size; | ||
239 | #ifdef CONFIG_IA32_EMULATION | ||
240 | memcpy(&fx_sw_reserved_ia32, &fx_sw_reserved, | ||
241 | sizeof(struct _fpx_sw_bytes)); | ||
242 | fx_sw_reserved_ia32.extended_size = sig_xstate_ia32_size; | ||
243 | #endif | ||
244 | } | ||
245 | |||
246 | /* | ||
247 | * Represents init state for the supported extended state. | ||
248 | */ | ||
249 | struct xsave_struct *init_xstate_buf; | ||
250 | |||
251 | #ifdef CONFIG_X86_64 | ||
252 | unsigned int sig_xstate_size = sizeof(struct _fpstate); | ||
253 | #endif | ||
254 | |||
255 | /* | ||
256 | * Enable the extended processor state save/restore feature | ||
257 | */ | ||
258 | void __cpuinit xsave_init(void) | ||
259 | { | ||
260 | if (!cpu_has_xsave) | ||
261 | return; | ||
262 | |||
263 | set_in_cr4(X86_CR4_OSXSAVE); | ||
264 | |||
265 | /* | ||
266 | * Enable all the features that the HW is capable of | ||
267 | * and the Linux kernel is aware of. | ||
268 | */ | ||
269 | xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask); | ||
270 | } | ||
271 | |||
272 | /* | ||
273 | * setup the xstate image representing the init state | ||
274 | */ | ||
275 | void setup_xstate_init(void) | ||
276 | { | ||
277 | init_xstate_buf = alloc_bootmem(xstate_size); | ||
278 | init_xstate_buf->i387.mxcsr = MXCSR_DEFAULT; | ||
279 | } | ||
280 | |||
281 | /* | ||
282 | * Enable and initialize the xsave feature. | ||
283 | */ | ||
284 | void __init xsave_cntxt_init(void) | ||
285 | { | ||
286 | unsigned int eax, ebx, ecx, edx; | ||
287 | |||
288 | cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); | ||
289 | pcntxt_mask = eax + ((u64)edx << 32); | ||
290 | |||
291 | if ((pcntxt_mask & XSTATE_FPSSE) != XSTATE_FPSSE) { | ||
292 | printk(KERN_ERR "FP/SSE not shown under xsave features 0x%llx\n", | ||
293 | pcntxt_mask); | ||
294 | BUG(); | ||
295 | } | ||
296 | |||
297 | /* | ||
298 | * for now OS knows only about FP/SSE | ||
299 | */ | ||
300 | pcntxt_mask = pcntxt_mask & XCNTXT_MASK; | ||
301 | xsave_init(); | ||
302 | |||
303 | /* | ||
304 | * Recompute the context size for enabled features | ||
305 | */ | ||
306 | cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); | ||
307 | xstate_size = ebx; | ||
308 | |||
309 | prepare_fx_sw_frame(); | ||
310 | |||
311 | setup_xstate_init(); | ||
312 | |||
313 | printk(KERN_INFO "xsave/xrstor: enabled xstate_bv 0x%llx, " | ||
314 | "cntxt size 0x%x\n", | ||
315 | pcntxt_mask, xstate_size); | ||
316 | } | ||
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index 8d45fabc5f3b..ce3251ce5504 100644 --- a/arch/x86/kvm/Kconfig +++ b/arch/x86/kvm/Kconfig | |||
@@ -21,6 +21,7 @@ config KVM | |||
21 | tristate "Kernel-based Virtual Machine (KVM) support" | 21 | tristate "Kernel-based Virtual Machine (KVM) support" |
22 | depends on HAVE_KVM | 22 | depends on HAVE_KVM |
23 | select PREEMPT_NOTIFIERS | 23 | select PREEMPT_NOTIFIERS |
24 | select MMU_NOTIFIER | ||
24 | select ANON_INODES | 25 | select ANON_INODES |
25 | ---help--- | 26 | ---help--- |
26 | Support hosting fully virtualized guest machines using hardware | 27 | Support hosting fully virtualized guest machines using hardware |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b0e4ddca6c18..0bfe2bd305eb 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -653,6 +653,84 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn) | |||
653 | account_shadowed(kvm, gfn); | 653 | account_shadowed(kvm, gfn); |
654 | } | 654 | } |
655 | 655 | ||
656 | static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp) | ||
657 | { | ||
658 | u64 *spte; | ||
659 | int need_tlb_flush = 0; | ||
660 | |||
661 | while ((spte = rmap_next(kvm, rmapp, NULL))) { | ||
662 | BUG_ON(!(*spte & PT_PRESENT_MASK)); | ||
663 | rmap_printk("kvm_rmap_unmap_hva: spte %p %llx\n", spte, *spte); | ||
664 | rmap_remove(kvm, spte); | ||
665 | set_shadow_pte(spte, shadow_trap_nonpresent_pte); | ||
666 | need_tlb_flush = 1; | ||
667 | } | ||
668 | return need_tlb_flush; | ||
669 | } | ||
670 | |||
671 | static int kvm_handle_hva(struct kvm *kvm, unsigned long hva, | ||
672 | int (*handler)(struct kvm *kvm, unsigned long *rmapp)) | ||
673 | { | ||
674 | int i; | ||
675 | int retval = 0; | ||
676 | |||
677 | /* | ||
678 | * If mmap_sem isn't taken, we can look the memslots with only | ||
679 | * the mmu_lock by skipping over the slots with userspace_addr == 0. | ||
680 | */ | ||
681 | for (i = 0; i < kvm->nmemslots; i++) { | ||
682 | struct kvm_memory_slot *memslot = &kvm->memslots[i]; | ||
683 | unsigned long start = memslot->userspace_addr; | ||
684 | unsigned long end; | ||
685 | |||
686 | /* mmu_lock protects userspace_addr */ | ||
687 | if (!start) | ||
688 | continue; | ||
689 | |||
690 | end = start + (memslot->npages << PAGE_SHIFT); | ||
691 | if (hva >= start && hva < end) { | ||
692 | gfn_t gfn_offset = (hva - start) >> PAGE_SHIFT; | ||
693 | retval |= handler(kvm, &memslot->rmap[gfn_offset]); | ||
694 | retval |= handler(kvm, | ||
695 | &memslot->lpage_info[ | ||
696 | gfn_offset / | ||
697 | KVM_PAGES_PER_HPAGE].rmap_pde); | ||
698 | } | ||
699 | } | ||
700 | |||
701 | return retval; | ||
702 | } | ||
703 | |||
704 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) | ||
705 | { | ||
706 | return kvm_handle_hva(kvm, hva, kvm_unmap_rmapp); | ||
707 | } | ||
708 | |||
709 | static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp) | ||
710 | { | ||
711 | u64 *spte; | ||
712 | int young = 0; | ||
713 | |||
714 | spte = rmap_next(kvm, rmapp, NULL); | ||
715 | while (spte) { | ||
716 | int _young; | ||
717 | u64 _spte = *spte; | ||
718 | BUG_ON(!(_spte & PT_PRESENT_MASK)); | ||
719 | _young = _spte & PT_ACCESSED_MASK; | ||
720 | if (_young) { | ||
721 | young = 1; | ||
722 | clear_bit(PT_ACCESSED_SHIFT, (unsigned long *)spte); | ||
723 | } | ||
724 | spte = rmap_next(kvm, rmapp, spte); | ||
725 | } | ||
726 | return young; | ||
727 | } | ||
728 | |||
729 | int kvm_age_hva(struct kvm *kvm, unsigned long hva) | ||
730 | { | ||
731 | return kvm_handle_hva(kvm, hva, kvm_age_rmapp); | ||
732 | } | ||
733 | |||
656 | #ifdef MMU_DEBUG | 734 | #ifdef MMU_DEBUG |
657 | static int is_empty_shadow_page(u64 *spt) | 735 | static int is_empty_shadow_page(u64 *spt) |
658 | { | 736 | { |
@@ -1203,6 +1281,7 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn) | |||
1203 | int r; | 1281 | int r; |
1204 | int largepage = 0; | 1282 | int largepage = 0; |
1205 | pfn_t pfn; | 1283 | pfn_t pfn; |
1284 | unsigned long mmu_seq; | ||
1206 | 1285 | ||
1207 | down_read(¤t->mm->mmap_sem); | 1286 | down_read(¤t->mm->mmap_sem); |
1208 | if (is_largepage_backed(vcpu, gfn & ~(KVM_PAGES_PER_HPAGE-1))) { | 1287 | if (is_largepage_backed(vcpu, gfn & ~(KVM_PAGES_PER_HPAGE-1))) { |
@@ -1210,6 +1289,8 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn) | |||
1210 | largepage = 1; | 1289 | largepage = 1; |
1211 | } | 1290 | } |
1212 | 1291 | ||
1292 | mmu_seq = vcpu->kvm->mmu_notifier_seq; | ||
1293 | /* implicit mb(), we'll read before PT lock is unlocked */ | ||
1213 | pfn = gfn_to_pfn(vcpu->kvm, gfn); | 1294 | pfn = gfn_to_pfn(vcpu->kvm, gfn); |
1214 | up_read(¤t->mm->mmap_sem); | 1295 | up_read(¤t->mm->mmap_sem); |
1215 | 1296 | ||
@@ -1220,6 +1301,8 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn) | |||
1220 | } | 1301 | } |
1221 | 1302 | ||
1222 | spin_lock(&vcpu->kvm->mmu_lock); | 1303 | spin_lock(&vcpu->kvm->mmu_lock); |
1304 | if (mmu_notifier_retry(vcpu, mmu_seq)) | ||
1305 | goto out_unlock; | ||
1223 | kvm_mmu_free_some_pages(vcpu); | 1306 | kvm_mmu_free_some_pages(vcpu); |
1224 | r = __direct_map(vcpu, v, write, largepage, gfn, pfn, | 1307 | r = __direct_map(vcpu, v, write, largepage, gfn, pfn, |
1225 | PT32E_ROOT_LEVEL); | 1308 | PT32E_ROOT_LEVEL); |
@@ -1227,6 +1310,11 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn) | |||
1227 | 1310 | ||
1228 | 1311 | ||
1229 | return r; | 1312 | return r; |
1313 | |||
1314 | out_unlock: | ||
1315 | spin_unlock(&vcpu->kvm->mmu_lock); | ||
1316 | kvm_release_pfn_clean(pfn); | ||
1317 | return 0; | ||
1230 | } | 1318 | } |
1231 | 1319 | ||
1232 | 1320 | ||
@@ -1345,6 +1433,7 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, | |||
1345 | int r; | 1433 | int r; |
1346 | int largepage = 0; | 1434 | int largepage = 0; |
1347 | gfn_t gfn = gpa >> PAGE_SHIFT; | 1435 | gfn_t gfn = gpa >> PAGE_SHIFT; |
1436 | unsigned long mmu_seq; | ||
1348 | 1437 | ||
1349 | ASSERT(vcpu); | 1438 | ASSERT(vcpu); |
1350 | ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa)); | 1439 | ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa)); |
@@ -1358,6 +1447,8 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, | |||
1358 | gfn &= ~(KVM_PAGES_PER_HPAGE-1); | 1447 | gfn &= ~(KVM_PAGES_PER_HPAGE-1); |
1359 | largepage = 1; | 1448 | largepage = 1; |
1360 | } | 1449 | } |
1450 | mmu_seq = vcpu->kvm->mmu_notifier_seq; | ||
1451 | /* implicit mb(), we'll read before PT lock is unlocked */ | ||
1361 | pfn = gfn_to_pfn(vcpu->kvm, gfn); | 1452 | pfn = gfn_to_pfn(vcpu->kvm, gfn); |
1362 | up_read(¤t->mm->mmap_sem); | 1453 | up_read(¤t->mm->mmap_sem); |
1363 | if (is_error_pfn(pfn)) { | 1454 | if (is_error_pfn(pfn)) { |
@@ -1365,12 +1456,19 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, | |||
1365 | return 1; | 1456 | return 1; |
1366 | } | 1457 | } |
1367 | spin_lock(&vcpu->kvm->mmu_lock); | 1458 | spin_lock(&vcpu->kvm->mmu_lock); |
1459 | if (mmu_notifier_retry(vcpu, mmu_seq)) | ||
1460 | goto out_unlock; | ||
1368 | kvm_mmu_free_some_pages(vcpu); | 1461 | kvm_mmu_free_some_pages(vcpu); |
1369 | r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK, | 1462 | r = __direct_map(vcpu, gpa, error_code & PFERR_WRITE_MASK, |
1370 | largepage, gfn, pfn, kvm_x86_ops->get_tdp_level()); | 1463 | largepage, gfn, pfn, kvm_x86_ops->get_tdp_level()); |
1371 | spin_unlock(&vcpu->kvm->mmu_lock); | 1464 | spin_unlock(&vcpu->kvm->mmu_lock); |
1372 | 1465 | ||
1373 | return r; | 1466 | return r; |
1467 | |||
1468 | out_unlock: | ||
1469 | spin_unlock(&vcpu->kvm->mmu_lock); | ||
1470 | kvm_release_pfn_clean(pfn); | ||
1471 | return 0; | ||
1374 | } | 1472 | } |
1375 | 1473 | ||
1376 | static void nonpaging_free(struct kvm_vcpu *vcpu) | 1474 | static void nonpaging_free(struct kvm_vcpu *vcpu) |
@@ -1670,6 +1768,8 @@ static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
1670 | gfn &= ~(KVM_PAGES_PER_HPAGE-1); | 1768 | gfn &= ~(KVM_PAGES_PER_HPAGE-1); |
1671 | vcpu->arch.update_pte.largepage = 1; | 1769 | vcpu->arch.update_pte.largepage = 1; |
1672 | } | 1770 | } |
1771 | vcpu->arch.update_pte.mmu_seq = vcpu->kvm->mmu_notifier_seq; | ||
1772 | /* implicit mb(), we'll read before PT lock is unlocked */ | ||
1673 | pfn = gfn_to_pfn(vcpu->kvm, gfn); | 1773 | pfn = gfn_to_pfn(vcpu->kvm, gfn); |
1674 | up_read(¤t->mm->mmap_sem); | 1774 | up_read(¤t->mm->mmap_sem); |
1675 | 1775 | ||
@@ -1814,6 +1914,7 @@ int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva) | |||
1814 | spin_unlock(&vcpu->kvm->mmu_lock); | 1914 | spin_unlock(&vcpu->kvm->mmu_lock); |
1815 | return r; | 1915 | return r; |
1816 | } | 1916 | } |
1917 | EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page_virt); | ||
1817 | 1918 | ||
1818 | void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) | 1919 | void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) |
1819 | { | 1920 | { |
@@ -1870,6 +1971,12 @@ void kvm_enable_tdp(void) | |||
1870 | } | 1971 | } |
1871 | EXPORT_SYMBOL_GPL(kvm_enable_tdp); | 1972 | EXPORT_SYMBOL_GPL(kvm_enable_tdp); |
1872 | 1973 | ||
1974 | void kvm_disable_tdp(void) | ||
1975 | { | ||
1976 | tdp_enabled = false; | ||
1977 | } | ||
1978 | EXPORT_SYMBOL_GPL(kvm_disable_tdp); | ||
1979 | |||
1873 | static void free_mmu_pages(struct kvm_vcpu *vcpu) | 1980 | static void free_mmu_pages(struct kvm_vcpu *vcpu) |
1874 | { | 1981 | { |
1875 | struct kvm_mmu_page *sp; | 1982 | struct kvm_mmu_page *sp; |
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index 4d918220baeb..4a814bff21f2 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -263,6 +263,8 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page, | |||
263 | pfn = vcpu->arch.update_pte.pfn; | 263 | pfn = vcpu->arch.update_pte.pfn; |
264 | if (is_error_pfn(pfn)) | 264 | if (is_error_pfn(pfn)) |
265 | return; | 265 | return; |
266 | if (mmu_notifier_retry(vcpu, vcpu->arch.update_pte.mmu_seq)) | ||
267 | return; | ||
266 | kvm_get_pfn(pfn); | 268 | kvm_get_pfn(pfn); |
267 | mmu_set_spte(vcpu, spte, page->role.access, pte_access, 0, 0, | 269 | mmu_set_spte(vcpu, spte, page->role.access, pte_access, 0, 0, |
268 | gpte & PT_DIRTY_MASK, NULL, largepage, gpte_to_gfn(gpte), | 270 | gpte & PT_DIRTY_MASK, NULL, largepage, gpte_to_gfn(gpte), |
@@ -343,7 +345,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr, | |||
343 | shadow_addr = __pa(shadow_page->spt); | 345 | shadow_addr = __pa(shadow_page->spt); |
344 | shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK | 346 | shadow_pte = shadow_addr | PT_PRESENT_MASK | PT_ACCESSED_MASK |
345 | | PT_WRITABLE_MASK | PT_USER_MASK; | 347 | | PT_WRITABLE_MASK | PT_USER_MASK; |
346 | *shadow_ent = shadow_pte; | 348 | set_shadow_pte(shadow_ent, shadow_pte); |
347 | } | 349 | } |
348 | 350 | ||
349 | mmu_set_spte(vcpu, shadow_ent, access, walker->pte_access & access, | 351 | mmu_set_spte(vcpu, shadow_ent, access, walker->pte_access & access, |
@@ -380,6 +382,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
380 | int r; | 382 | int r; |
381 | pfn_t pfn; | 383 | pfn_t pfn; |
382 | int largepage = 0; | 384 | int largepage = 0; |
385 | unsigned long mmu_seq; | ||
383 | 386 | ||
384 | pgprintk("%s: addr %lx err %x\n", __func__, addr, error_code); | 387 | pgprintk("%s: addr %lx err %x\n", __func__, addr, error_code); |
385 | kvm_mmu_audit(vcpu, "pre page fault"); | 388 | kvm_mmu_audit(vcpu, "pre page fault"); |
@@ -413,6 +416,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
413 | largepage = 1; | 416 | largepage = 1; |
414 | } | 417 | } |
415 | } | 418 | } |
419 | mmu_seq = vcpu->kvm->mmu_notifier_seq; | ||
420 | /* implicit mb(), we'll read before PT lock is unlocked */ | ||
416 | pfn = gfn_to_pfn(vcpu->kvm, walker.gfn); | 421 | pfn = gfn_to_pfn(vcpu->kvm, walker.gfn); |
417 | up_read(¤t->mm->mmap_sem); | 422 | up_read(¤t->mm->mmap_sem); |
418 | 423 | ||
@@ -424,6 +429,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
424 | } | 429 | } |
425 | 430 | ||
426 | spin_lock(&vcpu->kvm->mmu_lock); | 431 | spin_lock(&vcpu->kvm->mmu_lock); |
432 | if (mmu_notifier_retry(vcpu, mmu_seq)) | ||
433 | goto out_unlock; | ||
427 | kvm_mmu_free_some_pages(vcpu); | 434 | kvm_mmu_free_some_pages(vcpu); |
428 | shadow_pte = FNAME(fetch)(vcpu, addr, &walker, user_fault, write_fault, | 435 | shadow_pte = FNAME(fetch)(vcpu, addr, &walker, user_fault, write_fault, |
429 | largepage, &write_pt, pfn); | 436 | largepage, &write_pt, pfn); |
@@ -439,6 +446,11 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, | |||
439 | spin_unlock(&vcpu->kvm->mmu_lock); | 446 | spin_unlock(&vcpu->kvm->mmu_lock); |
440 | 447 | ||
441 | return write_pt; | 448 | return write_pt; |
449 | |||
450 | out_unlock: | ||
451 | spin_unlock(&vcpu->kvm->mmu_lock); | ||
452 | kvm_release_pfn_clean(pfn); | ||
453 | return 0; | ||
442 | } | 454 | } |
443 | 455 | ||
444 | static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) | 456 | static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr) |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index b756e876dce3..e2ee264740c7 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -453,7 +453,8 @@ static __init int svm_hardware_setup(void) | |||
453 | if (npt_enabled) { | 453 | if (npt_enabled) { |
454 | printk(KERN_INFO "kvm: Nested Paging enabled\n"); | 454 | printk(KERN_INFO "kvm: Nested Paging enabled\n"); |
455 | kvm_enable_tdp(); | 455 | kvm_enable_tdp(); |
456 | } | 456 | } else |
457 | kvm_disable_tdp(); | ||
457 | 458 | ||
458 | return 0; | 459 | return 0; |
459 | 460 | ||
@@ -1007,10 +1008,13 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1007 | struct kvm *kvm = svm->vcpu.kvm; | 1008 | struct kvm *kvm = svm->vcpu.kvm; |
1008 | u64 fault_address; | 1009 | u64 fault_address; |
1009 | u32 error_code; | 1010 | u32 error_code; |
1011 | bool event_injection = false; | ||
1010 | 1012 | ||
1011 | if (!irqchip_in_kernel(kvm) && | 1013 | if (!irqchip_in_kernel(kvm) && |
1012 | is_external_interrupt(exit_int_info)) | 1014 | is_external_interrupt(exit_int_info)) { |
1015 | event_injection = true; | ||
1013 | push_irq(&svm->vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); | 1016 | push_irq(&svm->vcpu, exit_int_info & SVM_EVTINJ_VEC_MASK); |
1017 | } | ||
1014 | 1018 | ||
1015 | fault_address = svm->vmcb->control.exit_info_2; | 1019 | fault_address = svm->vmcb->control.exit_info_2; |
1016 | error_code = svm->vmcb->control.exit_info_1; | 1020 | error_code = svm->vmcb->control.exit_info_1; |
@@ -1024,6 +1028,8 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1024 | (u32)fault_address, (u32)(fault_address >> 32), | 1028 | (u32)fault_address, (u32)(fault_address >> 32), |
1025 | handler); | 1029 | handler); |
1026 | 1030 | ||
1031 | if (event_injection) | ||
1032 | kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address); | ||
1027 | return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code); | 1033 | return kvm_mmu_page_fault(&svm->vcpu, fault_address, error_code); |
1028 | } | 1034 | } |
1029 | 1035 | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 0cac63701719..2a69773e3b26 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2298,6 +2298,8 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
2298 | cr2 = vmcs_readl(EXIT_QUALIFICATION); | 2298 | cr2 = vmcs_readl(EXIT_QUALIFICATION); |
2299 | KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, | 2299 | KVMTRACE_3D(PAGE_FAULT, vcpu, error_code, (u32)cr2, |
2300 | (u32)((u64)cr2 >> 32), handler); | 2300 | (u32)((u64)cr2 >> 32), handler); |
2301 | if (vect_info & VECTORING_INFO_VALID_MASK) | ||
2302 | kvm_mmu_unprotect_page_virt(vcpu, cr2); | ||
2301 | return kvm_mmu_page_fault(vcpu, cr2, error_code); | 2303 | return kvm_mmu_page_fault(vcpu, cr2, error_code); |
2302 | } | 2304 | } |
2303 | 2305 | ||
@@ -3116,15 +3118,6 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) | |||
3116 | return ERR_PTR(-ENOMEM); | 3118 | return ERR_PTR(-ENOMEM); |
3117 | 3119 | ||
3118 | allocate_vpid(vmx); | 3120 | allocate_vpid(vmx); |
3119 | if (id == 0 && vm_need_ept()) { | ||
3120 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | ||
3121 | VMX_EPT_WRITABLE_MASK | | ||
3122 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3123 | kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, | ||
3124 | VMX_EPT_FAKE_DIRTY_MASK, 0ull, | ||
3125 | VMX_EPT_EXECUTABLE_MASK); | ||
3126 | kvm_enable_tdp(); | ||
3127 | } | ||
3128 | 3121 | ||
3129 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); | 3122 | err = kvm_vcpu_init(&vmx->vcpu, kvm, id); |
3130 | if (err) | 3123 | if (err) |
@@ -3303,8 +3296,17 @@ static int __init vmx_init(void) | |||
3303 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); | 3296 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_ESP); |
3304 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); | 3297 | vmx_disable_intercept_for_msr(vmx_msr_bitmap, MSR_IA32_SYSENTER_EIP); |
3305 | 3298 | ||
3306 | if (cpu_has_vmx_ept()) | 3299 | if (vm_need_ept()) { |
3307 | bypass_guest_pf = 0; | 3300 | bypass_guest_pf = 0; |
3301 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | ||
3302 | VMX_EPT_WRITABLE_MASK | | ||
3303 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3304 | kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, | ||
3305 | VMX_EPT_FAKE_DIRTY_MASK, 0ull, | ||
3306 | VMX_EPT_EXECUTABLE_MASK); | ||
3307 | kvm_enable_tdp(); | ||
3308 | } else | ||
3309 | kvm_disable_tdp(); | ||
3308 | 3310 | ||
3309 | if (bypass_guest_pf) | 3311 | if (bypass_guest_pf) |
3310 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); | 3312 | kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9f1cdb011cff..0d682fc6aeb3 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -883,6 +883,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
883 | case KVM_CAP_PIT: | 883 | case KVM_CAP_PIT: |
884 | case KVM_CAP_NOP_IO_DELAY: | 884 | case KVM_CAP_NOP_IO_DELAY: |
885 | case KVM_CAP_MP_STATE: | 885 | case KVM_CAP_MP_STATE: |
886 | case KVM_CAP_SYNC_MMU: | ||
886 | r = 1; | 887 | r = 1; |
887 | break; | 888 | break; |
888 | case KVM_CAP_COALESCED_MMIO: | 889 | case KVM_CAP_COALESCED_MMIO: |
@@ -1495,6 +1496,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, | |||
1495 | goto out; | 1496 | goto out; |
1496 | 1497 | ||
1497 | down_write(&kvm->slots_lock); | 1498 | down_write(&kvm->slots_lock); |
1499 | spin_lock(&kvm->mmu_lock); | ||
1498 | 1500 | ||
1499 | p = &kvm->arch.aliases[alias->slot]; | 1501 | p = &kvm->arch.aliases[alias->slot]; |
1500 | p->base_gfn = alias->guest_phys_addr >> PAGE_SHIFT; | 1502 | p->base_gfn = alias->guest_phys_addr >> PAGE_SHIFT; |
@@ -1506,6 +1508,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, | |||
1506 | break; | 1508 | break; |
1507 | kvm->arch.naliases = n; | 1509 | kvm->arch.naliases = n; |
1508 | 1510 | ||
1511 | spin_unlock(&kvm->mmu_lock); | ||
1509 | kvm_mmu_zap_all(kvm); | 1512 | kvm_mmu_zap_all(kvm); |
1510 | 1513 | ||
1511 | up_write(&kvm->slots_lock); | 1514 | up_write(&kvm->slots_lock); |
@@ -3184,6 +3187,10 @@ static void seg_desct_to_kvm_desct(struct desc_struct *seg_desc, u16 selector, | |||
3184 | kvm_desct->base |= seg_desc->base2 << 24; | 3187 | kvm_desct->base |= seg_desc->base2 << 24; |
3185 | kvm_desct->limit = seg_desc->limit0; | 3188 | kvm_desct->limit = seg_desc->limit0; |
3186 | kvm_desct->limit |= seg_desc->limit << 16; | 3189 | kvm_desct->limit |= seg_desc->limit << 16; |
3190 | if (seg_desc->g) { | ||
3191 | kvm_desct->limit <<= 12; | ||
3192 | kvm_desct->limit |= 0xfff; | ||
3193 | } | ||
3187 | kvm_desct->selector = selector; | 3194 | kvm_desct->selector = selector; |
3188 | kvm_desct->type = seg_desc->type; | 3195 | kvm_desct->type = seg_desc->type; |
3189 | kvm_desct->present = seg_desc->p; | 3196 | kvm_desct->present = seg_desc->p; |
@@ -3223,6 +3230,7 @@ static void get_segment_descritptor_dtable(struct kvm_vcpu *vcpu, | |||
3223 | static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | 3230 | static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, |
3224 | struct desc_struct *seg_desc) | 3231 | struct desc_struct *seg_desc) |
3225 | { | 3232 | { |
3233 | gpa_t gpa; | ||
3226 | struct descriptor_table dtable; | 3234 | struct descriptor_table dtable; |
3227 | u16 index = selector >> 3; | 3235 | u16 index = selector >> 3; |
3228 | 3236 | ||
@@ -3232,13 +3240,16 @@ static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | |||
3232 | kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc); | 3240 | kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc); |
3233 | return 1; | 3241 | return 1; |
3234 | } | 3242 | } |
3235 | return kvm_read_guest(vcpu->kvm, dtable.base + index * 8, seg_desc, 8); | 3243 | gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base); |
3244 | gpa += index * 8; | ||
3245 | return kvm_read_guest(vcpu->kvm, gpa, seg_desc, 8); | ||
3236 | } | 3246 | } |
3237 | 3247 | ||
3238 | /* allowed just for 8 bytes segments */ | 3248 | /* allowed just for 8 bytes segments */ |
3239 | static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | 3249 | static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, |
3240 | struct desc_struct *seg_desc) | 3250 | struct desc_struct *seg_desc) |
3241 | { | 3251 | { |
3252 | gpa_t gpa; | ||
3242 | struct descriptor_table dtable; | 3253 | struct descriptor_table dtable; |
3243 | u16 index = selector >> 3; | 3254 | u16 index = selector >> 3; |
3244 | 3255 | ||
@@ -3246,7 +3257,9 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, | |||
3246 | 3257 | ||
3247 | if (dtable.limit < index * 8 + 7) | 3258 | if (dtable.limit < index * 8 + 7) |
3248 | return 1; | 3259 | return 1; |
3249 | return kvm_write_guest(vcpu->kvm, dtable.base + index * 8, seg_desc, 8); | 3260 | gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, dtable.base); |
3261 | gpa += index * 8; | ||
3262 | return kvm_write_guest(vcpu->kvm, gpa, seg_desc, 8); | ||
3250 | } | 3263 | } |
3251 | 3264 | ||
3252 | static u32 get_tss_base_addr(struct kvm_vcpu *vcpu, | 3265 | static u32 get_tss_base_addr(struct kvm_vcpu *vcpu, |
@@ -3258,55 +3271,7 @@ static u32 get_tss_base_addr(struct kvm_vcpu *vcpu, | |||
3258 | base_addr |= (seg_desc->base1 << 16); | 3271 | base_addr |= (seg_desc->base1 << 16); |
3259 | base_addr |= (seg_desc->base2 << 24); | 3272 | base_addr |= (seg_desc->base2 << 24); |
3260 | 3273 | ||
3261 | return base_addr; | 3274 | return vcpu->arch.mmu.gva_to_gpa(vcpu, base_addr); |
3262 | } | ||
3263 | |||
3264 | static int load_tss_segment32(struct kvm_vcpu *vcpu, | ||
3265 | struct desc_struct *seg_desc, | ||
3266 | struct tss_segment_32 *tss) | ||
3267 | { | ||
3268 | u32 base_addr; | ||
3269 | |||
3270 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3271 | |||
3272 | return kvm_read_guest(vcpu->kvm, base_addr, tss, | ||
3273 | sizeof(struct tss_segment_32)); | ||
3274 | } | ||
3275 | |||
3276 | static int save_tss_segment32(struct kvm_vcpu *vcpu, | ||
3277 | struct desc_struct *seg_desc, | ||
3278 | struct tss_segment_32 *tss) | ||
3279 | { | ||
3280 | u32 base_addr; | ||
3281 | |||
3282 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3283 | |||
3284 | return kvm_write_guest(vcpu->kvm, base_addr, tss, | ||
3285 | sizeof(struct tss_segment_32)); | ||
3286 | } | ||
3287 | |||
3288 | static int load_tss_segment16(struct kvm_vcpu *vcpu, | ||
3289 | struct desc_struct *seg_desc, | ||
3290 | struct tss_segment_16 *tss) | ||
3291 | { | ||
3292 | u32 base_addr; | ||
3293 | |||
3294 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3295 | |||
3296 | return kvm_read_guest(vcpu->kvm, base_addr, tss, | ||
3297 | sizeof(struct tss_segment_16)); | ||
3298 | } | ||
3299 | |||
3300 | static int save_tss_segment16(struct kvm_vcpu *vcpu, | ||
3301 | struct desc_struct *seg_desc, | ||
3302 | struct tss_segment_16 *tss) | ||
3303 | { | ||
3304 | u32 base_addr; | ||
3305 | |||
3306 | base_addr = get_tss_base_addr(vcpu, seg_desc); | ||
3307 | |||
3308 | return kvm_write_guest(vcpu->kvm, base_addr, tss, | ||
3309 | sizeof(struct tss_segment_16)); | ||
3310 | } | 3275 | } |
3311 | 3276 | ||
3312 | static u16 get_segment_selector(struct kvm_vcpu *vcpu, int seg) | 3277 | static u16 get_segment_selector(struct kvm_vcpu *vcpu, int seg) |
@@ -3466,20 +3431,26 @@ static int load_state_from_tss16(struct kvm_vcpu *vcpu, | |||
3466 | } | 3431 | } |
3467 | 3432 | ||
3468 | static int kvm_task_switch_16(struct kvm_vcpu *vcpu, u16 tss_selector, | 3433 | static int kvm_task_switch_16(struct kvm_vcpu *vcpu, u16 tss_selector, |
3469 | struct desc_struct *cseg_desc, | 3434 | u32 old_tss_base, |
3470 | struct desc_struct *nseg_desc) | 3435 | struct desc_struct *nseg_desc) |
3471 | { | 3436 | { |
3472 | struct tss_segment_16 tss_segment_16; | 3437 | struct tss_segment_16 tss_segment_16; |
3473 | int ret = 0; | 3438 | int ret = 0; |
3474 | 3439 | ||
3475 | if (load_tss_segment16(vcpu, cseg_desc, &tss_segment_16)) | 3440 | if (kvm_read_guest(vcpu->kvm, old_tss_base, &tss_segment_16, |
3441 | sizeof tss_segment_16)) | ||
3476 | goto out; | 3442 | goto out; |
3477 | 3443 | ||
3478 | save_state_to_tss16(vcpu, &tss_segment_16); | 3444 | save_state_to_tss16(vcpu, &tss_segment_16); |
3479 | save_tss_segment16(vcpu, cseg_desc, &tss_segment_16); | ||
3480 | 3445 | ||
3481 | if (load_tss_segment16(vcpu, nseg_desc, &tss_segment_16)) | 3446 | if (kvm_write_guest(vcpu->kvm, old_tss_base, &tss_segment_16, |
3447 | sizeof tss_segment_16)) | ||
3448 | goto out; | ||
3449 | |||
3450 | if (kvm_read_guest(vcpu->kvm, get_tss_base_addr(vcpu, nseg_desc), | ||
3451 | &tss_segment_16, sizeof tss_segment_16)) | ||
3482 | goto out; | 3452 | goto out; |
3453 | |||
3483 | if (load_state_from_tss16(vcpu, &tss_segment_16)) | 3454 | if (load_state_from_tss16(vcpu, &tss_segment_16)) |
3484 | goto out; | 3455 | goto out; |
3485 | 3456 | ||
@@ -3489,20 +3460,26 @@ out: | |||
3489 | } | 3460 | } |
3490 | 3461 | ||
3491 | static int kvm_task_switch_32(struct kvm_vcpu *vcpu, u16 tss_selector, | 3462 | static int kvm_task_switch_32(struct kvm_vcpu *vcpu, u16 tss_selector, |
3492 | struct desc_struct *cseg_desc, | 3463 | u32 old_tss_base, |
3493 | struct desc_struct *nseg_desc) | 3464 | struct desc_struct *nseg_desc) |
3494 | { | 3465 | { |
3495 | struct tss_segment_32 tss_segment_32; | 3466 | struct tss_segment_32 tss_segment_32; |
3496 | int ret = 0; | 3467 | int ret = 0; |
3497 | 3468 | ||
3498 | if (load_tss_segment32(vcpu, cseg_desc, &tss_segment_32)) | 3469 | if (kvm_read_guest(vcpu->kvm, old_tss_base, &tss_segment_32, |
3470 | sizeof tss_segment_32)) | ||
3499 | goto out; | 3471 | goto out; |
3500 | 3472 | ||
3501 | save_state_to_tss32(vcpu, &tss_segment_32); | 3473 | save_state_to_tss32(vcpu, &tss_segment_32); |
3502 | save_tss_segment32(vcpu, cseg_desc, &tss_segment_32); | ||
3503 | 3474 | ||
3504 | if (load_tss_segment32(vcpu, nseg_desc, &tss_segment_32)) | 3475 | if (kvm_write_guest(vcpu->kvm, old_tss_base, &tss_segment_32, |
3476 | sizeof tss_segment_32)) | ||
3505 | goto out; | 3477 | goto out; |
3478 | |||
3479 | if (kvm_read_guest(vcpu->kvm, get_tss_base_addr(vcpu, nseg_desc), | ||
3480 | &tss_segment_32, sizeof tss_segment_32)) | ||
3481 | goto out; | ||
3482 | |||
3506 | if (load_state_from_tss32(vcpu, &tss_segment_32)) | 3483 | if (load_state_from_tss32(vcpu, &tss_segment_32)) |
3507 | goto out; | 3484 | goto out; |
3508 | 3485 | ||
@@ -3517,16 +3494,20 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3517 | struct desc_struct cseg_desc; | 3494 | struct desc_struct cseg_desc; |
3518 | struct desc_struct nseg_desc; | 3495 | struct desc_struct nseg_desc; |
3519 | int ret = 0; | 3496 | int ret = 0; |
3497 | u32 old_tss_base = get_segment_base(vcpu, VCPU_SREG_TR); | ||
3498 | u16 old_tss_sel = get_segment_selector(vcpu, VCPU_SREG_TR); | ||
3520 | 3499 | ||
3521 | kvm_get_segment(vcpu, &tr_seg, VCPU_SREG_TR); | 3500 | old_tss_base = vcpu->arch.mmu.gva_to_gpa(vcpu, old_tss_base); |
3522 | 3501 | ||
3502 | /* FIXME: Handle errors. Failure to read either TSS or their | ||
3503 | * descriptors should generate a pagefault. | ||
3504 | */ | ||
3523 | if (load_guest_segment_descriptor(vcpu, tss_selector, &nseg_desc)) | 3505 | if (load_guest_segment_descriptor(vcpu, tss_selector, &nseg_desc)) |
3524 | goto out; | 3506 | goto out; |
3525 | 3507 | ||
3526 | if (load_guest_segment_descriptor(vcpu, tr_seg.selector, &cseg_desc)) | 3508 | if (load_guest_segment_descriptor(vcpu, old_tss_sel, &cseg_desc)) |
3527 | goto out; | 3509 | goto out; |
3528 | 3510 | ||
3529 | |||
3530 | if (reason != TASK_SWITCH_IRET) { | 3511 | if (reason != TASK_SWITCH_IRET) { |
3531 | int cpl; | 3512 | int cpl; |
3532 | 3513 | ||
@@ -3544,8 +3525,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3544 | 3525 | ||
3545 | if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { | 3526 | if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { |
3546 | cseg_desc.type &= ~(1 << 1); //clear the B flag | 3527 | cseg_desc.type &= ~(1 << 1); //clear the B flag |
3547 | save_guest_segment_descriptor(vcpu, tr_seg.selector, | 3528 | save_guest_segment_descriptor(vcpu, old_tss_sel, &cseg_desc); |
3548 | &cseg_desc); | ||
3549 | } | 3529 | } |
3550 | 3530 | ||
3551 | if (reason == TASK_SWITCH_IRET) { | 3531 | if (reason == TASK_SWITCH_IRET) { |
@@ -3557,10 +3537,10 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason) | |||
3557 | kvm_x86_ops->cache_regs(vcpu); | 3537 | kvm_x86_ops->cache_regs(vcpu); |
3558 | 3538 | ||
3559 | if (nseg_desc.type & 8) | 3539 | if (nseg_desc.type & 8) |
3560 | ret = kvm_task_switch_32(vcpu, tss_selector, &cseg_desc, | 3540 | ret = kvm_task_switch_32(vcpu, tss_selector, old_tss_base, |
3561 | &nseg_desc); | 3541 | &nseg_desc); |
3562 | else | 3542 | else |
3563 | ret = kvm_task_switch_16(vcpu, tss_selector, &cseg_desc, | 3543 | ret = kvm_task_switch_16(vcpu, tss_selector, old_tss_base, |
3564 | &nseg_desc); | 3544 | &nseg_desc); |
3565 | 3545 | ||
3566 | if (reason == TASK_SWITCH_CALL || reason == TASK_SWITCH_GATE) { | 3546 | if (reason == TASK_SWITCH_CALL || reason == TASK_SWITCH_GATE) { |
@@ -3995,16 +3975,23 @@ int kvm_arch_set_memory_region(struct kvm *kvm, | |||
3995 | */ | 3975 | */ |
3996 | if (!user_alloc) { | 3976 | if (!user_alloc) { |
3997 | if (npages && !old.rmap) { | 3977 | if (npages && !old.rmap) { |
3978 | unsigned long userspace_addr; | ||
3979 | |||
3998 | down_write(¤t->mm->mmap_sem); | 3980 | down_write(¤t->mm->mmap_sem); |
3999 | memslot->userspace_addr = do_mmap(NULL, 0, | 3981 | userspace_addr = do_mmap(NULL, 0, |
4000 | npages * PAGE_SIZE, | 3982 | npages * PAGE_SIZE, |
4001 | PROT_READ | PROT_WRITE, | 3983 | PROT_READ | PROT_WRITE, |
4002 | MAP_SHARED | MAP_ANONYMOUS, | 3984 | MAP_SHARED | MAP_ANONYMOUS, |
4003 | 0); | 3985 | 0); |
4004 | up_write(¤t->mm->mmap_sem); | 3986 | up_write(¤t->mm->mmap_sem); |
4005 | 3987 | ||
4006 | if (IS_ERR((void *)memslot->userspace_addr)) | 3988 | if (IS_ERR((void *)userspace_addr)) |
4007 | return PTR_ERR((void *)memslot->userspace_addr); | 3989 | return PTR_ERR((void *)userspace_addr); |
3990 | |||
3991 | /* set userspace_addr atomically for kvm_hva_to_rmapp */ | ||
3992 | spin_lock(&kvm->mmu_lock); | ||
3993 | memslot->userspace_addr = userspace_addr; | ||
3994 | spin_unlock(&kvm->mmu_lock); | ||
4008 | } else { | 3995 | } else { |
4009 | if (!old.user_alloc && old.rmap) { | 3996 | if (!old.user_alloc && old.rmap) { |
4010 | int ret; | 3997 | int ret; |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 0313a5eec412..65f0b8a47bed 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/lguest_launcher.h> | 55 | #include <linux/lguest_launcher.h> |
56 | #include <linux/virtio_console.h> | 56 | #include <linux/virtio_console.h> |
57 | #include <linux/pm.h> | 57 | #include <linux/pm.h> |
58 | #include <asm/apic.h> | ||
58 | #include <asm/lguest.h> | 59 | #include <asm/lguest.h> |
59 | #include <asm/paravirt.h> | 60 | #include <asm/paravirt.h> |
60 | #include <asm/param.h> | 61 | #include <asm/param.h> |
@@ -783,14 +784,44 @@ static void lguest_wbinvd(void) | |||
783 | * code qualifies for Advanced. It will also never interrupt anything. It | 784 | * code qualifies for Advanced. It will also never interrupt anything. It |
784 | * does, however, allow us to get through the Linux boot code. */ | 785 | * does, however, allow us to get through the Linux boot code. */ |
785 | #ifdef CONFIG_X86_LOCAL_APIC | 786 | #ifdef CONFIG_X86_LOCAL_APIC |
786 | static void lguest_apic_write(unsigned long reg, u32 v) | 787 | static void lguest_apic_write(u32 reg, u32 v) |
787 | { | 788 | { |
788 | } | 789 | } |
789 | 790 | ||
790 | static u32 lguest_apic_read(unsigned long reg) | 791 | static u32 lguest_apic_read(u32 reg) |
791 | { | 792 | { |
792 | return 0; | 793 | return 0; |
793 | } | 794 | } |
795 | |||
796 | static u64 lguest_apic_icr_read(void) | ||
797 | { | ||
798 | return 0; | ||
799 | } | ||
800 | |||
801 | static void lguest_apic_icr_write(u32 low, u32 id) | ||
802 | { | ||
803 | /* Warn to see if there's any stray references */ | ||
804 | WARN_ON(1); | ||
805 | } | ||
806 | |||
807 | static void lguest_apic_wait_icr_idle(void) | ||
808 | { | ||
809 | return; | ||
810 | } | ||
811 | |||
812 | static u32 lguest_apic_safe_wait_icr_idle(void) | ||
813 | { | ||
814 | return 0; | ||
815 | } | ||
816 | |||
817 | static struct apic_ops lguest_basic_apic_ops = { | ||
818 | .read = lguest_apic_read, | ||
819 | .write = lguest_apic_write, | ||
820 | .icr_read = lguest_apic_icr_read, | ||
821 | .icr_write = lguest_apic_icr_write, | ||
822 | .wait_icr_idle = lguest_apic_wait_icr_idle, | ||
823 | .safe_wait_icr_idle = lguest_apic_safe_wait_icr_idle, | ||
824 | }; | ||
794 | #endif | 825 | #endif |
795 | 826 | ||
796 | /* STOP! Until an interrupt comes in. */ | 827 | /* STOP! Until an interrupt comes in. */ |
@@ -990,8 +1021,7 @@ __init void lguest_init(void) | |||
990 | 1021 | ||
991 | #ifdef CONFIG_X86_LOCAL_APIC | 1022 | #ifdef CONFIG_X86_LOCAL_APIC |
992 | /* apic read/write intercepts */ | 1023 | /* apic read/write intercepts */ |
993 | pv_apic_ops.apic_write = lguest_apic_write; | 1024 | apic_ops = &lguest_basic_apic_ops; |
994 | pv_apic_ops.apic_read = lguest_apic_read; | ||
995 | #endif | 1025 | #endif |
996 | 1026 | ||
997 | /* time operations */ | 1027 | /* time operations */ |
@@ -1014,6 +1044,9 @@ __init void lguest_init(void) | |||
1014 | init_pg_tables_start = __pa(pg0); | 1044 | init_pg_tables_start = __pa(pg0); |
1015 | init_pg_tables_end = __pa(pg0); | 1045 | init_pg_tables_end = __pa(pg0); |
1016 | 1046 | ||
1047 | /* As described in head_32.S, we map the first 128M of memory. */ | ||
1048 | max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT; | ||
1049 | |||
1017 | /* Load the %fs segment register (the per-cpu segment register) with | 1050 | /* Load the %fs segment register (the per-cpu segment register) with |
1018 | * the normal data segment to get through booting. */ | 1051 | * the normal data segment to get through booting. */ |
1019 | asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory"); | 1052 | asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory"); |
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index aa3fa4119424..55e11aa6d66c 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -17,9 +17,6 @@ ifeq ($(CONFIG_X86_32),y) | |||
17 | lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o | 17 | lib-$(CONFIG_X86_USE_3DNOW) += mmx_32.o |
18 | else | 18 | else |
19 | obj-y += io_64.o iomap_copy_64.o | 19 | obj-y += io_64.o iomap_copy_64.o |
20 | |||
21 | CFLAGS_csum-partial_64.o := -funroll-loops | ||
22 | |||
23 | lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o | 20 | lib-y += csum-partial_64.o csum-copy_64.o csum-wrappers_64.o |
24 | lib-y += thunk_64.o clear_page_64.o copy_page_64.o | 21 | lib-y += thunk_64.o clear_page_64.o copy_page_64.o |
25 | lib-y += memmove_64.o memset_64.o | 22 | lib-y += memmove_64.o memset_64.o |
diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S index dfdf428975c0..f118c110af32 100644 --- a/arch/x86/lib/copy_user_64.S +++ b/arch/x86/lib/copy_user_64.S | |||
@@ -52,7 +52,7 @@ | |||
52 | jnz 100b | 52 | jnz 100b |
53 | 102: | 53 | 102: |
54 | .section .fixup,"ax" | 54 | .section .fixup,"ax" |
55 | 103: addl %r8d,%edx /* ecx is zerorest also */ | 55 | 103: addl %ecx,%edx /* ecx is zerorest also */ |
56 | jmp copy_user_handle_tail | 56 | jmp copy_user_handle_tail |
57 | .previous | 57 | .previous |
58 | 58 | ||
diff --git a/arch/x86/lib/copy_user_nocache_64.S b/arch/x86/lib/copy_user_nocache_64.S index 40e0e309d27e..cb0c112386fb 100644 --- a/arch/x86/lib/copy_user_nocache_64.S +++ b/arch/x86/lib/copy_user_nocache_64.S | |||
@@ -32,7 +32,7 @@ | |||
32 | jnz 100b | 32 | jnz 100b |
33 | 102: | 33 | 102: |
34 | .section .fixup,"ax" | 34 | .section .fixup,"ax" |
35 | 103: addl %r8d,%edx /* ecx is zerorest also */ | 35 | 103: addl %ecx,%edx /* ecx is zerorest also */ |
36 | jmp copy_user_handle_tail | 36 | jmp copy_user_handle_tail |
37 | .previous | 37 | .previous |
38 | 38 | ||
@@ -108,7 +108,6 @@ ENTRY(__copy_user_nocache) | |||
108 | jmp 60f | 108 | jmp 60f |
109 | 50: movl %ecx,%edx | 109 | 50: movl %ecx,%edx |
110 | 60: sfence | 110 | 60: sfence |
111 | movl %r8d,%ecx | ||
112 | jmp copy_user_handle_tail | 111 | jmp copy_user_handle_tail |
113 | .previous | 112 | .previous |
114 | 113 | ||
diff --git a/arch/x86/lib/msr-on-cpu.c b/arch/x86/lib/msr-on-cpu.c index d5a2b39f882b..01b868ba82f8 100644 --- a/arch/x86/lib/msr-on-cpu.c +++ b/arch/x86/lib/msr-on-cpu.c | |||
@@ -30,10 +30,11 @@ static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) | |||
30 | 30 | ||
31 | rv.msr_no = msr_no; | 31 | rv.msr_no = msr_no; |
32 | if (safe) { | 32 | if (safe) { |
33 | smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1); | 33 | err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, |
34 | err = rv.err; | 34 | &rv, 1); |
35 | err = err ? err : rv.err; | ||
35 | } else { | 36 | } else { |
36 | smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); | 37 | err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1); |
37 | } | 38 | } |
38 | *l = rv.l; | 39 | *l = rv.l; |
39 | *h = rv.h; | 40 | *h = rv.h; |
@@ -64,23 +65,24 @@ static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) | |||
64 | rv.l = l; | 65 | rv.l = l; |
65 | rv.h = h; | 66 | rv.h = h; |
66 | if (safe) { | 67 | if (safe) { |
67 | smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1); | 68 | err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, |
68 | err = rv.err; | 69 | &rv, 1); |
70 | err = err ? err : rv.err; | ||
69 | } else { | 71 | } else { |
70 | smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); | 72 | err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1); |
71 | } | 73 | } |
72 | 74 | ||
73 | return err; | 75 | return err; |
74 | } | 76 | } |
75 | 77 | ||
76 | void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) | 78 | int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) |
77 | { | 79 | { |
78 | _wrmsr_on_cpu(cpu, msr_no, l, h, 0); | 80 | return _wrmsr_on_cpu(cpu, msr_no, l, h, 0); |
79 | } | 81 | } |
80 | 82 | ||
81 | void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) | 83 | int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) |
82 | { | 84 | { |
83 | _rdmsr_on_cpu(cpu, msr_no, l, h, 0); | 85 | return _rdmsr_on_cpu(cpu, msr_no, l, h, 0); |
84 | } | 86 | } |
85 | 87 | ||
86 | /* These "safe" variants are slower and should be used when the target MSR | 88 | /* These "safe" variants are slower and should be used when the target MSR |
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 24e60944971a..9e68075544f6 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -14,6 +14,13 @@ | |||
14 | #include <asm/uaccess.h> | 14 | #include <asm/uaccess.h> |
15 | #include <asm/mmx.h> | 15 | #include <asm/mmx.h> |
16 | 16 | ||
17 | #ifdef CONFIG_X86_INTEL_USERCOPY | ||
18 | /* | ||
19 | * Alignment at which movsl is preferred for bulk memory copies. | ||
20 | */ | ||
21 | struct movsl_mask movsl_mask __read_mostly; | ||
22 | #endif | ||
23 | |||
17 | static inline int __movsl_is_ok(unsigned long a1, unsigned long a2, unsigned long n) | 24 | static inline int __movsl_is_ok(unsigned long a1, unsigned long a2, unsigned long n) |
18 | { | 25 | { |
19 | #ifdef CONFIG_X86_INTEL_USERCOPY | 26 | #ifdef CONFIG_X86_INTEL_USERCOPY |
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c index 3d317836be9e..37b9ae4d44c5 100644 --- a/arch/x86/mach-default/setup.c +++ b/arch/x86/mach-default/setup.c | |||
@@ -10,13 +10,15 @@ | |||
10 | #include <asm/e820.h> | 10 | #include <asm/e820.h> |
11 | #include <asm/setup.h> | 11 | #include <asm/setup.h> |
12 | 12 | ||
13 | #include <mach_ipi.h> | ||
14 | |||
13 | #ifdef CONFIG_HOTPLUG_CPU | 15 | #ifdef CONFIG_HOTPLUG_CPU |
14 | #define DEFAULT_SEND_IPI (1) | 16 | #define DEFAULT_SEND_IPI (1) |
15 | #else | 17 | #else |
16 | #define DEFAULT_SEND_IPI (0) | 18 | #define DEFAULT_SEND_IPI (0) |
17 | #endif | 19 | #endif |
18 | 20 | ||
19 | int no_broadcast=DEFAULT_SEND_IPI; | 21 | int no_broadcast = DEFAULT_SEND_IPI; |
20 | 22 | ||
21 | /** | 23 | /** |
22 | * pre_intr_init_hook - initialisation prior to setting up interrupt vectors | 24 | * pre_intr_init_hook - initialisation prior to setting up interrupt vectors |
@@ -36,15 +38,6 @@ void __init pre_intr_init_hook(void) | |||
36 | init_ISA_irqs(); | 38 | init_ISA_irqs(); |
37 | } | 39 | } |
38 | 40 | ||
39 | /* | ||
40 | * IRQ2 is cascade interrupt to second interrupt controller | ||
41 | */ | ||
42 | static struct irqaction irq2 = { | ||
43 | .handler = no_action, | ||
44 | .mask = CPU_MASK_NONE, | ||
45 | .name = "cascade", | ||
46 | }; | ||
47 | |||
48 | /** | 41 | /** |
49 | * intr_init_hook - post gate setup interrupt initialisation | 42 | * intr_init_hook - post gate setup interrupt initialisation |
50 | * | 43 | * |
@@ -60,12 +53,6 @@ void __init intr_init_hook(void) | |||
60 | if (x86_quirks->arch_intr_init()) | 53 | if (x86_quirks->arch_intr_init()) |
61 | return; | 54 | return; |
62 | } | 55 | } |
63 | #ifdef CONFIG_X86_LOCAL_APIC | ||
64 | apic_intr_init(); | ||
65 | #endif | ||
66 | |||
67 | if (!acpi_ioapic) | ||
68 | setup_irq(2, &irq2); | ||
69 | } | 56 | } |
70 | 57 | ||
71 | /** | 58 | /** |
diff --git a/arch/x86/mach-es7000/Makefile b/arch/x86/mach-es7000/Makefile deleted file mode 100644 index 3ef8b43b62fc..000000000000 --- a/arch/x86/mach-es7000/Makefile +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_X86_ES7000) := es7000plat.o | ||
diff --git a/arch/x86/mach-es7000/es7000.h b/arch/x86/mach-es7000/es7000.h deleted file mode 100644 index c8d5aa132fa0..000000000000 --- a/arch/x86/mach-es7000/es7000.h +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | /* | ||
2 | * Written by: Garry Forsgren, Unisys Corporation | ||
3 | * Natalie Protasevich, Unisys Corporation | ||
4 | * This file contains the code to configure and interface | ||
5 | * with Unisys ES7000 series hardware system manager. | ||
6 | * | ||
7 | * Copyright (c) 2003 Unisys Corporation. All Rights Reserved. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of version 2 of the GNU General Public License as | ||
11 | * published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it would be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along | ||
18 | * with this program; if not, write the Free Software Foundation, Inc., 59 | ||
19 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
20 | * | ||
21 | * Contact information: Unisys Corporation, Township Line & Union Meeting | ||
22 | * Roads-A, Unisys Way, Blue Bell, Pennsylvania, 19424, or: | ||
23 | * | ||
24 | * http://www.unisys.com | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * ES7000 chipsets | ||
29 | */ | ||
30 | |||
31 | #define NON_UNISYS 0 | ||
32 | #define ES7000_CLASSIC 1 | ||
33 | #define ES7000_ZORRO 2 | ||
34 | |||
35 | |||
36 | #define MIP_REG 1 | ||
37 | #define MIP_PSAI_REG 4 | ||
38 | |||
39 | #define MIP_BUSY 1 | ||
40 | #define MIP_SPIN 0xf0000 | ||
41 | #define MIP_VALID 0x0100000000000000ULL | ||
42 | #define MIP_PORT(VALUE) ((VALUE >> 32) & 0xffff) | ||
43 | |||
44 | #define MIP_RD_LO(VALUE) (VALUE & 0xffffffff) | ||
45 | |||
46 | struct mip_reg_info { | ||
47 | unsigned long long mip_info; | ||
48 | unsigned long long delivery_info; | ||
49 | unsigned long long host_reg; | ||
50 | unsigned long long mip_reg; | ||
51 | }; | ||
52 | |||
53 | struct part_info { | ||
54 | unsigned char type; | ||
55 | unsigned char length; | ||
56 | unsigned char part_id; | ||
57 | unsigned char apic_mode; | ||
58 | unsigned long snum; | ||
59 | char ptype[16]; | ||
60 | char sname[64]; | ||
61 | char pname[64]; | ||
62 | }; | ||
63 | |||
64 | struct psai { | ||
65 | unsigned long long entry_type; | ||
66 | unsigned long long addr; | ||
67 | unsigned long long bep_addr; | ||
68 | }; | ||
69 | |||
70 | struct es7000_mem_info { | ||
71 | unsigned char type; | ||
72 | unsigned char length; | ||
73 | unsigned char resv[6]; | ||
74 | unsigned long long start; | ||
75 | unsigned long long size; | ||
76 | }; | ||
77 | |||
78 | struct es7000_oem_table { | ||
79 | unsigned long long hdr; | ||
80 | struct mip_reg_info mip; | ||
81 | struct part_info pif; | ||
82 | struct es7000_mem_info shm; | ||
83 | struct psai psai; | ||
84 | }; | ||
85 | |||
86 | #ifdef CONFIG_ACPI | ||
87 | |||
88 | struct oem_table { | ||
89 | struct acpi_table_header Header; | ||
90 | u32 OEMTableAddr; | ||
91 | u32 OEMTableSize; | ||
92 | }; | ||
93 | |||
94 | extern int find_unisys_acpi_oem_table(unsigned long *oem_addr); | ||
95 | #endif | ||
96 | |||
97 | struct mip_reg { | ||
98 | unsigned long long off_0; | ||
99 | unsigned long long off_8; | ||
100 | unsigned long long off_10; | ||
101 | unsigned long long off_18; | ||
102 | unsigned long long off_20; | ||
103 | unsigned long long off_28; | ||
104 | unsigned long long off_30; | ||
105 | unsigned long long off_38; | ||
106 | }; | ||
107 | |||
108 | #define MIP_SW_APIC 0x1020b | ||
109 | #define MIP_FUNC(VALUE) (VALUE & 0xff) | ||
110 | |||
111 | extern int parse_unisys_oem (char *oemptr); | ||
112 | extern void setup_unisys(void); | ||
113 | extern int es7000_start_cpu(int cpu, unsigned long eip); | ||
114 | extern void es7000_sw_apic(void); | ||
diff --git a/arch/x86/mach-generic/Makefile b/arch/x86/mach-generic/Makefile index 0dbd7803a1d5..6730f4e7c744 100644 --- a/arch/x86/mach-generic/Makefile +++ b/arch/x86/mach-generic/Makefile | |||
@@ -9,4 +9,3 @@ obj-$(CONFIG_X86_NUMAQ) += numaq.o | |||
9 | obj-$(CONFIG_X86_SUMMIT) += summit.o | 9 | obj-$(CONFIG_X86_SUMMIT) += summit.o |
10 | obj-$(CONFIG_X86_BIGSMP) += bigsmp.o | 10 | obj-$(CONFIG_X86_BIGSMP) += bigsmp.o |
11 | obj-$(CONFIG_X86_ES7000) += es7000.o | 11 | obj-$(CONFIG_X86_ES7000) += es7000.o |
12 | obj-$(CONFIG_X86_ES7000) += ../../x86/mach-es7000/ | ||
diff --git a/arch/x86/mach-generic/bigsmp.c b/arch/x86/mach-generic/bigsmp.c index 59d771714559..df37fc9d6a26 100644 --- a/arch/x86/mach-generic/bigsmp.c +++ b/arch/x86/mach-generic/bigsmp.c | |||
@@ -5,18 +5,17 @@ | |||
5 | #define APIC_DEFINITION 1 | 5 | #define APIC_DEFINITION 1 |
6 | #include <linux/threads.h> | 6 | #include <linux/threads.h> |
7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
8 | #include <asm/smp.h> | ||
9 | #include <asm/mpspec.h> | 8 | #include <asm/mpspec.h> |
10 | #include <asm/genapic.h> | 9 | #include <asm/genapic.h> |
11 | #include <asm/fixmap.h> | 10 | #include <asm/fixmap.h> |
12 | #include <asm/apicdef.h> | 11 | #include <asm/apicdef.h> |
13 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | 13 | #include <linux/init.h> |
16 | #include <linux/dmi.h> | 14 | #include <linux/dmi.h> |
17 | #include <asm/mach-bigsmp/mach_apic.h> | 15 | #include <asm/bigsmp/apicdef.h> |
18 | #include <asm/mach-bigsmp/mach_apicdef.h> | 16 | #include <linux/smp.h> |
19 | #include <asm/mach-bigsmp/mach_ipi.h> | 17 | #include <asm/bigsmp/apic.h> |
18 | #include <asm/bigsmp/ipi.h> | ||
20 | #include <asm/mach-default/mach_mpparse.h> | 19 | #include <asm/mach-default/mach_mpparse.h> |
21 | 20 | ||
22 | static int dmi_bigsmp; /* can be set by dmi scanners */ | 21 | static int dmi_bigsmp; /* can be set by dmi scanners */ |
diff --git a/arch/x86/mach-generic/es7000.c b/arch/x86/mach-generic/es7000.c index 4742626f08c4..520cca0ee04e 100644 --- a/arch/x86/mach-generic/es7000.c +++ b/arch/x86/mach-generic/es7000.c | |||
@@ -4,20 +4,19 @@ | |||
4 | #define APIC_DEFINITION 1 | 4 | #define APIC_DEFINITION 1 |
5 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
7 | #include <asm/smp.h> | ||
8 | #include <asm/mpspec.h> | 7 | #include <asm/mpspec.h> |
9 | #include <asm/genapic.h> | 8 | #include <asm/genapic.h> |
10 | #include <asm/fixmap.h> | 9 | #include <asm/fixmap.h> |
11 | #include <asm/apicdef.h> | 10 | #include <asm/apicdef.h> |
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/string.h> | 12 | #include <linux/string.h> |
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | 13 | #include <linux/init.h> |
16 | #include <asm/mach-es7000/mach_apicdef.h> | 14 | #include <asm/es7000/apicdef.h> |
17 | #include <asm/mach-es7000/mach_apic.h> | 15 | #include <linux/smp.h> |
18 | #include <asm/mach-es7000/mach_ipi.h> | 16 | #include <asm/es7000/apic.h> |
19 | #include <asm/mach-es7000/mach_mpparse.h> | 17 | #include <asm/es7000/ipi.h> |
20 | #include <asm/mach-es7000/mach_wakecpu.h> | 18 | #include <asm/es7000/mpparse.h> |
19 | #include <asm/es7000/wakecpu.h> | ||
21 | 20 | ||
22 | static int probe_es7000(void) | 21 | static int probe_es7000(void) |
23 | { | 22 | { |
diff --git a/arch/x86/mach-generic/numaq.c b/arch/x86/mach-generic/numaq.c index 8091e68764c4..8cf58394975e 100644 --- a/arch/x86/mach-generic/numaq.c +++ b/arch/x86/mach-generic/numaq.c | |||
@@ -4,7 +4,6 @@ | |||
4 | #define APIC_DEFINITION 1 | 4 | #define APIC_DEFINITION 1 |
5 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
7 | #include <linux/smp.h> | ||
8 | #include <asm/mpspec.h> | 7 | #include <asm/mpspec.h> |
9 | #include <asm/genapic.h> | 8 | #include <asm/genapic.h> |
10 | #include <asm/fixmap.h> | 9 | #include <asm/fixmap.h> |
@@ -12,11 +11,12 @@ | |||
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/string.h> | 12 | #include <linux/string.h> |
14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
15 | #include <asm/mach-numaq/mach_apic.h> | 14 | #include <asm/numaq/apicdef.h> |
16 | #include <asm/mach-numaq/mach_apicdef.h> | 15 | #include <linux/smp.h> |
17 | #include <asm/mach-numaq/mach_ipi.h> | 16 | #include <asm/numaq/apic.h> |
18 | #include <asm/mach-numaq/mach_mpparse.h> | 17 | #include <asm/numaq/ipi.h> |
19 | #include <asm/mach-numaq/mach_wakecpu.h> | 18 | #include <asm/numaq/mpparse.h> |
19 | #include <asm/numaq/wakecpu.h> | ||
20 | #include <asm/numaq.h> | 20 | #include <asm/numaq.h> |
21 | 21 | ||
22 | static int mps_oem_check(struct mp_config_table *mpc, char *oem, | 22 | static int mps_oem_check(struct mp_config_table *mpc, char *oem, |
diff --git a/arch/x86/mach-generic/summit.c b/arch/x86/mach-generic/summit.c index a97ea0f35b1e..6ad6b67a723d 100644 --- a/arch/x86/mach-generic/summit.c +++ b/arch/x86/mach-generic/summit.c | |||
@@ -4,19 +4,18 @@ | |||
4 | #define APIC_DEFINITION 1 | 4 | #define APIC_DEFINITION 1 |
5 | #include <linux/threads.h> | 5 | #include <linux/threads.h> |
6 | #include <linux/cpumask.h> | 6 | #include <linux/cpumask.h> |
7 | #include <asm/smp.h> | ||
8 | #include <asm/mpspec.h> | 7 | #include <asm/mpspec.h> |
9 | #include <asm/genapic.h> | 8 | #include <asm/genapic.h> |
10 | #include <asm/fixmap.h> | 9 | #include <asm/fixmap.h> |
11 | #include <asm/apicdef.h> | 10 | #include <asm/apicdef.h> |
12 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
13 | #include <linux/string.h> | 12 | #include <linux/string.h> |
14 | #include <linux/smp.h> | ||
15 | #include <linux/init.h> | 13 | #include <linux/init.h> |
16 | #include <asm/mach-summit/mach_apic.h> | 14 | #include <asm/summit/apicdef.h> |
17 | #include <asm/mach-summit/mach_apicdef.h> | 15 | #include <linux/smp.h> |
18 | #include <asm/mach-summit/mach_ipi.h> | 16 | #include <asm/summit/apic.h> |
19 | #include <asm/mach-summit/mach_mpparse.h> | 17 | #include <asm/summit/ipi.h> |
18 | #include <asm/summit/mpparse.h> | ||
20 | 19 | ||
21 | static int probe_summit(void) | 20 | static int probe_summit(void) |
22 | { | 21 | { |
diff --git a/arch/x86/mach-rdc321x/platform.c b/arch/x86/mach-rdc321x/platform.c index a037041817c7..4f4e50c3ad3b 100644 --- a/arch/x86/mach-rdc321x/platform.c +++ b/arch/x86/mach-rdc321x/platform.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/version.h> | ||
29 | #include <linux/leds.h> | 28 | #include <linux/leds.h> |
30 | 29 | ||
31 | #include <asm/gpio.h> | 30 | #include <asm/gpio.h> |
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 1fbb844c3d7a..dfb932dcf136 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ | 1 | obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ |
2 | pat.o pgtable.o | 2 | pat.o pgtable.o gup.o |
3 | 3 | ||
4 | obj-$(CONFIG_X86_32) += pgtable_32.o | 4 | obj-$(CONFIG_X86_32) += pgtable_32.o |
5 | 5 | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 455f3fe67b42..8f92cac4e6db 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/tlbflush.h> | 35 | #include <asm/tlbflush.h> |
36 | #include <asm/proto.h> | 36 | #include <asm/proto.h> |
37 | #include <asm-generic/sections.h> | 37 | #include <asm-generic/sections.h> |
38 | #include <asm/traps.h> | ||
38 | 39 | ||
39 | /* | 40 | /* |
40 | * Page fault error code bits | 41 | * Page fault error code bits |
@@ -357,8 +358,6 @@ static int is_errata100(struct pt_regs *regs, unsigned long address) | |||
357 | return 0; | 358 | return 0; |
358 | } | 359 | } |
359 | 360 | ||
360 | void do_invalid_op(struct pt_regs *, unsigned long); | ||
361 | |||
362 | static int is_f00f_bug(struct pt_regs *regs, unsigned long address) | 361 | static int is_f00f_bug(struct pt_regs *regs, unsigned long address) |
363 | { | 362 | { |
364 | #ifdef CONFIG_X86_F00F_BUG | 363 | #ifdef CONFIG_X86_F00F_BUG |
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c new file mode 100644 index 000000000000..007bb06c7504 --- /dev/null +++ b/arch/x86/mm/gup.c | |||
@@ -0,0 +1,298 @@ | |||
1 | /* | ||
2 | * Lockless get_user_pages_fast for x86 | ||
3 | * | ||
4 | * Copyright (C) 2008 Nick Piggin | ||
5 | * Copyright (C) 2008 Novell Inc. | ||
6 | */ | ||
7 | #include <linux/sched.h> | ||
8 | #include <linux/mm.h> | ||
9 | #include <linux/vmstat.h> | ||
10 | #include <linux/highmem.h> | ||
11 | |||
12 | #include <asm/pgtable.h> | ||
13 | |||
14 | static inline pte_t gup_get_pte(pte_t *ptep) | ||
15 | { | ||
16 | #ifndef CONFIG_X86_PAE | ||
17 | return *ptep; | ||
18 | #else | ||
19 | /* | ||
20 | * With get_user_pages_fast, we walk down the pagetables without taking | ||
21 | * any locks. For this we would like to load the pointers atoimcally, | ||
22 | * but that is not possible (without expensive cmpxchg8b) on PAE. What | ||
23 | * we do have is the guarantee that a pte will only either go from not | ||
24 | * present to present, or present to not present or both -- it will not | ||
25 | * switch to a completely different present page without a TLB flush in | ||
26 | * between; something that we are blocking by holding interrupts off. | ||
27 | * | ||
28 | * Setting ptes from not present to present goes: | ||
29 | * ptep->pte_high = h; | ||
30 | * smp_wmb(); | ||
31 | * ptep->pte_low = l; | ||
32 | * | ||
33 | * And present to not present goes: | ||
34 | * ptep->pte_low = 0; | ||
35 | * smp_wmb(); | ||
36 | * ptep->pte_high = 0; | ||
37 | * | ||
38 | * We must ensure here that the load of pte_low sees l iff pte_high | ||
39 | * sees h. We load pte_high *after* loading pte_low, which ensures we | ||
40 | * don't see an older value of pte_high. *Then* we recheck pte_low, | ||
41 | * which ensures that we haven't picked up a changed pte high. We might | ||
42 | * have got rubbish values from pte_low and pte_high, but we are | ||
43 | * guaranteed that pte_low will not have the present bit set *unless* | ||
44 | * it is 'l'. And get_user_pages_fast only operates on present ptes, so | ||
45 | * we're safe. | ||
46 | * | ||
47 | * gup_get_pte should not be used or copied outside gup.c without being | ||
48 | * very careful -- it does not atomically load the pte or anything that | ||
49 | * is likely to be useful for you. | ||
50 | */ | ||
51 | pte_t pte; | ||
52 | |||
53 | retry: | ||
54 | pte.pte_low = ptep->pte_low; | ||
55 | smp_rmb(); | ||
56 | pte.pte_high = ptep->pte_high; | ||
57 | smp_rmb(); | ||
58 | if (unlikely(pte.pte_low != ptep->pte_low)) | ||
59 | goto retry; | ||
60 | |||
61 | return pte; | ||
62 | #endif | ||
63 | } | ||
64 | |||
65 | /* | ||
66 | * The performance critical leaf functions are made noinline otherwise gcc | ||
67 | * inlines everything into a single function which results in too much | ||
68 | * register pressure. | ||
69 | */ | ||
70 | static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, | ||
71 | unsigned long end, int write, struct page **pages, int *nr) | ||
72 | { | ||
73 | unsigned long mask; | ||
74 | pte_t *ptep; | ||
75 | |||
76 | mask = _PAGE_PRESENT|_PAGE_USER; | ||
77 | if (write) | ||
78 | mask |= _PAGE_RW; | ||
79 | |||
80 | ptep = pte_offset_map(&pmd, addr); | ||
81 | do { | ||
82 | pte_t pte = gup_get_pte(ptep); | ||
83 | struct page *page; | ||
84 | |||
85 | if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask) { | ||
86 | pte_unmap(ptep); | ||
87 | return 0; | ||
88 | } | ||
89 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); | ||
90 | page = pte_page(pte); | ||
91 | get_page(page); | ||
92 | pages[*nr] = page; | ||
93 | (*nr)++; | ||
94 | |||
95 | } while (ptep++, addr += PAGE_SIZE, addr != end); | ||
96 | pte_unmap(ptep - 1); | ||
97 | |||
98 | return 1; | ||
99 | } | ||
100 | |||
101 | static inline void get_head_page_multiple(struct page *page, int nr) | ||
102 | { | ||
103 | VM_BUG_ON(page != compound_head(page)); | ||
104 | VM_BUG_ON(page_count(page) == 0); | ||
105 | atomic_add(nr, &page->_count); | ||
106 | } | ||
107 | |||
108 | static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr, | ||
109 | unsigned long end, int write, struct page **pages, int *nr) | ||
110 | { | ||
111 | unsigned long mask; | ||
112 | pte_t pte = *(pte_t *)&pmd; | ||
113 | struct page *head, *page; | ||
114 | int refs; | ||
115 | |||
116 | mask = _PAGE_PRESENT|_PAGE_USER; | ||
117 | if (write) | ||
118 | mask |= _PAGE_RW; | ||
119 | if ((pte_val(pte) & mask) != mask) | ||
120 | return 0; | ||
121 | /* hugepages are never "special" */ | ||
122 | VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL); | ||
123 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); | ||
124 | |||
125 | refs = 0; | ||
126 | head = pte_page(pte); | ||
127 | page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT); | ||
128 | do { | ||
129 | VM_BUG_ON(compound_head(page) != head); | ||
130 | pages[*nr] = page; | ||
131 | (*nr)++; | ||
132 | page++; | ||
133 | refs++; | ||
134 | } while (addr += PAGE_SIZE, addr != end); | ||
135 | get_head_page_multiple(head, refs); | ||
136 | |||
137 | return 1; | ||
138 | } | ||
139 | |||
140 | static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, | ||
141 | int write, struct page **pages, int *nr) | ||
142 | { | ||
143 | unsigned long next; | ||
144 | pmd_t *pmdp; | ||
145 | |||
146 | pmdp = pmd_offset(&pud, addr); | ||
147 | do { | ||
148 | pmd_t pmd = *pmdp; | ||
149 | |||
150 | next = pmd_addr_end(addr, end); | ||
151 | if (pmd_none(pmd)) | ||
152 | return 0; | ||
153 | if (unlikely(pmd_large(pmd))) { | ||
154 | if (!gup_huge_pmd(pmd, addr, next, write, pages, nr)) | ||
155 | return 0; | ||
156 | } else { | ||
157 | if (!gup_pte_range(pmd, addr, next, write, pages, nr)) | ||
158 | return 0; | ||
159 | } | ||
160 | } while (pmdp++, addr = next, addr != end); | ||
161 | |||
162 | return 1; | ||
163 | } | ||
164 | |||
165 | static noinline int gup_huge_pud(pud_t pud, unsigned long addr, | ||
166 | unsigned long end, int write, struct page **pages, int *nr) | ||
167 | { | ||
168 | unsigned long mask; | ||
169 | pte_t pte = *(pte_t *)&pud; | ||
170 | struct page *head, *page; | ||
171 | int refs; | ||
172 | |||
173 | mask = _PAGE_PRESENT|_PAGE_USER; | ||
174 | if (write) | ||
175 | mask |= _PAGE_RW; | ||
176 | if ((pte_val(pte) & mask) != mask) | ||
177 | return 0; | ||
178 | /* hugepages are never "special" */ | ||
179 | VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL); | ||
180 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); | ||
181 | |||
182 | refs = 0; | ||
183 | head = pte_page(pte); | ||
184 | page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT); | ||
185 | do { | ||
186 | VM_BUG_ON(compound_head(page) != head); | ||
187 | pages[*nr] = page; | ||
188 | (*nr)++; | ||
189 | page++; | ||
190 | refs++; | ||
191 | } while (addr += PAGE_SIZE, addr != end); | ||
192 | get_head_page_multiple(head, refs); | ||
193 | |||
194 | return 1; | ||
195 | } | ||
196 | |||
197 | static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end, | ||
198 | int write, struct page **pages, int *nr) | ||
199 | { | ||
200 | unsigned long next; | ||
201 | pud_t *pudp; | ||
202 | |||
203 | pudp = pud_offset(&pgd, addr); | ||
204 | do { | ||
205 | pud_t pud = *pudp; | ||
206 | |||
207 | next = pud_addr_end(addr, end); | ||
208 | if (pud_none(pud)) | ||
209 | return 0; | ||
210 | if (unlikely(pud_large(pud))) { | ||
211 | if (!gup_huge_pud(pud, addr, next, write, pages, nr)) | ||
212 | return 0; | ||
213 | } else { | ||
214 | if (!gup_pmd_range(pud, addr, next, write, pages, nr)) | ||
215 | return 0; | ||
216 | } | ||
217 | } while (pudp++, addr = next, addr != end); | ||
218 | |||
219 | return 1; | ||
220 | } | ||
221 | |||
222 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
223 | struct page **pages) | ||
224 | { | ||
225 | struct mm_struct *mm = current->mm; | ||
226 | unsigned long addr, len, end; | ||
227 | unsigned long next; | ||
228 | pgd_t *pgdp; | ||
229 | int nr = 0; | ||
230 | |||
231 | start &= PAGE_MASK; | ||
232 | addr = start; | ||
233 | len = (unsigned long) nr_pages << PAGE_SHIFT; | ||
234 | end = start + len; | ||
235 | if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ, | ||
236 | start, len))) | ||
237 | goto slow_irqon; | ||
238 | |||
239 | /* | ||
240 | * XXX: batch / limit 'nr', to avoid large irq off latency | ||
241 | * needs some instrumenting to determine the common sizes used by | ||
242 | * important workloads (eg. DB2), and whether limiting the batch size | ||
243 | * will decrease performance. | ||
244 | * | ||
245 | * It seems like we're in the clear for the moment. Direct-IO is | ||
246 | * the main guy that batches up lots of get_user_pages, and even | ||
247 | * they are limited to 64-at-a-time which is not so many. | ||
248 | */ | ||
249 | /* | ||
250 | * This doesn't prevent pagetable teardown, but does prevent | ||
251 | * the pagetables and pages from being freed on x86. | ||
252 | * | ||
253 | * So long as we atomically load page table pointers versus teardown | ||
254 | * (which we do on x86, with the above PAE exception), we can follow the | ||
255 | * address down to the the page and take a ref on it. | ||
256 | */ | ||
257 | local_irq_disable(); | ||
258 | pgdp = pgd_offset(mm, addr); | ||
259 | do { | ||
260 | pgd_t pgd = *pgdp; | ||
261 | |||
262 | next = pgd_addr_end(addr, end); | ||
263 | if (pgd_none(pgd)) | ||
264 | goto slow; | ||
265 | if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) | ||
266 | goto slow; | ||
267 | } while (pgdp++, addr = next, addr != end); | ||
268 | local_irq_enable(); | ||
269 | |||
270 | VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT); | ||
271 | return nr; | ||
272 | |||
273 | { | ||
274 | int ret; | ||
275 | |||
276 | slow: | ||
277 | local_irq_enable(); | ||
278 | slow_irqon: | ||
279 | /* Try to get the remaining pages with get_user_pages */ | ||
280 | start += nr << PAGE_SHIFT; | ||
281 | pages += nr; | ||
282 | |||
283 | down_read(&mm->mmap_sem); | ||
284 | ret = get_user_pages(current, mm, start, | ||
285 | (end - start) >> PAGE_SHIFT, write, 0, pages, NULL); | ||
286 | up_read(&mm->mmap_sem); | ||
287 | |||
288 | /* Have to be a bit careful with return values */ | ||
289 | if (nr > 0) { | ||
290 | if (ret < 0) | ||
291 | ret = nr; | ||
292 | else | ||
293 | ret += nr; | ||
294 | } | ||
295 | |||
296 | return ret; | ||
297 | } | ||
298 | } | ||
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index d37f29376b0c..4974e97dedfe 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <asm/paravirt.h> | 47 | #include <asm/paravirt.h> |
48 | #include <asm/setup.h> | 48 | #include <asm/setup.h> |
49 | #include <asm/cacheflush.h> | 49 | #include <asm/cacheflush.h> |
50 | #include <asm/smp.h> | ||
50 | 51 | ||
51 | unsigned int __VMALLOC_RESERVE = 128 << 20; | 52 | unsigned int __VMALLOC_RESERVE = 128 << 20; |
52 | 53 | ||
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index ec37121f6709..1f6806b62eb8 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -60,7 +60,7 @@ static unsigned long dma_reserve __initdata; | |||
60 | 60 | ||
61 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | 61 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
62 | 62 | ||
63 | int direct_gbpages __meminitdata | 63 | int direct_gbpages |
64 | #ifdef CONFIG_DIRECT_GBPAGES | 64 | #ifdef CONFIG_DIRECT_GBPAGES |
65 | = 1 | 65 | = 1 |
66 | #endif | 66 | #endif |
@@ -86,46 +86,69 @@ early_param("gbpages", parse_direct_gbpages_on); | |||
86 | * around without checking the pgd every time. | 86 | * around without checking the pgd every time. |
87 | */ | 87 | */ |
88 | 88 | ||
89 | void show_mem(void) | 89 | int after_bootmem; |
90 | |||
91 | unsigned long __supported_pte_mask __read_mostly = ~0UL; | ||
92 | EXPORT_SYMBOL_GPL(__supported_pte_mask); | ||
93 | |||
94 | static int do_not_nx __cpuinitdata; | ||
95 | |||
96 | /* | ||
97 | * noexec=on|off | ||
98 | * Control non-executable mappings for 64-bit processes. | ||
99 | * | ||
100 | * on Enable (default) | ||
101 | * off Disable | ||
102 | */ | ||
103 | static int __init nonx_setup(char *str) | ||
90 | { | 104 | { |
91 | long i, total = 0, reserved = 0; | 105 | if (!str) |
92 | long shared = 0, cached = 0; | 106 | return -EINVAL; |
93 | struct page *page; | 107 | if (!strncmp(str, "on", 2)) { |
94 | pg_data_t *pgdat; | 108 | __supported_pte_mask |= _PAGE_NX; |
95 | 109 | do_not_nx = 0; | |
96 | printk(KERN_INFO "Mem-info:\n"); | 110 | } else if (!strncmp(str, "off", 3)) { |
97 | show_free_areas(); | 111 | do_not_nx = 1; |
98 | for_each_online_pgdat(pgdat) { | 112 | __supported_pte_mask &= ~_PAGE_NX; |
99 | for (i = 0; i < pgdat->node_spanned_pages; ++i) { | ||
100 | /* | ||
101 | * This loop can take a while with 256 GB and | ||
102 | * 4k pages so defer the NMI watchdog: | ||
103 | */ | ||
104 | if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) | ||
105 | touch_nmi_watchdog(); | ||
106 | |||
107 | if (!pfn_valid(pgdat->node_start_pfn + i)) | ||
108 | continue; | ||
109 | |||
110 | page = pfn_to_page(pgdat->node_start_pfn + i); | ||
111 | total++; | ||
112 | if (PageReserved(page)) | ||
113 | reserved++; | ||
114 | else if (PageSwapCache(page)) | ||
115 | cached++; | ||
116 | else if (page_count(page)) | ||
117 | shared += page_count(page) - 1; | ||
118 | } | ||
119 | } | 113 | } |
120 | printk(KERN_INFO "%lu pages of RAM\n", total); | 114 | return 0; |
121 | printk(KERN_INFO "%lu reserved pages\n", reserved); | ||
122 | printk(KERN_INFO "%lu pages shared\n", shared); | ||
123 | printk(KERN_INFO "%lu pages swap cached\n", cached); | ||
124 | } | 115 | } |
116 | early_param("noexec", nonx_setup); | ||
125 | 117 | ||
126 | int after_bootmem; | 118 | void __cpuinit check_efer(void) |
119 | { | ||
120 | unsigned long efer; | ||
121 | |||
122 | rdmsrl(MSR_EFER, efer); | ||
123 | if (!(efer & EFER_NX) || do_not_nx) | ||
124 | __supported_pte_mask &= ~_PAGE_NX; | ||
125 | } | ||
126 | |||
127 | int force_personality32; | ||
128 | |||
129 | /* | ||
130 | * noexec32=on|off | ||
131 | * Control non executable heap for 32bit processes. | ||
132 | * To control the stack too use noexec=off | ||
133 | * | ||
134 | * on PROT_READ does not imply PROT_EXEC for 32-bit processes (default) | ||
135 | * off PROT_READ implies PROT_EXEC | ||
136 | */ | ||
137 | static int __init nonx32_setup(char *str) | ||
138 | { | ||
139 | if (!strcmp(str, "on")) | ||
140 | force_personality32 &= ~READ_IMPLIES_EXEC; | ||
141 | else if (!strcmp(str, "off")) | ||
142 | force_personality32 |= READ_IMPLIES_EXEC; | ||
143 | return 1; | ||
144 | } | ||
145 | __setup("noexec32=", nonx32_setup); | ||
127 | 146 | ||
128 | static __init void *spp_getpage(void) | 147 | /* |
148 | * NOTE: This function is marked __ref because it calls __init function | ||
149 | * (alloc_bootmem_pages). It's safe to do it ONLY when after_bootmem == 0. | ||
150 | */ | ||
151 | static __ref void *spp_getpage(void) | ||
129 | { | 152 | { |
130 | void *ptr; | 153 | void *ptr; |
131 | 154 | ||
@@ -274,7 +297,7 @@ static unsigned long __initdata table_start; | |||
274 | static unsigned long __meminitdata table_end; | 297 | static unsigned long __meminitdata table_end; |
275 | static unsigned long __meminitdata table_top; | 298 | static unsigned long __meminitdata table_top; |
276 | 299 | ||
277 | static __meminit void *alloc_low_page(unsigned long *phys) | 300 | static __ref void *alloc_low_page(unsigned long *phys) |
278 | { | 301 | { |
279 | unsigned long pfn = table_end++; | 302 | unsigned long pfn = table_end++; |
280 | void *adr; | 303 | void *adr; |
@@ -295,7 +318,7 @@ static __meminit void *alloc_low_page(unsigned long *phys) | |||
295 | return adr; | 318 | return adr; |
296 | } | 319 | } |
297 | 320 | ||
298 | static __meminit void unmap_low_page(void *adr) | 321 | static __ref void unmap_low_page(void *adr) |
299 | { | 322 | { |
300 | if (after_bootmem) | 323 | if (after_bootmem) |
301 | return; | 324 | return; |
@@ -351,6 +374,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, | |||
351 | { | 374 | { |
352 | unsigned long pages = 0; | 375 | unsigned long pages = 0; |
353 | unsigned long last_map_addr = end; | 376 | unsigned long last_map_addr = end; |
377 | unsigned long start = address; | ||
354 | 378 | ||
355 | int i = pmd_index(address); | 379 | int i = pmd_index(address); |
356 | 380 | ||
@@ -368,16 +392,24 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, | |||
368 | } | 392 | } |
369 | 393 | ||
370 | if (pmd_val(*pmd)) { | 394 | if (pmd_val(*pmd)) { |
371 | if (!pmd_large(*pmd)) | 395 | if (!pmd_large(*pmd)) { |
396 | spin_lock(&init_mm.page_table_lock); | ||
372 | last_map_addr = phys_pte_update(pmd, address, | 397 | last_map_addr = phys_pte_update(pmd, address, |
373 | end); | 398 | end); |
399 | spin_unlock(&init_mm.page_table_lock); | ||
400 | } | ||
401 | /* Count entries we're using from level2_ident_pgt */ | ||
402 | if (start == 0) | ||
403 | pages++; | ||
374 | continue; | 404 | continue; |
375 | } | 405 | } |
376 | 406 | ||
377 | if (page_size_mask & (1<<PG_LEVEL_2M)) { | 407 | if (page_size_mask & (1<<PG_LEVEL_2M)) { |
378 | pages++; | 408 | pages++; |
409 | spin_lock(&init_mm.page_table_lock); | ||
379 | set_pte((pte_t *)pmd, | 410 | set_pte((pte_t *)pmd, |
380 | pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); | 411 | pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); |
412 | spin_unlock(&init_mm.page_table_lock); | ||
381 | last_map_addr = (address & PMD_MASK) + PMD_SIZE; | 413 | last_map_addr = (address & PMD_MASK) + PMD_SIZE; |
382 | continue; | 414 | continue; |
383 | } | 415 | } |
@@ -386,7 +418,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, | |||
386 | last_map_addr = phys_pte_init(pte, address, end); | 418 | last_map_addr = phys_pte_init(pte, address, end); |
387 | unmap_low_page(pte); | 419 | unmap_low_page(pte); |
388 | 420 | ||
421 | spin_lock(&init_mm.page_table_lock); | ||
389 | pmd_populate_kernel(&init_mm, pmd, __va(pte_phys)); | 422 | pmd_populate_kernel(&init_mm, pmd, __va(pte_phys)); |
423 | spin_unlock(&init_mm.page_table_lock); | ||
390 | } | 424 | } |
391 | update_page_count(PG_LEVEL_2M, pages); | 425 | update_page_count(PG_LEVEL_2M, pages); |
392 | return last_map_addr; | 426 | return last_map_addr; |
@@ -399,9 +433,7 @@ phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end, | |||
399 | pmd_t *pmd = pmd_offset(pud, 0); | 433 | pmd_t *pmd = pmd_offset(pud, 0); |
400 | unsigned long last_map_addr; | 434 | unsigned long last_map_addr; |
401 | 435 | ||
402 | spin_lock(&init_mm.page_table_lock); | ||
403 | last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask); | 436 | last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask); |
404 | spin_unlock(&init_mm.page_table_lock); | ||
405 | __flush_tlb_all(); | 437 | __flush_tlb_all(); |
406 | return last_map_addr; | 438 | return last_map_addr; |
407 | } | 439 | } |
@@ -437,20 +469,21 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, | |||
437 | 469 | ||
438 | if (page_size_mask & (1<<PG_LEVEL_1G)) { | 470 | if (page_size_mask & (1<<PG_LEVEL_1G)) { |
439 | pages++; | 471 | pages++; |
472 | spin_lock(&init_mm.page_table_lock); | ||
440 | set_pte((pte_t *)pud, | 473 | set_pte((pte_t *)pud, |
441 | pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); | 474 | pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); |
475 | spin_unlock(&init_mm.page_table_lock); | ||
442 | last_map_addr = (addr & PUD_MASK) + PUD_SIZE; | 476 | last_map_addr = (addr & PUD_MASK) + PUD_SIZE; |
443 | continue; | 477 | continue; |
444 | } | 478 | } |
445 | 479 | ||
446 | pmd = alloc_low_page(&pmd_phys); | 480 | pmd = alloc_low_page(&pmd_phys); |
447 | |||
448 | spin_lock(&init_mm.page_table_lock); | ||
449 | last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask); | 481 | last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask); |
450 | unmap_low_page(pmd); | 482 | unmap_low_page(pmd); |
483 | |||
484 | spin_lock(&init_mm.page_table_lock); | ||
451 | pud_populate(&init_mm, pud, __va(pmd_phys)); | 485 | pud_populate(&init_mm, pud, __va(pmd_phys)); |
452 | spin_unlock(&init_mm.page_table_lock); | 486 | spin_unlock(&init_mm.page_table_lock); |
453 | |||
454 | } | 487 | } |
455 | __flush_tlb_all(); | 488 | __flush_tlb_all(); |
456 | update_page_count(PG_LEVEL_1G, pages); | 489 | update_page_count(PG_LEVEL_1G, pages); |
@@ -542,16 +575,14 @@ static unsigned long __init kernel_physical_mapping_init(unsigned long start, | |||
542 | continue; | 575 | continue; |
543 | } | 576 | } |
544 | 577 | ||
545 | if (after_bootmem) | 578 | pud = alloc_low_page(&pud_phys); |
546 | pud = pud_offset(pgd, start & PGDIR_MASK); | ||
547 | else | ||
548 | pud = alloc_low_page(&pud_phys); | ||
549 | |||
550 | last_map_addr = phys_pud_init(pud, __pa(start), __pa(next), | 579 | last_map_addr = phys_pud_init(pud, __pa(start), __pa(next), |
551 | page_size_mask); | 580 | page_size_mask); |
552 | unmap_low_page(pud); | 581 | unmap_low_page(pud); |
553 | pgd_populate(&init_mm, pgd_offset_k(start), | 582 | |
554 | __va(pud_phys)); | 583 | spin_lock(&init_mm.page_table_lock); |
584 | pgd_populate(&init_mm, pgd, __va(pud_phys)); | ||
585 | spin_unlock(&init_mm.page_table_lock); | ||
555 | } | 586 | } |
556 | 587 | ||
557 | return last_map_addr; | 588 | return last_map_addr; |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 016f335bbeea..cac6da54203b 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -170,7 +170,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, | |||
170 | phys_addr &= PAGE_MASK; | 170 | phys_addr &= PAGE_MASK; |
171 | size = PAGE_ALIGN(last_addr+1) - phys_addr; | 171 | size = PAGE_ALIGN(last_addr+1) - phys_addr; |
172 | 172 | ||
173 | retval = reserve_memtype(phys_addr, phys_addr + size, | 173 | retval = reserve_memtype(phys_addr, (u64)phys_addr + size, |
174 | prot_val, &new_prot_val); | 174 | prot_val, &new_prot_val); |
175 | if (retval) { | 175 | if (retval) { |
176 | pr_debug("Warning: reserve_memtype returned %d\n", retval); | 176 | pr_debug("Warning: reserve_memtype returned %d\n", retval); |
@@ -421,7 +421,7 @@ void unxlate_dev_mem_ptr(unsigned long phys, void *addr) | |||
421 | return; | 421 | return; |
422 | } | 422 | } |
423 | 423 | ||
424 | int __initdata early_ioremap_debug; | 424 | static int __initdata early_ioremap_debug; |
425 | 425 | ||
426 | static int __init early_ioremap_debug_setup(char *str) | 426 | static int __init early_ioremap_debug_setup(char *str) |
427 | { | 427 | { |
@@ -547,19 +547,17 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx) | |||
547 | } | 547 | } |
548 | 548 | ||
549 | 549 | ||
550 | int __initdata early_ioremap_nested; | 550 | static int __initdata early_ioremap_nested; |
551 | 551 | ||
552 | static int __init check_early_ioremap_leak(void) | 552 | static int __init check_early_ioremap_leak(void) |
553 | { | 553 | { |
554 | if (!early_ioremap_nested) | 554 | if (!early_ioremap_nested) |
555 | return 0; | 555 | return 0; |
556 | 556 | WARN(1, KERN_WARNING | |
557 | printk(KERN_WARNING | ||
558 | "Debug warning: early ioremap leak of %d areas detected.\n", | 557 | "Debug warning: early ioremap leak of %d areas detected.\n", |
559 | early_ioremap_nested); | 558 | early_ioremap_nested); |
560 | printk(KERN_WARNING | 559 | printk(KERN_WARNING |
561 | "please boot with early_ioremap_debug and report the dmesg.\n"); | 560 | "please boot with early_ioremap_debug and report the dmesg.\n"); |
562 | WARN_ON(1); | ||
563 | 561 | ||
564 | return 1; | 562 | return 1; |
565 | } | 563 | } |
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c index e7397e108beb..635b50e85581 100644 --- a/arch/x86/mm/mmio-mod.c +++ b/arch/x86/mm/mmio-mod.c | |||
@@ -430,7 +430,9 @@ static void enter_uniprocessor(void) | |||
430 | "may miss events.\n"); | 430 | "may miss events.\n"); |
431 | } | 431 | } |
432 | 432 | ||
433 | static void leave_uniprocessor(void) | 433 | /* __ref because leave_uniprocessor calls cpu_up which is __cpuinit, |
434 | but this whole function is ifdefed CONFIG_HOTPLUG_CPU */ | ||
435 | static void __ref leave_uniprocessor(void) | ||
434 | { | 436 | { |
435 | int cpu; | 437 | int cpu; |
436 | int err; | 438 | int err; |
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index 0dcd42eb94e6..d4aa503caaa2 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c | |||
@@ -221,8 +221,7 @@ static int pageattr_test(void) | |||
221 | failed += print_split(&sc); | 221 | failed += print_split(&sc); |
222 | 222 | ||
223 | if (failed) { | 223 | if (failed) { |
224 | printk(KERN_ERR "NOT PASSED. Please report.\n"); | 224 | WARN(1, KERN_ERR "NOT PASSED. Please report.\n"); |
225 | WARN_ON(1); | ||
226 | return -EINVAL; | 225 | return -EINVAL; |
227 | } else { | 226 | } else { |
228 | if (print) | 227 | if (print) |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 65c6e46bf059..43e2f8483e4f 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -55,13 +55,19 @@ static void split_page_count(int level) | |||
55 | 55 | ||
56 | int arch_report_meminfo(char *page) | 56 | int arch_report_meminfo(char *page) |
57 | { | 57 | { |
58 | int n = sprintf(page, "DirectMap4k: %8lu\n" | 58 | int n = sprintf(page, "DirectMap4k: %8lu kB\n", |
59 | "DirectMap2M: %8lu\n", | 59 | direct_pages_count[PG_LEVEL_4K] << 2); |
60 | direct_pages_count[PG_LEVEL_4K], | 60 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) |
61 | direct_pages_count[PG_LEVEL_2M]); | 61 | n += sprintf(page + n, "DirectMap2M: %8lu kB\n", |
62 | direct_pages_count[PG_LEVEL_2M] << 11); | ||
63 | #else | ||
64 | n += sprintf(page + n, "DirectMap4M: %8lu kB\n", | ||
65 | direct_pages_count[PG_LEVEL_2M] << 12); | ||
66 | #endif | ||
62 | #ifdef CONFIG_X86_64 | 67 | #ifdef CONFIG_X86_64 |
63 | n += sprintf(page + n, "DirectMap1G: %8lu\n", | 68 | if (direct_gbpages) |
64 | direct_pages_count[PG_LEVEL_1G]); | 69 | n += sprintf(page + n, "DirectMap1G: %8lu kB\n", |
70 | direct_pages_count[PG_LEVEL_1G] << 20); | ||
65 | #endif | 71 | #endif |
66 | return n; | 72 | return n; |
67 | } | 73 | } |
@@ -592,10 +598,9 @@ repeat: | |||
592 | if (!pte_val(old_pte)) { | 598 | if (!pte_val(old_pte)) { |
593 | if (!primary) | 599 | if (!primary) |
594 | return 0; | 600 | return 0; |
595 | printk(KERN_WARNING "CPA: called for zero pte. " | 601 | WARN(1, KERN_WARNING "CPA: called for zero pte. " |
596 | "vaddr = %lx cpa->vaddr = %lx\n", address, | 602 | "vaddr = %lx cpa->vaddr = %lx\n", address, |
597 | cpa->vaddr); | 603 | cpa->vaddr); |
598 | WARN_ON(1); | ||
599 | return -EINVAL; | 604 | return -EINVAL; |
600 | } | 605 | } |
601 | 606 | ||
@@ -844,7 +849,7 @@ int set_memory_uc(unsigned long addr, int numpages) | |||
844 | /* | 849 | /* |
845 | * for now UC MINUS. see comments in ioremap_nocache() | 850 | * for now UC MINUS. see comments in ioremap_nocache() |
846 | */ | 851 | */ |
847 | if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, | 852 | if (reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE, |
848 | _PAGE_CACHE_UC_MINUS, NULL)) | 853 | _PAGE_CACHE_UC_MINUS, NULL)) |
849 | return -EINVAL; | 854 | return -EINVAL; |
850 | 855 | ||
@@ -863,7 +868,7 @@ int set_memory_wc(unsigned long addr, int numpages) | |||
863 | if (!pat_enabled) | 868 | if (!pat_enabled) |
864 | return set_memory_uc(addr, numpages); | 869 | return set_memory_uc(addr, numpages); |
865 | 870 | ||
866 | if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, | 871 | if (reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE, |
867 | _PAGE_CACHE_WC, NULL)) | 872 | _PAGE_CACHE_WC, NULL)) |
868 | return -EINVAL; | 873 | return -EINVAL; |
869 | 874 | ||
@@ -879,7 +884,7 @@ int _set_memory_wb(unsigned long addr, int numpages) | |||
879 | 884 | ||
880 | int set_memory_wb(unsigned long addr, int numpages) | 885 | int set_memory_wb(unsigned long addr, int numpages) |
881 | { | 886 | { |
882 | free_memtype(addr, addr + numpages * PAGE_SIZE); | 887 | free_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE); |
883 | 888 | ||
884 | return _set_memory_wb(addr, numpages); | 889 | return _set_memory_wb(addr, numpages); |
885 | } | 890 | } |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 2fe30916d4b6..2a50e0fa64a5 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -207,6 +207,9 @@ static int chk_conflict(struct memtype *new, struct memtype *entry, | |||
207 | return -EBUSY; | 207 | return -EBUSY; |
208 | } | 208 | } |
209 | 209 | ||
210 | static struct memtype *cached_entry; | ||
211 | static u64 cached_start; | ||
212 | |||
210 | /* | 213 | /* |
211 | * req_type typically has one of the: | 214 | * req_type typically has one of the: |
212 | * - _PAGE_CACHE_WB | 215 | * - _PAGE_CACHE_WB |
@@ -280,11 +283,17 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
280 | 283 | ||
281 | spin_lock(&memtype_lock); | 284 | spin_lock(&memtype_lock); |
282 | 285 | ||
286 | if (cached_entry && start >= cached_start) | ||
287 | entry = cached_entry; | ||
288 | else | ||
289 | entry = list_entry(&memtype_list, struct memtype, nd); | ||
290 | |||
283 | /* Search for existing mapping that overlaps the current range */ | 291 | /* Search for existing mapping that overlaps the current range */ |
284 | where = NULL; | 292 | where = NULL; |
285 | list_for_each_entry(entry, &memtype_list, nd) { | 293 | list_for_each_entry_continue(entry, &memtype_list, nd) { |
286 | if (end <= entry->start) { | 294 | if (end <= entry->start) { |
287 | where = entry->nd.prev; | 295 | where = entry->nd.prev; |
296 | cached_entry = list_entry(where, struct memtype, nd); | ||
288 | break; | 297 | break; |
289 | } else if (start <= entry->start) { /* end > entry->start */ | 298 | } else if (start <= entry->start) { /* end > entry->start */ |
290 | err = chk_conflict(new, entry, new_type); | 299 | err = chk_conflict(new, entry, new_type); |
@@ -292,6 +301,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
292 | dprintk("Overlap at 0x%Lx-0x%Lx\n", | 301 | dprintk("Overlap at 0x%Lx-0x%Lx\n", |
293 | entry->start, entry->end); | 302 | entry->start, entry->end); |
294 | where = entry->nd.prev; | 303 | where = entry->nd.prev; |
304 | cached_entry = list_entry(where, | ||
305 | struct memtype, nd); | ||
295 | } | 306 | } |
296 | break; | 307 | break; |
297 | } else if (start < entry->end) { /* start > entry->start */ | 308 | } else if (start < entry->end) { /* start > entry->start */ |
@@ -299,7 +310,20 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
299 | if (!err) { | 310 | if (!err) { |
300 | dprintk("Overlap at 0x%Lx-0x%Lx\n", | 311 | dprintk("Overlap at 0x%Lx-0x%Lx\n", |
301 | entry->start, entry->end); | 312 | entry->start, entry->end); |
302 | where = &entry->nd; | 313 | cached_entry = list_entry(entry->nd.prev, |
314 | struct memtype, nd); | ||
315 | |||
316 | /* | ||
317 | * Move to right position in the linked | ||
318 | * list to add this new entry | ||
319 | */ | ||
320 | list_for_each_entry_continue(entry, | ||
321 | &memtype_list, nd) { | ||
322 | if (start <= entry->start) { | ||
323 | where = entry->nd.prev; | ||
324 | break; | ||
325 | } | ||
326 | } | ||
303 | } | 327 | } |
304 | break; | 328 | break; |
305 | } | 329 | } |
@@ -314,6 +338,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type, | |||
314 | return err; | 338 | return err; |
315 | } | 339 | } |
316 | 340 | ||
341 | cached_start = start; | ||
342 | |||
317 | if (where) | 343 | if (where) |
318 | list_add(&new->nd, where); | 344 | list_add(&new->nd, where); |
319 | else | 345 | else |
@@ -343,6 +369,9 @@ int free_memtype(u64 start, u64 end) | |||
343 | spin_lock(&memtype_lock); | 369 | spin_lock(&memtype_lock); |
344 | list_for_each_entry(entry, &memtype_list, nd) { | 370 | list_for_each_entry(entry, &memtype_list, nd) { |
345 | if (entry->start == start && entry->end == end) { | 371 | if (entry->start == start && entry->end == end) { |
372 | if (cached_entry == entry || cached_start == start) | ||
373 | cached_entry = NULL; | ||
374 | |||
346 | list_del(&entry->nd); | 375 | list_del(&entry->nd); |
347 | kfree(entry); | 376 | kfree(entry); |
348 | err = 0; | 377 | err = 0; |
@@ -361,14 +390,6 @@ int free_memtype(u64 start, u64 end) | |||
361 | } | 390 | } |
362 | 391 | ||
363 | 392 | ||
364 | /* | ||
365 | * /dev/mem mmap interface. The memtype used for mapping varies: | ||
366 | * - Use UC for mappings with O_SYNC flag | ||
367 | * - Without O_SYNC flag, if there is any conflict in reserve_memtype, | ||
368 | * inherit the memtype from existing mapping. | ||
369 | * - Else use UC_MINUS memtype (for backward compatibility with existing | ||
370 | * X drivers. | ||
371 | */ | ||
372 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | 393 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, |
373 | unsigned long size, pgprot_t vma_prot) | 394 | unsigned long size, pgprot_t vma_prot) |
374 | { | 395 | { |
@@ -406,14 +427,14 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
406 | unsigned long size, pgprot_t *vma_prot) | 427 | unsigned long size, pgprot_t *vma_prot) |
407 | { | 428 | { |
408 | u64 offset = ((u64) pfn) << PAGE_SHIFT; | 429 | u64 offset = ((u64) pfn) << PAGE_SHIFT; |
409 | unsigned long flags = _PAGE_CACHE_UC_MINUS; | 430 | unsigned long flags = -1; |
410 | int retval; | 431 | int retval; |
411 | 432 | ||
412 | if (!range_is_allowed(pfn, size)) | 433 | if (!range_is_allowed(pfn, size)) |
413 | return 0; | 434 | return 0; |
414 | 435 | ||
415 | if (file->f_flags & O_SYNC) { | 436 | if (file->f_flags & O_SYNC) { |
416 | flags = _PAGE_CACHE_UC; | 437 | flags = _PAGE_CACHE_UC_MINUS; |
417 | } | 438 | } |
418 | 439 | ||
419 | #ifdef CONFIG_X86_32 | 440 | #ifdef CONFIG_X86_32 |
@@ -436,13 +457,14 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn, | |||
436 | #endif | 457 | #endif |
437 | 458 | ||
438 | /* | 459 | /* |
439 | * With O_SYNC, we can only take UC mapping. Fail if we cannot. | 460 | * With O_SYNC, we can only take UC_MINUS mapping. Fail if we cannot. |
461 | * | ||
440 | * Without O_SYNC, we want to get | 462 | * Without O_SYNC, we want to get |
441 | * - WB for WB-able memory and no other conflicting mappings | 463 | * - WB for WB-able memory and no other conflicting mappings |
442 | * - UC_MINUS for non-WB-able memory with no other conflicting mappings | 464 | * - UC_MINUS for non-WB-able memory with no other conflicting mappings |
443 | * - Inherit from confliting mappings otherwise | 465 | * - Inherit from confliting mappings otherwise |
444 | */ | 466 | */ |
445 | if (flags != _PAGE_CACHE_UC_MINUS) { | 467 | if (flags != -1) { |
446 | retval = reserve_memtype(offset, offset + size, flags, NULL); | 468 | retval = reserve_memtype(offset, offset + size, flags, NULL); |
447 | } else { | 469 | } else { |
448 | retval = reserve_memtype(offset, offset + size, -1, &flags); | 470 | retval = reserve_memtype(offset, offset + size, -1, &flags); |
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 557b2abceef8..d50302774fe2 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
@@ -207,6 +207,9 @@ static void pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmds[]) | |||
207 | unsigned long addr; | 207 | unsigned long addr; |
208 | int i; | 208 | int i; |
209 | 209 | ||
210 | if (PREALLOCATED_PMDS == 0) /* Work around gcc-3.4.x bug */ | ||
211 | return; | ||
212 | |||
210 | pud = pud_offset(pgd, 0); | 213 | pud = pud_offset(pgd, 0); |
211 | 214 | ||
212 | for (addr = i = 0; i < PREALLOCATED_PMDS; | 215 | for (addr = i = 0; i < PREALLOCATED_PMDS; |
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c index b4becbf8c570..cab0abbd1ebe 100644 --- a/arch/x86/mm/pgtable_32.c +++ b/arch/x86/mm/pgtable_32.c | |||
@@ -20,53 +20,6 @@ | |||
20 | #include <asm/tlb.h> | 20 | #include <asm/tlb.h> |
21 | #include <asm/tlbflush.h> | 21 | #include <asm/tlbflush.h> |
22 | 22 | ||
23 | void show_mem(void) | ||
24 | { | ||
25 | int total = 0, reserved = 0; | ||
26 | int shared = 0, cached = 0; | ||
27 | int highmem = 0; | ||
28 | struct page *page; | ||
29 | pg_data_t *pgdat; | ||
30 | unsigned long i; | ||
31 | unsigned long flags; | ||
32 | |||
33 | printk(KERN_INFO "Mem-info:\n"); | ||
34 | show_free_areas(); | ||
35 | for_each_online_pgdat(pgdat) { | ||
36 | pgdat_resize_lock(pgdat, &flags); | ||
37 | for (i = 0; i < pgdat->node_spanned_pages; ++i) { | ||
38 | if (unlikely(i % MAX_ORDER_NR_PAGES == 0)) | ||
39 | touch_nmi_watchdog(); | ||
40 | page = pgdat_page_nr(pgdat, i); | ||
41 | total++; | ||
42 | if (PageHighMem(page)) | ||
43 | highmem++; | ||
44 | if (PageReserved(page)) | ||
45 | reserved++; | ||
46 | else if (PageSwapCache(page)) | ||
47 | cached++; | ||
48 | else if (page_count(page)) | ||
49 | shared += page_count(page) - 1; | ||
50 | } | ||
51 | pgdat_resize_unlock(pgdat, &flags); | ||
52 | } | ||
53 | printk(KERN_INFO "%d pages of RAM\n", total); | ||
54 | printk(KERN_INFO "%d pages of HIGHMEM\n", highmem); | ||
55 | printk(KERN_INFO "%d reserved pages\n", reserved); | ||
56 | printk(KERN_INFO "%d pages shared\n", shared); | ||
57 | printk(KERN_INFO "%d pages swap cached\n", cached); | ||
58 | |||
59 | printk(KERN_INFO "%lu pages dirty\n", global_page_state(NR_FILE_DIRTY)); | ||
60 | printk(KERN_INFO "%lu pages writeback\n", | ||
61 | global_page_state(NR_WRITEBACK)); | ||
62 | printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED)); | ||
63 | printk(KERN_INFO "%lu pages slab\n", | ||
64 | global_page_state(NR_SLAB_RECLAIMABLE) + | ||
65 | global_page_state(NR_SLAB_UNRECLAIMABLE)); | ||
66 | printk(KERN_INFO "%lu pages pagetables\n", | ||
67 | global_page_state(NR_PAGETABLE)); | ||
68 | } | ||
69 | |||
70 | /* | 23 | /* |
71 | * Associate a virtual page frame with a given physical page frame | 24 | * Associate a virtual page frame with a given physical page frame |
72 | * and protection flags for that frame. | 25 | * and protection flags for that frame. |
diff --git a/arch/x86/mm/srat_32.c b/arch/x86/mm/srat_32.c index 1eb2973a301c..16ae70fc57e7 100644 --- a/arch/x86/mm/srat_32.c +++ b/arch/x86/mm/srat_32.c | |||
@@ -178,7 +178,7 @@ void acpi_numa_arch_fixup(void) | |||
178 | * start of the node, and that the current "end" address is after | 178 | * start of the node, and that the current "end" address is after |
179 | * the previous one. | 179 | * the previous one. |
180 | */ | 180 | */ |
181 | static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_chunk) | 181 | static __init int node_read_chunk(int nid, struct node_memory_chunk_s *memory_chunk) |
182 | { | 182 | { |
183 | /* | 183 | /* |
184 | * Only add present memory as told by the e820. | 184 | * Only add present memory as told by the e820. |
@@ -189,10 +189,10 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c | |||
189 | if (memory_chunk->start_pfn >= max_pfn) { | 189 | if (memory_chunk->start_pfn >= max_pfn) { |
190 | printk(KERN_INFO "Ignoring SRAT pfns: %08lx - %08lx\n", | 190 | printk(KERN_INFO "Ignoring SRAT pfns: %08lx - %08lx\n", |
191 | memory_chunk->start_pfn, memory_chunk->end_pfn); | 191 | memory_chunk->start_pfn, memory_chunk->end_pfn); |
192 | return; | 192 | return -1; |
193 | } | 193 | } |
194 | if (memory_chunk->nid != nid) | 194 | if (memory_chunk->nid != nid) |
195 | return; | 195 | return -1; |
196 | 196 | ||
197 | if (!node_has_online_mem(nid)) | 197 | if (!node_has_online_mem(nid)) |
198 | node_start_pfn[nid] = memory_chunk->start_pfn; | 198 | node_start_pfn[nid] = memory_chunk->start_pfn; |
@@ -202,6 +202,8 @@ static __init void node_read_chunk(int nid, struct node_memory_chunk_s *memory_c | |||
202 | 202 | ||
203 | if (node_end_pfn[nid] < memory_chunk->end_pfn) | 203 | if (node_end_pfn[nid] < memory_chunk->end_pfn) |
204 | node_end_pfn[nid] = memory_chunk->end_pfn; | 204 | node_end_pfn[nid] = memory_chunk->end_pfn; |
205 | |||
206 | return 0; | ||
205 | } | 207 | } |
206 | 208 | ||
207 | int __init get_memcfg_from_srat(void) | 209 | int __init get_memcfg_from_srat(void) |
@@ -259,7 +261,9 @@ int __init get_memcfg_from_srat(void) | |||
259 | printk(KERN_DEBUG | 261 | printk(KERN_DEBUG |
260 | "chunk %d nid %d start_pfn %08lx end_pfn %08lx\n", | 262 | "chunk %d nid %d start_pfn %08lx end_pfn %08lx\n", |
261 | j, chunk->nid, chunk->start_pfn, chunk->end_pfn); | 263 | j, chunk->nid, chunk->start_pfn, chunk->end_pfn); |
262 | node_read_chunk(chunk->nid, chunk); | 264 | if (node_read_chunk(chunk->nid, chunk)) |
265 | continue; | ||
266 | |||
263 | e820_register_active_regions(chunk->nid, chunk->start_pfn, | 267 | e820_register_active_regions(chunk->nid, chunk->start_pfn, |
264 | min(chunk->end_pfn, max_pfn)); | 268 | min(chunk->end_pfn, max_pfn)); |
265 | } | 269 | } |
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 3f90289410e6..0227694f7dab 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/moduleparam.h> | 16 | #include <linux/moduleparam.h> |
17 | #include <linux/kdebug.h> | 17 | #include <linux/kdebug.h> |
18 | #include <linux/cpu.h> | ||
18 | #include <asm/nmi.h> | 19 | #include <asm/nmi.h> |
19 | #include <asm/msr.h> | 20 | #include <asm/msr.h> |
20 | #include <asm/apic.h> | 21 | #include <asm/apic.h> |
@@ -28,23 +29,48 @@ static DEFINE_PER_CPU(unsigned long, saved_lvtpc); | |||
28 | 29 | ||
29 | static int nmi_start(void); | 30 | static int nmi_start(void); |
30 | static void nmi_stop(void); | 31 | static void nmi_stop(void); |
32 | static void nmi_cpu_start(void *dummy); | ||
33 | static void nmi_cpu_stop(void *dummy); | ||
31 | 34 | ||
32 | /* 0 == registered but off, 1 == registered and on */ | 35 | /* 0 == registered but off, 1 == registered and on */ |
33 | static int nmi_enabled = 0; | 36 | static int nmi_enabled = 0; |
34 | 37 | ||
38 | #ifdef CONFIG_SMP | ||
39 | static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action, | ||
40 | void *data) | ||
41 | { | ||
42 | int cpu = (unsigned long)data; | ||
43 | switch (action) { | ||
44 | case CPU_DOWN_FAILED: | ||
45 | case CPU_ONLINE: | ||
46 | smp_call_function_single(cpu, nmi_cpu_start, NULL, 0); | ||
47 | break; | ||
48 | case CPU_DOWN_PREPARE: | ||
49 | smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1); | ||
50 | break; | ||
51 | } | ||
52 | return NOTIFY_DONE; | ||
53 | } | ||
54 | |||
55 | static struct notifier_block oprofile_cpu_nb = { | ||
56 | .notifier_call = oprofile_cpu_notifier | ||
57 | }; | ||
58 | #endif | ||
59 | |||
35 | #ifdef CONFIG_PM | 60 | #ifdef CONFIG_PM |
36 | 61 | ||
37 | static int nmi_suspend(struct sys_device *dev, pm_message_t state) | 62 | static int nmi_suspend(struct sys_device *dev, pm_message_t state) |
38 | { | 63 | { |
64 | /* Only one CPU left, just stop that one */ | ||
39 | if (nmi_enabled == 1) | 65 | if (nmi_enabled == 1) |
40 | nmi_stop(); | 66 | nmi_cpu_stop(NULL); |
41 | return 0; | 67 | return 0; |
42 | } | 68 | } |
43 | 69 | ||
44 | static int nmi_resume(struct sys_device *dev) | 70 | static int nmi_resume(struct sys_device *dev) |
45 | { | 71 | { |
46 | if (nmi_enabled == 1) | 72 | if (nmi_enabled == 1) |
47 | nmi_start(); | 73 | nmi_cpu_start(NULL); |
48 | return 0; | 74 | return 0; |
49 | } | 75 | } |
50 | 76 | ||
@@ -463,6 +489,9 @@ int __init op_nmi_init(struct oprofile_operations *ops) | |||
463 | } | 489 | } |
464 | 490 | ||
465 | init_sysfs(); | 491 | init_sysfs(); |
492 | #ifdef CONFIG_SMP | ||
493 | register_cpu_notifier(&oprofile_cpu_nb); | ||
494 | #endif | ||
466 | using_nmi = 1; | 495 | using_nmi = 1; |
467 | ops->create_files = nmi_create_files; | 496 | ops->create_files = nmi_create_files; |
468 | ops->setup = nmi_setup; | 497 | ops->setup = nmi_setup; |
@@ -476,6 +505,10 @@ int __init op_nmi_init(struct oprofile_operations *ops) | |||
476 | 505 | ||
477 | void op_nmi_exit(void) | 506 | void op_nmi_exit(void) |
478 | { | 507 | { |
479 | if (using_nmi) | 508 | if (using_nmi) { |
480 | exit_sysfs(); | 509 | exit_sysfs(); |
510 | #ifdef CONFIG_SMP | ||
511 | unregister_cpu_notifier(&oprofile_cpu_nb); | ||
512 | #endif | ||
513 | } | ||
481 | } | 514 | } |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 19af06927fbc..1d88d2b39771 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -250,10 +250,5 @@ int __init pci_acpi_init(void) | |||
250 | acpi_pci_irq_enable(dev); | 250 | acpi_pci_irq_enable(dev); |
251 | } | 251 | } |
252 | 252 | ||
253 | #ifdef CONFIG_X86_IO_APIC | ||
254 | if (acpi_ioapic) | ||
255 | print_IO_APIC(); | ||
256 | #endif | ||
257 | |||
258 | return 0; | 253 | return 0; |
259 | } | 254 | } |
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c index dbf532369711..6a0fca78c362 100644 --- a/arch/x86/pci/amd_bus.c +++ b/arch/x86/pci/amd_bus.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/init.h> | 1 | #include <linux/init.h> |
2 | #include <linux/pci.h> | 2 | #include <linux/pci.h> |
3 | #include <linux/topology.h> | 3 | #include <linux/topology.h> |
4 | #include <linux/cpu.h> | ||
4 | #include "pci.h" | 5 | #include "pci.h" |
5 | 6 | ||
6 | #ifdef CONFIG_X86_64 | 7 | #ifdef CONFIG_X86_64 |
@@ -555,15 +556,17 @@ static int __init early_fill_mp_bus_info(void) | |||
555 | return 0; | 556 | return 0; |
556 | } | 557 | } |
557 | 558 | ||
558 | postcore_initcall(early_fill_mp_bus_info); | 559 | #else /* !CONFIG_X86_64 */ |
559 | 560 | ||
560 | #endif | 561 | static int __init early_fill_mp_bus_info(void) { return 0; } |
562 | |||
563 | #endif /* !CONFIG_X86_64 */ | ||
561 | 564 | ||
562 | /* common 32/64 bit code */ | 565 | /* common 32/64 bit code */ |
563 | 566 | ||
564 | #define ENABLE_CF8_EXT_CFG (1ULL << 46) | 567 | #define ENABLE_CF8_EXT_CFG (1ULL << 46) |
565 | 568 | ||
566 | static void enable_pci_io_ecs_per_cpu(void *unused) | 569 | static void enable_pci_io_ecs(void *unused) |
567 | { | 570 | { |
568 | u64 reg; | 571 | u64 reg; |
569 | rdmsrl(MSR_AMD64_NB_CFG, reg); | 572 | rdmsrl(MSR_AMD64_NB_CFG, reg); |
@@ -573,14 +576,51 @@ static void enable_pci_io_ecs_per_cpu(void *unused) | |||
573 | } | 576 | } |
574 | } | 577 | } |
575 | 578 | ||
576 | static int __init enable_pci_io_ecs(void) | 579 | static int __cpuinit amd_cpu_notify(struct notifier_block *self, |
580 | unsigned long action, void *hcpu) | ||
577 | { | 581 | { |
582 | int cpu = (long)hcpu; | ||
583 | switch(action) { | ||
584 | case CPU_ONLINE: | ||
585 | case CPU_ONLINE_FROZEN: | ||
586 | smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0); | ||
587 | break; | ||
588 | default: | ||
589 | break; | ||
590 | } | ||
591 | return NOTIFY_OK; | ||
592 | } | ||
593 | |||
594 | static struct notifier_block __cpuinitdata amd_cpu_notifier = { | ||
595 | .notifier_call = amd_cpu_notify, | ||
596 | }; | ||
597 | |||
598 | static int __init pci_io_ecs_init(void) | ||
599 | { | ||
600 | int cpu; | ||
601 | |||
578 | /* assume all cpus from fam10h have IO ECS */ | 602 | /* assume all cpus from fam10h have IO ECS */ |
579 | if (boot_cpu_data.x86 < 0x10) | 603 | if (boot_cpu_data.x86 < 0x10) |
580 | return 0; | 604 | return 0; |
581 | on_each_cpu(enable_pci_io_ecs_per_cpu, NULL, 1); | 605 | |
606 | register_cpu_notifier(&amd_cpu_notifier); | ||
607 | for_each_online_cpu(cpu) | ||
608 | amd_cpu_notify(&amd_cpu_notifier, (unsigned long)CPU_ONLINE, | ||
609 | (void *)(long)cpu); | ||
582 | pci_probe |= PCI_HAS_IO_ECS; | 610 | pci_probe |= PCI_HAS_IO_ECS; |
611 | |||
612 | return 0; | ||
613 | } | ||
614 | |||
615 | static int __init amd_postcore_init(void) | ||
616 | { | ||
617 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) | ||
618 | return 0; | ||
619 | |||
620 | early_fill_mp_bus_info(); | ||
621 | pci_io_ecs_init(); | ||
622 | |||
583 | return 0; | 623 | return 0; |
584 | } | 624 | } |
585 | 625 | ||
586 | postcore_initcall(enable_pci_io_ecs); | 626 | postcore_initcall(amd_postcore_init); |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index ff3a6a336342..4bdaa590375d 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -23,7 +23,8 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d) | |||
23 | pci_read_config_byte(d, reg++, &busno); | 23 | pci_read_config_byte(d, reg++, &busno); |
24 | pci_read_config_byte(d, reg++, &suba); | 24 | pci_read_config_byte(d, reg++, &suba); |
25 | pci_read_config_byte(d, reg++, &subb); | 25 | pci_read_config_byte(d, reg++, &subb); |
26 | DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); | 26 | dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, |
27 | suba, subb); | ||
27 | if (busno) | 28 | if (busno) |
28 | pci_scan_bus_with_sysdata(busno); /* Bus A */ | 29 | pci_scan_bus_with_sysdata(busno); /* Bus A */ |
29 | if (suba < subb) | 30 | if (suba < subb) |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index a09505806b82..844df0cbbd3e 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/bootmem.h> | 33 | #include <linux/bootmem.h> |
34 | 34 | ||
35 | #include <asm/pat.h> | 35 | #include <asm/pat.h> |
36 | #include <asm/e820.h> | ||
36 | 37 | ||
37 | #include "pci.h" | 38 | #include "pci.h" |
38 | 39 | ||
@@ -128,10 +129,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
128 | pr = pci_find_parent_resource(dev, r); | 129 | pr = pci_find_parent_resource(dev, r); |
129 | if (!r->start || !pr || | 130 | if (!r->start || !pr || |
130 | request_resource(pr, r) < 0) { | 131 | request_resource(pr, r) < 0) { |
131 | printk(KERN_ERR "PCI: Cannot allocate " | 132 | dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx); |
132 | "resource region %d " | ||
133 | "of bridge %s\n", | ||
134 | idx, pci_name(dev)); | ||
135 | /* | 133 | /* |
136 | * Something is wrong with the region. | 134 | * Something is wrong with the region. |
137 | * Invalidate the resource to prevent | 135 | * Invalidate the resource to prevent |
@@ -166,15 +164,13 @@ static void __init pcibios_allocate_resources(int pass) | |||
166 | else | 164 | else |
167 | disabled = !(command & PCI_COMMAND_MEMORY); | 165 | disabled = !(command & PCI_COMMAND_MEMORY); |
168 | if (pass == disabled) { | 166 | if (pass == disabled) { |
169 | DBG("PCI: Resource %08lx-%08lx " | 167 | dev_dbg(&dev->dev, "resource %#08llx-%#08llx (f=%lx, d=%d, p=%d)\n", |
170 | "(f=%lx, d=%d, p=%d)\n", | 168 | (unsigned long long) r->start, |
171 | r->start, r->end, r->flags, disabled, pass); | 169 | (unsigned long long) r->end, |
170 | r->flags, disabled, pass); | ||
172 | pr = pci_find_parent_resource(dev, r); | 171 | pr = pci_find_parent_resource(dev, r); |
173 | if (!pr || request_resource(pr, r) < 0) { | 172 | if (!pr || request_resource(pr, r) < 0) { |
174 | printk(KERN_ERR "PCI: Cannot allocate " | 173 | dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx); |
175 | "resource region %d " | ||
176 | "of device %s\n", | ||
177 | idx, pci_name(dev)); | ||
178 | /* We'll assign a new address later */ | 174 | /* We'll assign a new address later */ |
179 | r->end -= r->start; | 175 | r->end -= r->start; |
180 | r->start = 0; | 176 | r->start = 0; |
@@ -187,8 +183,7 @@ static void __init pcibios_allocate_resources(int pass) | |||
187 | /* Turn the ROM off, leave the resource region, | 183 | /* Turn the ROM off, leave the resource region, |
188 | * but keep it unregistered. */ | 184 | * but keep it unregistered. */ |
189 | u32 reg; | 185 | u32 reg; |
190 | DBG("PCI: Switching off ROM of %s\n", | 186 | dev_dbg(&dev->dev, "disabling ROM\n"); |
191 | pci_name(dev)); | ||
192 | r->flags &= ~IORESOURCE_ROM_ENABLE; | 187 | r->flags &= ~IORESOURCE_ROM_ENABLE; |
193 | pci_read_config_dword(dev, | 188 | pci_read_config_dword(dev, |
194 | dev->rom_base_reg, ®); | 189 | dev->rom_base_reg, ®); |
@@ -233,6 +228,8 @@ void __init pcibios_resource_survey(void) | |||
233 | pcibios_allocate_bus_resources(&pci_root_buses); | 228 | pcibios_allocate_bus_resources(&pci_root_buses); |
234 | pcibios_allocate_resources(0); | 229 | pcibios_allocate_resources(0); |
235 | pcibios_allocate_resources(1); | 230 | pcibios_allocate_resources(1); |
231 | |||
232 | e820_reserve_resources_late(); | ||
236 | } | 233 | } |
237 | 234 | ||
238 | /** | 235 | /** |
@@ -257,8 +254,7 @@ void pcibios_set_master(struct pci_dev *dev) | |||
257 | lat = pcibios_max_latency; | 254 | lat = pcibios_max_latency; |
258 | else | 255 | else |
259 | return; | 256 | return; |
260 | printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", | 257 | dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat); |
261 | pci_name(dev), lat); | ||
262 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); | 258 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); |
263 | } | 259 | } |
264 | 260 | ||
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index 6a06a2eb0597..8e077185e185 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -436,7 +436,7 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq) | |||
436 | { | 436 | { |
437 | WARN_ON_ONCE(pirq >= 9); | 437 | WARN_ON_ONCE(pirq >= 9); |
438 | if (pirq > 8) { | 438 | if (pirq > 8) { |
439 | printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); | 439 | dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq); |
440 | return 0; | 440 | return 0; |
441 | } | 441 | } |
442 | return read_config_nybble(router, 0x74, pirq-1); | 442 | return read_config_nybble(router, 0x74, pirq-1); |
@@ -446,7 +446,7 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, | |||
446 | { | 446 | { |
447 | WARN_ON_ONCE(pirq >= 9); | 447 | WARN_ON_ONCE(pirq >= 9); |
448 | if (pirq > 8) { | 448 | if (pirq > 8) { |
449 | printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); | 449 | dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq); |
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | write_config_nybble(router, 0x74, pirq-1, irq); | 452 | write_config_nybble(router, 0x74, pirq-1, irq); |
@@ -492,15 +492,17 @@ static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq | |||
492 | irq = 0; | 492 | irq = 0; |
493 | if (pirq <= 4) | 493 | if (pirq <= 4) |
494 | irq = read_config_nybble(router, 0x56, pirq - 1); | 494 | irq = read_config_nybble(router, 0x56, pirq - 1); |
495 | printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n", | 495 | dev_info(&dev->dev, |
496 | dev->vendor, dev->device, pirq, irq); | 496 | "AMD756: dev [%04x/%04x], router PIRQ %d get IRQ %d\n", |
497 | dev->vendor, dev->device, pirq, irq); | ||
497 | return irq; | 498 | return irq; |
498 | } | 499 | } |
499 | 500 | ||
500 | static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) | 501 | static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) |
501 | { | 502 | { |
502 | printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", | 503 | dev_info(&dev->dev, |
503 | dev->vendor, dev->device, pirq, irq); | 504 | "AMD756: dev [%04x/%04x], router PIRQ %d set IRQ %d\n", |
505 | dev->vendor, dev->device, pirq, irq); | ||
504 | if (pirq <= 4) | 506 | if (pirq <= 4) |
505 | write_config_nybble(router, 0x56, pirq - 1, irq); | 507 | write_config_nybble(router, 0x56, pirq - 1, irq); |
506 | return 1; | 508 | return 1; |
@@ -588,6 +590,8 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route | |||
588 | case PCI_DEVICE_ID_INTEL_ICH10_1: | 590 | case PCI_DEVICE_ID_INTEL_ICH10_1: |
589 | case PCI_DEVICE_ID_INTEL_ICH10_2: | 591 | case PCI_DEVICE_ID_INTEL_ICH10_2: |
590 | case PCI_DEVICE_ID_INTEL_ICH10_3: | 592 | case PCI_DEVICE_ID_INTEL_ICH10_3: |
593 | case PCI_DEVICE_ID_INTEL_PCH_0: | ||
594 | case PCI_DEVICE_ID_INTEL_PCH_1: | ||
591 | r->name = "PIIX/ICH"; | 595 | r->name = "PIIX/ICH"; |
592 | r->get = pirq_piix_get; | 596 | r->get = pirq_piix_get; |
593 | r->set = pirq_piix_set; | 597 | r->set = pirq_piix_set; |
@@ -730,7 +734,6 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, | |||
730 | switch (device) { | 734 | switch (device) { |
731 | case PCI_DEVICE_ID_AL_M1533: | 735 | case PCI_DEVICE_ID_AL_M1533: |
732 | case PCI_DEVICE_ID_AL_M1563: | 736 | case PCI_DEVICE_ID_AL_M1563: |
733 | printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n"); | ||
734 | r->name = "ALI"; | 737 | r->name = "ALI"; |
735 | r->get = pirq_ali_get; | 738 | r->get = pirq_ali_get; |
736 | r->set = pirq_ali_set; | 739 | r->set = pirq_ali_set; |
@@ -840,11 +843,9 @@ static void __init pirq_find_router(struct irq_router *r) | |||
840 | h->probe(r, pirq_router_dev, pirq_router_dev->device)) | 843 | h->probe(r, pirq_router_dev, pirq_router_dev->device)) |
841 | break; | 844 | break; |
842 | } | 845 | } |
843 | printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n", | 846 | dev_info(&pirq_router_dev->dev, "%s IRQ router [%04x/%04x]\n", |
844 | pirq_router.name, | 847 | pirq_router.name, |
845 | pirq_router_dev->vendor, | 848 | pirq_router_dev->vendor, pirq_router_dev->device); |
846 | pirq_router_dev->device, | ||
847 | pci_name(pirq_router_dev)); | ||
848 | 849 | ||
849 | /* The device remains referenced for the kernel lifetime */ | 850 | /* The device remains referenced for the kernel lifetime */ |
850 | } | 851 | } |
@@ -877,7 +878,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
877 | /* Find IRQ pin */ | 878 | /* Find IRQ pin */ |
878 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); | 879 | pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); |
879 | if (!pin) { | 880 | if (!pin) { |
880 | DBG(KERN_DEBUG " -> no interrupt pin\n"); | 881 | dev_dbg(&dev->dev, "no interrupt pin\n"); |
881 | return 0; | 882 | return 0; |
882 | } | 883 | } |
883 | pin = pin - 1; | 884 | pin = pin - 1; |
@@ -887,20 +888,20 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
887 | if (!pirq_table) | 888 | if (!pirq_table) |
888 | return 0; | 889 | return 0; |
889 | 890 | ||
890 | DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin); | ||
891 | info = pirq_get_info(dev); | 891 | info = pirq_get_info(dev); |
892 | if (!info) { | 892 | if (!info) { |
893 | DBG(" -> not found in routing table\n" KERN_DEBUG); | 893 | dev_dbg(&dev->dev, "PCI INT %c not found in routing table\n", |
894 | 'A' + pin); | ||
894 | return 0; | 895 | return 0; |
895 | } | 896 | } |
896 | pirq = info->irq[pin].link; | 897 | pirq = info->irq[pin].link; |
897 | mask = info->irq[pin].bitmap; | 898 | mask = info->irq[pin].bitmap; |
898 | if (!pirq) { | 899 | if (!pirq) { |
899 | DBG(" -> not routed\n" KERN_DEBUG); | 900 | dev_dbg(&dev->dev, "PCI INT %c not routed\n", 'A' + pin); |
900 | return 0; | 901 | return 0; |
901 | } | 902 | } |
902 | DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, | 903 | dev_dbg(&dev->dev, "PCI INT %c -> PIRQ %02x, mask %04x, excl %04x", |
903 | pirq_table->exclusive_irqs); | 904 | 'A' + pin, pirq, mask, pirq_table->exclusive_irqs); |
904 | mask &= pcibios_irq_mask; | 905 | mask &= pcibios_irq_mask; |
905 | 906 | ||
906 | /* Work around broken HP Pavilion Notebooks which assign USB to | 907 | /* Work around broken HP Pavilion Notebooks which assign USB to |
@@ -930,10 +931,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
930 | if (pci_probe & PCI_USE_PIRQ_MASK) | 931 | if (pci_probe & PCI_USE_PIRQ_MASK) |
931 | newirq = 0; | 932 | newirq = 0; |
932 | else | 933 | else |
933 | printk("\n" KERN_WARNING | 934 | dev_warn(&dev->dev, "IRQ %d doesn't match PIRQ mask " |
934 | "PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n" | 935 | "%#x; try pci=usepirqmask\n", newirq, mask); |
935 | KERN_DEBUG, newirq, | ||
936 | pci_name(dev)); | ||
937 | } | 936 | } |
938 | if (!newirq && assign) { | 937 | if (!newirq && assign) { |
939 | for (i = 0; i < 16; i++) { | 938 | for (i = 0; i < 16; i++) { |
@@ -944,39 +943,35 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
944 | newirq = i; | 943 | newirq = i; |
945 | } | 944 | } |
946 | } | 945 | } |
947 | DBG(" -> newirq=%d", newirq); | 946 | dev_dbg(&dev->dev, "PCI INT %c -> newirq %d", 'A' + pin, newirq); |
948 | 947 | ||
949 | /* Check if it is hardcoded */ | 948 | /* Check if it is hardcoded */ |
950 | if ((pirq & 0xf0) == 0xf0) { | 949 | if ((pirq & 0xf0) == 0xf0) { |
951 | irq = pirq & 0xf; | 950 | irq = pirq & 0xf; |
952 | DBG(" -> hardcoded IRQ %d\n", irq); | 951 | msg = "hardcoded"; |
953 | msg = "Hardcoded"; | ||
954 | } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ | 952 | } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ |
955 | ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) { | 953 | ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) { |
956 | DBG(" -> got IRQ %d\n", irq); | 954 | msg = "found"; |
957 | msg = "Found"; | ||
958 | eisa_set_level_irq(irq); | 955 | eisa_set_level_irq(irq); |
959 | } else if (newirq && r->set && | 956 | } else if (newirq && r->set && |
960 | (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { | 957 | (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { |
961 | DBG(" -> assigning IRQ %d", newirq); | ||
962 | if (r->set(pirq_router_dev, dev, pirq, newirq)) { | 958 | if (r->set(pirq_router_dev, dev, pirq, newirq)) { |
963 | eisa_set_level_irq(newirq); | 959 | eisa_set_level_irq(newirq); |
964 | DBG(" ... OK\n"); | 960 | msg = "assigned"; |
965 | msg = "Assigned"; | ||
966 | irq = newirq; | 961 | irq = newirq; |
967 | } | 962 | } |
968 | } | 963 | } |
969 | 964 | ||
970 | if (!irq) { | 965 | if (!irq) { |
971 | DBG(" ... failed\n"); | ||
972 | if (newirq && mask == (1 << newirq)) { | 966 | if (newirq && mask == (1 << newirq)) { |
973 | msg = "Guessed"; | 967 | msg = "guessed"; |
974 | irq = newirq; | 968 | irq = newirq; |
975 | } else | 969 | } else { |
970 | dev_dbg(&dev->dev, "can't route interrupt\n"); | ||
976 | return 0; | 971 | return 0; |
972 | } | ||
977 | } | 973 | } |
978 | printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, | 974 | dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin, irq); |
979 | pci_name(dev)); | ||
980 | 975 | ||
981 | /* Update IRQ for all devices with the same pirq value */ | 976 | /* Update IRQ for all devices with the same pirq value */ |
982 | while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { | 977 | while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { |
@@ -996,17 +991,17 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign) | |||
996 | (!(pci_probe & PCI_USE_PIRQ_MASK) || \ | 991 | (!(pci_probe & PCI_USE_PIRQ_MASK) || \ |
997 | ((1 << dev2->irq) & mask))) { | 992 | ((1 << dev2->irq) & mask))) { |
998 | #ifndef CONFIG_PCI_MSI | 993 | #ifndef CONFIG_PCI_MSI |
999 | printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", | 994 | dev_info(&dev2->dev, "IRQ routing conflict: " |
1000 | pci_name(dev2), dev2->irq, irq); | 995 | "have IRQ %d, want IRQ %d\n", |
996 | dev2->irq, irq); | ||
1001 | #endif | 997 | #endif |
1002 | continue; | 998 | continue; |
1003 | } | 999 | } |
1004 | dev2->irq = irq; | 1000 | dev2->irq = irq; |
1005 | pirq_penalty[irq]++; | 1001 | pirq_penalty[irq]++; |
1006 | if (dev != dev2) | 1002 | if (dev != dev2) |
1007 | printk(KERN_INFO | 1003 | dev_info(&dev->dev, "sharing IRQ %d with %s\n", |
1008 | "PCI: Sharing IRQ %d with %s\n", | 1004 | irq, pci_name(dev2)); |
1009 | irq, pci_name(dev2)); | ||
1010 | } | 1005 | } |
1011 | } | 1006 | } |
1012 | return 1; | 1007 | return 1; |
@@ -1025,8 +1020,7 @@ static void __init pcibios_fixup_irqs(void) | |||
1025 | * already in use. | 1020 | * already in use. |
1026 | */ | 1021 | */ |
1027 | if (dev->irq >= 16) { | 1022 | if (dev->irq >= 16) { |
1028 | DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", | 1023 | dev_dbg(&dev->dev, "ignoring bogus IRQ %d\n", dev->irq); |
1029 | pci_name(dev), dev->irq); | ||
1030 | dev->irq = 0; | 1024 | dev->irq = 0; |
1031 | } | 1025 | } |
1032 | /* | 1026 | /* |
@@ -1070,12 +1064,12 @@ static void __init pcibios_fixup_irqs(void) | |||
1070 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, | 1064 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, |
1071 | PCI_SLOT(bridge->devfn), pin); | 1065 | PCI_SLOT(bridge->devfn), pin); |
1072 | if (irq >= 0) | 1066 | if (irq >= 0) |
1073 | printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", | 1067 | dev_warn(&dev->dev, "using bridge %s INT %c to get IRQ %d\n", |
1074 | pci_name(bridge), 'A' + pin, irq); | 1068 | pci_name(bridge), |
1069 | 'A' + pin, irq); | ||
1075 | } | 1070 | } |
1076 | if (irq >= 0) { | 1071 | if (irq >= 0) { |
1077 | printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", | 1072 | dev_info(&dev->dev, "PCI->APIC IRQ transform: INT %c -> IRQ %d\n", 'A' + pin, irq); |
1078 | pci_name(dev), 'A' + pin, irq); | ||
1079 | dev->irq = irq; | 1073 | dev->irq = irq; |
1080 | } | 1074 | } |
1081 | } | 1075 | } |
@@ -1231,25 +1225,24 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1231 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, | 1225 | irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, |
1232 | PCI_SLOT(bridge->devfn), pin); | 1226 | PCI_SLOT(bridge->devfn), pin); |
1233 | if (irq >= 0) | 1227 | if (irq >= 0) |
1234 | printk(KERN_WARNING | 1228 | dev_warn(&dev->dev, "using bridge %s " |
1235 | "PCI: using PPB %s[%c] to get irq %d\n", | 1229 | "INT %c to get IRQ %d\n", |
1236 | pci_name(bridge), | 1230 | pci_name(bridge), 'A' + pin, |
1237 | 'A' + pin, irq); | 1231 | irq); |
1238 | dev = bridge; | 1232 | dev = bridge; |
1239 | } | 1233 | } |
1240 | dev = temp_dev; | 1234 | dev = temp_dev; |
1241 | if (irq >= 0) { | 1235 | if (irq >= 0) { |
1242 | printk(KERN_INFO | 1236 | dev_info(&dev->dev, "PCI->APIC IRQ transform: " |
1243 | "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", | 1237 | "INT %c -> IRQ %d\n", 'A' + pin, irq); |
1244 | pci_name(dev), 'A' + pin, irq); | ||
1245 | dev->irq = irq; | 1238 | dev->irq = irq; |
1246 | return 0; | 1239 | return 0; |
1247 | } else | 1240 | } else |
1248 | msg = " Probably buggy MP table."; | 1241 | msg = "; probably buggy MP table"; |
1249 | } else if (pci_probe & PCI_BIOS_IRQ_SCAN) | 1242 | } else if (pci_probe & PCI_BIOS_IRQ_SCAN) |
1250 | msg = ""; | 1243 | msg = ""; |
1251 | else | 1244 | else |
1252 | msg = " Please try using pci=biosirq."; | 1245 | msg = "; please try using pci=biosirq"; |
1253 | 1246 | ||
1254 | /* | 1247 | /* |
1255 | * With IDE legacy devices the IRQ lookup failure is not | 1248 | * With IDE legacy devices the IRQ lookup failure is not |
@@ -1259,9 +1252,8 @@ static int pirq_enable_irq(struct pci_dev *dev) | |||
1259 | !(dev->class & 0x5)) | 1252 | !(dev->class & 0x5)) |
1260 | return 0; | 1253 | return 0; |
1261 | 1254 | ||
1262 | printk(KERN_WARNING | 1255 | dev_warn(&dev->dev, "can't find IRQ for PCI INT %c%s\n", |
1263 | "PCI: No IRQ known for interrupt pin %c of device %s.%s\n", | 1256 | 'A' + pin, msg); |
1264 | 'A' + pin, pci_name(dev), msg); | ||
1265 | } | 1257 | } |
1266 | return 0; | 1258 | return 0; |
1267 | } | 1259 | } |
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c index ec9ce35e44d6..b722dd481b39 100644 --- a/arch/x86/pci/legacy.c +++ b/arch/x86/pci/legacy.c | |||
@@ -14,7 +14,7 @@ static void __devinit pcibios_fixup_peer_bridges(void) | |||
14 | int n, devfn; | 14 | int n, devfn; |
15 | long node; | 15 | long node; |
16 | 16 | ||
17 | if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff) | 17 | if (pcibios_last_bus <= 0 || pcibios_last_bus > 0xff) |
18 | return; | 18 | return; |
19 | DBG("PCI: Peer bridge fixup\n"); | 19 | DBG("PCI: Peer bridge fixup\n"); |
20 | 20 | ||
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 23faaa890ffc..654a2234f8f3 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -209,7 +209,7 @@ static int __init pci_mmcfg_check_hostbridge(void) | |||
209 | return name != NULL; | 209 | return name != NULL; |
210 | } | 210 | } |
211 | 211 | ||
212 | static void __init pci_mmcfg_insert_resources(unsigned long resource_flags) | 212 | static void __init pci_mmcfg_insert_resources(void) |
213 | { | 213 | { |
214 | #define PCI_MMCFG_RESOURCE_NAME_LEN 19 | 214 | #define PCI_MMCFG_RESOURCE_NAME_LEN 19 |
215 | int i; | 215 | int i; |
@@ -233,7 +233,7 @@ static void __init pci_mmcfg_insert_resources(unsigned long resource_flags) | |||
233 | cfg->pci_segment); | 233 | cfg->pci_segment); |
234 | res->start = cfg->address; | 234 | res->start = cfg->address; |
235 | res->end = res->start + (num_buses << 20) - 1; | 235 | res->end = res->start + (num_buses << 20) - 1; |
236 | res->flags = IORESOURCE_MEM | resource_flags; | 236 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
237 | insert_resource(&iomem_resource, res); | 237 | insert_resource(&iomem_resource, res); |
238 | names += PCI_MMCFG_RESOURCE_NAME_LEN; | 238 | names += PCI_MMCFG_RESOURCE_NAME_LEN; |
239 | } | 239 | } |
@@ -293,7 +293,7 @@ static acpi_status __init find_mboard_resource(acpi_handle handle, u32 lvl, | |||
293 | return AE_OK; | 293 | return AE_OK; |
294 | } | 294 | } |
295 | 295 | ||
296 | static int __init is_acpi_reserved(unsigned long start, unsigned long end) | 296 | static int __init is_acpi_reserved(u64 start, u64 end, unsigned not_used) |
297 | { | 297 | { |
298 | struct resource mcfg_res; | 298 | struct resource mcfg_res; |
299 | 299 | ||
@@ -310,6 +310,41 @@ static int __init is_acpi_reserved(unsigned long start, unsigned long end) | |||
310 | return mcfg_res.flags; | 310 | return mcfg_res.flags; |
311 | } | 311 | } |
312 | 312 | ||
313 | typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type); | ||
314 | |||
315 | static int __init is_mmconf_reserved(check_reserved_t is_reserved, | ||
316 | u64 addr, u64 size, int i, | ||
317 | typeof(pci_mmcfg_config[0]) *cfg, int with_e820) | ||
318 | { | ||
319 | u64 old_size = size; | ||
320 | int valid = 0; | ||
321 | |||
322 | while (!is_reserved(addr, addr + size - 1, E820_RESERVED)) { | ||
323 | size >>= 1; | ||
324 | if (size < (16UL<<20)) | ||
325 | break; | ||
326 | } | ||
327 | |||
328 | if (size >= (16UL<<20) || size == old_size) { | ||
329 | printk(KERN_NOTICE | ||
330 | "PCI: MCFG area at %Lx reserved in %s\n", | ||
331 | addr, with_e820?"E820":"ACPI motherboard resources"); | ||
332 | valid = 1; | ||
333 | |||
334 | if (old_size != size) { | ||
335 | /* update end_bus_number */ | ||
336 | cfg->end_bus_number = cfg->start_bus_number + ((size>>20) - 1); | ||
337 | printk(KERN_NOTICE "PCI: updated MCFG configuration %d: base %lx " | ||
338 | "segment %hu buses %u - %u\n", | ||
339 | i, (unsigned long)cfg->address, cfg->pci_segment, | ||
340 | (unsigned int)cfg->start_bus_number, | ||
341 | (unsigned int)cfg->end_bus_number); | ||
342 | } | ||
343 | } | ||
344 | |||
345 | return valid; | ||
346 | } | ||
347 | |||
313 | static void __init pci_mmcfg_reject_broken(int early) | 348 | static void __init pci_mmcfg_reject_broken(int early) |
314 | { | 349 | { |
315 | typeof(pci_mmcfg_config[0]) *cfg; | 350 | typeof(pci_mmcfg_config[0]) *cfg; |
@@ -324,21 +359,22 @@ static void __init pci_mmcfg_reject_broken(int early) | |||
324 | 359 | ||
325 | for (i = 0; i < pci_mmcfg_config_num; i++) { | 360 | for (i = 0; i < pci_mmcfg_config_num; i++) { |
326 | int valid = 0; | 361 | int valid = 0; |
327 | u32 size = (cfg->end_bus_number + 1) << 20; | 362 | u64 addr, size; |
363 | |||
328 | cfg = &pci_mmcfg_config[i]; | 364 | cfg = &pci_mmcfg_config[i]; |
365 | addr = cfg->start_bus_number; | ||
366 | addr <<= 20; | ||
367 | addr += cfg->address; | ||
368 | size = cfg->end_bus_number + 1 - cfg->start_bus_number; | ||
369 | size <<= 20; | ||
329 | printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " | 370 | printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx " |
330 | "segment %hu buses %u - %u\n", | 371 | "segment %hu buses %u - %u\n", |
331 | i, (unsigned long)cfg->address, cfg->pci_segment, | 372 | i, (unsigned long)cfg->address, cfg->pci_segment, |
332 | (unsigned int)cfg->start_bus_number, | 373 | (unsigned int)cfg->start_bus_number, |
333 | (unsigned int)cfg->end_bus_number); | 374 | (unsigned int)cfg->end_bus_number); |
334 | 375 | ||
335 | if (!early && | 376 | if (!early) |
336 | is_acpi_reserved(cfg->address, cfg->address + size - 1)) { | 377 | valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0); |
337 | printk(KERN_NOTICE "PCI: MCFG area at %Lx reserved " | ||
338 | "in ACPI motherboard resources\n", | ||
339 | cfg->address); | ||
340 | valid = 1; | ||
341 | } | ||
342 | 378 | ||
343 | if (valid) | 379 | if (valid) |
344 | continue; | 380 | continue; |
@@ -347,16 +383,11 @@ static void __init pci_mmcfg_reject_broken(int early) | |||
347 | printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" | 383 | printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" |
348 | " reserved in ACPI motherboard resources\n", | 384 | " reserved in ACPI motherboard resources\n", |
349 | cfg->address); | 385 | cfg->address); |
386 | |||
350 | /* Don't try to do this check unless configuration | 387 | /* Don't try to do this check unless configuration |
351 | type 1 is available. how about type 2 ?*/ | 388 | type 1 is available. how about type 2 ?*/ |
352 | if (raw_pci_ops && e820_all_mapped(cfg->address, | 389 | if (raw_pci_ops) |
353 | cfg->address + size - 1, | 390 | valid = is_mmconf_reserved(e820_all_mapped, addr, size, i, cfg, 1); |
354 | E820_RESERVED)) { | ||
355 | printk(KERN_NOTICE | ||
356 | "PCI: MCFG area at %Lx reserved in E820\n", | ||
357 | cfg->address); | ||
358 | valid = 1; | ||
359 | } | ||
360 | 391 | ||
361 | if (!valid) | 392 | if (!valid) |
362 | goto reject; | 393 | goto reject; |
@@ -365,7 +396,7 @@ static void __init pci_mmcfg_reject_broken(int early) | |||
365 | return; | 396 | return; |
366 | 397 | ||
367 | reject: | 398 | reject: |
368 | printk(KERN_ERR "PCI: Not using MMCONFIG.\n"); | 399 | printk(KERN_INFO "PCI: Not using MMCONFIG.\n"); |
369 | pci_mmcfg_arch_free(); | 400 | pci_mmcfg_arch_free(); |
370 | kfree(pci_mmcfg_config); | 401 | kfree(pci_mmcfg_config); |
371 | pci_mmcfg_config = NULL; | 402 | pci_mmcfg_config = NULL; |
@@ -403,11 +434,9 @@ static void __init __pci_mmcfg_init(int early) | |||
403 | (pci_mmcfg_config[0].address == 0)) | 434 | (pci_mmcfg_config[0].address == 0)) |
404 | return; | 435 | return; |
405 | 436 | ||
406 | if (pci_mmcfg_arch_init()) { | 437 | if (pci_mmcfg_arch_init()) |
407 | if (known_bridge) | ||
408 | pci_mmcfg_insert_resources(IORESOURCE_BUSY); | ||
409 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; | 438 | pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; |
410 | } else { | 439 | else { |
411 | /* | 440 | /* |
412 | * Signal not to attempt to insert mmcfg resources because | 441 | * Signal not to attempt to insert mmcfg resources because |
413 | * the architecture mmcfg setup could not initialize. | 442 | * the architecture mmcfg setup could not initialize. |
@@ -444,7 +473,7 @@ static int __init pci_mmcfg_late_insert_resources(void) | |||
444 | * marked so it won't cause request errors when __request_region is | 473 | * marked so it won't cause request errors when __request_region is |
445 | * called. | 474 | * called. |
446 | */ | 475 | */ |
447 | pci_mmcfg_insert_resources(0); | 476 | pci_mmcfg_insert_resources(); |
448 | 477 | ||
449 | return 0; | 478 | return 0; |
450 | } | 479 | } |
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c index f4b16dc11dad..1177845d3186 100644 --- a/arch/x86/pci/numaq_32.c +++ b/arch/x86/pci/numaq_32.c | |||
@@ -131,13 +131,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d) | |||
131 | u8 busno, suba, subb; | 131 | u8 busno, suba, subb; |
132 | int quad = BUS2QUAD(d->bus->number); | 132 | int quad = BUS2QUAD(d->bus->number); |
133 | 133 | ||
134 | printk("PCI: Searching for i450NX host bridges on %s\n", pci_name(d)); | 134 | dev_info(&d->dev, "searching for i450NX host bridges\n"); |
135 | reg = 0xd0; | 135 | reg = 0xd0; |
136 | for(pxb=0; pxb<2; pxb++) { | 136 | for(pxb=0; pxb<2; pxb++) { |
137 | pci_read_config_byte(d, reg++, &busno); | 137 | pci_read_config_byte(d, reg++, &busno); |
138 | pci_read_config_byte(d, reg++, &suba); | 138 | pci_read_config_byte(d, reg++, &suba); |
139 | pci_read_config_byte(d, reg++, &subb); | 139 | pci_read_config_byte(d, reg++, &subb); |
140 | DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); | 140 | dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", |
141 | pxb, busno, suba, subb); | ||
141 | if (busno) { | 142 | if (busno) { |
142 | /* Bus A */ | 143 | /* Bus A */ |
143 | pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno)); | 144 | pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno)); |
diff --git a/arch/x86/power/cpu_32.c b/arch/x86/power/cpu_32.c index 7dc5d5cf50a2..274d06082f48 100644 --- a/arch/x86/power/cpu_32.c +++ b/arch/x86/power/cpu_32.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/suspend.h> | 11 | #include <linux/suspend.h> |
12 | #include <asm/mtrr.h> | 12 | #include <asm/mtrr.h> |
13 | #include <asm/mce.h> | 13 | #include <asm/mce.h> |
14 | #include <asm/xcr.h> | ||
14 | 15 | ||
15 | static struct saved_context saved_context; | 16 | static struct saved_context saved_context; |
16 | 17 | ||
@@ -45,7 +46,7 @@ static void __save_processor_state(struct saved_context *ctxt) | |||
45 | ctxt->cr0 = read_cr0(); | 46 | ctxt->cr0 = read_cr0(); |
46 | ctxt->cr2 = read_cr2(); | 47 | ctxt->cr2 = read_cr2(); |
47 | ctxt->cr3 = read_cr3(); | 48 | ctxt->cr3 = read_cr3(); |
48 | ctxt->cr4 = read_cr4(); | 49 | ctxt->cr4 = read_cr4_safe(); |
49 | } | 50 | } |
50 | 51 | ||
51 | /* Needed by apm.c */ | 52 | /* Needed by apm.c */ |
@@ -98,7 +99,9 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
98 | /* | 99 | /* |
99 | * control registers | 100 | * control registers |
100 | */ | 101 | */ |
101 | write_cr4(ctxt->cr4); | 102 | /* cr4 was introduced in the Pentium CPU */ |
103 | if (ctxt->cr4) | ||
104 | write_cr4(ctxt->cr4); | ||
102 | write_cr3(ctxt->cr3); | 105 | write_cr3(ctxt->cr3); |
103 | write_cr2(ctxt->cr2); | 106 | write_cr2(ctxt->cr2); |
104 | write_cr0(ctxt->cr0); | 107 | write_cr0(ctxt->cr0); |
@@ -124,6 +127,12 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
124 | if (boot_cpu_has(X86_FEATURE_SEP)) | 127 | if (boot_cpu_has(X86_FEATURE_SEP)) |
125 | enable_sep_cpu(); | 128 | enable_sep_cpu(); |
126 | 129 | ||
130 | /* | ||
131 | * restore XCR0 for xsave capable cpu's. | ||
132 | */ | ||
133 | if (cpu_has_xsave) | ||
134 | xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask); | ||
135 | |||
127 | fix_processor_context(); | 136 | fix_processor_context(); |
128 | do_fpu_end(); | 137 | do_fpu_end(); |
129 | mtrr_ap_init(); | 138 | mtrr_ap_init(); |
diff --git a/arch/x86/power/cpu_64.c b/arch/x86/power/cpu_64.c index 66bdfb591fd8..e3b6cf70d62c 100644 --- a/arch/x86/power/cpu_64.c +++ b/arch/x86/power/cpu_64.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
15 | #include <asm/pgtable.h> | 15 | #include <asm/pgtable.h> |
16 | #include <asm/mtrr.h> | 16 | #include <asm/mtrr.h> |
17 | #include <asm/xcr.h> | ||
17 | 18 | ||
18 | static void fix_processor_context(void); | 19 | static void fix_processor_context(void); |
19 | 20 | ||
@@ -122,6 +123,12 @@ static void __restore_processor_state(struct saved_context *ctxt) | |||
122 | wrmsrl(MSR_GS_BASE, ctxt->gs_base); | 123 | wrmsrl(MSR_GS_BASE, ctxt->gs_base); |
123 | wrmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base); | 124 | wrmsrl(MSR_KERNEL_GS_BASE, ctxt->gs_kernel_base); |
124 | 125 | ||
126 | /* | ||
127 | * restore XCR0 for xsave capable cpu's. | ||
128 | */ | ||
129 | if (cpu_has_xsave) | ||
130 | xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask); | ||
131 | |||
125 | fix_processor_context(); | 132 | fix_processor_context(); |
126 | 133 | ||
127 | do_fpu_end(); | 134 | do_fpu_end(); |
diff --git a/arch/x86/power/hibernate_asm_32.S b/arch/x86/power/hibernate_asm_32.S index b95aa6cfe3cb..4fc7e872c85e 100644 --- a/arch/x86/power/hibernate_asm_32.S +++ b/arch/x86/power/hibernate_asm_32.S | |||
@@ -28,9 +28,9 @@ ENTRY(swsusp_arch_suspend) | |||
28 | ret | 28 | ret |
29 | 29 | ||
30 | ENTRY(restore_image) | 30 | ENTRY(restore_image) |
31 | movl resume_pg_dir, %ecx | 31 | movl resume_pg_dir, %eax |
32 | subl $__PAGE_OFFSET, %ecx | 32 | subl $__PAGE_OFFSET, %eax |
33 | movl %ecx, %cr3 | 33 | movl %eax, %cr3 |
34 | 34 | ||
35 | movl restore_pblist, %edx | 35 | movl restore_pblist, %edx |
36 | .p2align 4,,7 | 36 | .p2align 4,,7 |
@@ -52,17 +52,21 @@ copy_loop: | |||
52 | 52 | ||
53 | done: | 53 | done: |
54 | /* go back to the original page tables */ | 54 | /* go back to the original page tables */ |
55 | movl $swapper_pg_dir, %ecx | 55 | movl $swapper_pg_dir, %eax |
56 | subl $__PAGE_OFFSET, %ecx | 56 | subl $__PAGE_OFFSET, %eax |
57 | movl %ecx, %cr3 | 57 | movl %eax, %cr3 |
58 | /* Flush TLB, including "global" things (vmalloc) */ | 58 | /* Flush TLB, including "global" things (vmalloc) */ |
59 | movl mmu_cr4_features, %eax | 59 | movl mmu_cr4_features, %ecx |
60 | movl %eax, %edx | 60 | jecxz 1f # cr4 Pentium and higher, skip if zero |
61 | movl %ecx, %edx | ||
61 | andl $~(1<<7), %edx; # PGE | 62 | andl $~(1<<7), %edx; # PGE |
62 | movl %edx, %cr4; # turn off PGE | 63 | movl %edx, %cr4; # turn off PGE |
63 | movl %cr3, %ecx; # flush TLB | 64 | 1: |
64 | movl %ecx, %cr3 | 65 | movl %cr3, %eax; # flush TLB |
65 | movl %eax, %cr4; # turn PGE back on | 66 | movl %eax, %cr3 |
67 | jecxz 1f # cr4 Pentium and higher, skip if zero | ||
68 | movl %ecx, %cr4; # turn PGE back on | ||
69 | 1: | ||
66 | 70 | ||
67 | movl saved_context_esp, %esp | 71 | movl saved_context_esp, %esp |
68 | movl saved_context_ebp, %ebp | 72 | movl saved_context_ebp, %ebp |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 9ff6e3cbf08f..8d28925ebed9 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <xen/hvc-console.h> | 36 | #include <xen/hvc-console.h> |
37 | 37 | ||
38 | #include <asm/paravirt.h> | 38 | #include <asm/paravirt.h> |
39 | #include <asm/apic.h> | ||
39 | #include <asm/page.h> | 40 | #include <asm/page.h> |
40 | #include <asm/xen/hypercall.h> | 41 | #include <asm/xen/hypercall.h> |
41 | #include <asm/xen/hypervisor.h> | 42 | #include <asm/xen/hypervisor.h> |
@@ -580,16 +581,47 @@ static void xen_io_delay(void) | |||
580 | } | 581 | } |
581 | 582 | ||
582 | #ifdef CONFIG_X86_LOCAL_APIC | 583 | #ifdef CONFIG_X86_LOCAL_APIC |
583 | static u32 xen_apic_read(unsigned long reg) | 584 | static u32 xen_apic_read(u32 reg) |
584 | { | 585 | { |
585 | return 0; | 586 | return 0; |
586 | } | 587 | } |
587 | 588 | ||
588 | static void xen_apic_write(unsigned long reg, u32 val) | 589 | static void xen_apic_write(u32 reg, u32 val) |
589 | { | 590 | { |
590 | /* Warn to see if there's any stray references */ | 591 | /* Warn to see if there's any stray references */ |
591 | WARN_ON(1); | 592 | WARN_ON(1); |
592 | } | 593 | } |
594 | |||
595 | static u64 xen_apic_icr_read(void) | ||
596 | { | ||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | static void xen_apic_icr_write(u32 low, u32 id) | ||
601 | { | ||
602 | /* Warn to see if there's any stray references */ | ||
603 | WARN_ON(1); | ||
604 | } | ||
605 | |||
606 | static void xen_apic_wait_icr_idle(void) | ||
607 | { | ||
608 | return; | ||
609 | } | ||
610 | |||
611 | static u32 xen_safe_apic_wait_icr_idle(void) | ||
612 | { | ||
613 | return 0; | ||
614 | } | ||
615 | |||
616 | static struct apic_ops xen_basic_apic_ops = { | ||
617 | .read = xen_apic_read, | ||
618 | .write = xen_apic_write, | ||
619 | .icr_read = xen_apic_icr_read, | ||
620 | .icr_write = xen_apic_icr_write, | ||
621 | .wait_icr_idle = xen_apic_wait_icr_idle, | ||
622 | .safe_wait_icr_idle = xen_safe_apic_wait_icr_idle, | ||
623 | }; | ||
624 | |||
593 | #endif | 625 | #endif |
594 | 626 | ||
595 | static void xen_flush_tlb(void) | 627 | static void xen_flush_tlb(void) |
@@ -1273,8 +1305,6 @@ static const struct pv_irq_ops xen_irq_ops __initdata = { | |||
1273 | 1305 | ||
1274 | static const struct pv_apic_ops xen_apic_ops __initdata = { | 1306 | static const struct pv_apic_ops xen_apic_ops __initdata = { |
1275 | #ifdef CONFIG_X86_LOCAL_APIC | 1307 | #ifdef CONFIG_X86_LOCAL_APIC |
1276 | .apic_write = xen_apic_write, | ||
1277 | .apic_read = xen_apic_read, | ||
1278 | .setup_boot_clock = paravirt_nop, | 1308 | .setup_boot_clock = paravirt_nop, |
1279 | .setup_secondary_clock = paravirt_nop, | 1309 | .setup_secondary_clock = paravirt_nop, |
1280 | .startup_ipi_hook = paravirt_nop, | 1310 | .startup_ipi_hook = paravirt_nop, |
@@ -1677,6 +1707,13 @@ asmlinkage void __init xen_start_kernel(void) | |||
1677 | pv_apic_ops = xen_apic_ops; | 1707 | pv_apic_ops = xen_apic_ops; |
1678 | pv_mmu_ops = xen_mmu_ops; | 1708 | pv_mmu_ops = xen_mmu_ops; |
1679 | 1709 | ||
1710 | #ifdef CONFIG_X86_LOCAL_APIC | ||
1711 | /* | ||
1712 | * set up the basic apic ops. | ||
1713 | */ | ||
1714 | apic_ops = &xen_basic_apic_ops; | ||
1715 | #endif | ||
1716 | |||
1680 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { | 1717 | if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { |
1681 | pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; | 1718 | pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; |
1682 | pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; | 1719 | pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; |