aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-04-26 04:31:28 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-04-26 04:31:28 -0400
commitef2e58ea6b9931c3a4816c66593da49bb20e3b24 (patch)
treece7432add3becbe78de4ea06425cd2d9e91f4ada /arch/i386
parent06d63cc51d47f572009138a7f3ac34d95773405d (diff)
parentde46c33745f5e2ad594c72f2cf5f490861b16ce1 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/boot/video.S14
-rw-r--r--arch/i386/defconfig43
-rw-r--r--arch/i386/kernel/alternative.c21
-rw-r--r--arch/i386/kernel/apic.c117
-rw-r--r--arch/i386/kernel/cpu/amd.c34
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c2
-rw-r--r--arch/i386/kernel/hpet.c70
-rw-r--r--arch/i386/kernel/i386_ksyms.c2
-rw-r--r--arch/i386/kernel/i8253.c10
-rw-r--r--arch/i386/kernel/io_apic.c2
-rw-r--r--arch/i386/kernel/microcode.c71
-rw-r--r--arch/i386/kernel/nmi.c146
-rw-r--r--arch/i386/kernel/tsc.c9
-rw-r--r--arch/i386/kernel/vmi.c49
-rw-r--r--arch/i386/kernel/vmlinux.lds.S2
-rw-r--r--arch/i386/lib/usercopy.c9
-rw-r--r--arch/i386/mm/highmem.c2
-rw-r--r--arch/i386/pci/common.c14
19 files changed, 468 insertions, 151 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 27e8453274e6..53d62373a524 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -220,7 +220,7 @@ config PARAVIRT
220 220
221config VMI 221config VMI
222 bool "VMI Paravirt-ops support" 222 bool "VMI Paravirt-ops support"
223 depends on PARAVIRT 223 depends on PARAVIRT && !COMPAT_VDSO
224 help 224 help
225 VMI provides a paravirtualized interface to the VMware ESX server 225 VMI provides a paravirtualized interface to the VMware ESX server
226 (it could be used by other hypervisors in theory too, but is not 226 (it could be used by other hypervisors in theory too, but is not
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 2c5b5cc55f79..8143c9516cb4 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -571,6 +571,16 @@ setr1: lodsw
571 jmp _m_s 571 jmp _m_s
572 572
573check_vesa: 573check_vesa:
574#ifdef CONFIG_FIRMWARE_EDID
575 leaw modelist+1024, %di
576 movw $0x4f00, %ax
577 int $0x10
578 cmpw $0x004f, %ax
579 jnz setbad
580
581 movw 4(%di), %ax
582 movw %ax, vbe_version
583#endif
574 leaw modelist+1024, %di 584 leaw modelist+1024, %di
575 subb $VIDEO_FIRST_VESA>>8, %bh 585 subb $VIDEO_FIRST_VESA>>8, %bh
576 movw %bx, %cx # Get mode information structure 586 movw %bx, %cx # Get mode information structure
@@ -1945,6 +1955,9 @@ store_edid:
1945 rep 1955 rep
1946 stosl 1956 stosl
1947 1957
1958 cmpw $0x0200, vbe_version # only do EDID on >= VBE2.0
1959 jl no_edid
1960
1948 pushw %es # save ES 1961 pushw %es # save ES
1949 xorw %di, %di # Report Capability 1962 xorw %di, %di # Report Capability
1950 pushw %di 1963 pushw %di
@@ -1987,6 +2000,7 @@ do_restore: .byte 0 # Screen contents altered during mode change
1987svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes 2000svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes
1988graphic_mode: .byte 0 # Graphic mode with a linear frame buffer 2001graphic_mode: .byte 0 # Graphic mode with a linear frame buffer
1989dac_size: .byte 6 # DAC bit depth 2002dac_size: .byte 6 # DAC bit depth
2003vbe_version: .word 0 # VBE bios version
1990 2004
1991# Status messages 2005# Status messages
1992keymsg: .ascii "Press <RETURN> to see video modes available, " 2006keymsg: .ascii "Press <RETURN> to see video modes available, "
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 5ae1e0bc8fd7..f4efd66e1ee5 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1,10 +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.20-git8 3# Linux kernel version: 2.6.21-rc3
4# Tue Feb 13 11:25:18 2007 4# Wed Mar 7 15:29:47 2007
5# 5#
6CONFIG_X86_32=y 6CONFIG_X86_32=y
7CONFIG_GENERIC_TIME=y 7CONFIG_GENERIC_TIME=y
8CONFIG_CLOCKSOURCE_WATCHDOG=y
9CONFIG_GENERIC_CLOCKEVENTS=y
10CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
8CONFIG_LOCKDEP_SUPPORT=y 11CONFIG_LOCKDEP_SUPPORT=y
9CONFIG_STACKTRACE_SUPPORT=y 12CONFIG_STACKTRACE_SUPPORT=y
10CONFIG_SEMAPHORE_SLEEPERS=y 13CONFIG_SEMAPHORE_SLEEPERS=y
@@ -34,6 +37,7 @@ CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SWAP=y 37CONFIG_SWAP=y
35CONFIG_SYSVIPC=y 38CONFIG_SYSVIPC=y
36# CONFIG_IPC_NS is not set 39# CONFIG_IPC_NS is not set
40CONFIG_SYSVIPC_SYSCTL=y
37CONFIG_POSIX_MQUEUE=y 41CONFIG_POSIX_MQUEUE=y
38# CONFIG_BSD_PROCESS_ACCT is not set 42# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 43# CONFIG_TASKSTATS is not set
@@ -44,6 +48,7 @@ CONFIG_IKCONFIG_PROC=y
44# CONFIG_CPUSETS is not set 48# CONFIG_CPUSETS is not set
45CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
51CONFIG_BLK_DEV_INITRD=y
47CONFIG_INITRAMFS_SOURCE="" 52CONFIG_INITRAMFS_SOURCE=""
48CONFIG_CC_OPTIMIZE_FOR_SIZE=y 53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
49CONFIG_SYSCTL=y 54CONFIG_SYSCTL=y
@@ -103,6 +108,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
103# 108#
104# Processor type and features 109# Processor type and features
105# 110#
111# CONFIG_TICK_ONESHOT is not set
112# CONFIG_NO_HZ is not set
113# CONFIG_HIGH_RES_TIMERS is not set
106CONFIG_SMP=y 114CONFIG_SMP=y
107# CONFIG_X86_PC is not set 115# CONFIG_X86_PC is not set
108# CONFIG_X86_ELAN is not set 116# CONFIG_X86_ELAN is not set
@@ -235,10 +243,8 @@ CONFIG_ACPI_PROCFS=y
235CONFIG_ACPI_AC=y 243CONFIG_ACPI_AC=y
236CONFIG_ACPI_BATTERY=y 244CONFIG_ACPI_BATTERY=y
237CONFIG_ACPI_BUTTON=y 245CONFIG_ACPI_BUTTON=y
238# CONFIG_ACPI_HOTKEY is not set
239CONFIG_ACPI_FAN=y 246CONFIG_ACPI_FAN=y
240# CONFIG_ACPI_DOCK is not set 247# CONFIG_ACPI_DOCK is not set
241# CONFIG_ACPI_BAY is not set
242CONFIG_ACPI_PROCESSOR=y 248CONFIG_ACPI_PROCESSOR=y
243CONFIG_ACPI_THERMAL=y 249CONFIG_ACPI_THERMAL=y
244# CONFIG_ACPI_ASUS is not set 250# CONFIG_ACPI_ASUS is not set
@@ -289,6 +295,7 @@ CONFIG_X86_POWERNOW_K8_ACPI=y
289# CONFIG_X86_CPUFREQ_NFORCE2 is not set 295# CONFIG_X86_CPUFREQ_NFORCE2 is not set
290# CONFIG_X86_LONGRUN is not set 296# CONFIG_X86_LONGRUN is not set
291# CONFIG_X86_LONGHAUL is not set 297# CONFIG_X86_LONGHAUL is not set
298# CONFIG_X86_E_POWERSAVER is not set
292 299
293# 300#
294# shared options 301# shared options
@@ -368,7 +375,7 @@ CONFIG_IP_PNP_DHCP=y
368# CONFIG_INET_ESP is not set 375# CONFIG_INET_ESP is not set
369# CONFIG_INET_IPCOMP is not set 376# CONFIG_INET_IPCOMP is not set
370# CONFIG_INET_XFRM_TUNNEL is not set 377# CONFIG_INET_XFRM_TUNNEL is not set
371# CONFIG_INET_TUNNEL is not set 378CONFIG_INET_TUNNEL=y
372CONFIG_INET_XFRM_MODE_TRANSPORT=y 379CONFIG_INET_XFRM_MODE_TRANSPORT=y
373CONFIG_INET_XFRM_MODE_TUNNEL=y 380CONFIG_INET_XFRM_MODE_TUNNEL=y
374# CONFIG_INET_XFRM_MODE_BEET is not set 381# CONFIG_INET_XFRM_MODE_BEET is not set
@@ -470,7 +477,13 @@ CONFIG_FW_LOADER=y
470# 477#
471# Plug and Play support 478# Plug and Play support
472# 479#
473# CONFIG_PNP is not set 480CONFIG_PNP=y
481# CONFIG_PNP_DEBUG is not set
482
483#
484# Protocols
485#
486CONFIG_PNPACPI=y
474 487
475# 488#
476# Block devices 489# Block devices
@@ -490,7 +503,6 @@ CONFIG_BLK_DEV_RAM=y
490CONFIG_BLK_DEV_RAM_COUNT=16 503CONFIG_BLK_DEV_RAM_COUNT=16
491CONFIG_BLK_DEV_RAM_SIZE=4096 504CONFIG_BLK_DEV_RAM_SIZE=4096
492CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 505CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
493CONFIG_BLK_DEV_INITRD=y
494# CONFIG_CDROM_PKTCDVD is not set 506# CONFIG_CDROM_PKTCDVD is not set
495# CONFIG_ATA_OVER_ETH is not set 507# CONFIG_ATA_OVER_ETH is not set
496 508
@@ -500,6 +512,7 @@ CONFIG_BLK_DEV_INITRD=y
500# CONFIG_IBM_ASM is not set 512# CONFIG_IBM_ASM is not set
501# CONFIG_SGI_IOC4 is not set 513# CONFIG_SGI_IOC4 is not set
502# CONFIG_TIFM_CORE is not set 514# CONFIG_TIFM_CORE is not set
515# CONFIG_SONY_LAPTOP is not set
503 516
504# 517#
505# ATA/ATAPI/MFM/RLL support 518# ATA/ATAPI/MFM/RLL support
@@ -526,6 +539,7 @@ CONFIG_BLK_DEV_IDEACPI=y
526# 539#
527CONFIG_IDE_GENERIC=y 540CONFIG_IDE_GENERIC=y
528# CONFIG_BLK_DEV_CMD640 is not set 541# CONFIG_BLK_DEV_CMD640 is not set
542# CONFIG_BLK_DEV_IDEPNP is not set
529CONFIG_BLK_DEV_IDEPCI=y 543CONFIG_BLK_DEV_IDEPCI=y
530# CONFIG_IDEPCI_SHARE_IRQ is not set 544# CONFIG_IDEPCI_SHARE_IRQ is not set
531# CONFIG_BLK_DEV_OFFBOARD is not set 545# CONFIG_BLK_DEV_OFFBOARD is not set
@@ -679,6 +693,7 @@ CONFIG_SATA_VIA=y
679# CONFIG_SATA_VITESSE is not set 693# CONFIG_SATA_VITESSE is not set
680# CONFIG_SATA_INIC162X is not set 694# CONFIG_SATA_INIC162X is not set
681CONFIG_SATA_INTEL_COMBINED=y 695CONFIG_SATA_INTEL_COMBINED=y
696CONFIG_SATA_ACPI=y
682# CONFIG_PATA_ALI is not set 697# CONFIG_PATA_ALI is not set
683# CONFIG_PATA_AMD is not set 698# CONFIG_PATA_AMD is not set
684# CONFIG_PATA_ARTOP is not set 699# CONFIG_PATA_ARTOP is not set
@@ -786,6 +801,7 @@ CONFIG_NETDEVICES=y
786# CONFIG_BONDING is not set 801# CONFIG_BONDING is not set
787# CONFIG_EQUALIZER is not set 802# CONFIG_EQUALIZER is not set
788# CONFIG_TUN is not set 803# CONFIG_TUN is not set
804# CONFIG_NET_SB1000 is not set
789 805
790# 806#
791# ARCnet devices 807# ARCnet devices
@@ -979,6 +995,7 @@ CONFIG_HW_CONSOLE=y
979CONFIG_SERIAL_8250=y 995CONFIG_SERIAL_8250=y
980CONFIG_SERIAL_8250_CONSOLE=y 996CONFIG_SERIAL_8250_CONSOLE=y
981CONFIG_SERIAL_8250_PCI=y 997CONFIG_SERIAL_8250_PCI=y
998CONFIG_SERIAL_8250_PNP=y
982CONFIG_SERIAL_8250_NR_UARTS=4 999CONFIG_SERIAL_8250_NR_UARTS=4
983CONFIG_SERIAL_8250_RUNTIME_UARTS=4 1000CONFIG_SERIAL_8250_RUNTIME_UARTS=4
984# CONFIG_SERIAL_8250_EXTENDED is not set 1001# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -1065,6 +1082,11 @@ CONFIG_HANGCHECK_TIMER=y
1065# CONFIG_HWMON_VID is not set 1082# CONFIG_HWMON_VID is not set
1066 1083
1067# 1084#
1085# Multifunction device drivers
1086#
1087# CONFIG_MFD_SM501 is not set
1088
1089#
1068# Multimedia devices 1090# Multimedia devices
1069# 1091#
1070# CONFIG_VIDEO_DEV is not set 1092# CONFIG_VIDEO_DEV is not set
@@ -1078,7 +1100,7 @@ CONFIG_HANGCHECK_TIMER=y
1078# 1100#
1079# Graphics support 1101# Graphics support
1080# 1102#
1081CONFIG_FIRMWARE_EDID=y 1103# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1082# CONFIG_FB is not set 1104# CONFIG_FB is not set
1083 1105
1084# 1106#
@@ -1089,7 +1111,6 @@ CONFIG_VGACON_SOFT_SCROLLBACK=y
1089CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128 1111CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128
1090CONFIG_VIDEO_SELECT=y 1112CONFIG_VIDEO_SELECT=y
1091CONFIG_DUMMY_CONSOLE=y 1113CONFIG_DUMMY_CONSOLE=y
1092# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1093 1114
1094# 1115#
1095# Sound 1116# Sound
@@ -1238,6 +1259,7 @@ CONFIG_USB_MON=y
1238# CONFIG_USB_RIO500 is not set 1259# CONFIG_USB_RIO500 is not set
1239# CONFIG_USB_LEGOTOWER is not set 1260# CONFIG_USB_LEGOTOWER is not set
1240# CONFIG_USB_LCD is not set 1261# CONFIG_USB_LCD is not set
1262# CONFIG_USB_BERRY_CHARGE is not set
1241# CONFIG_USB_LED is not set 1263# CONFIG_USB_LED is not set
1242# CONFIG_USB_CYPRESS_CY7C63 is not set 1264# CONFIG_USB_CYPRESS_CY7C63 is not set
1243# CONFIG_USB_CYTHERM is not set 1265# CONFIG_USB_CYTHERM is not set
@@ -1248,6 +1270,7 @@ CONFIG_USB_MON=y
1248# CONFIG_USB_SISUSBVGA is not set 1270# CONFIG_USB_SISUSBVGA is not set
1249# CONFIG_USB_LD is not set 1271# CONFIG_USB_LD is not set
1250# CONFIG_USB_TRANCEVIBRATOR is not set 1272# CONFIG_USB_TRANCEVIBRATOR is not set
1273# CONFIG_USB_IOWARRIOR is not set
1251# CONFIG_USB_TEST is not set 1274# CONFIG_USB_TEST is not set
1252 1275
1253# 1276#
@@ -1506,6 +1529,7 @@ CONFIG_DEBUG_KERNEL=y
1506CONFIG_LOG_BUF_SHIFT=18 1529CONFIG_LOG_BUF_SHIFT=18
1507CONFIG_DETECT_SOFTLOCKUP=y 1530CONFIG_DETECT_SOFTLOCKUP=y
1508# CONFIG_SCHEDSTATS is not set 1531# CONFIG_SCHEDSTATS is not set
1532# CONFIG_TIMER_STATS is not set
1509# CONFIG_DEBUG_SLAB is not set 1533# CONFIG_DEBUG_SLAB is not set
1510# CONFIG_DEBUG_RT_MUTEXES is not set 1534# CONFIG_DEBUG_RT_MUTEXES is not set
1511# CONFIG_RT_MUTEX_TESTER is not set 1535# CONFIG_RT_MUTEX_TESTER is not set
@@ -1525,6 +1549,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1525# CONFIG_FORCED_INLINING is not set 1549# CONFIG_FORCED_INLINING is not set
1526# CONFIG_RCU_TORTURE_TEST is not set 1550# CONFIG_RCU_TORTURE_TEST is not set
1527# CONFIG_LKDTM is not set 1551# CONFIG_LKDTM is not set
1552# CONFIG_FAULT_INJECTION is not set
1528CONFIG_EARLY_PRINTK=y 1553CONFIG_EARLY_PRINTK=y
1529CONFIG_DEBUG_STACKOVERFLOW=y 1554CONFIG_DEBUG_STACKOVERFLOW=y
1530# CONFIG_DEBUG_STACK_USAGE is not set 1555# CONFIG_DEBUG_STACK_USAGE is not set
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 9eca21b49f6b..426f59b0106b 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -5,15 +5,9 @@
5#include <asm/alternative.h> 5#include <asm/alternative.h>
6#include <asm/sections.h> 6#include <asm/sections.h>
7 7
8static int no_replacement = 0;
9static int smp_alt_once = 0; 8static int smp_alt_once = 0;
10static int debug_alternative = 0; 9static int debug_alternative = 0;
11 10
12static int __init noreplacement_setup(char *s)
13{
14 no_replacement = 1;
15 return 1;
16}
17static int __init bootonly(char *str) 11static int __init bootonly(char *str)
18{ 12{
19 smp_alt_once = 1; 13 smp_alt_once = 1;
@@ -25,7 +19,6 @@ static int __init debug_alt(char *str)
25 return 1; 19 return 1;
26} 20}
27 21
28__setup("noreplacement", noreplacement_setup);
29__setup("smp-alt-boot", bootonly); 22__setup("smp-alt-boot", bootonly);
30__setup("debug-alternative", debug_alt); 23__setup("debug-alternative", debug_alt);
31 24
@@ -252,9 +245,6 @@ void alternatives_smp_module_add(struct module *mod, char *name,
252 struct smp_alt_module *smp; 245 struct smp_alt_module *smp;
253 unsigned long flags; 246 unsigned long flags;
254 247
255 if (no_replacement)
256 return;
257
258 if (smp_alt_once) { 248 if (smp_alt_once) {
259 if (boot_cpu_has(X86_FEATURE_UP)) 249 if (boot_cpu_has(X86_FEATURE_UP))
260 alternatives_smp_unlock(locks, locks_end, 250 alternatives_smp_unlock(locks, locks_end,
@@ -289,7 +279,7 @@ void alternatives_smp_module_del(struct module *mod)
289 struct smp_alt_module *item; 279 struct smp_alt_module *item;
290 unsigned long flags; 280 unsigned long flags;
291 281
292 if (no_replacement || smp_alt_once) 282 if (smp_alt_once)
293 return; 283 return;
294 284
295 spin_lock_irqsave(&smp_alt, flags); 285 spin_lock_irqsave(&smp_alt, flags);
@@ -320,7 +310,7 @@ void alternatives_smp_switch(int smp)
320 return; 310 return;
321#endif 311#endif
322 312
323 if (no_replacement || smp_alt_once) 313 if (smp_alt_once)
324 return; 314 return;
325 BUG_ON(!smp && (num_online_cpus() > 1)); 315 BUG_ON(!smp && (num_online_cpus() > 1));
326 316
@@ -386,13 +376,6 @@ extern struct paravirt_patch __start_parainstructions[],
386void __init alternative_instructions(void) 376void __init alternative_instructions(void)
387{ 377{
388 unsigned long flags; 378 unsigned long flags;
389 if (no_replacement) {
390 printk(KERN_INFO "(SMP-)alternatives turned off\n");
391 free_init_pages("SMP alternatives",
392 (unsigned long)__smp_alt_begin,
393 (unsigned long)__smp_alt_end);
394 return;
395 }
396 379
397 local_irq_save(flags); 380 local_irq_save(flags);
398 apply_alternatives(__alt_instructions, __alt_instructions_end); 381 apply_alternatives(__alt_instructions, __alt_instructions_end);
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 2383bcf18c5d..93aa911646ad 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -28,6 +28,7 @@
28#include <linux/clockchips.h> 28#include <linux/clockchips.h>
29#include <linux/acpi_pmtmr.h> 29#include <linux/acpi_pmtmr.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/dmi.h>
31 32
32#include <asm/atomic.h> 33#include <asm/atomic.h>
33#include <asm/smp.h> 34#include <asm/smp.h>
@@ -61,6 +62,11 @@ static int enable_local_apic __initdata = 0;
61 62
62/* Local APIC timer verification ok */ 63/* Local APIC timer verification ok */
63static int local_apic_timer_verify_ok; 64static int local_apic_timer_verify_ok;
65/* Disable local APIC timer from the kernel commandline or via dmi quirk */
66static int local_apic_timer_disabled;
67/* Local APIC timer works in C2 */
68int local_apic_timer_c2_ok;
69EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
64 70
65/* 71/*
66 * Debug level, exported for io_apic.c 72 * Debug level, exported for io_apic.c
@@ -338,6 +344,23 @@ void __init setup_boot_APIC_clock(void)
338 void (*real_handler)(struct clock_event_device *dev); 344 void (*real_handler)(struct clock_event_device *dev);
339 unsigned long deltaj; 345 unsigned long deltaj;
340 long delta, deltapm; 346 long delta, deltapm;
347 int pm_referenced = 0;
348
349 if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
350 local_apic_timer_disabled = 1;
351
352 /*
353 * The local apic timer can be disabled via the kernel
354 * commandline or from the test above. Register the lapic
355 * timer as a dummy clock event source on SMP systems, so the
356 * broadcast mechanism is used. On UP systems simply ignore it.
357 */
358 if (local_apic_timer_disabled) {
359 /* No broadcast on UP ! */
360 if (num_possible_cpus() > 1)
361 setup_APIC_timer();
362 return;
363 }
341 364
342 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n" 365 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
343 "calibrating APIC timer ...\n"); 366 "calibrating APIC timer ...\n");
@@ -357,7 +380,8 @@ void __init setup_boot_APIC_clock(void)
357 /* Let the interrupts run */ 380 /* Let the interrupts run */
358 local_irq_enable(); 381 local_irq_enable();
359 382
360 while(lapic_cal_loops <= LAPIC_CAL_LOOPS); 383 while (lapic_cal_loops <= LAPIC_CAL_LOOPS)
384 cpu_relax();
361 385
362 local_irq_disable(); 386 local_irq_disable();
363 387
@@ -394,6 +418,7 @@ void __init setup_boot_APIC_clock(void)
394 "%lu (%ld)\n", (unsigned long) res, delta); 418 "%lu (%ld)\n", (unsigned long) res, delta);
395 delta = (long) res; 419 delta = (long) res;
396 } 420 }
421 pm_referenced = 1;
397 } 422 }
398 423
399 /* Calculate the scaled math multiplication factor */ 424 /* Calculate the scaled math multiplication factor */
@@ -423,69 +448,43 @@ void __init setup_boot_APIC_clock(void)
423 calibration_result / (1000000 / HZ), 448 calibration_result / (1000000 / HZ),
424 calibration_result % (1000000 / HZ)); 449 calibration_result % (1000000 / HZ));
425 450
426
427 apic_printk(APIC_VERBOSE, "... verify APIC timer\n");
428
429 /*
430 * Setup the apic timer manually
431 */
432 local_apic_timer_verify_ok = 1; 451 local_apic_timer_verify_ok = 1;
433 levt->event_handler = lapic_cal_handler;
434 lapic_timer_setup(CLOCK_EVT_MODE_PERIODIC, levt);
435 lapic_cal_loops = -1;
436 452
437 /* Let the interrupts run */ 453 /* We trust the pm timer based calibration */
438 local_irq_enable(); 454 if (!pm_referenced) {
455 apic_printk(APIC_VERBOSE, "... verify APIC timer\n");
439 456
440 while(lapic_cal_loops <= LAPIC_CAL_LOOPS); 457 /*
458 * Setup the apic timer manually
459 */
460 levt->event_handler = lapic_cal_handler;
461 lapic_timer_setup(CLOCK_EVT_MODE_PERIODIC, levt);
462 lapic_cal_loops = -1;
441 463
442 local_irq_disable(); 464 /* Let the interrupts run */
465 local_irq_enable();
443 466
444 /* Stop the lapic timer */ 467 while(lapic_cal_loops <= LAPIC_CAL_LOOPS)
445 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, levt); 468 cpu_relax();
446 469
447 local_irq_enable(); 470 local_irq_disable();
448 471
449 /* Jiffies delta */ 472 /* Stop the lapic timer */
450 deltaj = lapic_cal_j2 - lapic_cal_j1; 473 lapic_timer_setup(CLOCK_EVT_MODE_SHUTDOWN, levt);
451 apic_printk(APIC_VERBOSE, "... jiffies delta = %lu\n", deltaj);
452 474
453 /* Check, if the PM timer is available */ 475 local_irq_enable();
454 deltapm = lapic_cal_pm2 - lapic_cal_pm1;
455 apic_printk(APIC_VERBOSE, "... PM timer delta = %ld\n", deltapm);
456 476
457 local_apic_timer_verify_ok = 0; 477 /* Jiffies delta */
478 deltaj = lapic_cal_j2 - lapic_cal_j1;
479 apic_printk(APIC_VERBOSE, "... jiffies delta = %lu\n", deltaj);
458 480
459 if (deltapm) {
460 if (deltapm > (pm_100ms - pm_thresh) &&
461 deltapm < (pm_100ms + pm_thresh)) {
462 apic_printk(APIC_VERBOSE, "... PM timer result ok\n");
463 /* Check, if the jiffies result is consistent */
464 if (deltaj < LAPIC_CAL_LOOPS-2 ||
465 deltaj > LAPIC_CAL_LOOPS+2) {
466 /*
467 * Not sure, what we can do about this one.
468 * When high resultion timers are active
469 * and the lapic timer does not stop in C3
470 * we are fine. Otherwise more trouble might
471 * be waiting. -- tglx
472 */
473 printk(KERN_WARNING "Global event device %s "
474 "has wrong frequency "
475 "(%lu ticks instead of %d)\n",
476 global_clock_event->name, deltaj,
477 LAPIC_CAL_LOOPS);
478 }
479 local_apic_timer_verify_ok = 1;
480 }
481 } else {
482 /* Check, if the jiffies result is consistent */ 481 /* Check, if the jiffies result is consistent */
483 if (deltaj >= LAPIC_CAL_LOOPS-2 && 482 if (deltaj >= LAPIC_CAL_LOOPS-2 && deltaj <= LAPIC_CAL_LOOPS+2)
484 deltaj <= LAPIC_CAL_LOOPS+2) {
485 apic_printk(APIC_VERBOSE, "... jiffies result ok\n"); 483 apic_printk(APIC_VERBOSE, "... jiffies result ok\n");
486 local_apic_timer_verify_ok = 1; 484 else
487 } 485 local_apic_timer_verify_ok = 0;
488 } 486 } else
487 local_irq_enable();
489 488
490 if (!local_apic_timer_verify_ok) { 489 if (!local_apic_timer_verify_ok) {
491 printk(KERN_WARNING 490 printk(KERN_WARNING
@@ -1203,6 +1202,20 @@ static int __init parse_nolapic(char *arg)
1203} 1202}
1204early_param("nolapic", parse_nolapic); 1203early_param("nolapic", parse_nolapic);
1205 1204
1205static int __init parse_disable_lapic_timer(char *arg)
1206{
1207 local_apic_timer_disabled = 1;
1208 return 0;
1209}
1210early_param("nolapic_timer", parse_disable_lapic_timer);
1211
1212static int __init parse_lapic_timer_c2_ok(char *arg)
1213{
1214 local_apic_timer_c2_ok = 1;
1215 return 0;
1216}
1217early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1218
1206static int __init apic_set_verbosity(char *str) 1219static int __init apic_set_verbosity(char *str)
1207{ 1220{
1208 if (strcmp("debug", str) == 0) 1221 if (strcmp("debug", str) == 0)
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index 41cfea57232b..2d47db482972 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -22,6 +22,37 @@
22extern void vide(void); 22extern void vide(void);
23__asm__(".align 4\nvide: ret"); 23__asm__(".align 4\nvide: ret");
24 24
25#define ENABLE_C1E_MASK 0x18000000
26#define CPUID_PROCESSOR_SIGNATURE 1
27#define CPUID_XFAM 0x0ff00000
28#define CPUID_XFAM_K8 0x00000000
29#define CPUID_XFAM_10H 0x00100000
30#define CPUID_XFAM_11H 0x00200000
31#define CPUID_XMOD 0x000f0000
32#define CPUID_XMOD_REV_F 0x00040000
33
34/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
35static __cpuinit int amd_apic_timer_broken(void)
36{
37 u32 lo, hi;
38 u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
39 switch (eax & CPUID_XFAM) {
40 case CPUID_XFAM_K8:
41 if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
42 break;
43 case CPUID_XFAM_10H:
44 case CPUID_XFAM_11H:
45 rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
46 if (lo & ENABLE_C1E_MASK)
47 return 1;
48 break;
49 default:
50 /* err on the side of caution */
51 return 1;
52 }
53 return 0;
54}
55
25static void __cpuinit init_amd(struct cpuinfo_x86 *c) 56static void __cpuinit init_amd(struct cpuinfo_x86 *c)
26{ 57{
27 u32 l, h; 58 u32 l, h;
@@ -241,6 +272,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
241 272
242 if (cpuid_eax(0x80000000) >= 0x80000006) 273 if (cpuid_eax(0x80000000) >= 0x80000006)
243 num_cache_leaves = 3; 274 num_cache_leaves = 3;
275
276 if (amd_apic_timer_broken())
277 set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability);
244} 278}
245 279
246static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) 280static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index a1f1b715bcf8..2b030d6ccbf7 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -758,7 +758,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
758 NULL, (void *)&pr); 758 NULL, (void *)&pr);
759 759
760 /* Check ACPI support for C3 state */ 760 /* Check ACPI support for C3 state */
761 if (pr != NULL && longhaul_version != TYPE_LONGHAUL_V1) { 761 if (pr != NULL && longhaul_version == TYPE_POWERSAVER) {
762 cx = &pr->power.states[ACPI_STATE_C3]; 762 cx = &pr->power.states[ACPI_STATE_C3];
763 if (cx->address > 0 && cx->latency <= 1000) { 763 if (cx->address > 0 && cx->latency <= 1000) {
764 longhaul_flags |= USE_ACPI_C3; 764 longhaul_flags |= USE_ACPI_C3;
diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
index f3ab61ee7498..17d73459fc5f 100644
--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -3,6 +3,8 @@
3#include <linux/errno.h> 3#include <linux/errno.h>
4#include <linux/hpet.h> 4#include <linux/hpet.h>
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/sysdev.h>
7#include <linux/pm.h>
6 8
7#include <asm/hpet.h> 9#include <asm/hpet.h>
8#include <asm/io.h> 10#include <asm/io.h>
@@ -197,7 +199,7 @@ static int hpet_next_event(unsigned long delta,
197 cnt += delta; 199 cnt += delta;
198 hpet_writel(cnt, HPET_T0_CMP); 200 hpet_writel(cnt, HPET_T0_CMP);
199 201
200 return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0); 202 return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0) ? -ETIME : 0;
201} 203}
202 204
203/* 205/*
@@ -307,6 +309,7 @@ int __init hpet_enable(void)
307out_nohpet: 309out_nohpet:
308 iounmap(hpet_virt_address); 310 iounmap(hpet_virt_address);
309 hpet_virt_address = NULL; 311 hpet_virt_address = NULL;
312 boot_hpet_disable = 1;
310 return 0; 313 return 0;
311} 314}
312 315
@@ -521,3 +524,68 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
521 return IRQ_HANDLED; 524 return IRQ_HANDLED;
522} 525}
523#endif 526#endif
527
528
529/*
530 * Suspend/resume part
531 */
532
533#ifdef CONFIG_PM
534
535static int hpet_suspend(struct sys_device *sys_device, pm_message_t state)
536{
537 unsigned long cfg = hpet_readl(HPET_CFG);
538
539 cfg &= ~(HPET_CFG_ENABLE|HPET_CFG_LEGACY);
540 hpet_writel(cfg, HPET_CFG);
541
542 return 0;
543}
544
545static int hpet_resume(struct sys_device *sys_device)
546{
547 unsigned int id;
548
549 hpet_start_counter();
550
551 id = hpet_readl(HPET_ID);
552
553 if (id & HPET_ID_LEGSUP)
554 hpet_enable_int();
555
556 return 0;
557}
558
559static struct sysdev_class hpet_class = {
560 set_kset_name("hpet"),
561 .suspend = hpet_suspend,
562 .resume = hpet_resume,
563};
564
565static struct sys_device hpet_device = {
566 .id = 0,
567 .cls = &hpet_class,
568};
569
570
571static __init int hpet_register_sysfs(void)
572{
573 int err;
574
575 if (!is_hpet_capable())
576 return 0;
577
578 err = sysdev_class_register(&hpet_class);
579
580 if (!err) {
581 err = sysdev_register(&hpet_device);
582 if (err)
583 sysdev_class_unregister(&hpet_class);
584 }
585
586 return err;
587}
588
589device_initcall(hpet_register_sysfs);
590
591#endif
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
index e3d4b73bfdb0..4afe26e86260 100644
--- a/arch/i386/kernel/i386_ksyms.c
+++ b/arch/i386/kernel/i386_ksyms.c
@@ -28,3 +28,5 @@ EXPORT_SYMBOL(__read_lock_failed);
28#endif 28#endif
29 29
30EXPORT_SYMBOL(csum_partial); 30EXPORT_SYMBOL(csum_partial);
31
32EXPORT_SYMBOL(_proxy_pda);
diff --git a/arch/i386/kernel/i8253.c b/arch/i386/kernel/i8253.c
index 5cbb776b3089..10cef5ca8a5b 100644
--- a/arch/i386/kernel/i8253.c
+++ b/arch/i386/kernel/i8253.c
@@ -47,9 +47,17 @@ static void init_pit_timer(enum clock_event_mode mode,
47 outb(LATCH >> 8 , PIT_CH0); /* MSB */ 47 outb(LATCH >> 8 , PIT_CH0); /* MSB */
48 break; 48 break;
49 49
50 case CLOCK_EVT_MODE_ONESHOT: 50 /*
51 * Avoid unnecessary state transitions, as it confuses
52 * Geode / Cyrix based boxen.
53 */
51 case CLOCK_EVT_MODE_SHUTDOWN: 54 case CLOCK_EVT_MODE_SHUTDOWN:
55 if (evt->mode == CLOCK_EVT_MODE_UNUSED)
56 break;
52 case CLOCK_EVT_MODE_UNUSED: 57 case CLOCK_EVT_MODE_UNUSED:
58 if (evt->mode == CLOCK_EVT_MODE_SHUTDOWN)
59 break;
60 case CLOCK_EVT_MODE_ONESHOT:
53 /* One shot setup */ 61 /* One shot setup */
54 outb_p(0x38, PIT_MODE); 62 outb_p(0x38, PIT_MODE);
55 udelay(10); 63 udelay(10);
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index e4408ff4e674..b3ab8ffebd27 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -736,7 +736,7 @@ failed:
736 return 0; 736 return 0;
737} 737}
738 738
739int __init irqbalance_disable(char *str) 739int __devinit irqbalance_disable(char *str)
740{ 740{
741 irqbalance_disabled = 1; 741 irqbalance_disabled = 1;
742 return 1; 742 return 1;
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index b8f16633a6ec..cbe7ec8dbb9f 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -567,6 +567,53 @@ static int cpu_request_microcode(int cpu)
567 return error; 567 return error;
568} 568}
569 569
570static int apply_microcode_on_cpu(int cpu)
571{
572 struct cpuinfo_x86 *c = cpu_data + cpu;
573 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
574 cpumask_t old;
575 unsigned int val[2];
576 int err = 0;
577
578 if (!uci->mc)
579 return -EINVAL;
580
581 old = current->cpus_allowed;
582 set_cpus_allowed(current, cpumask_of_cpu(cpu));
583
584 /* Check if the microcode we have in memory matches the CPU */
585 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
586 cpu_has(c, X86_FEATURE_IA64) || uci->sig != cpuid_eax(0x00000001))
587 err = -EINVAL;
588
589 if (!err && ((c->x86_model >= 5) || (c->x86 > 6))) {
590 /* get processor flags from MSR 0x17 */
591 rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
592 if (uci->pf != (1 << ((val[1] >> 18) & 7)))
593 err = -EINVAL;
594 }
595
596 if (!err) {
597 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
598 /* see notes above for revision 1.07. Apparent chip bug */
599 sync_core();
600 /* get the current revision from MSR 0x8B */
601 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
602 if (uci->rev != val[1])
603 err = -EINVAL;
604 }
605
606 if (!err)
607 apply_microcode(cpu);
608 else
609 printk(KERN_ERR "microcode: Could not apply microcode to CPU%d:"
610 " sig=0x%x, pf=0x%x, rev=0x%x\n",
611 cpu, uci->sig, uci->pf, uci->rev);
612
613 set_cpus_allowed(current, old);
614 return err;
615}
616
570static void microcode_init_cpu(int cpu) 617static void microcode_init_cpu(int cpu)
571{ 618{
572 cpumask_t old; 619 cpumask_t old;
@@ -577,7 +624,8 @@ static void microcode_init_cpu(int cpu)
577 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 624 set_cpus_allowed(current, cpumask_of_cpu(cpu));
578 mutex_lock(&microcode_mutex); 625 mutex_lock(&microcode_mutex);
579 collect_cpu_info(cpu); 626 collect_cpu_info(cpu);
580 if (uci->valid && system_state == SYSTEM_RUNNING) 627 if (uci->valid && system_state == SYSTEM_RUNNING &&
628 !suspend_cpu_hotplug)
581 cpu_request_microcode(cpu); 629 cpu_request_microcode(cpu);
582 mutex_unlock(&microcode_mutex); 630 mutex_unlock(&microcode_mutex);
583 set_cpus_allowed(current, old); 631 set_cpus_allowed(current, old);
@@ -663,13 +711,24 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
663 return 0; 711 return 0;
664 712
665 pr_debug("Microcode:CPU %d added\n", cpu); 713 pr_debug("Microcode:CPU %d added\n", cpu);
666 memset(uci, 0, sizeof(*uci)); 714 /* If suspend_cpu_hotplug is set, the system is resuming and we should
715 * use the data from before the suspend.
716 */
717 if (suspend_cpu_hotplug) {
718 err = apply_microcode_on_cpu(cpu);
719 if (err)
720 microcode_fini_cpu(cpu);
721 }
722 if (!uci->valid)
723 memset(uci, 0, sizeof(*uci));
667 724
668 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); 725 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
669 if (err) 726 if (err)
670 return err; 727 return err;
671 728
672 microcode_init_cpu(cpu); 729 if (!uci->valid)
730 microcode_init_cpu(cpu);
731
673 return 0; 732 return 0;
674} 733}
675 734
@@ -680,7 +739,11 @@ static int mc_sysdev_remove(struct sys_device *sys_dev)
680 if (!cpu_online(cpu)) 739 if (!cpu_online(cpu))
681 return 0; 740 return 0;
682 pr_debug("Microcode:CPU %d removed\n", cpu); 741 pr_debug("Microcode:CPU %d removed\n", cpu);
683 microcode_fini_cpu(cpu); 742 /* If suspend_cpu_hotplug is set, the system is suspending and we should
743 * keep the microcode in memory for the resume.
744 */
745 if (!suspend_cpu_hotplug)
746 microcode_fini_cpu(cpu);
684 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 747 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
685 return 0; 748 return 0;
686} 749}
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 821df34d2b3a..84c3497efb60 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -41,16 +41,17 @@ int nmi_watchdog_enabled;
41 * different subsystems this reservation system just tries to coordinate 41 * different subsystems this reservation system just tries to coordinate
42 * things a little 42 * things a little
43 */ 43 */
44static DEFINE_PER_CPU(unsigned long, perfctr_nmi_owner);
45static DEFINE_PER_CPU(unsigned long, evntsel_nmi_owner[3]);
46
47static cpumask_t backtrace_mask = CPU_MASK_NONE;
48 44
49/* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's 45/* this number is calculated from Intel's MSR_P4_CRU_ESCR5 register and it's
50 * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now) 46 * offset from MSR_P4_BSU_ESCR0. It will be the max for all platforms (for now)
51 */ 47 */
52#define NMI_MAX_COUNTER_BITS 66 48#define NMI_MAX_COUNTER_BITS 66
49#define NMI_MAX_COUNTER_LONGS BITS_TO_LONGS(NMI_MAX_COUNTER_BITS)
50
51static DEFINE_PER_CPU(unsigned long, perfctr_nmi_owner[NMI_MAX_COUNTER_LONGS]);
52static DEFINE_PER_CPU(unsigned long, evntsel_nmi_owner[NMI_MAX_COUNTER_LONGS]);
53 53
54static cpumask_t backtrace_mask = CPU_MASK_NONE;
54/* nmi_active: 55/* nmi_active:
55 * >0: the lapic NMI watchdog is active, but can be disabled 56 * >0: the lapic NMI watchdog is active, but can be disabled
56 * <0: the lapic NMI watchdog has not been set up, and cannot 57 * <0: the lapic NMI watchdog has not been set up, and cannot
@@ -122,64 +123,129 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
122/* checks for a bit availability (hack for oprofile) */ 123/* checks for a bit availability (hack for oprofile) */
123int avail_to_resrv_perfctr_nmi_bit(unsigned int counter) 124int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
124{ 125{
126 int cpu;
125 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 127 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
126 128 for_each_possible_cpu (cpu) {
127 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 129 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]))
130 return 0;
131 }
132 return 1;
128} 133}
129 134
130/* checks the an msr for availability */ 135/* checks the an msr for availability */
131int avail_to_resrv_perfctr_nmi(unsigned int msr) 136int avail_to_resrv_perfctr_nmi(unsigned int msr)
132{ 137{
133 unsigned int counter; 138 unsigned int counter;
139 int cpu;
134 140
135 counter = nmi_perfctr_msr_to_bit(msr); 141 counter = nmi_perfctr_msr_to_bit(msr);
136 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 142 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
137 143
138 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 144 for_each_possible_cpu (cpu) {
145 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]))
146 return 0;
147 }
148 return 1;
139} 149}
140 150
141int reserve_perfctr_nmi(unsigned int msr) 151static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
142{ 152{
143 unsigned int counter; 153 unsigned int counter;
154 if (cpu < 0)
155 cpu = smp_processor_id();
144 156
145 counter = nmi_perfctr_msr_to_bit(msr); 157 counter = nmi_perfctr_msr_to_bit(msr);
146 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 158 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
147 159
148 if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner))) 160 if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]))
149 return 1; 161 return 1;
150 return 0; 162 return 0;
151} 163}
152 164
153void release_perfctr_nmi(unsigned int msr) 165static void __release_perfctr_nmi(int cpu, unsigned int msr)
154{ 166{
155 unsigned int counter; 167 unsigned int counter;
168 if (cpu < 0)
169 cpu = smp_processor_id();
156 170
157 counter = nmi_perfctr_msr_to_bit(msr); 171 counter = nmi_perfctr_msr_to_bit(msr);
158 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 172 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
159 173
160 clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner)); 174 clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)[0]);
161} 175}
162 176
163int reserve_evntsel_nmi(unsigned int msr) 177int reserve_perfctr_nmi(unsigned int msr)
178{
179 int cpu, i;
180 for_each_possible_cpu (cpu) {
181 if (!__reserve_perfctr_nmi(cpu, msr)) {
182 for_each_possible_cpu (i) {
183 if (i >= cpu)
184 break;
185 __release_perfctr_nmi(i, msr);
186 }
187 return 0;
188 }
189 }
190 return 1;
191}
192
193void release_perfctr_nmi(unsigned int msr)
194{
195 int cpu;
196 for_each_possible_cpu (cpu) {
197 __release_perfctr_nmi(cpu, msr);
198 }
199}
200
201int __reserve_evntsel_nmi(int cpu, unsigned int msr)
164{ 202{
165 unsigned int counter; 203 unsigned int counter;
204 if (cpu < 0)
205 cpu = smp_processor_id();
166 206
167 counter = nmi_evntsel_msr_to_bit(msr); 207 counter = nmi_evntsel_msr_to_bit(msr);
168 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 208 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
169 209
170 if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0])) 210 if (!test_and_set_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]))
171 return 1; 211 return 1;
172 return 0; 212 return 0;
173} 213}
174 214
175void release_evntsel_nmi(unsigned int msr) 215static void __release_evntsel_nmi(int cpu, unsigned int msr)
176{ 216{
177 unsigned int counter; 217 unsigned int counter;
218 if (cpu < 0)
219 cpu = smp_processor_id();
178 220
179 counter = nmi_evntsel_msr_to_bit(msr); 221 counter = nmi_evntsel_msr_to_bit(msr);
180 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 222 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
181 223
182 clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0]); 224 clear_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]);
225}
226
227int reserve_evntsel_nmi(unsigned int msr)
228{
229 int cpu, i;
230 for_each_possible_cpu (cpu) {
231 if (!__reserve_evntsel_nmi(cpu, msr)) {
232 for_each_possible_cpu (i) {
233 if (i >= cpu)
234 break;
235 __release_evntsel_nmi(i, msr);
236 }
237 return 0;
238 }
239 }
240 return 1;
241}
242
243void release_evntsel_nmi(unsigned int msr)
244{
245 int cpu;
246 for_each_possible_cpu (cpu) {
247 __release_evntsel_nmi(cpu, msr);
248 }
183} 249}
184 250
185static __cpuinit inline int nmi_known_cpu(void) 251static __cpuinit inline int nmi_known_cpu(void)
@@ -245,14 +311,6 @@ static int __init check_nmi_watchdog(void)
245 unsigned int *prev_nmi_count; 311 unsigned int *prev_nmi_count;
246 int cpu; 312 int cpu;
247 313
248 /* Enable NMI watchdog for newer systems.
249 Probably safe on most older systems too, but let's be careful.
250 IBM ThinkPads use INT10 inside SMM and that allows early NMI inside SMM
251 which hangs the system. Disable watchdog for all thinkpads */
252 if (nmi_watchdog == NMI_DEFAULT && dmi_get_year(DMI_BIOS_DATE) >= 2004 &&
253 !dmi_name_in_vendors("ThinkPad"))
254 nmi_watchdog = NMI_LOCAL_APIC;
255
256 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 314 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT))
257 return 0; 315 return 0;
258 316
@@ -271,7 +329,7 @@ static int __init check_nmi_watchdog(void)
271 for_each_possible_cpu(cpu) 329 for_each_possible_cpu(cpu)
272 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; 330 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
273 local_irq_enable(); 331 local_irq_enable();
274 mdelay((10*1000)/nmi_hz); // wait 10 ticks 332 mdelay((20*1000)/nmi_hz); // wait 20 ticks
275 333
276 for_each_possible_cpu(cpu) { 334 for_each_possible_cpu(cpu) {
277#ifdef CONFIG_SMP 335#ifdef CONFIG_SMP
@@ -515,10 +573,10 @@ static int setup_k7_watchdog(void)
515 573
516 perfctr_msr = MSR_K7_PERFCTR0; 574 perfctr_msr = MSR_K7_PERFCTR0;
517 evntsel_msr = MSR_K7_EVNTSEL0; 575 evntsel_msr = MSR_K7_EVNTSEL0;
518 if (!reserve_perfctr_nmi(perfctr_msr)) 576 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
519 goto fail; 577 goto fail;
520 578
521 if (!reserve_evntsel_nmi(evntsel_msr)) 579 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
522 goto fail1; 580 goto fail1;
523 581
524 wrmsrl(perfctr_msr, 0UL); 582 wrmsrl(perfctr_msr, 0UL);
@@ -541,7 +599,7 @@ static int setup_k7_watchdog(void)
541 wd->check_bit = 1ULL<<63; 599 wd->check_bit = 1ULL<<63;
542 return 1; 600 return 1;
543fail1: 601fail1:
544 release_perfctr_nmi(perfctr_msr); 602 __release_perfctr_nmi(-1, perfctr_msr);
545fail: 603fail:
546 return 0; 604 return 0;
547} 605}
@@ -552,8 +610,8 @@ static void stop_k7_watchdog(void)
552 610
553 wrmsr(wd->evntsel_msr, 0, 0); 611 wrmsr(wd->evntsel_msr, 0, 0);
554 612
555 release_evntsel_nmi(wd->evntsel_msr); 613 __release_evntsel_nmi(-1, wd->evntsel_msr);
556 release_perfctr_nmi(wd->perfctr_msr); 614 __release_perfctr_nmi(-1, wd->perfctr_msr);
557} 615}
558 616
559#define P6_EVNTSEL0_ENABLE (1 << 22) 617#define P6_EVNTSEL0_ENABLE (1 << 22)
@@ -571,10 +629,10 @@ static int setup_p6_watchdog(void)
571 629
572 perfctr_msr = MSR_P6_PERFCTR0; 630 perfctr_msr = MSR_P6_PERFCTR0;
573 evntsel_msr = MSR_P6_EVNTSEL0; 631 evntsel_msr = MSR_P6_EVNTSEL0;
574 if (!reserve_perfctr_nmi(perfctr_msr)) 632 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
575 goto fail; 633 goto fail;
576 634
577 if (!reserve_evntsel_nmi(evntsel_msr)) 635 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
578 goto fail1; 636 goto fail1;
579 637
580 wrmsrl(perfctr_msr, 0UL); 638 wrmsrl(perfctr_msr, 0UL);
@@ -598,7 +656,7 @@ static int setup_p6_watchdog(void)
598 wd->check_bit = 1ULL<<39; 656 wd->check_bit = 1ULL<<39;
599 return 1; 657 return 1;
600fail1: 658fail1:
601 release_perfctr_nmi(perfctr_msr); 659 __release_perfctr_nmi(-1, perfctr_msr);
602fail: 660fail:
603 return 0; 661 return 0;
604} 662}
@@ -609,8 +667,8 @@ static void stop_p6_watchdog(void)
609 667
610 wrmsr(wd->evntsel_msr, 0, 0); 668 wrmsr(wd->evntsel_msr, 0, 0);
611 669
612 release_evntsel_nmi(wd->evntsel_msr); 670 __release_evntsel_nmi(-1, wd->evntsel_msr);
613 release_perfctr_nmi(wd->perfctr_msr); 671 __release_perfctr_nmi(-1, wd->perfctr_msr);
614} 672}
615 673
616/* Note that these events don't tick when the CPU idles. This means 674/* Note that these events don't tick when the CPU idles. This means
@@ -676,10 +734,10 @@ static int setup_p4_watchdog(void)
676 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); 734 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4);
677 } 735 }
678 736
679 if (!reserve_perfctr_nmi(perfctr_msr)) 737 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
680 goto fail; 738 goto fail;
681 739
682 if (!reserve_evntsel_nmi(evntsel_msr)) 740 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
683 goto fail1; 741 goto fail1;
684 742
685 evntsel = P4_ESCR_EVENT_SELECT(0x3F) 743 evntsel = P4_ESCR_EVENT_SELECT(0x3F)
@@ -703,7 +761,7 @@ static int setup_p4_watchdog(void)
703 wd->check_bit = 1ULL<<39; 761 wd->check_bit = 1ULL<<39;
704 return 1; 762 return 1;
705fail1: 763fail1:
706 release_perfctr_nmi(perfctr_msr); 764 __release_perfctr_nmi(-1, perfctr_msr);
707fail: 765fail:
708 return 0; 766 return 0;
709} 767}
@@ -715,8 +773,8 @@ static void stop_p4_watchdog(void)
715 wrmsr(wd->cccr_msr, 0, 0); 773 wrmsr(wd->cccr_msr, 0, 0);
716 wrmsr(wd->evntsel_msr, 0, 0); 774 wrmsr(wd->evntsel_msr, 0, 0);
717 775
718 release_evntsel_nmi(wd->evntsel_msr); 776 __release_evntsel_nmi(-1, wd->evntsel_msr);
719 release_perfctr_nmi(wd->perfctr_msr); 777 __release_perfctr_nmi(-1, wd->perfctr_msr);
720} 778}
721 779
722#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 780#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
@@ -744,10 +802,10 @@ static int setup_intel_arch_watchdog(void)
744 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 802 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
745 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0; 803 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
746 804
747 if (!reserve_perfctr_nmi(perfctr_msr)) 805 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
748 goto fail; 806 goto fail;
749 807
750 if (!reserve_evntsel_nmi(evntsel_msr)) 808 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
751 goto fail1; 809 goto fail1;
752 810
753 wrmsrl(perfctr_msr, 0UL); 811 wrmsrl(perfctr_msr, 0UL);
@@ -772,7 +830,7 @@ static int setup_intel_arch_watchdog(void)
772 wd->check_bit = 1ULL << (eax.split.bit_width - 1); 830 wd->check_bit = 1ULL << (eax.split.bit_width - 1);
773 return 1; 831 return 1;
774fail1: 832fail1:
775 release_perfctr_nmi(perfctr_msr); 833 __release_perfctr_nmi(-1, perfctr_msr);
776fail: 834fail:
777 return 0; 835 return 0;
778} 836}
@@ -795,8 +853,8 @@ static void stop_intel_arch_watchdog(void)
795 return; 853 return;
796 854
797 wrmsr(wd->evntsel_msr, 0, 0); 855 wrmsr(wd->evntsel_msr, 0, 0);
798 release_evntsel_nmi(wd->evntsel_msr); 856 __release_evntsel_nmi(-1, wd->evntsel_msr);
799 release_perfctr_nmi(wd->perfctr_msr); 857 __release_perfctr_nmi(-1, wd->perfctr_msr);
800} 858}
801 859
802void setup_apic_nmi_watchdog (void *unused) 860void setup_apic_nmi_watchdog (void *unused)
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 602660df455c..6cb8f5336732 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -18,6 +18,8 @@
18 18
19#include "mach_timer.h" 19#include "mach_timer.h"
20 20
21static int tsc_enabled;
22
21/* 23/*
22 * On some systems the TSC frequency does not 24 * On some systems the TSC frequency does not
23 * change with the cpu frequency. So we need 25 * change with the cpu frequency. So we need
@@ -105,7 +107,7 @@ unsigned long long sched_clock(void)
105 /* 107 /*
106 * Fall back to jiffies if there's no TSC available: 108 * Fall back to jiffies if there's no TSC available:
107 */ 109 */
108 if (unlikely(tsc_disable)) 110 if (unlikely(!tsc_enabled))
109 /* No locking but a rare wrong value is not a big deal: */ 111 /* No locking but a rare wrong value is not a big deal: */
110 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 112 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
111 113
@@ -283,6 +285,7 @@ void mark_tsc_unstable(void)
283{ 285{
284 if (!tsc_unstable) { 286 if (!tsc_unstable) {
285 tsc_unstable = 1; 287 tsc_unstable = 1;
288 tsc_enabled = 0;
286 /* Can be called before registration */ 289 /* Can be called before registration */
287 if (clocksource_tsc.mult) 290 if (clocksource_tsc.mult)
288 clocksource_change_rating(&clocksource_tsc, 0); 291 clocksource_change_rating(&clocksource_tsc, 0);
@@ -383,7 +386,9 @@ void __init tsc_init(void)
383 if (check_tsc_unstable()) { 386 if (check_tsc_unstable()) {
384 clocksource_tsc.rating = 0; 387 clocksource_tsc.rating = 0;
385 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 388 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
386 } 389 } else
390 tsc_enabled = 1;
391
387 clocksource_register(&clocksource_tsc); 392 clocksource_register(&clocksource_tsc);
388 393
389 return; 394 return;
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index fbf45fa08320..697a70e8c0c9 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -23,7 +23,6 @@
23 */ 23 */
24 24
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/license.h>
27#include <linux/cpu.h> 26#include <linux/cpu.h>
28#include <linux/bootmem.h> 27#include <linux/bootmem.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
@@ -48,7 +47,6 @@ typedef u64 __attribute__((regparm(2))) (VROMLONGFUNC)(int);
48 (((VROMLONGFUNC *)(rom->func)) (arg)) 47 (((VROMLONGFUNC *)(rom->func)) (arg))
49 48
50static struct vrom_header *vmi_rom; 49static struct vrom_header *vmi_rom;
51static int license_gplok;
52static int disable_pge; 50static int disable_pge;
53static int disable_pse; 51static int disable_pse;
54static int disable_sep; 52static int disable_sep;
@@ -71,6 +69,7 @@ struct {
71 void (*flush_tlb)(int); 69 void (*flush_tlb)(int);
72 void (*set_initial_ap_state)(int, int); 70 void (*set_initial_ap_state)(int, int);
73 void (*halt)(void); 71 void (*halt)(void);
72 void (*set_lazy_mode)(int mode);
74} vmi_ops; 73} vmi_ops;
75 74
76/* XXX move this to alternative.h */ 75/* XXX move this to alternative.h */
@@ -576,6 +575,26 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
576} 575}
577#endif 576#endif
578 577
578static void vmi_set_lazy_mode(int mode)
579{
580 static DEFINE_PER_CPU(int, lazy_mode);
581
582 if (!vmi_ops.set_lazy_mode)
583 return;
584
585 /* Modes should never nest or overlap */
586 BUG_ON(__get_cpu_var(lazy_mode) && !(mode == PARAVIRT_LAZY_NONE ||
587 mode == PARAVIRT_LAZY_FLUSH));
588
589 if (mode == PARAVIRT_LAZY_FLUSH) {
590 vmi_ops.set_lazy_mode(0);
591 vmi_ops.set_lazy_mode(__get_cpu_var(lazy_mode));
592 } else {
593 vmi_ops.set_lazy_mode(mode);
594 __get_cpu_var(lazy_mode) = mode;
595 }
596}
597
579static inline int __init check_vmi_rom(struct vrom_header *rom) 598static inline int __init check_vmi_rom(struct vrom_header *rom)
580{ 599{
581 struct pci_header *pci; 600 struct pci_header *pci;
@@ -629,13 +648,14 @@ static inline int __init check_vmi_rom(struct vrom_header *rom)
629 rom->api_version_maj, rom->api_version_min, 648 rom->api_version_maj, rom->api_version_min,
630 pci->rom_version_maj, pci->rom_version_min); 649 pci->rom_version_maj, pci->rom_version_min);
631 650
632 license_gplok = license_is_gpl_compatible(license); 651 /* Don't allow BSD/MIT here for now because we don't want to end up
633 if (!license_gplok) { 652 with any binary only shim layers */
634 printk(KERN_WARNING "VMI: ROM license '%s' taints kernel... " 653 if (strcmp(license, "GPL") && strcmp(license, "GPL v2")) {
635 "inlining disabled\n", 654 printk(KERN_WARNING "VMI: Non GPL license `%s' found for ROM. Not used.\n",
636 license); 655 license);
637 add_taint(TAINT_PROPRIETARY_MODULE); 656 return 0;
638 } 657 }
658
639 return 1; 659 return 1;
640} 660}
641 661
@@ -692,11 +712,14 @@ static void *vmi_get_function(int vmicall)
692do { \ 712do { \
693 reloc = call_vrom_long_func(vmi_rom, get_reloc, \ 713 reloc = call_vrom_long_func(vmi_rom, get_reloc, \
694 VMI_CALL_##vmicall); \ 714 VMI_CALL_##vmicall); \
695 if (rel->type != VMI_RELOCATION_NONE) { \ 715 if (rel->type == VMI_RELOCATION_CALL_REL) \
696 BUG_ON(rel->type != VMI_RELOCATION_CALL_REL); \
697 paravirt_ops.opname = (void *)rel->eip; \ 716 paravirt_ops.opname = (void *)rel->eip; \
698 } else if (rel->type == VMI_RELOCATION_NOP) \ 717 else if (rel->type == VMI_RELOCATION_NOP) \
699 paravirt_ops.opname = (void *)vmi_nop; \ 718 paravirt_ops.opname = (void *)vmi_nop; \
719 else if (rel->type != VMI_RELOCATION_NONE) \
720 printk(KERN_WARNING "VMI: Unknown relocation " \
721 "type %d for " #vmicall"\n",\
722 rel->type); \
700} while (0) 723} while (0)
701 724
702/* 725/*
@@ -805,7 +828,7 @@ static inline int __init activate_vmi(void)
805 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); 828 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack);
806 para_fill(set_iopl_mask, SetIOPLMask); 829 para_fill(set_iopl_mask, SetIOPLMask);
807 para_fill(io_delay, IODelay); 830 para_fill(io_delay, IODelay);
808 para_fill(set_lazy_mode, SetLazyMode); 831 para_wrap(set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode);
809 832
810 /* user and kernel flush are just handled with different flags to FlushTLB */ 833 /* user and kernel flush are just handled with different flags to FlushTLB */
811 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB); 834 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB);
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index ca51610955df..6f38f818380b 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -26,7 +26,7 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
26OUTPUT_ARCH(i386) 26OUTPUT_ARCH(i386)
27ENTRY(phys_startup_32) 27ENTRY(phys_startup_32)
28jiffies = jiffies_64; 28jiffies = jiffies_64;
29_proxy_pda = 0; 29_proxy_pda = 1;
30 30
31PHDRS { 31PHDRS {
32 text PT_LOAD FLAGS(5); /* R_E */ 32 text PT_LOAD FLAGS(5); /* R_E */
diff --git a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c
index d22cfc9d656c..086b3726862a 100644
--- a/arch/i386/lib/usercopy.c
+++ b/arch/i386/lib/usercopy.c
@@ -10,6 +10,7 @@
10#include <linux/blkdev.h> 10#include <linux/blkdev.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/backing-dev.h> 12#include <linux/backing-dev.h>
13#include <linux/interrupt.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14#include <asm/mmx.h> 15#include <asm/mmx.h>
15 16
@@ -719,6 +720,14 @@ unsigned long __copy_to_user_ll(void __user *to, const void *from,
719#ifndef CONFIG_X86_WP_WORKS_OK 720#ifndef CONFIG_X86_WP_WORKS_OK
720 if (unlikely(boot_cpu_data.wp_works_ok == 0) && 721 if (unlikely(boot_cpu_data.wp_works_ok == 0) &&
721 ((unsigned long )to) < TASK_SIZE) { 722 ((unsigned long )to) < TASK_SIZE) {
723 /*
724 * When we are in an atomic section (see
725 * mm/filemap.c:file_read_actor), return the full
726 * length to take the slow path.
727 */
728 if (in_atomic())
729 return n;
730
722 /* 731 /*
723 * CPU does not honor the WP bit when writing 732 * CPU does not honor the WP bit when writing
724 * from supervisory mode, and due to preemption or SMP, 733 * from supervisory mode, and due to preemption or SMP,
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c
index bb2de1089add..ac70d09df7ee 100644
--- a/arch/i386/mm/highmem.c
+++ b/arch/i386/mm/highmem.c
@@ -42,6 +42,7 @@ void *kmap_atomic(struct page *page, enum km_type type)
42 42
43 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 43 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
44 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot)); 44 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
45 arch_flush_lazy_mmu_mode();
45 46
46 return (void*) vaddr; 47 return (void*) vaddr;
47} 48}
@@ -82,6 +83,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
82 idx = type + KM_TYPE_NR*smp_processor_id(); 83 idx = type + KM_TYPE_NR*smp_processor_id();
83 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 84 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
84 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); 85 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
86 arch_flush_lazy_mmu_mode();
85 87
86 return (void*) vaddr; 88 return (void*) vaddr;
87} 89}
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 1bb069372143..3f78d4d8ecf3 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -193,6 +193,14 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
193 }, 193 },
194 { 194 {
195 .callback = set_bf_sort, 195 .callback = set_bf_sort,
196 .ident = "Dell PowerEdge R900",
197 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
199 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R900"),
200 },
201 },
202 {
203 .callback = set_bf_sort,
196 .ident = "HP ProLiant BL20p G3", 204 .ident = "HP ProLiant BL20p G3",
197 .matches = { 205 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 206 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
@@ -426,11 +434,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
426 if ((err = pcibios_enable_resources(dev, mask)) < 0) 434 if ((err = pcibios_enable_resources(dev, mask)) < 0)
427 return err; 435 return err;
428 436
429 return pcibios_enable_irq(dev); 437 if (!dev->msi_enabled)
438 return pcibios_enable_irq(dev);
439 return 0;
430} 440}
431 441
432void pcibios_disable_device (struct pci_dev *dev) 442void pcibios_disable_device (struct pci_dev *dev)
433{ 443{
434 if (pcibios_disable_irq) 444 if (!dev->msi_enabled && pcibios_disable_irq)
435 pcibios_disable_irq(dev); 445 pcibios_disable_irq(dev);
436} 446}