aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-davinci/time.c2
-rw-r--r--arch/arm/mach-imx/time.c1
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-omap1/time.c1
-rw-r--r--arch/arm/plat-omap/timer32k.c2
-rw-r--r--arch/i386/Kconfig21
-rw-r--r--arch/i386/defconfig264
-rw-r--r--arch/i386/kernel/Makefile1
-rw-r--r--arch/i386/kernel/acpi/boot.c36
-rw-r--r--arch/i386/kernel/alternative.c14
-rw-r--r--arch/i386/kernel/apic.c10
-rw-r--r--arch/i386/kernel/cpu/Makefile1
-rw-r--r--arch/i386/kernel/cpu/amd.c8
-rw-r--r--arch/i386/kernel/cpu/common.c2
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c79
-rw-r--r--arch/i386/kernel/cpu/mcheck/non-fatal.c4
-rw-r--r--arch/i386/kernel/cpu/mtrr/generic.c2
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c2
-rw-r--r--arch/i386/kernel/cpu/perfctr-watchdog.c4
-rw-r--r--arch/i386/kernel/cpu/rise.c52
-rw-r--r--arch/i386/kernel/e820.c32
-rw-r--r--arch/i386/kernel/geode.c155
-rw-r--r--arch/i386/kernel/hpet.c98
-rw-r--r--arch/i386/kernel/i8253.c32
-rw-r--r--arch/i386/kernel/io_apic.c26
-rw-r--r--arch/i386/kernel/irq.c8
-rw-r--r--arch/i386/kernel/process.c12
-rw-r--r--arch/i386/kernel/reboot.c9
-rw-r--r--arch/i386/kernel/setup.c11
-rw-r--r--arch/i386/kernel/sysenter.c4
-rw-r--r--arch/i386/kernel/time.c50
-rw-r--r--arch/i386/kernel/traps.c3
-rw-r--r--arch/i386/kernel/vmiclock.c2
-rw-r--r--arch/i386/lib/Makefile2
-rw-r--r--arch/i386/lib/string.c257
-rw-r--r--arch/i386/mm/init.c7
-rw-r--r--arch/i386/mm/ioremap.c2
-rw-r--r--arch/i386/mm/pageattr.c20
-rw-r--r--arch/i386/mm/pgtable.c6
-rw-r--r--arch/i386/pci/acpi.c32
-rw-r--r--arch/i386/pci/common.c13
-rw-r--r--arch/i386/pci/mmconfig-shared.c48
-rw-r--r--arch/i386/xen/time.c3
-rw-r--r--arch/ia64/ia32/binfmt_elf32.c2
-rw-r--r--arch/powerpc/boot/ps3-head.S2
-rw-r--r--arch/powerpc/boot/ps3-hvcall.S2
-rw-r--r--arch/powerpc/mm/tlb_32.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c18
-rw-r--r--arch/powerpc/platforms/ps3/Kconfig36
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c1
-rw-r--r--arch/sparc64/Kconfig4
-rw-r--r--arch/sparc64/kernel/time.c54
-rw-r--r--arch/x86_64/Kconfig12
-rw-r--r--arch/x86_64/Makefile3
-rw-r--r--arch/x86_64/defconfig288
-rw-r--r--arch/x86_64/ia32/ia32_binfmt.c1
-rw-r--r--arch/x86_64/ia32/ia32entry.S5
-rw-r--r--arch/x86_64/kernel/aperture.c4
-rw-r--r--arch/x86_64/kernel/apic.c77
-rw-r--r--arch/x86_64/kernel/e820.c138
-rw-r--r--arch/x86_64/kernel/early-quirks.c1
-rw-r--r--arch/x86_64/kernel/entry.S6
-rw-r--r--arch/x86_64/kernel/hpet.c6
-rw-r--r--arch/x86_64/kernel/i8259.c18
-rw-r--r--arch/x86_64/kernel/io_apic.c58
-rw-r--r--arch/x86_64/kernel/mce.c241
-rw-r--r--arch/x86_64/kernel/mce_amd.c6
-rw-r--r--arch/x86_64/kernel/mpparse.c21
-rw-r--r--arch/x86_64/kernel/pci-calgary.c570
-rw-r--r--arch/x86_64/kernel/pci-dma.c7
-rw-r--r--arch/x86_64/kernel/pci-gart.c27
-rw-r--r--arch/x86_64/kernel/pci-nommu.c8
-rw-r--r--arch/x86_64/kernel/pci-swiotlb.c2
-rw-r--r--arch/x86_64/kernel/process.c13
-rw-r--r--arch/x86_64/kernel/reboot.c4
-rw-r--r--arch/x86_64/kernel/setup.c9
-rw-r--r--arch/x86_64/kernel/signal.c7
-rw-r--r--arch/x86_64/kernel/smp.c6
-rw-r--r--arch/x86_64/kernel/tce.c12
-rw-r--r--arch/x86_64/kernel/time.c158
-rw-r--r--arch/x86_64/kernel/tsc.c39
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S25
-rw-r--r--arch/x86_64/kernel/vsyscall.c22
-rw-r--r--arch/x86_64/mm/fault.c4
-rw-r--r--arch/x86_64/mm/init.c11
-rw-r--r--arch/x86_64/mm/k8topology.c13
-rw-r--r--arch/x86_64/mm/numa.c15
-rw-r--r--arch/x86_64/mm/pageattr.c23
-rw-r--r--arch/x86_64/mm/srat.c97
-rw-r--r--arch/x86_64/pci/k8-bus.c6
-rw-r--r--arch/x86_64/vdso/Makefile49
-rw-r--r--arch/x86_64/vdso/vclock_gettime.c120
-rw-r--r--arch/x86_64/vdso/vdso-note.S12
-rw-r--r--arch/x86_64/vdso/vdso-start.S2
-rw-r--r--arch/x86_64/vdso/vdso.S2
-rw-r--r--arch/x86_64/vdso/vdso.lds.S77
-rw-r--r--arch/x86_64/vdso/vextern.h16
-rw-r--r--arch/x86_64/vdso/vgetcpu.c50
-rw-r--r--arch/x86_64/vdso/vma.c139
-rw-r--r--arch/x86_64/vdso/voffset.h1
-rw-r--r--arch/x86_64/vdso/vvar.c12
101 files changed, 2629 insertions, 1275 deletions
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 4d8425de6922..e96a3dcdc1a7 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -285,6 +285,8 @@ static void davinci_set_mode(enum clock_event_mode mode,
285 case CLOCK_EVT_MODE_SHUTDOWN: 285 case CLOCK_EVT_MODE_SHUTDOWN:
286 t->opts = TIMER_OPTS_DISABLED; 286 t->opts = TIMER_OPTS_DISABLED;
287 break; 287 break;
288 case CLOCK_EVT_MODE_RESUME:
289 break;
288 } 290 }
289} 291}
290 292
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index 010f6fa984a6..d86d124aea22 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -159,6 +159,7 @@ static void imx_set_mode(enum clock_event_mode mode, struct clock_event_device *
159 break; 159 break;
160 case CLOCK_EVT_MODE_SHUTDOWN: 160 case CLOCK_EVT_MODE_SHUTDOWN:
161 case CLOCK_EVT_MODE_UNUSED: 161 case CLOCK_EVT_MODE_UNUSED:
162 case CLOCK_EVT_MODE_RESUME:
162 /* Left event sources disabled, no more interrupts appears */ 163 /* Left event sources disabled, no more interrupts appears */
163 break; 164 break;
164 } 165 }
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 8112f726ffa0..23e7fba6d3e1 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -459,6 +459,8 @@ static void ixp4xx_set_mode(enum clock_event_mode mode,
459 default: 459 default:
460 osrt = opts = 0; 460 osrt = opts = 0;
461 break; 461 break;
462 case CLOCK_EVT_MODE_RESUME:
463 break;
462 } 464 }
463 465
464 *IXP4XX_OSRT1 = osrt | opts; 466 *IXP4XX_OSRT1 = osrt | opts;
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 3705d20c4e5c..237651ebae5d 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -156,6 +156,7 @@ static void omap_mpu_set_mode(enum clock_event_mode mode,
156 break; 156 break;
157 case CLOCK_EVT_MODE_UNUSED: 157 case CLOCK_EVT_MODE_UNUSED:
158 case CLOCK_EVT_MODE_SHUTDOWN: 158 case CLOCK_EVT_MODE_SHUTDOWN:
159 case CLOCK_EVT_MODE_RESUME:
159 break; 160 break;
160 } 161 }
161} 162}
diff --git a/arch/arm/plat-omap/timer32k.c b/arch/arm/plat-omap/timer32k.c
index 2feceec8eccd..b0af014b0e2c 100644
--- a/arch/arm/plat-omap/timer32k.c
+++ b/arch/arm/plat-omap/timer32k.c
@@ -156,6 +156,8 @@ static void omap_32k_timer_set_mode(enum clock_event_mode mode,
156 case CLOCK_EVT_MODE_SHUTDOWN: 156 case CLOCK_EVT_MODE_SHUTDOWN:
157 omap_32k_timer_stop(); 157 omap_32k_timer_stop();
158 break; 158 break;
159 case CLOCK_EVT_MODE_RESUME:
160 break;
159 } 161 }
160} 162}
161 163
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 7a11b905ef49..abb582bc218f 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -18,6 +18,10 @@ config GENERIC_TIME
18 bool 18 bool
19 default y 19 default y
20 20
21config GENERIC_CMOS_UPDATE
22 bool
23 default y
24
21config CLOCKSOURCE_WATCHDOG 25config CLOCKSOURCE_WATCHDOG
22 bool 26 bool
23 default y 27 default y
@@ -544,6 +548,7 @@ config HIGHMEM4G
544config HIGHMEM64G 548config HIGHMEM64G
545 bool "64GB" 549 bool "64GB"
546 depends on !M386 && !M486 550 depends on !M386 && !M486
551 select X86_PAE
547 help 552 help
548 Select this if you have a 32-bit processor and more than 4 553 Select this if you have a 32-bit processor and more than 4
549 gigabytes of physical RAM. 554 gigabytes of physical RAM.
@@ -573,12 +578,12 @@ choice
573 config VMSPLIT_3G 578 config VMSPLIT_3G
574 bool "3G/1G user/kernel split" 579 bool "3G/1G user/kernel split"
575 config VMSPLIT_3G_OPT 580 config VMSPLIT_3G_OPT
576 depends on !HIGHMEM 581 depends on !X86_PAE
577 bool "3G/1G user/kernel split (for full 1G low memory)" 582 bool "3G/1G user/kernel split (for full 1G low memory)"
578 config VMSPLIT_2G 583 config VMSPLIT_2G
579 bool "2G/2G user/kernel split" 584 bool "2G/2G user/kernel split"
580 config VMSPLIT_2G_OPT 585 config VMSPLIT_2G_OPT
581 depends on !HIGHMEM 586 depends on !X86_PAE
582 bool "2G/2G user/kernel split (for full 2G low memory)" 587 bool "2G/2G user/kernel split (for full 2G low memory)"
583 config VMSPLIT_1G 588 config VMSPLIT_1G
584 bool "1G/3G user/kernel split" 589 bool "1G/3G user/kernel split"
@@ -598,10 +603,15 @@ config HIGHMEM
598 default y 603 default y
599 604
600config X86_PAE 605config X86_PAE
601 bool 606 bool "PAE (Physical Address Extension) Support"
602 depends on HIGHMEM64G 607 default n
603 default y 608 depends on !HIGHMEM4G
604 select RESOURCES_64BIT 609 select RESOURCES_64BIT
610 help
611 PAE is required for NX support, and furthermore enables
612 larger swapspace support for non-overcommit purposes. It
613 has the cost of more pagetable lookup overhead, and also
614 consumes more pagetable space per process.
605 615
606# Common NUMA Features 616# Common NUMA Features
607config NUMA 617config NUMA
@@ -817,6 +827,7 @@ config CRASH_DUMP
817 827
818config PHYSICAL_START 828config PHYSICAL_START
819 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) 829 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
830 default "0x1000000" if X86_NUMAQ
820 default "0x100000" 831 default "0x100000"
821 help 832 help
822 This gives the physical address where the kernel is loaded. 833 This gives the physical address where the kernel is loaded.
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 0ac62cdcd3b7..54ee1764fdae 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc2 3# Linux kernel version: 2.6.22-git14
4# Mon May 21 13:23:44 2007 4# Fri Jul 20 09:53:15 2007
5# 5#
6CONFIG_X86_32=y 6CONFIG_X86_32=y
7CONFIG_GENERIC_TIME=y 7CONFIG_GENERIC_TIME=y
@@ -37,19 +37,18 @@ CONFIG_LOCALVERSION=""
37CONFIG_LOCALVERSION_AUTO=y 37CONFIG_LOCALVERSION_AUTO=y
38CONFIG_SWAP=y 38CONFIG_SWAP=y
39CONFIG_SYSVIPC=y 39CONFIG_SYSVIPC=y
40# CONFIG_IPC_NS is not set
41CONFIG_SYSVIPC_SYSCTL=y 40CONFIG_SYSVIPC_SYSCTL=y
42CONFIG_POSIX_MQUEUE=y 41CONFIG_POSIX_MQUEUE=y
43# CONFIG_BSD_PROCESS_ACCT is not set 42# CONFIG_BSD_PROCESS_ACCT is not set
44# CONFIG_TASKSTATS is not set 43# CONFIG_TASKSTATS is not set
45# CONFIG_UTS_NS is not set 44# CONFIG_USER_NS is not set
46# CONFIG_AUDIT is not set 45# CONFIG_AUDIT is not set
47CONFIG_IKCONFIG=y 46CONFIG_IKCONFIG=y
48CONFIG_IKCONFIG_PROC=y 47CONFIG_IKCONFIG_PROC=y
49CONFIG_LOG_BUF_SHIFT=18 48CONFIG_LOG_BUF_SHIFT=18
50# CONFIG_CPUSETS is not set 49# CONFIG_CPUSETS is not set
51CONFIG_SYSFS_DEPRECATED=y 50CONFIG_SYSFS_DEPRECATED=y
52# CONFIG_RELAY is not set 51CONFIG_RELAY=y
53CONFIG_BLK_DEV_INITRD=y 52CONFIG_BLK_DEV_INITRD=y
54CONFIG_INITRAMFS_SOURCE="" 53CONFIG_INITRAMFS_SOURCE=""
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y 54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -73,16 +72,13 @@ CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y 72CONFIG_EVENTFD=y
74CONFIG_SHMEM=y 73CONFIG_SHMEM=y
75CONFIG_VM_EVENT_COUNTERS=y 74CONFIG_VM_EVENT_COUNTERS=y
76CONFIG_SLAB=y 75CONFIG_SLUB_DEBUG=y
77# CONFIG_SLUB is not set 76# CONFIG_SLAB is not set
77CONFIG_SLUB=y
78# CONFIG_SLOB is not set 78# CONFIG_SLOB is not set
79CONFIG_RT_MUTEXES=y 79CONFIG_RT_MUTEXES=y
80# CONFIG_TINY_SHMEM is not set 80# CONFIG_TINY_SHMEM is not set
81CONFIG_BASE_SMALL=0 81CONFIG_BASE_SMALL=0
82
83#
84# Loadable module support
85#
86CONFIG_MODULES=y 82CONFIG_MODULES=y
87CONFIG_MODULE_UNLOAD=y 83CONFIG_MODULE_UNLOAD=y
88CONFIG_MODULE_FORCE_UNLOAD=y 84CONFIG_MODULE_FORCE_UNLOAD=y
@@ -90,14 +86,11 @@ CONFIG_MODULE_FORCE_UNLOAD=y
90# CONFIG_MODULE_SRCVERSION_ALL is not set 86# CONFIG_MODULE_SRCVERSION_ALL is not set
91# CONFIG_KMOD is not set 87# CONFIG_KMOD is not set
92CONFIG_STOP_MACHINE=y 88CONFIG_STOP_MACHINE=y
93
94#
95# Block layer
96#
97CONFIG_BLOCK=y 89CONFIG_BLOCK=y
98CONFIG_LBD=y 90CONFIG_LBD=y
99# CONFIG_BLK_DEV_IO_TRACE is not set 91# CONFIG_BLK_DEV_IO_TRACE is not set
100# CONFIG_LSF is not set 92# CONFIG_LSF is not set
93# CONFIG_BLK_DEV_BSG is not set
101 94
102# 95#
103# IO Schedulers 96# IO Schedulers
@@ -201,6 +194,7 @@ CONFIG_X86_CPUID=y
201# CONFIG_EDD is not set 194# CONFIG_EDD is not set
202# CONFIG_DELL_RBU is not set 195# CONFIG_DELL_RBU is not set
203# CONFIG_DCDBAS is not set 196# CONFIG_DCDBAS is not set
197CONFIG_DMIID=y
204# CONFIG_NOHIGHMEM is not set 198# CONFIG_NOHIGHMEM is not set
205CONFIG_HIGHMEM4G=y 199CONFIG_HIGHMEM4G=y
206# CONFIG_HIGHMEM64G is not set 200# CONFIG_HIGHMEM64G is not set
@@ -217,7 +211,9 @@ CONFIG_FLAT_NODE_MEM_MAP=y
217CONFIG_SPLIT_PTLOCK_CPUS=4 211CONFIG_SPLIT_PTLOCK_CPUS=4
218CONFIG_RESOURCES_64BIT=y 212CONFIG_RESOURCES_64BIT=y
219CONFIG_ZONE_DMA_FLAG=1 213CONFIG_ZONE_DMA_FLAG=1
214CONFIG_BOUNCE=y
220CONFIG_NR_QUICK=1 215CONFIG_NR_QUICK=1
216CONFIG_VIRT_TO_BUS=y
221# CONFIG_HIGHPTE is not set 217# CONFIG_HIGHPTE is not set
222# CONFIG_MATH_EMULATION is not set 218# CONFIG_MATH_EMULATION is not set
223CONFIG_MTRR=y 219CONFIG_MTRR=y
@@ -244,7 +240,6 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
244CONFIG_PM=y 240CONFIG_PM=y
245CONFIG_PM_LEGACY=y 241CONFIG_PM_LEGACY=y
246# CONFIG_PM_DEBUG is not set 242# CONFIG_PM_DEBUG is not set
247# CONFIG_PM_SYSFS_DEPRECATED is not set
248 243
249# 244#
250# ACPI (Advanced Configuration and Power Interface) Support 245# ACPI (Advanced Configuration and Power Interface) Support
@@ -284,7 +279,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
284# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 279# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
285CONFIG_CPU_FREQ_GOV_USERSPACE=y 280CONFIG_CPU_FREQ_GOV_USERSPACE=y
286CONFIG_CPU_FREQ_GOV_ONDEMAND=y 281CONFIG_CPU_FREQ_GOV_ONDEMAND=y
287# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set 282CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
288 283
289# 284#
290# CPUFreq processor drivers 285# CPUFreq processor drivers
@@ -325,7 +320,7 @@ CONFIG_PCI_MMCONFIG=y
325CONFIG_ARCH_SUPPORTS_MSI=y 320CONFIG_ARCH_SUPPORTS_MSI=y
326CONFIG_PCI_MSI=y 321CONFIG_PCI_MSI=y
327# CONFIG_PCI_DEBUG is not set 322# CONFIG_PCI_DEBUG is not set
328CONFIG_HT_IRQ=y 323# CONFIG_HT_IRQ is not set
329CONFIG_ISA_DMA_API=y 324CONFIG_ISA_DMA_API=y
330# CONFIG_ISA is not set 325# CONFIG_ISA is not set
331# CONFIG_MCA is not set 326# CONFIG_MCA is not set
@@ -381,7 +376,7 @@ CONFIG_IP_PNP_DHCP=y
381CONFIG_INET_TUNNEL=y 376CONFIG_INET_TUNNEL=y
382CONFIG_INET_XFRM_MODE_TRANSPORT=y 377CONFIG_INET_XFRM_MODE_TRANSPORT=y
383CONFIG_INET_XFRM_MODE_TUNNEL=y 378CONFIG_INET_XFRM_MODE_TUNNEL=y
384CONFIG_INET_XFRM_MODE_BEET=y 379# CONFIG_INET_XFRM_MODE_BEET is not set
385CONFIG_INET_DIAG=y 380CONFIG_INET_DIAG=y
386CONFIG_INET_TCP_DIAG=y 381CONFIG_INET_TCP_DIAG=y
387# CONFIG_TCP_CONG_ADVANCED is not set 382# CONFIG_TCP_CONG_ADVANCED is not set
@@ -400,27 +395,15 @@ CONFIG_IPV6=y
400# CONFIG_INET6_TUNNEL is not set 395# CONFIG_INET6_TUNNEL is not set
401CONFIG_INET6_XFRM_MODE_TRANSPORT=y 396CONFIG_INET6_XFRM_MODE_TRANSPORT=y
402CONFIG_INET6_XFRM_MODE_TUNNEL=y 397CONFIG_INET6_XFRM_MODE_TUNNEL=y
403CONFIG_INET6_XFRM_MODE_BEET=y 398# CONFIG_INET6_XFRM_MODE_BEET is not set
404# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 399# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
405CONFIG_IPV6_SIT=y 400CONFIG_IPV6_SIT=y
406# CONFIG_IPV6_TUNNEL is not set 401# CONFIG_IPV6_TUNNEL is not set
407# CONFIG_IPV6_MULTIPLE_TABLES is not set 402# CONFIG_IPV6_MULTIPLE_TABLES is not set
408# CONFIG_NETWORK_SECMARK is not set 403# CONFIG_NETWORK_SECMARK is not set
409# CONFIG_NETFILTER is not set 404# CONFIG_NETFILTER is not set
410
411#
412# DCCP Configuration (EXPERIMENTAL)
413#
414# CONFIG_IP_DCCP is not set 405# CONFIG_IP_DCCP is not set
415
416#
417# SCTP Configuration (EXPERIMENTAL)
418#
419# CONFIG_IP_SCTP is not set 406# CONFIG_IP_SCTP is not set
420
421#
422# TIPC Configuration (EXPERIMENTAL)
423#
424# CONFIG_TIPC is not set 407# CONFIG_TIPC is not set
425# CONFIG_ATM is not set 408# CONFIG_ATM is not set
426# CONFIG_BRIDGE is not set 409# CONFIG_BRIDGE is not set
@@ -457,6 +440,7 @@ CONFIG_IPV6_SIT=y
457# CONFIG_MAC80211 is not set 440# CONFIG_MAC80211 is not set
458# CONFIG_IEEE80211 is not set 441# CONFIG_IEEE80211 is not set
459# CONFIG_RFKILL is not set 442# CONFIG_RFKILL is not set
443# CONFIG_NET_9P is not set
460 444
461# 445#
462# Device Drivers 446# Device Drivers
@@ -471,21 +455,9 @@ CONFIG_FW_LOADER=y
471# CONFIG_DEBUG_DRIVER is not set 455# CONFIG_DEBUG_DRIVER is not set
472# CONFIG_DEBUG_DEVRES is not set 456# CONFIG_DEBUG_DEVRES is not set
473# CONFIG_SYS_HYPERVISOR is not set 457# CONFIG_SYS_HYPERVISOR is not set
474
475#
476# Connector - unified userspace <-> kernelspace linker
477#
478# CONFIG_CONNECTOR is not set 458# CONFIG_CONNECTOR is not set
479# CONFIG_MTD is not set 459# CONFIG_MTD is not set
480
481#
482# Parallel port support
483#
484# CONFIG_PARPORT is not set 460# CONFIG_PARPORT is not set
485
486#
487# Plug and Play support
488#
489CONFIG_PNP=y 461CONFIG_PNP=y
490# CONFIG_PNP_DEBUG is not set 462# CONFIG_PNP_DEBUG is not set
491 463
@@ -493,10 +465,7 @@ CONFIG_PNP=y
493# Protocols 465# Protocols
494# 466#
495CONFIG_PNPACPI=y 467CONFIG_PNPACPI=y
496 468CONFIG_BLK_DEV=y
497#
498# Block devices
499#
500CONFIG_BLK_DEV_FD=y 469CONFIG_BLK_DEV_FD=y
501# CONFIG_BLK_CPQ_DA is not set 470# CONFIG_BLK_CPQ_DA is not set
502# CONFIG_BLK_CPQ_CISS_DA is not set 471# CONFIG_BLK_CPQ_CISS_DA is not set
@@ -514,17 +483,14 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
514CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 483CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
515# CONFIG_CDROM_PKTCDVD is not set 484# CONFIG_CDROM_PKTCDVD is not set
516# CONFIG_ATA_OVER_ETH is not set 485# CONFIG_ATA_OVER_ETH is not set
517 486CONFIG_MISC_DEVICES=y
518#
519# Misc devices
520#
521# CONFIG_IBM_ASM is not set 487# CONFIG_IBM_ASM is not set
522# CONFIG_PHANTOM is not set 488# CONFIG_PHANTOM is not set
489# CONFIG_EEPROM_93CX6 is not set
523# CONFIG_SGI_IOC4 is not set 490# CONFIG_SGI_IOC4 is not set
524# CONFIG_TIFM_CORE is not set 491# CONFIG_TIFM_CORE is not set
525# CONFIG_SONY_LAPTOP is not set 492# CONFIG_SONY_LAPTOP is not set
526# CONFIG_THINKPAD_ACPI is not set 493# CONFIG_THINKPAD_ACPI is not set
527# CONFIG_BLINK is not set
528CONFIG_IDE=y 494CONFIG_IDE=y
529CONFIG_BLK_DEV_IDE=y 495CONFIG_BLK_DEV_IDE=y
530 496
@@ -596,6 +562,7 @@ CONFIG_BLK_DEV_IDEDMA=y
596# 562#
597# CONFIG_RAID_ATTRS is not set 563# CONFIG_RAID_ATTRS is not set
598CONFIG_SCSI=y 564CONFIG_SCSI=y
565CONFIG_SCSI_DMA=y
599# CONFIG_SCSI_TGT is not set 566# CONFIG_SCSI_TGT is not set
600CONFIG_SCSI_NETLINK=y 567CONFIG_SCSI_NETLINK=y
601# CONFIG_SCSI_PROC_FS is not set 568# CONFIG_SCSI_PROC_FS is not set
@@ -606,8 +573,9 @@ CONFIG_SCSI_NETLINK=y
606CONFIG_BLK_DEV_SD=y 573CONFIG_BLK_DEV_SD=y
607# CONFIG_CHR_DEV_ST is not set 574# CONFIG_CHR_DEV_ST is not set
608# CONFIG_CHR_DEV_OSST is not set 575# CONFIG_CHR_DEV_OSST is not set
609# CONFIG_BLK_DEV_SR is not set 576CONFIG_BLK_DEV_SR=y
610# CONFIG_CHR_DEV_SG is not set 577# CONFIG_BLK_DEV_SR_VENDOR is not set
578CONFIG_CHR_DEV_SG=y
611# CONFIG_CHR_DEV_SCH is not set 579# CONFIG_CHR_DEV_SCH is not set
612 580
613# 581#
@@ -667,6 +635,7 @@ CONFIG_AIC79XX_DEBUG_MASK=0
667# CONFIG_SCSI_INIA100 is not set 635# CONFIG_SCSI_INIA100 is not set
668# CONFIG_SCSI_STEX is not set 636# CONFIG_SCSI_STEX is not set
669# CONFIG_SCSI_SYM53C8XX_2 is not set 637# CONFIG_SCSI_SYM53C8XX_2 is not set
638# CONFIG_SCSI_IPR is not set
670# CONFIG_SCSI_QLOGIC_1280 is not set 639# CONFIG_SCSI_QLOGIC_1280 is not set
671# CONFIG_SCSI_QLA_FC is not set 640# CONFIG_SCSI_QLA_FC is not set
672# CONFIG_SCSI_QLA_ISCSI is not set 641# CONFIG_SCSI_QLA_ISCSI is not set
@@ -675,14 +644,73 @@ CONFIG_AIC79XX_DEBUG_MASK=0
675# CONFIG_SCSI_DC390T is not set 644# CONFIG_SCSI_DC390T is not set
676# CONFIG_SCSI_NSP32 is not set 645# CONFIG_SCSI_NSP32 is not set
677# CONFIG_SCSI_DEBUG is not set 646# CONFIG_SCSI_DEBUG is not set
678# CONFIG_SCSI_ESP_CORE is not set
679# CONFIG_SCSI_SRP is not set 647# CONFIG_SCSI_SRP is not set
680# CONFIG_ATA is not set 648CONFIG_ATA=y
681 649# CONFIG_ATA_NONSTANDARD is not set
682# 650CONFIG_ATA_ACPI=y
683# Multi-device support (RAID and LVM) 651CONFIG_SATA_AHCI=y
684# 652CONFIG_SATA_SVW=y
685# CONFIG_MD is not set 653CONFIG_ATA_PIIX=y
654# CONFIG_SATA_MV is not set
655CONFIG_SATA_NV=y
656# CONFIG_PDC_ADMA is not set
657# CONFIG_SATA_QSTOR is not set
658# CONFIG_SATA_PROMISE is not set
659# CONFIG_SATA_SX4 is not set
660CONFIG_SATA_SIL=y
661# CONFIG_SATA_SIL24 is not set
662# CONFIG_SATA_SIS is not set
663# CONFIG_SATA_ULI is not set
664CONFIG_SATA_VIA=y
665# CONFIG_SATA_VITESSE is not set
666# CONFIG_SATA_INIC162X is not set
667# CONFIG_PATA_ALI is not set
668# CONFIG_PATA_AMD is not set
669# CONFIG_PATA_ARTOP is not set
670# CONFIG_PATA_ATIIXP is not set
671# CONFIG_PATA_CMD640_PCI is not set
672# CONFIG_PATA_CMD64X is not set
673# CONFIG_PATA_CS5520 is not set
674# CONFIG_PATA_CS5530 is not set
675# CONFIG_PATA_CS5535 is not set
676# CONFIG_PATA_CYPRESS is not set
677# CONFIG_PATA_EFAR is not set
678# CONFIG_ATA_GENERIC is not set
679# CONFIG_PATA_HPT366 is not set
680# CONFIG_PATA_HPT37X is not set
681# CONFIG_PATA_HPT3X2N is not set
682# CONFIG_PATA_HPT3X3 is not set
683# CONFIG_PATA_IT821X is not set
684# CONFIG_PATA_IT8213 is not set
685# CONFIG_PATA_JMICRON is not set
686# CONFIG_PATA_TRIFLEX is not set
687# CONFIG_PATA_MARVELL is not set
688# CONFIG_PATA_MPIIX is not set
689# CONFIG_PATA_OLDPIIX is not set
690# CONFIG_PATA_NETCELL is not set
691# CONFIG_PATA_NS87410 is not set
692# CONFIG_PATA_OPTI is not set
693# CONFIG_PATA_OPTIDMA is not set
694# CONFIG_PATA_PDC_OLD is not set
695# CONFIG_PATA_RADISYS is not set
696# CONFIG_PATA_RZ1000 is not set
697# CONFIG_PATA_SC1200 is not set
698# CONFIG_PATA_SERVERWORKS is not set
699# CONFIG_PATA_PDC2027X is not set
700# CONFIG_PATA_SIL680 is not set
701# CONFIG_PATA_SIS is not set
702# CONFIG_PATA_VIA is not set
703# CONFIG_PATA_WINBOND is not set
704CONFIG_MD=y
705# CONFIG_BLK_DEV_MD is not set
706CONFIG_BLK_DEV_DM=y
707# CONFIG_DM_DEBUG is not set
708# CONFIG_DM_CRYPT is not set
709# CONFIG_DM_SNAPSHOT is not set
710# CONFIG_DM_MIRROR is not set
711# CONFIG_DM_ZERO is not set
712# CONFIG_DM_MULTIPATH is not set
713# CONFIG_DM_DELAY is not set
686 714
687# 715#
688# Fusion MPT device support 716# Fusion MPT device support
@@ -723,42 +751,27 @@ CONFIG_IEEE1394_OHCI1394=y
723# CONFIG_IEEE1394_ETH1394 is not set 751# CONFIG_IEEE1394_ETH1394 is not set
724# CONFIG_IEEE1394_DV1394 is not set 752# CONFIG_IEEE1394_DV1394 is not set
725CONFIG_IEEE1394_RAWIO=y 753CONFIG_IEEE1394_RAWIO=y
726
727#
728# I2O device support
729#
730# CONFIG_I2O is not set 754# CONFIG_I2O is not set
731# CONFIG_MACINTOSH_DRIVERS is not set 755CONFIG_MACINTOSH_DRIVERS=y
732 756# CONFIG_MAC_EMUMOUSEBTN is not set
733#
734# Network device support
735#
736CONFIG_NETDEVICES=y 757CONFIG_NETDEVICES=y
758CONFIG_NETDEVICES_MULTIQUEUE=y
737# CONFIG_DUMMY is not set 759# CONFIG_DUMMY is not set
738# CONFIG_BONDING is not set 760# CONFIG_BONDING is not set
761# CONFIG_MACVLAN is not set
739# CONFIG_EQUALIZER is not set 762# CONFIG_EQUALIZER is not set
740# CONFIG_TUN is not set 763# CONFIG_TUN is not set
741# CONFIG_NET_SB1000 is not set 764# CONFIG_NET_SB1000 is not set
742
743#
744# ARCnet devices
745#
746# CONFIG_ARCNET is not set 765# CONFIG_ARCNET is not set
747# CONFIG_PHYLIB is not set 766# CONFIG_PHYLIB is not set
748
749#
750# Ethernet (10 or 100Mbit)
751#
752CONFIG_NET_ETHERNET=y 767CONFIG_NET_ETHERNET=y
753CONFIG_MII=y 768CONFIG_MII=y
754# CONFIG_HAPPYMEAL is not set 769# CONFIG_HAPPYMEAL is not set
755# CONFIG_SUNGEM is not set 770# CONFIG_SUNGEM is not set
756# CONFIG_CASSINI is not set 771# CONFIG_CASSINI is not set
757# CONFIG_NET_VENDOR_3COM is not set 772CONFIG_NET_VENDOR_3COM=y
758 773CONFIG_VORTEX=y
759# 774# CONFIG_TYPHOON is not set
760# Tulip family network device support
761#
762CONFIG_NET_TULIP=y 775CONFIG_NET_TULIP=y
763# CONFIG_DE2104X is not set 776# CONFIG_DE2104X is not set
764CONFIG_TULIP=y 777CONFIG_TULIP=y
@@ -809,7 +822,6 @@ CONFIG_R8169=y
809# CONFIG_SIS190 is not set 822# CONFIG_SIS190 is not set
810# CONFIG_SKGE is not set 823# CONFIG_SKGE is not set
811CONFIG_SKY2=y 824CONFIG_SKY2=y
812# CONFIG_SK98LIN is not set
813# CONFIG_VIA_VELOCITY is not set 825# CONFIG_VIA_VELOCITY is not set
814CONFIG_TIGON3=y 826CONFIG_TIGON3=y
815CONFIG_BNX2=y 827CONFIG_BNX2=y
@@ -823,10 +835,6 @@ CONFIG_NETDEV_10000=y
823# CONFIG_MYRI10GE is not set 835# CONFIG_MYRI10GE is not set
824# CONFIG_NETXEN_NIC is not set 836# CONFIG_NETXEN_NIC is not set
825# CONFIG_MLX4_CORE is not set 837# CONFIG_MLX4_CORE is not set
826
827#
828# Token Ring devices
829#
830# CONFIG_TR is not set 838# CONFIG_TR is not set
831 839
832# 840#
@@ -855,15 +863,7 @@ CONFIG_NETCONSOLE=y
855CONFIG_NETPOLL=y 863CONFIG_NETPOLL=y
856# CONFIG_NETPOLL_TRAP is not set 864# CONFIG_NETPOLL_TRAP is not set
857CONFIG_NET_POLL_CONTROLLER=y 865CONFIG_NET_POLL_CONTROLLER=y
858
859#
860# ISDN subsystem
861#
862# CONFIG_ISDN is not set 866# CONFIG_ISDN is not set
863
864#
865# Telephony Support
866#
867# CONFIG_PHONE is not set 867# CONFIG_PHONE is not set
868 868
869# 869#
@@ -871,6 +871,7 @@ CONFIG_NET_POLL_CONTROLLER=y
871# 871#
872CONFIG_INPUT=y 872CONFIG_INPUT=y
873# CONFIG_INPUT_FF_MEMLESS is not set 873# CONFIG_INPUT_FF_MEMLESS is not set
874# CONFIG_INPUT_POLLDEV is not set
874 875
875# 876#
876# Userland interfaces 877# Userland interfaces
@@ -936,6 +937,7 @@ CONFIG_HW_CONSOLE=y
936# 937#
937CONFIG_SERIAL_8250=y 938CONFIG_SERIAL_8250=y
938CONFIG_SERIAL_8250_CONSOLE=y 939CONFIG_SERIAL_8250_CONSOLE=y
940CONFIG_FIX_EARLYCON_MEM=y
939CONFIG_SERIAL_8250_PCI=y 941CONFIG_SERIAL_8250_PCI=y
940CONFIG_SERIAL_8250_PNP=y 942CONFIG_SERIAL_8250_PNP=y
941CONFIG_SERIAL_8250_NR_UARTS=4 943CONFIG_SERIAL_8250_NR_UARTS=4
@@ -951,10 +953,6 @@ CONFIG_SERIAL_CORE_CONSOLE=y
951CONFIG_UNIX98_PTYS=y 953CONFIG_UNIX98_PTYS=y
952CONFIG_LEGACY_PTYS=y 954CONFIG_LEGACY_PTYS=y
953CONFIG_LEGACY_PTY_COUNT=256 955CONFIG_LEGACY_PTY_COUNT=256
954
955#
956# IPMI
957#
958# CONFIG_IPMI_HANDLER is not set 956# CONFIG_IPMI_HANDLER is not set
959# CONFIG_WATCHDOG is not set 957# CONFIG_WATCHDOG is not set
960CONFIG_HW_RANDOM=y 958CONFIG_HW_RANDOM=y
@@ -988,11 +986,7 @@ CONFIG_MAX_RAW_DEVS=256
988CONFIG_HPET=y 986CONFIG_HPET=y
989# CONFIG_HPET_RTC_IRQ is not set 987# CONFIG_HPET_RTC_IRQ is not set
990CONFIG_HPET_MMAP=y 988CONFIG_HPET_MMAP=y
991CONFIG_HANGCHECK_TIMER=y 989# CONFIG_HANGCHECK_TIMER is not set
992
993#
994# TPM devices
995#
996# CONFIG_TCG_TPM is not set 990# CONFIG_TCG_TPM is not set
997# CONFIG_TELCLOCK is not set 991# CONFIG_TELCLOCK is not set
998CONFIG_DEVPORT=y 992CONFIG_DEVPORT=y
@@ -1003,11 +997,8 @@ CONFIG_DEVPORT=y
1003# 997#
1004# CONFIG_SPI is not set 998# CONFIG_SPI is not set
1005# CONFIG_SPI_MASTER is not set 999# CONFIG_SPI_MASTER is not set
1006
1007#
1008# Dallas's 1-wire bus
1009#
1010# CONFIG_W1 is not set 1000# CONFIG_W1 is not set
1001# CONFIG_POWER_SUPPLY is not set
1011# CONFIG_HWMON is not set 1002# CONFIG_HWMON is not set
1012 1003
1013# 1004#
@@ -1041,7 +1032,7 @@ CONFIG_DAB=y
1041CONFIG_VGA_CONSOLE=y 1032CONFIG_VGA_CONSOLE=y
1042CONFIG_VGACON_SOFT_SCROLLBACK=y 1033CONFIG_VGACON_SOFT_SCROLLBACK=y
1043CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128 1034CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=128
1044# CONFIG_VIDEO_SELECT is not set 1035CONFIG_VIDEO_SELECT=y
1045CONFIG_DUMMY_CONSOLE=y 1036CONFIG_DUMMY_CONSOLE=y
1046 1037
1047# 1038#
@@ -1058,15 +1049,11 @@ CONFIG_SOUND=y
1058# Open Sound System 1049# Open Sound System
1059# 1050#
1060CONFIG_SOUND_PRIME=y 1051CONFIG_SOUND_PRIME=y
1061# CONFIG_OSS_OBSOLETE is not set
1062# CONFIG_SOUND_TRIDENT is not set 1052# CONFIG_SOUND_TRIDENT is not set
1063# CONFIG_SOUND_MSNDCLAS is not set 1053# CONFIG_SOUND_MSNDCLAS is not set
1064# CONFIG_SOUND_MSNDPIN is not set 1054# CONFIG_SOUND_MSNDPIN is not set
1065# CONFIG_SOUND_OSS is not set 1055# CONFIG_SOUND_OSS is not set
1066 1056CONFIG_HID_SUPPORT=y
1067#
1068# HID Devices
1069#
1070CONFIG_HID=y 1057CONFIG_HID=y
1071# CONFIG_HID_DEBUG is not set 1058# CONFIG_HID_DEBUG is not set
1072 1059
@@ -1077,10 +1064,7 @@ CONFIG_USB_HID=y
1077# CONFIG_USB_HIDINPUT_POWERBOOK is not set 1064# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1078# CONFIG_HID_FF is not set 1065# CONFIG_HID_FF is not set
1079# CONFIG_USB_HIDDEV is not set 1066# CONFIG_USB_HIDDEV is not set
1080 1067CONFIG_USB_SUPPORT=y
1081#
1082# USB support
1083#
1084CONFIG_USB_ARCH_HAS_HCD=y 1068CONFIG_USB_ARCH_HAS_HCD=y
1085CONFIG_USB_ARCH_HAS_OHCI=y 1069CONFIG_USB_ARCH_HAS_OHCI=y
1086CONFIG_USB_ARCH_HAS_EHCI=y 1070CONFIG_USB_ARCH_HAS_EHCI=y
@@ -1094,6 +1078,7 @@ CONFIG_USB_DEVICEFS=y
1094# CONFIG_USB_DEVICE_CLASS is not set 1078# CONFIG_USB_DEVICE_CLASS is not set
1095# CONFIG_USB_DYNAMIC_MINORS is not set 1079# CONFIG_USB_DYNAMIC_MINORS is not set
1096# CONFIG_USB_SUSPEND is not set 1080# CONFIG_USB_SUSPEND is not set
1081# CONFIG_USB_PERSIST is not set
1097# CONFIG_USB_OTG is not set 1082# CONFIG_USB_OTG is not set
1098 1083
1099# 1084#
@@ -1103,7 +1088,6 @@ CONFIG_USB_EHCI_HCD=y
1103# CONFIG_USB_EHCI_SPLIT_ISO is not set 1088# CONFIG_USB_EHCI_SPLIT_ISO is not set
1104# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1089# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1105# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1090# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1106# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
1107# CONFIG_USB_ISP116X_HCD is not set 1091# CONFIG_USB_ISP116X_HCD is not set
1108CONFIG_USB_OHCI_HCD=y 1092CONFIG_USB_OHCI_HCD=y
1109# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1093# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -1111,6 +1095,7 @@ CONFIG_USB_OHCI_HCD=y
1111CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1095CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1112CONFIG_USB_UHCI_HCD=y 1096CONFIG_USB_UHCI_HCD=y
1113# CONFIG_USB_SL811_HCD is not set 1097# CONFIG_USB_SL811_HCD is not set
1098# CONFIG_USB_R8A66597_HCD is not set
1114 1099
1115# 1100#
1116# USB Device Class drivers 1101# USB Device Class drivers
@@ -1201,15 +1186,7 @@ CONFIG_USB_MON=y
1201# 1186#
1202# LED Triggers 1187# LED Triggers
1203# 1188#
1204
1205#
1206# InfiniBand support
1207#
1208# CONFIG_INFINIBAND is not set 1189# CONFIG_INFINIBAND is not set
1209
1210#
1211# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1212#
1213# CONFIG_EDAC is not set 1190# CONFIG_EDAC is not set
1214 1191
1215# 1192#
@@ -1229,11 +1206,13 @@ CONFIG_USB_MON=y
1229# 1206#
1230# DMA Devices 1207# DMA Devices
1231# 1208#
1209CONFIG_VIRTUALIZATION=y
1210# CONFIG_KVM is not set
1232 1211
1233# 1212#
1234# Virtualization 1213# Userspace I/O
1235# 1214#
1236# CONFIG_KVM is not set 1215# CONFIG_UIO is not set
1237 1216
1238# 1217#
1239# File systems 1218# File systems
@@ -1271,6 +1250,7 @@ CONFIG_DNOTIFY=y
1271# CONFIG_AUTOFS_FS is not set 1250# CONFIG_AUTOFS_FS is not set
1272CONFIG_AUTOFS4_FS=y 1251CONFIG_AUTOFS4_FS=y
1273# CONFIG_FUSE_FS is not set 1252# CONFIG_FUSE_FS is not set
1253CONFIG_GENERIC_ACL=y
1274 1254
1275# 1255#
1276# CD-ROM/DVD Filesystems 1256# CD-ROM/DVD Filesystems
@@ -1298,7 +1278,7 @@ CONFIG_PROC_KCORE=y
1298CONFIG_PROC_SYSCTL=y 1278CONFIG_PROC_SYSCTL=y
1299CONFIG_SYSFS=y 1279CONFIG_SYSFS=y
1300CONFIG_TMPFS=y 1280CONFIG_TMPFS=y
1301# CONFIG_TMPFS_POSIX_ACL is not set 1281CONFIG_TMPFS_POSIX_ACL=y
1302CONFIG_HUGETLBFS=y 1282CONFIG_HUGETLBFS=y
1303CONFIG_HUGETLB_PAGE=y 1283CONFIG_HUGETLB_PAGE=y
1304CONFIG_RAMFS=y 1284CONFIG_RAMFS=y
@@ -1348,7 +1328,6 @@ CONFIG_SUNRPC=y
1348# CONFIG_NCP_FS is not set 1328# CONFIG_NCP_FS is not set
1349# CONFIG_CODA_FS is not set 1329# CONFIG_CODA_FS is not set
1350# CONFIG_AFS_FS is not set 1330# CONFIG_AFS_FS is not set
1351# CONFIG_9P_FS is not set
1352 1331
1353# 1332#
1354# Partition Types 1333# Partition Types
@@ -1404,10 +1383,7 @@ CONFIG_NLS_UTF8=y
1404# Distributed Lock Manager 1383# Distributed Lock Manager
1405# 1384#
1406# CONFIG_DLM is not set 1385# CONFIG_DLM is not set
1407 1386CONFIG_INSTRUMENTATION=y
1408#
1409# Instrumentation Support
1410#
1411CONFIG_PROFILING=y 1387CONFIG_PROFILING=y
1412CONFIG_OPROFILE=y 1388CONFIG_OPROFILE=y
1413CONFIG_KPROBES=y 1389CONFIG_KPROBES=y
@@ -1417,7 +1393,7 @@ CONFIG_KPROBES=y
1417# 1393#
1418CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1394CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1419# CONFIG_PRINTK_TIME is not set 1395# CONFIG_PRINTK_TIME is not set
1420CONFIG_ENABLE_MUST_CHECK=y 1396# CONFIG_ENABLE_MUST_CHECK is not set
1421CONFIG_MAGIC_SYSRQ=y 1397CONFIG_MAGIC_SYSRQ=y
1422CONFIG_UNUSED_SYMBOLS=y 1398CONFIG_UNUSED_SYMBOLS=y
1423# CONFIG_DEBUG_FS is not set 1399# CONFIG_DEBUG_FS is not set
@@ -1425,15 +1401,17 @@ CONFIG_UNUSED_SYMBOLS=y
1425CONFIG_DEBUG_KERNEL=y 1401CONFIG_DEBUG_KERNEL=y
1426# CONFIG_DEBUG_SHIRQ is not set 1402# CONFIG_DEBUG_SHIRQ is not set
1427CONFIG_DETECT_SOFTLOCKUP=y 1403CONFIG_DETECT_SOFTLOCKUP=y
1404# CONFIG_SCHED_DEBUG is not set
1428# CONFIG_SCHEDSTATS is not set 1405# CONFIG_SCHEDSTATS is not set
1429# CONFIG_TIMER_STATS is not set 1406CONFIG_TIMER_STATS=y
1430# CONFIG_DEBUG_SLAB is not set 1407# CONFIG_SLUB_DEBUG_ON is not set
1431# CONFIG_DEBUG_RT_MUTEXES is not set 1408# CONFIG_DEBUG_RT_MUTEXES is not set
1432# CONFIG_RT_MUTEX_TESTER is not set 1409# CONFIG_RT_MUTEX_TESTER is not set
1433# CONFIG_DEBUG_SPINLOCK is not set 1410# CONFIG_DEBUG_SPINLOCK is not set
1434# CONFIG_DEBUG_MUTEXES is not set 1411# CONFIG_DEBUG_MUTEXES is not set
1435# CONFIG_DEBUG_LOCK_ALLOC is not set 1412# CONFIG_DEBUG_LOCK_ALLOC is not set
1436# CONFIG_PROVE_LOCKING is not set 1413# CONFIG_PROVE_LOCKING is not set
1414# CONFIG_LOCK_STAT is not set
1437# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1415# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1438# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1416# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1439# CONFIG_DEBUG_KOBJECT is not set 1417# CONFIG_DEBUG_KOBJECT is not set
@@ -1443,7 +1421,6 @@ CONFIG_DEBUG_BUGVERBOSE=y
1443# CONFIG_DEBUG_VM is not set 1421# CONFIG_DEBUG_VM is not set
1444# CONFIG_DEBUG_LIST is not set 1422# CONFIG_DEBUG_LIST is not set
1445# CONFIG_FRAME_POINTER is not set 1423# CONFIG_FRAME_POINTER is not set
1446# CONFIG_UNWIND_INFO is not set
1447# CONFIG_FORCED_INLINING is not set 1424# CONFIG_FORCED_INLINING is not set
1448# CONFIG_RCU_TORTURE_TEST is not set 1425# CONFIG_RCU_TORTURE_TEST is not set
1449# CONFIG_LKDTM is not set 1426# CONFIG_LKDTM is not set
@@ -1462,10 +1439,6 @@ CONFIG_DOUBLEFAULT=y
1462# 1439#
1463# CONFIG_KEYS is not set 1440# CONFIG_KEYS is not set
1464# CONFIG_SECURITY is not set 1441# CONFIG_SECURITY is not set
1465
1466#
1467# Cryptographic options
1468#
1469# CONFIG_CRYPTO is not set 1442# CONFIG_CRYPTO is not set
1470 1443
1471# 1444#
@@ -1476,6 +1449,7 @@ CONFIG_BITREVERSE=y
1476# CONFIG_CRC16 is not set 1449# CONFIG_CRC16 is not set
1477# CONFIG_CRC_ITU_T is not set 1450# CONFIG_CRC_ITU_T is not set
1478CONFIG_CRC32=y 1451CONFIG_CRC32=y
1452# CONFIG_CRC7 is not set
1479# CONFIG_LIBCRC32C is not set 1453# CONFIG_LIBCRC32C is not set
1480CONFIG_ZLIB_INFLATE=y 1454CONFIG_ZLIB_INFLATE=y
1481CONFIG_PLIST=y 1455CONFIG_PLIST=y
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 06da59f6f837..dbe5e87e0d66 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_VM86) += vm86.o
40obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 40obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
41obj-$(CONFIG_HPET_TIMER) += hpet.o 41obj-$(CONFIG_HPET_TIMER) += hpet.o
42obj-$(CONFIG_K8_NB) += k8.o 42obj-$(CONFIG_K8_NB) += k8.o
43obj-$(CONFIG_MGEODE_LX) += geode.o
43 44
44obj-$(CONFIG_VMI) += vmi.o vmiclock.o 45obj-$(CONFIG_VMI) += vmi.o vmiclock.o
45obj-$(CONFIG_PARAVIRT) += paravirt.o 46obj-$(CONFIG_PARAVIRT) += paravirt.o
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index a574cd2c8b61..b87cedeaf59b 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -618,6 +618,8 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table)
618#ifdef CONFIG_HPET_TIMER 618#ifdef CONFIG_HPET_TIMER
619#include <asm/hpet.h> 619#include <asm/hpet.h>
620 620
621static struct __initdata resource *hpet_res;
622
621static int __init acpi_parse_hpet(struct acpi_table_header *table) 623static int __init acpi_parse_hpet(struct acpi_table_header *table)
622{ 624{
623 struct acpi_table_hpet *hpet_tbl; 625 struct acpi_table_hpet *hpet_tbl;
@@ -638,8 +640,42 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
638 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 640 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
639 hpet_tbl->id, hpet_address); 641 hpet_tbl->id, hpet_address);
640 642
643 /*
644 * Allocate and initialize the HPET firmware resource for adding into
645 * the resource tree during the lateinit timeframe.
646 */
647#define HPET_RESOURCE_NAME_SIZE 9
648 hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
649
650 if (!hpet_res)
651 return 0;
652
653 memset(hpet_res, 0, sizeof(*hpet_res));
654 hpet_res->name = (void *)&hpet_res[1];
655 hpet_res->flags = IORESOURCE_MEM;
656 snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, "HPET %u",
657 hpet_tbl->sequence);
658
659 hpet_res->start = hpet_address;
660 hpet_res->end = hpet_address + (1 * 1024) - 1;
661
641 return 0; 662 return 0;
642} 663}
664
665/*
666 * hpet_insert_resource inserts the HPET resources used into the resource
667 * tree.
668 */
669static __init int hpet_insert_resource(void)
670{
671 if (!hpet_res)
672 return 1;
673
674 return insert_resource(&iomem_resource, hpet_res);
675}
676
677late_initcall(hpet_insert_resource);
678
643#else 679#else
644#define acpi_parse_hpet NULL 680#define acpi_parse_hpet NULL
645#endif 681#endif
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index d8cda14fff8b..0695be538de5 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -5,9 +5,8 @@
5#include <asm/alternative.h> 5#include <asm/alternative.h>
6#include <asm/sections.h> 6#include <asm/sections.h>
7 7
8static int noreplace_smp = 0; 8#ifdef CONFIG_HOTPLUG_CPU
9static int smp_alt_once = 0; 9static int smp_alt_once;
10static int debug_alternative = 0;
11 10
12static int __init bootonly(char *str) 11static int __init bootonly(char *str)
13{ 12{
@@ -15,6 +14,11 @@ static int __init bootonly(char *str)
15 return 1; 14 return 1;
16} 15}
17__setup("smp-alt-boot", bootonly); 16__setup("smp-alt-boot", bootonly);
17#else
18#define smp_alt_once 1
19#endif
20
21static int debug_alternative;
18 22
19static int __init debug_alt(char *str) 23static int __init debug_alt(char *str)
20{ 24{
@@ -23,6 +27,8 @@ static int __init debug_alt(char *str)
23} 27}
24__setup("debug-alternative", debug_alt); 28__setup("debug-alternative", debug_alt);
25 29
30static int noreplace_smp;
31
26static int __init setup_noreplace_smp(char *str) 32static int __init setup_noreplace_smp(char *str)
27{ 33{
28 noreplace_smp = 1; 34 noreplace_smp = 1;
@@ -376,8 +382,6 @@ void __init alternative_instructions(void)
376#ifdef CONFIG_HOTPLUG_CPU 382#ifdef CONFIG_HOTPLUG_CPU
377 if (num_possible_cpus() < 2) 383 if (num_possible_cpus() < 2)
378 smp_alt_once = 1; 384 smp_alt_once = 1;
379#else
380 smp_alt_once = 1;
381#endif 385#endif
382 386
383#ifdef CONFIG_SMP 387#ifdef CONFIG_SMP
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 67824f3bb974..bfc6cb7df7e7 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -263,6 +263,9 @@ static void lapic_timer_setup(enum clock_event_mode mode,
263 v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR); 263 v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
264 apic_write_around(APIC_LVTT, v); 264 apic_write_around(APIC_LVTT, v);
265 break; 265 break;
266 case CLOCK_EVT_MODE_RESUME:
267 /* Nothing to do here */
268 break;
266 } 269 }
267 270
268 local_irq_restore(flags); 271 local_irq_restore(flags);
@@ -315,7 +318,7 @@ static void __devinit setup_APIC_timer(void)
315 318
316#define LAPIC_CAL_LOOPS (HZ/10) 319#define LAPIC_CAL_LOOPS (HZ/10)
317 320
318static __initdata volatile int lapic_cal_loops = -1; 321static __initdata int lapic_cal_loops = -1;
319static __initdata long lapic_cal_t1, lapic_cal_t2; 322static __initdata long lapic_cal_t1, lapic_cal_t2;
320static __initdata unsigned long long lapic_cal_tsc1, lapic_cal_tsc2; 323static __initdata unsigned long long lapic_cal_tsc1, lapic_cal_tsc2;
321static __initdata unsigned long lapic_cal_pm1, lapic_cal_pm2; 324static __initdata unsigned long lapic_cal_pm1, lapic_cal_pm2;
@@ -485,7 +488,7 @@ void __init setup_boot_APIC_clock(void)
485 /* Let the interrupts run */ 488 /* Let the interrupts run */
486 local_irq_enable(); 489 local_irq_enable();
487 490
488 while(lapic_cal_loops <= LAPIC_CAL_LOOPS) 491 while (lapic_cal_loops <= LAPIC_CAL_LOOPS)
489 cpu_relax(); 492 cpu_relax();
490 493
491 local_irq_disable(); 494 local_irq_disable();
@@ -521,6 +524,9 @@ void __init setup_boot_APIC_clock(void)
521 */ 524 */
522 if (nmi_watchdog != NMI_IO_APIC) 525 if (nmi_watchdog != NMI_IO_APIC)
523 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY; 526 lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
527 else
528 printk(KERN_WARNING "APIC timer registered as dummy,"
529 " due to nmi_watchdog=1!\n");
524 } 530 }
525 531
526 /* Setup the lapic or request the broadcast */ 532 /* Setup the lapic or request the broadcast */
diff --git a/arch/i386/kernel/cpu/Makefile b/arch/i386/kernel/cpu/Makefile
index 0b6a8551e9e2..778396c78d65 100644
--- a/arch/i386/kernel/cpu/Makefile
+++ b/arch/i386/kernel/cpu/Makefile
@@ -9,7 +9,6 @@ obj-y += cyrix.o
9obj-y += centaur.o 9obj-y += centaur.o
10obj-y += transmeta.o 10obj-y += transmeta.o
11obj-y += intel.o intel_cacheinfo.o addon_cpuid_features.o 11obj-y += intel.o intel_cacheinfo.o addon_cpuid_features.o
12obj-y += rise.o
13obj-y += nexgen.o 12obj-y += nexgen.o
14obj-y += umc.o 13obj-y += umc.o
15 14
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index 6f47eeeb93ea..815a5f0aa474 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -272,8 +272,12 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
272 } 272 }
273#endif 273#endif
274 274
275 if (cpuid_eax(0x80000000) >= 0x80000006) 275 if (cpuid_eax(0x80000000) >= 0x80000006) {
276 num_cache_leaves = 3; 276 if ((c->x86 == 0x10) && (cpuid_edx(0x80000006) & 0xf000))
277 num_cache_leaves = 4;
278 else
279 num_cache_leaves = 3;
280 }
277 281
278 if (amd_apic_timer_broken()) 282 if (amd_apic_timer_broken())
279 set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability); 283 set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability);
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index e5419a9dec88..d506201d397c 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -606,7 +606,6 @@ extern int nsc_init_cpu(void);
606extern int amd_init_cpu(void); 606extern int amd_init_cpu(void);
607extern int centaur_init_cpu(void); 607extern int centaur_init_cpu(void);
608extern int transmeta_init_cpu(void); 608extern int transmeta_init_cpu(void);
609extern int rise_init_cpu(void);
610extern int nexgen_init_cpu(void); 609extern int nexgen_init_cpu(void);
611extern int umc_init_cpu(void); 610extern int umc_init_cpu(void);
612 611
@@ -618,7 +617,6 @@ void __init early_cpu_init(void)
618 amd_init_cpu(); 617 amd_init_cpu();
619 centaur_init_cpu(); 618 centaur_init_cpu();
620 transmeta_init_cpu(); 619 transmeta_init_cpu();
621 rise_init_cpu();
622 nexgen_init_cpu(); 620 nexgen_init_cpu();
623 umc_init_cpu(); 621 umc_init_cpu();
624 early_cpu_detect(); 622 early_cpu_detect();
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index e5be819492ef..d5a456d27d82 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -4,7 +4,7 @@
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 : CPUID4 emulation on AMD. 7 * Andi Kleen / Andreas Herrmann : CPUID4 emulation on AMD.
8 */ 8 */
9 9
10#include <linux/init.h> 10#include <linux/init.h>
@@ -135,7 +135,7 @@ unsigned short num_cache_leaves;
135 135
136/* AMD doesn't have CPUID4. Emulate it here to report the same 136/* AMD doesn't have CPUID4. Emulate it here to report the same
137 information to the user. This makes some assumptions about the machine: 137 information to the user. This makes some assumptions about the machine:
138 No L3, L2 not shared, no SMT etc. that is currently true on AMD CPUs. 138 L2 not shared, no SMT etc. that is currently true on AMD CPUs.
139 139
140 In theory the TLBs could be reported as fake type (they are in "dummy"). 140 In theory the TLBs could be reported as fake type (they are in "dummy").
141 Maybe later */ 141 Maybe later */
@@ -159,13 +159,26 @@ union l2_cache {
159 unsigned val; 159 unsigned val;
160}; 160};
161 161
162union l3_cache {
163 struct {
164 unsigned line_size : 8;
165 unsigned lines_per_tag : 4;
166 unsigned assoc : 4;
167 unsigned res : 2;
168 unsigned size_encoded : 14;
169 };
170 unsigned val;
171};
172
162static const unsigned short assocs[] = { 173static const unsigned short assocs[] = {
163 [1] = 1, [2] = 2, [4] = 4, [6] = 8, 174 [1] = 1, [2] = 2, [4] = 4, [6] = 8,
164 [8] = 16, 175 [8] = 16, [0xa] = 32, [0xb] = 48,
176 [0xc] = 64,
165 [0xf] = 0xffff // ?? 177 [0xf] = 0xffff // ??
166 }; 178};
167static const unsigned char levels[] = { 1, 1, 2 }; 179
168static const unsigned char types[] = { 1, 2, 3 }; 180static const unsigned char levels[] = { 1, 1, 2, 3 };
181static const unsigned char types[] = { 1, 2, 3, 3 };
169 182
170static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, 183static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
171 union _cpuid4_leaf_ebx *ebx, 184 union _cpuid4_leaf_ebx *ebx,
@@ -175,37 +188,58 @@ static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
175 unsigned line_size, lines_per_tag, assoc, size_in_kb; 188 unsigned line_size, lines_per_tag, assoc, size_in_kb;
176 union l1_cache l1i, l1d; 189 union l1_cache l1i, l1d;
177 union l2_cache l2; 190 union l2_cache l2;
191 union l3_cache l3;
192 union l1_cache *l1 = &l1d;
178 193
179 eax->full = 0; 194 eax->full = 0;
180 ebx->full = 0; 195 ebx->full = 0;
181 ecx->full = 0; 196 ecx->full = 0;
182 197
183 cpuid(0x80000005, &dummy, &dummy, &l1d.val, &l1i.val); 198 cpuid(0x80000005, &dummy, &dummy, &l1d.val, &l1i.val);
184 cpuid(0x80000006, &dummy, &dummy, &l2.val, &dummy); 199 cpuid(0x80000006, &dummy, &dummy, &l2.val, &l3.val);
185 200
186 if (leaf > 2 || !l1d.val || !l1i.val || !l2.val) 201 switch (leaf) {
187 return; 202 case 1:
188 203 l1 = &l1i;
189 eax->split.is_self_initializing = 1; 204 case 0:
190 eax->split.type = types[leaf]; 205 if (!l1->val)
191 eax->split.level = levels[leaf]; 206 return;
192 eax->split.num_threads_sharing = 0;
193 eax->split.num_cores_on_die = current_cpu_data.x86_max_cores - 1;
194
195 if (leaf <= 1) {
196 union l1_cache *l1 = leaf == 0 ? &l1d : &l1i;
197 assoc = l1->assoc; 207 assoc = l1->assoc;
198 line_size = l1->line_size; 208 line_size = l1->line_size;
199 lines_per_tag = l1->lines_per_tag; 209 lines_per_tag = l1->lines_per_tag;
200 size_in_kb = l1->size_in_kb; 210 size_in_kb = l1->size_in_kb;
201 } else { 211 break;
212 case 2:
213 if (!l2.val)
214 return;
202 assoc = l2.assoc; 215 assoc = l2.assoc;
203 line_size = l2.line_size; 216 line_size = l2.line_size;
204 lines_per_tag = l2.lines_per_tag; 217 lines_per_tag = l2.lines_per_tag;
205 /* cpu_data has errata corrections for K7 applied */ 218 /* cpu_data has errata corrections for K7 applied */
206 size_in_kb = current_cpu_data.x86_cache_size; 219 size_in_kb = current_cpu_data.x86_cache_size;
220 break;
221 case 3:
222 if (!l3.val)
223 return;
224 assoc = l3.assoc;
225 line_size = l3.line_size;
226 lines_per_tag = l3.lines_per_tag;
227 size_in_kb = l3.size_encoded * 512;
228 break;
229 default:
230 return;
207 } 231 }
208 232
233 eax->split.is_self_initializing = 1;
234 eax->split.type = types[leaf];
235 eax->split.level = levels[leaf];
236 if (leaf == 3)
237 eax->split.num_threads_sharing = current_cpu_data.x86_max_cores - 1;
238 else
239 eax->split.num_threads_sharing = 0;
240 eax->split.num_cores_on_die = current_cpu_data.x86_max_cores - 1;
241
242
209 if (assoc == 0xf) 243 if (assoc == 0xf)
210 eax->split.is_fully_associative = 1; 244 eax->split.is_fully_associative = 1;
211 ebx->split.coherency_line_size = line_size - 1; 245 ebx->split.coherency_line_size = line_size - 1;
@@ -239,8 +273,7 @@ static int __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le
239 return 0; 273 return 0;
240} 274}
241 275
242/* will only be called once; __init is safe here */ 276static int __cpuinit find_num_cache_leaves(void)
243static int __init find_num_cache_leaves(void)
244{ 277{
245 unsigned int eax, ebx, ecx, edx; 278 unsigned int eax, ebx, ecx, edx;
246 union _cpuid4_leaf_eax cache_eax; 279 union _cpuid4_leaf_eax cache_eax;
@@ -710,7 +743,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
710 return retval; 743 return retval;
711} 744}
712 745
713static void __cpuexit cache_remove_dev(struct sys_device * sys_dev) 746static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
714{ 747{
715 unsigned int cpu = sys_dev->id; 748 unsigned int cpu = sys_dev->id;
716 unsigned long i; 749 unsigned long i;
diff --git a/arch/i386/kernel/cpu/mcheck/non-fatal.c b/arch/i386/kernel/cpu/mcheck/non-fatal.c
index 6b5d3518a1c0..bf39409b3838 100644
--- a/arch/i386/kernel/cpu/mcheck/non-fatal.c
+++ b/arch/i386/kernel/cpu/mcheck/non-fatal.c
@@ -57,7 +57,7 @@ static DECLARE_DELAYED_WORK(mce_work, mce_work_fn);
57static void mce_work_fn(struct work_struct *work) 57static void mce_work_fn(struct work_struct *work)
58{ 58{
59 on_each_cpu(mce_checkregs, NULL, 1, 1); 59 on_each_cpu(mce_checkregs, NULL, 1, 1);
60 schedule_delayed_work(&mce_work, MCE_RATE); 60 schedule_delayed_work(&mce_work, round_jiffies_relative(MCE_RATE));
61} 61}
62 62
63static int __init init_nonfatal_mce_checker(void) 63static int __init init_nonfatal_mce_checker(void)
@@ -82,7 +82,7 @@ static int __init init_nonfatal_mce_checker(void)
82 /* 82 /*
83 * Check for non-fatal errors every MCE_RATE s 83 * Check for non-fatal errors every MCE_RATE s
84 */ 84 */
85 schedule_delayed_work(&mce_work, MCE_RATE); 85 schedule_delayed_work(&mce_work, round_jiffies_relative(MCE_RATE));
86 printk(KERN_INFO "Machine check exception polling timer started.\n"); 86 printk(KERN_INFO "Machine check exception polling timer started.\n");
87 return 0; 87 return 0;
88} 88}
diff --git a/arch/i386/kernel/cpu/mtrr/generic.c b/arch/i386/kernel/cpu/mtrr/generic.c
index f6e46943e6ef..56f64e34829f 100644
--- a/arch/i386/kernel/cpu/mtrr/generic.c
+++ b/arch/i386/kernel/cpu/mtrr/generic.c
@@ -79,7 +79,7 @@ static void print_fixed(unsigned base, unsigned step, const mtrr_type*types)
79} 79}
80 80
81/* Grab all of the MTRR state for this CPU into *state */ 81/* Grab all of the MTRR state for this CPU into *state */
82void get_mtrr_state(void) 82void __init get_mtrr_state(void)
83{ 83{
84 unsigned int i; 84 unsigned int i;
85 struct mtrr_var_range *vrs; 85 struct mtrr_var_range *vrs;
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 75dc6d5214bc..c48b6fea5ab4 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -643,7 +643,7 @@ static struct sysdev_driver mtrr_sysdev_driver = {
643 * initialized (i.e. before smp_init()). 643 * initialized (i.e. before smp_init()).
644 * 644 *
645 */ 645 */
646__init void mtrr_bp_init(void) 646void __init mtrr_bp_init(void)
647{ 647{
648 init_ifs(); 648 init_ifs();
649 649
diff --git a/arch/i386/kernel/cpu/perfctr-watchdog.c b/arch/i386/kernel/cpu/perfctr-watchdog.c
index 4d26d514c56f..30b5e48aa76b 100644
--- a/arch/i386/kernel/cpu/perfctr-watchdog.c
+++ b/arch/i386/kernel/cpu/perfctr-watchdog.c
@@ -599,8 +599,8 @@ static struct wd_ops intel_arch_wd_ops = {
599 .setup = setup_intel_arch_watchdog, 599 .setup = setup_intel_arch_watchdog,
600 .rearm = p6_rearm, 600 .rearm = p6_rearm,
601 .stop = single_msr_stop_watchdog, 601 .stop = single_msr_stop_watchdog,
602 .perfctr = MSR_ARCH_PERFMON_PERFCTR0, 602 .perfctr = MSR_ARCH_PERFMON_PERFCTR1,
603 .evntsel = MSR_ARCH_PERFMON_EVENTSEL0, 603 .evntsel = MSR_ARCH_PERFMON_EVENTSEL1,
604}; 604};
605 605
606static void probe_nmi_watchdog(void) 606static void probe_nmi_watchdog(void)
diff --git a/arch/i386/kernel/cpu/rise.c b/arch/i386/kernel/cpu/rise.c
deleted file mode 100644
index 50076f22e90f..000000000000
--- a/arch/i386/kernel/cpu/rise.c
+++ /dev/null
@@ -1,52 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/bitops.h>
4#include <asm/processor.h>
5
6#include "cpu.h"
7
8static void __cpuinit init_rise(struct cpuinfo_x86 *c)
9{
10 printk("CPU: Rise iDragon");
11 if (c->x86_model > 2)
12 printk(" II");
13 printk("\n");
14
15 /* Unhide possibly hidden capability flags
16 The mp6 iDragon family don't have MSRs.
17 We switch on extra features with this cpuid weirdness: */
18 __asm__ (
19 "movl $0x6363452a, %%eax\n\t"
20 "movl $0x3231206c, %%ecx\n\t"
21 "movl $0x2a32313a, %%edx\n\t"
22 "cpuid\n\t"
23 "movl $0x63634523, %%eax\n\t"
24 "movl $0x32315f6c, %%ecx\n\t"
25 "movl $0x2333313a, %%edx\n\t"
26 "cpuid\n\t" : : : "eax", "ebx", "ecx", "edx"
27 );
28 set_bit(X86_FEATURE_CX8, c->x86_capability);
29}
30
31static struct cpu_dev rise_cpu_dev __cpuinitdata = {
32 .c_vendor = "Rise",
33 .c_ident = { "RiseRiseRise" },
34 .c_models = {
35 { .vendor = X86_VENDOR_RISE, .family = 5, .model_names =
36 {
37 [0] = "iDragon",
38 [2] = "iDragon",
39 [8] = "iDragon II",
40 [9] = "iDragon II"
41 }
42 },
43 },
44 .c_init = init_rise,
45};
46
47int __init rise_init_cpu(void)
48{
49 cpu_devs[X86_VENDOR_RISE] = &rise_cpu_dev;
50 return 0;
51}
52
diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index fc822a46897a..e60cddbc4cfb 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -10,6 +10,7 @@
10#include <linux/efi.h> 10#include <linux/efi.h>
11#include <linux/pfn.h> 11#include <linux/pfn.h>
12#include <linux/uaccess.h> 12#include <linux/uaccess.h>
13#include <linux/suspend.h>
13 14
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <asm/page.h> 16#include <asm/page.h>
@@ -320,6 +321,37 @@ static int __init request_standard_resources(void)
320 321
321subsys_initcall(request_standard_resources); 322subsys_initcall(request_standard_resources);
322 323
324#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
325/**
326 * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
327 * correspond to e820 RAM areas and mark the corresponding pages as nosave for
328 * hibernation.
329 *
330 * This function requires the e820 map to be sorted and without any
331 * overlapping entries and assumes the first e820 area to be RAM.
332 */
333void __init e820_mark_nosave_regions(void)
334{
335 int i;
336 unsigned long pfn;
337
338 pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
339 for (i = 1; i < e820.nr_map; i++) {
340 struct e820entry *ei = &e820.map[i];
341
342 if (pfn < PFN_UP(ei->addr))
343 register_nosave_region(pfn, PFN_UP(ei->addr));
344
345 pfn = PFN_DOWN(ei->addr + ei->size);
346 if (ei->type != E820_RAM)
347 register_nosave_region(PFN_UP(ei->addr), pfn);
348
349 if (pfn >= max_low_pfn)
350 break;
351 }
352}
353#endif
354
323void __init add_memory_region(unsigned long long start, 355void __init add_memory_region(unsigned long long start,
324 unsigned long long size, int type) 356 unsigned long long size, int type)
325{ 357{
diff --git a/arch/i386/kernel/geode.c b/arch/i386/kernel/geode.c
new file mode 100644
index 000000000000..41e8aec4c61d
--- /dev/null
+++ b/arch/i386/kernel/geode.c
@@ -0,0 +1,155 @@
1/*
2 * AMD Geode southbridge support code
3 * Copyright (C) 2006, Advanced Micro Devices, Inc.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
8 */
9
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/ioport.h>
13#include <linux/io.h>
14#include <asm/msr.h>
15#include <asm/geode.h>
16
17static struct {
18 char *name;
19 u32 msr;
20 int size;
21 u32 base;
22} lbars[] = {
23 { "geode-pms", MSR_LBAR_PMS, LBAR_PMS_SIZE, 0 },
24 { "geode-acpi", MSR_LBAR_ACPI, LBAR_ACPI_SIZE, 0 },
25 { "geode-gpio", MSR_LBAR_GPIO, LBAR_GPIO_SIZE, 0 },
26 { "geode-mfgpt", MSR_LBAR_MFGPT, LBAR_MFGPT_SIZE, 0 }
27};
28
29static void __init init_lbars(void)
30{
31 u32 lo, hi;
32 int i;
33
34 for (i = 0; i < ARRAY_SIZE(lbars); i++) {
35 rdmsr(lbars[i].msr, lo, hi);
36 if (hi & 0x01)
37 lbars[i].base = lo & 0x0000ffff;
38
39 if (lbars[i].base == 0)
40 printk(KERN_ERR "geode: Couldn't initialize '%s'\n",
41 lbars[i].name);
42 }
43}
44
45int geode_get_dev_base(unsigned int dev)
46{
47 BUG_ON(dev >= ARRAY_SIZE(lbars));
48 return lbars[dev].base;
49}
50EXPORT_SYMBOL_GPL(geode_get_dev_base);
51
52/* === GPIO API === */
53
54void geode_gpio_set(unsigned int gpio, unsigned int reg)
55{
56 u32 base = geode_get_dev_base(GEODE_DEV_GPIO);
57
58 if (!base)
59 return;
60
61 if (gpio < 16)
62 outl(1 << gpio, base + reg);
63 else
64 outl(1 << (gpio - 16), base + 0x80 + reg);
65}
66EXPORT_SYMBOL_GPL(geode_gpio_set);
67
68void geode_gpio_clear(unsigned int gpio, unsigned int reg)
69{
70 u32 base = geode_get_dev_base(GEODE_DEV_GPIO);
71
72 if (!base)
73 return;
74
75 if (gpio < 16)
76 outl(1 << (gpio + 16), base + reg);
77 else
78 outl(1 << gpio, base + 0x80 + reg);
79}
80EXPORT_SYMBOL_GPL(geode_gpio_clear);
81
82int geode_gpio_isset(unsigned int gpio, unsigned int reg)
83{
84 u32 base = geode_get_dev_base(GEODE_DEV_GPIO);
85
86 if (!base)
87 return 0;
88
89 if (gpio < 16)
90 return (inl(base + reg) & (1 << gpio)) ? 1 : 0;
91 else
92 return (inl(base + 0x80 + reg) & (1 << (gpio - 16))) ? 1 : 0;
93}
94EXPORT_SYMBOL_GPL(geode_gpio_isset);
95
96void geode_gpio_set_irq(unsigned int group, unsigned int irq)
97{
98 u32 lo, hi;
99
100 if (group > 7 || irq > 15)
101 return;
102
103 rdmsr(MSR_PIC_ZSEL_HIGH, lo, hi);
104
105 lo &= ~(0xF << (group * 4));
106 lo |= (irq & 0xF) << (group * 4);
107
108 wrmsr(MSR_PIC_ZSEL_HIGH, lo, hi);
109}
110EXPORT_SYMBOL_GPL(geode_gpio_set_irq);
111
112void geode_gpio_setup_event(unsigned int gpio, int pair, int pme)
113{
114 u32 base = geode_get_dev_base(GEODE_DEV_GPIO);
115 u32 offset, shift, val;
116
117 if (gpio >= 24)
118 offset = GPIO_MAP_W;
119 else if (gpio >= 16)
120 offset = GPIO_MAP_Z;
121 else if (gpio >= 8)
122 offset = GPIO_MAP_Y;
123 else
124 offset = GPIO_MAP_X;
125
126 shift = (gpio % 8) * 4;
127
128 val = inl(base + offset);
129
130 /* Clear whatever was there before */
131 val &= ~(0xF << shift);
132
133 /* And set the new value */
134
135 val |= ((pair & 7) << shift);
136
137 /* Set the PME bit if this is a PME event */
138
139 if (pme)
140 val |= (1 << (shift + 3));
141
142 outl(val, base + offset);
143}
144EXPORT_SYMBOL_GPL(geode_gpio_setup_event);
145
146static int __init geode_southbridge_init(void)
147{
148 if (!is_geode())
149 return -ENODEV;
150
151 init_lbars();
152 return 0;
153}
154
155postcore_initcall(geode_southbridge_init);
diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
index 17d73459fc5f..533d4932bc79 100644
--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -5,6 +5,7 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/sysdev.h> 6#include <linux/sysdev.h>
7#include <linux/pm.h> 7#include <linux/pm.h>
8#include <linux/delay.h>
8 9
9#include <asm/hpet.h> 10#include <asm/hpet.h>
10#include <asm/io.h> 11#include <asm/io.h>
@@ -187,6 +188,10 @@ static void hpet_set_mode(enum clock_event_mode mode,
187 cfg &= ~HPET_TN_ENABLE; 188 cfg &= ~HPET_TN_ENABLE;
188 hpet_writel(cfg, HPET_T0_CFG); 189 hpet_writel(cfg, HPET_T0_CFG);
189 break; 190 break;
191
192 case CLOCK_EVT_MODE_RESUME:
193 hpet_enable_int();
194 break;
190 } 195 }
191} 196}
192 197
@@ -217,6 +222,7 @@ static struct clocksource clocksource_hpet = {
217 .mask = HPET_MASK, 222 .mask = HPET_MASK,
218 .shift = HPET_SHIFT, 223 .shift = HPET_SHIFT,
219 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 224 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
225 .resume = hpet_start_counter,
220}; 226};
221 227
222/* 228/*
@@ -226,7 +232,8 @@ int __init hpet_enable(void)
226{ 232{
227 unsigned long id; 233 unsigned long id;
228 uint64_t hpet_freq; 234 uint64_t hpet_freq;
229 u64 tmp; 235 u64 tmp, start, now;
236 cycle_t t1;
230 237
231 if (!is_hpet_capable()) 238 if (!is_hpet_capable())
232 return 0; 239 return 0;
@@ -273,6 +280,27 @@ int __init hpet_enable(void)
273 /* Start the counter */ 280 /* Start the counter */
274 hpet_start_counter(); 281 hpet_start_counter();
275 282
283 /* Verify whether hpet counter works */
284 t1 = read_hpet();
285 rdtscll(start);
286
287 /*
288 * We don't know the TSC frequency yet, but waiting for
289 * 200000 TSC cycles is safe:
290 * 4 GHz == 50us
291 * 1 GHz == 200us
292 */
293 do {
294 rep_nop();
295 rdtscll(now);
296 } while ((now - start) < 200000UL);
297
298 if (t1 == read_hpet()) {
299 printk(KERN_WARNING
300 "HPET counter not counting. HPET disabled\n");
301 goto out_nohpet;
302 }
303
276 /* Initialize and register HPET clocksource 304 /* Initialize and register HPET clocksource
277 * 305 *
278 * hpet period is in femto seconds per cycle 306 * hpet period is in femto seconds per cycle
@@ -291,7 +319,6 @@ int __init hpet_enable(void)
291 319
292 clocksource_register(&clocksource_hpet); 320 clocksource_register(&clocksource_hpet);
293 321
294
295 if (id & HPET_ID_LEGSUP) { 322 if (id & HPET_ID_LEGSUP) {
296 hpet_enable_int(); 323 hpet_enable_int();
297 hpet_reserve_platform_timers(id); 324 hpet_reserve_platform_timers(id);
@@ -299,7 +326,7 @@ int __init hpet_enable(void)
299 * Start hpet with the boot cpu mask and make it 326 * Start hpet with the boot cpu mask and make it
300 * global after the IO_APIC has been initialized. 327 * global after the IO_APIC has been initialized.
301 */ 328 */
302 hpet_clockevent.cpumask =cpumask_of_cpu(0); 329 hpet_clockevent.cpumask = cpumask_of_cpu(smp_processor_id());
303 clockevents_register_device(&hpet_clockevent); 330 clockevents_register_device(&hpet_clockevent);
304 global_clock_event = &hpet_clockevent; 331 global_clock_event = &hpet_clockevent;
305 return 1; 332 return 1;
@@ -524,68 +551,3 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
524 return IRQ_HANDLED; 551 return IRQ_HANDLED;
525} 552}
526#endif 553#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/i8253.c b/arch/i386/kernel/i8253.c
index f8a3c4054c70..6d839f2f1b1a 100644
--- a/arch/i386/kernel/i8253.c
+++ b/arch/i386/kernel/i8253.c
@@ -3,18 +3,17 @@
3 * 3 *
4 */ 4 */
5#include <linux/clockchips.h> 5#include <linux/clockchips.h>
6#include <linux/spinlock.h> 6#include <linux/init.h>
7#include <linux/interrupt.h>
7#include <linux/jiffies.h> 8#include <linux/jiffies.h>
8#include <linux/sysdev.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/init.h> 10#include <linux/spinlock.h>
11 11
12#include <asm/smp.h> 12#include <asm/smp.h>
13#include <asm/delay.h> 13#include <asm/delay.h>
14#include <asm/i8253.h> 14#include <asm/i8253.h>
15#include <asm/io.h> 15#include <asm/io.h>
16 16#include <asm/timer.h>
17#include "io_ports.h"
18 17
19DEFINE_SPINLOCK(i8253_lock); 18DEFINE_SPINLOCK(i8253_lock);
20EXPORT_SYMBOL(i8253_lock); 19EXPORT_SYMBOL(i8253_lock);
@@ -41,26 +40,27 @@ static void init_pit_timer(enum clock_event_mode mode,
41 case CLOCK_EVT_MODE_PERIODIC: 40 case CLOCK_EVT_MODE_PERIODIC:
42 /* binary, mode 2, LSB/MSB, ch 0 */ 41 /* binary, mode 2, LSB/MSB, ch 0 */
43 outb_p(0x34, PIT_MODE); 42 outb_p(0x34, PIT_MODE);
44 udelay(10);
45 outb_p(LATCH & 0xff , PIT_CH0); /* LSB */ 43 outb_p(LATCH & 0xff , PIT_CH0); /* LSB */
46 udelay(10);
47 outb(LATCH >> 8 , PIT_CH0); /* MSB */ 44 outb(LATCH >> 8 , PIT_CH0); /* MSB */
48 break; 45 break;
49 46
50 /*
51 * Avoid unnecessary state transitions, as it confuses
52 * Geode / Cyrix based boxen.
53 */
54 case CLOCK_EVT_MODE_SHUTDOWN: 47 case CLOCK_EVT_MODE_SHUTDOWN:
55 if (evt->mode == CLOCK_EVT_MODE_UNUSED)
56 break;
57 case CLOCK_EVT_MODE_UNUSED: 48 case CLOCK_EVT_MODE_UNUSED:
58 if (evt->mode == CLOCK_EVT_MODE_SHUTDOWN) 49 if (evt->mode == CLOCK_EVT_MODE_PERIODIC ||
59 break; 50 evt->mode == CLOCK_EVT_MODE_ONESHOT) {
51 outb_p(0x30, PIT_MODE);
52 outb_p(0, PIT_CH0);
53 outb_p(0, PIT_CH0);
54 }
55 break;
56
60 case CLOCK_EVT_MODE_ONESHOT: 57 case CLOCK_EVT_MODE_ONESHOT:
61 /* One shot setup */ 58 /* One shot setup */
62 outb_p(0x38, PIT_MODE); 59 outb_p(0x38, PIT_MODE);
63 udelay(10); 60 break;
61
62 case CLOCK_EVT_MODE_RESUME:
63 /* Nothing to do here */
64 break; 64 break;
65 } 65 }
66 spin_unlock_irqrestore(&i8253_lock, flags); 66 spin_unlock_irqrestore(&i8253_lock, flags);
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 21db8f56c9a1..893df8280756 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -353,14 +353,6 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
353# include <linux/slab.h> /* kmalloc() */ 353# include <linux/slab.h> /* kmalloc() */
354# include <linux/timer.h> /* time_after() */ 354# include <linux/timer.h> /* time_after() */
355 355
356#ifdef CONFIG_BALANCED_IRQ_DEBUG
357# define TDprintk(x...) do { printk("<%ld:%s:%d>: ", jiffies, __FILE__, __LINE__); printk(x); } while (0)
358# define Dprintk(x...) do { TDprintk(x); } while (0)
359# else
360# define TDprintk(x...)
361# define Dprintk(x...)
362# endif
363
364#define IRQBALANCE_CHECK_ARCH -999 356#define IRQBALANCE_CHECK_ARCH -999
365#define MAX_BALANCED_IRQ_INTERVAL (5*HZ) 357#define MAX_BALANCED_IRQ_INTERVAL (5*HZ)
366#define MIN_BALANCED_IRQ_INTERVAL (HZ/2) 358#define MIN_BALANCED_IRQ_INTERVAL (HZ/2)
@@ -443,7 +435,7 @@ static inline void balance_irq(int cpu, int irq)
443static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold) 435static inline void rotate_irqs_among_cpus(unsigned long useful_load_threshold)
444{ 436{
445 int i, j; 437 int i, j;
446 Dprintk("Rotating IRQs among CPUs.\n"); 438
447 for_each_online_cpu(i) { 439 for_each_online_cpu(i) {
448 for (j = 0; j < NR_IRQS; j++) { 440 for (j = 0; j < NR_IRQS; j++) {
449 if (!irq_desc[j].action) 441 if (!irq_desc[j].action)
@@ -560,19 +552,11 @@ tryanothercpu:
560 max_loaded = tmp_loaded; /* processor */ 552 max_loaded = tmp_loaded; /* processor */
561 imbalance = (max_cpu_irq - min_cpu_irq) / 2; 553 imbalance = (max_cpu_irq - min_cpu_irq) / 2;
562 554
563 Dprintk("max_loaded cpu = %d\n", max_loaded);
564 Dprintk("min_loaded cpu = %d\n", min_loaded);
565 Dprintk("max_cpu_irq load = %ld\n", max_cpu_irq);
566 Dprintk("min_cpu_irq load = %ld\n", min_cpu_irq);
567 Dprintk("load imbalance = %lu\n", imbalance);
568
569 /* if imbalance is less than approx 10% of max load, then 555 /* if imbalance is less than approx 10% of max load, then
570 * observe diminishing returns action. - quit 556 * observe diminishing returns action. - quit
571 */ 557 */
572 if (imbalance < (max_cpu_irq >> 3)) { 558 if (imbalance < (max_cpu_irq >> 3))
573 Dprintk("Imbalance too trivial\n");
574 goto not_worth_the_effort; 559 goto not_worth_the_effort;
575 }
576 560
577tryanotherirq: 561tryanotherirq:
578 /* if we select an IRQ to move that can't go where we want, then 562 /* if we select an IRQ to move that can't go where we want, then
@@ -629,9 +613,6 @@ tryanotherirq:
629 cpus_and(tmp, target_cpu_mask, allowed_mask); 613 cpus_and(tmp, target_cpu_mask, allowed_mask);
630 614
631 if (!cpus_empty(tmp)) { 615 if (!cpus_empty(tmp)) {
632
633 Dprintk("irq = %d moved to cpu = %d\n",
634 selected_irq, min_loaded);
635 /* mark for change destination */ 616 /* mark for change destination */
636 set_pending_irq(selected_irq, cpumask_of_cpu(min_loaded)); 617 set_pending_irq(selected_irq, cpumask_of_cpu(min_loaded));
637 618
@@ -651,7 +632,6 @@ not_worth_the_effort:
651 */ 632 */
652 balanced_irq_interval = min((long)MAX_BALANCED_IRQ_INTERVAL, 633 balanced_irq_interval = min((long)MAX_BALANCED_IRQ_INTERVAL,
653 balanced_irq_interval + BALANCED_IRQ_MORE_DELTA); 634 balanced_irq_interval + BALANCED_IRQ_MORE_DELTA);
654 Dprintk("IRQ worth rotating not found\n");
655 return; 635 return;
656} 636}
657 637
@@ -1902,7 +1882,7 @@ __setup("no_timer_check", notimercheck);
1902 * - if this function detects that timer IRQs are defunct, then we fall 1882 * - if this function detects that timer IRQs are defunct, then we fall
1903 * back to ISA timer IRQs 1883 * back to ISA timer IRQs
1904 */ 1884 */
1905int __init timer_irq_works(void) 1885static int __init timer_irq_works(void)
1906{ 1886{
1907 unsigned long t1 = jiffies; 1887 unsigned long t1 = jiffies;
1908 1888
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
index ba44d40b066d..dd2b97fc00b2 100644
--- a/arch/i386/kernel/irq.c
+++ b/arch/i386/kernel/irq.c
@@ -149,15 +149,11 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs)
149 149
150#ifdef CONFIG_4KSTACKS 150#ifdef CONFIG_4KSTACKS
151 151
152/*
153 * These should really be __section__(".bss.page_aligned") as well, but
154 * gcc's 3.0 and earlier don't handle that correctly.
155 */
156static char softirq_stack[NR_CPUS * THREAD_SIZE] 152static char softirq_stack[NR_CPUS * THREAD_SIZE]
157 __attribute__((__aligned__(THREAD_SIZE))); 153 __attribute__((__section__(".bss.page_aligned")));
158 154
159static char hardirq_stack[NR_CPUS * THREAD_SIZE] 155static char hardirq_stack[NR_CPUS * THREAD_SIZE]
160 __attribute__((__aligned__(THREAD_SIZE))); 156 __attribute__((__section__(".bss.page_aligned")));
161 157
162/* 158/*
163 * allocate per-cpu stacks for hardirq and for softirq processing 159 * allocate per-cpu stacks for hardirq and for softirq processing
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index 6c49acb96982..84664710b784 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -300,6 +300,7 @@ early_param("idle", idle_setup);
300void show_regs(struct pt_regs * regs) 300void show_regs(struct pt_regs * regs)
301{ 301{
302 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; 302 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
303 unsigned long d0, d1, d2, d3, d6, d7;
303 304
304 printk("\n"); 305 printk("\n");
305 printk("Pid: %d, comm: %20s\n", current->pid, current->comm); 306 printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
@@ -324,6 +325,17 @@ void show_regs(struct pt_regs * regs)
324 cr3 = read_cr3(); 325 cr3 = read_cr3();
325 cr4 = read_cr4_safe(); 326 cr4 = read_cr4_safe();
326 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); 327 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
328
329 get_debugreg(d0, 0);
330 get_debugreg(d1, 1);
331 get_debugreg(d2, 2);
332 get_debugreg(d3, 3);
333 printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
334 d0, d1, d2, d3);
335 get_debugreg(d6, 6);
336 get_debugreg(d7, 7);
337 printk("DR6: %08lx DR7: %08lx\n", d6, d7);
338
327 show_trace(NULL, regs, &regs->esp); 339 show_trace(NULL, regs, &regs->esp);
328} 340}
329 341
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c
index 5513f8d5b5be..0d796248866c 100644
--- a/arch/i386/kernel/reboot.c
+++ b/arch/i386/kernel/reboot.c
@@ -113,6 +113,15 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
113 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 300/"), 113 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 300/"),
114 }, 114 },
115 }, 115 },
116 { /* Handle problems with rebooting on Dell Optiplex 745's SFF*/
117 .callback = set_bios_reboot,
118 .ident = "Dell OptiPlex 745",
119 .matches = {
120 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
121 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 745"),
122 DMI_MATCH(DMI_BOARD_NAME, "0WF810"),
123 },
124 },
116 { /* Handle problems with rebooting on Dell 2400's */ 125 { /* Handle problems with rebooting on Dell 2400's */
117 .callback = set_bios_reboot, 126 .callback = set_bios_reboot,
118 .ident = "Dell PowerEdge 2400", 127 .ident = "Dell PowerEdge 2400",
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 74871d066c2b..d474cd639bcb 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -273,18 +273,18 @@ unsigned long __init find_max_low_pfn(void)
273 printk(KERN_WARNING "Warning only %ldMB will be used.\n", 273 printk(KERN_WARNING "Warning only %ldMB will be used.\n",
274 MAXMEM>>20); 274 MAXMEM>>20);
275 if (max_pfn > MAX_NONPAE_PFN) 275 if (max_pfn > MAX_NONPAE_PFN)
276 printk(KERN_WARNING "Use a PAE enabled kernel.\n"); 276 printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
277 else 277 else
278 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n"); 278 printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
279 max_pfn = MAXMEM_PFN; 279 max_pfn = MAXMEM_PFN;
280#else /* !CONFIG_HIGHMEM */ 280#else /* !CONFIG_HIGHMEM */
281#ifndef CONFIG_X86_PAE 281#ifndef CONFIG_HIGHMEM64G
282 if (max_pfn > MAX_NONPAE_PFN) { 282 if (max_pfn > MAX_NONPAE_PFN) {
283 max_pfn = MAX_NONPAE_PFN; 283 max_pfn = MAX_NONPAE_PFN;
284 printk(KERN_WARNING "Warning only 4GB will be used.\n"); 284 printk(KERN_WARNING "Warning only 4GB will be used.\n");
285 printk(KERN_WARNING "Use a PAE enabled kernel.\n"); 285 printk(KERN_WARNING "Use a HIGHMEM64G enabled kernel.\n");
286 } 286 }
287#endif /* !CONFIG_X86_PAE */ 287#endif /* !CONFIG_HIGHMEM64G */
288#endif /* !CONFIG_HIGHMEM */ 288#endif /* !CONFIG_HIGHMEM */
289 } else { 289 } else {
290 if (highmem_pages == -1) 290 if (highmem_pages == -1)
@@ -466,7 +466,7 @@ void __init setup_bootmem_allocator(void)
466 * 466 *
467 * This should all compile down to nothing when NUMA is off. 467 * This should all compile down to nothing when NUMA is off.
468 */ 468 */
469void __init remapped_pgdat_init(void) 469static void __init remapped_pgdat_init(void)
470{ 470{
471 int nid; 471 int nid;
472 472
@@ -640,6 +640,7 @@ void __init setup_arch(char **cmdline_p)
640#endif 640#endif
641 641
642 e820_register_memory(); 642 e820_register_memory();
643 e820_mark_nosave_regions();
643 644
644#ifdef CONFIG_VT 645#ifdef CONFIG_VT
645#if defined(CONFIG_VGA_CONSOLE) 646#if defined(CONFIG_VGA_CONSOLE)
diff --git a/arch/i386/kernel/sysenter.c b/arch/i386/kernel/sysenter.c
index ff4ee6f3326b..6deb159d08e0 100644
--- a/arch/i386/kernel/sysenter.c
+++ b/arch/i386/kernel/sysenter.c
@@ -336,7 +336,9 @@ struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
336 336
337int in_gate_area(struct task_struct *task, unsigned long addr) 337int in_gate_area(struct task_struct *task, unsigned long addr)
338{ 338{
339 return 0; 339 const struct vm_area_struct *vma = get_gate_vma(task);
340
341 return vma && addr >= vma->vm_start && addr < vma->vm_end;
340} 342}
341 343
342int in_gate_area_no_task(unsigned long addr) 344int in_gate_area_no_task(unsigned long addr)
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index a665df61f08c..19a6c678d02e 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -207,55 +207,9 @@ unsigned long read_persistent_clock(void)
207 return retval; 207 return retval;
208} 208}
209 209
210static void sync_cmos_clock(unsigned long dummy); 210int update_persistent_clock(struct timespec now)
211
212static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
213int no_sync_cmos_clock;
214
215static void sync_cmos_clock(unsigned long dummy)
216{
217 struct timeval now, next;
218 int fail = 1;
219
220 /*
221 * If we have an externally synchronized Linux clock, then update
222 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
223 * called as close as possible to 500 ms before the new second starts.
224 * This code is run on a timer. If the clock is set, that timer
225 * may not expire at the correct time. Thus, we adjust...
226 */
227 if (!ntp_synced())
228 /*
229 * Not synced, exit, do not restart a timer (if one is
230 * running, let it run out).
231 */
232 return;
233
234 do_gettimeofday(&now);
235 if (now.tv_usec >= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
236 now.tv_usec <= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2)
237 fail = set_rtc_mmss(now.tv_sec);
238
239 next.tv_usec = USEC_AFTER - now.tv_usec;
240 if (next.tv_usec <= 0)
241 next.tv_usec += USEC_PER_SEC;
242
243 if (!fail)
244 next.tv_sec = 659;
245 else
246 next.tv_sec = 0;
247
248 if (next.tv_usec >= USEC_PER_SEC) {
249 next.tv_sec++;
250 next.tv_usec -= USEC_PER_SEC;
251 }
252 mod_timer(&sync_cmos_timer, jiffies + timeval_to_jiffies(&next));
253}
254
255void notify_arch_cmos_timer(void)
256{ 211{
257 if (!no_sync_cmos_clock) 212 return set_rtc_mmss(now.tv_sec);
258 mod_timer(&sync_cmos_timer, jiffies + 1);
259} 213}
260 214
261extern void (*late_time_init)(void); 215extern void (*late_time_init)(void);
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 3e7753c78b9b..57772a18c394 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -152,7 +152,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
152 if (!stack) { 152 if (!stack) {
153 unsigned long dummy; 153 unsigned long dummy;
154 stack = &dummy; 154 stack = &dummy;
155 if (task && task != current) 155 if (task != current)
156 stack = (unsigned long *)task->thread.esp; 156 stack = (unsigned long *)task->thread.esp;
157 } 157 }
158 158
@@ -211,6 +211,7 @@ static void print_trace_address(void *data, unsigned long addr)
211{ 211{
212 printk("%s [<%08lx>] ", (char *)data, addr); 212 printk("%s [<%08lx>] ", (char *)data, addr);
213 print_symbol("%s\n", addr); 213 print_symbol("%s\n", addr);
214 touch_nmi_watchdog();
214} 215}
215 216
216static struct stacktrace_ops print_trace_ops = { 217static struct stacktrace_ops print_trace_ops = {
diff --git a/arch/i386/kernel/vmiclock.c b/arch/i386/kernel/vmiclock.c
index f9b845f4e692..b1b5ab08b26e 100644
--- a/arch/i386/kernel/vmiclock.c
+++ b/arch/i386/kernel/vmiclock.c
@@ -32,6 +32,7 @@
32#include <asm/apicdef.h> 32#include <asm/apicdef.h>
33#include <asm/apic.h> 33#include <asm/apic.h>
34#include <asm/timer.h> 34#include <asm/timer.h>
35#include <asm/i8253.h>
35 36
36#include <irq_vectors.h> 37#include <irq_vectors.h>
37#include "io_ports.h" 38#include "io_ports.h"
@@ -142,6 +143,7 @@ static void vmi_timer_set_mode(enum clock_event_mode mode,
142 143
143 switch (mode) { 144 switch (mode) {
144 case CLOCK_EVT_MODE_ONESHOT: 145 case CLOCK_EVT_MODE_ONESHOT:
146 case CLOCK_EVT_MODE_RESUME:
145 break; 147 break;
146 case CLOCK_EVT_MODE_PERIODIC: 148 case CLOCK_EVT_MODE_PERIODIC:
147 cycles_per_hz = vmi_timer_ops.get_cycle_frequency(); 149 cycles_per_hz = vmi_timer_ops.get_cycle_frequency();
diff --git a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile
index 22d8ac5815f0..4d105fdfe817 100644
--- a/arch/i386/lib/Makefile
+++ b/arch/i386/lib/Makefile
@@ -4,7 +4,7 @@
4 4
5 5
6lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \ 6lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \
7 bitops.o semaphore.o 7 bitops.o semaphore.o string.o
8 8
9lib-$(CONFIG_X86_USE_3DNOW) += mmx.o 9lib-$(CONFIG_X86_USE_3DNOW) += mmx.o
10 10
diff --git a/arch/i386/lib/string.c b/arch/i386/lib/string.c
new file mode 100644
index 000000000000..2c773fefa3dd
--- /dev/null
+++ b/arch/i386/lib/string.c
@@ -0,0 +1,257 @@
1/*
2 * Most of the string-functions are rather heavily hand-optimized,
3 * see especially strsep,strstr,str[c]spn. They should work, but are not
4 * very easy to understand. Everything is done entirely within the register
5 * set, making the functions fast and clean. String instructions have been
6 * used through-out, making for "slightly" unclear code :-)
7 *
8 * AK: On P4 and K7 using non string instruction implementations might be faster
9 * for large memory blocks. But most of them are unlikely to be used on large
10 * strings.
11 */
12
13#include <linux/string.h>
14#include <linux/module.h>
15
16#ifdef __HAVE_ARCH_STRCPY
17char *strcpy(char * dest,const char *src)
18{
19 int d0, d1, d2;
20 asm volatile( "1:\tlodsb\n\t"
21 "stosb\n\t"
22 "testb %%al,%%al\n\t"
23 "jne 1b"
24 : "=&S" (d0), "=&D" (d1), "=&a" (d2)
25 :"0" (src),"1" (dest) : "memory");
26 return dest;
27}
28EXPORT_SYMBOL(strcpy);
29#endif
30
31#ifdef __HAVE_ARCH_STRNCPY
32char *strncpy(char * dest,const char *src,size_t count)
33{
34 int d0, d1, d2, d3;
35 asm volatile( "1:\tdecl %2\n\t"
36 "js 2f\n\t"
37 "lodsb\n\t"
38 "stosb\n\t"
39 "testb %%al,%%al\n\t"
40 "jne 1b\n\t"
41 "rep\n\t"
42 "stosb\n"
43 "2:"
44 : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3)
45 :"0" (src),"1" (dest),"2" (count) : "memory");
46 return dest;
47}
48EXPORT_SYMBOL(strncpy);
49#endif
50
51#ifdef __HAVE_ARCH_STRCAT
52char *strcat(char * dest,const char * src)
53{
54 int d0, d1, d2, d3;
55 asm volatile( "repne\n\t"
56 "scasb\n\t"
57 "decl %1\n"
58 "1:\tlodsb\n\t"
59 "stosb\n\t"
60 "testb %%al,%%al\n\t"
61 "jne 1b"
62 : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
63 : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu): "memory");
64 return dest;
65}
66EXPORT_SYMBOL(strcat);
67#endif
68
69#ifdef __HAVE_ARCH_STRNCAT
70char *strncat(char * dest,const char * src,size_t count)
71{
72 int d0, d1, d2, d3;
73 asm volatile( "repne\n\t"
74 "scasb\n\t"
75 "decl %1\n\t"
76 "movl %8,%3\n"
77 "1:\tdecl %3\n\t"
78 "js 2f\n\t"
79 "lodsb\n\t"
80 "stosb\n\t"
81 "testb %%al,%%al\n\t"
82 "jne 1b\n"
83 "2:\txorl %2,%2\n\t"
84 "stosb"
85 : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
86 : "0" (src),"1" (dest),"2" (0),"3" (0xffffffffu), "g" (count)
87 : "memory");
88 return dest;
89}
90EXPORT_SYMBOL(strncat);
91#endif
92
93#ifdef __HAVE_ARCH_STRCMP
94int strcmp(const char * cs,const char * ct)
95{
96 int d0, d1;
97 int res;
98 asm volatile( "1:\tlodsb\n\t"
99 "scasb\n\t"
100 "jne 2f\n\t"
101 "testb %%al,%%al\n\t"
102 "jne 1b\n\t"
103 "xorl %%eax,%%eax\n\t"
104 "jmp 3f\n"
105 "2:\tsbbl %%eax,%%eax\n\t"
106 "orb $1,%%al\n"
107 "3:"
108 :"=a" (res), "=&S" (d0), "=&D" (d1)
109 :"1" (cs),"2" (ct)
110 :"memory");
111 return res;
112}
113EXPORT_SYMBOL(strcmp);
114#endif
115
116#ifdef __HAVE_ARCH_STRNCMP
117int strncmp(const char * cs,const char * ct,size_t count)
118{
119 int res;
120 int d0, d1, d2;
121 asm volatile( "1:\tdecl %3\n\t"
122 "js 2f\n\t"
123 "lodsb\n\t"
124 "scasb\n\t"
125 "jne 3f\n\t"
126 "testb %%al,%%al\n\t"
127 "jne 1b\n"
128 "2:\txorl %%eax,%%eax\n\t"
129 "jmp 4f\n"
130 "3:\tsbbl %%eax,%%eax\n\t"
131 "orb $1,%%al\n"
132 "4:"
133 :"=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
134 :"1" (cs),"2" (ct),"3" (count)
135 :"memory");
136 return res;
137}
138EXPORT_SYMBOL(strncmp);
139#endif
140
141#ifdef __HAVE_ARCH_STRCHR
142char *strchr(const char * s, int c)
143{
144 int d0;
145 char * res;
146 asm volatile( "movb %%al,%%ah\n"
147 "1:\tlodsb\n\t"
148 "cmpb %%ah,%%al\n\t"
149 "je 2f\n\t"
150 "testb %%al,%%al\n\t"
151 "jne 1b\n\t"
152 "movl $1,%1\n"
153 "2:\tmovl %1,%0\n\t"
154 "decl %0"
155 :"=a" (res), "=&S" (d0)
156 :"1" (s),"0" (c)
157 :"memory");
158 return res;
159}
160EXPORT_SYMBOL(strchr);
161#endif
162
163#ifdef __HAVE_ARCH_STRRCHR
164char *strrchr(const char * s, int c)
165{
166 int d0, d1;
167 char * res;
168 asm volatile( "movb %%al,%%ah\n"
169 "1:\tlodsb\n\t"
170 "cmpb %%ah,%%al\n\t"
171 "jne 2f\n\t"
172 "leal -1(%%esi),%0\n"
173 "2:\ttestb %%al,%%al\n\t"
174 "jne 1b"
175 :"=g" (res), "=&S" (d0), "=&a" (d1)
176 :"0" (0),"1" (s),"2" (c)
177 :"memory");
178 return res;
179}
180EXPORT_SYMBOL(strrchr);
181#endif
182
183#ifdef __HAVE_ARCH_STRLEN
184size_t strlen(const char * s)
185{
186 int d0;
187 int res;
188 asm volatile( "repne\n\t"
189 "scasb\n\t"
190 "notl %0\n\t"
191 "decl %0"
192 :"=c" (res), "=&D" (d0)
193 :"1" (s),"a" (0), "0" (0xffffffffu)
194 :"memory");
195 return res;
196}
197EXPORT_SYMBOL(strlen);
198#endif
199
200#ifdef __HAVE_ARCH_MEMCHR
201void *memchr(const void *cs,int c,size_t count)
202{
203 int d0;
204 void *res;
205 if (!count)
206 return NULL;
207 asm volatile( "repne\n\t"
208 "scasb\n\t"
209 "je 1f\n\t"
210 "movl $1,%0\n"
211 "1:\tdecl %0"
212 :"=D" (res), "=&c" (d0)
213 :"a" (c),"0" (cs),"1" (count)
214 :"memory");
215 return res;
216}
217EXPORT_SYMBOL(memchr);
218#endif
219
220#ifdef __HAVE_ARCH_MEMSCAN
221void *memscan(void * addr, int c, size_t size)
222{
223 if (!size)
224 return addr;
225 asm volatile("repnz; scasb\n\t"
226 "jnz 1f\n\t"
227 "dec %%edi\n"
228 "1:"
229 : "=D" (addr), "=c" (size)
230 : "0" (addr), "1" (size), "a" (c)
231 : "memory");
232 return addr;
233}
234EXPORT_SYMBOL(memscan);
235#endif
236
237#ifdef __HAVE_ARCH_STRNLEN
238size_t strnlen(const char *s, size_t count)
239{
240 int d0;
241 int res;
242 asm volatile( "movl %2,%0\n\t"
243 "jmp 2f\n"
244 "1:\tcmpb $0,(%0)\n\t"
245 "je 3f\n\t"
246 "incl %0\n"
247 "2:\tdecl %1\n\t"
248 "cmpl $-1,%1\n\t"
249 "jne 1b\n"
250 "3:\tsubl %2,%0"
251 :"=a" (res), "=&d" (d0)
252 :"c" (s),"1" (count)
253 :"memory");
254 return res;
255}
256EXPORT_SYMBOL(strnlen);
257#endif
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 6e72f22e6bbd..e1a9a805c445 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -471,6 +471,10 @@ void zap_low_mappings (void)
471 flush_tlb_all(); 471 flush_tlb_all();
472} 472}
473 473
474int nx_enabled = 0;
475
476#ifdef CONFIG_X86_PAE
477
474static int disable_nx __initdata = 0; 478static int disable_nx __initdata = 0;
475u64 __supported_pte_mask __read_mostly = ~_PAGE_NX; 479u64 __supported_pte_mask __read_mostly = ~_PAGE_NX;
476EXPORT_SYMBOL_GPL(__supported_pte_mask); 480EXPORT_SYMBOL_GPL(__supported_pte_mask);
@@ -500,9 +504,6 @@ static int __init noexec_setup(char *str)
500} 504}
501early_param("noexec", noexec_setup); 505early_param("noexec", noexec_setup);
502 506
503int nx_enabled = 0;
504#ifdef CONFIG_X86_PAE
505
506static void __init set_nx(void) 507static void __init set_nx(void)
507{ 508{
508 unsigned int v[4], l, h; 509 unsigned int v[4], l, h;
diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
index fff08ae7b5ed..0b278315d737 100644
--- a/arch/i386/mm/ioremap.c
+++ b/arch/i386/mm/ioremap.c
@@ -196,7 +196,7 @@ void iounmap(volatile void __iomem *addr)
196 /* Reset the direct mapping. Can block */ 196 /* Reset the direct mapping. Can block */
197 if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) { 197 if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) {
198 change_page_attr(virt_to_page(__va(p->phys_addr)), 198 change_page_attr(virt_to_page(__va(p->phys_addr)),
199 p->size >> PAGE_SHIFT, 199 get_vm_area_size(p) >> PAGE_SHIFT,
200 PAGE_KERNEL); 200 PAGE_KERNEL);
201 global_flush_tlb(); 201 global_flush_tlb();
202 } 202 }
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index 37992ffb1633..8927222b3ab2 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -82,7 +82,7 @@ static void flush_kernel_map(void *arg)
82 struct page *p; 82 struct page *p;
83 83
84 /* High level code is not ready for clflush yet */ 84 /* High level code is not ready for clflush yet */
85 if (0 && cpu_has_clflush) { 85 if (cpu_has_clflush) {
86 list_for_each_entry (p, lh, lru) 86 list_for_each_entry (p, lh, lru)
87 cache_flush_page(p); 87 cache_flush_page(p);
88 } else if (boot_cpu_data.x86_model >= 4) 88 } else if (boot_cpu_data.x86_model >= 4)
@@ -136,6 +136,12 @@ static inline void revert_page(struct page *kpte_page, unsigned long address)
136 ref_prot)); 136 ref_prot));
137} 137}
138 138
139static inline void save_page(struct page *kpte_page)
140{
141 if (!test_and_set_bit(PG_arch_1, &kpte_page->flags))
142 list_add(&kpte_page->lru, &df_list);
143}
144
139static int 145static int
140__change_page_attr(struct page *page, pgprot_t prot) 146__change_page_attr(struct page *page, pgprot_t prot)
141{ 147{
@@ -150,6 +156,9 @@ __change_page_attr(struct page *page, pgprot_t prot)
150 if (!kpte) 156 if (!kpte)
151 return -EINVAL; 157 return -EINVAL;
152 kpte_page = virt_to_page(kpte); 158 kpte_page = virt_to_page(kpte);
159 BUG_ON(PageLRU(kpte_page));
160 BUG_ON(PageCompound(kpte_page));
161
153 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) { 162 if (pgprot_val(prot) != pgprot_val(PAGE_KERNEL)) {
154 if (!pte_huge(*kpte)) { 163 if (!pte_huge(*kpte)) {
155 set_pte_atomic(kpte, mk_pte(page, prot)); 164 set_pte_atomic(kpte, mk_pte(page, prot));
@@ -179,11 +188,11 @@ __change_page_attr(struct page *page, pgprot_t prot)
179 * time (not via split_large_page) and in turn we must not 188 * time (not via split_large_page) and in turn we must not
180 * replace it with a largepage. 189 * replace it with a largepage.
181 */ 190 */
191
192 save_page(kpte_page);
182 if (!PageReserved(kpte_page)) { 193 if (!PageReserved(kpte_page)) {
183 if (cpu_has_pse && (page_private(kpte_page) == 0)) { 194 if (cpu_has_pse && (page_private(kpte_page) == 0)) {
184 ClearPagePrivate(kpte_page);
185 paravirt_release_pt(page_to_pfn(kpte_page)); 195 paravirt_release_pt(page_to_pfn(kpte_page));
186 list_add(&kpte_page->lru, &df_list);
187 revert_page(kpte_page, address); 196 revert_page(kpte_page, address);
188 } 197 }
189 } 198 }
@@ -236,6 +245,11 @@ void global_flush_tlb(void)
236 spin_unlock_irq(&cpa_lock); 245 spin_unlock_irq(&cpa_lock);
237 flush_map(&l); 246 flush_map(&l);
238 list_for_each_entry_safe(pg, next, &l, lru) { 247 list_for_each_entry_safe(pg, next, &l, lru) {
248 list_del(&pg->lru);
249 clear_bit(PG_arch_1, &pg->flags);
250 if (PageReserved(pg) || !cpu_has_pse || page_private(pg) != 0)
251 continue;
252 ClearPagePrivate(pg);
239 __free_page(pg); 253 __free_page(pg);
240 } 254 }
241} 255}
diff --git a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c
index 8d7c0864cc04..01437c46baae 100644
--- a/arch/i386/mm/pgtable.c
+++ b/arch/i386/mm/pgtable.c
@@ -235,7 +235,7 @@ static inline void pgd_list_del(pgd_t *pgd)
235 235
236#if (PTRS_PER_PMD == 1) 236#if (PTRS_PER_PMD == 1)
237/* Non-PAE pgd constructor */ 237/* Non-PAE pgd constructor */
238void pgd_ctor(void *pgd) 238static void pgd_ctor(void *pgd)
239{ 239{
240 unsigned long flags; 240 unsigned long flags;
241 241
@@ -257,7 +257,7 @@ void pgd_ctor(void *pgd)
257} 257}
258#else /* PTRS_PER_PMD > 1 */ 258#else /* PTRS_PER_PMD > 1 */
259/* PAE pgd constructor */ 259/* PAE pgd constructor */
260void pgd_ctor(void *pgd) 260static void pgd_ctor(void *pgd)
261{ 261{
262 /* PAE, kernel PMD may be shared */ 262 /* PAE, kernel PMD may be shared */
263 263
@@ -276,7 +276,7 @@ void pgd_ctor(void *pgd)
276} 276}
277#endif /* PTRS_PER_PMD */ 277#endif /* PTRS_PER_PMD */
278 278
279void pgd_dtor(void *pgd) 279static void pgd_dtor(void *pgd)
280{ 280{
281 unsigned long flags; /* can be called from interrupt context */ 281 unsigned long flags; /* can be called from interrupt context */
282 282
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
index b33aea845f58..bc8a44bddaa7 100644
--- a/arch/i386/pci/acpi.c
+++ b/arch/i386/pci/acpi.c
@@ -8,20 +8,42 @@
8struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) 8struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
9{ 9{
10 struct pci_bus *bus; 10 struct pci_bus *bus;
11 struct pci_sysdata *sd;
12 int pxm;
13
14 /* Allocate per-root-bus (not per bus) arch-specific data.
15 * TODO: leak; this memory is never freed.
16 * It's arguable whether it's worth the trouble to care.
17 */
18 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
19 if (!sd) {
20 printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum);
21 return NULL;
22 }
11 23
12 if (domain != 0) { 24 if (domain != 0) {
13 printk(KERN_WARNING "PCI: Multiple domains not supported\n"); 25 printk(KERN_WARNING "PCI: Multiple domains not supported\n");
26 kfree(sd);
14 return NULL; 27 return NULL;
15 } 28 }
16 29
17 bus = pcibios_scan_root(busnum); 30 sd->node = -1;
31
32 pxm = acpi_get_pxm(device->handle);
33#ifdef CONFIG_ACPI_NUMA
34 if (pxm >= 0)
35 sd->node = pxm_to_node(pxm);
36#endif
37
38 bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
39 if (!bus)
40 kfree(sd);
41
18#ifdef CONFIG_ACPI_NUMA 42#ifdef CONFIG_ACPI_NUMA
19 if (bus != NULL) { 43 if (bus != NULL) {
20 int pxm = acpi_get_pxm(device->handle);
21 if (pxm >= 0) { 44 if (pxm >= 0) {
22 bus->sysdata = (void *)(unsigned long)pxm_to_node(pxm); 45 printk("bus %d -> pxm %d -> node %d\n",
23 printk("bus %d -> pxm %d -> node %ld\n", 46 busnum, pxm, sd->node);
24 busnum, pxm, (long)(bus->sysdata));
25 } 47 }
26 } 48 }
27#endif 49#endif
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 3f78d4d8ecf3..85503deeda46 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -293,6 +293,7 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
293struct pci_bus * __devinit pcibios_scan_root(int busnum) 293struct pci_bus * __devinit pcibios_scan_root(int busnum)
294{ 294{
295 struct pci_bus *bus = NULL; 295 struct pci_bus *bus = NULL;
296 struct pci_sysdata *sd;
296 297
297 dmi_check_system(pciprobe_dmi_table); 298 dmi_check_system(pciprobe_dmi_table);
298 299
@@ -303,9 +304,19 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
303 } 304 }
304 } 305 }
305 306
307 /* Allocate per-root-bus (not per bus) arch-specific data.
308 * TODO: leak; this memory is never freed.
309 * It's arguable whether it's worth the trouble to care.
310 */
311 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
312 if (!sd) {
313 printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum);
314 return NULL;
315 }
316
306 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum); 317 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
307 318
308 return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, NULL); 319 return pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
309} 320}
310 321
311extern u8 pci_cache_line_size; 322extern u8 pci_cache_line_size;
diff --git a/arch/i386/pci/mmconfig-shared.c b/arch/i386/pci/mmconfig-shared.c
index c7cabeed4d7b..4df637e34f81 100644
--- a/arch/i386/pci/mmconfig-shared.c
+++ b/arch/i386/pci/mmconfig-shared.c
@@ -24,6 +24,9 @@
24 24
25DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS); 25DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
26 26
27/* Indicate if the mmcfg resources have been placed into the resource table. */
28static int __initdata pci_mmcfg_resources_inserted;
29
27/* K8 systems have some devices (typically in the builtin northbridge) 30/* K8 systems have some devices (typically in the builtin northbridge)
28 that are only accessible using type1 31 that are only accessible using type1
29 Normally this can be expressed in the MCFG by not listing them 32 Normally this can be expressed in the MCFG by not listing them
@@ -170,7 +173,7 @@ static int __init pci_mmcfg_check_hostbridge(void)
170 return name != NULL; 173 return name != NULL;
171} 174}
172 175
173static void __init pci_mmcfg_insert_resources(void) 176static void __init pci_mmcfg_insert_resources(unsigned long resource_flags)
174{ 177{
175#define PCI_MMCFG_RESOURCE_NAME_LEN 19 178#define PCI_MMCFG_RESOURCE_NAME_LEN 19
176 int i; 179 int i;
@@ -194,10 +197,13 @@ static void __init pci_mmcfg_insert_resources(void)
194 cfg->pci_segment); 197 cfg->pci_segment);
195 res->start = cfg->address; 198 res->start = cfg->address;
196 res->end = res->start + (num_buses << 20) - 1; 199 res->end = res->start + (num_buses << 20) - 1;
197 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 200 res->flags = IORESOURCE_MEM | resource_flags;
198 insert_resource(&iomem_resource, res); 201 insert_resource(&iomem_resource, res);
199 names += PCI_MMCFG_RESOURCE_NAME_LEN; 202 names += PCI_MMCFG_RESOURCE_NAME_LEN;
200 } 203 }
204
205 /* Mark that the resources have been inserted. */
206 pci_mmcfg_resources_inserted = 1;
201} 207}
202 208
203static void __init pci_mmcfg_reject_broken(int type) 209static void __init pci_mmcfg_reject_broken(int type)
@@ -267,7 +273,43 @@ void __init pci_mmcfg_init(int type)
267 if (type == 1) 273 if (type == 1)
268 unreachable_devices(); 274 unreachable_devices();
269 if (known_bridge) 275 if (known_bridge)
270 pci_mmcfg_insert_resources(); 276 pci_mmcfg_insert_resources(IORESOURCE_BUSY);
271 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 277 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
278 } else {
279 /*
280 * Signal not to attempt to insert mmcfg resources because
281 * the architecture mmcfg setup could not initialize.
282 */
283 pci_mmcfg_resources_inserted = 1;
272 } 284 }
273} 285}
286
287static int __init pci_mmcfg_late_insert_resources(void)
288{
289 /*
290 * If resources are already inserted or we are not using MMCONFIG,
291 * don't insert the resources.
292 */
293 if ((pci_mmcfg_resources_inserted == 1) ||
294 (pci_probe & PCI_PROBE_MMCONF) == 0 ||
295 (pci_mmcfg_config_num == 0) ||
296 (pci_mmcfg_config == NULL) ||
297 (pci_mmcfg_config[0].address == 0))
298 return 1;
299
300 /*
301 * Attempt to insert the mmcfg resources but not with the busy flag
302 * marked so it won't cause request errors when __request_region is
303 * called.
304 */
305 pci_mmcfg_insert_resources(0);
306
307 return 0;
308}
309
310/*
311 * Perform MMCONFIG resource insertion after PCI initialization to allow for
312 * misprogrammed MCFG tables that state larger sizes but actually conflict
313 * with other system resources.
314 */
315late_initcall(pci_mmcfg_late_insert_resources);
diff --git a/arch/i386/xen/time.c b/arch/i386/xen/time.c
index 51fdabf1fd4d..dfd6db69ead5 100644
--- a/arch/i386/xen/time.c
+++ b/arch/i386/xen/time.c
@@ -412,6 +412,7 @@ static void xen_timerop_set_mode(enum clock_event_mode mode,
412 break; 412 break;
413 413
414 case CLOCK_EVT_MODE_ONESHOT: 414 case CLOCK_EVT_MODE_ONESHOT:
415 case CLOCK_EVT_MODE_RESUME:
415 break; 416 break;
416 417
417 case CLOCK_EVT_MODE_UNUSED: 418 case CLOCK_EVT_MODE_UNUSED:
@@ -474,6 +475,8 @@ static void xen_vcpuop_set_mode(enum clock_event_mode mode,
474 HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL)) 475 HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL))
475 BUG(); 476 BUG();
476 break; 477 break;
478 case CLOCK_EVT_MODE_RESUME:
479 break;
477 } 480 }
478} 481}
479 482
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
index e1189ba1ca5e..1cfab326fb7e 100644
--- a/arch/ia64/ia32/binfmt_elf32.c
+++ b/arch/ia64/ia32/binfmt_elf32.c
@@ -226,7 +226,7 @@ elf32_set_personality (void)
226} 226}
227 227
228static unsigned long 228static unsigned long
229elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type, unsigned long unused) 229elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
230{ 230{
231 unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK; 231 unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK;
232 232
diff --git a/arch/powerpc/boot/ps3-head.S b/arch/powerpc/boot/ps3-head.S
index 1a6d64a68df5..a55c2735f759 100644
--- a/arch/powerpc/boot/ps3-head.S
+++ b/arch/powerpc/boot/ps3-head.S
@@ -20,6 +20,8 @@
20 20
21#include "ppc_asm.h" 21#include "ppc_asm.h"
22 22
23 .machine "ppc64"
24
23 .text 25 .text
24 26
25/* 27/*
diff --git a/arch/powerpc/boot/ps3-hvcall.S b/arch/powerpc/boot/ps3-hvcall.S
index c8b7df3210d1..585965f7e6a8 100644
--- a/arch/powerpc/boot/ps3-hvcall.S
+++ b/arch/powerpc/boot/ps3-hvcall.S
@@ -20,6 +20,8 @@
20 20
21#include "ppc_asm.h" 21#include "ppc_asm.h"
22 22
23 .machine "ppc64"
24
23/* 25/*
24 * The PS3 hypervisor uses a 64 bit "C" language calling convention. 26 * The PS3 hypervisor uses a 64 bit "C" language calling convention.
25 * The routines here marshal arguments between the 32 bit wrapper 27 * The routines here marshal arguments between the 32 bit wrapper
diff --git a/arch/powerpc/mm/tlb_32.c b/arch/powerpc/mm/tlb_32.c
index 06c7e77e097a..eb4b512d65fa 100644
--- a/arch/powerpc/mm/tlb_32.c
+++ b/arch/powerpc/mm/tlb_32.c
@@ -26,6 +26,8 @@
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/pagemap.h>
30
29#include <asm/tlbflush.h> 31#include <asm/tlbflush.h>
30#include <asm/tlb.h> 32#include <asm/tlb.h>
31 33
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 7de4e919687b..c2aaec5289dc 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -941,6 +941,13 @@ static const struct file_operations spufs_signal1_nosched_fops = {
941 .mmap = spufs_signal1_mmap, 941 .mmap = spufs_signal1_mmap,
942}; 942};
943 943
944static const struct file_operations spufs_signal1_nosched_fops = {
945 .open = spufs_signal1_open,
946 .release = spufs_signal1_release,
947 .write = spufs_signal1_write,
948 .mmap = spufs_signal1_mmap,
949};
950
944static int spufs_signal2_open(struct inode *inode, struct file *file) 951static int spufs_signal2_open(struct inode *inode, struct file *file)
945{ 952{
946 struct spufs_inode_info *i = SPUFS_I(inode); 953 struct spufs_inode_info *i = SPUFS_I(inode);
@@ -1076,6 +1083,13 @@ static const struct file_operations spufs_signal2_nosched_fops = {
1076 .mmap = spufs_signal2_mmap, 1083 .mmap = spufs_signal2_mmap,
1077}; 1084};
1078 1085
1086static const struct file_operations spufs_signal2_nosched_fops = {
1087 .open = spufs_signal2_open,
1088 .release = spufs_signal2_release,
1089 .write = spufs_signal2_write,
1090 .mmap = spufs_signal2_mmap,
1091};
1092
1079static void spufs_signal1_type_set(void *data, u64 val) 1093static void spufs_signal1_type_set(void *data, u64 val)
1080{ 1094{
1081 struct spu_context *ctx = data; 1095 struct spu_context *ctx = data;
@@ -2177,8 +2191,8 @@ struct tree_descr spufs_dir_contents[] = {
2177 { "mbox_stat", &spufs_mbox_stat_fops, 0444, }, 2191 { "mbox_stat", &spufs_mbox_stat_fops, 0444, },
2178 { "ibox_stat", &spufs_ibox_stat_fops, 0444, }, 2192 { "ibox_stat", &spufs_ibox_stat_fops, 0444, },
2179 { "wbox_stat", &spufs_wbox_stat_fops, 0444, }, 2193 { "wbox_stat", &spufs_wbox_stat_fops, 0444, },
2180 { "signal1", &spufs_signal1_fops, 0666, }, 2194 { "signal1", &spufs_signal1_nosched_fops, 0222, },
2181 { "signal2", &spufs_signal2_fops, 0666, }, 2195 { "signal2", &spufs_signal2_nosched_fops, 0222, },
2182 { "signal1_type", &spufs_signal1_type, 0666, }, 2196 { "signal1_type", &spufs_signal1_type, 0666, },
2183 { "signal2_type", &spufs_signal2_type, 0666, }, 2197 { "signal2_type", &spufs_signal2_type, 0666, },
2184 { "cntl", &spufs_cntl_fops, 0666, }, 2198 { "cntl", &spufs_cntl_fops, 0666, },
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig
index a05079b07696..d4fc74f7bb15 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -102,4 +102,40 @@ config PS3_STORAGE
102 depends on PPC_PS3 102 depends on PPC_PS3
103 tristate 103 tristate
104 104
105config PS3_DISK
106 tristate "PS3 Disk Storage Driver"
107 depends on PPC_PS3 && BLOCK
108 select PS3_STORAGE
109 help
110 Include support for the PS3 Disk Storage.
111
112 This support is required to access the PS3 hard disk.
113 In general, all users will say Y or M.
114
115config PS3_ROM
116 tristate "PS3 BD/DVD/CD-ROM Storage Driver"
117 depends on PPC_PS3 && SCSI
118 select PS3_STORAGE
119 help
120 Include support for the PS3 ROM Storage.
121
122 This support is required to access the PS3 BD/DVD/CD-ROM drive.
123 In general, all users will say Y or M.
124 Also make sure to say Y or M to "SCSI CDROM support" later.
125
126config PS3_FLASH
127 tristate "PS3 FLASH ROM Storage Driver"
128 depends on PPC_PS3
129 select PS3_STORAGE
130 help
131 Include support for the PS3 FLASH ROM Storage.
132
133 This support is required to access the PS3 FLASH ROM, which
134 contains the boot loader and some boot options.
135 In general, all users will say Y or M.
136
137 As this driver needs a fixed buffer of 256 KiB of memory, it can
138 be disabled on the kernel command line using "ps3flash=off", to
139 not allocate this fixed buffer.
140
105endmenu 141endmenu
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index 097ebd49f1bf..7aca37d79766 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -80,6 +80,7 @@ static void tmu_set_mode(enum clock_event_mode mode,
80 break; 80 break;
81 case CLOCK_EVT_MODE_UNUSED: 81 case CLOCK_EVT_MODE_UNUSED:
82 case CLOCK_EVT_MODE_SHUTDOWN: 82 case CLOCK_EVT_MODE_SHUTDOWN:
83 case CLOCK_EVT_MODE_RESUME:
83 break; 84 break;
84 } 85 }
85} 86}
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index f1cc55677ff2..33dabf588bdd 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -23,6 +23,10 @@ config GENERIC_TIME
23 bool 23 bool
24 default y 24 default y
25 25
26config GENERIC_CMOS_UPDATE
27 bool
28 default y
29
26config GENERIC_CLOCKEVENTS 30config GENERIC_CLOCKEVENTS
27 bool 31 bool
28 default y 32 default y
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index e340eb401fb9..49063ca2efcd 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -403,58 +403,9 @@ static struct sparc64_tick_ops hbtick_operations __read_mostly = {
403 403
404static unsigned long timer_ticks_per_nsec_quotient __read_mostly; 404static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
405 405
406#define TICK_SIZE (tick_nsec / 1000) 406int update_persistent_clock(struct timespec now)
407
408#define USEC_AFTER 500000
409#define USEC_BEFORE 500000
410
411static void sync_cmos_clock(unsigned long dummy);
412
413static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
414
415static void sync_cmos_clock(unsigned long dummy)
416{
417 struct timeval now, next;
418 int fail = 1;
419
420 /*
421 * If we have an externally synchronized Linux clock, then update
422 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
423 * called as close as possible to 500 ms before the new second starts.
424 * This code is run on a timer. If the clock is set, that timer
425 * may not expire at the correct time. Thus, we adjust...
426 */
427 if (!ntp_synced())
428 /*
429 * Not synced, exit, do not restart a timer (if one is
430 * running, let it run out).
431 */
432 return;
433
434 do_gettimeofday(&now);
435 if (now.tv_usec >= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
436 now.tv_usec <= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2)
437 fail = set_rtc_mmss(now.tv_sec);
438
439 next.tv_usec = USEC_AFTER - now.tv_usec;
440 if (next.tv_usec <= 0)
441 next.tv_usec += USEC_PER_SEC;
442
443 if (!fail)
444 next.tv_sec = 659;
445 else
446 next.tv_sec = 0;
447
448 if (next.tv_usec >= USEC_PER_SEC) {
449 next.tv_sec++;
450 next.tv_usec -= USEC_PER_SEC;
451 }
452 mod_timer(&sync_cmos_timer, jiffies + timeval_to_jiffies(&next));
453}
454
455void notify_arch_cmos_timer(void)
456{ 407{
457 mod_timer(&sync_cmos_timer, jiffies + 1); 408 return set_rtc_mmss(now.tv_sec);
458} 409}
459 410
460/* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */ 411/* Kick start a stopped clock (procedure from the Sun NVRAM/hostid FAQ). */
@@ -931,6 +882,7 @@ static void sparc64_timer_setup(enum clock_event_mode mode,
931{ 882{
932 switch (mode) { 883 switch (mode) {
933 case CLOCK_EVT_MODE_ONESHOT: 884 case CLOCK_EVT_MODE_ONESHOT:
885 case CLOCK_EVT_MODE_RESUME:
934 break; 886 break;
935 887
936 case CLOCK_EVT_MODE_SHUTDOWN: 888 case CLOCK_EVT_MODE_SHUTDOWN:
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 14bf8ce3ea23..45f82ae6d389 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -32,6 +32,10 @@ config GENERIC_TIME_VSYSCALL
32 bool 32 bool
33 default y 33 default y
34 34
35config GENERIC_CMOS_UPDATE
36 bool
37 default y
38
35config ZONE_DMA32 39config ZONE_DMA32
36 bool 40 bool
37 default y 41 default y
@@ -56,6 +60,14 @@ config ZONE_DMA
56 bool 60 bool
57 default y 61 default y
58 62
63config QUICKLIST
64 bool
65 default y
66
67config NR_QUICK
68 int
69 default 2
70
59config ISA 71config ISA
60 bool 72 bool
61 73
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 29617ae3926d..128561d3e876 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -76,7 +76,8 @@ head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kern
76libs-y += arch/x86_64/lib/ 76libs-y += arch/x86_64/lib/
77core-y += arch/x86_64/kernel/ \ 77core-y += arch/x86_64/kernel/ \
78 arch/x86_64/mm/ \ 78 arch/x86_64/mm/ \
79 arch/x86_64/crypto/ 79 arch/x86_64/crypto/ \
80 arch/x86_64/vdso/
80core-$(CONFIG_IA32_EMULATION) += arch/x86_64/ia32/ 81core-$(CONFIG_IA32_EMULATION) += arch/x86_64/ia32/
81drivers-$(CONFIG_PCI) += arch/x86_64/pci/ 82drivers-$(CONFIG_PCI) += arch/x86_64/pci/
82drivers-$(CONFIG_OPROFILE) += arch/x86_64/oprofile/ 83drivers-$(CONFIG_OPROFILE) += arch/x86_64/oprofile/
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 40178e5c3104..b7c4cd04bfc3 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,19 +1,22 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc2 3# Linux kernel version: 2.6.22-git14
4# Mon May 21 13:23:40 2007 4# Fri Jul 20 09:53:15 2007
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
8CONFIG_X86=y 8CONFIG_X86=y
9CONFIG_GENERIC_TIME=y 9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_TIME_VSYSCALL=y 10CONFIG_GENERIC_TIME_VSYSCALL=y
11CONFIG_GENERIC_CMOS_UPDATE=y
11CONFIG_ZONE_DMA32=y 12CONFIG_ZONE_DMA32=y
12CONFIG_LOCKDEP_SUPPORT=y 13CONFIG_LOCKDEP_SUPPORT=y
13CONFIG_STACKTRACE_SUPPORT=y 14CONFIG_STACKTRACE_SUPPORT=y
14CONFIG_SEMAPHORE_SLEEPERS=y 15CONFIG_SEMAPHORE_SLEEPERS=y
15CONFIG_MMU=y 16CONFIG_MMU=y
16CONFIG_ZONE_DMA=y 17CONFIG_ZONE_DMA=y
18CONFIG_QUICKLIST=y
19CONFIG_NR_QUICK=2
17CONFIG_RWSEM_GENERIC_SPINLOCK=y 20CONFIG_RWSEM_GENERIC_SPINLOCK=y
18CONFIG_GENERIC_HWEIGHT=y 21CONFIG_GENERIC_HWEIGHT=y
19CONFIG_GENERIC_CALIBRATE_DELAY=y 22CONFIG_GENERIC_CALIBRATE_DELAY=y
@@ -44,19 +47,18 @@ CONFIG_LOCALVERSION=""
44CONFIG_LOCALVERSION_AUTO=y 47CONFIG_LOCALVERSION_AUTO=y
45CONFIG_SWAP=y 48CONFIG_SWAP=y
46CONFIG_SYSVIPC=y 49CONFIG_SYSVIPC=y
47# CONFIG_IPC_NS is not set
48CONFIG_SYSVIPC_SYSCTL=y 50CONFIG_SYSVIPC_SYSCTL=y
49CONFIG_POSIX_MQUEUE=y 51CONFIG_POSIX_MQUEUE=y
50# CONFIG_BSD_PROCESS_ACCT is not set 52# CONFIG_BSD_PROCESS_ACCT is not set
51# CONFIG_TASKSTATS is not set 53# CONFIG_TASKSTATS is not set
52# CONFIG_UTS_NS is not set 54# CONFIG_USER_NS is not set
53# CONFIG_AUDIT is not set 55# CONFIG_AUDIT is not set
54CONFIG_IKCONFIG=y 56CONFIG_IKCONFIG=y
55CONFIG_IKCONFIG_PROC=y 57CONFIG_IKCONFIG_PROC=y
56CONFIG_LOG_BUF_SHIFT=18 58CONFIG_LOG_BUF_SHIFT=18
57# CONFIG_CPUSETS is not set 59# CONFIG_CPUSETS is not set
58CONFIG_SYSFS_DEPRECATED=y 60CONFIG_SYSFS_DEPRECATED=y
59# CONFIG_RELAY is not set 61CONFIG_RELAY=y
60CONFIG_BLK_DEV_INITRD=y 62CONFIG_BLK_DEV_INITRD=y
61CONFIG_INITRAMFS_SOURCE="" 63CONFIG_INITRAMFS_SOURCE=""
62CONFIG_CC_OPTIMIZE_FOR_SIZE=y 64CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -86,10 +88,6 @@ CONFIG_SLAB=y
86CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
87# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
88CONFIG_BASE_SMALL=0 90CONFIG_BASE_SMALL=0
89
90#
91# Loadable module support
92#
93CONFIG_MODULES=y 91CONFIG_MODULES=y
94CONFIG_MODULE_UNLOAD=y 92CONFIG_MODULE_UNLOAD=y
95CONFIG_MODULE_FORCE_UNLOAD=y 93CONFIG_MODULE_FORCE_UNLOAD=y
@@ -97,12 +95,9 @@ CONFIG_MODULE_FORCE_UNLOAD=y
97# CONFIG_MODULE_SRCVERSION_ALL is not set 95# CONFIG_MODULE_SRCVERSION_ALL is not set
98# CONFIG_KMOD is not set 96# CONFIG_KMOD is not set
99CONFIG_STOP_MACHINE=y 97CONFIG_STOP_MACHINE=y
100
101#
102# Block layer
103#
104CONFIG_BLOCK=y 98CONFIG_BLOCK=y
105# CONFIG_BLK_DEV_IO_TRACE is not set 99# CONFIG_BLK_DEV_IO_TRACE is not set
100# CONFIG_BLK_DEV_BSG is not set
106 101
107# 102#
108# IO Schedulers 103# IO Schedulers
@@ -165,9 +160,12 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
165CONFIG_MIGRATION=y 160CONFIG_MIGRATION=y
166CONFIG_RESOURCES_64BIT=y 161CONFIG_RESOURCES_64BIT=y
167CONFIG_ZONE_DMA_FLAG=1 162CONFIG_ZONE_DMA_FLAG=1
163CONFIG_BOUNCE=y
164CONFIG_VIRT_TO_BUS=y
168CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 165CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
169CONFIG_OUT_OF_LINE_PFN_TO_PAGE=y 166CONFIG_OUT_OF_LINE_PFN_TO_PAGE=y
170CONFIG_NR_CPUS=32 167CONFIG_NR_CPUS=32
168CONFIG_PHYSICAL_ALIGN=0x200000
171CONFIG_HOTPLUG_CPU=y 169CONFIG_HOTPLUG_CPU=y
172CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 170CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
173CONFIG_HPET_TIMER=y 171CONFIG_HPET_TIMER=y
@@ -180,7 +178,7 @@ CONFIG_X86_MCE_INTEL=y
180CONFIG_X86_MCE_AMD=y 178CONFIG_X86_MCE_AMD=y
181# CONFIG_KEXEC is not set 179# CONFIG_KEXEC is not set
182# CONFIG_CRASH_DUMP is not set 180# CONFIG_CRASH_DUMP is not set
183CONFIG_RELOCATABLE=y 181# CONFIG_RELOCATABLE is not set
184CONFIG_PHYSICAL_START=0x200000 182CONFIG_PHYSICAL_START=0x200000
185CONFIG_SECCOMP=y 183CONFIG_SECCOMP=y
186# CONFIG_CC_STACKPROTECTOR is not set 184# CONFIG_CC_STACKPROTECTOR is not set
@@ -201,7 +199,6 @@ CONFIG_GENERIC_PENDING_IRQ=y
201CONFIG_PM=y 199CONFIG_PM=y
202# CONFIG_PM_LEGACY is not set 200# CONFIG_PM_LEGACY is not set
203# CONFIG_PM_DEBUG is not set 201# CONFIG_PM_DEBUG is not set
204# CONFIG_PM_SYSFS_DEPRECATED is not set
205CONFIG_SOFTWARE_SUSPEND=y 202CONFIG_SOFTWARE_SUSPEND=y
206CONFIG_PM_STD_PARTITION="" 203CONFIG_PM_STD_PARTITION=""
207CONFIG_SUSPEND_SMP=y 204CONFIG_SUSPEND_SMP=y
@@ -248,7 +245,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
248# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 245# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
249CONFIG_CPU_FREQ_GOV_USERSPACE=y 246CONFIG_CPU_FREQ_GOV_USERSPACE=y
250CONFIG_CPU_FREQ_GOV_ONDEMAND=y 247CONFIG_CPU_FREQ_GOV_ONDEMAND=y
251# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set 248CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
252 249
253# 250#
254# CPUFreq processor drivers 251# CPUFreq processor drivers
@@ -351,20 +348,8 @@ CONFIG_IPV6_SIT=y
351# CONFIG_IPV6_MULTIPLE_TABLES is not set 348# CONFIG_IPV6_MULTIPLE_TABLES is not set
352# CONFIG_NETWORK_SECMARK is not set 349# CONFIG_NETWORK_SECMARK is not set
353# CONFIG_NETFILTER is not set 350# CONFIG_NETFILTER is not set
354
355#
356# DCCP Configuration (EXPERIMENTAL)
357#
358# CONFIG_IP_DCCP is not set 351# CONFIG_IP_DCCP is not set
359
360#
361# SCTP Configuration (EXPERIMENTAL)
362#
363# CONFIG_IP_SCTP is not set 352# CONFIG_IP_SCTP is not set
364
365#
366# TIPC Configuration (EXPERIMENTAL)
367#
368# CONFIG_TIPC is not set 353# CONFIG_TIPC is not set
369# CONFIG_ATM is not set 354# CONFIG_ATM is not set
370# CONFIG_BRIDGE is not set 355# CONFIG_BRIDGE is not set
@@ -401,6 +386,7 @@ CONFIG_IPV6_SIT=y
401# CONFIG_MAC80211 is not set 386# CONFIG_MAC80211 is not set
402# CONFIG_IEEE80211 is not set 387# CONFIG_IEEE80211 is not set
403# CONFIG_RFKILL is not set 388# CONFIG_RFKILL is not set
389# CONFIG_NET_9P is not set
404 390
405# 391#
406# Device Drivers 392# Device Drivers
@@ -415,21 +401,9 @@ CONFIG_FW_LOADER=y
415# CONFIG_DEBUG_DRIVER is not set 401# CONFIG_DEBUG_DRIVER is not set
416# CONFIG_DEBUG_DEVRES is not set 402# CONFIG_DEBUG_DEVRES is not set
417# CONFIG_SYS_HYPERVISOR is not set 403# CONFIG_SYS_HYPERVISOR is not set
418
419#
420# Connector - unified userspace <-> kernelspace linker
421#
422# CONFIG_CONNECTOR is not set 404# CONFIG_CONNECTOR is not set
423# CONFIG_MTD is not set 405# CONFIG_MTD is not set
424
425#
426# Parallel port support
427#
428# CONFIG_PARPORT is not set 406# CONFIG_PARPORT is not set
429
430#
431# Plug and Play support
432#
433CONFIG_PNP=y 407CONFIG_PNP=y
434# CONFIG_PNP_DEBUG is not set 408# CONFIG_PNP_DEBUG is not set
435 409
@@ -437,10 +411,7 @@ CONFIG_PNP=y
437# Protocols 411# Protocols
438# 412#
439CONFIG_PNPACPI=y 413CONFIG_PNPACPI=y
440 414CONFIG_BLK_DEV=y
441#
442# Block devices
443#
444CONFIG_BLK_DEV_FD=y 415CONFIG_BLK_DEV_FD=y
445# CONFIG_BLK_CPQ_DA is not set 416# CONFIG_BLK_CPQ_DA is not set
446# CONFIG_BLK_CPQ_CISS_DA is not set 417# CONFIG_BLK_CPQ_CISS_DA is not set
@@ -458,17 +429,14 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
458CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 429CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
459# CONFIG_CDROM_PKTCDVD is not set 430# CONFIG_CDROM_PKTCDVD is not set
460# CONFIG_ATA_OVER_ETH is not set 431# CONFIG_ATA_OVER_ETH is not set
461 432CONFIG_MISC_DEVICES=y
462#
463# Misc devices
464#
465# CONFIG_IBM_ASM is not set 433# CONFIG_IBM_ASM is not set
466# CONFIG_PHANTOM is not set 434# CONFIG_PHANTOM is not set
435# CONFIG_EEPROM_93CX6 is not set
467# CONFIG_SGI_IOC4 is not set 436# CONFIG_SGI_IOC4 is not set
468# CONFIG_TIFM_CORE is not set 437# CONFIG_TIFM_CORE is not set
469# CONFIG_SONY_LAPTOP is not set 438# CONFIG_SONY_LAPTOP is not set
470# CONFIG_THINKPAD_ACPI is not set 439# CONFIG_THINKPAD_ACPI is not set
471# CONFIG_BLINK is not set
472CONFIG_IDE=y 440CONFIG_IDE=y
473CONFIG_BLK_DEV_IDE=y 441CONFIG_BLK_DEV_IDE=y
474 442
@@ -539,6 +507,7 @@ CONFIG_BLK_DEV_IDEDMA=y
539# 507#
540# CONFIG_RAID_ATTRS is not set 508# CONFIG_RAID_ATTRS is not set
541CONFIG_SCSI=y 509CONFIG_SCSI=y
510CONFIG_SCSI_DMA=y
542# CONFIG_SCSI_TGT is not set 511# CONFIG_SCSI_TGT is not set
543CONFIG_SCSI_NETLINK=y 512CONFIG_SCSI_NETLINK=y
544# CONFIG_SCSI_PROC_FS is not set 513# CONFIG_SCSI_PROC_FS is not set
@@ -590,11 +559,9 @@ CONFIG_AIC79XX_DEBUG_MASK=0
590# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set 559# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
591# CONFIG_SCSI_AIC94XX is not set 560# CONFIG_SCSI_AIC94XX is not set
592# CONFIG_SCSI_ARCMSR is not set 561# CONFIG_SCSI_ARCMSR is not set
593CONFIG_MEGARAID_NEWGEN=y 562# CONFIG_MEGARAID_NEWGEN is not set
594CONFIG_MEGARAID_MM=y
595CONFIG_MEGARAID_MAILBOX=y
596# CONFIG_MEGARAID_LEGACY is not set 563# CONFIG_MEGARAID_LEGACY is not set
597CONFIG_MEGARAID_SAS=y 564# CONFIG_MEGARAID_SAS is not set
598# CONFIG_SCSI_HPTIOP is not set 565# CONFIG_SCSI_HPTIOP is not set
599# CONFIG_SCSI_BUSLOGIC is not set 566# CONFIG_SCSI_BUSLOGIC is not set
600# CONFIG_SCSI_DMX3191D is not set 567# CONFIG_SCSI_DMX3191D is not set
@@ -614,7 +581,6 @@ CONFIG_MEGARAID_SAS=y
614# CONFIG_SCSI_DC395x is not set 581# CONFIG_SCSI_DC395x is not set
615# CONFIG_SCSI_DC390T is not set 582# CONFIG_SCSI_DC390T is not set
616# CONFIG_SCSI_DEBUG is not set 583# CONFIG_SCSI_DEBUG is not set
617# CONFIG_SCSI_ESP_CORE is not set
618# CONFIG_SCSI_SRP is not set 584# CONFIG_SCSI_SRP is not set
619CONFIG_ATA=y 585CONFIG_ATA=y
620# CONFIG_ATA_NONSTANDARD is not set 586# CONFIG_ATA_NONSTANDARD is not set
@@ -671,10 +637,6 @@ CONFIG_SATA_VIA=y
671# CONFIG_PATA_SIS is not set 637# CONFIG_PATA_SIS is not set
672# CONFIG_PATA_VIA is not set 638# CONFIG_PATA_VIA is not set
673# CONFIG_PATA_WINBOND is not set 639# CONFIG_PATA_WINBOND is not set
674
675#
676# Multi-device support (RAID and LVM)
677#
678CONFIG_MD=y 640CONFIG_MD=y
679# CONFIG_BLK_DEV_MD is not set 641# CONFIG_BLK_DEV_MD is not set
680CONFIG_BLK_DEV_DM=y 642CONFIG_BLK_DEV_DM=y
@@ -692,7 +654,7 @@ CONFIG_BLK_DEV_DM=y
692CONFIG_FUSION=y 654CONFIG_FUSION=y
693CONFIG_FUSION_SPI=y 655CONFIG_FUSION_SPI=y
694# CONFIG_FUSION_FC is not set 656# CONFIG_FUSION_FC is not set
695CONFIG_FUSION_SAS=y 657# CONFIG_FUSION_SAS is not set
696CONFIG_FUSION_MAX_SGE=128 658CONFIG_FUSION_MAX_SGE=128
697# CONFIG_FUSION_CTL is not set 659# CONFIG_FUSION_CTL is not set
698 660
@@ -710,7 +672,10 @@ CONFIG_IEEE1394=y
710# 672#
711# Controllers 673# Controllers
712# 674#
713# CONFIG_IEEE1394_PCILYNX is not set 675
676#
677# Texas Instruments PCILynx requires I2C
678#
714CONFIG_IEEE1394_OHCI1394=y 679CONFIG_IEEE1394_OHCI1394=y
715 680
716# 681#
@@ -722,32 +687,19 @@ CONFIG_IEEE1394_OHCI1394=y
722# CONFIG_IEEE1394_ETH1394 is not set 687# CONFIG_IEEE1394_ETH1394 is not set
723# CONFIG_IEEE1394_DV1394 is not set 688# CONFIG_IEEE1394_DV1394 is not set
724CONFIG_IEEE1394_RAWIO=y 689CONFIG_IEEE1394_RAWIO=y
725
726#
727# I2O device support
728#
729# CONFIG_I2O is not set 690# CONFIG_I2O is not set
730# CONFIG_MACINTOSH_DRIVERS is not set 691CONFIG_MACINTOSH_DRIVERS=y
731 692# CONFIG_MAC_EMUMOUSEBTN is not set
732#
733# Network device support
734#
735CONFIG_NETDEVICES=y 693CONFIG_NETDEVICES=y
694CONFIG_NETDEVICES_MULTIQUEUE=y
736# CONFIG_DUMMY is not set 695# CONFIG_DUMMY is not set
737# CONFIG_BONDING is not set 696# CONFIG_BONDING is not set
697# CONFIG_MACVLAN is not set
738# CONFIG_EQUALIZER is not set 698# CONFIG_EQUALIZER is not set
739CONFIG_TUN=y 699CONFIG_TUN=y
740# CONFIG_NET_SB1000 is not set 700# CONFIG_NET_SB1000 is not set
741
742#
743# ARCnet devices
744#
745# CONFIG_ARCNET is not set 701# CONFIG_ARCNET is not set
746# CONFIG_PHYLIB is not set 702# CONFIG_PHYLIB is not set
747
748#
749# Ethernet (10 or 100Mbit)
750#
751CONFIG_NET_ETHERNET=y 703CONFIG_NET_ETHERNET=y
752CONFIG_MII=y 704CONFIG_MII=y
753# CONFIG_HAPPYMEAL is not set 705# CONFIG_HAPPYMEAL is not set
@@ -756,10 +708,6 @@ CONFIG_MII=y
756CONFIG_NET_VENDOR_3COM=y 708CONFIG_NET_VENDOR_3COM=y
757CONFIG_VORTEX=y 709CONFIG_VORTEX=y
758# CONFIG_TYPHOON is not set 710# CONFIG_TYPHOON is not set
759
760#
761# Tulip family network device support
762#
763CONFIG_NET_TULIP=y 711CONFIG_NET_TULIP=y
764# CONFIG_DE2104X is not set 712# CONFIG_DE2104X is not set
765CONFIG_TULIP=y 713CONFIG_TULIP=y
@@ -773,7 +721,8 @@ CONFIG_TULIP=y
773# CONFIG_HP100 is not set 721# CONFIG_HP100 is not set
774CONFIG_NET_PCI=y 722CONFIG_NET_PCI=y
775# CONFIG_PCNET32 is not set 723# CONFIG_PCNET32 is not set
776# CONFIG_AMD8111_ETH is not set 724CONFIG_AMD8111_ETH=y
725# CONFIG_AMD8111E_NAPI is not set
777# CONFIG_ADAPTEC_STARFIRE is not set 726# CONFIG_ADAPTEC_STARFIRE is not set
778CONFIG_B44=y 727CONFIG_B44=y
779CONFIG_FORCEDETH=y 728CONFIG_FORCEDETH=y
@@ -808,7 +757,6 @@ CONFIG_E1000=y
808# CONFIG_SIS190 is not set 757# CONFIG_SIS190 is not set
809# CONFIG_SKGE is not set 758# CONFIG_SKGE is not set
810# CONFIG_SKY2 is not set 759# CONFIG_SKY2 is not set
811# CONFIG_SK98LIN is not set
812# CONFIG_VIA_VELOCITY is not set 760# CONFIG_VIA_VELOCITY is not set
813CONFIG_TIGON3=y 761CONFIG_TIGON3=y
814CONFIG_BNX2=y 762CONFIG_BNX2=y
@@ -823,10 +771,6 @@ CONFIG_S2IO=m
823# CONFIG_MYRI10GE is not set 771# CONFIG_MYRI10GE is not set
824# CONFIG_NETXEN_NIC is not set 772# CONFIG_NETXEN_NIC is not set
825# CONFIG_MLX4_CORE is not set 773# CONFIG_MLX4_CORE is not set
826
827#
828# Token Ring devices
829#
830# CONFIG_TR is not set 774# CONFIG_TR is not set
831 775
832# 776#
@@ -855,15 +799,7 @@ CONFIG_NETCONSOLE=y
855CONFIG_NETPOLL=y 799CONFIG_NETPOLL=y
856# CONFIG_NETPOLL_TRAP is not set 800# CONFIG_NETPOLL_TRAP is not set
857CONFIG_NET_POLL_CONTROLLER=y 801CONFIG_NET_POLL_CONTROLLER=y
858
859#
860# ISDN subsystem
861#
862# CONFIG_ISDN is not set 802# CONFIG_ISDN is not set
863
864#
865# Telephony Support
866#
867# CONFIG_PHONE is not set 803# CONFIG_PHONE is not set
868 804
869# 805#
@@ -871,6 +807,7 @@ CONFIG_NET_POLL_CONTROLLER=y
871# 807#
872CONFIG_INPUT=y 808CONFIG_INPUT=y
873# CONFIG_INPUT_FF_MEMLESS is not set 809# CONFIG_INPUT_FF_MEMLESS is not set
810# CONFIG_INPUT_POLLDEV is not set
874 811
875# 812#
876# Userland interfaces 813# Userland interfaces
@@ -936,6 +873,7 @@ CONFIG_HW_CONSOLE=y
936# 873#
937CONFIG_SERIAL_8250=y 874CONFIG_SERIAL_8250=y
938CONFIG_SERIAL_8250_CONSOLE=y 875CONFIG_SERIAL_8250_CONSOLE=y
876CONFIG_FIX_EARLYCON_MEM=y
939CONFIG_SERIAL_8250_PCI=y 877CONFIG_SERIAL_8250_PCI=y
940CONFIG_SERIAL_8250_PNP=y 878CONFIG_SERIAL_8250_PNP=y
941CONFIG_SERIAL_8250_NR_UARTS=4 879CONFIG_SERIAL_8250_NR_UARTS=4
@@ -951,16 +889,11 @@ CONFIG_SERIAL_CORE_CONSOLE=y
951CONFIG_UNIX98_PTYS=y 889CONFIG_UNIX98_PTYS=y
952CONFIG_LEGACY_PTYS=y 890CONFIG_LEGACY_PTYS=y
953CONFIG_LEGACY_PTY_COUNT=256 891CONFIG_LEGACY_PTY_COUNT=256
954
955#
956# IPMI
957#
958# CONFIG_IPMI_HANDLER is not set 892# CONFIG_IPMI_HANDLER is not set
959# CONFIG_WATCHDOG is not set 893# CONFIG_WATCHDOG is not set
960CONFIG_HW_RANDOM=y 894CONFIG_HW_RANDOM=y
961CONFIG_HW_RANDOM_INTEL=y 895CONFIG_HW_RANDOM_INTEL=y
962CONFIG_HW_RANDOM_AMD=y 896CONFIG_HW_RANDOM_AMD=y
963# CONFIG_HW_RANDOM_GEODE is not set
964# CONFIG_NVRAM is not set 897# CONFIG_NVRAM is not set
965CONFIG_RTC=y 898CONFIG_RTC=y
966# CONFIG_R3964 is not set 899# CONFIG_R3964 is not set
@@ -979,127 +912,19 @@ CONFIG_HPET=y
979# CONFIG_HPET_RTC_IRQ is not set 912# CONFIG_HPET_RTC_IRQ is not set
980CONFIG_HPET_MMAP=y 913CONFIG_HPET_MMAP=y
981# CONFIG_HANGCHECK_TIMER is not set 914# CONFIG_HANGCHECK_TIMER is not set
982
983#
984# TPM devices
985#
986# CONFIG_TCG_TPM is not set 915# CONFIG_TCG_TPM is not set
987# CONFIG_TELCLOCK is not set 916# CONFIG_TELCLOCK is not set
988CONFIG_DEVPORT=y 917CONFIG_DEVPORT=y
989CONFIG_I2C=m 918# CONFIG_I2C is not set
990CONFIG_I2C_BOARDINFO=y
991CONFIG_I2C_CHARDEV=m
992
993#
994# I2C Algorithms
995#
996# CONFIG_I2C_ALGOBIT is not set
997# CONFIG_I2C_ALGOPCF is not set
998# CONFIG_I2C_ALGOPCA is not set
999
1000#
1001# I2C Hardware Bus support
1002#
1003# CONFIG_I2C_ALI1535 is not set
1004# CONFIG_I2C_ALI1563 is not set
1005# CONFIG_I2C_ALI15X3 is not set
1006# CONFIG_I2C_AMD756 is not set
1007# CONFIG_I2C_AMD8111 is not set
1008# CONFIG_I2C_I801 is not set
1009# CONFIG_I2C_I810 is not set
1010# CONFIG_I2C_PIIX4 is not set
1011# CONFIG_I2C_NFORCE2 is not set
1012# CONFIG_I2C_OCORES is not set
1013# CONFIG_I2C_PARPORT_LIGHT is not set
1014# CONFIG_I2C_PROSAVAGE is not set
1015# CONFIG_I2C_SAVAGE4 is not set
1016# CONFIG_I2C_SIMTEC is not set
1017# CONFIG_I2C_SIS5595 is not set
1018# CONFIG_I2C_SIS630 is not set
1019# CONFIG_I2C_SIS96X is not set
1020# CONFIG_I2C_STUB is not set
1021# CONFIG_I2C_TINY_USB is not set
1022# CONFIG_I2C_VIA is not set
1023# CONFIG_I2C_VIAPRO is not set
1024# CONFIG_I2C_VOODOO3 is not set
1025
1026#
1027# Miscellaneous I2C Chip support
1028#
1029# CONFIG_SENSORS_DS1337 is not set
1030# CONFIG_SENSORS_DS1374 is not set
1031# CONFIG_SENSORS_EEPROM is not set
1032# CONFIG_SENSORS_PCF8574 is not set
1033# CONFIG_SENSORS_PCA9539 is not set
1034# CONFIG_SENSORS_PCF8591 is not set
1035# CONFIG_SENSORS_MAX6875 is not set
1036# CONFIG_I2C_DEBUG_CORE is not set
1037# CONFIG_I2C_DEBUG_ALGO is not set
1038# CONFIG_I2C_DEBUG_BUS is not set
1039# CONFIG_I2C_DEBUG_CHIP is not set
1040 919
1041# 920#
1042# SPI support 921# SPI support
1043# 922#
1044# CONFIG_SPI is not set 923# CONFIG_SPI is not set
1045# CONFIG_SPI_MASTER is not set 924# CONFIG_SPI_MASTER is not set
1046
1047#
1048# Dallas's 1-wire bus
1049#
1050# CONFIG_W1 is not set 925# CONFIG_W1 is not set
1051CONFIG_HWMON=y 926# CONFIG_POWER_SUPPLY is not set
1052# CONFIG_HWMON_VID is not set 927# CONFIG_HWMON is not set
1053# CONFIG_SENSORS_ABITUGURU is not set
1054# CONFIG_SENSORS_AD7418 is not set
1055# CONFIG_SENSORS_ADM1021 is not set
1056# CONFIG_SENSORS_ADM1025 is not set
1057# CONFIG_SENSORS_ADM1026 is not set
1058# CONFIG_SENSORS_ADM1029 is not set
1059# CONFIG_SENSORS_ADM1031 is not set
1060# CONFIG_SENSORS_ADM9240 is not set
1061# CONFIG_SENSORS_K8TEMP is not set
1062# CONFIG_SENSORS_ASB100 is not set
1063# CONFIG_SENSORS_ATXP1 is not set
1064# CONFIG_SENSORS_DS1621 is not set
1065# CONFIG_SENSORS_F71805F is not set
1066# CONFIG_SENSORS_FSCHER is not set
1067# CONFIG_SENSORS_FSCPOS is not set
1068# CONFIG_SENSORS_GL518SM is not set
1069# CONFIG_SENSORS_GL520SM is not set
1070CONFIG_SENSORS_CORETEMP=y
1071# CONFIG_SENSORS_IT87 is not set
1072# CONFIG_SENSORS_LM63 is not set
1073# CONFIG_SENSORS_LM75 is not set
1074# CONFIG_SENSORS_LM77 is not set
1075# CONFIG_SENSORS_LM78 is not set
1076# CONFIG_SENSORS_LM80 is not set
1077# CONFIG_SENSORS_LM83 is not set
1078# CONFIG_SENSORS_LM85 is not set
1079# CONFIG_SENSORS_LM87 is not set
1080# CONFIG_SENSORS_LM90 is not set
1081# CONFIG_SENSORS_LM92 is not set
1082# CONFIG_SENSORS_MAX1619 is not set
1083# CONFIG_SENSORS_MAX6650 is not set
1084# CONFIG_SENSORS_PC87360 is not set
1085# CONFIG_SENSORS_PC87427 is not set
1086# CONFIG_SENSORS_SIS5595 is not set
1087# CONFIG_SENSORS_SMSC47M1 is not set
1088# CONFIG_SENSORS_SMSC47M192 is not set
1089CONFIG_SENSORS_SMSC47B397=m
1090# CONFIG_SENSORS_VIA686A is not set
1091# CONFIG_SENSORS_VT1211 is not set
1092# CONFIG_SENSORS_VT8231 is not set
1093# CONFIG_SENSORS_W83781D is not set
1094# CONFIG_SENSORS_W83791D is not set
1095# CONFIG_SENSORS_W83792D is not set
1096# CONFIG_SENSORS_W83793 is not set
1097# CONFIG_SENSORS_W83L785TS is not set
1098# CONFIG_SENSORS_W83627HF is not set
1099# CONFIG_SENSORS_W83627EHF is not set
1100# CONFIG_SENSORS_HDAPS is not set
1101# CONFIG_SENSORS_APPLESMC is not set
1102# CONFIG_HWMON_DEBUG_CHIP is not set
1103 928
1104# 929#
1105# Multifunction device drivers 930# Multifunction device drivers
@@ -1149,15 +974,11 @@ CONFIG_SOUND=y
1149# Open Sound System 974# Open Sound System
1150# 975#
1151CONFIG_SOUND_PRIME=y 976CONFIG_SOUND_PRIME=y
1152# CONFIG_OSS_OBSOLETE is not set
1153# CONFIG_SOUND_TRIDENT is not set 977# CONFIG_SOUND_TRIDENT is not set
1154# CONFIG_SOUND_MSNDCLAS is not set 978# CONFIG_SOUND_MSNDCLAS is not set
1155# CONFIG_SOUND_MSNDPIN is not set 979# CONFIG_SOUND_MSNDPIN is not set
1156# CONFIG_SOUND_OSS is not set 980# CONFIG_SOUND_OSS is not set
1157 981CONFIG_HID_SUPPORT=y
1158#
1159# HID Devices
1160#
1161CONFIG_HID=y 982CONFIG_HID=y
1162# CONFIG_HID_DEBUG is not set 983# CONFIG_HID_DEBUG is not set
1163 984
@@ -1168,10 +989,7 @@ CONFIG_USB_HID=y
1168# CONFIG_USB_HIDINPUT_POWERBOOK is not set 989# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1169# CONFIG_HID_FF is not set 990# CONFIG_HID_FF is not set
1170# CONFIG_USB_HIDDEV is not set 991# CONFIG_USB_HIDDEV is not set
1171 992CONFIG_USB_SUPPORT=y
1172#
1173# USB support
1174#
1175CONFIG_USB_ARCH_HAS_HCD=y 993CONFIG_USB_ARCH_HAS_HCD=y
1176CONFIG_USB_ARCH_HAS_OHCI=y 994CONFIG_USB_ARCH_HAS_OHCI=y
1177CONFIG_USB_ARCH_HAS_EHCI=y 995CONFIG_USB_ARCH_HAS_EHCI=y
@@ -1185,6 +1003,7 @@ CONFIG_USB_DEVICEFS=y
1185# CONFIG_USB_DEVICE_CLASS is not set 1003# CONFIG_USB_DEVICE_CLASS is not set
1186# CONFIG_USB_DYNAMIC_MINORS is not set 1004# CONFIG_USB_DYNAMIC_MINORS is not set
1187# CONFIG_USB_SUSPEND is not set 1005# CONFIG_USB_SUSPEND is not set
1006# CONFIG_USB_PERSIST is not set
1188# CONFIG_USB_OTG is not set 1007# CONFIG_USB_OTG is not set
1189 1008
1190# 1009#
@@ -1194,7 +1013,6 @@ CONFIG_USB_EHCI_HCD=y
1194# CONFIG_USB_EHCI_SPLIT_ISO is not set 1013# CONFIG_USB_EHCI_SPLIT_ISO is not set
1195# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1014# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1196# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1015# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1197# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
1198# CONFIG_USB_ISP116X_HCD is not set 1016# CONFIG_USB_ISP116X_HCD is not set
1199CONFIG_USB_OHCI_HCD=y 1017CONFIG_USB_OHCI_HCD=y
1200# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1018# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
@@ -1202,6 +1020,7 @@ CONFIG_USB_OHCI_HCD=y
1202CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1020CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1203CONFIG_USB_UHCI_HCD=y 1021CONFIG_USB_UHCI_HCD=y
1204# CONFIG_USB_SL811_HCD is not set 1022# CONFIG_USB_SL811_HCD is not set
1023# CONFIG_USB_R8A66597_HCD is not set
1205 1024
1206# 1025#
1207# USB Device Class drivers 1026# USB Device Class drivers
@@ -1292,15 +1111,7 @@ CONFIG_USB_MON=y
1292# 1111#
1293# LED Triggers 1112# LED Triggers
1294# 1113#
1295
1296#
1297# InfiniBand support
1298#
1299# CONFIG_INFINIBAND is not set 1114# CONFIG_INFINIBAND is not set
1300
1301#
1302# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1303#
1304# CONFIG_EDAC is not set 1115# CONFIG_EDAC is not set
1305 1116
1306# 1117#
@@ -1320,11 +1131,13 @@ CONFIG_USB_MON=y
1320# 1131#
1321# DMA Devices 1132# DMA Devices
1322# 1133#
1134CONFIG_VIRTUALIZATION=y
1135# CONFIG_KVM is not set
1323 1136
1324# 1137#
1325# Virtualization 1138# Userspace I/O
1326# 1139#
1327# CONFIG_KVM is not set 1140# CONFIG_UIO is not set
1328 1141
1329# 1142#
1330# Firmware Drivers 1143# Firmware Drivers
@@ -1332,6 +1145,7 @@ CONFIG_USB_MON=y
1332# CONFIG_EDD is not set 1145# CONFIG_EDD is not set
1333# CONFIG_DELL_RBU is not set 1146# CONFIG_DELL_RBU is not set
1334# CONFIG_DCDBAS is not set 1147# CONFIG_DCDBAS is not set
1148CONFIG_DMIID=y
1335 1149
1336# 1150#
1337# File systems 1151# File systems
@@ -1447,7 +1261,6 @@ CONFIG_SUNRPC=y
1447# CONFIG_NCP_FS is not set 1261# CONFIG_NCP_FS is not set
1448# CONFIG_CODA_FS is not set 1262# CONFIG_CODA_FS is not set
1449# CONFIG_AFS_FS is not set 1263# CONFIG_AFS_FS is not set
1450# CONFIG_9P_FS is not set
1451 1264
1452# 1265#
1453# Partition Types 1266# Partition Types
@@ -1524,8 +1337,9 @@ CONFIG_DEBUG_FS=y
1524CONFIG_DEBUG_KERNEL=y 1337CONFIG_DEBUG_KERNEL=y
1525# CONFIG_DEBUG_SHIRQ is not set 1338# CONFIG_DEBUG_SHIRQ is not set
1526CONFIG_DETECT_SOFTLOCKUP=y 1339CONFIG_DETECT_SOFTLOCKUP=y
1340# CONFIG_SCHED_DEBUG is not set
1527# CONFIG_SCHEDSTATS is not set 1341# CONFIG_SCHEDSTATS is not set
1528# CONFIG_TIMER_STATS is not set 1342CONFIG_TIMER_STATS=y
1529# CONFIG_DEBUG_SLAB is not set 1343# CONFIG_DEBUG_SLAB is not set
1530# CONFIG_DEBUG_RT_MUTEXES is not set 1344# CONFIG_DEBUG_RT_MUTEXES is not set
1531# CONFIG_RT_MUTEX_TESTER is not set 1345# CONFIG_RT_MUTEX_TESTER is not set
@@ -1533,6 +1347,7 @@ CONFIG_DETECT_SOFTLOCKUP=y
1533# CONFIG_DEBUG_MUTEXES is not set 1347# CONFIG_DEBUG_MUTEXES is not set
1534# CONFIG_DEBUG_LOCK_ALLOC is not set 1348# CONFIG_DEBUG_LOCK_ALLOC is not set
1535# CONFIG_PROVE_LOCKING is not set 1349# CONFIG_PROVE_LOCKING is not set
1350# CONFIG_LOCK_STAT is not set
1536# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1351# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1537# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1352# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1538# CONFIG_DEBUG_KOBJECT is not set 1353# CONFIG_DEBUG_KOBJECT is not set
@@ -1541,8 +1356,6 @@ CONFIG_DEBUG_BUGVERBOSE=y
1541# CONFIG_DEBUG_VM is not set 1356# CONFIG_DEBUG_VM is not set
1542# CONFIG_DEBUG_LIST is not set 1357# CONFIG_DEBUG_LIST is not set
1543# CONFIG_FRAME_POINTER is not set 1358# CONFIG_FRAME_POINTER is not set
1544CONFIG_UNWIND_INFO=y
1545CONFIG_STACK_UNWIND=y
1546# CONFIG_FORCED_INLINING is not set 1359# CONFIG_FORCED_INLINING is not set
1547# CONFIG_RCU_TORTURE_TEST is not set 1360# CONFIG_RCU_TORTURE_TEST is not set
1548# CONFIG_LKDTM is not set 1361# CONFIG_LKDTM is not set
@@ -1557,10 +1370,6 @@ CONFIG_DEBUG_STACKOVERFLOW=y
1557# 1370#
1558# CONFIG_KEYS is not set 1371# CONFIG_KEYS is not set
1559# CONFIG_SECURITY is not set 1372# CONFIG_SECURITY is not set
1560
1561#
1562# Cryptographic options
1563#
1564# CONFIG_CRYPTO is not set 1373# CONFIG_CRYPTO is not set
1565 1374
1566# 1375#
@@ -1571,6 +1380,7 @@ CONFIG_BITREVERSE=y
1571# CONFIG_CRC16 is not set 1380# CONFIG_CRC16 is not set
1572# CONFIG_CRC_ITU_T is not set 1381# CONFIG_CRC_ITU_T is not set
1573CONFIG_CRC32=y 1382CONFIG_CRC32=y
1383# CONFIG_CRC7 is not set
1574# CONFIG_LIBCRC32C is not set 1384# CONFIG_LIBCRC32C is not set
1575CONFIG_ZLIB_INFLATE=y 1385CONFIG_ZLIB_INFLATE=y
1576CONFIG_PLIST=y 1386CONFIG_PLIST=y
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
index ed56a8806eab..b70f3e7cf06c 100644
--- a/arch/x86_64/ia32/ia32_binfmt.c
+++ b/arch/x86_64/ia32/ia32_binfmt.c
@@ -38,6 +38,7 @@
38 38
39int sysctl_vsyscall32 = 1; 39int sysctl_vsyscall32 = 1;
40 40
41#undef ARCH_DLINFO
41#define ARCH_DLINFO do { \ 42#define ARCH_DLINFO do { \
42 if (sysctl_vsyscall32) { \ 43 if (sysctl_vsyscall32) { \
43 NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \ 44 NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 3f66e970d86f..938278697e20 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -104,7 +104,7 @@ ENTRY(ia32_sysenter_target)
104 pushq %rax 104 pushq %rax
105 CFI_ADJUST_CFA_OFFSET 8 105 CFI_ADJUST_CFA_OFFSET 8
106 cld 106 cld
107 SAVE_ARGS 0,0,0 107 SAVE_ARGS 0,0,1
108 /* no need to do an access_ok check here because rbp has been 108 /* no need to do an access_ok check here because rbp has been
109 32bit zero extended */ 109 32bit zero extended */
1101: movl (%rbp),%r9d 1101: movl (%rbp),%r9d
@@ -294,7 +294,7 @@ ia32_badarg:
294 */ 294 */
295 295
296ENTRY(ia32_syscall) 296ENTRY(ia32_syscall)
297 CFI_STARTPROC simple 297 CFI_STARTPROC32 simple
298 CFI_SIGNAL_FRAME 298 CFI_SIGNAL_FRAME
299 CFI_DEF_CFA rsp,SS+8-RIP 299 CFI_DEF_CFA rsp,SS+8-RIP
300 /*CFI_REL_OFFSET ss,SS-RIP*/ 300 /*CFI_REL_OFFSET ss,SS-RIP*/
@@ -330,6 +330,7 @@ ia32_sysret:
330 330
331ia32_tracesys: 331ia32_tracesys:
332 SAVE_REST 332 SAVE_REST
333 CLEAR_RREGS
333 movq $-ENOSYS,RAX(%rsp) /* really needed? */ 334 movq $-ENOSYS,RAX(%rsp) /* really needed? */
334 movq %rsp,%rdi /* &pt_regs -> arg1 */ 335 movq %rsp,%rdi /* &pt_regs -> arg1 */
335 call syscall_trace_enter 336 call syscall_trace_enter
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index a3d450d6c15b..8f681cae7bf7 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -20,7 +20,7 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <asm/e820.h> 21#include <asm/e820.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/proto.h> 23#include <asm/iommu.h>
24#include <asm/pci-direct.h> 24#include <asm/pci-direct.h>
25#include <asm/dma.h> 25#include <asm/dma.h>
26#include <asm/k8.h> 26#include <asm/k8.h>
@@ -214,7 +214,7 @@ void __init iommu_hole_init(void)
214 if (iommu_aperture_disabled || !fix_aperture || !early_pci_allowed()) 214 if (iommu_aperture_disabled || !fix_aperture || !early_pci_allowed())
215 return; 215 return;
216 216
217 printk("Checking aperture...\n"); 217 printk(KERN_INFO "Checking aperture...\n");
218 218
219 fix = 0; 219 fix = 0;
220 for (num = 24; num < 32; num++) { 220 for (num = 24; num < 32; num++) {
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 1b0e07bb8728..900ff38d68de 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -92,8 +92,9 @@ unsigned int safe_apic_wait_icr_idle(void)
92void enable_NMI_through_LVT0 (void * dummy) 92void enable_NMI_through_LVT0 (void * dummy)
93{ 93{
94 unsigned int v; 94 unsigned int v;
95 95
96 v = APIC_DM_NMI; /* unmask and set to NMI */ 96 /* unmask and set to NMI */
97 v = APIC_DM_NMI;
97 apic_write(APIC_LVT0, v); 98 apic_write(APIC_LVT0, v);
98} 99}
99 100
@@ -120,7 +121,7 @@ void ack_bad_irq(unsigned int irq)
120 * holds up an irq slot - in excessive cases (when multiple 121 * holds up an irq slot - in excessive cases (when multiple
121 * unexpected vectors occur) that might lock up the APIC 122 * unexpected vectors occur) that might lock up the APIC
122 * completely. 123 * completely.
123 * But don't ack when the APIC is disabled. -AK 124 * But don't ack when the APIC is disabled. -AK
124 */ 125 */
125 if (!disable_apic) 126 if (!disable_apic)
126 ack_APIC_irq(); 127 ack_APIC_irq();
@@ -616,7 +617,7 @@ early_param("apic", apic_set_verbosity);
616 * Detect and enable local APICs on non-SMP boards. 617 * Detect and enable local APICs on non-SMP boards.
617 * Original code written by Keir Fraser. 618 * Original code written by Keir Fraser.
618 * On AMD64 we trust the BIOS - if it says no APIC it is likely 619 * On AMD64 we trust the BIOS - if it says no APIC it is likely
619 * not correctly set up (usually the APIC timer won't work etc.) 620 * not correctly set up (usually the APIC timer won't work etc.)
620 */ 621 */
621 622
622static int __init detect_init_APIC (void) 623static int __init detect_init_APIC (void)
@@ -789,13 +790,13 @@ static void setup_APIC_timer(unsigned int clocks)
789 local_irq_save(flags); 790 local_irq_save(flags);
790 791
791 /* wait for irq slice */ 792 /* wait for irq slice */
792 if (hpet_address && hpet_use_timer) { 793 if (hpet_address && hpet_use_timer) {
793 int trigger = hpet_readl(HPET_T0_CMP); 794 int trigger = hpet_readl(HPET_T0_CMP);
794 while (hpet_readl(HPET_COUNTER) >= trigger) 795 while (hpet_readl(HPET_COUNTER) >= trigger)
795 /* do nothing */ ; 796 /* do nothing */ ;
796 while (hpet_readl(HPET_COUNTER) < trigger) 797 while (hpet_readl(HPET_COUNTER) < trigger)
797 /* do nothing */ ; 798 /* do nothing */ ;
798 } else { 799 } else {
799 int c1, c2; 800 int c1, c2;
800 outb_p(0x00, 0x43); 801 outb_p(0x00, 0x43);
801 c2 = inb_p(0x40); 802 c2 = inb_p(0x40);
@@ -881,10 +882,10 @@ static unsigned int calibration_result;
881 882
882void __init setup_boot_APIC_clock (void) 883void __init setup_boot_APIC_clock (void)
883{ 884{
884 if (disable_apic_timer) { 885 if (disable_apic_timer) {
885 printk(KERN_INFO "Disabling APIC timer\n"); 886 printk(KERN_INFO "Disabling APIC timer\n");
886 return; 887 return;
887 } 888 }
888 889
889 printk(KERN_INFO "Using local APIC timer interrupts.\n"); 890 printk(KERN_INFO "Using local APIC timer interrupts.\n");
890 using_apic_timer = 1; 891 using_apic_timer = 1;
@@ -990,8 +991,8 @@ int setup_profiling_timer(unsigned int multiplier)
990 return -EINVAL; 991 return -EINVAL;
991} 992}
992 993
993void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector, 994void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
994 unsigned char msg_type, unsigned char mask) 995 unsigned char msg_type, unsigned char mask)
995{ 996{
996 unsigned long reg = (lvt_off << 4) + K8_APIC_EXT_LVT_BASE; 997 unsigned long reg = (lvt_off << 4) + K8_APIC_EXT_LVT_BASE;
997 unsigned int v = (mask << 16) | (msg_type << 8) | vector; 998 unsigned int v = (mask << 16) | (msg_type << 8) | vector;
@@ -1128,20 +1129,6 @@ asmlinkage void smp_spurious_interrupt(void)
1128 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f))) 1129 if (v & (1 << (SPURIOUS_APIC_VECTOR & 0x1f)))
1129 ack_APIC_irq(); 1130 ack_APIC_irq();
1130 1131
1131#if 0
1132 static unsigned long last_warning;
1133 static unsigned long skipped;
1134
1135 /* see sw-dev-man vol 3, chapter 7.4.13.5 */
1136 if (time_before(last_warning+30*HZ,jiffies)) {
1137 printk(KERN_INFO "spurious APIC interrupt on CPU#%d, %ld skipped.\n",
1138 smp_processor_id(), skipped);
1139 last_warning = jiffies;
1140 skipped = 0;
1141 } else {
1142 skipped++;
1143 }
1144#endif
1145 irq_exit(); 1132 irq_exit();
1146} 1133}
1147 1134
@@ -1173,11 +1160,11 @@ asmlinkage void smp_error_interrupt(void)
1173 7: Illegal register address 1160 7: Illegal register address
1174 */ 1161 */
1175 printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n", 1162 printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
1176 smp_processor_id(), v , v1); 1163 smp_processor_id(), v , v1);
1177 irq_exit(); 1164 irq_exit();
1178} 1165}
1179 1166
1180int disable_apic; 1167int disable_apic;
1181 1168
1182/* 1169/*
1183 * This initializes the IO-APIC and APIC hardware if this is 1170 * This initializes the IO-APIC and APIC hardware if this is
@@ -1185,11 +1172,11 @@ int disable_apic;
1185 */ 1172 */
1186int __init APIC_init_uniprocessor (void) 1173int __init APIC_init_uniprocessor (void)
1187{ 1174{
1188 if (disable_apic) { 1175 if (disable_apic) {
1189 printk(KERN_INFO "Apic disabled\n"); 1176 printk(KERN_INFO "Apic disabled\n");
1190 return -1; 1177 return -1;
1191 } 1178 }
1192 if (!cpu_has_apic) { 1179 if (!cpu_has_apic) {
1193 disable_apic = 1; 1180 disable_apic = 1;
1194 printk(KERN_INFO "Apic disabled by BIOS\n"); 1181 printk(KERN_INFO "Apic disabled by BIOS\n");
1195 return -1; 1182 return -1;
@@ -1211,8 +1198,8 @@ int __init APIC_init_uniprocessor (void)
1211 return 0; 1198 return 0;
1212} 1199}
1213 1200
1214static __init int setup_disableapic(char *str) 1201static __init int setup_disableapic(char *str)
1215{ 1202{
1216 disable_apic = 1; 1203 disable_apic = 1;
1217 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); 1204 clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
1218 return 0; 1205 return 0;
@@ -1220,10 +1207,10 @@ static __init int setup_disableapic(char *str)
1220early_param("disableapic", setup_disableapic); 1207early_param("disableapic", setup_disableapic);
1221 1208
1222/* same as disableapic, for compatibility */ 1209/* same as disableapic, for compatibility */
1223static __init int setup_nolapic(char *str) 1210static __init int setup_nolapic(char *str)
1224{ 1211{
1225 return setup_disableapic(str); 1212 return setup_disableapic(str);
1226} 1213}
1227early_param("nolapic", setup_nolapic); 1214early_param("nolapic", setup_nolapic);
1228 1215
1229static int __init parse_lapic_timer_c2_ok(char *arg) 1216static int __init parse_lapic_timer_c2_ok(char *arg)
@@ -1233,13 +1220,13 @@ static int __init parse_lapic_timer_c2_ok(char *arg)
1233} 1220}
1234early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok); 1221early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1235 1222
1236static __init int setup_noapictimer(char *str) 1223static __init int setup_noapictimer(char *str)
1237{ 1224{
1238 if (str[0] != ' ' && str[0] != 0) 1225 if (str[0] != ' ' && str[0] != 0)
1239 return 0; 1226 return 0;
1240 disable_apic_timer = 1; 1227 disable_apic_timer = 1;
1241 return 1; 1228 return 1;
1242} 1229}
1243 1230
1244static __init int setup_apicmaintimer(char *str) 1231static __init int setup_apicmaintimer(char *str)
1245{ 1232{
@@ -1264,5 +1251,5 @@ static __init int setup_apicpmtimer(char *s)
1264} 1251}
1265__setup("apicpmtimer", setup_apicpmtimer); 1252__setup("apicpmtimer", setup_apicpmtimer);
1266 1253
1267__setup("noapictimer", setup_noapictimer); 1254__setup("noapictimer", setup_noapictimer);
1268 1255
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 13c6c37610e0..0f4d5e209e9b 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -194,37 +194,6 @@ unsigned long __init e820_end_of_ram(void)
194} 194}
195 195
196/* 196/*
197 * Find the hole size in the range.
198 */
199unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
200{
201 unsigned long ram = 0;
202 int i;
203
204 for (i = 0; i < e820.nr_map; i++) {
205 struct e820entry *ei = &e820.map[i];
206 unsigned long last, addr;
207
208 if (ei->type != E820_RAM ||
209 ei->addr+ei->size <= start ||
210 ei->addr >= end)
211 continue;
212
213 addr = round_up(ei->addr, PAGE_SIZE);
214 if (addr < start)
215 addr = start;
216
217 last = round_down(ei->addr + ei->size, PAGE_SIZE);
218 if (last >= end)
219 last = end;
220
221 if (last > addr)
222 ram += last - addr;
223 }
224 return ((end - start) - ram);
225}
226
227/*
228 * Mark e820 reserved areas as busy for the resource manager. 197 * Mark e820 reserved areas as busy for the resource manager.
229 */ 198 */
230void __init e820_reserve_resources(void) 199void __init e820_reserve_resources(void)
@@ -289,47 +258,61 @@ void __init e820_mark_nosave_regions(void)
289 } 258 }
290} 259}
291 260
292/* Walk the e820 map and register active regions within a node */ 261/*
293void __init 262 * Finds an active region in the address range from start_pfn to end_pfn and
294e820_register_active_regions(int nid, unsigned long start_pfn, 263 * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
295 unsigned long end_pfn) 264 */
265static int __init e820_find_active_region(const struct e820entry *ei,
266 unsigned long start_pfn,
267 unsigned long end_pfn,
268 unsigned long *ei_startpfn,
269 unsigned long *ei_endpfn)
296{ 270{
297 int i; 271 *ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
298 unsigned long ei_startpfn, ei_endpfn; 272 *ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE) >> PAGE_SHIFT;
299 for (i = 0; i < e820.nr_map; i++) {
300 struct e820entry *ei = &e820.map[i];
301 ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
302 ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE)
303 >> PAGE_SHIFT;
304 273
305 /* Skip map entries smaller than a page */ 274 /* Skip map entries smaller than a page */
306 if (ei_startpfn >= ei_endpfn) 275 if (*ei_startpfn >= *ei_endpfn)
307 continue; 276 return 0;
308 277
309 /* Check if end_pfn_map should be updated */ 278 /* Check if end_pfn_map should be updated */
310 if (ei->type != E820_RAM && ei_endpfn > end_pfn_map) 279 if (ei->type != E820_RAM && *ei_endpfn > end_pfn_map)
311 end_pfn_map = ei_endpfn; 280 end_pfn_map = *ei_endpfn;
312 281
313 /* Skip if map is outside the node */ 282 /* Skip if map is outside the node */
314 if (ei->type != E820_RAM || 283 if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
315 ei_endpfn <= start_pfn || 284 *ei_startpfn >= end_pfn)
316 ei_startpfn >= end_pfn) 285 return 0;
317 continue;
318 286
319 /* Check for overlaps */ 287 /* Check for overlaps */
320 if (ei_startpfn < start_pfn) 288 if (*ei_startpfn < start_pfn)
321 ei_startpfn = start_pfn; 289 *ei_startpfn = start_pfn;
322 if (ei_endpfn > end_pfn) 290 if (*ei_endpfn > end_pfn)
323 ei_endpfn = end_pfn; 291 *ei_endpfn = end_pfn;
324 292
325 /* Obey end_user_pfn to save on memmap */ 293 /* Obey end_user_pfn to save on memmap */
326 if (ei_startpfn >= end_user_pfn) 294 if (*ei_startpfn >= end_user_pfn)
327 continue; 295 return 0;
328 if (ei_endpfn > end_user_pfn) 296 if (*ei_endpfn > end_user_pfn)
329 ei_endpfn = end_user_pfn; 297 *ei_endpfn = end_user_pfn;
330 298
331 add_active_range(nid, ei_startpfn, ei_endpfn); 299 return 1;
332 } 300}
301
302/* Walk the e820 map and register active regions within a node */
303void __init
304e820_register_active_regions(int nid, unsigned long start_pfn,
305 unsigned long end_pfn)
306{
307 unsigned long ei_startpfn;
308 unsigned long ei_endpfn;
309 int i;
310
311 for (i = 0; i < e820.nr_map; i++)
312 if (e820_find_active_region(&e820.map[i],
313 start_pfn, end_pfn,
314 &ei_startpfn, &ei_endpfn))
315 add_active_range(nid, ei_startpfn, ei_endpfn);
333} 316}
334 317
335/* 318/*
@@ -350,12 +333,35 @@ void __init add_memory_region(unsigned long start, unsigned long size, int type)
350 e820.nr_map++; 333 e820.nr_map++;
351} 334}
352 335
336/*
337 * Find the hole size (in bytes) in the memory range.
338 * @start: starting address of the memory range to scan
339 * @end: ending address of the memory range to scan
340 */
341unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
342{
343 unsigned long start_pfn = start >> PAGE_SHIFT;
344 unsigned long end_pfn = end >> PAGE_SHIFT;
345 unsigned long ei_startpfn;
346 unsigned long ei_endpfn;
347 unsigned long ram = 0;
348 int i;
349
350 for (i = 0; i < e820.nr_map; i++) {
351 if (e820_find_active_region(&e820.map[i],
352 start_pfn, end_pfn,
353 &ei_startpfn, &ei_endpfn))
354 ram += ei_endpfn - ei_startpfn;
355 }
356 return end - start - (ram << PAGE_SHIFT);
357}
358
353void __init e820_print_map(char *who) 359void __init e820_print_map(char *who)
354{ 360{
355 int i; 361 int i;
356 362
357 for (i = 0; i < e820.nr_map; i++) { 363 for (i = 0; i < e820.nr_map; i++) {
358 printk(" %s: %016Lx - %016Lx ", who, 364 printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
359 (unsigned long long) e820.map[i].addr, 365 (unsigned long long) e820.map[i].addr,
360 (unsigned long long) (e820.map[i].addr + e820.map[i].size)); 366 (unsigned long long) (e820.map[i].addr + e820.map[i].size));
361 switch (e820.map[i].type) { 367 switch (e820.map[i].type) {
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c
index 990d9c218a5d..13aa4fd728f3 100644
--- a/arch/x86_64/kernel/early-quirks.c
+++ b/arch/x86_64/kernel/early-quirks.c
@@ -14,6 +14,7 @@
14#include <linux/pci_ids.h> 14#include <linux/pci_ids.h>
15#include <asm/pci-direct.h> 15#include <asm/pci-direct.h>
16#include <asm/proto.h> 16#include <asm/proto.h>
17#include <asm/iommu.h>
17#include <asm/dma.h> 18#include <asm/dma.h>
18 19
19static void __init via_bugs(void) 20static void __init via_bugs(void)
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index a67f87bf4015..830cfc6ee8cb 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -282,7 +282,7 @@ sysret_careful:
282sysret_signal: 282sysret_signal:
283 TRACE_IRQS_ON 283 TRACE_IRQS_ON
284 sti 284 sti
285 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx 285 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
286 jz 1f 286 jz 1f
287 287
288 /* Really a signal */ 288 /* Really a signal */
@@ -375,7 +375,7 @@ int_very_careful:
375 jmp int_restore_rest 375 jmp int_restore_rest
376 376
377int_signal: 377int_signal:
378 testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP),%edx 378 testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
379 jz 1f 379 jz 1f
380 movq %rsp,%rdi # &ptregs -> arg1 380 movq %rsp,%rdi # &ptregs -> arg1
381 xorl %esi,%esi # oldset -> arg2 381 xorl %esi,%esi # oldset -> arg2
@@ -599,7 +599,7 @@ retint_careful:
599 jmp retint_check 599 jmp retint_check
600 600
601retint_signal: 601retint_signal:
602 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx 602 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
603 jz retint_swapgs 603 jz retint_swapgs
604 TRACE_IRQS_ON 604 TRACE_IRQS_ON
605 sti 605 sti
diff --git a/arch/x86_64/kernel/hpet.c b/arch/x86_64/kernel/hpet.c
index b8286968662d..636f4f9fc6bb 100644
--- a/arch/x86_64/kernel/hpet.c
+++ b/arch/x86_64/kernel/hpet.c
@@ -190,7 +190,7 @@ int hpet_reenable(void)
190 */ 190 */
191 191
192#define TICK_COUNT 100000000 192#define TICK_COUNT 100000000
193#define TICK_MIN 5000 193#define SMI_THRESHOLD 50000
194#define MAX_TRIES 5 194#define MAX_TRIES 5
195 195
196/* 196/*
@@ -205,7 +205,7 @@ static void __init read_hpet_tsc(int *hpet, int *tsc)
205 tsc1 = get_cycles_sync(); 205 tsc1 = get_cycles_sync();
206 hpet1 = hpet_readl(HPET_COUNTER); 206 hpet1 = hpet_readl(HPET_COUNTER);
207 tsc2 = get_cycles_sync(); 207 tsc2 = get_cycles_sync();
208 if (tsc2 - tsc1 > TICK_MIN) 208 if ((tsc2 - tsc1) < SMI_THRESHOLD)
209 break; 209 break;
210 } 210 }
211 *hpet = hpet1; 211 *hpet = hpet1;
@@ -439,7 +439,7 @@ int hpet_rtc_dropped_irq(void)
439 return 1; 439 return 1;
440} 440}
441 441
442irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) 442irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
443{ 443{
444 struct rtc_time curr_time; 444 struct rtc_time curr_time;
445 unsigned long rtc_int_flag = 0; 445 unsigned long rtc_int_flag = 0;
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index 4b326655b208..948cae646099 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -444,24 +444,6 @@ void __init init_ISA_irqs (void)
444 } 444 }
445} 445}
446 446
447void apic_timer_interrupt(void);
448void spurious_interrupt(void);
449void error_interrupt(void);
450void reschedule_interrupt(void);
451void call_function_interrupt(void);
452void irq_move_cleanup_interrupt(void);
453void invalidate_interrupt0(void);
454void invalidate_interrupt1(void);
455void invalidate_interrupt2(void);
456void invalidate_interrupt3(void);
457void invalidate_interrupt4(void);
458void invalidate_interrupt5(void);
459void invalidate_interrupt6(void);
460void invalidate_interrupt7(void);
461void thermal_interrupt(void);
462void threshold_interrupt(void);
463void i8254_timer_resume(void);
464
465static void setup_timer_hardware(void) 447static void setup_timer_hardware(void)
466{ 448{
467 outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */ 449 outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 1c6c6f724573..050141c0602b 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -152,6 +152,32 @@ static inline void io_apic_modify(unsigned int apic, unsigned int value)
152 writel(value, &io_apic->data); 152 writel(value, &io_apic->data);
153} 153}
154 154
155static int io_apic_level_ack_pending(unsigned int irq)
156{
157 struct irq_pin_list *entry;
158 unsigned long flags;
159 int pending = 0;
160
161 spin_lock_irqsave(&ioapic_lock, flags);
162 entry = irq_2_pin + irq;
163 for (;;) {
164 unsigned int reg;
165 int pin;
166
167 pin = entry->pin;
168 if (pin == -1)
169 break;
170 reg = io_apic_read(entry->apic, 0x10 + pin*2);
171 /* Is the remote IRR bit set? */
172 pending |= (reg >> 14) & 1;
173 if (!entry->next)
174 break;
175 entry = irq_2_pin + entry->next;
176 }
177 spin_unlock_irqrestore(&ioapic_lock, flags);
178 return pending;
179}
180
155/* 181/*
156 * Synchronize the IO-APIC and the CPU by doing 182 * Synchronize the IO-APIC and the CPU by doing
157 * a dummy read from the IO-APIC 183 * a dummy read from the IO-APIC
@@ -1418,9 +1444,37 @@ static void ack_apic_level(unsigned int irq)
1418 ack_APIC_irq(); 1444 ack_APIC_irq();
1419 1445
1420 /* Now we can move and renable the irq */ 1446 /* Now we can move and renable the irq */
1421 move_masked_irq(irq); 1447 if (unlikely(do_unmask_irq)) {
1422 if (unlikely(do_unmask_irq)) 1448 /* Only migrate the irq if the ack has been received.
1449 *
1450 * On rare occasions the broadcast level triggered ack gets
1451 * delayed going to ioapics, and if we reprogram the
1452 * vector while Remote IRR is still set the irq will never
1453 * fire again.
1454 *
1455 * To prevent this scenario we read the Remote IRR bit
1456 * of the ioapic. This has two effects.
1457 * - On any sane system the read of the ioapic will
1458 * flush writes (and acks) going to the ioapic from
1459 * this cpu.
1460 * - We get to see if the ACK has actually been delivered.
1461 *
1462 * Based on failed experiments of reprogramming the
1463 * ioapic entry from outside of irq context starting
1464 * with masking the ioapic entry and then polling until
1465 * Remote IRR was clear before reprogramming the
1466 * ioapic I don't trust the Remote IRR bit to be
1467 * completey accurate.
1468 *
1469 * However there appears to be no other way to plug
1470 * this race, so if the Remote IRR bit is not
1471 * accurate and is causing problems then it is a hardware bug
1472 * and you can go talk to the chipset vendor about it.
1473 */
1474 if (!io_apic_level_ack_pending(irq))
1475 move_masked_irq(irq);
1423 unmask_IO_APIC_irq(irq); 1476 unmask_IO_APIC_irq(irq);
1477 }
1424} 1478}
1425 1479
1426static struct irq_chip ioapic_chip __read_mostly = { 1480static struct irq_chip ioapic_chip __read_mostly = {
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index f3fb8174559e..4d8450ee3635 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -18,6 +18,8 @@
18#include <linux/capability.h> 18#include <linux/capability.h>
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/poll.h>
22#include <linux/thread_info.h>
21#include <linux/ctype.h> 23#include <linux/ctype.h>
22#include <linux/kmod.h> 24#include <linux/kmod.h>
23#include <linux/kdebug.h> 25#include <linux/kdebug.h>
@@ -26,6 +28,7 @@
26#include <asm/mce.h> 28#include <asm/mce.h>
27#include <asm/uaccess.h> 29#include <asm/uaccess.h>
28#include <asm/smp.h> 30#include <asm/smp.h>
31#include <asm/idle.h>
29 32
30#define MISC_MCELOG_MINOR 227 33#define MISC_MCELOG_MINOR 227
31#define NR_BANKS 6 34#define NR_BANKS 6
@@ -34,13 +37,17 @@ atomic_t mce_entry;
34 37
35static int mce_dont_init; 38static int mce_dont_init;
36 39
37/* 0: always panic, 1: panic if deadlock possible, 2: try to avoid panic, 40/*
38 3: never panic or exit (for testing only) */ 41 * Tolerant levels:
42 * 0: always panic on uncorrected errors, log corrected errors
43 * 1: panic or SIGBUS on uncorrected errors, log corrected errors
44 * 2: SIGBUS or log uncorrected errors (if possible), log corrected errors
45 * 3: never panic or SIGBUS, log all errors (for testing only)
46 */
39static int tolerant = 1; 47static int tolerant = 1;
40static int banks; 48static int banks;
41static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL }; 49static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
42static unsigned long console_logged; 50static unsigned long notify_user;
43static int notify_user;
44static int rip_msr; 51static int rip_msr;
45static int mce_bootlog = 1; 52static int mce_bootlog = 1;
46static atomic_t mce_events; 53static atomic_t mce_events;
@@ -48,6 +55,8 @@ static atomic_t mce_events;
48static char trigger[128]; 55static char trigger[128];
49static char *trigger_argv[2] = { trigger, NULL }; 56static char *trigger_argv[2] = { trigger, NULL };
50 57
58static DECLARE_WAIT_QUEUE_HEAD(mce_wait);
59
51/* 60/*
52 * Lockless MCE logging infrastructure. 61 * Lockless MCE logging infrastructure.
53 * This avoids deadlocks on printk locks without having to break locks. Also 62 * This avoids deadlocks on printk locks without having to break locks. Also
@@ -94,8 +103,7 @@ void mce_log(struct mce *mce)
94 mcelog.entry[entry].finished = 1; 103 mcelog.entry[entry].finished = 1;
95 wmb(); 104 wmb();
96 105
97 if (!test_and_set_bit(0, &console_logged)) 106 set_bit(0, &notify_user);
98 notify_user = 1;
99} 107}
100 108
101static void print_mce(struct mce *m) 109static void print_mce(struct mce *m)
@@ -128,6 +136,7 @@ static void print_mce(struct mce *m)
128static void mce_panic(char *msg, struct mce *backup, unsigned long start) 136static void mce_panic(char *msg, struct mce *backup, unsigned long start)
129{ 137{
130 int i; 138 int i;
139
131 oops_begin(); 140 oops_begin();
132 for (i = 0; i < MCE_LOG_LEN; i++) { 141 for (i = 0; i < MCE_LOG_LEN; i++) {
133 unsigned long tsc = mcelog.entry[i].tsc; 142 unsigned long tsc = mcelog.entry[i].tsc;
@@ -139,10 +148,7 @@ static void mce_panic(char *msg, struct mce *backup, unsigned long start)
139 } 148 }
140 if (backup) 149 if (backup)
141 print_mce(backup); 150 print_mce(backup);
142 if (tolerant >= 3) 151 panic(msg);
143 printk("Fake panic: %s\n", msg);
144 else
145 panic(msg);
146} 152}
147 153
148static int mce_available(struct cpuinfo_x86 *c) 154static int mce_available(struct cpuinfo_x86 *c)
@@ -167,17 +173,6 @@ static inline void mce_get_rip(struct mce *m, struct pt_regs *regs)
167 } 173 }
168} 174}
169 175
170static void do_mce_trigger(void)
171{
172 static atomic_t mce_logged;
173 int events = atomic_read(&mce_events);
174 if (events != atomic_read(&mce_logged) && trigger[0]) {
175 /* Small race window, but should be harmless. */
176 atomic_set(&mce_logged, events);
177 call_usermodehelper(trigger, trigger_argv, NULL, UMH_NO_WAIT);
178 }
179}
180
181/* 176/*
182 * The actual machine check handler 177 * The actual machine check handler
183 */ 178 */
@@ -185,11 +180,19 @@ static void do_mce_trigger(void)
185void do_machine_check(struct pt_regs * regs, long error_code) 180void do_machine_check(struct pt_regs * regs, long error_code)
186{ 181{
187 struct mce m, panicm; 182 struct mce m, panicm;
188 int nowayout = (tolerant < 1);
189 int kill_it = 0;
190 u64 mcestart = 0; 183 u64 mcestart = 0;
191 int i; 184 int i;
192 int panicm_found = 0; 185 int panicm_found = 0;
186 /*
187 * If no_way_out gets set, there is no safe way to recover from this
188 * MCE. If tolerant is cranked up, we'll try anyway.
189 */
190 int no_way_out = 0;
191 /*
192 * If kill_it gets set, there might be a way to recover from this
193 * error.
194 */
195 int kill_it = 0;
193 196
194 atomic_inc(&mce_entry); 197 atomic_inc(&mce_entry);
195 198
@@ -201,8 +204,9 @@ void do_machine_check(struct pt_regs * regs, long error_code)
201 memset(&m, 0, sizeof(struct mce)); 204 memset(&m, 0, sizeof(struct mce));
202 m.cpu = smp_processor_id(); 205 m.cpu = smp_processor_id();
203 rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus); 206 rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus);
207 /* if the restart IP is not valid, we're done for */
204 if (!(m.mcgstatus & MCG_STATUS_RIPV)) 208 if (!(m.mcgstatus & MCG_STATUS_RIPV))
205 kill_it = 1; 209 no_way_out = 1;
206 210
207 rdtscll(mcestart); 211 rdtscll(mcestart);
208 barrier(); 212 barrier();
@@ -221,10 +225,18 @@ void do_machine_check(struct pt_regs * regs, long error_code)
221 continue; 225 continue;
222 226
223 if (m.status & MCI_STATUS_EN) { 227 if (m.status & MCI_STATUS_EN) {
224 /* In theory _OVER could be a nowayout too, but 228 /* if PCC was set, there's no way out */
225 assume any overflowed errors were no fatal. */ 229 no_way_out |= !!(m.status & MCI_STATUS_PCC);
226 nowayout |= !!(m.status & MCI_STATUS_PCC); 230 /*
227 kill_it |= !!(m.status & MCI_STATUS_UC); 231 * If this error was uncorrectable and there was
232 * an overflow, we're in trouble. If no overflow,
233 * we might get away with just killing a task.
234 */
235 if (m.status & MCI_STATUS_UC) {
236 if (tolerant < 1 || m.status & MCI_STATUS_OVER)
237 no_way_out = 1;
238 kill_it = 1;
239 }
228 } 240 }
229 241
230 if (m.status & MCI_STATUS_MISCV) 242 if (m.status & MCI_STATUS_MISCV)
@@ -235,7 +247,6 @@ void do_machine_check(struct pt_regs * regs, long error_code)
235 mce_get_rip(&m, regs); 247 mce_get_rip(&m, regs);
236 if (error_code >= 0) 248 if (error_code >= 0)
237 rdtscll(m.tsc); 249 rdtscll(m.tsc);
238 wrmsrl(MSR_IA32_MC0_STATUS + i*4, 0);
239 if (error_code != -2) 250 if (error_code != -2)
240 mce_log(&m); 251 mce_log(&m);
241 252
@@ -251,45 +262,59 @@ void do_machine_check(struct pt_regs * regs, long error_code)
251 } 262 }
252 263
253 /* Never do anything final in the polling timer */ 264 /* Never do anything final in the polling timer */
254 if (!regs) { 265 if (!regs)
255 /* Normal interrupt context here. Call trigger for any new
256 events. */
257 do_mce_trigger();
258 goto out; 266 goto out;
259 }
260 267
261 /* If we didn't find an uncorrectable error, pick 268 /* If we didn't find an uncorrectable error, pick
262 the last one (shouldn't happen, just being safe). */ 269 the last one (shouldn't happen, just being safe). */
263 if (!panicm_found) 270 if (!panicm_found)
264 panicm = m; 271 panicm = m;
265 if (nowayout) 272
273 /*
274 * If we have decided that we just CAN'T continue, and the user
275 * has not set tolerant to an insane level, give up and die.
276 */
277 if (no_way_out && tolerant < 3)
266 mce_panic("Machine check", &panicm, mcestart); 278 mce_panic("Machine check", &panicm, mcestart);
267 if (kill_it) { 279
280 /*
281 * If the error seems to be unrecoverable, something should be
282 * done. Try to kill as little as possible. If we can kill just
283 * one task, do that. If the user has set the tolerance very
284 * high, don't try to do anything at all.
285 */
286 if (kill_it && tolerant < 3) {
268 int user_space = 0; 287 int user_space = 0;
269 288
270 if (m.mcgstatus & MCG_STATUS_RIPV) 289 /*
290 * If the EIPV bit is set, it means the saved IP is the
291 * instruction which caused the MCE.
292 */
293 if (m.mcgstatus & MCG_STATUS_EIPV)
271 user_space = panicm.rip && (panicm.cs & 3); 294 user_space = panicm.rip && (panicm.cs & 3);
272 295
273 /* When the machine was in user space and the CPU didn't get 296 /*
274 confused it's normally not necessary to panic, unless you 297 * If we know that the error was in user space, send a
275 are paranoid (tolerant == 0) 298 * SIGBUS. Otherwise, panic if tolerance is low.
276 299 *
277 RED-PEN could be more tolerant for MCEs in idle, 300 * do_exit() takes an awful lot of locks and has a slight
278 but most likely they occur at boot anyways, where 301 * risk of deadlocking.
279 it is best to just halt the machine. */ 302 */
280 if ((!user_space && (panic_on_oops || tolerant < 2)) || 303 if (user_space) {
281 (unsigned)current->pid <= 1)
282 mce_panic("Uncorrected machine check", &panicm, mcestart);
283
284 /* do_exit takes an awful lot of locks and has as
285 slight risk of deadlocking. If you don't want that
286 don't set tolerant >= 2 */
287 if (tolerant < 3)
288 do_exit(SIGBUS); 304 do_exit(SIGBUS);
305 } else if (panic_on_oops || tolerant < 2) {
306 mce_panic("Uncorrected machine check",
307 &panicm, mcestart);
308 }
289 } 309 }
290 310
311 /* notify userspace ASAP */
312 set_thread_flag(TIF_MCE_NOTIFY);
313
291 out: 314 out:
292 /* Last thing done in the machine check exception to clear state. */ 315 /* the last thing we do is clear state */
316 for (i = 0; i < banks; i++)
317 wrmsrl(MSR_IA32_MC0_STATUS+4*i, 0);
293 wrmsrl(MSR_IA32_MCG_STATUS, 0); 318 wrmsrl(MSR_IA32_MCG_STATUS, 0);
294 out2: 319 out2:
295 atomic_dec(&mce_entry); 320 atomic_dec(&mce_entry);
@@ -344,37 +369,69 @@ static void mcheck_timer(struct work_struct *work)
344 on_each_cpu(mcheck_check_cpu, NULL, 1, 1); 369 on_each_cpu(mcheck_check_cpu, NULL, 1, 1);
345 370
346 /* 371 /*
347 * It's ok to read stale data here for notify_user and 372 * Alert userspace if needed. If we logged an MCE, reduce the
348 * console_logged as we'll simply get the updated versions 373 * polling interval, otherwise increase the polling interval.
349 * on the next mcheck_timer execution and atomic operations
350 * on console_logged act as synchronization for notify_user
351 * writes.
352 */ 374 */
353 if (notify_user && console_logged) { 375 if (mce_notify_user()) {
376 next_interval = max(next_interval/2, HZ/100);
377 } else {
378 next_interval = min(next_interval*2,
379 (int)round_jiffies_relative(check_interval*HZ));
380 }
381
382 schedule_delayed_work(&mcheck_work, next_interval);
383}
384
385/*
386 * This is only called from process context. This is where we do
387 * anything we need to alert userspace about new MCEs. This is called
388 * directly from the poller and also from entry.S and idle, thanks to
389 * TIF_MCE_NOTIFY.
390 */
391int mce_notify_user(void)
392{
393 clear_thread_flag(TIF_MCE_NOTIFY);
394 if (test_and_clear_bit(0, &notify_user)) {
354 static unsigned long last_print; 395 static unsigned long last_print;
355 unsigned long now = jiffies; 396 unsigned long now = jiffies;
356 397
357 /* if we logged an MCE, reduce the polling interval */ 398 wake_up_interruptible(&mce_wait);
358 next_interval = max(next_interval/2, HZ/100); 399 if (trigger[0])
359 notify_user = 0; 400 call_usermodehelper(trigger, trigger_argv, NULL,
360 clear_bit(0, &console_logged); 401 UMH_NO_WAIT);
402
361 if (time_after_eq(now, last_print + (check_interval*HZ))) { 403 if (time_after_eq(now, last_print + (check_interval*HZ))) {
362 last_print = now; 404 last_print = now;
363 printk(KERN_INFO "Machine check events logged\n"); 405 printk(KERN_INFO "Machine check events logged\n");
364 } 406 }
365 } else { 407
366 next_interval = min(next_interval*2, check_interval*HZ); 408 return 1;
367 } 409 }
410 return 0;
411}
368 412
369 schedule_delayed_work(&mcheck_work, next_interval); 413/* see if the idle task needs to notify userspace */
414static int
415mce_idle_callback(struct notifier_block *nfb, unsigned long action, void *junk)
416{
417 /* IDLE_END should be safe - interrupts are back on */
418 if (action == IDLE_END && test_thread_flag(TIF_MCE_NOTIFY))
419 mce_notify_user();
420
421 return NOTIFY_OK;
370} 422}
371 423
424static struct notifier_block mce_idle_notifier = {
425 .notifier_call = mce_idle_callback,
426};
372 427
373static __init int periodic_mcheck_init(void) 428static __init int periodic_mcheck_init(void)
374{ 429{
375 next_interval = check_interval * HZ; 430 next_interval = check_interval * HZ;
376 if (next_interval) 431 if (next_interval)
377 schedule_delayed_work(&mcheck_work, next_interval); 432 schedule_delayed_work(&mcheck_work,
433 round_jiffies_relative(next_interval));
434 idle_notifier_register(&mce_idle_notifier);
378 return 0; 435 return 0;
379} 436}
380__initcall(periodic_mcheck_init); 437__initcall(periodic_mcheck_init);
@@ -465,6 +522,40 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
465 * Character device to read and clear the MCE log. 522 * Character device to read and clear the MCE log.
466 */ 523 */
467 524
525static DEFINE_SPINLOCK(mce_state_lock);
526static int open_count; /* #times opened */
527static int open_exclu; /* already open exclusive? */
528
529static int mce_open(struct inode *inode, struct file *file)
530{
531 spin_lock(&mce_state_lock);
532
533 if (open_exclu || (open_count && (file->f_flags & O_EXCL))) {
534 spin_unlock(&mce_state_lock);
535 return -EBUSY;
536 }
537
538 if (file->f_flags & O_EXCL)
539 open_exclu = 1;
540 open_count++;
541
542 spin_unlock(&mce_state_lock);
543
544 return nonseekable_open(inode, file);
545}
546
547static int mce_release(struct inode *inode, struct file *file)
548{
549 spin_lock(&mce_state_lock);
550
551 open_count--;
552 open_exclu = 0;
553
554 spin_unlock(&mce_state_lock);
555
556 return 0;
557}
558
468static void collect_tscs(void *data) 559static void collect_tscs(void *data)
469{ 560{
470 unsigned long *cpu_tsc = (unsigned long *)data; 561 unsigned long *cpu_tsc = (unsigned long *)data;
@@ -532,6 +623,14 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff
532 return err ? -EFAULT : buf - ubuf; 623 return err ? -EFAULT : buf - ubuf;
533} 624}
534 625
626static unsigned int mce_poll(struct file *file, poll_table *wait)
627{
628 poll_wait(file, &mce_wait, wait);
629 if (rcu_dereference(mcelog.next))
630 return POLLIN | POLLRDNORM;
631 return 0;
632}
633
535static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned long arg) 634static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned long arg)
536{ 635{
537 int __user *p = (int __user *)arg; 636 int __user *p = (int __user *)arg;
@@ -555,7 +654,10 @@ static int mce_ioctl(struct inode *i, struct file *f,unsigned int cmd, unsigned
555} 654}
556 655
557static const struct file_operations mce_chrdev_ops = { 656static const struct file_operations mce_chrdev_ops = {
657 .open = mce_open,
658 .release = mce_release,
558 .read = mce_read, 659 .read = mce_read,
660 .poll = mce_poll,
559 .ioctl = mce_ioctl, 661 .ioctl = mce_ioctl,
560}; 662};
561 663
@@ -620,7 +722,8 @@ static void mce_restart(void)
620 on_each_cpu(mce_init, NULL, 1, 1); 722 on_each_cpu(mce_init, NULL, 1, 1);
621 next_interval = check_interval * HZ; 723 next_interval = check_interval * HZ;
622 if (next_interval) 724 if (next_interval)
623 schedule_delayed_work(&mcheck_work, next_interval); 725 schedule_delayed_work(&mcheck_work,
726 round_jiffies_relative(next_interval));
624} 727}
625 728
626static struct sysdev_class mce_sysclass = { 729static struct sysdev_class mce_sysclass = {
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c
index 03356e64f9c8..2f8a7f18b0fe 100644
--- a/arch/x86_64/kernel/mce_amd.c
+++ b/arch/x86_64/kernel/mce_amd.c
@@ -157,9 +157,9 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
157 high |= K8_APIC_EXT_LVT_ENTRY_THRESHOLD << 20; 157 high |= K8_APIC_EXT_LVT_ENTRY_THRESHOLD << 20;
158 wrmsr(address, low, high); 158 wrmsr(address, low, high);
159 159
160 setup_APIC_extened_lvt(K8_APIC_EXT_LVT_ENTRY_THRESHOLD, 160 setup_APIC_extended_lvt(K8_APIC_EXT_LVT_ENTRY_THRESHOLD,
161 THRESHOLD_APIC_VECTOR, 161 THRESHOLD_APIC_VECTOR,
162 K8_APIC_EXT_INT_MSG_FIX, 0); 162 K8_APIC_EXT_INT_MSG_FIX, 0);
163 163
164 threshold_defaults.address = address; 164 threshold_defaults.address = address;
165 threshold_restart_bank(&threshold_defaults, 0, 0); 165 threshold_restart_bank(&threshold_defaults, 0, 0);
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 61ae57eb9e4c..8bf0ca03ac8e 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -32,7 +32,6 @@
32 32
33/* Have we found an MP table */ 33/* Have we found an MP table */
34int smp_found_config; 34int smp_found_config;
35unsigned int __initdata maxcpus = NR_CPUS;
36 35
37/* 36/*
38 * Various Linux-internal data structures created from the 37 * Various Linux-internal data structures created from the
@@ -649,6 +648,20 @@ static int mp_find_ioapic(int gsi)
649 return -1; 648 return -1;
650} 649}
651 650
651static u8 uniq_ioapic_id(u8 id)
652{
653 int i;
654 DECLARE_BITMAP(used, 256);
655 bitmap_zero(used, 256);
656 for (i = 0; i < nr_ioapics; i++) {
657 struct mpc_config_ioapic *ia = &mp_ioapics[i];
658 __set_bit(ia->mpc_apicid, used);
659 }
660 if (!test_bit(id, used))
661 return id;
662 return find_first_zero_bit(used, 256);
663}
664
652void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base) 665void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
653{ 666{
654 int idx = 0; 667 int idx = 0;
@@ -656,14 +669,14 @@ void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
656 if (bad_ioapic(address)) 669 if (bad_ioapic(address))
657 return; 670 return;
658 671
659 idx = nr_ioapics++; 672 idx = nr_ioapics;
660 673
661 mp_ioapics[idx].mpc_type = MP_IOAPIC; 674 mp_ioapics[idx].mpc_type = MP_IOAPIC;
662 mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE; 675 mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE;
663 mp_ioapics[idx].mpc_apicaddr = address; 676 mp_ioapics[idx].mpc_apicaddr = address;
664 677
665 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); 678 set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
666 mp_ioapics[idx].mpc_apicid = id; 679 mp_ioapics[idx].mpc_apicid = uniq_ioapic_id(id);
667 mp_ioapics[idx].mpc_apicver = 0; 680 mp_ioapics[idx].mpc_apicver = 0;
668 681
669 /* 682 /*
@@ -680,6 +693,8 @@ void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
680 mp_ioapics[idx].mpc_apicaddr, 693 mp_ioapics[idx].mpc_apicaddr,
681 mp_ioapic_routing[idx].gsi_start, 694 mp_ioapic_routing[idx].gsi_start,
682 mp_ioapic_routing[idx].gsi_end); 695 mp_ioapic_routing[idx].gsi_end);
696
697 nr_ioapics++;
683} 698}
684 699
685void __init 700void __init
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c
index 5bd20b542c1e..ba16c968ca3f 100644
--- a/arch/x86_64/kernel/pci-calgary.c
+++ b/arch/x86_64/kernel/pci-calgary.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Derived from arch/powerpc/kernel/iommu.c 2 * Derived from arch/powerpc/kernel/iommu.c
3 * 3 *
4 * Copyright (C) IBM Corporation, 2006 4 * Copyright IBM Corporation, 2006-2007
5 * Copyright (C) 2006 Jon Mason <jdmason@kudzu.us> 5 * Copyright (C) 2006 Jon Mason <jdmason@kudzu.us>
6 * 6 *
7 * Author: Jon Mason <jdmason@kudzu.us> 7 * Author: Jon Mason <jdmason@kudzu.us>
@@ -35,7 +35,7 @@
35#include <linux/pci_ids.h> 35#include <linux/pci_ids.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <asm/proto.h> 38#include <asm/iommu.h>
39#include <asm/calgary.h> 39#include <asm/calgary.h>
40#include <asm/tce.h> 40#include <asm/tce.h>
41#include <asm/pci-direct.h> 41#include <asm/pci-direct.h>
@@ -50,13 +50,7 @@ int use_calgary __read_mostly = 0;
50#endif /* CONFIG_CALGARY_DEFAULT_ENABLED */ 50#endif /* CONFIG_CALGARY_DEFAULT_ENABLED */
51 51
52#define PCI_DEVICE_ID_IBM_CALGARY 0x02a1 52#define PCI_DEVICE_ID_IBM_CALGARY 0x02a1
53#define PCI_VENDOR_DEVICE_ID_CALGARY \ 53#define PCI_DEVICE_ID_IBM_CALIOC2 0x0308
54 (PCI_VENDOR_ID_IBM | PCI_DEVICE_ID_IBM_CALGARY << 16)
55
56/* we need these for register space address calculation */
57#define START_ADDRESS 0xfe000000
58#define CHASSIS_BASE 0
59#define ONE_BASED_CHASSIS_NUM 1
60 54
61/* register offsets inside the host bridge space */ 55/* register offsets inside the host bridge space */
62#define CALGARY_CONFIG_REG 0x0108 56#define CALGARY_CONFIG_REG 0x0108
@@ -80,6 +74,12 @@ int use_calgary __read_mostly = 0;
80#define PHB_MEM_2_SIZE_LOW 0x02E0 74#define PHB_MEM_2_SIZE_LOW 0x02E0
81#define PHB_DOSHOLE_OFFSET 0x08E0 75#define PHB_DOSHOLE_OFFSET 0x08E0
82 76
77/* CalIOC2 specific */
78#define PHB_SAVIOR_L2 0x0DB0
79#define PHB_PAGE_MIG_CTRL 0x0DA8
80#define PHB_PAGE_MIG_DEBUG 0x0DA0
81#define PHB_ROOT_COMPLEX_STATUS 0x0CB0
82
83/* PHB_CONFIG_RW */ 83/* PHB_CONFIG_RW */
84#define PHB_TCE_ENABLE 0x20000000 84#define PHB_TCE_ENABLE 0x20000000
85#define PHB_SLOT_DISABLE 0x1C000000 85#define PHB_SLOT_DISABLE 0x1C000000
@@ -92,7 +92,11 @@ int use_calgary __read_mostly = 0;
92/* CSR (Channel/DMA Status Register) */ 92/* CSR (Channel/DMA Status Register) */
93#define CSR_AGENT_MASK 0xffe0ffff 93#define CSR_AGENT_MASK 0xffe0ffff
94/* CCR (Calgary Configuration Register) */ 94/* CCR (Calgary Configuration Register) */
95#define CCR_2SEC_TIMEOUT 0x000000000000000EUL 95#define CCR_2SEC_TIMEOUT 0x000000000000000EUL
96/* PMCR/PMDR (Page Migration Control/Debug Registers */
97#define PMR_SOFTSTOP 0x80000000
98#define PMR_SOFTSTOPFAULT 0x40000000
99#define PMR_HARDSTOP 0x20000000
96 100
97#define MAX_NUM_OF_PHBS 8 /* how many PHBs in total? */ 101#define MAX_NUM_OF_PHBS 8 /* how many PHBs in total? */
98#define MAX_NUM_CHASSIS 8 /* max number of chassis */ 102#define MAX_NUM_CHASSIS 8 /* max number of chassis */
@@ -155,9 +159,26 @@ struct calgary_bus_info {
155 void __iomem *bbar; 159 void __iomem *bbar;
156}; 160};
157 161
158static struct calgary_bus_info bus_info[MAX_PHB_BUS_NUM] = { { NULL, 0, 0 }, }; 162static void calgary_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev);
163static void calgary_tce_cache_blast(struct iommu_table *tbl);
164static void calgary_dump_error_regs(struct iommu_table *tbl);
165static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev);
166static void calioc2_tce_cache_blast(struct iommu_table *tbl);
167static void calioc2_dump_error_regs(struct iommu_table *tbl);
168
169static struct cal_chipset_ops calgary_chip_ops = {
170 .handle_quirks = calgary_handle_quirks,
171 .tce_cache_blast = calgary_tce_cache_blast,
172 .dump_error_regs = calgary_dump_error_regs
173};
159 174
160static void tce_cache_blast(struct iommu_table *tbl); 175static struct cal_chipset_ops calioc2_chip_ops = {
176 .handle_quirks = calioc2_handle_quirks,
177 .tce_cache_blast = calioc2_tce_cache_blast,
178 .dump_error_regs = calioc2_dump_error_regs
179};
180
181static struct calgary_bus_info bus_info[MAX_PHB_BUS_NUM] = { { NULL, 0, 0 }, };
161 182
162/* enable this to stress test the chip's TCE cache */ 183/* enable this to stress test the chip's TCE cache */
163#ifdef CONFIG_IOMMU_DEBUG 184#ifdef CONFIG_IOMMU_DEBUG
@@ -187,6 +208,7 @@ static inline unsigned long verify_bit_range(unsigned long* bitmap,
187{ 208{
188 return ~0UL; 209 return ~0UL;
189} 210}
211
190#endif /* CONFIG_IOMMU_DEBUG */ 212#endif /* CONFIG_IOMMU_DEBUG */
191 213
192static inline unsigned int num_dma_pages(unsigned long dma, unsigned int dmalen) 214static inline unsigned int num_dma_pages(unsigned long dma, unsigned int dmalen)
@@ -206,11 +228,12 @@ static inline int translate_phb(struct pci_dev* dev)
206} 228}
207 229
208static void iommu_range_reserve(struct iommu_table *tbl, 230static void iommu_range_reserve(struct iommu_table *tbl,
209 unsigned long start_addr, unsigned int npages) 231 unsigned long start_addr, unsigned int npages)
210{ 232{
211 unsigned long index; 233 unsigned long index;
212 unsigned long end; 234 unsigned long end;
213 unsigned long badbit; 235 unsigned long badbit;
236 unsigned long flags;
214 237
215 index = start_addr >> PAGE_SHIFT; 238 index = start_addr >> PAGE_SHIFT;
216 239
@@ -222,6 +245,8 @@ static void iommu_range_reserve(struct iommu_table *tbl,
222 if (end > tbl->it_size) /* don't go off the table */ 245 if (end > tbl->it_size) /* don't go off the table */
223 end = tbl->it_size; 246 end = tbl->it_size;
224 247
248 spin_lock_irqsave(&tbl->it_lock, flags);
249
225 badbit = verify_bit_range(tbl->it_map, 0, index, end); 250 badbit = verify_bit_range(tbl->it_map, 0, index, end);
226 if (badbit != ~0UL) { 251 if (badbit != ~0UL) {
227 if (printk_ratelimit()) 252 if (printk_ratelimit())
@@ -231,23 +256,29 @@ static void iommu_range_reserve(struct iommu_table *tbl,
231 } 256 }
232 257
233 set_bit_string(tbl->it_map, index, npages); 258 set_bit_string(tbl->it_map, index, npages);
259
260 spin_unlock_irqrestore(&tbl->it_lock, flags);
234} 261}
235 262
236static unsigned long iommu_range_alloc(struct iommu_table *tbl, 263static unsigned long iommu_range_alloc(struct iommu_table *tbl,
237 unsigned int npages) 264 unsigned int npages)
238{ 265{
266 unsigned long flags;
239 unsigned long offset; 267 unsigned long offset;
240 268
241 BUG_ON(npages == 0); 269 BUG_ON(npages == 0);
242 270
271 spin_lock_irqsave(&tbl->it_lock, flags);
272
243 offset = find_next_zero_string(tbl->it_map, tbl->it_hint, 273 offset = find_next_zero_string(tbl->it_map, tbl->it_hint,
244 tbl->it_size, npages); 274 tbl->it_size, npages);
245 if (offset == ~0UL) { 275 if (offset == ~0UL) {
246 tce_cache_blast(tbl); 276 tbl->chip_ops->tce_cache_blast(tbl);
247 offset = find_next_zero_string(tbl->it_map, 0, 277 offset = find_next_zero_string(tbl->it_map, 0,
248 tbl->it_size, npages); 278 tbl->it_size, npages);
249 if (offset == ~0UL) { 279 if (offset == ~0UL) {
250 printk(KERN_WARNING "Calgary: IOMMU full.\n"); 280 printk(KERN_WARNING "Calgary: IOMMU full.\n");
281 spin_unlock_irqrestore(&tbl->it_lock, flags);
251 if (panic_on_overflow) 282 if (panic_on_overflow)
252 panic("Calgary: fix the allocator.\n"); 283 panic("Calgary: fix the allocator.\n");
253 else 284 else
@@ -259,17 +290,17 @@ static unsigned long iommu_range_alloc(struct iommu_table *tbl,
259 tbl->it_hint = offset + npages; 290 tbl->it_hint = offset + npages;
260 BUG_ON(tbl->it_hint > tbl->it_size); 291 BUG_ON(tbl->it_hint > tbl->it_size);
261 292
293 spin_unlock_irqrestore(&tbl->it_lock, flags);
294
262 return offset; 295 return offset;
263} 296}
264 297
265static dma_addr_t iommu_alloc(struct iommu_table *tbl, void *vaddr, 298static dma_addr_t iommu_alloc(struct iommu_table *tbl, void *vaddr,
266 unsigned int npages, int direction) 299 unsigned int npages, int direction)
267{ 300{
268 unsigned long entry, flags; 301 unsigned long entry;
269 dma_addr_t ret = bad_dma_address; 302 dma_addr_t ret = bad_dma_address;
270 303
271 spin_lock_irqsave(&tbl->it_lock, flags);
272
273 entry = iommu_range_alloc(tbl, npages); 304 entry = iommu_range_alloc(tbl, npages);
274 305
275 if (unlikely(entry == bad_dma_address)) 306 if (unlikely(entry == bad_dma_address))
@@ -282,23 +313,21 @@ static dma_addr_t iommu_alloc(struct iommu_table *tbl, void *vaddr,
282 tce_build(tbl, entry, npages, (unsigned long)vaddr & PAGE_MASK, 313 tce_build(tbl, entry, npages, (unsigned long)vaddr & PAGE_MASK,
283 direction); 314 direction);
284 315
285 spin_unlock_irqrestore(&tbl->it_lock, flags);
286
287 return ret; 316 return ret;
288 317
289error: 318error:
290 spin_unlock_irqrestore(&tbl->it_lock, flags);
291 printk(KERN_WARNING "Calgary: failed to allocate %u pages in " 319 printk(KERN_WARNING "Calgary: failed to allocate %u pages in "
292 "iommu %p\n", npages, tbl); 320 "iommu %p\n", npages, tbl);
293 return bad_dma_address; 321 return bad_dma_address;
294} 322}
295 323
296static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, 324static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
297 unsigned int npages) 325 unsigned int npages)
298{ 326{
299 unsigned long entry; 327 unsigned long entry;
300 unsigned long badbit; 328 unsigned long badbit;
301 unsigned long badend; 329 unsigned long badend;
330 unsigned long flags;
302 331
303 /* were we called with bad_dma_address? */ 332 /* were we called with bad_dma_address? */
304 badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE); 333 badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE);
@@ -315,6 +344,8 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
315 344
316 tce_free(tbl, entry, npages); 345 tce_free(tbl, entry, npages);
317 346
347 spin_lock_irqsave(&tbl->it_lock, flags);
348
318 badbit = verify_bit_range(tbl->it_map, 1, entry, entry + npages); 349 badbit = verify_bit_range(tbl->it_map, 1, entry, entry + npages);
319 if (badbit != ~0UL) { 350 if (badbit != ~0UL) {
320 if (printk_ratelimit()) 351 if (printk_ratelimit())
@@ -324,23 +355,40 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
324 } 355 }
325 356
326 __clear_bit_string(tbl->it_map, entry, npages); 357 __clear_bit_string(tbl->it_map, entry, npages);
358
359 spin_unlock_irqrestore(&tbl->it_lock, flags);
327} 360}
328 361
329static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, 362static inline struct iommu_table *find_iommu_table(struct device *dev)
330 unsigned int npages)
331{ 363{
332 unsigned long flags; 364 struct pci_dev *pdev;
365 struct pci_bus *pbus;
366 struct iommu_table *tbl;
333 367
334 spin_lock_irqsave(&tbl->it_lock, flags); 368 pdev = to_pci_dev(dev);
335 369
336 __iommu_free(tbl, dma_addr, npages); 370 /* is the device behind a bridge? */
371 if (unlikely(pdev->bus->parent))
372 pbus = pdev->bus->parent;
373 else
374 pbus = pdev->bus;
337 375
338 spin_unlock_irqrestore(&tbl->it_lock, flags); 376 tbl = pci_iommu(pbus);
377
378 BUG_ON(pdev->bus->parent &&
379 (tbl->it_busno != pdev->bus->parent->number));
380
381 return tbl;
339} 382}
340 383
341static void __calgary_unmap_sg(struct iommu_table *tbl, 384static void calgary_unmap_sg(struct device *dev,
342 struct scatterlist *sglist, int nelems, int direction) 385 struct scatterlist *sglist, int nelems, int direction)
343{ 386{
387 struct iommu_table *tbl = find_iommu_table(dev);
388
389 if (!translate_phb(to_pci_dev(dev)))
390 return;
391
344 while (nelems--) { 392 while (nelems--) {
345 unsigned int npages; 393 unsigned int npages;
346 dma_addr_t dma = sglist->dma_address; 394 dma_addr_t dma = sglist->dma_address;
@@ -350,33 +398,17 @@ static void __calgary_unmap_sg(struct iommu_table *tbl,
350 break; 398 break;
351 399
352 npages = num_dma_pages(dma, dmalen); 400 npages = num_dma_pages(dma, dmalen);
353 __iommu_free(tbl, dma, npages); 401 iommu_free(tbl, dma, npages);
354 sglist++; 402 sglist++;
355 } 403 }
356} 404}
357 405
358void calgary_unmap_sg(struct device *dev, struct scatterlist *sglist,
359 int nelems, int direction)
360{
361 unsigned long flags;
362 struct iommu_table *tbl = to_pci_dev(dev)->bus->self->sysdata;
363
364 if (!translate_phb(to_pci_dev(dev)))
365 return;
366
367 spin_lock_irqsave(&tbl->it_lock, flags);
368
369 __calgary_unmap_sg(tbl, sglist, nelems, direction);
370
371 spin_unlock_irqrestore(&tbl->it_lock, flags);
372}
373
374static int calgary_nontranslate_map_sg(struct device* dev, 406static int calgary_nontranslate_map_sg(struct device* dev,
375 struct scatterlist *sg, int nelems, int direction) 407 struct scatterlist *sg, int nelems, int direction)
376{ 408{
377 int i; 409 int i;
378 410
379 for (i = 0; i < nelems; i++ ) { 411 for (i = 0; i < nelems; i++ ) {
380 struct scatterlist *s = &sg[i]; 412 struct scatterlist *s = &sg[i];
381 BUG_ON(!s->page); 413 BUG_ON(!s->page);
382 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 414 s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
@@ -385,11 +417,10 @@ static int calgary_nontranslate_map_sg(struct device* dev,
385 return nelems; 417 return nelems;
386} 418}
387 419
388int calgary_map_sg(struct device *dev, struct scatterlist *sg, 420static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
389 int nelems, int direction) 421 int nelems, int direction)
390{ 422{
391 struct iommu_table *tbl = to_pci_dev(dev)->bus->self->sysdata; 423 struct iommu_table *tbl = find_iommu_table(dev);
392 unsigned long flags;
393 unsigned long vaddr; 424 unsigned long vaddr;
394 unsigned int npages; 425 unsigned int npages;
395 unsigned long entry; 426 unsigned long entry;
@@ -398,8 +429,6 @@ int calgary_map_sg(struct device *dev, struct scatterlist *sg,
398 if (!translate_phb(to_pci_dev(dev))) 429 if (!translate_phb(to_pci_dev(dev)))
399 return calgary_nontranslate_map_sg(dev, sg, nelems, direction); 430 return calgary_nontranslate_map_sg(dev, sg, nelems, direction);
400 431
401 spin_lock_irqsave(&tbl->it_lock, flags);
402
403 for (i = 0; i < nelems; i++ ) { 432 for (i = 0; i < nelems; i++ ) {
404 struct scatterlist *s = &sg[i]; 433 struct scatterlist *s = &sg[i];
405 BUG_ON(!s->page); 434 BUG_ON(!s->page);
@@ -423,26 +452,23 @@ int calgary_map_sg(struct device *dev, struct scatterlist *sg,
423 s->dma_length = s->length; 452 s->dma_length = s->length;
424 } 453 }
425 454
426 spin_unlock_irqrestore(&tbl->it_lock, flags);
427
428 return nelems; 455 return nelems;
429error: 456error:
430 __calgary_unmap_sg(tbl, sg, nelems, direction); 457 calgary_unmap_sg(dev, sg, nelems, direction);
431 for (i = 0; i < nelems; i++) { 458 for (i = 0; i < nelems; i++) {
432 sg[i].dma_address = bad_dma_address; 459 sg[i].dma_address = bad_dma_address;
433 sg[i].dma_length = 0; 460 sg[i].dma_length = 0;
434 } 461 }
435 spin_unlock_irqrestore(&tbl->it_lock, flags);
436 return 0; 462 return 0;
437} 463}
438 464
439dma_addr_t calgary_map_single(struct device *dev, void *vaddr, 465static dma_addr_t calgary_map_single(struct device *dev, void *vaddr,
440 size_t size, int direction) 466 size_t size, int direction)
441{ 467{
442 dma_addr_t dma_handle = bad_dma_address; 468 dma_addr_t dma_handle = bad_dma_address;
443 unsigned long uaddr; 469 unsigned long uaddr;
444 unsigned int npages; 470 unsigned int npages;
445 struct iommu_table *tbl = to_pci_dev(dev)->bus->self->sysdata; 471 struct iommu_table *tbl = find_iommu_table(dev);
446 472
447 uaddr = (unsigned long)vaddr; 473 uaddr = (unsigned long)vaddr;
448 npages = num_dma_pages(uaddr, size); 474 npages = num_dma_pages(uaddr, size);
@@ -455,10 +481,10 @@ dma_addr_t calgary_map_single(struct device *dev, void *vaddr,
455 return dma_handle; 481 return dma_handle;
456} 482}
457 483
458void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle, 484static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
459 size_t size, int direction) 485 size_t size, int direction)
460{ 486{
461 struct iommu_table *tbl = to_pci_dev(dev)->bus->self->sysdata; 487 struct iommu_table *tbl = find_iommu_table(dev);
462 unsigned int npages; 488 unsigned int npages;
463 489
464 if (!translate_phb(to_pci_dev(dev))) 490 if (!translate_phb(to_pci_dev(dev)))
@@ -468,15 +494,13 @@ void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
468 iommu_free(tbl, dma_handle, npages); 494 iommu_free(tbl, dma_handle, npages);
469} 495}
470 496
471void* calgary_alloc_coherent(struct device *dev, size_t size, 497static void* calgary_alloc_coherent(struct device *dev, size_t size,
472 dma_addr_t *dma_handle, gfp_t flag) 498 dma_addr_t *dma_handle, gfp_t flag)
473{ 499{
474 void *ret = NULL; 500 void *ret = NULL;
475 dma_addr_t mapping; 501 dma_addr_t mapping;
476 unsigned int npages, order; 502 unsigned int npages, order;
477 struct iommu_table *tbl; 503 struct iommu_table *tbl = find_iommu_table(dev);
478
479 tbl = to_pci_dev(dev)->bus->self->sysdata;
480 504
481 size = PAGE_ALIGN(size); /* size rounded up to full pages */ 505 size = PAGE_ALIGN(size); /* size rounded up to full pages */
482 npages = size >> PAGE_SHIFT; 506 npages = size >> PAGE_SHIFT;
@@ -552,7 +576,22 @@ static inline void __iomem* calgary_reg(void __iomem *bar, unsigned long offset)
552 return (void __iomem*)target; 576 return (void __iomem*)target;
553} 577}
554 578
555static void tce_cache_blast(struct iommu_table *tbl) 579static inline int is_calioc2(unsigned short device)
580{
581 return (device == PCI_DEVICE_ID_IBM_CALIOC2);
582}
583
584static inline int is_calgary(unsigned short device)
585{
586 return (device == PCI_DEVICE_ID_IBM_CALGARY);
587}
588
589static inline int is_cal_pci_dev(unsigned short device)
590{
591 return (is_calgary(device) || is_calioc2(device));
592}
593
594static void calgary_tce_cache_blast(struct iommu_table *tbl)
556{ 595{
557 u64 val; 596 u64 val;
558 u32 aer; 597 u32 aer;
@@ -589,6 +628,85 @@ static void tce_cache_blast(struct iommu_table *tbl)
589 (void)readl(target); /* flush */ 628 (void)readl(target); /* flush */
590} 629}
591 630
631static void calioc2_tce_cache_blast(struct iommu_table *tbl)
632{
633 void __iomem *bbar = tbl->bbar;
634 void __iomem *target;
635 u64 val64;
636 u32 val;
637 int i = 0;
638 int count = 1;
639 unsigned char bus = tbl->it_busno;
640
641begin:
642 printk(KERN_DEBUG "Calgary: CalIOC2 bus 0x%x entering tce cache blast "
643 "sequence - count %d\n", bus, count);
644
645 /* 1. using the Page Migration Control reg set SoftStop */
646 target = calgary_reg(bbar, phb_offset(bus) | PHB_PAGE_MIG_CTRL);
647 val = be32_to_cpu(readl(target));
648 printk(KERN_DEBUG "1a. read 0x%x [LE] from %p\n", val, target);
649 val |= PMR_SOFTSTOP;
650 printk(KERN_DEBUG "1b. writing 0x%x [LE] to %p\n", val, target);
651 writel(cpu_to_be32(val), target);
652
653 /* 2. poll split queues until all DMA activity is done */
654 printk(KERN_DEBUG "2a. starting to poll split queues\n");
655 target = calgary_reg(bbar, split_queue_offset(bus));
656 do {
657 val64 = readq(target);
658 i++;
659 } while ((val64 & 0xff) != 0xff && i < 100);
660 if (i == 100)
661 printk(KERN_WARNING "CalIOC2: PCI bus not quiesced, "
662 "continuing anyway\n");
663
664 /* 3. poll Page Migration DEBUG for SoftStopFault */
665 target = calgary_reg(bbar, phb_offset(bus) | PHB_PAGE_MIG_DEBUG);
666 val = be32_to_cpu(readl(target));
667 printk(KERN_DEBUG "3. read 0x%x [LE] from %p\n", val, target);
668
669 /* 4. if SoftStopFault - goto (1) */
670 if (val & PMR_SOFTSTOPFAULT) {
671 if (++count < 100)
672 goto begin;
673 else {
674 printk(KERN_WARNING "CalIOC2: too many SoftStopFaults, "
675 "aborting TCE cache flush sequence!\n");
676 return; /* pray for the best */
677 }
678 }
679
680 /* 5. Slam into HardStop by reading PHB_PAGE_MIG_CTRL */
681 target = calgary_reg(bbar, phb_offset(bus) | PHB_PAGE_MIG_CTRL);
682 printk(KERN_DEBUG "5a. slamming into HardStop by reading %p\n", target);
683 val = be32_to_cpu(readl(target));
684 printk(KERN_DEBUG "5b. read 0x%x [LE] from %p\n", val, target);
685 target = calgary_reg(bbar, phb_offset(bus) | PHB_PAGE_MIG_DEBUG);
686 val = be32_to_cpu(readl(target));
687 printk(KERN_DEBUG "5c. read 0x%x [LE] from %p (debug)\n", val, target);
688
689 /* 6. invalidate TCE cache */
690 printk(KERN_DEBUG "6. invalidating TCE cache\n");
691 target = calgary_reg(bbar, tar_offset(bus));
692 writeq(tbl->tar_val, target);
693
694 /* 7. Re-read PMCR */
695 printk(KERN_DEBUG "7a. Re-reading PMCR\n");
696 target = calgary_reg(bbar, phb_offset(bus) | PHB_PAGE_MIG_CTRL);
697 val = be32_to_cpu(readl(target));
698 printk(KERN_DEBUG "7b. read 0x%x [LE] from %p\n", val, target);
699
700 /* 8. Remove HardStop */
701 printk(KERN_DEBUG "8a. removing HardStop from PMCR\n");
702 target = calgary_reg(bbar, phb_offset(bus) | PHB_PAGE_MIG_CTRL);
703 val = 0;
704 printk(KERN_DEBUG "8b. writing 0x%x [LE] to %p\n", val, target);
705 writel(cpu_to_be32(val), target);
706 val = be32_to_cpu(readl(target));
707 printk(KERN_DEBUG "8c. read 0x%x [LE] from %p\n", val, target);
708}
709
592static void __init calgary_reserve_mem_region(struct pci_dev *dev, u64 start, 710static void __init calgary_reserve_mem_region(struct pci_dev *dev, u64 start,
593 u64 limit) 711 u64 limit)
594{ 712{
@@ -598,7 +716,7 @@ static void __init calgary_reserve_mem_region(struct pci_dev *dev, u64 start,
598 limit++; 716 limit++;
599 717
600 numpages = ((limit - start) >> PAGE_SHIFT); 718 numpages = ((limit - start) >> PAGE_SHIFT);
601 iommu_range_reserve(dev->sysdata, start, numpages); 719 iommu_range_reserve(pci_iommu(dev->bus), start, numpages);
602} 720}
603 721
604static void __init calgary_reserve_peripheral_mem_1(struct pci_dev *dev) 722static void __init calgary_reserve_peripheral_mem_1(struct pci_dev *dev)
@@ -606,7 +724,7 @@ static void __init calgary_reserve_peripheral_mem_1(struct pci_dev *dev)
606 void __iomem *target; 724 void __iomem *target;
607 u64 low, high, sizelow; 725 u64 low, high, sizelow;
608 u64 start, limit; 726 u64 start, limit;
609 struct iommu_table *tbl = dev->sysdata; 727 struct iommu_table *tbl = pci_iommu(dev->bus);
610 unsigned char busnum = dev->bus->number; 728 unsigned char busnum = dev->bus->number;
611 void __iomem *bbar = tbl->bbar; 729 void __iomem *bbar = tbl->bbar;
612 730
@@ -630,7 +748,7 @@ static void __init calgary_reserve_peripheral_mem_2(struct pci_dev *dev)
630 u32 val32; 748 u32 val32;
631 u64 low, high, sizelow, sizehigh; 749 u64 low, high, sizelow, sizehigh;
632 u64 start, limit; 750 u64 start, limit;
633 struct iommu_table *tbl = dev->sysdata; 751 struct iommu_table *tbl = pci_iommu(dev->bus);
634 unsigned char busnum = dev->bus->number; 752 unsigned char busnum = dev->bus->number;
635 void __iomem *bbar = tbl->bbar; 753 void __iomem *bbar = tbl->bbar;
636 754
@@ -666,14 +784,20 @@ static void __init calgary_reserve_regions(struct pci_dev *dev)
666{ 784{
667 unsigned int npages; 785 unsigned int npages;
668 u64 start; 786 u64 start;
669 struct iommu_table *tbl = dev->sysdata; 787 struct iommu_table *tbl = pci_iommu(dev->bus);
670 788
671 /* reserve EMERGENCY_PAGES from bad_dma_address and up */ 789 /* reserve EMERGENCY_PAGES from bad_dma_address and up */
672 iommu_range_reserve(tbl, bad_dma_address, EMERGENCY_PAGES); 790 iommu_range_reserve(tbl, bad_dma_address, EMERGENCY_PAGES);
673 791
674 /* avoid the BIOS/VGA first 640KB-1MB region */ 792 /* avoid the BIOS/VGA first 640KB-1MB region */
675 start = (640 * 1024); 793 /* for CalIOC2 - avoid the entire first MB */
676 npages = ((1024 - 640) * 1024) >> PAGE_SHIFT; 794 if (is_calgary(dev->device)) {
795 start = (640 * 1024);
796 npages = ((1024 - 640) * 1024) >> PAGE_SHIFT;
797 } else { /* calioc2 */
798 start = 0;
799 npages = (1 * 1024 * 1024) >> PAGE_SHIFT;
800 }
677 iommu_range_reserve(tbl, start, npages); 801 iommu_range_reserve(tbl, start, npages);
678 802
679 /* reserve the two PCI peripheral memory regions in IO space */ 803 /* reserve the two PCI peripheral memory regions in IO space */
@@ -694,10 +818,17 @@ static int __init calgary_setup_tar(struct pci_dev *dev, void __iomem *bbar)
694 if (ret) 818 if (ret)
695 return ret; 819 return ret;
696 820
697 tbl = dev->sysdata; 821 tbl = pci_iommu(dev->bus);
698 tbl->it_base = (unsigned long)bus_info[dev->bus->number].tce_space; 822 tbl->it_base = (unsigned long)bus_info[dev->bus->number].tce_space;
699 tce_free(tbl, 0, tbl->it_size); 823 tce_free(tbl, 0, tbl->it_size);
700 824
825 if (is_calgary(dev->device))
826 tbl->chip_ops = &calgary_chip_ops;
827 else if (is_calioc2(dev->device))
828 tbl->chip_ops = &calioc2_chip_ops;
829 else
830 BUG();
831
701 calgary_reserve_regions(dev); 832 calgary_reserve_regions(dev);
702 833
703 /* set TARs for each PHB */ 834 /* set TARs for each PHB */
@@ -706,15 +837,15 @@ static int __init calgary_setup_tar(struct pci_dev *dev, void __iomem *bbar)
706 837
707 /* zero out all TAR bits under sw control */ 838 /* zero out all TAR bits under sw control */
708 val64 &= ~TAR_SW_BITS; 839 val64 &= ~TAR_SW_BITS;
709
710 tbl = dev->sysdata;
711 table_phys = (u64)__pa(tbl->it_base); 840 table_phys = (u64)__pa(tbl->it_base);
841
712 val64 |= table_phys; 842 val64 |= table_phys;
713 843
714 BUG_ON(specified_table_size > TCE_TABLE_SIZE_8M); 844 BUG_ON(specified_table_size > TCE_TABLE_SIZE_8M);
715 val64 |= (u64) specified_table_size; 845 val64 |= (u64) specified_table_size;
716 846
717 tbl->tar_val = cpu_to_be64(val64); 847 tbl->tar_val = cpu_to_be64(val64);
848
718 writeq(tbl->tar_val, target); 849 writeq(tbl->tar_val, target);
719 readq(target); /* flush */ 850 readq(target); /* flush */
720 851
@@ -724,7 +855,7 @@ static int __init calgary_setup_tar(struct pci_dev *dev, void __iomem *bbar)
724static void __init calgary_free_bus(struct pci_dev *dev) 855static void __init calgary_free_bus(struct pci_dev *dev)
725{ 856{
726 u64 val64; 857 u64 val64;
727 struct iommu_table *tbl = dev->sysdata; 858 struct iommu_table *tbl = pci_iommu(dev->bus);
728 void __iomem *target; 859 void __iomem *target;
729 unsigned int bitmapsz; 860 unsigned int bitmapsz;
730 861
@@ -739,16 +870,81 @@ static void __init calgary_free_bus(struct pci_dev *dev)
739 tbl->it_map = NULL; 870 tbl->it_map = NULL;
740 871
741 kfree(tbl); 872 kfree(tbl);
742 dev->sysdata = NULL; 873
874 set_pci_iommu(dev->bus, NULL);
743 875
744 /* Can't free bootmem allocated memory after system is up :-( */ 876 /* Can't free bootmem allocated memory after system is up :-( */
745 bus_info[dev->bus->number].tce_space = NULL; 877 bus_info[dev->bus->number].tce_space = NULL;
746} 878}
747 879
880static void calgary_dump_error_regs(struct iommu_table *tbl)
881{
882 void __iomem *bbar = tbl->bbar;
883 void __iomem *target;
884 u32 csr, plssr;
885
886 target = calgary_reg(bbar, phb_offset(tbl->it_busno) | PHB_CSR_OFFSET);
887 csr = be32_to_cpu(readl(target));
888
889 target = calgary_reg(bbar, phb_offset(tbl->it_busno) | PHB_PLSSR_OFFSET);
890 plssr = be32_to_cpu(readl(target));
891
892 /* If no error, the agent ID in the CSR is not valid */
893 printk(KERN_EMERG "Calgary: DMA error on Calgary PHB 0x%x, "
894 "0x%08x@CSR 0x%08x@PLSSR\n", tbl->it_busno, csr, plssr);
895}
896
897static void calioc2_dump_error_regs(struct iommu_table *tbl)
898{
899 void __iomem *bbar = tbl->bbar;
900 u32 csr, csmr, plssr, mck, rcstat;
901 void __iomem *target;
902 unsigned long phboff = phb_offset(tbl->it_busno);
903 unsigned long erroff;
904 u32 errregs[7];
905 int i;
906
907 /* dump CSR */
908 target = calgary_reg(bbar, phboff | PHB_CSR_OFFSET);
909 csr = be32_to_cpu(readl(target));
910 /* dump PLSSR */
911 target = calgary_reg(bbar, phboff | PHB_PLSSR_OFFSET);
912 plssr = be32_to_cpu(readl(target));
913 /* dump CSMR */
914 target = calgary_reg(bbar, phboff | 0x290);
915 csmr = be32_to_cpu(readl(target));
916 /* dump mck */
917 target = calgary_reg(bbar, phboff | 0x800);
918 mck = be32_to_cpu(readl(target));
919
920 printk(KERN_EMERG "Calgary: DMA error on CalIOC2 PHB 0x%x\n",
921 tbl->it_busno);
922
923 printk(KERN_EMERG "Calgary: 0x%08x@CSR 0x%08x@PLSSR 0x%08x@CSMR 0x%08x@MCK\n",
924 csr, plssr, csmr, mck);
925
926 /* dump rest of error regs */
927 printk(KERN_EMERG "Calgary: ");
928 for (i = 0; i < ARRAY_SIZE(errregs); i++) {
929 /* err regs are at 0x810 - 0x870 */
930 erroff = (0x810 + (i * 0x10));
931 target = calgary_reg(bbar, phboff | erroff);
932 errregs[i] = be32_to_cpu(readl(target));
933 printk("0x%08x@0x%lx ", errregs[i], erroff);
934 }
935 printk("\n");
936
937 /* root complex status */
938 target = calgary_reg(bbar, phboff | PHB_ROOT_COMPLEX_STATUS);
939 rcstat = be32_to_cpu(readl(target));
940 printk(KERN_EMERG "Calgary: 0x%08x@0x%x\n", rcstat,
941 PHB_ROOT_COMPLEX_STATUS);
942}
943
748static void calgary_watchdog(unsigned long data) 944static void calgary_watchdog(unsigned long data)
749{ 945{
750 struct pci_dev *dev = (struct pci_dev *)data; 946 struct pci_dev *dev = (struct pci_dev *)data;
751 struct iommu_table *tbl = dev->sysdata; 947 struct iommu_table *tbl = pci_iommu(dev->bus);
752 void __iomem *bbar = tbl->bbar; 948 void __iomem *bbar = tbl->bbar;
753 u32 val32; 949 u32 val32;
754 void __iomem *target; 950 void __iomem *target;
@@ -758,13 +954,14 @@ static void calgary_watchdog(unsigned long data)
758 954
759 /* If no error, the agent ID in the CSR is not valid */ 955 /* If no error, the agent ID in the CSR is not valid */
760 if (val32 & CSR_AGENT_MASK) { 956 if (val32 & CSR_AGENT_MASK) {
761 printk(KERN_EMERG "calgary_watchdog: DMA error on PHB %#x, " 957 tbl->chip_ops->dump_error_regs(tbl);
762 "CSR = %#x\n", dev->bus->number, val32); 958
959 /* reset error */
763 writel(0, target); 960 writel(0, target);
764 961
765 /* Disable bus that caused the error */ 962 /* Disable bus that caused the error */
766 target = calgary_reg(bbar, phb_offset(tbl->it_busno) | 963 target = calgary_reg(bbar, phb_offset(tbl->it_busno) |
767 PHB_CONFIG_RW_OFFSET); 964 PHB_CONFIG_RW_OFFSET);
768 val32 = be32_to_cpu(readl(target)); 965 val32 = be32_to_cpu(readl(target));
769 val32 |= PHB_SLOT_DISABLE; 966 val32 |= PHB_SLOT_DISABLE;
770 writel(cpu_to_be32(val32), target); 967 writel(cpu_to_be32(val32), target);
@@ -775,8 +972,8 @@ static void calgary_watchdog(unsigned long data)
775 } 972 }
776} 973}
777 974
778static void __init calgary_increase_split_completion_timeout(void __iomem *bbar, 975static void __init calgary_set_split_completion_timeout(void __iomem *bbar,
779 unsigned char busnum) 976 unsigned char busnum, unsigned long timeout)
780{ 977{
781 u64 val64; 978 u64 val64;
782 void __iomem *target; 979 void __iomem *target;
@@ -802,11 +999,40 @@ static void __init calgary_increase_split_completion_timeout(void __iomem *bbar,
802 /* zero out this PHB's timer bits */ 999 /* zero out this PHB's timer bits */
803 mask = ~(0xFUL << phb_shift); 1000 mask = ~(0xFUL << phb_shift);
804 val64 &= mask; 1001 val64 &= mask;
805 val64 |= (CCR_2SEC_TIMEOUT << phb_shift); 1002 val64 |= (timeout << phb_shift);
806 writeq(cpu_to_be64(val64), target); 1003 writeq(cpu_to_be64(val64), target);
807 readq(target); /* flush */ 1004 readq(target); /* flush */
808} 1005}
809 1006
1007static void calioc2_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev)
1008{
1009 unsigned char busnum = dev->bus->number;
1010 void __iomem *bbar = tbl->bbar;
1011 void __iomem *target;
1012 u32 val;
1013
1014 /*
1015 * CalIOC2 designers recommend setting bit 8 in 0xnDB0 to 1
1016 */
1017 target = calgary_reg(bbar, phb_offset(busnum) | PHB_SAVIOR_L2);
1018 val = cpu_to_be32(readl(target));
1019 val |= 0x00800000;
1020 writel(cpu_to_be32(val), target);
1021}
1022
1023static void calgary_handle_quirks(struct iommu_table *tbl, struct pci_dev *dev)
1024{
1025 unsigned char busnum = dev->bus->number;
1026
1027 /*
1028 * Give split completion a longer timeout on bus 1 for aic94xx
1029 * http://bugzilla.kernel.org/show_bug.cgi?id=7180
1030 */
1031 if (is_calgary(dev->device) && (busnum == 1))
1032 calgary_set_split_completion_timeout(tbl->bbar, busnum,
1033 CCR_2SEC_TIMEOUT);
1034}
1035
810static void __init calgary_enable_translation(struct pci_dev *dev) 1036static void __init calgary_enable_translation(struct pci_dev *dev)
811{ 1037{
812 u32 val32; 1038 u32 val32;
@@ -816,7 +1042,7 @@ static void __init calgary_enable_translation(struct pci_dev *dev)
816 struct iommu_table *tbl; 1042 struct iommu_table *tbl;
817 1043
818 busnum = dev->bus->number; 1044 busnum = dev->bus->number;
819 tbl = dev->sysdata; 1045 tbl = pci_iommu(dev->bus);
820 bbar = tbl->bbar; 1046 bbar = tbl->bbar;
821 1047
822 /* enable TCE in PHB Config Register */ 1048 /* enable TCE in PHB Config Register */
@@ -824,20 +1050,15 @@ static void __init calgary_enable_translation(struct pci_dev *dev)
824 val32 = be32_to_cpu(readl(target)); 1050 val32 = be32_to_cpu(readl(target));
825 val32 |= PHB_TCE_ENABLE | PHB_DAC_DISABLE | PHB_MCSR_ENABLE; 1051 val32 |= PHB_TCE_ENABLE | PHB_DAC_DISABLE | PHB_MCSR_ENABLE;
826 1052
827 printk(KERN_INFO "Calgary: enabling translation on PHB %#x\n", busnum); 1053 printk(KERN_INFO "Calgary: enabling translation on %s PHB %#x\n",
1054 (dev->device == PCI_DEVICE_ID_IBM_CALGARY) ?
1055 "Calgary" : "CalIOC2", busnum);
828 printk(KERN_INFO "Calgary: errant DMAs will now be prevented on this " 1056 printk(KERN_INFO "Calgary: errant DMAs will now be prevented on this "
829 "bus.\n"); 1057 "bus.\n");
830 1058
831 writel(cpu_to_be32(val32), target); 1059 writel(cpu_to_be32(val32), target);
832 readl(target); /* flush */ 1060 readl(target); /* flush */
833 1061
834 /*
835 * Give split completion a longer timeout on bus 1 for aic94xx
836 * http://bugzilla.kernel.org/show_bug.cgi?id=7180
837 */
838 if (busnum == 1)
839 calgary_increase_split_completion_timeout(bbar, busnum);
840
841 init_timer(&tbl->watchdog_timer); 1062 init_timer(&tbl->watchdog_timer);
842 tbl->watchdog_timer.function = &calgary_watchdog; 1063 tbl->watchdog_timer.function = &calgary_watchdog;
843 tbl->watchdog_timer.data = (unsigned long)dev; 1064 tbl->watchdog_timer.data = (unsigned long)dev;
@@ -853,7 +1074,7 @@ static void __init calgary_disable_translation(struct pci_dev *dev)
853 struct iommu_table *tbl; 1074 struct iommu_table *tbl;
854 1075
855 busnum = dev->bus->number; 1076 busnum = dev->bus->number;
856 tbl = dev->sysdata; 1077 tbl = pci_iommu(dev->bus);
857 bbar = tbl->bbar; 1078 bbar = tbl->bbar;
858 1079
859 /* disable TCE in PHB Config Register */ 1080 /* disable TCE in PHB Config Register */
@@ -871,13 +1092,19 @@ static void __init calgary_disable_translation(struct pci_dev *dev)
871static void __init calgary_init_one_nontraslated(struct pci_dev *dev) 1092static void __init calgary_init_one_nontraslated(struct pci_dev *dev)
872{ 1093{
873 pci_dev_get(dev); 1094 pci_dev_get(dev);
874 dev->sysdata = NULL; 1095 set_pci_iommu(dev->bus, NULL);
875 dev->bus->self = dev; 1096
1097 /* is the device behind a bridge? */
1098 if (dev->bus->parent)
1099 dev->bus->parent->self = dev;
1100 else
1101 dev->bus->self = dev;
876} 1102}
877 1103
878static int __init calgary_init_one(struct pci_dev *dev) 1104static int __init calgary_init_one(struct pci_dev *dev)
879{ 1105{
880 void __iomem *bbar; 1106 void __iomem *bbar;
1107 struct iommu_table *tbl;
881 int ret; 1108 int ret;
882 1109
883 BUG_ON(dev->bus->number >= MAX_PHB_BUS_NUM); 1110 BUG_ON(dev->bus->number >= MAX_PHB_BUS_NUM);
@@ -888,7 +1115,18 @@ static int __init calgary_init_one(struct pci_dev *dev)
888 goto done; 1115 goto done;
889 1116
890 pci_dev_get(dev); 1117 pci_dev_get(dev);
891 dev->bus->self = dev; 1118
1119 if (dev->bus->parent) {
1120 if (dev->bus->parent->self)
1121 printk(KERN_WARNING "Calgary: IEEEE, dev %p has "
1122 "bus->parent->self!\n", dev);
1123 dev->bus->parent->self = dev;
1124 } else
1125 dev->bus->self = dev;
1126
1127 tbl = pci_iommu(dev->bus);
1128 tbl->chip_ops->handle_quirks(tbl, dev);
1129
892 calgary_enable_translation(dev); 1130 calgary_enable_translation(dev);
893 1131
894 return 0; 1132 return 0;
@@ -924,11 +1162,18 @@ static int __init calgary_locate_bbars(void)
924 target = calgary_reg(bbar, offset); 1162 target = calgary_reg(bbar, offset);
925 1163
926 val = be32_to_cpu(readl(target)); 1164 val = be32_to_cpu(readl(target));
1165
927 start_bus = (u8)((val & 0x00FF0000) >> 16); 1166 start_bus = (u8)((val & 0x00FF0000) >> 16);
928 end_bus = (u8)((val & 0x0000FF00) >> 8); 1167 end_bus = (u8)((val & 0x0000FF00) >> 8);
929 for (bus = start_bus; bus <= end_bus; bus++) { 1168
930 bus_info[bus].bbar = bbar; 1169 if (end_bus) {
931 bus_info[bus].phbid = phb; 1170 for (bus = start_bus; bus <= end_bus; bus++) {
1171 bus_info[bus].bbar = bbar;
1172 bus_info[bus].phbid = phb;
1173 }
1174 } else {
1175 bus_info[start_bus].bbar = bbar;
1176 bus_info[start_bus].phbid = phb;
932 } 1177 }
933 } 1178 }
934 } 1179 }
@@ -948,22 +1193,24 @@ static int __init calgary_init(void)
948{ 1193{
949 int ret; 1194 int ret;
950 struct pci_dev *dev = NULL; 1195 struct pci_dev *dev = NULL;
1196 void *tce_space;
951 1197
952 ret = calgary_locate_bbars(); 1198 ret = calgary_locate_bbars();
953 if (ret) 1199 if (ret)
954 return ret; 1200 return ret;
955 1201
956 do { 1202 do {
957 dev = pci_get_device(PCI_VENDOR_ID_IBM, 1203 dev = pci_get_device(PCI_VENDOR_ID_IBM, PCI_ANY_ID, dev);
958 PCI_DEVICE_ID_IBM_CALGARY,
959 dev);
960 if (!dev) 1204 if (!dev)
961 break; 1205 break;
1206 if (!is_cal_pci_dev(dev->device))
1207 continue;
962 if (!translate_phb(dev)) { 1208 if (!translate_phb(dev)) {
963 calgary_init_one_nontraslated(dev); 1209 calgary_init_one_nontraslated(dev);
964 continue; 1210 continue;
965 } 1211 }
966 if (!bus_info[dev->bus->number].tce_space && !translate_empty_slots) 1212 tce_space = bus_info[dev->bus->number].tce_space;
1213 if (!tce_space && !translate_empty_slots)
967 continue; 1214 continue;
968 1215
969 ret = calgary_init_one(dev); 1216 ret = calgary_init_one(dev);
@@ -976,10 +1223,11 @@ static int __init calgary_init(void)
976error: 1223error:
977 do { 1224 do {
978 dev = pci_get_device_reverse(PCI_VENDOR_ID_IBM, 1225 dev = pci_get_device_reverse(PCI_VENDOR_ID_IBM,
979 PCI_DEVICE_ID_IBM_CALGARY, 1226 PCI_ANY_ID, dev);
980 dev);
981 if (!dev) 1227 if (!dev)
982 break; 1228 break;
1229 if (!is_cal_pci_dev(dev->device))
1230 continue;
983 if (!translate_phb(dev)) { 1231 if (!translate_phb(dev)) {
984 pci_dev_put(dev); 1232 pci_dev_put(dev);
985 continue; 1233 continue;
@@ -1057,9 +1305,29 @@ static int __init build_detail_arrays(void)
1057 return 0; 1305 return 0;
1058} 1306}
1059 1307
1060void __init detect_calgary(void) 1308static int __init calgary_bus_has_devices(int bus, unsigned short pci_dev)
1061{ 1309{
1310 int dev;
1062 u32 val; 1311 u32 val;
1312
1313 if (pci_dev == PCI_DEVICE_ID_IBM_CALIOC2) {
1314 /*
1315 * FIXME: properly scan for devices accross the
1316 * PCI-to-PCI bridge on every CalIOC2 port.
1317 */
1318 return 1;
1319 }
1320
1321 for (dev = 1; dev < 8; dev++) {
1322 val = read_pci_config(bus, dev, 0, 0);
1323 if (val != 0xffffffff)
1324 break;
1325 }
1326 return (val != 0xffffffff);
1327}
1328
1329void __init detect_calgary(void)
1330{
1063 int bus; 1331 int bus;
1064 void *tbl; 1332 void *tbl;
1065 int calgary_found = 0; 1333 int calgary_found = 0;
@@ -1116,29 +1384,26 @@ void __init detect_calgary(void)
1116 specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE); 1384 specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE);
1117 1385
1118 for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) { 1386 for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
1119 int dev;
1120 struct calgary_bus_info *info = &bus_info[bus]; 1387 struct calgary_bus_info *info = &bus_info[bus];
1388 unsigned short pci_device;
1389 u32 val;
1390
1391 val = read_pci_config(bus, 0, 0, 0);
1392 pci_device = (val & 0xFFFF0000) >> 16;
1121 1393
1122 if (read_pci_config(bus, 0, 0, 0) != PCI_VENDOR_DEVICE_ID_CALGARY) 1394 if (!is_cal_pci_dev(pci_device))
1123 continue; 1395 continue;
1124 1396
1125 if (info->translation_disabled) 1397 if (info->translation_disabled)
1126 continue; 1398 continue;
1127 1399
1128 /* 1400 if (calgary_bus_has_devices(bus, pci_device) ||
1129 * Scan the slots of the PCI bus to see if there is a device present. 1401 translate_empty_slots) {
1130 * The parent bus will be the zero-ith device, so start at 1. 1402 tbl = alloc_tce_table();
1131 */ 1403 if (!tbl)
1132 for (dev = 1; dev < 8; dev++) { 1404 goto cleanup;
1133 val = read_pci_config(bus, dev, 0, 0); 1405 info->tce_space = tbl;
1134 if (val != 0xffffffff || translate_empty_slots) { 1406 calgary_found = 1;
1135 tbl = alloc_tce_table();
1136 if (!tbl)
1137 goto cleanup;
1138 info->tce_space = tbl;
1139 calgary_found = 1;
1140 break;
1141 }
1142 } 1407 }
1143 } 1408 }
1144 1409
@@ -1249,3 +1514,66 @@ static int __init calgary_parse_options(char *p)
1249 return 1; 1514 return 1;
1250} 1515}
1251__setup("calgary=", calgary_parse_options); 1516__setup("calgary=", calgary_parse_options);
1517
1518static void __init calgary_fixup_one_tce_space(struct pci_dev *dev)
1519{
1520 struct iommu_table *tbl;
1521 unsigned int npages;
1522 int i;
1523
1524 tbl = pci_iommu(dev->bus);
1525
1526 for (i = 0; i < 4; i++) {
1527 struct resource *r = &dev->resource[PCI_BRIDGE_RESOURCES + i];
1528
1529 /* Don't give out TCEs that map MEM resources */
1530 if (!(r->flags & IORESOURCE_MEM))
1531 continue;
1532
1533 /* 0-based? we reserve the whole 1st MB anyway */
1534 if (!r->start)
1535 continue;
1536
1537 /* cover the whole region */
1538 npages = (r->end - r->start) >> PAGE_SHIFT;
1539 npages++;
1540
1541 iommu_range_reserve(tbl, r->start, npages);
1542 }
1543}
1544
1545static int __init calgary_fixup_tce_spaces(void)
1546{
1547 struct pci_dev *dev = NULL;
1548 void *tce_space;
1549
1550 if (no_iommu || swiotlb || !calgary_detected)
1551 return -ENODEV;
1552
1553 printk(KERN_DEBUG "Calgary: fixing up tce spaces\n");
1554
1555 do {
1556 dev = pci_get_device(PCI_VENDOR_ID_IBM, PCI_ANY_ID, dev);
1557 if (!dev)
1558 break;
1559 if (!is_cal_pci_dev(dev->device))
1560 continue;
1561 if (!translate_phb(dev))
1562 continue;
1563
1564 tce_space = bus_info[dev->bus->number].tce_space;
1565 if (!tce_space)
1566 continue;
1567
1568 calgary_fixup_one_tce_space(dev);
1569
1570 } while (1);
1571
1572 return 0;
1573}
1574
1575/*
1576 * We need to be call after pcibios_assign_resources (fs_initcall level)
1577 * and before device_initcall.
1578 */
1579rootfs_initcall(calgary_fixup_tce_spaces);
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 90f6315d02d4..05d745ede561 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -8,7 +8,7 @@
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/proto.h> 11#include <asm/iommu.h>
12#include <asm/calgary.h> 12#include <asm/calgary.h>
13 13
14int iommu_merge __read_mostly = 0; 14int iommu_merge __read_mostly = 0;
@@ -321,6 +321,11 @@ static int __init pci_iommu_init(void)
321 return 0; 321 return 0;
322} 322}
323 323
324void pci_iommu_shutdown(void)
325{
326 gart_iommu_shutdown();
327}
328
324#ifdef CONFIG_PCI 329#ifdef CONFIG_PCI
325/* Many VIA bridges seem to corrupt data for DAC. Disable it here */ 330/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
326 331
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index ae091cdc1a4d..4918c575d582 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -28,6 +28,7 @@
28#include <asm/mtrr.h> 28#include <asm/mtrr.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/proto.h> 30#include <asm/proto.h>
31#include <asm/iommu.h>
31#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
32#include <asm/swiotlb.h> 33#include <asm/swiotlb.h>
33#include <asm/dma.h> 34#include <asm/dma.h>
@@ -235,7 +236,7 @@ static dma_addr_t gart_map_simple(struct device *dev, char *buf,
235} 236}
236 237
237/* Map a single area into the IOMMU */ 238/* Map a single area into the IOMMU */
238dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir) 239static dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir)
239{ 240{
240 unsigned long phys_mem, bus; 241 unsigned long phys_mem, bus;
241 242
@@ -253,7 +254,7 @@ dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir)
253/* 254/*
254 * Free a DMA mapping. 255 * Free a DMA mapping.
255 */ 256 */
256void gart_unmap_single(struct device *dev, dma_addr_t dma_addr, 257static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
257 size_t size, int direction) 258 size_t size, int direction)
258{ 259{
259 unsigned long iommu_page; 260 unsigned long iommu_page;
@@ -275,7 +276,7 @@ void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
275/* 276/*
276 * Wrapper for pci_unmap_single working with scatterlists. 277 * Wrapper for pci_unmap_single working with scatterlists.
277 */ 278 */
278void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) 279static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
279{ 280{
280 int i; 281 int i;
281 282
@@ -571,6 +572,26 @@ static const struct dma_mapping_ops gart_dma_ops = {
571 .unmap_sg = gart_unmap_sg, 572 .unmap_sg = gart_unmap_sg,
572}; 573};
573 574
575void gart_iommu_shutdown(void)
576{
577 struct pci_dev *dev;
578 int i;
579
580 if (no_agp && (dma_ops != &gart_dma_ops))
581 return;
582
583 for (i = 0; i < num_k8_northbridges; i++) {
584 u32 ctl;
585
586 dev = k8_northbridges[i];
587 pci_read_config_dword(dev, 0x90, &ctl);
588
589 ctl &= ~1;
590
591 pci_write_config_dword(dev, 0x90, ctl);
592 }
593}
594
574void __init gart_iommu_init(void) 595void __init gart_iommu_init(void)
575{ 596{
576 struct agp_kern_info info; 597 struct agp_kern_info info;
diff --git a/arch/x86_64/kernel/pci-nommu.c b/arch/x86_64/kernel/pci-nommu.c
index 6dade0c867cc..2a34c6c025a9 100644
--- a/arch/x86_64/kernel/pci-nommu.c
+++ b/arch/x86_64/kernel/pci-nommu.c
@@ -6,7 +6,7 @@
6#include <linux/string.h> 6#include <linux/string.h>
7#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
8 8
9#include <asm/proto.h> 9#include <asm/iommu.h>
10#include <asm/processor.h> 10#include <asm/processor.h>
11#include <asm/dma.h> 11#include <asm/dma.h>
12 12
@@ -34,7 +34,7 @@ nommu_map_single(struct device *hwdev, void *ptr, size_t size,
34 return bus; 34 return bus;
35} 35}
36 36
37void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size, 37static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
38 int direction) 38 int direction)
39{ 39{
40} 40}
@@ -54,7 +54,7 @@ void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
54 * Device ownership issues as mentioned above for pci_map_single are 54 * Device ownership issues as mentioned above for pci_map_single are
55 * the same here. 55 * the same here.
56 */ 56 */
57int nommu_map_sg(struct device *hwdev, struct scatterlist *sg, 57static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
58 int nents, int direction) 58 int nents, int direction)
59{ 59{
60 int i; 60 int i;
@@ -74,7 +74,7 @@ int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
74 * Again, cpu read rules concerning calls here are the same as for 74 * Again, cpu read rules concerning calls here are the same as for
75 * pci_unmap_single() above. 75 * pci_unmap_single() above.
76 */ 76 */
77void nommu_unmap_sg(struct device *dev, struct scatterlist *sg, 77static void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
78 int nents, int dir) 78 int nents, int dir)
79{ 79{
80} 80}
diff --git a/arch/x86_64/kernel/pci-swiotlb.c b/arch/x86_64/kernel/pci-swiotlb.c
index 4b4569abc60c..b2f405ea7c85 100644
--- a/arch/x86_64/kernel/pci-swiotlb.c
+++ b/arch/x86_64/kernel/pci-swiotlb.c
@@ -5,7 +5,7 @@
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/dma-mapping.h> 6#include <linux/dma-mapping.h>
7 7
8#include <asm/proto.h> 8#include <asm/iommu.h>
9#include <asm/swiotlb.h> 9#include <asm/swiotlb.h>
10#include <asm/dma.h> 10#include <asm/dma.h>
11 11
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 5909039f37aa..92fade4a62cf 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -207,6 +207,7 @@ void cpu_idle (void)
207 if (__get_cpu_var(cpu_idle_state)) 207 if (__get_cpu_var(cpu_idle_state))
208 __get_cpu_var(cpu_idle_state) = 0; 208 __get_cpu_var(cpu_idle_state) = 0;
209 209
210 check_pgt_cache();
210 rmb(); 211 rmb();
211 idle = pm_idle; 212 idle = pm_idle;
212 if (!idle) 213 if (!idle)
@@ -278,7 +279,7 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
278 */ 279 */
279 if (!pm_idle) { 280 if (!pm_idle) {
280 if (!printed) { 281 if (!printed) {
281 printk("using mwait in idle threads.\n"); 282 printk(KERN_INFO "using mwait in idle threads.\n");
282 printed = 1; 283 printed = 1;
283 } 284 }
284 pm_idle = mwait_idle; 285 pm_idle = mwait_idle;
@@ -305,6 +306,7 @@ early_param("idle", idle_setup);
305void __show_regs(struct pt_regs * regs) 306void __show_regs(struct pt_regs * regs)
306{ 307{
307 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; 308 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
309 unsigned long d0, d1, d2, d3, d6, d7;
308 unsigned int fsindex,gsindex; 310 unsigned int fsindex,gsindex;
309 unsigned int ds,cs,es; 311 unsigned int ds,cs,es;
310 312
@@ -349,6 +351,15 @@ void __show_regs(struct pt_regs * regs)
349 fs,fsindex,gs,gsindex,shadowgs); 351 fs,fsindex,gs,gsindex,shadowgs);
350 printk("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0); 352 printk("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0);
351 printk("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4); 353 printk("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4);
354
355 get_debugreg(d0, 0);
356 get_debugreg(d1, 1);
357 get_debugreg(d2, 2);
358 printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
359 get_debugreg(d3, 3);
360 get_debugreg(d6, 6);
361 get_debugreg(d7, 7);
362 printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
352} 363}
353 364
354void show_regs(struct pt_regs *regs) 365void show_regs(struct pt_regs *regs)
diff --git a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c
index 7503068e788d..368db2b9c5ac 100644
--- a/arch/x86_64/kernel/reboot.c
+++ b/arch/x86_64/kernel/reboot.c
@@ -16,6 +16,7 @@
16#include <asm/pgtable.h> 16#include <asm/pgtable.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18#include <asm/apic.h> 18#include <asm/apic.h>
19#include <asm/iommu.h>
19 20
20/* 21/*
21 * Power off function, if any 22 * Power off function, if any
@@ -81,6 +82,7 @@ static inline void kb_wait(void)
81void machine_shutdown(void) 82void machine_shutdown(void)
82{ 83{
83 unsigned long flags; 84 unsigned long flags;
85
84 /* Stop the cpus and apics */ 86 /* Stop the cpus and apics */
85#ifdef CONFIG_SMP 87#ifdef CONFIG_SMP
86 int reboot_cpu_id; 88 int reboot_cpu_id;
@@ -111,6 +113,8 @@ void machine_shutdown(void)
111 disable_IO_APIC(); 113 disable_IO_APIC();
112 114
113 local_irq_restore(flags); 115 local_irq_restore(flags);
116
117 pci_iommu_shutdown();
114} 118}
115 119
116void machine_emergency_restart(void) 120void machine_emergency_restart(void)
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 33ef718f8cb5..6fa0a302e2aa 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -575,6 +575,8 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
575 level = cpuid_eax(1); 575 level = cpuid_eax(1);
576 if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)) 576 if (c->x86 == 15 && ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58))
577 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability); 577 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
578 if (c->x86 == 0x10)
579 set_bit(X86_FEATURE_REP_GOOD, &c->x86_capability);
578 580
579 /* Enable workaround for FXSAVE leak */ 581 /* Enable workaround for FXSAVE leak */
580 if (c->x86 >= 6) 582 if (c->x86 >= 6)
@@ -600,8 +602,11 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
600 if (c->extended_cpuid_level >= 0x80000008) 602 if (c->extended_cpuid_level >= 0x80000008)
601 amd_detect_cmp(c); 603 amd_detect_cmp(c);
602 604
603 /* Fix cpuid4 emulation for more */ 605 if (c->extended_cpuid_level >= 0x80000006 &&
604 num_cache_leaves = 3; 606 (cpuid_edx(0x80000006) & 0xf000))
607 num_cache_leaves = 4;
608 else
609 num_cache_leaves = 3;
605 610
606 /* RDTSC can be speculated around */ 611 /* RDTSC can be speculated around */
607 clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability); 612 clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
index 290f5d8037cd..4886afcd6287 100644
--- a/arch/x86_64/kernel/signal.c
+++ b/arch/x86_64/kernel/signal.c
@@ -26,6 +26,7 @@
26#include <asm/i387.h> 26#include <asm/i387.h>
27#include <asm/proto.h> 27#include <asm/proto.h>
28#include <asm/ia32_unistd.h> 28#include <asm/ia32_unistd.h>
29#include <asm/mce.h>
29 30
30/* #define DEBUG_SIG 1 */ 31/* #define DEBUG_SIG 1 */
31 32
@@ -472,6 +473,12 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
472 clear_thread_flag(TIF_SINGLESTEP); 473 clear_thread_flag(TIF_SINGLESTEP);
473 } 474 }
474 475
476#ifdef CONFIG_X86_MCE
477 /* notify userspace of pending MCEs */
478 if (thread_info_flags & _TIF_MCE_NOTIFY)
479 mce_notify_user();
480#endif /* CONFIG_X86_MCE */
481
475 /* deal with pending signal delivery */ 482 /* deal with pending signal delivery */
476 if (thread_info_flags & (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK)) 483 if (thread_info_flags & (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK))
477 do_signal(regs); 484 do_signal(regs);
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
index 0694940b2e73..673a300b5944 100644
--- a/arch/x86_64/kernel/smp.c
+++ b/arch/x86_64/kernel/smp.c
@@ -241,7 +241,7 @@ void flush_tlb_mm (struct mm_struct * mm)
241 } 241 }
242 if (!cpus_empty(cpu_mask)) 242 if (!cpus_empty(cpu_mask))
243 flush_tlb_others(cpu_mask, mm, FLUSH_ALL); 243 flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
244 244 check_pgt_cache();
245 preempt_enable(); 245 preempt_enable();
246} 246}
247EXPORT_SYMBOL(flush_tlb_mm); 247EXPORT_SYMBOL(flush_tlb_mm);
@@ -386,9 +386,9 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
386 return 0; 386 return 0;
387 } 387 }
388 388
389 spin_lock_bh(&call_lock); 389 spin_lock(&call_lock);
390 __smp_call_function_single(cpu, func, info, nonatomic, wait); 390 __smp_call_function_single(cpu, func, info, nonatomic, wait);
391 spin_unlock_bh(&call_lock); 391 spin_unlock(&call_lock);
392 put_cpu(); 392 put_cpu();
393 return 0; 393 return 0;
394} 394}
diff --git a/arch/x86_64/kernel/tce.c b/arch/x86_64/kernel/tce.c
index f61fb8e4f129..3aeae2fa2e24 100644
--- a/arch/x86_64/kernel/tce.c
+++ b/arch/x86_64/kernel/tce.c
@@ -136,9 +136,9 @@ int build_tce_table(struct pci_dev *dev, void __iomem *bbar)
136 struct iommu_table *tbl; 136 struct iommu_table *tbl;
137 int ret; 137 int ret;
138 138
139 if (dev->sysdata) { 139 if (pci_iommu(dev->bus)) {
140 printk(KERN_ERR "Calgary: dev %p has sysdata %p\n", 140 printk(KERN_ERR "Calgary: dev %p has sysdata->iommu %p\n",
141 dev, dev->sysdata); 141 dev, pci_iommu(dev->bus));
142 BUG(); 142 BUG();
143 } 143 }
144 144
@@ -155,11 +155,7 @@ int build_tce_table(struct pci_dev *dev, void __iomem *bbar)
155 155
156 tbl->bbar = bbar; 156 tbl->bbar = bbar;
157 157
158 /* 158 set_pci_iommu(dev->bus, tbl);
159 * NUMA is already using the bus's sysdata pointer, so we use
160 * the bus's pci_dev's sysdata instead.
161 */
162 dev->sysdata = tbl;
163 159
164 return 0; 160 return 0;
165 161
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 4a0895bacf51..6d48a4e826d9 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -33,6 +33,7 @@
33#include <acpi/acpi_bus.h> 33#include <acpi/acpi_bus.h>
34#endif 34#endif
35#include <asm/8253pit.h> 35#include <asm/8253pit.h>
36#include <asm/i8253.h>
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
37#include <asm/vsyscall.h> 38#include <asm/vsyscall.h>
38#include <asm/timex.h> 39#include <asm/timex.h>
@@ -44,12 +45,14 @@
44#include <asm/hpet.h> 45#include <asm/hpet.h>
45#include <asm/mpspec.h> 46#include <asm/mpspec.h>
46#include <asm/nmi.h> 47#include <asm/nmi.h>
48#include <asm/vgtod.h>
47 49
48static char *timename = NULL; 50static char *timename = NULL;
49 51
50DEFINE_SPINLOCK(rtc_lock); 52DEFINE_SPINLOCK(rtc_lock);
51EXPORT_SYMBOL(rtc_lock); 53EXPORT_SYMBOL(rtc_lock);
52DEFINE_SPINLOCK(i8253_lock); 54DEFINE_SPINLOCK(i8253_lock);
55EXPORT_SYMBOL(i8253_lock);
53 56
54volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; 57volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
55 58
@@ -79,8 +82,9 @@ EXPORT_SYMBOL(profile_pc);
79 * sheet for details. 82 * sheet for details.
80 */ 83 */
81 84
82static void set_rtc_mmss(unsigned long nowtime) 85static int set_rtc_mmss(unsigned long nowtime)
83{ 86{
87 int retval = 0;
84 int real_seconds, real_minutes, cmos_minutes; 88 int real_seconds, real_minutes, cmos_minutes;
85 unsigned char control, freq_select; 89 unsigned char control, freq_select;
86 90
@@ -120,6 +124,7 @@ static void set_rtc_mmss(unsigned long nowtime)
120 if (abs(real_minutes - cmos_minutes) >= 30) { 124 if (abs(real_minutes - cmos_minutes) >= 30) {
121 printk(KERN_WARNING "time.c: can't update CMOS clock " 125 printk(KERN_WARNING "time.c: can't update CMOS clock "
122 "from %d to %d\n", cmos_minutes, real_minutes); 126 "from %d to %d\n", cmos_minutes, real_minutes);
127 retval = -1;
123 } else { 128 } else {
124 BIN_TO_BCD(real_seconds); 129 BIN_TO_BCD(real_seconds);
125 BIN_TO_BCD(real_minutes); 130 BIN_TO_BCD(real_minutes);
@@ -139,12 +144,17 @@ static void set_rtc_mmss(unsigned long nowtime)
139 CMOS_WRITE(freq_select, RTC_FREQ_SELECT); 144 CMOS_WRITE(freq_select, RTC_FREQ_SELECT);
140 145
141 spin_unlock(&rtc_lock); 146 spin_unlock(&rtc_lock);
147
148 return retval;
142} 149}
143 150
151int update_persistent_clock(struct timespec now)
152{
153 return set_rtc_mmss(now.tv_sec);
154}
144 155
145void main_timer_handler(void) 156void main_timer_handler(void)
146{ 157{
147 static unsigned long rtc_update = 0;
148/* 158/*
149 * Here we are in the timer irq handler. We have irqs locally disabled (so we 159 * Here we are in the timer irq handler. We have irqs locally disabled (so we
150 * don't need spin_lock_irqsave()) but we don't know if the timer_bh is running 160 * don't need spin_lock_irqsave()) but we don't know if the timer_bh is running
@@ -172,20 +182,6 @@ void main_timer_handler(void)
172 if (!using_apic_timer) 182 if (!using_apic_timer)
173 smp_local_timer_interrupt(); 183 smp_local_timer_interrupt();
174 184
175/*
176 * If we have an externally synchronized Linux clock, then update CMOS clock
177 * accordingly every ~11 minutes. set_rtc_mmss() will be called in the jiffy
178 * closest to exactly 500 ms before the next second. If the update fails, we
179 * don't care, as it'll be updated on the next turn, and the problem (time way
180 * off) isn't likely to go away much sooner anyway.
181 */
182
183 if (ntp_synced() && xtime.tv_sec > rtc_update &&
184 abs(xtime.tv_nsec - 500000000) <= tick_nsec / 2) {
185 set_rtc_mmss(xtime.tv_sec);
186 rtc_update = xtime.tv_sec + 660;
187 }
188
189 write_sequnlock(&xtime_lock); 185 write_sequnlock(&xtime_lock);
190} 186}
191 187
@@ -199,7 +195,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
199 return IRQ_HANDLED; 195 return IRQ_HANDLED;
200} 196}
201 197
202static unsigned long get_cmos_time(void) 198unsigned long read_persistent_clock(void)
203{ 199{
204 unsigned int year, mon, day, hour, min, sec; 200 unsigned int year, mon, day, hour, min, sec;
205 unsigned long flags; 201 unsigned long flags;
@@ -226,7 +222,7 @@ static unsigned long get_cmos_time(void)
226 /* 222 /*
227 * We know that x86-64 always uses BCD format, no need to check the 223 * We know that x86-64 always uses BCD format, no need to check the
228 * config register. 224 * config register.
229 */ 225 */
230 226
231 BCD_TO_BIN(sec); 227 BCD_TO_BIN(sec);
232 BCD_TO_BIN(min); 228 BCD_TO_BIN(min);
@@ -239,11 +235,11 @@ static unsigned long get_cmos_time(void)
239 BCD_TO_BIN(century); 235 BCD_TO_BIN(century);
240 year += century * 100; 236 year += century * 100;
241 printk(KERN_INFO "Extended CMOS year: %d\n", century * 100); 237 printk(KERN_INFO "Extended CMOS year: %d\n", century * 100);
242 } else { 238 } else {
243 /* 239 /*
244 * x86-64 systems only exists since 2002. 240 * x86-64 systems only exists since 2002.
245 * This will work up to Dec 31, 2100 241 * This will work up to Dec 31, 2100
246 */ 242 */
247 year += 2000; 243 year += 2000;
248 } 244 }
249 245
@@ -255,45 +251,45 @@ static unsigned long get_cmos_time(void)
255#define TICK_COUNT 100000000 251#define TICK_COUNT 100000000
256static unsigned int __init tsc_calibrate_cpu_khz(void) 252static unsigned int __init tsc_calibrate_cpu_khz(void)
257{ 253{
258 int tsc_start, tsc_now; 254 int tsc_start, tsc_now;
259 int i, no_ctr_free; 255 int i, no_ctr_free;
260 unsigned long evntsel3 = 0, pmc3 = 0, pmc_now = 0; 256 unsigned long evntsel3 = 0, pmc3 = 0, pmc_now = 0;
261 unsigned long flags; 257 unsigned long flags;
262 258
263 for (i = 0; i < 4; i++) 259 for (i = 0; i < 4; i++)
264 if (avail_to_resrv_perfctr_nmi_bit(i)) 260 if (avail_to_resrv_perfctr_nmi_bit(i))
265 break; 261 break;
266 no_ctr_free = (i == 4); 262 no_ctr_free = (i == 4);
267 if (no_ctr_free) { 263 if (no_ctr_free) {
268 i = 3; 264 i = 3;
269 rdmsrl(MSR_K7_EVNTSEL3, evntsel3); 265 rdmsrl(MSR_K7_EVNTSEL3, evntsel3);
270 wrmsrl(MSR_K7_EVNTSEL3, 0); 266 wrmsrl(MSR_K7_EVNTSEL3, 0);
271 rdmsrl(MSR_K7_PERFCTR3, pmc3); 267 rdmsrl(MSR_K7_PERFCTR3, pmc3);
272 } else { 268 } else {
273 reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i); 269 reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i);
274 reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i); 270 reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
275 } 271 }
276 local_irq_save(flags); 272 local_irq_save(flags);
277 /* start meauring cycles, incrementing from 0 */ 273 /* start meauring cycles, incrementing from 0 */
278 wrmsrl(MSR_K7_PERFCTR0 + i, 0); 274 wrmsrl(MSR_K7_PERFCTR0 + i, 0);
279 wrmsrl(MSR_K7_EVNTSEL0 + i, 1 << 22 | 3 << 16 | 0x76); 275 wrmsrl(MSR_K7_EVNTSEL0 + i, 1 << 22 | 3 << 16 | 0x76);
280 rdtscl(tsc_start); 276 rdtscl(tsc_start);
281 do { 277 do {
282 rdmsrl(MSR_K7_PERFCTR0 + i, pmc_now); 278 rdmsrl(MSR_K7_PERFCTR0 + i, pmc_now);
283 tsc_now = get_cycles_sync(); 279 tsc_now = get_cycles_sync();
284 } while ((tsc_now - tsc_start) < TICK_COUNT); 280 } while ((tsc_now - tsc_start) < TICK_COUNT);
285 281
286 local_irq_restore(flags); 282 local_irq_restore(flags);
287 if (no_ctr_free) { 283 if (no_ctr_free) {
288 wrmsrl(MSR_K7_EVNTSEL3, 0); 284 wrmsrl(MSR_K7_EVNTSEL3, 0);
289 wrmsrl(MSR_K7_PERFCTR3, pmc3); 285 wrmsrl(MSR_K7_PERFCTR3, pmc3);
290 wrmsrl(MSR_K7_EVNTSEL3, evntsel3); 286 wrmsrl(MSR_K7_EVNTSEL3, evntsel3);
291 } else { 287 } else {
292 release_perfctr_nmi(MSR_K7_PERFCTR0 + i); 288 release_perfctr_nmi(MSR_K7_PERFCTR0 + i);
293 release_evntsel_nmi(MSR_K7_EVNTSEL0 + i); 289 release_evntsel_nmi(MSR_K7_EVNTSEL0 + i);
294 } 290 }
295 291
296 return pmc_now * tsc_khz / (tsc_now - tsc_start); 292 return pmc_now * tsc_khz / (tsc_now - tsc_start);
297} 293}
298 294
299/* 295/*
@@ -321,7 +317,7 @@ static unsigned int __init pit_calibrate_tsc(void)
321 end = get_cycles_sync(); 317 end = get_cycles_sync();
322 318
323 spin_unlock_irqrestore(&i8253_lock, flags); 319 spin_unlock_irqrestore(&i8253_lock, flags);
324 320
325 return (end - start) / 50; 321 return (end - start) / 50;
326} 322}
327 323
@@ -366,25 +362,20 @@ static struct irqaction irq0 = {
366 .handler = timer_interrupt, 362 .handler = timer_interrupt,
367 .flags = IRQF_DISABLED | IRQF_IRQPOLL, 363 .flags = IRQF_DISABLED | IRQF_IRQPOLL,
368 .mask = CPU_MASK_NONE, 364 .mask = CPU_MASK_NONE,
369 .name = "timer" 365 .name = "timer"
370}; 366};
371 367
372void __init time_init(void) 368void __init time_init(void)
373{ 369{
374 if (nohpet) 370 if (nohpet)
375 hpet_address = 0; 371 hpet_address = 0;
376 xtime.tv_sec = get_cmos_time();
377 xtime.tv_nsec = 0;
378
379 set_normalized_timespec(&wall_to_monotonic,
380 -xtime.tv_sec, -xtime.tv_nsec);
381 372
382 if (hpet_arch_init()) 373 if (hpet_arch_init())
383 hpet_address = 0; 374 hpet_address = 0;
384 375
385 if (hpet_use_timer) { 376 if (hpet_use_timer) {
386 /* set tick_nsec to use the proper rate for HPET */ 377 /* set tick_nsec to use the proper rate for HPET */
387 tick_nsec = TICK_NSEC_HPET; 378 tick_nsec = TICK_NSEC_HPET;
388 tsc_khz = hpet_calibrate_tsc(); 379 tsc_khz = hpet_calibrate_tsc();
389 timename = "HPET"; 380 timename = "HPET";
390 } else { 381 } else {
@@ -415,54 +406,21 @@ void __init time_init(void)
415 setup_irq(0, &irq0); 406 setup_irq(0, &irq0);
416} 407}
417 408
418
419static long clock_cmos_diff;
420static unsigned long sleep_start;
421
422/* 409/*
423 * sysfs support for the timer. 410 * sysfs support for the timer.
424 */ 411 */
425 412
426static int timer_suspend(struct sys_device *dev, pm_message_t state) 413static int timer_suspend(struct sys_device *dev, pm_message_t state)
427{ 414{
428 /*
429 * Estimate time zone so that set_time can update the clock
430 */
431 long cmos_time = get_cmos_time();
432
433 clock_cmos_diff = -cmos_time;
434 clock_cmos_diff += get_seconds();
435 sleep_start = cmos_time;
436 return 0; 415 return 0;
437} 416}
438 417
439static int timer_resume(struct sys_device *dev) 418static int timer_resume(struct sys_device *dev)
440{ 419{
441 unsigned long flags;
442 unsigned long sec;
443 unsigned long ctime = get_cmos_time();
444 long sleep_length = (ctime - sleep_start) * HZ;
445
446 if (sleep_length < 0) {
447 printk(KERN_WARNING "Time skew detected in timer resume!\n");
448 /* The time after the resume must not be earlier than the time
449 * before the suspend or some nasty things will happen
450 */
451 sleep_length = 0;
452 ctime = sleep_start;
453 }
454 if (hpet_address) 420 if (hpet_address)
455 hpet_reenable(); 421 hpet_reenable();
456 else 422 else
457 i8254_timer_resume(); 423 i8254_timer_resume();
458
459 sec = ctime + clock_cmos_diff;
460 write_seqlock_irqsave(&xtime_lock,flags);
461 xtime.tv_sec = sec;
462 xtime.tv_nsec = 0;
463 jiffies += sleep_length;
464 write_sequnlock_irqrestore(&xtime_lock,flags);
465 touch_softlockup_watchdog();
466 return 0; 424 return 0;
467} 425}
468 426
diff --git a/arch/x86_64/kernel/tsc.c b/arch/x86_64/kernel/tsc.c
index e850aa01e1b3..9b76b03d0600 100644
--- a/arch/x86_64/kernel/tsc.c
+++ b/arch/x86_64/kernel/tsc.c
@@ -61,25 +61,9 @@ inline int check_tsc_unstable(void)
61 * first tick after the change will be slightly wrong. 61 * first tick after the change will be slightly wrong.
62 */ 62 */
63 63
64#include <linux/workqueue.h> 64static unsigned int ref_freq;
65 65static unsigned long loops_per_jiffy_ref;
66static unsigned int cpufreq_delayed_issched = 0; 66static unsigned long tsc_khz_ref;
67static unsigned int cpufreq_init = 0;
68static struct work_struct cpufreq_delayed_get_work;
69
70static void handle_cpufreq_delayed_get(struct work_struct *v)
71{
72 unsigned int cpu;
73 for_each_online_cpu(cpu) {
74 cpufreq_get(cpu);
75 }
76 cpufreq_delayed_issched = 0;
77}
78
79static unsigned int ref_freq = 0;
80static unsigned long loops_per_jiffy_ref = 0;
81
82static unsigned long tsc_khz_ref = 0;
83 67
84static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, 68static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
85 void *data) 69 void *data)
@@ -125,10 +109,8 @@ static struct notifier_block time_cpufreq_notifier_block = {
125 109
126static int __init cpufreq_tsc(void) 110static int __init cpufreq_tsc(void)
127{ 111{
128 INIT_WORK(&cpufreq_delayed_get_work, handle_cpufreq_delayed_get); 112 cpufreq_register_notifier(&time_cpufreq_notifier_block,
129 if (!cpufreq_register_notifier(&time_cpufreq_notifier_block, 113 CPUFREQ_TRANSITION_NOTIFIER);
130 CPUFREQ_TRANSITION_NOTIFIER))
131 cpufreq_init = 1;
132 return 0; 114 return 0;
133} 115}
134 116
@@ -153,17 +135,18 @@ __cpuinit int unsynchronized_tsc(void)
153#endif 135#endif
154 /* Most intel systems have synchronized TSCs except for 136 /* Most intel systems have synchronized TSCs except for
155 multi node systems */ 137 multi node systems */
156 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) { 138 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
157#ifdef CONFIG_ACPI 139#ifdef CONFIG_ACPI
158 /* But TSC doesn't tick in C3 so don't use it there */ 140 /* But TSC doesn't tick in C3 so don't use it there */
159 if (acpi_gbl_FADT.header.length > 0 && acpi_gbl_FADT.C3latency < 1000) 141 if (acpi_gbl_FADT.header.length > 0 &&
142 acpi_gbl_FADT.C3latency < 1000)
160 return 1; 143 return 1;
161#endif 144#endif
162 return 0; 145 return 0;
163 } 146 }
164 147
165 /* Assume multi socket systems are not synchronized */ 148 /* Assume multi socket systems are not synchronized */
166 return num_present_cpus() > 1; 149 return num_present_cpus() > 1;
167} 150}
168 151
169int __init notsc_setup(char *s) 152int __init notsc_setup(char *s)
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 5c57ea4591c1..e7a5eb6cd785 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -54,6 +54,13 @@ SECTIONS
54 54
55 RODATA 55 RODATA
56 56
57 . = ALIGN(4);
58 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
59 __tracedata_start = .;
60 *(.tracedata)
61 __tracedata_end = .;
62 }
63
57 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */ 64 . = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */
58 /* Data */ 65 /* Data */
59 .data : AT(ADDR(.data) - LOAD_OFFSET) { 66 .data : AT(ADDR(.data) - LOAD_OFFSET) {
@@ -93,6 +100,9 @@ SECTIONS
93 .vsyscall_gtod_data : AT(VLOAD(.vsyscall_gtod_data)) 100 .vsyscall_gtod_data : AT(VLOAD(.vsyscall_gtod_data))
94 { *(.vsyscall_gtod_data) } 101 { *(.vsyscall_gtod_data) }
95 vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data); 102 vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data);
103 .vsyscall_clock : AT(VLOAD(.vsyscall_clock))
104 { *(.vsyscall_clock) }
105 vsyscall_clock = VVIRT(.vsyscall_clock);
96 106
97 107
98 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) 108 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1))
@@ -133,20 +143,11 @@ SECTIONS
133 /* might get freed after init */ 143 /* might get freed after init */
134 . = ALIGN(4096); 144 . = ALIGN(4096);
135 __smp_alt_begin = .; 145 __smp_alt_begin = .;
136 __smp_alt_instructions = .;
137 .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
138 *(.smp_altinstructions)
139 }
140 __smp_alt_instructions_end = .;
141 . = ALIGN(8);
142 __smp_locks = .; 146 __smp_locks = .;
143 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 147 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
144 *(.smp_locks) 148 *(.smp_locks)
145 } 149 }
146 __smp_locks_end = .; 150 __smp_locks_end = .;
147 .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
148 *(.smp_altinstr_replacement)
149 }
150 . = ALIGN(4096); 151 . = ALIGN(4096);
151 __smp_alt_end = .; 152 __smp_alt_end = .;
152 153
@@ -189,6 +190,12 @@ SECTIONS
189 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } 190 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
190 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } 191 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
191 192
193/* vdso blob that is mapped into user space */
194 vdso_start = . ;
195 .vdso : AT(ADDR(.vdso) - LOAD_OFFSET) { *(.vdso) }
196 . = ALIGN(4096);
197 vdso_end = .;
198
192#ifdef CONFIG_BLK_DEV_INITRD 199#ifdef CONFIG_BLK_DEV_INITRD
193 . = ALIGN(4096); 200 . = ALIGN(4096);
194 __initramfs_start = .; 201 __initramfs_start = .;
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
index 57660d58d500..06c34949bfdc 100644
--- a/arch/x86_64/kernel/vsyscall.c
+++ b/arch/x86_64/kernel/vsyscall.c
@@ -42,6 +42,7 @@
42#include <asm/segment.h> 42#include <asm/segment.h>
43#include <asm/desc.h> 43#include <asm/desc.h>
44#include <asm/topology.h> 44#include <asm/topology.h>
45#include <asm/vgtod.h>
45 46
46#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) 47#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
47#define __syscall_clobber "r11","rcx","memory" 48#define __syscall_clobber "r11","rcx","memory"
@@ -57,26 +58,9 @@
57 * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) 58 * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64)
58 * Try to keep this structure as small as possible to avoid cache line ping pongs 59 * Try to keep this structure as small as possible to avoid cache line ping pongs
59 */ 60 */
60struct vsyscall_gtod_data_t {
61 seqlock_t lock;
62
63 /* open coded 'struct timespec' */
64 time_t wall_time_sec;
65 u32 wall_time_nsec;
66
67 int sysctl_enabled;
68 struct timezone sys_tz;
69 struct { /* extract of a clocksource struct */
70 cycle_t (*vread)(void);
71 cycle_t cycle_last;
72 cycle_t mask;
73 u32 mult;
74 u32 shift;
75 } clock;
76};
77int __vgetcpu_mode __section_vgetcpu_mode; 61int __vgetcpu_mode __section_vgetcpu_mode;
78 62
79struct vsyscall_gtod_data_t __vsyscall_gtod_data __section_vsyscall_gtod_data = 63struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data =
80{ 64{
81 .lock = SEQLOCK_UNLOCKED, 65 .lock = SEQLOCK_UNLOCKED,
82 .sysctl_enabled = 1, 66 .sysctl_enabled = 1,
@@ -96,6 +80,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
96 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; 80 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
97 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; 81 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
98 vsyscall_gtod_data.sys_tz = sys_tz; 82 vsyscall_gtod_data.sys_tz = sys_tz;
83 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
84 vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic;
99 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); 85 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
100} 86}
101 87
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 84f11728fc76..2074bddd4f04 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -301,7 +301,7 @@ static int vmalloc_fault(unsigned long address)
301 return 0; 301 return 0;
302} 302}
303 303
304int page_fault_trace = 0; 304static int page_fault_trace;
305int exception_trace = 1; 305int exception_trace = 1;
306 306
307/* 307/*
@@ -568,7 +568,7 @@ out_of_memory:
568 } 568 }
569 printk("VM: killing process %s\n", tsk->comm); 569 printk("VM: killing process %s\n", tsk->comm);
570 if (error_code & 4) 570 if (error_code & 4)
571 do_exit(SIGKILL); 571 do_group_exit(SIGKILL);
572 goto no_context; 572 goto no_context;
573 573
574do_sigbus: 574do_sigbus:
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 9a0e98accf04..381c2ecd407e 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -700,8 +700,6 @@ int kern_addr_valid(unsigned long addr)
700#ifdef CONFIG_SYSCTL 700#ifdef CONFIG_SYSCTL
701#include <linux/sysctl.h> 701#include <linux/sysctl.h>
702 702
703extern int exception_trace, page_fault_trace;
704
705static ctl_table debug_table2[] = { 703static ctl_table debug_table2[] = {
706 { 704 {
707 .ctl_name = 99, 705 .ctl_name = 99,
@@ -774,3 +772,12 @@ void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
774 return __alloc_bootmem_core(pgdat->bdata, size, 772 return __alloc_bootmem_core(pgdat->bdata, size,
775 SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0); 773 SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
776} 774}
775
776const char *arch_vma_name(struct vm_area_struct *vma)
777{
778 if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso)
779 return "[vdso]";
780 if (vma == &gate_vma)
781 return "[vsyscall]";
782 return NULL;
783}
diff --git a/arch/x86_64/mm/k8topology.c b/arch/x86_64/mm/k8topology.c
index f983c75825d0..a96006f7ae0c 100644
--- a/arch/x86_64/mm/k8topology.c
+++ b/arch/x86_64/mm/k8topology.c
@@ -44,12 +44,12 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
44{ 44{
45 unsigned long prevbase; 45 unsigned long prevbase;
46 struct bootnode nodes[8]; 46 struct bootnode nodes[8];
47 int nodeid, i, nb; 47 int nodeid, i, j, nb;
48 unsigned char nodeids[8]; 48 unsigned char nodeids[8];
49 int found = 0; 49 int found = 0;
50 u32 reg; 50 u32 reg;
51 unsigned numnodes; 51 unsigned numnodes;
52 unsigned dualcore = 0; 52 unsigned num_cores;
53 53
54 if (!early_pci_allowed()) 54 if (!early_pci_allowed())
55 return -1; 55 return -1;
@@ -60,6 +60,9 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
60 60
61 printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb); 61 printk(KERN_INFO "Scanning NUMA topology in Northbridge %d\n", nb);
62 62
63 num_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
64 printk(KERN_INFO "CPU has %d num_cores\n", num_cores);
65
63 reg = read_pci_config(0, nb, 0, 0x60); 66 reg = read_pci_config(0, nb, 0, 0x60);
64 numnodes = ((reg >> 4) & 0xF) + 1; 67 numnodes = ((reg >> 4) & 0xF) + 1;
65 if (numnodes <= 1) 68 if (numnodes <= 1)
@@ -73,8 +76,6 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
73 unsigned long base,limit; 76 unsigned long base,limit;
74 u32 nodeid; 77 u32 nodeid;
75 78
76 /* Undefined before E stepping, but hopefully 0 */
77 dualcore |= ((read_pci_config(0, nb, 3, 0xe8) >> 12) & 3) == 1;
78 base = read_pci_config(0, nb, 1, 0x40 + i*8); 79 base = read_pci_config(0, nb, 1, 0x40 + i*8);
79 limit = read_pci_config(0, nb, 1, 0x44 + i*8); 80 limit = read_pci_config(0, nb, 1, 0x44 + i*8);
80 81
@@ -170,8 +171,8 @@ int __init k8_scan_nodes(unsigned long start, unsigned long end)
170 for (i = 0; i < 8; i++) { 171 for (i = 0; i < 8; i++) {
171 if (nodes[i].start != nodes[i].end) { 172 if (nodes[i].start != nodes[i].end) {
172 nodeid = nodeids[i]; 173 nodeid = nodeids[i];
173 apicid_to_node[nodeid << dualcore] = i; 174 for (j = 0; j < num_cores; j++)
174 apicid_to_node[(nodeid << dualcore) + dualcore] = i; 175 apicid_to_node[(nodeid * num_cores) + j] = i;
175 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 176 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
176 } 177 }
177 } 178 }
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 51548947ad3b..6da235522269 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -273,9 +273,6 @@ void __init numa_init_array(void)
273 273
274#ifdef CONFIG_NUMA_EMU 274#ifdef CONFIG_NUMA_EMU
275/* Numa emulation */ 275/* Numa emulation */
276#define E820_ADDR_HOLE_SIZE(start, end) \
277 (e820_hole_size((start) >> PAGE_SHIFT, (end) >> PAGE_SHIFT) << \
278 PAGE_SHIFT)
279char *cmdline __initdata; 276char *cmdline __initdata;
280 277
281/* 278/*
@@ -319,7 +316,7 @@ static int __init split_nodes_equally(struct bootnode *nodes, u64 *addr,
319 return -1; 316 return -1;
320 if (num_nodes > MAX_NUMNODES) 317 if (num_nodes > MAX_NUMNODES)
321 num_nodes = MAX_NUMNODES; 318 num_nodes = MAX_NUMNODES;
322 size = (max_addr - *addr - E820_ADDR_HOLE_SIZE(*addr, max_addr)) / 319 size = (max_addr - *addr - e820_hole_size(*addr, max_addr)) /
323 num_nodes; 320 num_nodes;
324 /* 321 /*
325 * Calculate the number of big nodes that can be allocated as a result 322 * Calculate the number of big nodes that can be allocated as a result
@@ -347,7 +344,7 @@ static int __init split_nodes_equally(struct bootnode *nodes, u64 *addr,
347 if (i == num_nodes + node_start - 1) 344 if (i == num_nodes + node_start - 1)
348 end = max_addr; 345 end = max_addr;
349 else 346 else
350 while (end - *addr - E820_ADDR_HOLE_SIZE(*addr, end) < 347 while (end - *addr - e820_hole_size(*addr, end) <
351 size) { 348 size) {
352 end += FAKE_NODE_MIN_SIZE; 349 end += FAKE_NODE_MIN_SIZE;
353 if (end > max_addr) { 350 if (end > max_addr) {
@@ -476,18 +473,22 @@ out:
476 473
477 /* 474 /*
478 * We need to vacate all active ranges that may have been registered by 475 * We need to vacate all active ranges that may have been registered by
479 * SRAT. 476 * SRAT and set acpi_numa to -1 so that srat_disabled() always returns
477 * true. NUMA emulation has succeeded so we will not scan ACPI nodes.
480 */ 478 */
481 remove_all_active_ranges(); 479 remove_all_active_ranges();
480#ifdef CONFIG_ACPI_NUMA
481 acpi_numa = -1;
482#endif
482 for_each_node_mask(i, node_possible_map) { 483 for_each_node_mask(i, node_possible_map) {
483 e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT, 484 e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT,
484 nodes[i].end >> PAGE_SHIFT); 485 nodes[i].end >> PAGE_SHIFT);
485 setup_node_bootmem(i, nodes[i].start, nodes[i].end); 486 setup_node_bootmem(i, nodes[i].start, nodes[i].end);
486 } 487 }
488 acpi_fake_nodes(nodes, num_nodes);
487 numa_init_array(); 489 numa_init_array();
488 return 0; 490 return 0;
489} 491}
490#undef E820_ADDR_HOLE_SIZE
491#endif /* CONFIG_NUMA_EMU */ 492#endif /* CONFIG_NUMA_EMU */
492 493
493void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) 494void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index 9148f4a4cec6..36377b6b8efe 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -74,14 +74,12 @@ static void flush_kernel_map(void *arg)
74 struct page *pg; 74 struct page *pg;
75 75
76 /* When clflush is available always use it because it is 76 /* When clflush is available always use it because it is
77 much cheaper than WBINVD. Disable clflush for now because 77 much cheaper than WBINVD. */
78 the high level code is not ready yet */ 78 if (!cpu_has_clflush)
79 if (1 || !cpu_has_clflush)
80 asm volatile("wbinvd" ::: "memory"); 79 asm volatile("wbinvd" ::: "memory");
81 else list_for_each_entry(pg, l, lru) { 80 else list_for_each_entry(pg, l, lru) {
82 void *adr = page_address(pg); 81 void *adr = page_address(pg);
83 if (cpu_has_clflush) 82 cache_flush_page(adr);
84 cache_flush_page(adr);
85 } 83 }
86 __flush_tlb_all(); 84 __flush_tlb_all();
87} 85}
@@ -95,7 +93,8 @@ static LIST_HEAD(deferred_pages); /* protected by init_mm.mmap_sem */
95 93
96static inline void save_page(struct page *fpage) 94static inline void save_page(struct page *fpage)
97{ 95{
98 list_add(&fpage->lru, &deferred_pages); 96 if (!test_and_set_bit(PG_arch_1, &fpage->flags))
97 list_add(&fpage->lru, &deferred_pages);
99} 98}
100 99
101/* 100/*
@@ -129,9 +128,12 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
129 pte_t *kpte; 128 pte_t *kpte;
130 struct page *kpte_page; 129 struct page *kpte_page;
131 pgprot_t ref_prot2; 130 pgprot_t ref_prot2;
131
132 kpte = lookup_address(address); 132 kpte = lookup_address(address);
133 if (!kpte) return 0; 133 if (!kpte) return 0;
134 kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK); 134 kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK);
135 BUG_ON(PageLRU(kpte_page));
136 BUG_ON(PageCompound(kpte_page));
135 if (pgprot_val(prot) != pgprot_val(ref_prot)) { 137 if (pgprot_val(prot) != pgprot_val(ref_prot)) {
136 if (!pte_huge(*kpte)) { 138 if (!pte_huge(*kpte)) {
137 set_pte(kpte, pfn_pte(pfn, prot)); 139 set_pte(kpte, pfn_pte(pfn, prot));
@@ -159,10 +161,9 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
159 /* on x86-64 the direct mapping set at boot is not using 4k pages */ 161 /* on x86-64 the direct mapping set at boot is not using 4k pages */
160 BUG_ON(PageReserved(kpte_page)); 162 BUG_ON(PageReserved(kpte_page));
161 163
162 if (page_private(kpte_page) == 0) { 164 save_page(kpte_page);
163 save_page(kpte_page); 165 if (page_private(kpte_page) == 0)
164 revert_page(address, ref_prot); 166 revert_page(address, ref_prot);
165 }
166 return 0; 167 return 0;
167} 168}
168 169
@@ -234,6 +235,10 @@ void global_flush_tlb(void)
234 flush_map(&l); 235 flush_map(&l);
235 236
236 list_for_each_entry_safe(pg, next, &l, lru) { 237 list_for_each_entry_safe(pg, next, &l, lru) {
238 list_del(&pg->lru);
239 clear_bit(PG_arch_1, &pg->flags);
240 if (page_private(pg) != 0)
241 continue;
237 ClearPagePrivate(pg); 242 ClearPagePrivate(pg);
238 __free_page(pg); 243 __free_page(pg);
239 } 244 }
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 1e76bb0a7277..acdf03e19146 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -106,9 +106,9 @@ static __init int slit_valid(struct acpi_table_slit *slit)
106 for (j = 0; j < d; j++) { 106 for (j = 0; j < d; j++) {
107 u8 val = slit->entry[d*i + j]; 107 u8 val = slit->entry[d*i + j];
108 if (i == j) { 108 if (i == j) {
109 if (val != 10) 109 if (val != LOCAL_DISTANCE)
110 return 0; 110 return 0;
111 } else if (val <= 10) 111 } else if (val <= LOCAL_DISTANCE)
112 return 0; 112 return 0;
113 } 113 }
114 } 114 }
@@ -350,7 +350,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
350 350
351/* Sanity check to catch more bad SRATs (they are amazingly common). 351/* Sanity check to catch more bad SRATs (they are amazingly common).
352 Make sure the PXMs cover all memory. */ 352 Make sure the PXMs cover all memory. */
353static int nodes_cover_memory(void) 353static int __init nodes_cover_memory(const struct bootnode *nodes)
354{ 354{
355 int i; 355 int i;
356 unsigned long pxmram, e820ram; 356 unsigned long pxmram, e820ram;
@@ -394,6 +394,9 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
394{ 394{
395 int i; 395 int i;
396 396
397 if (acpi_numa <= 0)
398 return -1;
399
397 /* First clean up the node list */ 400 /* First clean up the node list */
398 for (i = 0; i < MAX_NUMNODES; i++) { 401 for (i = 0; i < MAX_NUMNODES; i++) {
399 cutoff_node(i, start, end); 402 cutoff_node(i, start, end);
@@ -403,10 +406,7 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
403 } 406 }
404 } 407 }
405 408
406 if (acpi_numa <= 0) 409 if (!nodes_cover_memory(nodes)) {
407 return -1;
408
409 if (!nodes_cover_memory()) {
410 bad_srat(); 410 bad_srat();
411 return -1; 411 return -1;
412 } 412 }
@@ -440,6 +440,86 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
440 return 0; 440 return 0;
441} 441}
442 442
443#ifdef CONFIG_NUMA_EMU
444static int __init find_node_by_addr(unsigned long addr)
445{
446 int ret = NUMA_NO_NODE;
447 int i;
448
449 for_each_node_mask(i, nodes_parsed) {
450 /*
451 * Find the real node that this emulated node appears on. For
452 * the sake of simplicity, we only use a real node's starting
453 * address to determine which emulated node it appears on.
454 */
455 if (addr >= nodes[i].start && addr < nodes[i].end) {
456 ret = i;
457 break;
458 }
459 }
460 return i;
461}
462
463/*
464 * In NUMA emulation, we need to setup proximity domain (_PXM) to node ID
465 * mappings that respect the real ACPI topology but reflect our emulated
466 * environment. For each emulated node, we find which real node it appears on
467 * and create PXM to NID mappings for those fake nodes which mirror that
468 * locality. SLIT will now represent the correct distances between emulated
469 * nodes as a result of the real topology.
470 */
471void __init acpi_fake_nodes(const struct bootnode *fake_nodes, int num_nodes)
472{
473 int i, j;
474 int fake_node_to_pxm_map[MAX_NUMNODES] = {
475 [0 ... MAX_NUMNODES-1] = PXM_INVAL
476 };
477 unsigned char fake_apicid_to_node[MAX_LOCAL_APIC] = {
478 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
479 };
480
481 printk(KERN_INFO "Faking PXM affinity for fake nodes on real "
482 "topology.\n");
483 for (i = 0; i < num_nodes; i++) {
484 int nid, pxm;
485
486 nid = find_node_by_addr(fake_nodes[i].start);
487 if (nid == NUMA_NO_NODE)
488 continue;
489 pxm = node_to_pxm(nid);
490 if (pxm == PXM_INVAL)
491 continue;
492 fake_node_to_pxm_map[i] = pxm;
493 /*
494 * For each apicid_to_node mapping that exists for this real
495 * node, it must now point to the fake node ID.
496 */
497 for (j = 0; j < MAX_LOCAL_APIC; j++)
498 if (apicid_to_node[j] == nid)
499 fake_apicid_to_node[j] = i;
500 }
501 for (i = 0; i < num_nodes; i++)
502 __acpi_map_pxm_to_node(fake_node_to_pxm_map[i], i);
503 memcpy(apicid_to_node, fake_apicid_to_node, sizeof(apicid_to_node));
504
505 nodes_clear(nodes_parsed);
506 for (i = 0; i < num_nodes; i++)
507 if (fake_nodes[i].start != fake_nodes[i].end)
508 node_set(i, nodes_parsed);
509 WARN_ON(!nodes_cover_memory(fake_nodes));
510}
511
512static int null_slit_node_compare(int a, int b)
513{
514 return node_to_pxm(a) == node_to_pxm(b);
515}
516#else
517static int null_slit_node_compare(int a, int b)
518{
519 return a == b;
520}
521#endif /* CONFIG_NUMA_EMU */
522
443void __init srat_reserve_add_area(int nodeid) 523void __init srat_reserve_add_area(int nodeid)
444{ 524{
445 if (found_add_area && nodes_add[nodeid].end) { 525 if (found_add_area && nodes_add[nodeid].end) {
@@ -464,7 +544,8 @@ int __node_distance(int a, int b)
464 int index; 544 int index;
465 545
466 if (!acpi_slit) 546 if (!acpi_slit)
467 return a == b ? 10 : 20; 547 return null_slit_node_compare(a, b) ? LOCAL_DISTANCE :
548 REMOTE_DISTANCE;
468 index = acpi_slit->locality_count * node_to_pxm(a); 549 index = acpi_slit->locality_count * node_to_pxm(a);
469 return acpi_slit->entry[index + node_to_pxm(b)]; 550 return acpi_slit->entry[index + node_to_pxm(b)];
470} 551}
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c
index 3acf60ded2a0..9cc813e29706 100644
--- a/arch/x86_64/pci/k8-bus.c
+++ b/arch/x86_64/pci/k8-bus.c
@@ -59,6 +59,8 @@ fill_mp_bus_to_cpumask(void)
59 j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus); 59 j <= SUBORDINATE_LDT_BUS_NUMBER(ldtbus);
60 j++) { 60 j++) {
61 struct pci_bus *bus; 61 struct pci_bus *bus;
62 struct pci_sysdata *sd;
63
62 long node = NODE_ID(nid); 64 long node = NODE_ID(nid);
63 /* Algorithm a bit dumb, but 65 /* Algorithm a bit dumb, but
64 it shouldn't matter here */ 66 it shouldn't matter here */
@@ -67,7 +69,9 @@ fill_mp_bus_to_cpumask(void)
67 continue; 69 continue;
68 if (!node_online(node)) 70 if (!node_online(node))
69 node = 0; 71 node = 0;
70 bus->sysdata = (void *)node; 72
73 sd = bus->sysdata;
74 sd->node = node;
71 } 75 }
72 } 76 }
73 } 77 }
diff --git a/arch/x86_64/vdso/Makefile b/arch/x86_64/vdso/Makefile
new file mode 100644
index 000000000000..faaa72fb250c
--- /dev/null
+++ b/arch/x86_64/vdso/Makefile
@@ -0,0 +1,49 @@
1#
2# x86-64 vDSO.
3#
4
5# files to link into the vdso
6# vdso-start.o has to be first
7vobjs-y := vdso-start.o vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
8
9# files to link into kernel
10obj-y := vma.o vdso.o vdso-syms.o
11
12vobjs := $(foreach F,$(vobjs-y),$(obj)/$F)
13
14$(obj)/vdso.o: $(obj)/vdso.so
15
16targets += vdso.so vdso.lds $(vobjs-y) vdso-syms.o
17
18# The DSO images are built using a special linker script.
19quiet_cmd_syscall = SYSCALL $@
20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
21 -Wl,-T,$(filter-out FORCE,$^) -o $@
22
23export CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
24
25vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
26 $(call ld-option, -Wl$(comma)--hash-style=sysv) \
27 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
28SYSCFLAGS_vdso.so = $(vdso-flags)
29
30$(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
31
32$(obj)/vdso.so: $(src)/vdso.lds $(vobjs) FORCE
33 $(call if_changed,syscall)
34
35CF := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64
36
37$(obj)/vclock_gettime.o: CFLAGS = $(CF)
38$(obj)/vgetcpu.o: CFLAGS = $(CF)
39
40# We also create a special relocatable object that should mirror the symbol
41# table and layout of the linked DSO. With ld -R we can then refer to
42# these symbols in the kernel code rather than hand-coded addresses.
43extra-y += vdso-syms.o
44$(obj)/built-in.o: $(obj)/vdso-syms.o
45$(obj)/built-in.o: ld_flags += -R $(obj)/vdso-syms.o
46
47SYSCFLAGS_vdso-syms.o = -r -d
48$(obj)/vdso-syms.o: $(src)/vdso.lds $(vobjs) FORCE
49 $(call if_changed,syscall)
diff --git a/arch/x86_64/vdso/vclock_gettime.c b/arch/x86_64/vdso/vclock_gettime.c
new file mode 100644
index 000000000000..17f6a00de712
--- /dev/null
+++ b/arch/x86_64/vdso/vclock_gettime.c
@@ -0,0 +1,120 @@
1/*
2 * Copyright 2006 Andi Kleen, SUSE Labs.
3 * Subject to the GNU Public License, v.2
4 *
5 * Fast user context implementation of clock_gettime and gettimeofday.
6 *
7 * The code should have no internal unresolved relocations.
8 * Check with readelf after changing.
9 * Also alternative() doesn't work.
10 */
11
12#include <linux/kernel.h>
13#include <linux/posix-timers.h>
14#include <linux/time.h>
15#include <linux/string.h>
16#include <asm/vsyscall.h>
17#include <asm/vgtod.h>
18#include <asm/timex.h>
19#include <asm/hpet.h>
20#include <asm/unistd.h>
21#include <asm/io.h>
22#include <asm/vgtod.h>
23#include "vextern.h"
24
25#define gtod vdso_vsyscall_gtod_data
26
27static long vdso_fallback_gettime(long clock, struct timespec *ts)
28{
29 long ret;
30 asm("syscall" : "=a" (ret) :
31 "0" (__NR_clock_gettime),"D" (clock), "S" (ts) : "memory");
32 return ret;
33}
34
35static inline long vgetns(void)
36{
37 cycles_t (*vread)(void);
38 vread = gtod->clock.vread;
39 return ((vread() - gtod->clock.cycle_last) * gtod->clock.mult) >>
40 gtod->clock.shift;
41}
42
43static noinline int do_realtime(struct timespec *ts)
44{
45 unsigned long seq, ns;
46 do {
47 seq = read_seqbegin(&gtod->lock);
48 ts->tv_sec = gtod->wall_time_sec;
49 ts->tv_nsec = gtod->wall_time_nsec;
50 ns = vgetns();
51 } while (unlikely(read_seqretry(&gtod->lock, seq)));
52 timespec_add_ns(ts, ns);
53 return 0;
54}
55
56/* Copy of the version in kernel/time.c which we cannot directly access */
57static void vset_normalized_timespec(struct timespec *ts, long sec, long nsec)
58{
59 while (nsec >= NSEC_PER_SEC) {
60 nsec -= NSEC_PER_SEC;
61 ++sec;
62 }
63 while (nsec < 0) {
64 nsec += NSEC_PER_SEC;
65 --sec;
66 }
67 ts->tv_sec = sec;
68 ts->tv_nsec = nsec;
69}
70
71static noinline int do_monotonic(struct timespec *ts)
72{
73 unsigned long seq, ns, secs;
74 do {
75 seq = read_seqbegin(&gtod->lock);
76 secs = gtod->wall_time_sec;
77 ns = gtod->wall_time_nsec + vgetns();
78 secs += gtod->wall_to_monotonic.tv_sec;
79 ns += gtod->wall_to_monotonic.tv_nsec;
80 } while (unlikely(read_seqretry(&gtod->lock, seq)));
81 vset_normalized_timespec(ts, secs, ns);
82 return 0;
83}
84
85int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
86{
87 if (likely(gtod->sysctl_enabled && gtod->clock.vread))
88 switch (clock) {
89 case CLOCK_REALTIME:
90 return do_realtime(ts);
91 case CLOCK_MONOTONIC:
92 return do_monotonic(ts);
93 }
94 return vdso_fallback_gettime(clock, ts);
95}
96int clock_gettime(clockid_t, struct timespec *)
97 __attribute__((weak, alias("__vdso_clock_gettime")));
98
99int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
100{
101 long ret;
102 if (likely(gtod->sysctl_enabled && gtod->clock.vread)) {
103 BUILD_BUG_ON(offsetof(struct timeval, tv_usec) !=
104 offsetof(struct timespec, tv_nsec) ||
105 sizeof(*tv) != sizeof(struct timespec));
106 do_realtime((struct timespec *)tv);
107 tv->tv_usec /= 1000;
108 if (unlikely(tz != NULL)) {
109 /* This relies on gcc inlining the memcpy. We'll notice
110 if it ever fails to do so. */
111 memcpy(tz, &gtod->sys_tz, sizeof(struct timezone));
112 }
113 return 0;
114 }
115 asm("syscall" : "=a" (ret) :
116 "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory");
117 return ret;
118}
119int gettimeofday(struct timeval *, struct timezone *)
120 __attribute__((weak, alias("__vdso_gettimeofday")));
diff --git a/arch/x86_64/vdso/vdso-note.S b/arch/x86_64/vdso/vdso-note.S
new file mode 100644
index 000000000000..79a071e4357e
--- /dev/null
+++ b/arch/x86_64/vdso/vdso-note.S
@@ -0,0 +1,12 @@
1/*
2 * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
3 * Here we can supply some information useful to userland.
4 */
5
6#include <linux/uts.h>
7#include <linux/version.h>
8#include <linux/elfnote.h>
9
10ELFNOTE_START(Linux, 0, "a")
11 .long LINUX_VERSION_CODE
12ELFNOTE_END
diff --git a/arch/x86_64/vdso/vdso-start.S b/arch/x86_64/vdso/vdso-start.S
new file mode 100644
index 000000000000..2dc2cdb84d67
--- /dev/null
+++ b/arch/x86_64/vdso/vdso-start.S
@@ -0,0 +1,2 @@
1 .globl vdso_kernel_start
2vdso_kernel_start:
diff --git a/arch/x86_64/vdso/vdso.S b/arch/x86_64/vdso/vdso.S
new file mode 100644
index 000000000000..92e80c1972a7
--- /dev/null
+++ b/arch/x86_64/vdso/vdso.S
@@ -0,0 +1,2 @@
1 .section ".vdso","a"
2 .incbin "arch/x86_64/vdso/vdso.so"
diff --git a/arch/x86_64/vdso/vdso.lds.S b/arch/x86_64/vdso/vdso.lds.S
new file mode 100644
index 000000000000..b9a60e665d08
--- /dev/null
+++ b/arch/x86_64/vdso/vdso.lds.S
@@ -0,0 +1,77 @@
1/*
2 * Linker script for vsyscall DSO. The vsyscall page is an ELF shared
3 * object prelinked to its virtual address, and with only one read-only
4 * segment (that fits in one page). This script controls its layout.
5 */
6#include <asm/asm-offsets.h>
7#include "voffset.h"
8
9#define VDSO_PRELINK 0xffffffffff700000
10
11SECTIONS
12{
13 . = VDSO_PRELINK + SIZEOF_HEADERS;
14
15 .hash : { *(.hash) } :text
16 .gnu.hash : { *(.gnu.hash) }
17 .dynsym : { *(.dynsym) }
18 .dynstr : { *(.dynstr) }
19 .gnu.version : { *(.gnu.version) }
20 .gnu.version_d : { *(.gnu.version_d) }
21 .gnu.version_r : { *(.gnu.version_r) }
22
23 /* This linker script is used both with -r and with -shared.
24 For the layouts to match, we need to skip more than enough
25 space for the dynamic symbol table et al. If this amount
26 is insufficient, ld -shared will barf. Just increase it here. */
27 . = VDSO_PRELINK + VDSO_TEXT_OFFSET;
28
29 .text : { *(.text) } :text
30 .text.ptr : { *(.text.ptr) } :text
31 . = VDSO_PRELINK + 0x900;
32 .data : { *(.data) } :text
33 .bss : { *(.bss) } :text
34
35 .altinstructions : { *(.altinstructions) } :text
36 .altinstr_replacement : { *(.altinstr_replacement) } :text
37
38 .note : { *(.note.*) } :text :note
39 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
40 .eh_frame : { KEEP (*(.eh_frame)) } :text
41 .dynamic : { *(.dynamic) } :text :dynamic
42 .useless : {
43 *(.got.plt) *(.got)
44 *(.gnu.linkonce.d.*)
45 *(.dynbss)
46 *(.gnu.linkonce.b.*)
47 } :text
48}
49
50/*
51 * We must supply the ELF program headers explicitly to get just one
52 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
53 */
54PHDRS
55{
56 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
57 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
58 note PT_NOTE FLAGS(4); /* PF_R */
59 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
60}
61
62/*
63 * This controls what symbols we export from the DSO.
64 */
65VERSION
66{
67 LINUX_2.6 {
68 global:
69 clock_gettime;
70 __vdso_clock_gettime;
71 gettimeofday;
72 __vdso_gettimeofday;
73 getcpu;
74 __vdso_getcpu;
75 local: *;
76 };
77}
diff --git a/arch/x86_64/vdso/vextern.h b/arch/x86_64/vdso/vextern.h
new file mode 100644
index 000000000000..1683ba2ae3e8
--- /dev/null
+++ b/arch/x86_64/vdso/vextern.h
@@ -0,0 +1,16 @@
1#ifndef VEXTERN
2#include <asm/vsyscall.h>
3#define VEXTERN(x) \
4 extern typeof(x) *vdso_ ## x __attribute__((visibility("hidden")));
5#endif
6
7#define VMAGIC 0xfeedbabeabcdefabUL
8
9/* Any kernel variables used in the vDSO must be exported in the main
10 kernel's vmlinux.lds.S/vsyscall.h/proper __section and
11 put into vextern.h and be referenced as a pointer with vdso prefix.
12 The main kernel later fills in the values. */
13
14VEXTERN(jiffies)
15VEXTERN(vgetcpu_mode)
16VEXTERN(vsyscall_gtod_data)
diff --git a/arch/x86_64/vdso/vgetcpu.c b/arch/x86_64/vdso/vgetcpu.c
new file mode 100644
index 000000000000..91f6e85d0fc2
--- /dev/null
+++ b/arch/x86_64/vdso/vgetcpu.c
@@ -0,0 +1,50 @@
1/*
2 * Copyright 2006 Andi Kleen, SUSE Labs.
3 * Subject to the GNU Public License, v.2
4 *
5 * Fast user context implementation of getcpu()
6 */
7
8#include <linux/kernel.h>
9#include <linux/getcpu.h>
10#include <linux/jiffies.h>
11#include <linux/time.h>
12#include <asm/vsyscall.h>
13#include <asm/vgtod.h>
14#include "vextern.h"
15
16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
17{
18 unsigned int dummy, p;
19 unsigned long j = 0;
20
21 /* Fast cache - only recompute value once per jiffies and avoid
22 relatively costly rdtscp/cpuid otherwise.
23 This works because the scheduler usually keeps the process
24 on the same CPU and this syscall doesn't guarantee its
25 results anyways.
26 We do this here because otherwise user space would do it on
27 its own in a likely inferior way (no access to jiffies).
28 If you don't like it pass NULL. */
29 if (tcache && tcache->blob[0] == (j = *vdso_jiffies)) {
30 p = tcache->blob[1];
31 } else if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) {
32 /* Load per CPU data from RDTSCP */
33 rdtscp(dummy, dummy, p);
34 } else {
35 /* Load per CPU data from GDT */
36 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
37 }
38 if (tcache) {
39 tcache->blob[0] = j;
40 tcache->blob[1] = p;
41 }
42 if (cpu)
43 *cpu = p & 0xfff;
44 if (node)
45 *node = p >> 12;
46 return 0;
47}
48
49long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
50 __attribute__((weak, alias("__vdso_getcpu")));
diff --git a/arch/x86_64/vdso/vma.c b/arch/x86_64/vdso/vma.c
new file mode 100644
index 000000000000..d4cb83a6c066
--- /dev/null
+++ b/arch/x86_64/vdso/vma.c
@@ -0,0 +1,139 @@
1/*
2 * Set up the VMAs to tell the VM about the vDSO.
3 * Copyright 2007 Andi Kleen, SUSE Labs.
4 * Subject to the GPL, v.2
5 */
6#include <linux/mm.h>
7#include <linux/sched.h>
8#include <linux/init.h>
9#include <linux/random.h>
10#include <asm/vsyscall.h>
11#include <asm/vgtod.h>
12#include <asm/proto.h>
13#include "voffset.h"
14
15int vdso_enabled = 1;
16
17#define VEXTERN(x) extern typeof(__ ## x) *vdso_ ## x;
18#include "vextern.h"
19#undef VEXTERN
20
21extern char vdso_kernel_start[], vdso_start[], vdso_end[];
22extern unsigned short vdso_sync_cpuid;
23
24struct page **vdso_pages;
25
26static inline void *var_ref(void *vbase, char *var, char *name)
27{
28 unsigned offset = var - &vdso_kernel_start[0] + VDSO_TEXT_OFFSET;
29 void *p = vbase + offset;
30 if (*(void **)p != (void *)VMAGIC) {
31 printk("VDSO: variable %s broken\n", name);
32 vdso_enabled = 0;
33 }
34 return p;
35}
36
37static int __init init_vdso_vars(void)
38{
39 int npages = (vdso_end - vdso_start + PAGE_SIZE - 1) / PAGE_SIZE;
40 int i;
41 char *vbase;
42
43 vdso_pages = kmalloc(sizeof(struct page *) * npages, GFP_KERNEL);
44 if (!vdso_pages)
45 goto oom;
46 for (i = 0; i < npages; i++) {
47 struct page *p;
48 p = alloc_page(GFP_KERNEL);
49 if (!p)
50 goto oom;
51 vdso_pages[i] = p;
52 copy_page(page_address(p), vdso_start + i*PAGE_SIZE);
53 }
54
55 vbase = vmap(vdso_pages, npages, 0, PAGE_KERNEL);
56 if (!vbase)
57 goto oom;
58
59 if (memcmp(vbase, "\177ELF", 4)) {
60 printk("VDSO: I'm broken; not ELF\n");
61 vdso_enabled = 0;
62 }
63
64#define V(x) *(typeof(x) *) var_ref(vbase, (char *)RELOC_HIDE(&x, 0), #x)
65#define VEXTERN(x) \
66 V(vdso_ ## x) = &__ ## x;
67#include "vextern.h"
68#undef VEXTERN
69 return 0;
70
71 oom:
72 printk("Cannot allocate vdso\n");
73 vdso_enabled = 0;
74 return -ENOMEM;
75}
76__initcall(init_vdso_vars);
77
78struct linux_binprm;
79
80/* Put the vdso above the (randomized) stack with another randomized offset.
81 This way there is no hole in the middle of address space.
82 To save memory make sure it is still in the same PTE as the stack top.
83 This doesn't give that many random bits */
84static unsigned long vdso_addr(unsigned long start, unsigned len)
85{
86 unsigned long addr, end;
87 unsigned offset;
88 end = (start + PMD_SIZE - 1) & PMD_MASK;
89 if (end >= TASK_SIZE64)
90 end = TASK_SIZE64;
91 end -= len;
92 /* This loses some more bits than a modulo, but is cheaper */
93 offset = get_random_int() & (PTRS_PER_PTE - 1);
94 addr = start + (offset << PAGE_SHIFT);
95 if (addr >= end)
96 addr = end;
97 return addr;
98}
99
100/* Setup a VMA at program startup for the vsyscall page.
101 Not called for compat tasks */
102int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
103{
104 struct mm_struct *mm = current->mm;
105 unsigned long addr;
106 int ret;
107 unsigned len = round_up(vdso_end - vdso_start, PAGE_SIZE);
108
109 if (!vdso_enabled)
110 return 0;
111
112 down_write(&mm->mmap_sem);
113 addr = vdso_addr(mm->start_stack, len);
114 addr = get_unmapped_area(NULL, addr, len, 0, 0);
115 if (IS_ERR_VALUE(addr)) {
116 ret = addr;
117 goto up_fail;
118 }
119
120 ret = install_special_mapping(mm, addr, len,
121 VM_READ|VM_EXEC|
122 VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
123 VM_ALWAYSDUMP,
124 vdso_pages);
125 if (ret)
126 goto up_fail;
127
128 current->mm->context.vdso = (void *)addr;
129up_fail:
130 up_write(&mm->mmap_sem);
131 return ret;
132}
133
134static __init int vdso_setup(char *s)
135{
136 vdso_enabled = simple_strtoul(s, NULL, 0);
137 return 0;
138}
139__setup("vdso=", vdso_setup);
diff --git a/arch/x86_64/vdso/voffset.h b/arch/x86_64/vdso/voffset.h
new file mode 100644
index 000000000000..5304204911f2
--- /dev/null
+++ b/arch/x86_64/vdso/voffset.h
@@ -0,0 +1 @@
#define VDSO_TEXT_OFFSET 0x500
diff --git a/arch/x86_64/vdso/vvar.c b/arch/x86_64/vdso/vvar.c
new file mode 100644
index 000000000000..6fc22219a472
--- /dev/null
+++ b/arch/x86_64/vdso/vvar.c
@@ -0,0 +1,12 @@
1/* Define pointer to external vDSO variables.
2 These are part of the vDSO. The kernel fills in the real addresses
3 at boot time. This is done because when the vdso is linked the
4 kernel isn't yet and we don't know the final addresses. */
5#include <linux/kernel.h>
6#include <linux/time.h>
7#include <asm/vsyscall.h>
8#include <asm/timex.h>
9#include <asm/vgtod.h>
10
11#define VEXTERN(x) typeof (__ ## x) *vdso_ ## x = (void *)VMAGIC;
12#include "vextern.h"