aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-08-09 11:51:35 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-08-09 11:51:35 -0400
commitc973b112c76c9d8fd042991128f218a738cc8d0a (patch)
treee813b0da5d0a0e19e06de6462d145a29ad683026 /arch/x86_64
parentc5fbc3966f48279dbebfde10248c977014aa9988 (diff)
parent00dd1e433967872f3997a45d5adf35056fdf2f56 (diff)
Merge with /shiny/git/linux-2.6/.git
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/Kconfig5
-rw-r--r--arch/x86_64/Makefile12
-rw-r--r--arch/x86_64/crypto/aes.c1
-rw-r--r--arch/x86_64/defconfig224
-rw-r--r--arch/x86_64/ia32/Makefile4
-rw-r--r--arch/x86_64/ia32/ia32_aout.c6
-rw-r--r--arch/x86_64/ia32/ptrace32.c8
-rw-r--r--arch/x86_64/ia32/syscall32.c10
-rw-r--r--arch/x86_64/ia32/syscall32_syscall.S17
-rw-r--r--arch/x86_64/kernel/entry.S22
-rw-r--r--arch/x86_64/kernel/genapic.c33
-rw-r--r--arch/x86_64/kernel/genapic_flat.c142
-rw-r--r--arch/x86_64/kernel/head.S16
-rw-r--r--arch/x86_64/kernel/irq.c19
-rw-r--r--arch/x86_64/kernel/machine_kexec.c101
-rw-r--r--arch/x86_64/kernel/mce.c109
-rw-r--r--arch/x86_64/kernel/mpparse.c34
-rw-r--r--arch/x86_64/kernel/setup.c11
-rw-r--r--arch/x86_64/kernel/setup64.c18
-rw-r--r--arch/x86_64/kernel/smp.c66
-rw-r--r--arch/x86_64/kernel/smpboot.c94
-rw-r--r--arch/x86_64/kernel/traps.c3
-rw-r--r--arch/x86_64/lib/csum-copy.S2
-rw-r--r--arch/x86_64/lib/delay.c2
-rw-r--r--arch/x86_64/mm/fault.c7
-rw-r--r--arch/x86_64/mm/numa.c50
-rw-r--r--arch/x86_64/mm/srat.c22
-rw-r--r--arch/x86_64/pci/k8-bus.c2
28 files changed, 612 insertions, 428 deletions
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 4b8326177c52..660a03a89e66 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -329,12 +329,15 @@ config HPET_EMULATE_RTC
329 329
330config GART_IOMMU 330config GART_IOMMU
331 bool "IOMMU support" 331 bool "IOMMU support"
332 default y
332 depends on PCI 333 depends on PCI
333 help 334 help
334 Support the K8 IOMMU. Needed to run systems with more than 4GB of memory 335 Support the IOMMU. Needed to run systems with more than 3GB of memory
335 properly with 32-bit PCI devices that do not support DAC (Double Address 336 properly with 32-bit PCI devices that do not support DAC (Double Address
336 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. 337 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter.
337 Normally the kernel will take the right choice by itself. 338 Normally the kernel will take the right choice by itself.
339 This option includes a driver for the AMD Opteron/Athlon64 IOMMU
340 and a software emulation used on some other systems.
338 If unsure, say Y. 341 If unsure, say Y.
339 342
340# need this always enabled with GART_IOMMU for the VIA workaround 343# need this always enabled with GART_IOMMU for the VIA workaround
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 428915697675..4c6ed96d5f7c 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -21,18 +21,6 @@
21# 21#
22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ 22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $
23 23
24#
25# early bootup linking needs 32bit. You can either use real 32bit tools
26# here or 64bit tools in 32bit mode.
27#
28IA32_CC := $(CC) $(CPPFLAGS) -m32 -O2 -fomit-frame-pointer
29IA32_LD := $(LD) -m elf_i386
30IA32_AS := $(CC) $(AFLAGS) -m32 -Wa,--32 -traditional -c
31IA32_OBJCOPY := $(CROSS_COMPILE)objcopy
32IA32_CPP := $(CROSS_COMPILE)gcc -m32 -E
33export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
34
35
36LDFLAGS := -m elf_x86_64 24LDFLAGS := -m elf_x86_64
37OBJCOPYFLAGS := -O binary -R .note -R .comment -S 25OBJCOPYFLAGS := -O binary -R .note -R .comment -S
38LDFLAGS_vmlinux := 26LDFLAGS_vmlinux :=
diff --git a/arch/x86_64/crypto/aes.c b/arch/x86_64/crypto/aes.c
index 2b5c4010ce38..acfdaa28791e 100644
--- a/arch/x86_64/crypto/aes.c
+++ b/arch/x86_64/crypto/aes.c
@@ -322,3 +322,4 @@ module_exit(aes_fini);
322 322
323MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm"); 323MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm");
324MODULE_LICENSE("GPL"); 324MODULE_LICENSE("GPL");
325MODULE_ALIAS("aes");
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 569595b74c7c..776f3c866b70 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/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.12-rc4 3# Linux kernel version: 2.6.13-rc3
4# Fri May 13 06:39:11 2005 4# Fri Jul 22 16:47:31 2005
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -84,14 +84,27 @@ CONFIG_X86_IO_APIC=y
84CONFIG_X86_LOCAL_APIC=y 84CONFIG_X86_LOCAL_APIC=y
85CONFIG_MTRR=y 85CONFIG_MTRR=y
86CONFIG_SMP=y 86CONFIG_SMP=y
87# CONFIG_PREEMPT is not set
88CONFIG_SCHED_SMT=y 87CONFIG_SCHED_SMT=y
88CONFIG_PREEMPT_NONE=y
89# CONFIG_PREEMPT_VOLUNTARY is not set
90# CONFIG_PREEMPT is not set
91CONFIG_PREEMPT_BKL=y
89CONFIG_K8_NUMA=y 92CONFIG_K8_NUMA=y
90# CONFIG_NUMA_EMU is not set 93# CONFIG_NUMA_EMU is not set
91CONFIG_DISCONTIGMEM=y 94CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
92CONFIG_NUMA=y 95CONFIG_NUMA=y
96CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
97CONFIG_ARCH_SPARSEMEM_ENABLE=y
98CONFIG_SELECT_MEMORY_MODEL=y
99# CONFIG_FLATMEM_MANUAL is not set
100CONFIG_DISCONTIGMEM_MANUAL=y
101# CONFIG_SPARSEMEM_MANUAL is not set
102CONFIG_DISCONTIGMEM=y
103CONFIG_FLAT_NODE_MEM_MAP=y
104CONFIG_NEED_MULTIPLE_NODES=y
105CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
93CONFIG_HAVE_DEC_LOCK=y 106CONFIG_HAVE_DEC_LOCK=y
94CONFIG_NR_CPUS=8 107CONFIG_NR_CPUS=32
95CONFIG_HPET_TIMER=y 108CONFIG_HPET_TIMER=y
96CONFIG_X86_PM_TIMER=y 109CONFIG_X86_PM_TIMER=y
97CONFIG_HPET_EMULATE_RTC=y 110CONFIG_HPET_EMULATE_RTC=y
@@ -99,7 +112,13 @@ CONFIG_GART_IOMMU=y
99CONFIG_SWIOTLB=y 112CONFIG_SWIOTLB=y
100CONFIG_X86_MCE=y 113CONFIG_X86_MCE=y
101CONFIG_X86_MCE_INTEL=y 114CONFIG_X86_MCE_INTEL=y
115CONFIG_PHYSICAL_START=0x100000
116# CONFIG_KEXEC is not set
102CONFIG_SECCOMP=y 117CONFIG_SECCOMP=y
118# CONFIG_HZ_100 is not set
119CONFIG_HZ_250=y
120# CONFIG_HZ_1000 is not set
121CONFIG_HZ=250
103CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
104CONFIG_GENERIC_IRQ_PROBE=y 123CONFIG_GENERIC_IRQ_PROBE=y
105CONFIG_ISA_DMA_API=y 124CONFIG_ISA_DMA_API=y
@@ -118,12 +137,11 @@ CONFIG_PM_STD_PARTITION=""
118CONFIG_ACPI=y 137CONFIG_ACPI=y
119CONFIG_ACPI_BOOT=y 138CONFIG_ACPI_BOOT=y
120CONFIG_ACPI_INTERPRETER=y 139CONFIG_ACPI_INTERPRETER=y
121CONFIG_ACPI_SLEEP=y
122CONFIG_ACPI_SLEEP_PROC_FS=y
123CONFIG_ACPI_AC=y 140CONFIG_ACPI_AC=y
124CONFIG_ACPI_BATTERY=y 141CONFIG_ACPI_BATTERY=y
125CONFIG_ACPI_BUTTON=y 142CONFIG_ACPI_BUTTON=y
126# CONFIG_ACPI_VIDEO is not set 143# CONFIG_ACPI_VIDEO is not set
144CONFIG_ACPI_HOTKEY=m
127CONFIG_ACPI_FAN=y 145CONFIG_ACPI_FAN=y
128CONFIG_ACPI_PROCESSOR=y 146CONFIG_ACPI_PROCESSOR=y
129CONFIG_ACPI_THERMAL=y 147CONFIG_ACPI_THERMAL=y
@@ -154,6 +172,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
154# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 172# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
155CONFIG_CPU_FREQ_GOV_USERSPACE=y 173CONFIG_CPU_FREQ_GOV_USERSPACE=y
156CONFIG_CPU_FREQ_GOV_ONDEMAND=y 174CONFIG_CPU_FREQ_GOV_ONDEMAND=y
175# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
157 176
158# 177#
159# CPUFreq processor drivers 178# CPUFreq processor drivers
@@ -204,6 +223,76 @@ CONFIG_SYSVIPC_COMPAT=y
204CONFIG_UID16=y 223CONFIG_UID16=y
205 224
206# 225#
226# Networking
227#
228CONFIG_NET=y
229
230#
231# Networking options
232#
233CONFIG_PACKET=y
234# CONFIG_PACKET_MMAP is not set
235CONFIG_UNIX=y
236# CONFIG_NET_KEY is not set
237CONFIG_INET=y
238CONFIG_IP_MULTICAST=y
239# CONFIG_IP_ADVANCED_ROUTER is not set
240CONFIG_IP_FIB_HASH=y
241# CONFIG_IP_PNP is not set
242# CONFIG_NET_IPIP is not set
243# CONFIG_NET_IPGRE is not set
244# CONFIG_IP_MROUTE is not set
245# CONFIG_ARPD is not set
246# CONFIG_SYN_COOKIES is not set
247# CONFIG_INET_AH is not set
248# CONFIG_INET_ESP is not set
249# CONFIG_INET_IPCOMP is not set
250# CONFIG_INET_TUNNEL is not set
251CONFIG_IP_TCPDIAG=y
252CONFIG_IP_TCPDIAG_IPV6=y
253# CONFIG_TCP_CONG_ADVANCED is not set
254CONFIG_TCP_CONG_BIC=y
255CONFIG_IPV6=y
256# CONFIG_IPV6_PRIVACY is not set
257# CONFIG_INET6_AH is not set
258# CONFIG_INET6_ESP is not set
259# CONFIG_INET6_IPCOMP is not set
260# CONFIG_INET6_TUNNEL is not set
261# CONFIG_IPV6_TUNNEL is not set
262# CONFIG_NETFILTER is not set
263
264#
265# SCTP Configuration (EXPERIMENTAL)
266#
267# CONFIG_IP_SCTP is not set
268# CONFIG_ATM is not set
269# CONFIG_BRIDGE is not set
270# CONFIG_VLAN_8021Q is not set
271# CONFIG_DECNET is not set
272# CONFIG_LLC2 is not set
273# CONFIG_IPX is not set
274# CONFIG_ATALK is not set
275# CONFIG_X25 is not set
276# CONFIG_LAPB is not set
277# CONFIG_NET_DIVERT is not set
278# CONFIG_ECONET is not set
279# CONFIG_WAN_ROUTER is not set
280# CONFIG_NET_SCHED is not set
281# CONFIG_NET_CLS_ROUTE is not set
282
283#
284# Network testing
285#
286# CONFIG_NET_PKTGEN is not set
287CONFIG_NETPOLL=y
288# CONFIG_NETPOLL_RX is not set
289# CONFIG_NETPOLL_TRAP is not set
290CONFIG_NET_POLL_CONTROLLER=y
291# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set
293# CONFIG_BT is not set
294
295#
207# Device Drivers 296# Device Drivers
208# 297#
209 298
@@ -308,6 +397,7 @@ CONFIG_BLK_DEV_AMD74XX=y
308# CONFIG_BLK_DEV_HPT366 is not set 397# CONFIG_BLK_DEV_HPT366 is not set
309# CONFIG_BLK_DEV_SC1200 is not set 398# CONFIG_BLK_DEV_SC1200 is not set
310CONFIG_BLK_DEV_PIIX=y 399CONFIG_BLK_DEV_PIIX=y
400# CONFIG_BLK_DEV_IT821X is not set
311# CONFIG_BLK_DEV_NS87415 is not set 401# CONFIG_BLK_DEV_NS87415 is not set
312# CONFIG_BLK_DEV_PDC202XX_OLD is not set 402# CONFIG_BLK_DEV_PDC202XX_OLD is not set
313CONFIG_BLK_DEV_PDC202XX_NEW=y 403CONFIG_BLK_DEV_PDC202XX_NEW=y
@@ -338,6 +428,7 @@ CONFIG_BLK_DEV_SD=y
338# CONFIG_CHR_DEV_OSST is not set 428# CONFIG_CHR_DEV_OSST is not set
339# CONFIG_BLK_DEV_SR is not set 429# CONFIG_BLK_DEV_SR is not set
340# CONFIG_CHR_DEV_SG is not set 430# CONFIG_CHR_DEV_SG is not set
431# CONFIG_CHR_DEV_SCH is not set
341 432
342# 433#
343# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 434# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -372,7 +463,6 @@ CONFIG_AIC79XX_DEBUG_MASK=0
372# CONFIG_MEGARAID_NEWGEN is not set 463# CONFIG_MEGARAID_NEWGEN is not set
373# CONFIG_MEGARAID_LEGACY is not set 464# CONFIG_MEGARAID_LEGACY is not set
374CONFIG_SCSI_SATA=y 465CONFIG_SCSI_SATA=y
375# CONFIG_SCSI_SATA_AHCI is not set
376# CONFIG_SCSI_SATA_SVW is not set 466# CONFIG_SCSI_SATA_SVW is not set
377CONFIG_SCSI_ATA_PIIX=y 467CONFIG_SCSI_ATA_PIIX=y
378# CONFIG_SCSI_SATA_NV is not set 468# CONFIG_SCSI_SATA_NV is not set
@@ -410,14 +500,21 @@ CONFIG_SCSI_QLA2XXX=y
410# 500#
411# Multi-device support (RAID and LVM) 501# Multi-device support (RAID and LVM)
412# 502#
413# CONFIG_MD is not set 503CONFIG_MD=y
504# CONFIG_BLK_DEV_MD is not set
505CONFIG_BLK_DEV_DM=y
506# CONFIG_DM_CRYPT is not set
507# CONFIG_DM_SNAPSHOT is not set
508# CONFIG_DM_MIRROR is not set
509# CONFIG_DM_ZERO is not set
510# CONFIG_DM_MULTIPATH is not set
414 511
415# 512#
416# Fusion MPT device support 513# Fusion MPT device support
417# 514#
418CONFIG_FUSION=y 515# CONFIG_FUSION is not set
419CONFIG_FUSION_MAX_SGE=40 516# CONFIG_FUSION_SPI is not set
420# CONFIG_FUSION_CTL is not set 517# CONFIG_FUSION_FC is not set
421 518
422# 519#
423# IEEE 1394 (FireWire) support 520# IEEE 1394 (FireWire) support
@@ -430,75 +527,8 @@ CONFIG_FUSION_MAX_SGE=40
430# CONFIG_I2O is not set 527# CONFIG_I2O is not set
431 528
432# 529#
433# Networking support 530# Network device support
434#
435CONFIG_NET=y
436
437#
438# Networking options
439#
440CONFIG_PACKET=y
441# CONFIG_PACKET_MMAP is not set
442CONFIG_UNIX=y
443# CONFIG_NET_KEY is not set
444CONFIG_INET=y
445CONFIG_IP_MULTICAST=y
446# CONFIG_IP_ADVANCED_ROUTER is not set
447# CONFIG_IP_PNP is not set
448# CONFIG_NET_IPIP is not set
449# CONFIG_NET_IPGRE is not set
450# CONFIG_IP_MROUTE is not set
451# CONFIG_ARPD is not set
452# CONFIG_SYN_COOKIES is not set
453# CONFIG_INET_AH is not set
454# CONFIG_INET_ESP is not set
455# CONFIG_INET_IPCOMP is not set
456# CONFIG_INET_TUNNEL is not set
457CONFIG_IP_TCPDIAG=y
458CONFIG_IP_TCPDIAG_IPV6=y
459CONFIG_IPV6=y
460# CONFIG_IPV6_PRIVACY is not set
461# CONFIG_INET6_AH is not set
462# CONFIG_INET6_ESP is not set
463# CONFIG_INET6_IPCOMP is not set
464# CONFIG_INET6_TUNNEL is not set
465# CONFIG_IPV6_TUNNEL is not set
466# CONFIG_NETFILTER is not set
467
468#
469# SCTP Configuration (EXPERIMENTAL)
470# 531#
471# CONFIG_IP_SCTP is not set
472# CONFIG_ATM is not set
473# CONFIG_BRIDGE is not set
474# CONFIG_VLAN_8021Q is not set
475# CONFIG_DECNET is not set
476# CONFIG_LLC2 is not set
477# CONFIG_IPX is not set
478# CONFIG_ATALK is not set
479# CONFIG_X25 is not set
480# CONFIG_LAPB is not set
481# CONFIG_NET_DIVERT is not set
482# CONFIG_ECONET is not set
483# CONFIG_WAN_ROUTER is not set
484
485#
486# QoS and/or fair queueing
487#
488# CONFIG_NET_SCHED is not set
489# CONFIG_NET_CLS_ROUTE is not set
490
491#
492# Network testing
493#
494# CONFIG_NET_PKTGEN is not set
495CONFIG_NETPOLL=y
496# CONFIG_NETPOLL_RX is not set
497# CONFIG_NETPOLL_TRAP is not set
498CONFIG_NET_POLL_CONTROLLER=y
499# CONFIG_HAMRADIO is not set
500# CONFIG_IRDA is not set
501# CONFIG_BT is not set
502CONFIG_NETDEVICES=y 532CONFIG_NETDEVICES=y
503# CONFIG_DUMMY is not set 533# CONFIG_DUMMY is not set
504# CONFIG_BONDING is not set 534# CONFIG_BONDING is not set
@@ -517,7 +547,9 @@ CONFIG_NET_ETHERNET=y
517CONFIG_MII=y 547CONFIG_MII=y
518# CONFIG_HAPPYMEAL is not set 548# CONFIG_HAPPYMEAL is not set
519# CONFIG_SUNGEM is not set 549# CONFIG_SUNGEM is not set
520# CONFIG_NET_VENDOR_3COM is not set 550CONFIG_NET_VENDOR_3COM=y
551CONFIG_VORTEX=y
552# CONFIG_TYPHOON is not set
521 553
522# 554#
523# Tulip family network device support 555# Tulip family network device support
@@ -532,7 +564,7 @@ CONFIG_NET_PCI=y
532CONFIG_FORCEDETH=y 564CONFIG_FORCEDETH=y
533# CONFIG_DGRS is not set 565# CONFIG_DGRS is not set
534# CONFIG_EEPRO100 is not set 566# CONFIG_EEPRO100 is not set
535# CONFIG_E100 is not set 567CONFIG_E100=y
536# CONFIG_FEALNX is not set 568# CONFIG_FEALNX is not set
537# CONFIG_NATSEMI is not set 569# CONFIG_NATSEMI is not set
538# CONFIG_NE2K_PCI is not set 570# CONFIG_NE2K_PCI is not set
@@ -553,14 +585,15 @@ CONFIG_8139TOO=y
553# CONFIG_ACENIC is not set 585# CONFIG_ACENIC is not set
554# CONFIG_DL2K is not set 586# CONFIG_DL2K is not set
555CONFIG_E1000=y 587CONFIG_E1000=y
556# CONFIG_E1000_NAPI is not set
557# CONFIG_NS83820 is not set 588# CONFIG_NS83820 is not set
558# CONFIG_HAMACHI is not set 589# CONFIG_HAMACHI is not set
559# CONFIG_YELLOWFIN is not set 590# CONFIG_YELLOWFIN is not set
560# CONFIG_R8169 is not set 591# CONFIG_R8169 is not set
592# CONFIG_SKGE is not set
561# CONFIG_SK98LIN is not set 593# CONFIG_SK98LIN is not set
562# CONFIG_VIA_VELOCITY is not set 594# CONFIG_VIA_VELOCITY is not set
563CONFIG_TIGON3=y 595CONFIG_TIGON3=y
596# CONFIG_BNX2 is not set
564 597
565# 598#
566# Ethernet (10000 Mbit) 599# Ethernet (10000 Mbit)
@@ -647,7 +680,6 @@ CONFIG_SERIO_I8042=y
647CONFIG_SERIO_LIBPS2=y 680CONFIG_SERIO_LIBPS2=y
648# CONFIG_SERIO_RAW is not set 681# CONFIG_SERIO_RAW is not set
649# CONFIG_GAMEPORT is not set 682# CONFIG_GAMEPORT is not set
650CONFIG_SOUND_GAMEPORT=y
651 683
652# 684#
653# Character devices 685# Character devices
@@ -716,6 +748,7 @@ CONFIG_MAX_RAW_DEVS=256
716# I2C support 748# I2C support
717# 749#
718# CONFIG_I2C is not set 750# CONFIG_I2C is not set
751# CONFIG_I2C_SENSOR is not set
719 752
720# 753#
721# Dallas's 1-wire bus 754# Dallas's 1-wire bus
@@ -723,6 +756,12 @@ CONFIG_MAX_RAW_DEVS=256
723# CONFIG_W1 is not set 756# CONFIG_W1 is not set
724 757
725# 758#
759# Hardware Monitoring support
760#
761CONFIG_HWMON=y
762# CONFIG_HWMON_DEBUG_CHIP is not set
763
764#
726# Misc devices 765# Misc devices
727# 766#
728# CONFIG_IBM_ASM is not set 767# CONFIG_IBM_ASM is not set
@@ -808,6 +847,7 @@ CONFIG_USB_DEVICEFS=y
808CONFIG_USB_EHCI_HCD=y 847CONFIG_USB_EHCI_HCD=y
809# CONFIG_USB_EHCI_SPLIT_ISO is not set 848# CONFIG_USB_EHCI_SPLIT_ISO is not set
810# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 849# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
850# CONFIG_USB_ISP116X_HCD is not set
811CONFIG_USB_OHCI_HCD=y 851CONFIG_USB_OHCI_HCD=y
812# CONFIG_USB_OHCI_BIG_ENDIAN is not set 852# CONFIG_USB_OHCI_BIG_ENDIAN is not set
813CONFIG_USB_OHCI_LITTLE_ENDIAN=y 853CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -846,12 +886,15 @@ CONFIG_USB_HIDINPUT=y
846# CONFIG_USB_HIDDEV is not set 886# CONFIG_USB_HIDDEV is not set
847# CONFIG_USB_AIPTEK is not set 887# CONFIG_USB_AIPTEK is not set
848# CONFIG_USB_WACOM is not set 888# CONFIG_USB_WACOM is not set
889# CONFIG_USB_ACECAD is not set
849# CONFIG_USB_KBTAB is not set 890# CONFIG_USB_KBTAB is not set
850# CONFIG_USB_POWERMATE is not set 891# CONFIG_USB_POWERMATE is not set
851# CONFIG_USB_MTOUCH is not set 892# CONFIG_USB_MTOUCH is not set
893# CONFIG_USB_ITMTOUCH is not set
852# CONFIG_USB_EGALAX is not set 894# CONFIG_USB_EGALAX is not set
853# CONFIG_USB_XPAD is not set 895# CONFIG_USB_XPAD is not set
854# CONFIG_USB_ATI_REMOTE is not set 896# CONFIG_USB_ATI_REMOTE is not set
897# CONFIG_USB_KEYSPAN_REMOTE is not set
855 898
856# 899#
857# USB Imaging devices 900# USB Imaging devices
@@ -902,10 +945,11 @@ CONFIG_USB_MON=y
902# CONFIG_USB_PHIDGETSERVO is not set 945# CONFIG_USB_PHIDGETSERVO is not set
903# CONFIG_USB_IDMOUSE is not set 946# CONFIG_USB_IDMOUSE is not set
904# CONFIG_USB_SISUSBVGA is not set 947# CONFIG_USB_SISUSBVGA is not set
948# CONFIG_USB_LD is not set
905# CONFIG_USB_TEST is not set 949# CONFIG_USB_TEST is not set
906 950
907# 951#
908# USB ATM/DSL drivers 952# USB DSL modem support
909# 953#
910 954
911# 955#
@@ -924,6 +968,10 @@ CONFIG_USB_MON=y
924# CONFIG_INFINIBAND is not set 968# CONFIG_INFINIBAND is not set
925 969
926# 970#
971# SN Devices
972#
973
974#
927# Firmware Drivers 975# Firmware Drivers
928# 976#
929# CONFIG_EDD is not set 977# CONFIG_EDD is not set
@@ -935,6 +983,7 @@ CONFIG_EXT2_FS=y
935CONFIG_EXT2_FS_XATTR=y 983CONFIG_EXT2_FS_XATTR=y
936CONFIG_EXT2_FS_POSIX_ACL=y 984CONFIG_EXT2_FS_POSIX_ACL=y
937# CONFIG_EXT2_FS_SECURITY is not set 985# CONFIG_EXT2_FS_SECURITY is not set
986# CONFIG_EXT2_FS_XIP is not set
938CONFIG_EXT3_FS=y 987CONFIG_EXT3_FS=y
939CONFIG_EXT3_FS_XATTR=y 988CONFIG_EXT3_FS_XATTR=y
940CONFIG_EXT3_FS_POSIX_ACL=y 989CONFIG_EXT3_FS_POSIX_ACL=y
@@ -957,6 +1006,7 @@ CONFIG_FS_POSIX_ACL=y
957# CONFIG_XFS_FS is not set 1006# CONFIG_XFS_FS is not set
958# CONFIG_MINIX_FS is not set 1007# CONFIG_MINIX_FS is not set
959# CONFIG_ROMFS_FS is not set 1008# CONFIG_ROMFS_FS is not set
1009CONFIG_INOTIFY=y
960# CONFIG_QUOTA is not set 1010# CONFIG_QUOTA is not set
961CONFIG_DNOTIFY=y 1011CONFIG_DNOTIFY=y
962CONFIG_AUTOFS_FS=y 1012CONFIG_AUTOFS_FS=y
@@ -986,7 +1036,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
986CONFIG_PROC_FS=y 1036CONFIG_PROC_FS=y
987CONFIG_PROC_KCORE=y 1037CONFIG_PROC_KCORE=y
988CONFIG_SYSFS=y 1038CONFIG_SYSFS=y
989# CONFIG_DEVFS_FS is not set
990# CONFIG_DEVPTS_FS_XATTR is not set 1039# CONFIG_DEVPTS_FS_XATTR is not set
991CONFIG_TMPFS=y 1040CONFIG_TMPFS=y
992# CONFIG_TMPFS_XATTR is not set 1041# CONFIG_TMPFS_XATTR is not set
@@ -1016,15 +1065,18 @@ CONFIG_RAMFS=y
1016# 1065#
1017CONFIG_NFS_FS=y 1066CONFIG_NFS_FS=y
1018CONFIG_NFS_V3=y 1067CONFIG_NFS_V3=y
1068# CONFIG_NFS_V3_ACL is not set
1019# CONFIG_NFS_V4 is not set 1069# CONFIG_NFS_V4 is not set
1020# CONFIG_NFS_DIRECTIO is not set 1070# CONFIG_NFS_DIRECTIO is not set
1021CONFIG_NFSD=y 1071CONFIG_NFSD=y
1022CONFIG_NFSD_V3=y 1072CONFIG_NFSD_V3=y
1073# CONFIG_NFSD_V3_ACL is not set
1023# CONFIG_NFSD_V4 is not set 1074# CONFIG_NFSD_V4 is not set
1024CONFIG_NFSD_TCP=y 1075CONFIG_NFSD_TCP=y
1025CONFIG_LOCKD=y 1076CONFIG_LOCKD=y
1026CONFIG_LOCKD_V4=y 1077CONFIG_LOCKD_V4=y
1027CONFIG_EXPORTFS=y 1078CONFIG_EXPORTFS=y
1079CONFIG_NFS_COMMON=y
1028CONFIG_SUNRPC=y 1080CONFIG_SUNRPC=y
1029# CONFIG_RPCSEC_GSS_KRB5 is not set 1081# CONFIG_RPCSEC_GSS_KRB5 is not set
1030# CONFIG_RPCSEC_GSS_SPKM3 is not set 1082# CONFIG_RPCSEC_GSS_SPKM3 is not set
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile
index a12b19da4b59..f76217d8f579 100644
--- a/arch/x86_64/ia32/Makefile
+++ b/arch/x86_64/ia32/Makefile
@@ -4,14 +4,14 @@
4 4
5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \ 5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \
6 ia32_signal.o tls32.o \ 6 ia32_signal.o tls32.o \
7 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o 7 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o
8 8
9sysv-$(CONFIG_SYSVIPC) := ipc32.o 9sysv-$(CONFIG_SYSVIPC) := ipc32.o
10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y) 10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
11 11
12obj-$(CONFIG_IA32_AOUT) += ia32_aout.o 12obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
13 13
14$(obj)/syscall32.o: $(src)/syscall32.c \ 14$(obj)/syscall32_syscall.o: \
15 $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so) 15 $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so)
16 16
17# Teach kbuild about targets 17# Teach kbuild about targets
diff --git a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c
index c12edf5d97f0..3e6780fa0186 100644
--- a/arch/x86_64/ia32/ia32_aout.c
+++ b/arch/x86_64/ia32/ia32_aout.c
@@ -42,7 +42,7 @@ extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
42static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 42static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
43static int load_aout_library(struct file*); 43static int load_aout_library(struct file*);
44 44
45#if CORE_DUMP 45#ifdef CORE_DUMP
46static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); 46static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file);
47 47
48/* 48/*
@@ -103,7 +103,7 @@ static struct linux_binfmt aout_format = {
103 .module = THIS_MODULE, 103 .module = THIS_MODULE,
104 .load_binary = load_aout_binary, 104 .load_binary = load_aout_binary,
105 .load_shlib = load_aout_library, 105 .load_shlib = load_aout_library,
106#if CORE_DUMP 106#ifdef CORE_DUMP
107 .core_dump = aout_core_dump, 107 .core_dump = aout_core_dump,
108#endif 108#endif
109 .min_coredump = PAGE_SIZE 109 .min_coredump = PAGE_SIZE
@@ -120,7 +120,7 @@ static void set_brk(unsigned long start, unsigned long end)
120 up_write(&current->mm->mmap_sem); 120 up_write(&current->mm->mmap_sem);
121} 121}
122 122
123#if CORE_DUMP 123#ifdef CORE_DUMP
124/* 124/*
125 * These are the only things you should do on a core-file: use only these 125 * These are the only things you should do on a core-file: use only these
126 * macros to write out all the necessary info. 126 * macros to write out all the necessary info.
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
index b98b6d2462f6..2a925e2af390 100644
--- a/arch/x86_64/ia32/ptrace32.c
+++ b/arch/x86_64/ia32/ptrace32.c
@@ -43,11 +43,11 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val)
43 switch (regno) { 43 switch (regno) {
44 case offsetof(struct user32, regs.fs): 44 case offsetof(struct user32, regs.fs):
45 if (val && (val & 3) != 3) return -EIO; 45 if (val && (val & 3) != 3) return -EIO;
46 child->thread.fs = val & 0xffff; 46 child->thread.fsindex = val & 0xffff;
47 break; 47 break;
48 case offsetof(struct user32, regs.gs): 48 case offsetof(struct user32, regs.gs):
49 if (val && (val & 3) != 3) return -EIO; 49 if (val && (val & 3) != 3) return -EIO;
50 child->thread.gs = val & 0xffff; 50 child->thread.gsindex = val & 0xffff;
51 break; 51 break;
52 case offsetof(struct user32, regs.ds): 52 case offsetof(struct user32, regs.ds):
53 if (val && (val & 3) != 3) return -EIO; 53 if (val && (val & 3) != 3) return -EIO;
@@ -138,10 +138,10 @@ static int getreg32(struct task_struct *child, unsigned regno, u32 *val)
138 138
139 switch (regno) { 139 switch (regno) {
140 case offsetof(struct user32, regs.fs): 140 case offsetof(struct user32, regs.fs):
141 *val = child->thread.fs; 141 *val = child->thread.fsindex;
142 break; 142 break;
143 case offsetof(struct user32, regs.gs): 143 case offsetof(struct user32, regs.gs):
144 *val = child->thread.gs; 144 *val = child->thread.gsindex;
145 break; 145 break;
146 case offsetof(struct user32, regs.ds): 146 case offsetof(struct user32, regs.ds):
147 *val = child->thread.ds; 147 *val = child->thread.ds;
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
index 816a3b89f13d..adbc5f8089e9 100644
--- a/arch/x86_64/ia32/syscall32.c
+++ b/arch/x86_64/ia32/syscall32.c
@@ -14,16 +14,6 @@
14#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
15#include <asm/ia32_unistd.h> 15#include <asm/ia32_unistd.h>
16 16
17/* 32bit VDSOs mapped into user space. */
18asm(".section \".init.data\",\"aw\"\n"
19 "syscall32_syscall:\n"
20 ".incbin \"arch/x86_64/ia32/vsyscall-syscall.so\"\n"
21 "syscall32_syscall_end:\n"
22 "syscall32_sysenter:\n"
23 ".incbin \"arch/x86_64/ia32/vsyscall-sysenter.so\"\n"
24 "syscall32_sysenter_end:\n"
25 ".previous");
26
27extern unsigned char syscall32_syscall[], syscall32_syscall_end[]; 17extern unsigned char syscall32_syscall[], syscall32_syscall_end[];
28extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[]; 18extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[];
29extern int sysctl_vsyscall32; 19extern int sysctl_vsyscall32;
diff --git a/arch/x86_64/ia32/syscall32_syscall.S b/arch/x86_64/ia32/syscall32_syscall.S
new file mode 100644
index 000000000000..8f8271bdf135
--- /dev/null
+++ b/arch/x86_64/ia32/syscall32_syscall.S
@@ -0,0 +1,17 @@
1/* 32bit VDSOs mapped into user space. */
2
3 .section ".init.data","aw"
4
5 .globl syscall32_syscall
6 .globl syscall32_syscall_end
7
8syscall32_syscall:
9 .incbin "arch/x86_64/ia32/vsyscall-syscall.so"
10syscall32_syscall_end:
11
12 .globl syscall32_sysenter
13 .globl syscall32_sysenter_end
14
15syscall32_sysenter:
16 .incbin "arch/x86_64/ia32/vsyscall-sysenter.so"
17syscall32_sysenter_end:
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 28817490fdc6..096d470e280f 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -76,7 +76,7 @@
76 76
77 .macro FAKE_STACK_FRAME child_rip 77 .macro FAKE_STACK_FRAME child_rip
78 /* push in order ss, rsp, eflags, cs, rip */ 78 /* push in order ss, rsp, eflags, cs, rip */
79 xorq %rax, %rax 79 xorl %eax, %eax
80 pushq %rax /* ss */ 80 pushq %rax /* ss */
81 CFI_ADJUST_CFA_OFFSET 8 81 CFI_ADJUST_CFA_OFFSET 8
82 pushq %rax /* rsp */ 82 pushq %rax /* rsp */
@@ -423,7 +423,7 @@ ENTRY(stub_rt_sigreturn)
423 testl $3,CS(%rdi) 423 testl $3,CS(%rdi)
424 je 1f 424 je 1f
425 swapgs 425 swapgs
4261: addl $1,%gs:pda_irqcount # RED-PEN should check preempt count 4261: incl %gs:pda_irqcount # RED-PEN should check preempt count
427 movq %gs:pda_irqstackptr,%rax 427 movq %gs:pda_irqstackptr,%rax
428 cmoveq %rax,%rsp 428 cmoveq %rax,%rsp
429 pushq %rdi # save old stack 429 pushq %rdi # save old stack
@@ -436,7 +436,7 @@ ENTRY(common_interrupt)
436ret_from_intr: 436ret_from_intr:
437 popq %rdi 437 popq %rdi
438 cli 438 cli
439 subl $1,%gs:pda_irqcount 439 decl %gs:pda_irqcount
440#ifdef CONFIG_DEBUG_INFO 440#ifdef CONFIG_DEBUG_INFO
441 movq RBP(%rdi),%rbp 441 movq RBP(%rdi),%rbp
442#endif 442#endif
@@ -494,7 +494,7 @@ retint_signal:
494 sti 494 sti
495 SAVE_REST 495 SAVE_REST
496 movq $-1,ORIG_RAX(%rsp) 496 movq $-1,ORIG_RAX(%rsp)
497 xorq %rsi,%rsi # oldset 497 xorl %esi,%esi # oldset
498 movq %rsp,%rdi # &pt_regs 498 movq %rsp,%rdi # &pt_regs
499 call do_notify_resume 499 call do_notify_resume
500 RESTORE_REST 500 RESTORE_REST
@@ -752,7 +752,7 @@ child_rip:
752 movq %rsi, %rdi 752 movq %rsi, %rdi
753 call *%rax 753 call *%rax
754 # exit 754 # exit
755 xorq %rdi, %rdi 755 xorl %edi, %edi
756 call do_exit 756 call do_exit
757 757
758/* 758/*
@@ -918,3 +918,15 @@ ENTRY(machine_check)
918ENTRY(call_debug) 918ENTRY(call_debug)
919 zeroentry do_call_debug 919 zeroentry do_call_debug
920 920
921ENTRY(call_softirq)
922 movq %gs:pda_irqstackptr,%rax
923 pushq %r15
924 movq %rsp,%r15
925 incl %gs:pda_irqcount
926 cmove %rax,%rsp
927 call __do_softirq
928 movq %r15,%rsp
929 decl %gs:pda_irqcount
930 popq %r15
931 ret
932
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c
index 69b9c25a8fc4..30c843a5efdd 100644
--- a/arch/x86_64/kernel/genapic.c
+++ b/arch/x86_64/kernel/genapic.c
@@ -31,6 +31,7 @@ u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
31 31
32extern struct genapic apic_cluster; 32extern struct genapic apic_cluster;
33extern struct genapic apic_flat; 33extern struct genapic apic_flat;
34extern struct genapic apic_physflat;
34 35
35struct genapic *genapic = &apic_flat; 36struct genapic *genapic = &apic_flat;
36 37
@@ -44,12 +45,7 @@ void __init clustered_apic_check(void)
44 u8 clusters, max_cluster; 45 u8 clusters, max_cluster;
45 u8 id; 46 u8 id;
46 u8 cluster_cnt[NUM_APIC_CLUSTERS]; 47 u8 cluster_cnt[NUM_APIC_CLUSTERS];
47 48 int num_cpus = 0;
48 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
49 /* AMD always uses flat mode right now */
50 genapic = &apic_flat;
51 goto print;
52 }
53 49
54#if defined(CONFIG_ACPI_BUS) 50#if defined(CONFIG_ACPI_BUS)
55 /* 51 /*
@@ -64,15 +60,34 @@ void __init clustered_apic_check(void)
64#endif 60#endif
65 61
66 memset(cluster_cnt, 0, sizeof(cluster_cnt)); 62 memset(cluster_cnt, 0, sizeof(cluster_cnt));
67
68 for (i = 0; i < NR_CPUS; i++) { 63 for (i = 0; i < NR_CPUS; i++) {
69 id = bios_cpu_apicid[i]; 64 id = bios_cpu_apicid[i];
70 if (id != BAD_APICID) 65 if (id == BAD_APICID)
71 cluster_cnt[APIC_CLUSTERID(id)]++; 66 continue;
67 num_cpus++;
68 cluster_cnt[APIC_CLUSTERID(id)]++;
72 } 69 }
73 70
71 /* Don't use clustered mode on AMD platforms. */
72 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
73 genapic = &apic_physflat;
74#ifndef CONFIG_CPU_HOTPLUG
75 /* In the CPU hotplug case we cannot use broadcast mode
76 because that opens a race when a CPU is removed.
77 Stay at physflat mode in this case.
78 It is bad to do this unconditionally though. Once
79 we have ACPI platform support for CPU hotplug
80 we should detect hotplug capablity from ACPI tables and
81 only do this when really needed. -AK */
82 if (num_cpus <= 8)
83 genapic = &apic_flat;
84#endif
85 goto print;
86 }
87
74 clusters = 0; 88 clusters = 0;
75 max_cluster = 0; 89 max_cluster = 0;
90
76 for (i = 0; i < NUM_APIC_CLUSTERS; i++) { 91 for (i = 0; i < NUM_APIC_CLUSTERS; i++) {
77 if (cluster_cnt[i] > 0) { 92 if (cluster_cnt[i] > 0) {
78 ++clusters; 93 ++clusters;
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c
index 282846965080..adc96282a9e2 100644
--- a/arch/x86_64/kernel/genapic_flat.c
+++ b/arch/x86_64/kernel/genapic_flat.c
@@ -2,13 +2,11 @@
2 * Copyright 2004 James Cleverdon, IBM. 2 * Copyright 2004 James Cleverdon, IBM.
3 * Subject to the GNU Public License, v.2 3 * Subject to the GNU Public License, v.2
4 * 4 *
5 * Flat APIC subarch code. Maximum 8 CPUs, logical delivery. 5 * Flat APIC subarch code.
6 * 6 *
7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by 7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and 8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
9 * James Cleverdon. 9 * James Cleverdon.
10 * Ashok Raj <ashok.raj@intel.com>
11 * Removed IPI broadcast shortcut to support CPU hotplug
12 */ 10 */
13#include <linux/config.h> 11#include <linux/config.h>
14#include <linux/threads.h> 12#include <linux/threads.h>
@@ -20,47 +18,6 @@
20#include <asm/smp.h> 18#include <asm/smp.h>
21#include <asm/ipi.h> 19#include <asm/ipi.h>
22 20
23/*
24 * The following permit choosing broadcast IPI shortcut v.s sending IPI only
25 * to online cpus via the send_IPI_mask varient.
26 * The mask version is my preferred option, since it eliminates a lot of
27 * other extra code that would need to be written to cleanup intrs sent
28 * to a CPU while offline.
29 *
30 * Sending broadcast introduces lots of trouble in CPU hotplug situations.
31 * These IPI's are delivered to cpu's irrespective of their offline status
32 * and could pickup stale intr data when these CPUS are turned online.
33 *
34 * Not using broadcast is a cleaner approach IMO, but Andi Kleen disagrees with
35 * the idea of not using broadcast IPI's anymore. Hence the run time check
36 * is introduced, on his request so we can choose an alternate mechanism.
37 *
38 * Initial wacky performance tests that collect cycle counts show
39 * no increase in using mask v.s broadcast version. In fact they seem
40 * identical in terms of cycle counts.
41 *
42 * if we need to use broadcast, we need to do the following.
43 *
44 * cli;
45 * hold call_lock;
46 * clear any pending IPI, just ack and clear all pending intr
47 * set cpu_online_map;
48 * release call_lock;
49 * sti;
50 *
51 * The complicated dummy irq processing shown above is not required if
52 * we didnt sent IPI's to wrong CPU's in the first place.
53 *
54 * - Ashok Raj <ashok.raj@intel.com>
55 */
56#ifdef CONFIG_HOTPLUG_CPU
57#define DEFAULT_SEND_IPI (1)
58#else
59#define DEFAULT_SEND_IPI (0)
60#endif
61
62static int no_broadcast=DEFAULT_SEND_IPI;
63
64static cpumask_t flat_target_cpus(void) 21static cpumask_t flat_target_cpus(void)
65{ 22{
66 return cpu_online_map; 23 return cpu_online_map;
@@ -119,37 +76,15 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
119 local_irq_restore(flags); 76 local_irq_restore(flags);
120} 77}
121 78
122static inline void __local_flat_send_IPI_allbutself(int vector)
123{
124 if (no_broadcast) {
125 cpumask_t mask = cpu_online_map;
126 int this_cpu = get_cpu();
127
128 cpu_clear(this_cpu, mask);
129 flat_send_IPI_mask(mask, vector);
130 put_cpu();
131 }
132 else
133 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
134}
135
136static inline void __local_flat_send_IPI_all(int vector)
137{
138 if (no_broadcast)
139 flat_send_IPI_mask(cpu_online_map, vector);
140 else
141 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
142}
143
144static void flat_send_IPI_allbutself(int vector) 79static void flat_send_IPI_allbutself(int vector)
145{ 80{
146 if (((num_online_cpus()) - 1) >= 1) 81 if (((num_online_cpus()) - 1) >= 1)
147 __local_flat_send_IPI_allbutself(vector); 82 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
148} 83}
149 84
150static void flat_send_IPI_all(int vector) 85static void flat_send_IPI_all(int vector)
151{ 86{
152 __local_flat_send_IPI_all(vector); 87 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
153} 88}
154 89
155static int flat_apic_id_registered(void) 90static int flat_apic_id_registered(void)
@@ -170,16 +105,6 @@ static unsigned int phys_pkg_id(int index_msb)
170 return ((ebx >> 24) & 0xFF) >> index_msb; 105 return ((ebx >> 24) & 0xFF) >> index_msb;
171} 106}
172 107
173static __init int no_ipi_broadcast(char *str)
174{
175 get_option(&str, &no_broadcast);
176 printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
177 "IPI Broadcast");
178 return 1;
179}
180
181__setup("no_ipi_broadcast", no_ipi_broadcast);
182
183struct genapic apic_flat = { 108struct genapic apic_flat = {
184 .name = "flat", 109 .name = "flat",
185 .int_delivery_mode = dest_LowestPrio, 110 .int_delivery_mode = dest_LowestPrio,
@@ -195,11 +120,62 @@ struct genapic apic_flat = {
195 .phys_pkg_id = phys_pkg_id, 120 .phys_pkg_id = phys_pkg_id,
196}; 121};
197 122
198static int __init print_ipi_mode(void) 123/*
124 * Physflat mode is used when there are more than 8 CPUs on a AMD system.
125 * We cannot use logical delivery in this case because the mask
126 * overflows, so use physical mode.
127 */
128
129static cpumask_t physflat_target_cpus(void)
130{
131 return cpumask_of_cpu(0);
132}
133
134static void physflat_send_IPI_mask(cpumask_t cpumask, int vector)
135{
136 send_IPI_mask_sequence(cpumask, vector);
137}
138
139static void physflat_send_IPI_allbutself(int vector)
140{
141 cpumask_t allbutme = cpu_online_map;
142 int me = get_cpu();
143 cpu_clear(me, allbutme);
144 physflat_send_IPI_mask(allbutme, vector);
145 put_cpu();
146}
147
148static void physflat_send_IPI_all(int vector)
199{ 149{
200 printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" : 150 physflat_send_IPI_mask(cpu_online_map, vector);
201 "Shortcut");
202 return 0;
203} 151}
204 152
205late_initcall(print_ipi_mode); 153static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask)
154{
155 int cpu;
156
157 /*
158 * We're using fixed IRQ delivery, can only return one phys APIC ID.
159 * May as well be the first.
160 */
161 cpu = first_cpu(cpumask);
162 if ((unsigned)cpu < NR_CPUS)
163 return x86_cpu_to_apicid[cpu];
164 else
165 return BAD_APICID;
166}
167
168struct genapic apic_physflat = {
169 .name = "physical flat",
170 .int_delivery_mode = dest_LowestPrio,
171 .int_dest_mode = (APIC_DEST_PHYSICAL != 0),
172 .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_LOWEST,
173 .target_cpus = physflat_target_cpus,
174 .apic_id_registered = flat_apic_id_registered,
175 .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/
176 .send_IPI_all = physflat_send_IPI_all,
177 .send_IPI_allbutself = physflat_send_IPI_allbutself,
178 .send_IPI_mask = physflat_send_IPI_mask,
179 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
180 .phys_pkg_id = phys_pkg_id,
181};
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 8d765aa77a26..98ff5eb32b9a 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -137,14 +137,14 @@ startup_64:
137 wrmsr 137 wrmsr
138 138
139 /* Setup cr0 */ 139 /* Setup cr0 */
140 xorq %rax, %rax 140#define CR0_PM 1 /* protected mode */
141 btsq $31, %rax /* Enable paging */ 141#define CR0_MP (1<<1)
142 btsq $0, %rax /* Enable protected mode */ 142#define CR0_ET (1<<4)
143 btsq $1, %rax /* Enable MP */ 143#define CR0_NE (1<<5)
144 btsq $4, %rax /* Enable ET */ 144#define CR0_WP (1<<16)
145 btsq $5, %rax /* Enable NE */ 145#define CR0_AM (1<<18)
146 btsq $16, %rax /* Enable WP */ 146#define CR0_PAGING (1<<31)
147 btsq $18, %rax /* Enable AM */ 147 movl $CR0_PM|CR0_MP|CR0_ET|CR0_NE|CR0_WP|CR0_AM|CR0_PAGING,%eax
148 /* Make changes effective */ 148 /* Make changes effective */
149 movq %rax, %cr0 149 movq %rax, %cr0
150 150
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index cc3fb85f5145..849a20aec7ca 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -135,3 +135,22 @@ void fixup_irqs(cpumask_t map)
135 local_irq_disable(); 135 local_irq_disable();
136} 136}
137#endif 137#endif
138
139extern void call_softirq(void);
140
141asmlinkage void do_softirq(void)
142{
143 __u32 pending;
144 unsigned long flags;
145
146 if (in_interrupt())
147 return;
148
149 local_irq_save(flags);
150 pending = local_softirq_pending();
151 /* Switch to interrupt stack */
152 if (pending)
153 call_softirq();
154 local_irq_restore(flags);
155}
156EXPORT_SYMBOL(do_softirq);
diff --git a/arch/x86_64/kernel/machine_kexec.c b/arch/x86_64/kernel/machine_kexec.c
index 60d1eff41567..89fab51e20f4 100644
--- a/arch/x86_64/kernel/machine_kexec.c
+++ b/arch/x86_64/kernel/machine_kexec.c
@@ -8,43 +8,26 @@
8 8
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/kexec.h> 10#include <linux/kexec.h>
11#include <linux/delay.h>
12#include <linux/string.h> 11#include <linux/string.h>
13#include <linux/reboot.h> 12#include <linux/reboot.h>
14#include <asm/pda.h>
15#include <asm/pgtable.h> 13#include <asm/pgtable.h>
16#include <asm/pgalloc.h>
17#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
18#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
19#include <asm/io.h> 16#include <asm/io.h>
20#include <asm/apic.h> 17
21#include <asm/cpufeature.h> 18static void init_level2_page(pmd_t *level2p, unsigned long addr)
22#include <asm/hw_irq.h>
23
24#define LEVEL0_SIZE (1UL << 12UL)
25#define LEVEL1_SIZE (1UL << 21UL)
26#define LEVEL2_SIZE (1UL << 30UL)
27#define LEVEL3_SIZE (1UL << 39UL)
28#define LEVEL4_SIZE (1UL << 48UL)
29
30#define L0_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
31#define L1_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE)
32#define L2_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
33#define L3_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
34
35static void init_level2_page(u64 *level2p, unsigned long addr)
36{ 19{
37 unsigned long end_addr; 20 unsigned long end_addr;
38 21
39 addr &= PAGE_MASK; 22 addr &= PAGE_MASK;
40 end_addr = addr + LEVEL2_SIZE; 23 end_addr = addr + PUD_SIZE;
41 while (addr < end_addr) { 24 while (addr < end_addr) {
42 *(level2p++) = addr | L1_ATTR; 25 set_pmd(level2p++, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC));
43 addr += LEVEL1_SIZE; 26 addr += PMD_SIZE;
44 } 27 }
45} 28}
46 29
47static int init_level3_page(struct kimage *image, u64 *level3p, 30static int init_level3_page(struct kimage *image, pud_t *level3p,
48 unsigned long addr, unsigned long last_addr) 31 unsigned long addr, unsigned long last_addr)
49{ 32{
50 unsigned long end_addr; 33 unsigned long end_addr;
@@ -52,32 +35,32 @@ static int init_level3_page(struct kimage *image, u64 *level3p,
52 35
53 result = 0; 36 result = 0;
54 addr &= PAGE_MASK; 37 addr &= PAGE_MASK;
55 end_addr = addr + LEVEL3_SIZE; 38 end_addr = addr + PGDIR_SIZE;
56 while ((addr < last_addr) && (addr < end_addr)) { 39 while ((addr < last_addr) && (addr < end_addr)) {
57 struct page *page; 40 struct page *page;
58 u64 *level2p; 41 pmd_t *level2p;
59 42
60 page = kimage_alloc_control_pages(image, 0); 43 page = kimage_alloc_control_pages(image, 0);
61 if (!page) { 44 if (!page) {
62 result = -ENOMEM; 45 result = -ENOMEM;
63 goto out; 46 goto out;
64 } 47 }
65 level2p = (u64 *)page_address(page); 48 level2p = (pmd_t *)page_address(page);
66 init_level2_page(level2p, addr); 49 init_level2_page(level2p, addr);
67 *(level3p++) = __pa(level2p) | L2_ATTR; 50 set_pud(level3p++, __pud(__pa(level2p) | _KERNPG_TABLE));
68 addr += LEVEL2_SIZE; 51 addr += PUD_SIZE;
69 } 52 }
70 /* clear the unused entries */ 53 /* clear the unused entries */
71 while (addr < end_addr) { 54 while (addr < end_addr) {
72 *(level3p++) = 0; 55 pud_clear(level3p++);
73 addr += LEVEL2_SIZE; 56 addr += PUD_SIZE;
74 } 57 }
75out: 58out:
76 return result; 59 return result;
77} 60}
78 61
79 62
80static int init_level4_page(struct kimage *image, u64 *level4p, 63static int init_level4_page(struct kimage *image, pgd_t *level4p,
81 unsigned long addr, unsigned long last_addr) 64 unsigned long addr, unsigned long last_addr)
82{ 65{
83 unsigned long end_addr; 66 unsigned long end_addr;
@@ -85,28 +68,28 @@ static int init_level4_page(struct kimage *image, u64 *level4p,
85 68
86 result = 0; 69 result = 0;
87 addr &= PAGE_MASK; 70 addr &= PAGE_MASK;
88 end_addr = addr + LEVEL4_SIZE; 71 end_addr = addr + (PTRS_PER_PGD * PGDIR_SIZE);
89 while ((addr < last_addr) && (addr < end_addr)) { 72 while ((addr < last_addr) && (addr < end_addr)) {
90 struct page *page; 73 struct page *page;
91 u64 *level3p; 74 pud_t *level3p;
92 75
93 page = kimage_alloc_control_pages(image, 0); 76 page = kimage_alloc_control_pages(image, 0);
94 if (!page) { 77 if (!page) {
95 result = -ENOMEM; 78 result = -ENOMEM;
96 goto out; 79 goto out;
97 } 80 }
98 level3p = (u64 *)page_address(page); 81 level3p = (pud_t *)page_address(page);
99 result = init_level3_page(image, level3p, addr, last_addr); 82 result = init_level3_page(image, level3p, addr, last_addr);
100 if (result) { 83 if (result) {
101 goto out; 84 goto out;
102 } 85 }
103 *(level4p++) = __pa(level3p) | L3_ATTR; 86 set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE));
104 addr += LEVEL3_SIZE; 87 addr += PGDIR_SIZE;
105 } 88 }
106 /* clear the unused entries */ 89 /* clear the unused entries */
107 while (addr < end_addr) { 90 while (addr < end_addr) {
108 *(level4p++) = 0; 91 pgd_clear(level4p++);
109 addr += LEVEL3_SIZE; 92 addr += PGDIR_SIZE;
110 } 93 }
111out: 94out:
112 return result; 95 return result;
@@ -115,52 +98,50 @@ out:
115 98
116static int init_pgtable(struct kimage *image, unsigned long start_pgtable) 99static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
117{ 100{
118 u64 *level4p; 101 pgd_t *level4p;
119 level4p = (u64 *)__va(start_pgtable); 102 level4p = (pgd_t *)__va(start_pgtable);
120 return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT); 103 return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT);
121} 104}
122 105
123static void set_idt(void *newidt, u16 limit) 106static void set_idt(void *newidt, u16 limit)
124{ 107{
125 unsigned char curidt[10]; 108 struct desc_ptr curidt;
126 109
127 /* x86-64 supports unaliged loads & stores */ 110 /* x86-64 supports unaliged loads & stores */
128 (*(u16 *)(curidt)) = limit; 111 curidt.size = limit;
129 (*(u64 *)(curidt +2)) = (unsigned long)(newidt); 112 curidt.address = (unsigned long)newidt;
130 113
131 __asm__ __volatile__ ( 114 __asm__ __volatile__ (
132 "lidt %0\n" 115 "lidtq %0\n"
133 : "=m" (curidt) 116 : : "m" (curidt)
134 ); 117 );
135}; 118};
136 119
137 120
138static void set_gdt(void *newgdt, u16 limit) 121static void set_gdt(void *newgdt, u16 limit)
139{ 122{
140 unsigned char curgdt[10]; 123 struct desc_ptr curgdt;
141 124
142 /* x86-64 supports unaligned loads & stores */ 125 /* x86-64 supports unaligned loads & stores */
143 (*(u16 *)(curgdt)) = limit; 126 curgdt.size = limit;
144 (*(u64 *)(curgdt +2)) = (unsigned long)(newgdt); 127 curgdt.address = (unsigned long)newgdt;
145 128
146 __asm__ __volatile__ ( 129 __asm__ __volatile__ (
147 "lgdt %0\n" 130 "lgdtq %0\n"
148 : "=m" (curgdt) 131 : : "m" (curgdt)
149 ); 132 );
150}; 133};
151 134
152static void load_segments(void) 135static void load_segments(void)
153{ 136{
154 __asm__ __volatile__ ( 137 __asm__ __volatile__ (
155 "\tmovl $"STR(__KERNEL_DS)",%eax\n" 138 "\tmovl %0,%%ds\n"
156 "\tmovl %eax,%ds\n" 139 "\tmovl %0,%%es\n"
157 "\tmovl %eax,%es\n" 140 "\tmovl %0,%%ss\n"
158 "\tmovl %eax,%ss\n" 141 "\tmovl %0,%%fs\n"
159 "\tmovl %eax,%fs\n" 142 "\tmovl %0,%%gs\n"
160 "\tmovl %eax,%gs\n" 143 : : "a" (__KERNEL_DS)
161 ); 144 );
162#undef STR
163#undef __STR
164} 145}
165 146
166typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page, 147typedef NORET_TYPE void (*relocate_new_kernel_t)(unsigned long indirection_page,
@@ -178,7 +159,7 @@ int machine_kexec_prepare(struct kimage *image)
178 159
179 /* Calculate the offsets */ 160 /* Calculate the offsets */
180 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; 161 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
181 control_code_buffer = start_pgtable + 4096UL; 162 control_code_buffer = start_pgtable + PAGE_SIZE;
182 163
183 /* Setup the identity mapped 64bit page table */ 164 /* Setup the identity mapped 64bit page table */
184 result = init_pgtable(image, start_pgtable); 165 result = init_pgtable(image, start_pgtable);
@@ -214,7 +195,7 @@ NORET_TYPE void machine_kexec(struct kimage *image)
214 /* Calculate the offsets */ 195 /* Calculate the offsets */
215 page_list = image->head; 196 page_list = image->head;
216 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; 197 start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT;
217 control_code_buffer = start_pgtable + 4096UL; 198 control_code_buffer = start_pgtable + PAGE_SIZE;
218 199
219 /* Set the low half of the page table to my identity mapped 200 /* Set the low half of the page table to my identity mapped
220 * page table for kexec. Leave the high half pointing at the 201 * page table for kexec. Leave the high half pointing at the
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 21e70625a495..8aa56736cde3 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -15,6 +15,8 @@
15#include <linux/sysdev.h> 15#include <linux/sysdev.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/cpu.h>
19#include <linux/percpu.h>
18#include <asm/processor.h> 20#include <asm/processor.h>
19#include <asm/msr.h> 21#include <asm/msr.h>
20#include <asm/mce.h> 22#include <asm/mce.h>
@@ -34,6 +36,7 @@ static unsigned long bank[NR_BANKS] = { [0 ... NR_BANKS-1] = ~0UL };
34static unsigned long console_logged; 36static unsigned long console_logged;
35static int notify_user; 37static int notify_user;
36static int rip_msr; 38static int rip_msr;
39static int mce_bootlog;
37 40
38/* 41/*
39 * Lockless MCE logging infrastructure. 42 * Lockless MCE logging infrastructure.
@@ -195,10 +198,11 @@ void do_machine_check(struct pt_regs * regs, long error_code)
195 rdmsrl(MSR_IA32_MC0_ADDR + i*4, m.addr); 198 rdmsrl(MSR_IA32_MC0_ADDR + i*4, m.addr);
196 199
197 mce_get_rip(&m, regs); 200 mce_get_rip(&m, regs);
198 if (error_code != -1) 201 if (error_code >= 0)
199 rdtscll(m.tsc); 202 rdtscll(m.tsc);
200 wrmsrl(MSR_IA32_MC0_STATUS + i*4, 0); 203 wrmsrl(MSR_IA32_MC0_STATUS + i*4, 0);
201 mce_log(&m); 204 if (error_code != -2)
205 mce_log(&m);
202 206
203 /* Did this bank cause the exception? */ 207 /* Did this bank cause the exception? */
204 /* Assume that the bank with uncorrectable errors did it, 208 /* Assume that the bank with uncorrectable errors did it,
@@ -313,7 +317,7 @@ static void mce_init(void *dummy)
313 317
314 /* Log the machine checks left over from the previous reset. 318 /* Log the machine checks left over from the previous reset.
315 This also clears all registers */ 319 This also clears all registers */
316 do_machine_check(NULL, -1); 320 do_machine_check(NULL, mce_bootlog ? -1 : -2);
317 321
318 set_in_cr4(X86_CR4_MCE); 322 set_in_cr4(X86_CR4_MCE);
319 323
@@ -474,11 +478,17 @@ static int __init mcheck_disable(char *str)
474} 478}
475 479
476/* mce=off disables machine check. Note you can reenable it later 480/* mce=off disables machine check. Note you can reenable it later
477 using sysfs */ 481 using sysfs.
482 mce=bootlog Log MCEs from before booting. Disabled by default to work
483 around buggy BIOS that leave bogus MCEs. */
478static int __init mcheck_enable(char *str) 484static int __init mcheck_enable(char *str)
479{ 485{
486 if (*str == '=')
487 str++;
480 if (!strcmp(str, "off")) 488 if (!strcmp(str, "off"))
481 mce_dont_init = 1; 489 mce_dont_init = 1;
490 else if (!strcmp(str, "bootlog"))
491 mce_bootlog = 1;
482 else 492 else
483 printk("mce= argument %s ignored. Please use /sys", str); 493 printk("mce= argument %s ignored. Please use /sys", str);
484 return 0; 494 return 0;
@@ -514,10 +524,7 @@ static struct sysdev_class mce_sysclass = {
514 set_kset_name("machinecheck"), 524 set_kset_name("machinecheck"),
515}; 525};
516 526
517static struct sys_device device_mce = { 527static DEFINE_PER_CPU(struct sys_device, device_mce);
518 .id = 0,
519 .cls = &mce_sysclass,
520};
521 528
522/* Why are there no generic functions for this? */ 529/* Why are there no generic functions for this? */
523#define ACCESSOR(name, var, start) \ 530#define ACCESSOR(name, var, start) \
@@ -542,27 +549,83 @@ ACCESSOR(bank4ctl,bank[4],mce_restart())
542ACCESSOR(tolerant,tolerant,) 549ACCESSOR(tolerant,tolerant,)
543ACCESSOR(check_interval,check_interval,mce_restart()) 550ACCESSOR(check_interval,check_interval,mce_restart())
544 551
545static __cpuinit int mce_init_device(void) 552/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
553static __cpuinit int mce_create_device(unsigned int cpu)
546{ 554{
547 int err; 555 int err;
556 if (!mce_available(&cpu_data[cpu]))
557 return -EIO;
558
559 per_cpu(device_mce,cpu).id = cpu;
560 per_cpu(device_mce,cpu).cls = &mce_sysclass;
561
562 err = sysdev_register(&per_cpu(device_mce,cpu));
563
564 if (!err) {
565 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
566 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
567 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
568 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
569 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
570 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant);
571 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval);
572 }
573 return err;
574}
575
576#ifdef CONFIG_HOTPLUG_CPU
577static __cpuinit void mce_remove_device(unsigned int cpu)
578{
579 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
580 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
581 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
582 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
583 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
584 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant);
585 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
586 sysdev_unregister(&per_cpu(device_mce,cpu));
587}
588#endif
589
590/* Get notified when a cpu comes on/off. Be hotplug friendly. */
591static __cpuinit int
592mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
593{
594 unsigned int cpu = (unsigned long)hcpu;
595
596 switch (action) {
597 case CPU_ONLINE:
598 mce_create_device(cpu);
599 break;
600#ifdef CONFIG_HOTPLUG_CPU
601 case CPU_DEAD:
602 mce_remove_device(cpu);
603 break;
604#endif
605 }
606 return NOTIFY_OK;
607}
608
609static struct notifier_block mce_cpu_notifier = {
610 .notifier_call = mce_cpu_callback,
611};
612
613static __init int mce_init_device(void)
614{
615 int err;
616 int i = 0;
617
548 if (!mce_available(&boot_cpu_data)) 618 if (!mce_available(&boot_cpu_data))
549 return -EIO; 619 return -EIO;
550 err = sysdev_class_register(&mce_sysclass); 620 err = sysdev_class_register(&mce_sysclass);
551 if (!err) 621
552 err = sysdev_register(&device_mce); 622 for_each_online_cpu(i) {
553 if (!err) { 623 mce_create_device(i);
554 /* could create per CPU objects, but it is not worth it. */ 624 }
555 sysdev_create_file(&device_mce, &attr_bank0ctl); 625
556 sysdev_create_file(&device_mce, &attr_bank1ctl); 626 register_cpu_notifier(&mce_cpu_notifier);
557 sysdev_create_file(&device_mce, &attr_bank2ctl);
558 sysdev_create_file(&device_mce, &attr_bank3ctl);
559 sysdev_create_file(&device_mce, &attr_bank4ctl);
560 sysdev_create_file(&device_mce, &attr_tolerant);
561 sysdev_create_file(&device_mce, &attr_check_interval);
562 }
563
564 misc_register(&mce_log_device); 627 misc_register(&mce_log_device);
565 return err; 628 return err;
566
567} 629}
630
568device_initcall(mce_init_device); 631device_initcall(mce_init_device);
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 9c5aa2a790c7..79c362d03e2e 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -109,7 +109,7 @@ static int __init mpf_checksum(unsigned char *mp, int len)
109 109
110static void __init MP_processor_info (struct mpc_config_processor *m) 110static void __init MP_processor_info (struct mpc_config_processor *m)
111{ 111{
112 int ver; 112 int ver, cpu;
113 static int found_bsp=0; 113 static int found_bsp=0;
114 114
115 if (!(m->mpc_cpuflag & CPU_ENABLED)) 115 if (!(m->mpc_cpuflag & CPU_ENABLED))
@@ -131,7 +131,7 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
131 return; 131 return;
132 } 132 }
133 133
134 num_processors++; 134 cpu = num_processors++;
135 135
136 if (m->mpc_apicid > MAX_APICS) { 136 if (m->mpc_apicid > MAX_APICS) {
137 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", 137 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
@@ -155,13 +155,18 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
155 * in same order as logical cpu numbers. Hence the first 155 * in same order as logical cpu numbers. Hence the first
156 * entry is BSP, and so on. 156 * entry is BSP, and so on.
157 */ 157 */
158 cpu = 0;
159
158 bios_cpu_apicid[0] = m->mpc_apicid; 160 bios_cpu_apicid[0] = m->mpc_apicid;
159 x86_cpu_to_apicid[0] = m->mpc_apicid; 161 x86_cpu_to_apicid[0] = m->mpc_apicid;
160 found_bsp = 1; 162 found_bsp = 1;
161 } else { 163 } else
162 bios_cpu_apicid[num_processors - found_bsp] = m->mpc_apicid; 164 cpu = num_processors - found_bsp;
163 x86_cpu_to_apicid[num_processors - found_bsp] = m->mpc_apicid; 165 bios_cpu_apicid[cpu] = m->mpc_apicid;
164 } 166 x86_cpu_to_apicid[cpu] = m->mpc_apicid;
167
168 cpu_set(cpu, cpu_possible_map);
169 cpu_set(cpu, cpu_present_map);
165} 170}
166 171
167static void __init MP_bus_info (struct mpc_config_bus *m) 172static void __init MP_bus_info (struct mpc_config_bus *m)
@@ -965,8 +970,21 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
965 * due to unused I/O APIC pins. 970 * due to unused I/O APIC pins.
966 */ 971 */
967 int irq = gsi; 972 int irq = gsi;
968 gsi = pci_irq++; 973 if (gsi < MAX_GSI_NUM) {
969 gsi_to_irq[irq] = gsi; 974 if (gsi > 15)
975 gsi = pci_irq++;
976#ifdef CONFIG_ACPI_BUS
977 /*
978 * Don't assign IRQ used by ACPI SCI
979 */
980 if (gsi == acpi_fadt.sci_int)
981 gsi = pci_irq++;
982#endif
983 gsi_to_irq[irq] = gsi;
984 } else {
985 printk(KERN_ERR "GSI %u is too high\n", gsi);
986 return gsi;
987 }
970 } 988 }
971 989
972 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, 990 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 5fd03225058a..116a491e2961 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -645,15 +645,15 @@ void __init setup_arch(char **cmdline_p)
645 } 645 }
646 } 646 }
647#endif 647#endif
648
649 sparse_init();
650
651#ifdef CONFIG_KEXEC 648#ifdef CONFIG_KEXEC
652 if (crashk_res.start != crashk_res.end) { 649 if (crashk_res.start != crashk_res.end) {
653 reserve_bootmem(crashk_res.start, 650 reserve_bootmem(crashk_res.start,
654 crashk_res.end - crashk_res.start + 1); 651 crashk_res.end - crashk_res.start + 1);
655 } 652 }
656#endif 653#endif
654
655 sparse_init();
656
657 paging_init(); 657 paging_init();
658 658
659 check_ioapic(); 659 check_ioapic();
@@ -765,8 +765,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
765 int cpu = smp_processor_id(); 765 int cpu = smp_processor_id();
766 int node = 0; 766 int node = 0;
767 unsigned bits; 767 unsigned bits;
768 if (c->x86_num_cores == 1)
769 return;
770 768
771 bits = 0; 769 bits = 0;
772 while ((1 << bits) < c->x86_num_cores) 770 while ((1 << bits) < c->x86_num_cores)
@@ -1081,8 +1079,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1081 else 1079 else
1082 mtrr_ap_init(); 1080 mtrr_ap_init();
1083#ifdef CONFIG_NUMA 1081#ifdef CONFIG_NUMA
1084 if (c != &boot_cpu_data) 1082 numa_add_cpu(smp_processor_id());
1085 numa_add_cpu(c - cpu_data);
1086#endif 1083#endif
1087} 1084}
1088 1085
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index f2b9c6bc999a..34082c1cc41e 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -12,6 +12,7 @@
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/module.h>
15#include <asm/bootsetup.h> 16#include <asm/bootsetup.h>
16#include <asm/pda.h> 17#include <asm/pda.h>
17#include <asm/pgtable.h> 18#include <asm/pgtable.h>
@@ -22,10 +23,8 @@
22#include <asm/smp.h> 23#include <asm/smp.h>
23#include <asm/i387.h> 24#include <asm/i387.h>
24#include <asm/percpu.h> 25#include <asm/percpu.h>
25#include <asm/mtrr.h>
26#include <asm/proto.h> 26#include <asm/proto.h>
27#include <asm/mman.h> 27#include <asm/sections.h>
28#include <asm/numa.h>
29 28
30char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; 29char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
31 30
@@ -33,11 +32,6 @@ cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
33 32
34struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 33struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned;
35 34
36extern struct task_struct init_task;
37
38extern unsigned char __per_cpu_start[], __per_cpu_end[];
39
40extern struct desc_ptr cpu_gdt_descr[];
41struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 35struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
42 36
43char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); 37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
@@ -101,7 +95,7 @@ void __init setup_per_cpu_areas(void)
101#endif 95#endif
102 96
103 for (i = 0; i < NR_CPUS; i++) { 97 for (i = 0; i < NR_CPUS; i++) {
104 unsigned char *ptr; 98 char *ptr;
105 99
106 if (!NODE_DATA(cpu_to_node(i))) { 100 if (!NODE_DATA(cpu_to_node(i))) {
107 printk("cpu with no node %d, num_online_nodes %d\n", 101 printk("cpu with no node %d, num_online_nodes %d\n",
@@ -190,11 +184,7 @@ void __cpuinit check_efer(void)
190 */ 184 */
191void __cpuinit cpu_init (void) 185void __cpuinit cpu_init (void)
192{ 186{
193#ifdef CONFIG_SMP
194 int cpu = stack_smp_processor_id(); 187 int cpu = stack_smp_processor_id();
195#else
196 int cpu = smp_processor_id();
197#endif
198 struct tss_struct *t = &per_cpu(init_tss, cpu); 188 struct tss_struct *t = &per_cpu(init_tss, cpu);
199 unsigned long v; 189 unsigned long v;
200 char *estacks = NULL; 190 char *estacks = NULL;
@@ -214,7 +204,7 @@ void __cpuinit cpu_init (void)
214 204
215 printk("Initializing CPU#%d\n", cpu); 205 printk("Initializing CPU#%d\n", cpu);
216 206
217 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); 207 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
218 208
219 /* 209 /*
220 * Initialize the per-CPU GDT with the boot GDT, 210 * Initialize the per-CPU GDT with the boot GDT,
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
index ccae392886af..e5958220d6b8 100644
--- a/arch/x86_64/kernel/smp.c
+++ b/arch/x86_64/kernel/smp.c
@@ -129,10 +129,9 @@ asmlinkage void smp_invalidate_interrupt (void)
129 } else 129 } else
130 leave_mm(cpu); 130 leave_mm(cpu);
131 } 131 }
132out:
132 ack_APIC_irq(); 133 ack_APIC_irq();
133 cpu_clear(cpu, flush_cpumask); 134 cpu_clear(cpu, flush_cpumask);
134
135out:
136 put_cpu_no_resched(); 135 put_cpu_no_resched();
137} 136}
138 137
@@ -294,6 +293,69 @@ void unlock_ipi_call_lock(void)
294} 293}
295 294
296/* 295/*
296 * this function sends a 'generic call function' IPI to one other CPU
297 * in the system.
298 */
299static void __smp_call_function_single (int cpu, void (*func) (void *info), void *info,
300 int nonatomic, int wait)
301{
302 struct call_data_struct data;
303 int cpus = 1;
304
305 data.func = func;
306 data.info = info;
307 atomic_set(&data.started, 0);
308 data.wait = wait;
309 if (wait)
310 atomic_set(&data.finished, 0);
311
312 call_data = &data;
313 wmb();
314 /* Send a message to all other CPUs and wait for them to respond */
315 send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR);
316
317 /* Wait for response */
318 while (atomic_read(&data.started) != cpus)
319 cpu_relax();
320
321 if (!wait)
322 return;
323
324 while (atomic_read(&data.finished) != cpus)
325 cpu_relax();
326}
327
328/*
329 * smp_call_function_single - Run a function on another CPU
330 * @func: The function to run. This must be fast and non-blocking.
331 * @info: An arbitrary pointer to pass to the function.
332 * @nonatomic: Currently unused.
333 * @wait: If true, wait until function has completed on other CPUs.
334 *
335 * Retrurns 0 on success, else a negative status code.
336 *
337 * Does not return until the remote CPU is nearly ready to execute <func>
338 * or is or has executed.
339 */
340
341int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
342 int nonatomic, int wait)
343{
344 /* prevent preemption and reschedule on another processor */
345 int me = get_cpu();
346 if (cpu == me) {
347 WARN_ON(1);
348 put_cpu();
349 return -EBUSY;
350 }
351 spin_lock_bh(&call_lock);
352 __smp_call_function_single(cpu, func, info, nonatomic, wait);
353 spin_unlock_bh(&call_lock);
354 put_cpu();
355 return 0;
356}
357
358/*
297 * this function sends a 'generic call function' IPI to all other CPUs 359 * this function sends a 'generic call function' IPI to all other CPUs
298 * in the system. 360 * in the system.
299 */ 361 */
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index b969ee128728..6e4807d64d46 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -113,24 +113,6 @@ struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
113#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) 113#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p))
114 114
115/* 115/*
116 * cpu_possible_map should be static, it cannot change as cpu's
117 * are onlined, or offlined. The reason is per-cpu data-structures
118 * are allocated by some modules at init time, and dont expect to
119 * do this dynamically on cpu arrival/departure.
120 * cpu_present_map on the other hand can change dynamically.
121 * In case when cpu_hotplug is not compiled, then we resort to current
122 * behaviour, which is cpu_possible == cpu_present.
123 * If cpu-hotplug is supported, then we need to preallocate for all
124 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range.
125 * - Ashok Raj
126 */
127#ifdef CONFIG_HOTPLUG_CPU
128#define fixup_cpu_possible_map(x) cpu_set((x), cpu_possible_map)
129#else
130#define fixup_cpu_possible_map(x)
131#endif
132
133/*
134 * Currently trivial. Write the real->protected mode 116 * Currently trivial. Write the real->protected mode
135 * bootstrap into the page concerned. The caller 117 * bootstrap into the page concerned. The caller
136 * has made sure it's suitably aligned. 118 * has made sure it's suitably aligned.
@@ -229,9 +211,6 @@ static __cpuinit void sync_master(void *arg)
229{ 211{
230 unsigned long flags, i; 212 unsigned long flags, i;
231 213
232 if (smp_processor_id() != boot_cpu_id)
233 return;
234
235 go[MASTER] = 0; 214 go[MASTER] = 0;
236 215
237 local_irq_save(flags); 216 local_irq_save(flags);
@@ -280,12 +259,12 @@ get_delta(long *rt, long *master)
280 return tcenter - best_tm; 259 return tcenter - best_tm;
281} 260}
282 261
283static __cpuinit void sync_tsc(void) 262static __cpuinit void sync_tsc(unsigned int master)
284{ 263{
285 int i, done = 0; 264 int i, done = 0;
286 long delta, adj, adjust_latency = 0; 265 long delta, adj, adjust_latency = 0;
287 unsigned long flags, rt, master_time_stamp, bound; 266 unsigned long flags, rt, master_time_stamp, bound;
288#if DEBUG_TSC_SYNC 267#ifdef DEBUG_TSC_SYNC
289 static struct syncdebug { 268 static struct syncdebug {
290 long rt; /* roundtrip time */ 269 long rt; /* roundtrip time */
291 long master; /* master's timestamp */ 270 long master; /* master's timestamp */
@@ -294,9 +273,17 @@ static __cpuinit void sync_tsc(void)
294 } t[NUM_ROUNDS] __cpuinitdata; 273 } t[NUM_ROUNDS] __cpuinitdata;
295#endif 274#endif
296 275
276 printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n",
277 smp_processor_id(), master);
278
297 go[MASTER] = 1; 279 go[MASTER] = 1;
298 280
299 smp_call_function(sync_master, NULL, 1, 0); 281 /* It is dangerous to broadcast IPI as cpus are coming up,
282 * as they may not be ready to accept them. So since
283 * we only need to send the ipi to the boot cpu direct
284 * the message, and avoid the race.
285 */
286 smp_call_function_single(master, sync_master, NULL, 1, 0);
300 287
301 while (go[MASTER]) /* wait for master to be ready */ 288 while (go[MASTER]) /* wait for master to be ready */
302 no_cpu_relax(); 289 no_cpu_relax();
@@ -321,7 +308,7 @@ static __cpuinit void sync_tsc(void)
321 rdtscll(t); 308 rdtscll(t);
322 wrmsrl(MSR_IA32_TSC, t + adj); 309 wrmsrl(MSR_IA32_TSC, t + adj);
323 } 310 }
324#if DEBUG_TSC_SYNC 311#ifdef DEBUG_TSC_SYNC
325 t[i].rt = rt; 312 t[i].rt = rt;
326 t[i].master = master_time_stamp; 313 t[i].master = master_time_stamp;
327 t[i].diff = delta; 314 t[i].diff = delta;
@@ -331,7 +318,7 @@ static __cpuinit void sync_tsc(void)
331 } 318 }
332 spin_unlock_irqrestore(&tsc_sync_lock, flags); 319 spin_unlock_irqrestore(&tsc_sync_lock, flags);
333 320
334#if DEBUG_TSC_SYNC 321#ifdef DEBUG_TSC_SYNC
335 for (i = 0; i < NUM_ROUNDS; ++i) 322 for (i = 0; i < NUM_ROUNDS; ++i)
336 printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n", 323 printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n",
337 t[i].rt, t[i].master, t[i].diff, t[i].lat); 324 t[i].rt, t[i].master, t[i].diff, t[i].lat);
@@ -340,16 +327,14 @@ static __cpuinit void sync_tsc(void)
340 printk(KERN_INFO 327 printk(KERN_INFO
341 "CPU %d: synchronized TSC with CPU %u (last diff %ld cycles, " 328 "CPU %d: synchronized TSC with CPU %u (last diff %ld cycles, "
342 "maxerr %lu cycles)\n", 329 "maxerr %lu cycles)\n",
343 smp_processor_id(), boot_cpu_id, delta, rt); 330 smp_processor_id(), master, delta, rt);
344} 331}
345 332
346static void __cpuinit tsc_sync_wait(void) 333static void __cpuinit tsc_sync_wait(void)
347{ 334{
348 if (notscsync || !cpu_has_tsc) 335 if (notscsync || !cpu_has_tsc)
349 return; 336 return;
350 printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n", smp_processor_id(), 337 sync_tsc(boot_cpu_id);
351 boot_cpu_id);
352 sync_tsc();
353} 338}
354 339
355static __init int notscsync_setup(char *s) 340static __init int notscsync_setup(char *s)
@@ -537,7 +522,7 @@ void __cpuinit start_secondary(void)
537extern volatile unsigned long init_rsp; 522extern volatile unsigned long init_rsp;
538extern void (*initial_code)(void); 523extern void (*initial_code)(void);
539 524
540#if APIC_DEBUG 525#ifdef APIC_DEBUG
541static void inquire_remote_apic(int apicid) 526static void inquire_remote_apic(int apicid)
542{ 527{
543 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 }; 528 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 };
@@ -773,8 +758,9 @@ do_rest:
773 initial_code = start_secondary; 758 initial_code = start_secondary;
774 clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); 759 clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK);
775 760
776 printk(KERN_INFO "Booting processor %d/%d rip %lx rsp %lx\n", cpu, apicid, 761 printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu,
777 start_rip, init_rsp); 762 cpus_weight(cpu_present_map),
763 apicid);
778 764
779 /* 765 /*
780 * This grunge runs the startup process for 766 * This grunge runs the startup process for
@@ -841,7 +827,7 @@ do_rest:
841 else 827 else
842 /* trampoline code not run */ 828 /* trampoline code not run */
843 printk("Not responding.\n"); 829 printk("Not responding.\n");
844#if APIC_DEBUG 830#ifdef APIC_DEBUG
845 inquire_remote_apic(apicid); 831 inquire_remote_apic(apicid);
846#endif 832#endif
847 } 833 }
@@ -924,6 +910,27 @@ static __init void enforce_max_cpus(unsigned max_cpus)
924 } 910 }
925} 911}
926 912
913#ifdef CONFIG_HOTPLUG_CPU
914/*
915 * cpu_possible_map should be static, it cannot change as cpu's
916 * are onlined, or offlined. The reason is per-cpu data-structures
917 * are allocated by some modules at init time, and dont expect to
918 * do this dynamically on cpu arrival/departure.
919 * cpu_present_map on the other hand can change dynamically.
920 * In case when cpu_hotplug is not compiled, then we resort to current
921 * behaviour, which is cpu_possible == cpu_present.
922 * If cpu-hotplug is supported, then we need to preallocate for all
923 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range.
924 * - Ashok Raj
925 */
926static void prefill_possible_map(void)
927{
928 int i;
929 for (i = 0; i < NR_CPUS; i++)
930 cpu_set(i, cpu_possible_map);
931}
932#endif
933
927/* 934/*
928 * Various sanity checks. 935 * Various sanity checks.
929 */ 936 */
@@ -987,25 +994,15 @@ static int __init smp_sanity_check(unsigned max_cpus)
987 */ 994 */
988void __init smp_prepare_cpus(unsigned int max_cpus) 995void __init smp_prepare_cpus(unsigned int max_cpus)
989{ 996{
990 int i;
991
992 nmi_watchdog_default(); 997 nmi_watchdog_default();
993 current_cpu_data = boot_cpu_data; 998 current_cpu_data = boot_cpu_data;
994 current_thread_info()->cpu = 0; /* needed? */ 999 current_thread_info()->cpu = 0; /* needed? */
995 1000
996 enforce_max_cpus(max_cpus); 1001 enforce_max_cpus(max_cpus);
997 1002
998 /* 1003#ifdef CONFIG_HOTPLUG_CPU
999 * Fill in cpu_present_mask 1004 prefill_possible_map();
1000 */ 1005#endif
1001 for (i = 0; i < NR_CPUS; i++) {
1002 int apicid = cpu_present_to_apicid(i);
1003 if (physid_isset(apicid, phys_cpu_present_map)) {
1004 cpu_set(i, cpu_present_map);
1005 cpu_set(i, cpu_possible_map);
1006 }
1007 fixup_cpu_possible_map(i);
1008 }
1009 1006
1010 if (smp_sanity_check(max_cpus) < 0) { 1007 if (smp_sanity_check(max_cpus) < 0) {
1011 printk(KERN_INFO "SMP disabled\n"); 1008 printk(KERN_INFO "SMP disabled\n");
@@ -1189,8 +1186,7 @@ void __cpu_die(unsigned int cpu)
1189 printk ("CPU %d is now offline\n", cpu); 1186 printk ("CPU %d is now offline\n", cpu);
1190 return; 1187 return;
1191 } 1188 }
1192 current->state = TASK_UNINTERRUPTIBLE; 1189 msleep(100);
1193 schedule_timeout(HZ/10);
1194 } 1190 }
1195 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1191 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
1196} 1192}
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 102736630002..6ead433a3885 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -594,9 +594,6 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
594 if (!cpu) 594 if (!cpu)
595 reason = get_nmi_reason(); 595 reason = get_nmi_reason();
596 596
597 if (!cpu_online(cpu))
598 return;
599
600 if (!(reason & 0xc0)) { 597 if (!(reason & 0xc0)) {
601 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) 598 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT)
602 == NOTIFY_STOP) 599 == NOTIFY_STOP)
diff --git a/arch/x86_64/lib/csum-copy.S b/arch/x86_64/lib/csum-copy.S
index 01808ec37836..72fd55ee896e 100644
--- a/arch/x86_64/lib/csum-copy.S
+++ b/arch/x86_64/lib/csum-copy.S
@@ -188,8 +188,8 @@ csum_partial_copy_generic:
188 source 188 source
189 movw (%rdi),%bx 189 movw (%rdi),%bx
190 adcl %ebx,%eax 190 adcl %ebx,%eax
191 dest
192 decl %ecx 191 decl %ecx
192 dest
193 movw %bx,(%rsi) 193 movw %bx,(%rsi)
194 leaq 2(%rdi),%rdi 194 leaq 2(%rdi),%rdi
195 leaq 2(%rsi),%rsi 195 leaq 2(%rsi),%rsi
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c
index 33a873a3c223..841bd738a189 100644
--- a/arch/x86_64/lib/delay.c
+++ b/arch/x86_64/lib/delay.c
@@ -18,8 +18,6 @@
18#include <asm/smp.h> 18#include <asm/smp.h>
19#endif 19#endif
20 20
21int x86_udelay_tsc = 0; /* Delay via TSC */
22
23int read_current_timer(unsigned long *timer_value) 21int read_current_timer(unsigned long *timer_value)
24{ 22{
25 rdtscll(*timer_value); 23 rdtscll(*timer_value);
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 2f187986f940..493819e543a5 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -23,7 +23,6 @@
23#include <linux/vt_kern.h> /* For unblank_screen() */ 23#include <linux/vt_kern.h> /* For unblank_screen() */
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kprobes.h>
27 26
28#include <asm/system.h> 27#include <asm/system.h>
29#include <asm/uaccess.h> 28#include <asm/uaccess.h>
@@ -440,13 +439,13 @@ good_area:
440 * the fault. 439 * the fault.
441 */ 440 */
442 switch (handle_mm_fault(mm, vma, address, write)) { 441 switch (handle_mm_fault(mm, vma, address, write)) {
443 case 1: 442 case VM_FAULT_MINOR:
444 tsk->min_flt++; 443 tsk->min_flt++;
445 break; 444 break;
446 case 2: 445 case VM_FAULT_MAJOR:
447 tsk->maj_flt++; 446 tsk->maj_flt++;
448 break; 447 break;
449 case 0: 448 case VM_FAULT_SIGBUS:
450 goto do_sigbus; 449 goto do_sigbus;
451 default: 450 default:
452 goto out_of_memory; 451 goto out_of_memory;
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index ac61c186eb02..70cb2904a90f 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -36,34 +36,36 @@ int numa_off __initdata;
36int __init compute_hash_shift(struct node *nodes, int numnodes) 36int __init compute_hash_shift(struct node *nodes, int numnodes)
37{ 37{
38 int i; 38 int i;
39 int shift = 24; 39 int shift = 20;
40 u64 addr; 40 unsigned long addr,maxend=0;
41 41
42 /* When in doubt use brute force. */ 42 for (i = 0; i < numnodes; i++)
43 while (shift < 48) { 43 if ((nodes[i].start != nodes[i].end) && (nodes[i].end > maxend))
44 memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE); 44 maxend = nodes[i].end;
45 for (i = 0; i < numnodes; i++) { 45
46 if (nodes[i].start == nodes[i].end) 46 while ((1UL << shift) < (maxend / NODEMAPSIZE))
47 continue; 47 shift++;
48 for (addr = nodes[i].start; 48
49 addr < nodes[i].end; 49 printk (KERN_DEBUG"Using %d for the hash shift. Max adder is %lx \n",
50 addr += (1UL << shift)) { 50 shift,maxend);
51 if (memnodemap[addr >> shift] != 0xff && 51 memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE);
52 memnodemap[addr >> shift] != i) { 52 for (i = 0; i < numnodes; i++) {
53 printk(KERN_INFO 53 if (nodes[i].start == nodes[i].end)
54 "node %d shift %d addr %Lx conflict %d\n", 54 continue;
55 i, shift, addr, memnodemap[addr>>shift]); 55 for (addr = nodes[i].start;
56 goto next; 56 addr < nodes[i].end;
57 } 57 addr += (1UL << shift)) {
58 memnodemap[addr >> shift] = i; 58 if (memnodemap[addr >> shift] != 0xff) {
59 printk(KERN_INFO
60 "Your memory is not aligned you need to rebuild your kernel "
61 "with a bigger NODEMAPSIZE shift=%d adder=%lu\n",
62 shift,addr);
63 return -1;
59 } 64 }
65 memnodemap[addr >> shift] = i;
60 } 66 }
61 return shift;
62 next:
63 shift++;
64 } 67 }
65 memset(memnodemap,0,sizeof(*memnodemap) * NODEMAPSIZE); 68 return shift;
66 return -1;
67} 69}
68 70
69#ifdef CONFIG_SPARSEMEM 71#ifdef CONFIG_SPARSEMEM
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 5d01b31472e1..8e3d097a9ddd 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -20,6 +20,9 @@
20 20
21static struct acpi_table_slit *acpi_slit; 21static struct acpi_table_slit *acpi_slit;
22 22
23/* Internal processor count */
24static unsigned int __initdata num_processors = 0;
25
23static nodemask_t nodes_parsed __initdata; 26static nodemask_t nodes_parsed __initdata;
24static nodemask_t nodes_found __initdata; 27static nodemask_t nodes_found __initdata;
25static struct node nodes[MAX_NUMNODES] __initdata; 28static struct node nodes[MAX_NUMNODES] __initdata;
@@ -101,16 +104,18 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
101 bad_srat(); 104 bad_srat();
102 return; 105 return;
103 } 106 }
104 if (pa->apic_id >= NR_CPUS) { 107 if (num_processors >= NR_CPUS) {
105 printk(KERN_ERR "SRAT: lapic %u too large.\n", 108 printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n",
106 pa->apic_id); 109 num_processors, pa->apic_id, NR_CPUS);
107 bad_srat(); 110 bad_srat();
108 return; 111 return;
109 } 112 }
110 cpu_to_node[pa->apic_id] = node; 113 cpu_to_node[num_processors] = node;
111 acpi_numa = 1; 114 acpi_numa = 1;
112 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", 115 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n",
113 pxm, pa->apic_id, node); 116 pxm, pa->apic_id, num_processors, node);
117
118 num_processors++;
114} 119}
115 120
116/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 121/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
@@ -124,7 +129,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
124 129
125 if (srat_disabled() || ma->flags.enabled == 0) 130 if (srat_disabled() || ma->flags.enabled == 0)
126 return; 131 return;
127 /* hotplug bit is ignored for now */
128 pxm = ma->proximity_domain; 132 pxm = ma->proximity_domain;
129 node = setup_node(pxm); 133 node = setup_node(pxm);
130 if (node < 0) { 134 if (node < 0) {
@@ -134,6 +138,10 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
134 } 138 }
135 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); 139 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
136 end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); 140 end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
141 /* It is fine to add this area to the nodes data it will be used later*/
142 if (ma->flags.hot_pluggable == 1)
143 printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n",
144 start, end);
137 i = conflicting_nodes(start, end); 145 i = conflicting_nodes(start, end);
138 if (i >= 0) { 146 if (i >= 0) {
139 printk(KERN_ERR 147 printk(KERN_ERR
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c
index 7e7d0c2a0025..c2c38b579939 100644
--- a/arch/x86_64/pci/k8-bus.c
+++ b/arch/x86_64/pci/k8-bus.c
@@ -29,7 +29,7 @@ __init static int
29fill_mp_bus_to_cpumask(void) 29fill_mp_bus_to_cpumask(void)
30{ 30{
31 struct pci_dev *nb_dev = NULL; 31 struct pci_dev *nb_dev = NULL;
32 int i, j, printed; 32 int i, j;
33 u32 ldtbus, nid; 33 u32 ldtbus, nid;
34 static int lbnr[3] = { 34 static int lbnr[3] = {
35 LDT_BUS_NUMBER_REGISTER_0, 35 LDT_BUS_NUMBER_REGISTER_0,