aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/apm.c2
-rw-r--r--arch/arm/kernel/ecard.c2
-rw-r--r--arch/arm/mach-omap1/Kconfig1
-rw-r--r--arch/arm/mach-omap1/board-osk.c1
-rw-r--r--arch/arm/mach-pxa/Kconfig16
-rw-r--r--arch/arm/plat-omap/Kconfig2
-rw-r--r--arch/arm26/kernel/ecard.c2
-rw-r--r--arch/arm26/kernel/irq.c2
-rw-r--r--arch/cris/arch-v10/drivers/axisflashmap.c2
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c2
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c2
-rw-r--r--arch/cris/arch-v32/drivers/gpio.c2
-rw-r--r--arch/cris/arch-v32/kernel/signal.c2
-rw-r--r--arch/cris/kernel/profile.c2
-rw-r--r--arch/h8300/kernel/ints.c2
-rw-r--r--arch/h8300/platform/h8s/ints.c2
-rw-r--r--arch/i386/kernel/apm.c2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/Kconfig6
-rw-r--r--arch/i386/kernel/cpu/cpufreq/Makefile2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c813
-rw-r--r--arch/i386/kernel/cpu/cpufreq/gx-suspmod.c4
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c8
-rw-r--r--arch/i386/kernel/cpu/cpufreq/p4-clockmod.c38
-rw-r--r--arch/i386/kernel/cpu/cpufreq/sc520_freq.c7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c15
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-lib.c32
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-lib.h1
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-smi.c3
-rw-r--r--arch/i386/kernel/microcode.c6
-rw-r--r--arch/i386/kernel/smpboot.c2
-rw-r--r--arch/ia64/hp/sim/simserial.c2
-rw-r--r--arch/ia64/kernel/Makefile1
-rw-r--r--arch/ia64/kernel/crash.c22
-rw-r--r--arch/ia64/kernel/crash_dump.c48
-rw-r--r--arch/ia64/kernel/jprobes.S3
-rw-r--r--arch/ia64/kernel/kprobes.c226
-rw-r--r--arch/ia64/kernel/machine_kexec.c7
-rw-r--r--arch/ia64/kernel/mca.c2
-rw-r--r--arch/ia64/kernel/setup.c33
-rw-r--r--arch/ia64/kernel/smp.c4
-rw-r--r--arch/ia64/kernel/traps.c50
-rw-r--r--arch/ia64/mm/contig.c9
-rw-r--r--arch/ia64/mm/init.c9
-rw-r--r--arch/ia64/sn/kernel/setup.c12
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c2
-rw-r--r--arch/ia64/sn/kernel/xpc_channel.c15
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c64
-rw-r--r--arch/m68k/mm/kmap.c2
-rw-r--r--arch/mips/kernel/apm.c2
-rw-r--r--arch/mips/mm/init.c25
-rw-r--r--arch/parisc/hpux/sys_hpux.c2
-rw-r--r--arch/parisc/kernel/unwind.c2
-rw-r--r--arch/powerpc/kernel/nvram_64.c4
-rw-r--r--arch/powerpc/kernel/pci_32.c2
-rw-r--r--arch/powerpc/mm/imalloc.c6
-rw-r--r--arch/powerpc/platforms/4xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c2
-rw-r--r--arch/ppc/8260_io/fcc_enet.c4
-rw-r--r--arch/ppc/8xx_io/cs4218_tdm.c2
-rw-r--r--arch/ppc/Kconfig4
-rw-r--r--arch/ppc/platforms/4xx/Kconfig2
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/kernel/debug.c8
-rw-r--r--arch/s390/kernel/s390_ext.c2
-rw-r--r--arch/sparc/kernel/irq.c4
-rw-r--r--arch/sparc/kernel/sun4d_irq.c2
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c4
-rw-r--r--arch/um/drivers/net_kern.c18
-rw-r--r--arch/um/include/net_kern.h2
-rw-r--r--arch/um/sys-i386/ldt.c4
-rw-r--r--arch/v850/Kconfig28
-rw-r--r--arch/x86_64/kernel/cpufreq/Kconfig6
-rw-r--r--arch/x86_64/kernel/cpufreq/Makefile2
-rw-r--r--arch/xtensa/kernel/Makefile2
-rw-r--r--arch/xtensa/kernel/syscall.c2
76 files changed, 1061 insertions, 580 deletions
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c
index a11fb9a40c04..2c37b70b17ab 100644
--- a/arch/arm/kernel/apm.c
+++ b/arch/arm/kernel/apm.c
@@ -423,7 +423,7 @@ static int apm_open(struct inode * inode, struct file * filp)
423{ 423{
424 struct apm_user *as; 424 struct apm_user *as;
425 425
426 as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL); 426 as = kzalloc(sizeof(*as), GFP_KERNEL);
427 if (as) { 427 if (as) {
428 /* 428 /*
429 * XXX - this is a tiny bit broken, when we consider BSD 429 * XXX - this is a tiny bit broken, when we consider BSD
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index a786f769035d..71257e3d513f 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -353,7 +353,7 @@ int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
353 } 353 }
354 if (c_id(&excd) == 0x80) { /* loader */ 354 if (c_id(&excd) == 0x80) { /* loader */
355 if (!ec->loader) { 355 if (!ec->loader) {
356 ec->loader = (loader_t)kmalloc(c_len(&excd), 356 ec->loader = kmalloc(c_len(&excd),
357 GFP_KERNEL); 357 GFP_KERNEL);
358 if (ec->loader) 358 if (ec->loader)
359 ecard_readbytes(ec->loader, ec, 359 ecard_readbytes(ec->loader, ec,
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index d135568dc9e7..8781aaeb576b 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -43,6 +43,7 @@ config MACH_OMAP_H3
43config MACH_OMAP_OSK 43config MACH_OMAP_OSK
44 bool "TI OSK Support" 44 bool "TI OSK Support"
45 depends on ARCH_OMAP1 && ARCH_OMAP16XX 45 depends on ARCH_OMAP1 && ARCH_OMAP16XX
46 select TPS65010
46 help 47 help
47 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here 48 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
48 if you have such a board. 49 if you have such a board.
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 3a622801d7b0..7d0cf7af88ce 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/irq.h> 32#include <linux/irq.h>
33#include <linux/interrupt.h>
33 34
34#include <linux/mtd/mtd.h> 35#include <linux/mtd/mtd.h>
35#include <linux/mtd/partitions.h> 36#include <linux/mtd/partitions.h>
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 9e3d0bdcba07..5c0a10041cd1 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -75,28 +75,28 @@ endmenu
75 75
76config MACH_POODLE 76config MACH_POODLE
77 bool "Enable Sharp SL-5600 (Poodle) Support" 77 bool "Enable Sharp SL-5600 (Poodle) Support"
78 depends PXA_SHARPSL_25x 78 depends on PXA_SHARPSL_25x
79 select SHARP_LOCOMO 79 select SHARP_LOCOMO
80 select PXA_SSP 80 select PXA_SSP
81 81
82config MACH_CORGI 82config MACH_CORGI
83 bool "Enable Sharp SL-C700 (Corgi) Support" 83 bool "Enable Sharp SL-C700 (Corgi) Support"
84 depends PXA_SHARPSL_25x 84 depends on PXA_SHARPSL_25x
85 select PXA_SHARP_C7xx 85 select PXA_SHARP_C7xx
86 86
87config MACH_SHEPHERD 87config MACH_SHEPHERD
88 bool "Enable Sharp SL-C750 (Shepherd) Support" 88 bool "Enable Sharp SL-C750 (Shepherd) Support"
89 depends PXA_SHARPSL_25x 89 depends on PXA_SHARPSL_25x
90 select PXA_SHARP_C7xx 90 select PXA_SHARP_C7xx
91 91
92config MACH_HUSKY 92config MACH_HUSKY
93 bool "Enable Sharp SL-C760 (Husky) Support" 93 bool "Enable Sharp SL-C760 (Husky) Support"
94 depends PXA_SHARPSL_25x 94 depends on PXA_SHARPSL_25x
95 select PXA_SHARP_C7xx 95 select PXA_SHARP_C7xx
96 96
97config MACH_AKITA 97config MACH_AKITA
98 bool "Enable Sharp SL-1000 (Akita) Support" 98 bool "Enable Sharp SL-1000 (Akita) Support"
99 depends PXA_SHARPSL_27x 99 depends on PXA_SHARPSL_27x
100 select PXA_SHARP_Cxx00 100 select PXA_SHARP_Cxx00
101 select MACH_SPITZ 101 select MACH_SPITZ
102 select I2C 102 select I2C
@@ -104,17 +104,17 @@ config MACH_AKITA
104 104
105config MACH_SPITZ 105config MACH_SPITZ
106 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support" 106 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
107 depends PXA_SHARPSL_27x 107 depends on PXA_SHARPSL_27x
108 select PXA_SHARP_Cxx00 108 select PXA_SHARP_Cxx00
109 109
110config MACH_BORZOI 110config MACH_BORZOI
111 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support" 111 bool "Enable Sharp Zaurus SL-3100 (Borzoi) Support"
112 depends PXA_SHARPSL_27x 112 depends on PXA_SHARPSL_27x
113 select PXA_SHARP_Cxx00 113 select PXA_SHARP_Cxx00
114 114
115config MACH_TOSA 115config MACH_TOSA
116 bool "Enable Sharp SL-6000x (Tosa) Support" 116 bool "Enable Sharp SL-6000x (Tosa) Support"
117 depends PXA_SHARPSL_25x 117 depends on PXA_SHARPSL_25x
118 118
119config PXA25x 119config PXA25x
120 bool 120 bool
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index ec752e16d618..f2dc363de66b 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -113,7 +113,7 @@ endchoice
113 113
114config OMAP_SERIAL_WAKE 114config OMAP_SERIAL_WAKE
115 bool "Enable wake-up events for serial ports" 115 bool "Enable wake-up events for serial ports"
116 depends OMAP_MUX 116 depends on OMAP_MUX
117 default y 117 default y
118 help 118 help
119 Select this option if you want to have your system wake up 119 Select this option if you want to have your system wake up
diff --git a/arch/arm26/kernel/ecard.c b/arch/arm26/kernel/ecard.c
index 43dd41be71fb..9dbc17247c6f 100644
--- a/arch/arm26/kernel/ecard.c
+++ b/arch/arm26/kernel/ecard.c
@@ -215,7 +215,7 @@ int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
215 } 215 }
216 if (c_id(&excd) == 0x80) { /* loader */ 216 if (c_id(&excd) == 0x80) { /* loader */
217 if (!ec->loader) { 217 if (!ec->loader) {
218 ec->loader = (loader_t)kmalloc(c_len(&excd), 218 ec->loader = kmalloc(c_len(&excd),
219 GFP_KERNEL); 219 GFP_KERNEL);
220 if (ec->loader) 220 if (ec->loader)
221 ecard_readbytes(ec->loader, ec, 221 ecard_readbytes(ec->loader, ec,
diff --git a/arch/arm26/kernel/irq.c b/arch/arm26/kernel/irq.c
index d87d68b77d66..d53382c83bf9 100644
--- a/arch/arm26/kernel/irq.c
+++ b/arch/arm26/kernel/irq.c
@@ -545,7 +545,7 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_
545 (irq_flags & IRQF_SHARED && !dev_id)) 545 (irq_flags & IRQF_SHARED && !dev_id))
546 return -EINVAL; 546 return -EINVAL;
547 547
548 action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); 548 action = kmalloc(sizeof(struct irqaction), GFP_KERNEL);
549 if (!action) 549 if (!action)
550 return -ENOMEM; 550 return -ENOMEM;
551 551
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
index 4fa81abab0c7..ffade19a14e6 100644
--- a/arch/cris/arch-v10/drivers/axisflashmap.c
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c
@@ -516,7 +516,7 @@ static int __init init_axis_flash(void)
516#else 516#else
517 struct mtd_info *mtd_ram; 517 struct mtd_info *mtd_ram;
518 518
519 mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info), 519 mtd_ram = kmalloc(sizeof(struct mtd_info),
520 GFP_KERNEL); 520 GFP_KERNEL);
521 if (!mtd_ram) { 521 if (!mtd_ram) {
522 panic("axisflashmap couldn't allocate memory for " 522 panic("axisflashmap couldn't allocate memory for "
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index fcba6632ed7b..9aba18b931dd 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -440,7 +440,7 @@ gpio_open(struct inode *inode, struct file *filp)
440 if (p > GPIO_MINOR_LAST) 440 if (p > GPIO_MINOR_LAST)
441 return -EINVAL; 441 return -EINVAL;
442 442
443 priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private), 443 priv = kmalloc(sizeof(struct gpio_private),
444 GFP_KERNEL); 444 GFP_KERNEL);
445 445
446 if (!priv) 446 if (!priv)
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
index 41952320e00a..5180d45412fc 100644
--- a/arch/cris/arch-v32/drivers/axisflashmap.c
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -427,7 +427,7 @@ static int __init init_axis_flash(void)
427#else 427#else
428 struct mtd_info *mtd_ram; 428 struct mtd_info *mtd_ram;
429 429
430 mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info), 430 mtd_ram = kmalloc(sizeof(struct mtd_info),
431 GFP_KERNEL); 431 GFP_KERNEL);
432 if (!mtd_ram) { 432 if (!mtd_ram) {
433 panic("axisflashmap couldn't allocate memory for " 433 panic("axisflashmap couldn't allocate memory for "
diff --git a/arch/cris/arch-v32/drivers/gpio.c b/arch/cris/arch-v32/drivers/gpio.c
index c3f876b4da6b..08d36f0955c6 100644
--- a/arch/cris/arch-v32/drivers/gpio.c
+++ b/arch/cris/arch-v32/drivers/gpio.c
@@ -423,7 +423,7 @@ gpio_open(struct inode *inode, struct file *filp)
423 if (p > GPIO_MINOR_LAST) 423 if (p > GPIO_MINOR_LAST)
424 return -EINVAL; 424 return -EINVAL;
425 425
426 priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private), 426 priv = kmalloc(sizeof(struct gpio_private),
427 GFP_KERNEL); 427 GFP_KERNEL);
428 428
429 if (!priv) 429 if (!priv)
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index 99e59b3eacf8..7cd6ac803409 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -686,7 +686,7 @@ keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
686int __init 686int __init
687cris_init_signal(void) 687cris_init_signal(void)
688{ 688{
689 u16* data = (u16*)kmalloc(PAGE_SIZE, GFP_KERNEL); 689 u16* data = kmalloc(PAGE_SIZE, GFP_KERNEL);
690 690
691 /* This is movu.w __NR_sigreturn, r9; break 13; */ 691 /* This is movu.w __NR_sigreturn, r9; break 13; */
692 data[0] = 0x9c5f; 692 data[0] = 0x9c5f;
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c
index 69c52189f044..f60ab785f235 100644
--- a/arch/cris/kernel/profile.c
+++ b/arch/cris/kernel/profile.c
@@ -59,7 +59,7 @@ static int
59__init init_cris_profile(void) 59__init init_cris_profile(void)
60{ 60{
61 struct proc_dir_entry *entry; 61 struct proc_dir_entry *entry;
62 sample_buffer = (char*)kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL); 62 sample_buffer = kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL);
63 sample_buffer_pos = sample_buffer; 63 sample_buffer_pos = sample_buffer;
64 entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL); 64 entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL);
65 if (entry) { 65 if (entry) {
diff --git a/arch/h8300/kernel/ints.c b/arch/h8300/kernel/ints.c
index 1bfc77e391d5..587ef7f4fcc7 100644
--- a/arch/h8300/kernel/ints.c
+++ b/arch/h8300/kernel/ints.c
@@ -141,7 +141,7 @@ int request_irq(unsigned int irq,
141 return -EBUSY; 141 return -EBUSY;
142 142
143 if (use_kmalloc) 143 if (use_kmalloc)
144 irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); 144 irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
145 else { 145 else {
146 /* use bootmem allocater */ 146 /* use bootmem allocater */
147 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t)); 147 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
diff --git a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c
index 270440de4610..567f681ddfec 100644
--- a/arch/h8300/platform/h8s/ints.c
+++ b/arch/h8300/platform/h8s/ints.c
@@ -176,7 +176,7 @@ int request_irq(unsigned int irq,
176 } 176 }
177 177
178 if (use_kmalloc) 178 if (use_kmalloc)
179 irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); 179 irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
180 else { 180 else {
181 /* use bootmem allocater */ 181 /* use bootmem allocater */
182 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t)); 182 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index a97847da9ed5..b75cff25de4b 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -1604,7 +1604,7 @@ static int do_open(struct inode * inode, struct file * filp)
1604{ 1604{
1605 struct apm_user * as; 1605 struct apm_user * as;
1606 1606
1607 as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL); 1607 as = kmalloc(sizeof(*as), GFP_KERNEL);
1608 if (as == NULL) { 1608 if (as == NULL) {
1609 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", 1609 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n",
1610 sizeof(*as)); 1610 sizeof(*as));
diff --git a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig
index ccc1edff5c97..5299c5bf4454 100644
--- a/arch/i386/kernel/cpu/cpufreq/Kconfig
+++ b/arch/i386/kernel/cpu/cpufreq/Kconfig
@@ -17,6 +17,7 @@ config X86_ACPI_CPUFREQ
17 help 17 help
18 This driver adds a CPUFreq driver which utilizes the ACPI 18 This driver adds a CPUFreq driver which utilizes the ACPI
19 Processor Performance States. 19 Processor Performance States.
20 This driver also supports Intel Enhanced Speedstep.
20 21
21 For details, take a look at <file:Documentation/cpu-freq/>. 22 For details, take a look at <file:Documentation/cpu-freq/>.
22 23
@@ -121,11 +122,14 @@ config X86_SPEEDSTEP_CENTRINO
121 If in doubt, say N. 122 If in doubt, say N.
122 123
123config X86_SPEEDSTEP_CENTRINO_ACPI 124config X86_SPEEDSTEP_CENTRINO_ACPI
124 bool "Use ACPI tables to decode valid frequency/voltage pairs" 125 bool "Use ACPI tables to decode valid frequency/voltage (deprecated)"
125 depends on X86_SPEEDSTEP_CENTRINO && ACPI_PROCESSOR 126 depends on X86_SPEEDSTEP_CENTRINO && ACPI_PROCESSOR
126 depends on !(X86_SPEEDSTEP_CENTRINO = y && ACPI_PROCESSOR = m) 127 depends on !(X86_SPEEDSTEP_CENTRINO = y && ACPI_PROCESSOR = m)
127 default y 128 default y
128 help 129 help
130 This is deprecated and this functionality is now merged into
131 acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
132 speedstep_centrino.
129 Use primarily the information provided in the BIOS ACPI tables 133 Use primarily the information provided in the BIOS ACPI tables
130 to determine valid CPU frequency and voltage pairings. It is 134 to determine valid CPU frequency and voltage pairings. It is
131 required for the driver to work on non-Banias CPUs. 135 required for the driver to work on non-Banias CPUs.
diff --git a/arch/i386/kernel/cpu/cpufreq/Makefile b/arch/i386/kernel/cpu/cpufreq/Makefile
index 2e894f1c8910..8de3abe322a9 100644
--- a/arch/i386/kernel/cpu/cpufreq/Makefile
+++ b/arch/i386/kernel/cpu/cpufreq/Makefile
@@ -7,9 +7,9 @@ obj-$(CONFIG_SC520_CPUFREQ) += sc520_freq.o
7obj-$(CONFIG_X86_LONGRUN) += longrun.o 7obj-$(CONFIG_X86_LONGRUN) += longrun.o
8obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o 8obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
9obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o 9obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o
10obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
11obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o 10obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o
12obj-$(CONFIG_X86_SPEEDSTEP_SMI) += speedstep-smi.o 11obj-$(CONFIG_X86_SPEEDSTEP_SMI) += speedstep-smi.o
13obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o 12obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o
13obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
14obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o 14obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o
15obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o 15obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 57c880bf0bd6..18f4715c655d 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * acpi-cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.3 $) 2 * acpi-cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.4 $)
3 * 3 *
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> 4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * Copyright (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de> 6 * Copyright (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de>
7 * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@intel.com>
7 * 8 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 * 10 *
@@ -27,202 +28,387 @@
27#include <linux/kernel.h> 28#include <linux/kernel.h>
28#include <linux/module.h> 29#include <linux/module.h>
29#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/smp.h>
32#include <linux/sched.h>
30#include <linux/cpufreq.h> 33#include <linux/cpufreq.h>
31#include <linux/proc_fs.h>
32#include <linux/seq_file.h>
33#include <linux/compiler.h> 34#include <linux/compiler.h>
34#include <linux/sched.h> /* current */
35#include <linux/dmi.h> 35#include <linux/dmi.h>
36#include <asm/io.h>
37#include <asm/delay.h>
38#include <asm/uaccess.h>
39 36
40#include <linux/acpi.h> 37#include <linux/acpi.h>
41#include <acpi/processor.h> 38#include <acpi/processor.h>
42 39
40#include <asm/io.h>
41#include <asm/msr.h>
42#include <asm/processor.h>
43#include <asm/cpufeature.h>
44#include <asm/delay.h>
45#include <asm/uaccess.h>
46
43#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) 47#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg)
44 48
45MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); 49MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
46MODULE_DESCRIPTION("ACPI Processor P-States Driver"); 50MODULE_DESCRIPTION("ACPI Processor P-States Driver");
47MODULE_LICENSE("GPL"); 51MODULE_LICENSE("GPL");
48 52
53enum {
54 UNDEFINED_CAPABLE = 0,
55 SYSTEM_INTEL_MSR_CAPABLE,
56 SYSTEM_IO_CAPABLE,
57};
58
59#define INTEL_MSR_RANGE (0xffff)
60#define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1)
49 61
50struct cpufreq_acpi_io { 62struct acpi_cpufreq_data {
51 struct acpi_processor_performance *acpi_data; 63 struct acpi_processor_performance *acpi_data;
52 struct cpufreq_frequency_table *freq_table; 64 struct cpufreq_frequency_table *freq_table;
53 unsigned int resume; 65 unsigned int max_freq;
66 unsigned int resume;
67 unsigned int cpu_feature;
54}; 68};
55 69
56static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; 70static struct acpi_cpufreq_data *drv_data[NR_CPUS];
57static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; 71static struct acpi_processor_performance *acpi_perf_data[NR_CPUS];
58 72
59static struct cpufreq_driver acpi_cpufreq_driver; 73static struct cpufreq_driver acpi_cpufreq_driver;
60 74
61static unsigned int acpi_pstate_strict; 75static unsigned int acpi_pstate_strict;
62 76
63static int 77static int check_est_cpu(unsigned int cpuid)
64acpi_processor_write_port( 78{
65 u16 port, 79 struct cpuinfo_x86 *cpu = &cpu_data[cpuid];
66 u8 bit_width, 80
67 u32 value) 81 if (cpu->x86_vendor != X86_VENDOR_INTEL ||
82 !cpu_has(cpu, X86_FEATURE_EST))
83 return 0;
84
85 return 1;
86}
87
88static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
89{
90 struct acpi_processor_performance *perf;
91 int i;
92
93 perf = data->acpi_data;
94
95 for (i=0; i<perf->state_count; i++) {
96 if (value == perf->states[i].status)
97 return data->freq_table[i].frequency;
98 }
99 return 0;
100}
101
102static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
68{ 103{
69 if (bit_width <= 8) { 104 int i;
105 struct acpi_processor_performance *perf;
106
107 msr &= INTEL_MSR_RANGE;
108 perf = data->acpi_data;
109
110 for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
111 if (msr == perf->states[data->freq_table[i].index].status)
112 return data->freq_table[i].frequency;
113 }
114 return data->freq_table[0].frequency;
115}
116
117static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
118{
119 switch (data->cpu_feature) {
120 case SYSTEM_INTEL_MSR_CAPABLE:
121 return extract_msr(val, data);
122 case SYSTEM_IO_CAPABLE:
123 return extract_io(val, data);
124 default:
125 return 0;
126 }
127}
128
129static void wrport(u16 port, u8 bit_width, u32 value)
130{
131 if (bit_width <= 8)
70 outb(value, port); 132 outb(value, port);
71 } else if (bit_width <= 16) { 133 else if (bit_width <= 16)
72 outw(value, port); 134 outw(value, port);
73 } else if (bit_width <= 32) { 135 else if (bit_width <= 32)
74 outl(value, port); 136 outl(value, port);
75 } else {
76 return -ENODEV;
77 }
78 return 0;
79} 137}
80 138
81static int 139static void rdport(u16 port, u8 bit_width, u32 * ret)
82acpi_processor_read_port(
83 u16 port,
84 u8 bit_width,
85 u32 *ret)
86{ 140{
87 *ret = 0; 141 *ret = 0;
88 if (bit_width <= 8) { 142 if (bit_width <= 8)
89 *ret = inb(port); 143 *ret = inb(port);
90 } else if (bit_width <= 16) { 144 else if (bit_width <= 16)
91 *ret = inw(port); 145 *ret = inw(port);
92 } else if (bit_width <= 32) { 146 else if (bit_width <= 32)
93 *ret = inl(port); 147 *ret = inl(port);
94 } else { 148}
95 return -ENODEV; 149
150struct msr_addr {
151 u32 reg;
152};
153
154struct io_addr {
155 u16 port;
156 u8 bit_width;
157};
158
159typedef union {
160 struct msr_addr msr;
161 struct io_addr io;
162} drv_addr_union;
163
164struct drv_cmd {
165 unsigned int type;
166 cpumask_t mask;
167 drv_addr_union addr;
168 u32 val;
169};
170
171static void do_drv_read(struct drv_cmd *cmd)
172{
173 u32 h;
174
175 switch (cmd->type) {
176 case SYSTEM_INTEL_MSR_CAPABLE:
177 rdmsr(cmd->addr.msr.reg, cmd->val, h);
178 break;
179 case SYSTEM_IO_CAPABLE:
180 rdport(cmd->addr.io.port, cmd->addr.io.bit_width, &cmd->val);
181 break;
182 default:
183 break;
96 } 184 }
97 return 0;
98} 185}
99 186
100static int 187static void do_drv_write(struct drv_cmd *cmd)
101acpi_processor_set_performance (
102 struct cpufreq_acpi_io *data,
103 unsigned int cpu,
104 int state)
105{ 188{
106 u16 port = 0; 189 u32 h = 0;
107 u8 bit_width = 0; 190
108 int i = 0; 191 switch (cmd->type) {
109 int ret = 0; 192 case SYSTEM_INTEL_MSR_CAPABLE:
110 u32 value = 0; 193 wrmsr(cmd->addr.msr.reg, cmd->val, h);
111 int retval; 194 break;
112 struct acpi_processor_performance *perf; 195 case SYSTEM_IO_CAPABLE:
113 196 wrport(cmd->addr.io.port, cmd->addr.io.bit_width, cmd->val);
114 dprintk("acpi_processor_set_performance\n"); 197 break;
115 198 default:
116 retval = 0; 199 break;
117 perf = data->acpi_data;
118 if (state == perf->state) {
119 if (unlikely(data->resume)) {
120 dprintk("Called after resume, resetting to P%d\n", state);
121 data->resume = 0;
122 } else {
123 dprintk("Already at target state (P%d)\n", state);
124 return (retval);
125 }
126 } 200 }
201}
127 202
128 dprintk("Transitioning from P%d to P%d\n", perf->state, state); 203static void drv_read(struct drv_cmd *cmd)
204{
205 cpumask_t saved_mask = current->cpus_allowed;
206 cmd->val = 0;
129 207
130 /* 208 set_cpus_allowed(current, cmd->mask);
131 * First we write the target state's 'control' value to the 209 do_drv_read(cmd);
132 * control_register. 210 set_cpus_allowed(current, saved_mask);
133 */ 211}
212
213static void drv_write(struct drv_cmd *cmd)
214{
215 cpumask_t saved_mask = current->cpus_allowed;
216 unsigned int i;
217
218 for_each_cpu_mask(i, cmd->mask) {
219 set_cpus_allowed(current, cpumask_of_cpu(i));
220 do_drv_write(cmd);
221 }
222
223 set_cpus_allowed(current, saved_mask);
224 return;
225}
226
227static u32 get_cur_val(cpumask_t mask)
228{
229 struct acpi_processor_performance *perf;
230 struct drv_cmd cmd;
231
232 if (unlikely(cpus_empty(mask)))
233 return 0;
234
235 switch (drv_data[first_cpu(mask)]->cpu_feature) {
236 case SYSTEM_INTEL_MSR_CAPABLE:
237 cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
238 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
239 break;
240 case SYSTEM_IO_CAPABLE:
241 cmd.type = SYSTEM_IO_CAPABLE;
242 perf = drv_data[first_cpu(mask)]->acpi_data;
243 cmd.addr.io.port = perf->control_register.address;
244 cmd.addr.io.bit_width = perf->control_register.bit_width;
245 break;
246 default:
247 return 0;
248 }
249
250 cmd.mask = mask;
134 251
135 port = perf->control_register.address; 252 drv_read(&cmd);
136 bit_width = perf->control_register.bit_width;
137 value = (u32) perf->states[state].control;
138 253
139 dprintk("Writing 0x%08x to port 0x%04x\n", value, port); 254 dprintk("get_cur_val = %u\n", cmd.val);
140 255
141 ret = acpi_processor_write_port(port, bit_width, value); 256 return cmd.val;
142 if (ret) { 257}
143 dprintk("Invalid port width 0x%04x\n", bit_width); 258
144 return (ret); 259/*
260 * Return the measured active (C0) frequency on this CPU since last call
261 * to this function.
262 * Input: cpu number
263 * Return: Average CPU frequency in terms of max frequency (zero on error)
264 *
265 * We use IA32_MPERF and IA32_APERF MSRs to get the measured performance
266 * over a period of time, while CPU is in C0 state.
267 * IA32_MPERF counts at the rate of max advertised frequency
268 * IA32_APERF counts at the rate of actual CPU frequency
269 * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and
270 * no meaning should be associated with absolute values of these MSRs.
271 */
272static unsigned int get_measured_perf(unsigned int cpu)
273{
274 union {
275 struct {
276 u32 lo;
277 u32 hi;
278 } split;
279 u64 whole;
280 } aperf_cur, mperf_cur;
281
282 cpumask_t saved_mask;
283 unsigned int perf_percent;
284 unsigned int retval;
285
286 saved_mask = current->cpus_allowed;
287 set_cpus_allowed(current, cpumask_of_cpu(cpu));
288 if (get_cpu() != cpu) {
289 /* We were not able to run on requested processor */
290 put_cpu();
291 return 0;
145 } 292 }
146 293
294 rdmsr(MSR_IA32_APERF, aperf_cur.split.lo, aperf_cur.split.hi);
295 rdmsr(MSR_IA32_MPERF, mperf_cur.split.lo, mperf_cur.split.hi);
296
297 wrmsr(MSR_IA32_APERF, 0,0);
298 wrmsr(MSR_IA32_MPERF, 0,0);
299
300#ifdef __i386__
147 /* 301 /*
148 * Assume the write went through when acpi_pstate_strict is not used. 302 * We dont want to do 64 bit divide with 32 bit kernel
149 * As read status_register is an expensive operation and there 303 * Get an approximate value. Return failure in case we cannot get
150 * are no specific error cases where an IO port write will fail. 304 * an approximate value.
151 */ 305 */
152 if (acpi_pstate_strict) { 306 if (unlikely(aperf_cur.split.hi || mperf_cur.split.hi)) {
153 /* Then we read the 'status_register' and compare the value 307 int shift_count;
154 * with the target state's 'status' to make sure the 308 u32 h;
155 * transition was successful. 309
156 * Note that we'll poll for up to 1ms (100 cycles of 10us) 310 h = max_t(u32, aperf_cur.split.hi, mperf_cur.split.hi);
157 * before giving up. 311 shift_count = fls(h);
158 */ 312
159 313 aperf_cur.whole >>= shift_count;
160 port = perf->status_register.address; 314 mperf_cur.whole >>= shift_count;
161 bit_width = perf->status_register.bit_width; 315 }
162 316
163 dprintk("Looking for 0x%08x from port 0x%04x\n", 317 if (((unsigned long)(-1) / 100) < aperf_cur.split.lo) {
164 (u32) perf->states[state].status, port); 318 int shift_count = 7;
165 319 aperf_cur.split.lo >>= shift_count;
166 for (i = 0; i < 100; i++) { 320 mperf_cur.split.lo >>= shift_count;
167 ret = acpi_processor_read_port(port, bit_width, &value); 321 }
168 if (ret) { 322
169 dprintk("Invalid port width 0x%04x\n", bit_width); 323 if (aperf_cur.split.lo && mperf_cur.split.lo)
170 return (ret); 324 perf_percent = (aperf_cur.split.lo * 100) / mperf_cur.split.lo;
171 } 325 else
172 if (value == (u32) perf->states[state].status) 326 perf_percent = 0;
173 break; 327
174 udelay(10); 328#else
175 } 329 if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) {
176 } else { 330 int shift_count = 7;
177 value = (u32) perf->states[state].status; 331 aperf_cur.whole >>= shift_count;
332 mperf_cur.whole >>= shift_count;
178 } 333 }
179 334
180 if (unlikely(value != (u32) perf->states[state].status)) { 335 if (aperf_cur.whole && mperf_cur.whole)
181 printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); 336 perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole;
182 retval = -ENODEV; 337 else
183 return (retval); 338 perf_percent = 0;
339
340#endif
341
342 retval = drv_data[cpu]->max_freq * perf_percent / 100;
343
344 put_cpu();
345 set_cpus_allowed(current, saved_mask);
346
347 dprintk("cpu %d: performance percent %d\n", cpu, perf_percent);
348 return retval;
349}
350
351static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
352{
353 struct acpi_cpufreq_data *data = drv_data[cpu];
354 unsigned int freq;
355
356 dprintk("get_cur_freq_on_cpu (%d)\n", cpu);
357
358 if (unlikely(data == NULL ||
359 data->acpi_data == NULL || data->freq_table == NULL)) {
360 return 0;
184 } 361 }
185 362
186 dprintk("Transition successful after %d microseconds\n", i * 10); 363 freq = extract_freq(get_cur_val(cpumask_of_cpu(cpu)), data);
364 dprintk("cur freq = %u\n", freq);
187 365
188 perf->state = state; 366 return freq;
189 return (retval);
190} 367}
191 368
369static unsigned int check_freqs(cpumask_t mask, unsigned int freq,
370 struct acpi_cpufreq_data *data)
371{
372 unsigned int cur_freq;
373 unsigned int i;
374
375 for (i=0; i<100; i++) {
376 cur_freq = extract_freq(get_cur_val(mask), data);
377 if (cur_freq == freq)
378 return 1;
379 udelay(10);
380 }
381 return 0;
382}
192 383
193static int 384static int acpi_cpufreq_target(struct cpufreq_policy *policy,
194acpi_cpufreq_target ( 385 unsigned int target_freq, unsigned int relation)
195 struct cpufreq_policy *policy,
196 unsigned int target_freq,
197 unsigned int relation)
198{ 386{
199 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; 387 struct acpi_cpufreq_data *data = drv_data[policy->cpu];
200 struct acpi_processor_performance *perf; 388 struct acpi_processor_performance *perf;
201 struct cpufreq_freqs freqs; 389 struct cpufreq_freqs freqs;
202 cpumask_t online_policy_cpus; 390 cpumask_t online_policy_cpus;
203 cpumask_t saved_mask; 391 struct drv_cmd cmd;
204 cpumask_t set_mask; 392 unsigned int msr;
205 cpumask_t covered_cpus;
206 unsigned int cur_state = 0;
207 unsigned int next_state = 0; 393 unsigned int next_state = 0;
208 unsigned int result = 0; 394 unsigned int next_perf_state = 0;
209 unsigned int j; 395 unsigned int i;
210 unsigned int tmp; 396 int result = 0;
211 397
212 dprintk("acpi_cpufreq_setpolicy\n"); 398 dprintk("acpi_cpufreq_target %d (%d)\n", target_freq, policy->cpu);
213 399
214 result = cpufreq_frequency_table_target(policy, 400 if (unlikely(data == NULL ||
215 data->freq_table, 401 data->acpi_data == NULL || data->freq_table == NULL)) {
216 target_freq, 402 return -ENODEV;
217 relation, 403 }
218 &next_state);
219 if (unlikely(result))
220 return (result);
221 404
222 perf = data->acpi_data; 405 perf = data->acpi_data;
223 cur_state = perf->state; 406 result = cpufreq_frequency_table_target(policy,
224 freqs.old = data->freq_table[cur_state].frequency; 407 data->freq_table,
225 freqs.new = data->freq_table[next_state].frequency; 408 target_freq,
409 relation, &next_state);
410 if (unlikely(result))
411 return -ENODEV;
226 412
227#ifdef CONFIG_HOTPLUG_CPU 413#ifdef CONFIG_HOTPLUG_CPU
228 /* cpufreq holds the hotplug lock, so we are safe from here on */ 414 /* cpufreq holds the hotplug lock, so we are safe from here on */
@@ -231,106 +417,84 @@ acpi_cpufreq_target (
231 online_policy_cpus = policy->cpus; 417 online_policy_cpus = policy->cpus;
232#endif 418#endif
233 419
234 for_each_cpu_mask(j, online_policy_cpus) { 420 next_perf_state = data->freq_table[next_state].index;
235 freqs.cpu = j; 421 if (perf->state == next_perf_state) {
236 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 422 if (unlikely(data->resume)) {
423 dprintk("Called after resume, resetting to P%d\n",
424 next_perf_state);
425 data->resume = 0;
426 } else {
427 dprintk("Already at target state (P%d)\n",
428 next_perf_state);
429 return 0;
430 }
237 } 431 }
238 432
239 /* 433 switch (data->cpu_feature) {
240 * We need to call driver->target() on all or any CPU in 434 case SYSTEM_INTEL_MSR_CAPABLE:
241 * policy->cpus, depending on policy->shared_type. 435 cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
242 */ 436 cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
243 saved_mask = current->cpus_allowed; 437 msr =
244 cpus_clear(covered_cpus); 438 (u32) perf->states[next_perf_state].
245 for_each_cpu_mask(j, online_policy_cpus) { 439 control & INTEL_MSR_RANGE;
246 /* 440 cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr;
247 * Support for SMP systems. 441 break;
248 * Make sure we are running on CPU that wants to change freq 442 case SYSTEM_IO_CAPABLE:
249 */ 443 cmd.type = SYSTEM_IO_CAPABLE;
250 cpus_clear(set_mask); 444 cmd.addr.io.port = perf->control_register.address;
251 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 445 cmd.addr.io.bit_width = perf->control_register.bit_width;
252 cpus_or(set_mask, set_mask, online_policy_cpus); 446 cmd.val = (u32) perf->states[next_perf_state].control;
253 else 447 break;
254 cpu_set(j, set_mask); 448 default:
255 449 return -ENODEV;
256 set_cpus_allowed(current, set_mask); 450 }
257 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
258 dprintk("couldn't limit to CPUs in this domain\n");
259 result = -EAGAIN;
260 break;
261 }
262 451
263 result = acpi_processor_set_performance (data, j, next_state); 452 cpus_clear(cmd.mask);
264 if (result) {
265 result = -EAGAIN;
266 break;
267 }
268 453
269 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 454 if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
270 break; 455 cmd.mask = online_policy_cpus;
271 456 else
272 cpu_set(j, covered_cpus); 457 cpu_set(policy->cpu, cmd.mask);
273 }
274 458
275 for_each_cpu_mask(j, online_policy_cpus) { 459 freqs.old = data->freq_table[perf->state].frequency;
276 freqs.cpu = j; 460 freqs.new = data->freq_table[next_perf_state].frequency;
277 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 461 for_each_cpu_mask(i, cmd.mask) {
462 freqs.cpu = i;
463 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
278 } 464 }
279 465
280 if (unlikely(result)) { 466 drv_write(&cmd);
281 /*
282 * We have failed halfway through the frequency change.
283 * We have sent callbacks to online_policy_cpus and
284 * acpi_processor_set_performance() has been called on
285 * coverd_cpus. Best effort undo..
286 */
287
288 if (!cpus_empty(covered_cpus)) {
289 for_each_cpu_mask(j, covered_cpus) {
290 policy->cpu = j;
291 acpi_processor_set_performance (data,
292 j,
293 cur_state);
294 }
295 }
296 467
297 tmp = freqs.new; 468 if (acpi_pstate_strict) {
298 freqs.new = freqs.old; 469 if (!check_freqs(cmd.mask, freqs.new, data)) {
299 freqs.old = tmp; 470 dprintk("acpi_cpufreq_target failed (%d)\n",
300 for_each_cpu_mask(j, online_policy_cpus) { 471 policy->cpu);
301 freqs.cpu = j; 472 return -EAGAIN;
302 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
303 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
304 } 473 }
305 } 474 }
306 475
307 set_cpus_allowed(current, saved_mask); 476 for_each_cpu_mask(i, cmd.mask) {
308 return (result); 477 freqs.cpu = i;
309} 478 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
479 }
480 perf->state = next_perf_state;
310 481
482 return result;
483}
311 484
312static int 485static int acpi_cpufreq_verify(struct cpufreq_policy *policy)
313acpi_cpufreq_verify (
314 struct cpufreq_policy *policy)
315{ 486{
316 unsigned int result = 0; 487 struct acpi_cpufreq_data *data = drv_data[policy->cpu];
317 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu];
318 488
319 dprintk("acpi_cpufreq_verify\n"); 489 dprintk("acpi_cpufreq_verify\n");
320 490
321 result = cpufreq_frequency_table_verify(policy, 491 return cpufreq_frequency_table_verify(policy, data->freq_table);
322 data->freq_table);
323
324 return (result);
325} 492}
326 493
327
328static unsigned long 494static unsigned long
329acpi_cpufreq_guess_freq ( 495acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
330 struct cpufreq_acpi_io *data,
331 unsigned int cpu)
332{ 496{
333 struct acpi_processor_performance *perf = data->acpi_data; 497 struct acpi_processor_performance *perf = data->acpi_data;
334 498
335 if (cpu_khz) { 499 if (cpu_khz) {
336 /* search the closest match to cpu_khz */ 500 /* search the closest match to cpu_khz */
@@ -338,16 +502,16 @@ acpi_cpufreq_guess_freq (
338 unsigned long freq; 502 unsigned long freq;
339 unsigned long freqn = perf->states[0].core_frequency * 1000; 503 unsigned long freqn = perf->states[0].core_frequency * 1000;
340 504
341 for (i = 0; i < (perf->state_count - 1); i++) { 505 for (i=0; i<(perf->state_count-1); i++) {
342 freq = freqn; 506 freq = freqn;
343 freqn = perf->states[i+1].core_frequency * 1000; 507 freqn = perf->states[i+1].core_frequency * 1000;
344 if ((2 * cpu_khz) > (freqn + freq)) { 508 if ((2 * cpu_khz) > (freqn + freq)) {
345 perf->state = i; 509 perf->state = i;
346 return (freq); 510 return freq;
347 } 511 }
348 } 512 }
349 perf->state = perf->state_count - 1; 513 perf->state = perf->state_count-1;
350 return (freqn); 514 return freqn;
351 } else { 515 } else {
352 /* assume CPU is at P0... */ 516 /* assume CPU is at P0... */
353 perf->state = 0; 517 perf->state = 0;
@@ -355,7 +519,6 @@ acpi_cpufreq_guess_freq (
355 } 519 }
356} 520}
357 521
358
359/* 522/*
360 * acpi_cpufreq_early_init - initialize ACPI P-States library 523 * acpi_cpufreq_early_init - initialize ACPI P-States library
361 * 524 *
@@ -364,30 +527,34 @@ acpi_cpufreq_guess_freq (
364 * do _PDC and _PSD and find out the processor dependency for the 527 * do _PDC and _PSD and find out the processor dependency for the
365 * actual init that will happen later... 528 * actual init that will happen later...
366 */ 529 */
367static int acpi_cpufreq_early_init_acpi(void) 530static int acpi_cpufreq_early_init(void)
368{ 531{
369 struct acpi_processor_performance *data; 532 struct acpi_processor_performance *data;
370 unsigned int i, j; 533 cpumask_t covered;
534 unsigned int i, j;
371 535
372 dprintk("acpi_cpufreq_early_init\n"); 536 dprintk("acpi_cpufreq_early_init\n");
373 537
374 for_each_possible_cpu(i) { 538 for_each_possible_cpu(i) {
375 data = kzalloc(sizeof(struct acpi_processor_performance), 539 data = kzalloc(sizeof(struct acpi_processor_performance),
376 GFP_KERNEL); 540 GFP_KERNEL);
377 if (!data) { 541 if (!data) {
378 for_each_possible_cpu(j) { 542 for_each_cpu_mask(j, covered) {
379 kfree(acpi_perf_data[j]); 543 kfree(acpi_perf_data[j]);
380 acpi_perf_data[j] = NULL; 544 acpi_perf_data[j] = NULL;
381 } 545 }
382 return (-ENOMEM); 546 return -ENOMEM;
383 } 547 }
384 acpi_perf_data[i] = data; 548 acpi_perf_data[i] = data;
549 cpu_set(i, covered);
385 } 550 }
386 551
387 /* Do initialization in ACPI core */ 552 /* Do initialization in ACPI core */
388 return acpi_processor_preregister_performance(acpi_perf_data); 553 acpi_processor_preregister_performance(acpi_perf_data);
554 return 0;
389} 555}
390 556
557#ifdef CONFIG_SMP
391/* 558/*
392 * Some BIOSes do SW_ANY coordination internally, either set it up in hw 559 * Some BIOSes do SW_ANY coordination internally, either set it up in hw
393 * or do it in BIOS firmware and won't inform about it to OS. If not 560 * or do it in BIOS firmware and won't inform about it to OS. If not
@@ -414,39 +581,42 @@ static struct dmi_system_id sw_any_bug_dmi_table[] = {
414 }, 581 },
415 { } 582 { }
416}; 583};
584#endif
417 585
418static int 586static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
419acpi_cpufreq_cpu_init (
420 struct cpufreq_policy *policy)
421{ 587{
422 unsigned int i; 588 unsigned int i;
423 unsigned int cpu = policy->cpu; 589 unsigned int valid_states = 0;
424 struct cpufreq_acpi_io *data; 590 unsigned int cpu = policy->cpu;
425 unsigned int result = 0; 591 struct acpi_cpufreq_data *data;
592 unsigned int result = 0;
426 struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; 593 struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
427 struct acpi_processor_performance *perf; 594 struct acpi_processor_performance *perf;
428 595
429 dprintk("acpi_cpufreq_cpu_init\n"); 596 dprintk("acpi_cpufreq_cpu_init\n");
430 597
431 if (!acpi_perf_data[cpu]) 598 if (!acpi_perf_data[cpu])
432 return (-ENODEV); 599 return -ENODEV;
433 600
434 data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); 601 data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL);
435 if (!data) 602 if (!data)
436 return (-ENOMEM); 603 return -ENOMEM;
437 604
438 data->acpi_data = acpi_perf_data[cpu]; 605 data->acpi_data = acpi_perf_data[cpu];
439 acpi_io_data[cpu] = data; 606 drv_data[cpu] = data;
440 607
441 result = acpi_processor_register_performance(data->acpi_data, cpu); 608 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC))
609 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
442 610
611 result = acpi_processor_register_performance(data->acpi_data, cpu);
443 if (result) 612 if (result)
444 goto err_free; 613 goto err_free;
445 614
446 perf = data->acpi_data; 615 perf = data->acpi_data;
447 policy->shared_type = perf->shared_type; 616 policy->shared_type = perf->shared_type;
617
448 /* 618 /*
449 * Will let policy->cpus know about dependency only when software 619 * Will let policy->cpus know about dependency only when software
450 * coordination is required. 620 * coordination is required.
451 */ 621 */
452 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || 622 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
@@ -462,10 +632,6 @@ acpi_cpufreq_cpu_init (
462 } 632 }
463#endif 633#endif
464 634
465 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
466 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
467 }
468
469 /* capability check */ 635 /* capability check */
470 if (perf->state_count <= 1) { 636 if (perf->state_count <= 1) {
471 dprintk("No P-States\n"); 637 dprintk("No P-States\n");
@@ -473,17 +639,33 @@ acpi_cpufreq_cpu_init (
473 goto err_unreg; 639 goto err_unreg;
474 } 640 }
475 641
476 if ((perf->control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || 642 if (perf->control_register.space_id != perf->status_register.space_id) {
477 (perf->status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { 643 result = -ENODEV;
478 dprintk("Unsupported address space [%d, %d]\n", 644 goto err_unreg;
479 (u32) (perf->control_register.space_id), 645 }
480 (u32) (perf->status_register.space_id)); 646
647 switch (perf->control_register.space_id) {
648 case ACPI_ADR_SPACE_SYSTEM_IO:
649 dprintk("SYSTEM IO addr space\n");
650 data->cpu_feature = SYSTEM_IO_CAPABLE;
651 break;
652 case ACPI_ADR_SPACE_FIXED_HARDWARE:
653 dprintk("HARDWARE addr space\n");
654 if (!check_est_cpu(cpu)) {
655 result = -ENODEV;
656 goto err_unreg;
657 }
658 data->cpu_feature = SYSTEM_INTEL_MSR_CAPABLE;
659 break;
660 default:
661 dprintk("Unknown addr space %d\n",
662 (u32) (perf->control_register.space_id));
481 result = -ENODEV; 663 result = -ENODEV;
482 goto err_unreg; 664 goto err_unreg;
483 } 665 }
484 666
485 /* alloc freq_table */ 667 data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) *
486 data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count + 1), GFP_KERNEL); 668 (perf->state_count+1), GFP_KERNEL);
487 if (!data->freq_table) { 669 if (!data->freq_table) {
488 result = -ENOMEM; 670 result = -ENOMEM;
489 goto err_unreg; 671 goto err_unreg;
@@ -492,129 +674,140 @@ acpi_cpufreq_cpu_init (
492 /* detect transition latency */ 674 /* detect transition latency */
493 policy->cpuinfo.transition_latency = 0; 675 policy->cpuinfo.transition_latency = 0;
494 for (i=0; i<perf->state_count; i++) { 676 for (i=0; i<perf->state_count; i++) {
495 if ((perf->states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) 677 if ((perf->states[i].transition_latency * 1000) >
496 policy->cpuinfo.transition_latency = perf->states[i].transition_latency * 1000; 678 policy->cpuinfo.transition_latency)
679 policy->cpuinfo.transition_latency =
680 perf->states[i].transition_latency * 1000;
497 } 681 }
498 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 682 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
499 683
500 /* The current speed is unknown and not detectable by ACPI... */ 684 data->max_freq = perf->states[0].core_frequency * 1000;
501 policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
502
503 /* table init */ 685 /* table init */
504 for (i=0; i<=perf->state_count; i++) 686 for (i=0; i<perf->state_count; i++) {
505 { 687 if (i>0 && perf->states[i].core_frequency ==
506 data->freq_table[i].index = i; 688 perf->states[i-1].core_frequency)
507 if (i<perf->state_count) 689 continue;
508 data->freq_table[i].frequency = perf->states[i].core_frequency * 1000; 690
509 else 691 data->freq_table[valid_states].index = i;
510 data->freq_table[i].frequency = CPUFREQ_TABLE_END; 692 data->freq_table[valid_states].frequency =
693 perf->states[i].core_frequency * 1000;
694 valid_states++;
511 } 695 }
696 data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
512 697
513 result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); 698 result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
514 if (result) { 699 if (result)
515 goto err_freqfree; 700 goto err_freqfree;
701
702 switch (data->cpu_feature) {
703 case ACPI_ADR_SPACE_SYSTEM_IO:
704 /* Current speed is unknown and not detectable by IO port */
705 policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
706 break;
707 case ACPI_ADR_SPACE_FIXED_HARDWARE:
708 acpi_cpufreq_driver.get = get_cur_freq_on_cpu;
709 get_cur_freq_on_cpu(cpu);
710 break;
711 default:
712 break;
516 } 713 }
517 714
518 /* notify BIOS that we exist */ 715 /* notify BIOS that we exist */
519 acpi_processor_notify_smm(THIS_MODULE); 716 acpi_processor_notify_smm(THIS_MODULE);
520 717
521 printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", 718 /* Check for APERF/MPERF support in hardware */
522 cpu); 719 if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) {
720 unsigned int ecx;
721 ecx = cpuid_ecx(6);
722 if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY)
723 acpi_cpufreq_driver.getavg = get_measured_perf;
724 }
725
726 dprintk("CPU%u - ACPI performance management activated.\n", cpu);
523 for (i = 0; i < perf->state_count; i++) 727 for (i = 0; i < perf->state_count; i++)
524 dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", 728 dprintk(" %cP%d: %d MHz, %d mW, %d uS\n",
525 (i == perf->state?'*':' '), i, 729 (i == perf->state ? '*' : ' '), i,
526 (u32) perf->states[i].core_frequency, 730 (u32) perf->states[i].core_frequency,
527 (u32) perf->states[i].power, 731 (u32) perf->states[i].power,
528 (u32) perf->states[i].transition_latency); 732 (u32) perf->states[i].transition_latency);
529 733
530 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); 734 cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu);
531 735
532 /* 736 /*
533 * the first call to ->target() should result in us actually 737 * the first call to ->target() should result in us actually
534 * writing something to the appropriate registers. 738 * writing something to the appropriate registers.
535 */ 739 */
536 data->resume = 1; 740 data->resume = 1;
537
538 return (result);
539 741
540 err_freqfree: 742 return result;
743
744err_freqfree:
541 kfree(data->freq_table); 745 kfree(data->freq_table);
542 err_unreg: 746err_unreg:
543 acpi_processor_unregister_performance(perf, cpu); 747 acpi_processor_unregister_performance(perf, cpu);
544 err_free: 748err_free:
545 kfree(data); 749 kfree(data);
546 acpi_io_data[cpu] = NULL; 750 drv_data[cpu] = NULL;
547 751
548 return (result); 752 return result;
549} 753}
550 754
551 755static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
552static int
553acpi_cpufreq_cpu_exit (
554 struct cpufreq_policy *policy)
555{ 756{
556 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; 757 struct acpi_cpufreq_data *data = drv_data[policy->cpu];
557
558 758
559 dprintk("acpi_cpufreq_cpu_exit\n"); 759 dprintk("acpi_cpufreq_cpu_exit\n");
560 760
561 if (data) { 761 if (data) {
562 cpufreq_frequency_table_put_attr(policy->cpu); 762 cpufreq_frequency_table_put_attr(policy->cpu);
563 acpi_io_data[policy->cpu] = NULL; 763 drv_data[policy->cpu] = NULL;
564 acpi_processor_unregister_performance(data->acpi_data, policy->cpu); 764 acpi_processor_unregister_performance(data->acpi_data,
765 policy->cpu);
565 kfree(data); 766 kfree(data);
566 } 767 }
567 768
568 return (0); 769 return 0;
569} 770}
570 771
571static int 772static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
572acpi_cpufreq_resume (
573 struct cpufreq_policy *policy)
574{ 773{
575 struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; 774 struct acpi_cpufreq_data *data = drv_data[policy->cpu];
576
577 775
578 dprintk("acpi_cpufreq_resume\n"); 776 dprintk("acpi_cpufreq_resume\n");
579 777
580 data->resume = 1; 778 data->resume = 1;
581 779
582 return (0); 780 return 0;
583} 781}
584 782
585 783static struct freq_attr *acpi_cpufreq_attr[] = {
586static struct freq_attr* acpi_cpufreq_attr[] = {
587 &cpufreq_freq_attr_scaling_available_freqs, 784 &cpufreq_freq_attr_scaling_available_freqs,
588 NULL, 785 NULL,
589}; 786};
590 787
591static struct cpufreq_driver acpi_cpufreq_driver = { 788static struct cpufreq_driver acpi_cpufreq_driver = {
592 .verify = acpi_cpufreq_verify, 789 .verify = acpi_cpufreq_verify,
593 .target = acpi_cpufreq_target, 790 .target = acpi_cpufreq_target,
594 .init = acpi_cpufreq_cpu_init, 791 .init = acpi_cpufreq_cpu_init,
595 .exit = acpi_cpufreq_cpu_exit, 792 .exit = acpi_cpufreq_cpu_exit,
596 .resume = acpi_cpufreq_resume, 793 .resume = acpi_cpufreq_resume,
597 .name = "acpi-cpufreq", 794 .name = "acpi-cpufreq",
598 .owner = THIS_MODULE, 795 .owner = THIS_MODULE,
599 .attr = acpi_cpufreq_attr, 796 .attr = acpi_cpufreq_attr,
600}; 797};
601 798
602 799static int __init acpi_cpufreq_init(void)
603static int __init
604acpi_cpufreq_init (void)
605{ 800{
606 dprintk("acpi_cpufreq_init\n"); 801 dprintk("acpi_cpufreq_init\n");
607 802
608 acpi_cpufreq_early_init_acpi(); 803 acpi_cpufreq_early_init();
609 804
610 return cpufreq_register_driver(&acpi_cpufreq_driver); 805 return cpufreq_register_driver(&acpi_cpufreq_driver);
611} 806}
612 807
613 808static void __exit acpi_cpufreq_exit(void)
614static void __exit
615acpi_cpufreq_exit (void)
616{ 809{
617 unsigned int i; 810 unsigned int i;
618 dprintk("acpi_cpufreq_exit\n"); 811 dprintk("acpi_cpufreq_exit\n");
619 812
620 cpufreq_unregister_driver(&acpi_cpufreq_driver); 813 cpufreq_unregister_driver(&acpi_cpufreq_driver);
@@ -627,7 +820,9 @@ acpi_cpufreq_exit (void)
627} 820}
628 821
629module_param(acpi_pstate_strict, uint, 0644); 822module_param(acpi_pstate_strict, uint, 0644);
630MODULE_PARM_DESC(acpi_pstate_strict, "value 0 or non-zero. non-zero -> strict ACPI checks are performed during frequency changes."); 823MODULE_PARM_DESC(acpi_pstate_strict,
824 "value 0 or non-zero. non-zero -> strict ACPI checks are "
825 "performed during frequency changes.");
631 826
632late_initcall(acpi_cpufreq_init); 827late_initcall(acpi_cpufreq_init);
633module_exit(acpi_cpufreq_exit); 828module_exit(acpi_cpufreq_exit);
diff --git a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
index 92afa3bc84f1..6667e9cceb9f 100644
--- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
@@ -447,7 +447,6 @@ static int __init cpufreq_gx_init(void)
447 int ret; 447 int ret;
448 struct gxfreq_params *params; 448 struct gxfreq_params *params;
449 struct pci_dev *gx_pci; 449 struct pci_dev *gx_pci;
450 u32 class_rev;
451 450
452 /* Test if we have the right hardware */ 451 /* Test if we have the right hardware */
453 if ((gx_pci = gx_detect_chipset()) == NULL) 452 if ((gx_pci = gx_detect_chipset()) == NULL)
@@ -472,8 +471,7 @@ static int __init cpufreq_gx_init(void)
472 pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2)); 471 pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2));
473 pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration)); 472 pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration));
474 pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration)); 473 pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration));
475 pci_read_config_dword(params->cs55x0, PCI_CLASS_REVISION, &class_rev); 474 pci_read_config_byte(params->cs55x0, PCI_REVISION_ID, &params->pci_rev);
476 params->pci_rev = class_rev && 0xff;
477 475
478 if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) { 476 if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) {
479 kfree(params); 477 kfree(params);
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 7233abe5d695..c548daad3476 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -410,7 +410,7 @@ static int __init longhaul_get_ranges(void)
410 maxmult=longhaul_get_cpu_mult(); 410 maxmult=longhaul_get_cpu_mult();
411 411
412 /* Starting with the 1.2GHz parts, theres a 200MHz bus. */ 412 /* Starting with the 1.2GHz parts, theres a 200MHz bus. */
413 if ((cpu_khz/1000) > 1200) 413 if ((cpu_khz/maxmult) > 13400)
414 fsb = 200; 414 fsb = 200;
415 else 415 else
416 fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB]; 416 fsb = eblcr_fsb_table_v2[longhaul.bits.MaxMHzFSB];
@@ -583,6 +583,10 @@ static int enable_arbiter_disable(void)
583 if (dev == NULL) { 583 if (dev == NULL) {
584 reg = 0x76; 584 reg = 0x76;
585 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL); 585 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL);
586 /* Find CN400 V-Link host bridge */
587 if (dev == NULL)
588 dev = pci_find_device(PCI_VENDOR_ID_VIA, 0x7259, NULL);
589
586 } 590 }
587 if (dev != NULL) { 591 if (dev != NULL) {
588 /* Enable access to port 0x22 */ 592 /* Enable access to port 0x22 */
@@ -734,7 +738,7 @@ print_support_type:
734 return 0; 738 return 0;
735 739
736err_acpi: 740err_acpi:
737 printk(KERN_ERR PFX "No ACPI support. No VT8601 or VT8623 northbridge. Aborting.\n"); 741 printk(KERN_ERR PFX "No ACPI support. Unsupported northbridge. Aborting.\n");
738 return -ENODEV; 742 return -ENODEV;
739} 743}
740 744
diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
index 304d2eaa4a1b..bec50170b75a 100644
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -163,29 +163,27 @@ static int cpufreq_p4_verify(struct cpufreq_policy *policy)
163 163
164static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) 164static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
165{ 165{
166 if ((c->x86 == 0x06) && (c->x86_model == 0x09)) { 166 if (c->x86 == 0x06) {
167 /* Pentium M (Banias) */ 167 if (cpu_has(c, X86_FEATURE_EST))
168 printk(KERN_WARNING PFX "Warning: Pentium M detected. " 168 printk(KERN_WARNING PFX "Warning: EST-capable CPU detected. "
169 "The speedstep_centrino module offers voltage scaling" 169 "The acpi-cpufreq module offers voltage scaling"
170 " in addition of frequency scaling. You should use " 170 " in addition of frequency scaling. You should use "
171 "that instead of p4-clockmod, if possible.\n"); 171 "that instead of p4-clockmod, if possible.\n");
172 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM); 172 switch (c->x86_model) {
173 } 173 case 0x0E: /* Core */
174 174 case 0x0F: /* Core Duo */
175 if ((c->x86 == 0x06) && (c->x86_model == 0x0D)) { 175 p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
176 /* Pentium M (Dothan) */ 176 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE);
177 printk(KERN_WARNING PFX "Warning: Pentium M detected. " 177 case 0x0D: /* Pentium M (Dothan) */
178 "The speedstep_centrino module offers voltage scaling" 178 p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
179 " in addition of frequency scaling. You should use " 179 /* fall through */
180 "that instead of p4-clockmod, if possible.\n"); 180 case 0x09: /* Pentium M (Banias) */
181 /* on P-4s, the TSC runs with constant frequency independent whether 181 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
182 * throttling is active or not. */ 182 }
183 p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
184 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
185 } 183 }
186 184
187 if (c->x86 != 0xF) { 185 if (c->x86 != 0xF) {
188 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <linux@brodo.de>\n"); 186 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@lists.linux.org.uk>\n");
189 return 0; 187 return 0;
190 } 188 }
191 189
diff --git a/arch/i386/kernel/cpu/cpufreq/sc520_freq.c b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c
index ef457d50f4ac..b8fb4b521c62 100644
--- a/arch/i386/kernel/cpu/cpufreq/sc520_freq.c
+++ b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c
@@ -153,6 +153,7 @@ static struct cpufreq_driver sc520_freq_driver = {
153static int __init sc520_freq_init(void) 153static int __init sc520_freq_init(void)
154{ 154{
155 struct cpuinfo_x86 *c = cpu_data; 155 struct cpuinfo_x86 *c = cpu_data;
156 int err;
156 157
157 /* Test if we have the right hardware */ 158 /* Test if we have the right hardware */
158 if(c->x86_vendor != X86_VENDOR_AMD || 159 if(c->x86_vendor != X86_VENDOR_AMD ||
@@ -166,7 +167,11 @@ static int __init sc520_freq_init(void)
166 return -ENOMEM; 167 return -ENOMEM;
167 } 168 }
168 169
169 return cpufreq_register_driver(&sc520_freq_driver); 170 err = cpufreq_register_driver(&sc520_freq_driver);
171 if (err)
172 iounmap(cpuctl);
173
174 return err;
170} 175}
171 176
172 177
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index e8993baf3d14..5113e9231634 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -36,6 +36,7 @@
36 36
37#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg) 37#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg)
38 38
39#define INTEL_MSR_RANGE (0xffff)
39 40
40struct cpu_id 41struct cpu_id
41{ 42{
@@ -379,6 +380,7 @@ static int centrino_cpu_early_init_acpi(void)
379} 380}
380 381
381 382
383#ifdef CONFIG_SMP
382/* 384/*
383 * Some BIOSes do SW_ANY coordination internally, either set it up in hw 385 * Some BIOSes do SW_ANY coordination internally, either set it up in hw
384 * or do it in BIOS firmware and won't inform about it to OS. If not 386 * or do it in BIOS firmware and won't inform about it to OS. If not
@@ -392,7 +394,6 @@ static int sw_any_bug_found(struct dmi_system_id *d)
392 return 0; 394 return 0;
393} 395}
394 396
395
396static struct dmi_system_id sw_any_bug_dmi_table[] = { 397static struct dmi_system_id sw_any_bug_dmi_table[] = {
397 { 398 {
398 .callback = sw_any_bug_found, 399 .callback = sw_any_bug_found,
@@ -405,7 +406,7 @@ static struct dmi_system_id sw_any_bug_dmi_table[] = {
405 }, 406 },
406 { } 407 { }
407}; 408};
408 409#endif
409 410
410/* 411/*
411 * centrino_cpu_init_acpi - register with ACPI P-States library 412 * centrino_cpu_init_acpi - register with ACPI P-States library
@@ -463,8 +464,9 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
463 } 464 }
464 465
465 for (i=0; i<p->state_count; i++) { 466 for (i=0; i<p->state_count; i++) {
466 if (p->states[i].control != p->states[i].status) { 467 if ((p->states[i].control & INTEL_MSR_RANGE) !=
467 dprintk("Different control (%llu) and status values (%llu)\n", 468 (p->states[i].status & INTEL_MSR_RANGE)) {
469 dprintk("Different MSR bits in control (%llu) and status (%llu)\n",
468 p->states[i].control, p->states[i].status); 470 p->states[i].control, p->states[i].status);
469 result = -EINVAL; 471 result = -EINVAL;
470 goto err_unreg; 472 goto err_unreg;
@@ -500,7 +502,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
500 } 502 }
501 503
502 for (i=0; i<p->state_count; i++) { 504 for (i=0; i<p->state_count; i++) {
503 centrino_model[cpu]->op_points[i].index = p->states[i].control; 505 centrino_model[cpu]->op_points[i].index = p->states[i].control & INTEL_MSR_RANGE;
504 centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000; 506 centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000;
505 dprintk("adding state %i with frequency %u and control value %04x\n", 507 dprintk("adding state %i with frequency %u and control value %04x\n",
506 i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); 508 i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index);
@@ -531,6 +533,9 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
531 533
532 /* notify BIOS that we exist */ 534 /* notify BIOS that we exist */
533 acpi_processor_notify_smm(THIS_MODULE); 535 acpi_processor_notify_smm(THIS_MODULE);
536 printk("speedstep-centrino with X86_SPEEDSTEP_CENTRINO_ACPI"
537 "config is deprecated.\n "
538 "Use X86_ACPI_CPUFREQ (acpi-cpufreq instead.\n" );
534 539
535 return 0; 540 return 0;
536 541
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
index 4f46cac155c4..d59277c00911 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
@@ -123,6 +123,36 @@ static unsigned int pentiumM_get_frequency(void)
123 return (msr_tmp * 100 * 1000); 123 return (msr_tmp * 100 * 1000);
124} 124}
125 125
126static unsigned int pentium_core_get_frequency(void)
127{
128 u32 fsb = 0;
129 u32 msr_lo, msr_tmp;
130
131 rdmsr(MSR_FSB_FREQ, msr_lo, msr_tmp);
132 /* see table B-2 of 25366920.pdf */
133 switch (msr_lo & 0x07) {
134 case 5:
135 fsb = 100000;
136 break;
137 case 1:
138 fsb = 133333;
139 break;
140 case 3:
141 fsb = 166667;
142 break;
143 default:
144 printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value");
145 }
146
147 rdmsr(MSR_IA32_EBL_CR_POWERON, msr_lo, msr_tmp);
148 dprintk("PCORE - MSR_IA32_EBL_CR_POWERON: 0x%x 0x%x\n", msr_lo, msr_tmp);
149
150 msr_tmp = (msr_lo >> 22) & 0x1f;
151 dprintk("bits 22-26 are 0x%x, speed is %u\n", msr_tmp, (msr_tmp * fsb));
152
153 return (msr_tmp * fsb);
154}
155
126 156
127static unsigned int pentium4_get_frequency(void) 157static unsigned int pentium4_get_frequency(void)
128{ 158{
@@ -174,6 +204,8 @@ static unsigned int pentium4_get_frequency(void)
174unsigned int speedstep_get_processor_frequency(unsigned int processor) 204unsigned int speedstep_get_processor_frequency(unsigned int processor)
175{ 205{
176 switch (processor) { 206 switch (processor) {
207 case SPEEDSTEP_PROCESSOR_PCORE:
208 return pentium_core_get_frequency();
177 case SPEEDSTEP_PROCESSOR_PM: 209 case SPEEDSTEP_PROCESSOR_PM:
178 return pentiumM_get_frequency(); 210 return pentiumM_get_frequency();
179 case SPEEDSTEP_PROCESSOR_P4D: 211 case SPEEDSTEP_PROCESSOR_P4D:
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
index b735429c50b4..b11bcc608cac 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
@@ -22,6 +22,7 @@
22 * the speedstep_get_processor_frequency() call. */ 22 * the speedstep_get_processor_frequency() call. */
23#define SPEEDSTEP_PROCESSOR_PM 0xFFFFFF03 /* Pentium M */ 23#define SPEEDSTEP_PROCESSOR_PM 0xFFFFFF03 /* Pentium M */
24#define SPEEDSTEP_PROCESSOR_P4D 0xFFFFFF04 /* desktop P4 */ 24#define SPEEDSTEP_PROCESSOR_P4D 0xFFFFFF04 /* desktop P4 */
25#define SPEEDSTEP_PROCESSOR_PCORE 0xFFFFFF05 /* Core */
25 26
26/* speedstep states -- only two of them */ 27/* speedstep states -- only two of them */
27 28
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
index c28333d53646..ff0d89806114 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
@@ -360,9 +360,6 @@ static int __init speedstep_init(void)
360 case SPEEDSTEP_PROCESSOR_PIII_C: 360 case SPEEDSTEP_PROCESSOR_PIII_C:
361 case SPEEDSTEP_PROCESSOR_PIII_C_EARLY: 361 case SPEEDSTEP_PROCESSOR_PIII_C_EARLY:
362 break; 362 break;
363 case SPEEDSTEP_PROCESSOR_P4M:
364 printk(KERN_INFO "speedstep-smi: you're trying to use this cpufreq driver on a Pentium 4-based CPU. Most likely it will not work.\n");
365 break;
366 default: 363 default:
367 speedstep_processor = 0; 364 speedstep_processor = 0;
368 } 365 }
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 972346604f9d..47ffec57c0cb 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Intel CPU Microcode Update Driver for Linux 2 * Intel CPU Microcode Update Driver for Linux
3 * 3 *
4 * Copyright (C) 2000-2004 Tigran Aivazian 4 * Copyright (C) 2000-2006 Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
5 * 2006 Shaohua Li <shaohua.li@intel.com> 5 * 2006 Shaohua Li <shaohua.li@intel.com>
6 * 6 *
7 * This driver allows to upgrade microcode on Intel processors 7 * This driver allows to upgrade microcode on Intel processors
@@ -92,7 +92,7 @@
92#include <asm/processor.h> 92#include <asm/processor.h>
93 93
94MODULE_DESCRIPTION("Intel CPU (IA-32) Microcode Update Driver"); 94MODULE_DESCRIPTION("Intel CPU (IA-32) Microcode Update Driver");
95MODULE_AUTHOR("Tigran Aivazian <tigran@veritas.com>"); 95MODULE_AUTHOR("Tigran Aivazian <tigran@aivazian.fsnet.co.uk>");
96MODULE_LICENSE("GPL"); 96MODULE_LICENSE("GPL");
97 97
98#define MICROCODE_VERSION "1.14a" 98#define MICROCODE_VERSION "1.14a"
@@ -752,7 +752,7 @@ static int __init microcode_init (void)
752 register_hotcpu_notifier(&mc_cpu_notifier); 752 register_hotcpu_notifier(&mc_cpu_notifier);
753 753
754 printk(KERN_INFO 754 printk(KERN_INFO
755 "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " <tigran@veritas.com>\n"); 755 "IA-32 Microcode Update Driver: v" MICROCODE_VERSION " <tigran@aivazian.fsnet.co.uk>\n");
756 return 0; 756 return 0;
757} 757}
758 758
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index b0f84e5778ad..aef39be81361 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -69,9 +69,7 @@ static int __devinitdata smp_b_stepping;
69 69
70/* Number of siblings per CPU package */ 70/* Number of siblings per CPU package */
71int smp_num_siblings = 1; 71int smp_num_siblings = 1;
72#ifdef CONFIG_SMP
73EXPORT_SYMBOL(smp_num_siblings); 72EXPORT_SYMBOL(smp_num_siblings);
74#endif
75 73
76/* Last level cache ID of each logical CPU */ 74/* Last level cache ID of each logical CPU */
77int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; 75int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 1f16ebb9a800..324ea7565e2c 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -488,7 +488,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
488 488
489#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 489#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
490 490
491static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios) 491static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
492{ 492{
493 unsigned int cflag = tty->termios->c_cflag; 493 unsigned int cflag = tty->termios->c_cflag;
494 494
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 8ae384eb5357..098ee605bf5e 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_CPU_FREQ) += cpufreq/
29obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o 29obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o
30obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o 30obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o
31obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o 31obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
32obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
32obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o 33obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o
33obj-$(CONFIG_AUDIT) += audit.o 34obj-$(CONFIG_AUDIT) += audit.o
34obj-$(CONFIG_PCI_MSI) += msi_ia64.o 35obj-$(CONFIG_PCI_MSI) += msi_ia64.o
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 0aabedf95dad..bc2f64d72244 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -19,29 +19,11 @@
19 19
20#include <asm/kdebug.h> 20#include <asm/kdebug.h>
21#include <asm/mca.h> 21#include <asm/mca.h>
22#include <asm/uaccess.h>
23 22
24int kdump_status[NR_CPUS]; 23int kdump_status[NR_CPUS];
25atomic_t kdump_cpu_freezed; 24atomic_t kdump_cpu_freezed;
26atomic_t kdump_in_progress; 25atomic_t kdump_in_progress;
27int kdump_on_init = 1; 26int kdump_on_init = 1;
28ssize_t
29copy_oldmem_page(unsigned long pfn, char *buf,
30 size_t csize, unsigned long offset, int userbuf)
31{
32 void *vaddr;
33
34 if (!csize)
35 return 0;
36 vaddr = __va(pfn<<PAGE_SHIFT);
37 if (userbuf) {
38 if (copy_to_user(buf, (vaddr + offset), csize)) {
39 return -EFAULT;
40 }
41 } else
42 memcpy(buf, (vaddr + offset), csize);
43 return csize;
44}
45 27
46static inline Elf64_Word 28static inline Elf64_Word
47*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data, 29*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
@@ -225,14 +207,10 @@ static ctl_table sys_table[] = {
225static int 207static int
226machine_crash_setup(void) 208machine_crash_setup(void)
227{ 209{
228 char *from = strstr(saved_command_line, "elfcorehdr=");
229 static struct notifier_block kdump_init_notifier_nb = { 210 static struct notifier_block kdump_init_notifier_nb = {
230 .notifier_call = kdump_init_notifier, 211 .notifier_call = kdump_init_notifier,
231 }; 212 };
232 int ret; 213 int ret;
233 if (from)
234 elfcorehdr_addr = memparse(from+11, &from);
235 saved_max_pfn = (unsigned long)-1;
236 if((ret = register_die_notifier(&kdump_init_notifier_nb)) != 0) 214 if((ret = register_die_notifier(&kdump_init_notifier_nb)) != 0)
237 return ret; 215 return ret;
238#ifdef CONFIG_SYSCTL 216#ifdef CONFIG_SYSCTL
diff --git a/arch/ia64/kernel/crash_dump.c b/arch/ia64/kernel/crash_dump.c
new file mode 100644
index 000000000000..83b8c91c1408
--- /dev/null
+++ b/arch/ia64/kernel/crash_dump.c
@@ -0,0 +1,48 @@
1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code.
3 *
4 * Created by: Simon Horman <horms@verge.net.au>
5 * Original code moved from kernel/crash.c
6 * Original code comment copied from the i386 version of this file
7 */
8
9#include <linux/errno.h>
10#include <linux/types.h>
11
12#include <linux/uaccess.h>
13
14/**
15 * copy_oldmem_page - copy one page from "oldmem"
16 * @pfn: page frame number to be copied
17 * @buf: target memory address for the copy; this can be in kernel address
18 * space or user address space (see @userbuf)
19 * @csize: number of bytes to copy
20 * @offset: offset in bytes into the page (based on pfn) to begin the copy
21 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
22 * otherwise @buf is in kernel address space, use memcpy().
23 *
24 * Copy a page from "oldmem". For this page, there is no pte mapped
25 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
26 *
27 * Calling copy_to_user() in atomic context is not desirable. Hence first
28 * copying the data to a pre-allocated kernel page and then copying to user
29 * space in non-atomic context.
30 */
31ssize_t
32copy_oldmem_page(unsigned long pfn, char *buf,
33 size_t csize, unsigned long offset, int userbuf)
34{
35 void *vaddr;
36
37 if (!csize)
38 return 0;
39 vaddr = __va(pfn<<PAGE_SHIFT);
40 if (userbuf) {
41 if (copy_to_user(buf, (vaddr + offset), csize)) {
42 return -EFAULT;
43 }
44 } else
45 memcpy(buf, (vaddr + offset), csize);
46 return csize;
47}
48
diff --git a/arch/ia64/kernel/jprobes.S b/arch/ia64/kernel/jprobes.S
index 5cd6226f44f2..621630256c4a 100644
--- a/arch/ia64/kernel/jprobes.S
+++ b/arch/ia64/kernel/jprobes.S
@@ -45,13 +45,14 @@
45 * to the correct location. 45 * to the correct location.
46 */ 46 */
47#include <asm/asmmacro.h> 47#include <asm/asmmacro.h>
48#include <asm-ia64/break.h>
48 49
49 /* 50 /*
50 * void jprobe_break(void) 51 * void jprobe_break(void)
51 */ 52 */
52 .section .kprobes.text, "ax" 53 .section .kprobes.text, "ax"
53ENTRY(jprobe_break) 54ENTRY(jprobe_break)
54 break.m 0x80300 55 break.m __IA64_BREAK_JPROBE
55END(jprobe_break) 56END(jprobe_break)
56 57
57 /* 58 /*
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 76e778951e20..6cb56dd4056d 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -88,6 +88,7 @@ static void __kprobes update_kprobe_inst_flag(uint template, uint slot,
88{ 88{
89 p->ainsn.inst_flag = 0; 89 p->ainsn.inst_flag = 0;
90 p->ainsn.target_br_reg = 0; 90 p->ainsn.target_br_reg = 0;
91 p->ainsn.slot = slot;
91 92
92 /* Check for Break instruction 93 /* Check for Break instruction
93 * Bits 37:40 Major opcode to be zero 94 * Bits 37:40 Major opcode to be zero
@@ -129,48 +130,6 @@ static void __kprobes update_kprobe_inst_flag(uint template, uint slot,
129 130
130/* 131/*
131 * In this function we check to see if the instruction 132 * In this function we check to see if the instruction
132 * on which we are inserting kprobe is supported.
133 * Returns 0 if supported
134 * Returns -EINVAL if unsupported
135 */
136static int __kprobes unsupported_inst(uint template, uint slot,
137 uint major_opcode,
138 unsigned long kprobe_inst,
139 unsigned long addr)
140{
141 if (bundle_encoding[template][slot] == I) {
142 switch (major_opcode) {
143 case 0x0: //I_UNIT_MISC_OPCODE:
144 /*
145 * Check for Integer speculation instruction
146 * - Bit 33-35 to be equal to 0x1
147 */
148 if (((kprobe_inst >> 33) & 0x7) == 1) {
149 printk(KERN_WARNING
150 "Kprobes on speculation inst at <0x%lx> not supported\n",
151 addr);
152 return -EINVAL;
153 }
154
155 /*
156 * IP relative mov instruction
157 * - Bit 27-35 to be equal to 0x30
158 */
159 if (((kprobe_inst >> 27) & 0x1FF) == 0x30) {
160 printk(KERN_WARNING
161 "Kprobes on \"mov r1=ip\" at <0x%lx> not supported\n",
162 addr);
163 return -EINVAL;
164
165 }
166 }
167 }
168 return 0;
169}
170
171
172/*
173 * In this function we check to see if the instruction
174 * (qp) cmpx.crel.ctype p1,p2=r2,r3 133 * (qp) cmpx.crel.ctype p1,p2=r2,r3
175 * on which we are inserting kprobe is cmp instruction 134 * on which we are inserting kprobe is cmp instruction
176 * with ctype as unc. 135 * with ctype as unc.
@@ -206,26 +165,136 @@ out:
206} 165}
207 166
208/* 167/*
168 * In this function we check to see if the instruction
169 * on which we are inserting kprobe is supported.
170 * Returns qp value if supported
171 * Returns -EINVAL if unsupported
172 */
173static int __kprobes unsupported_inst(uint template, uint slot,
174 uint major_opcode,
175 unsigned long kprobe_inst,
176 unsigned long addr)
177{
178 int qp;
179
180 qp = kprobe_inst & 0x3f;
181 if (is_cmp_ctype_unc_inst(template, slot, major_opcode, kprobe_inst)) {
182 if (slot == 1 && qp) {
183 printk(KERN_WARNING "Kprobes on cmp unc"
184 "instruction on slot 1 at <0x%lx>"
185 "is not supported\n", addr);
186 return -EINVAL;
187
188 }
189 qp = 0;
190 }
191 else if (bundle_encoding[template][slot] == I) {
192 if (major_opcode == 0) {
193 /*
194 * Check for Integer speculation instruction
195 * - Bit 33-35 to be equal to 0x1
196 */
197 if (((kprobe_inst >> 33) & 0x7) == 1) {
198 printk(KERN_WARNING
199 "Kprobes on speculation inst at <0x%lx> not supported\n",
200 addr);
201 return -EINVAL;
202 }
203 /*
204 * IP relative mov instruction
205 * - Bit 27-35 to be equal to 0x30
206 */
207 if (((kprobe_inst >> 27) & 0x1FF) == 0x30) {
208 printk(KERN_WARNING
209 "Kprobes on \"mov r1=ip\" at <0x%lx> not supported\n",
210 addr);
211 return -EINVAL;
212
213 }
214 }
215 else if ((major_opcode == 5) && !(kprobe_inst & (0xFUl << 33)) &&
216 (kprobe_inst & (0x1UL << 12))) {
217 /* test bit instructions, tbit,tnat,tf
218 * bit 33-36 to be equal to 0
219 * bit 12 to be equal to 1
220 */
221 if (slot == 1 && qp) {
222 printk(KERN_WARNING "Kprobes on test bit"
223 "instruction on slot at <0x%lx>"
224 "is not supported\n", addr);
225 return -EINVAL;
226 }
227 qp = 0;
228 }
229 }
230 else if (bundle_encoding[template][slot] == B) {
231 if (major_opcode == 7) {
232 /* IP-Relative Predict major code is 7 */
233 printk(KERN_WARNING "Kprobes on IP-Relative"
234 "Predict is not supported\n");
235 return -EINVAL;
236 }
237 else if (major_opcode == 2) {
238 /* Indirect Predict, major code is 2
239 * bit 27-32 to be equal to 10 or 11
240 */
241 int x6=(kprobe_inst >> 27) & 0x3F;
242 if ((x6 == 0x10) || (x6 == 0x11)) {
243 printk(KERN_WARNING "Kprobes on"
244 "Indirect Predict is not supported\n");
245 return -EINVAL;
246 }
247 }
248 }
249 /* kernel does not use float instruction, here for safety kprobe
250 * will judge whether it is fcmp/flass/float approximation instruction
251 */
252 else if (unlikely(bundle_encoding[template][slot] == F)) {
253 if ((major_opcode == 4 || major_opcode == 5) &&
254 (kprobe_inst & (0x1 << 12))) {
255 /* fcmp/fclass unc instruction */
256 if (slot == 1 && qp) {
257 printk(KERN_WARNING "Kprobes on fcmp/fclass "
258 "instruction on slot at <0x%lx> "
259 "is not supported\n", addr);
260 return -EINVAL;
261
262 }
263 qp = 0;
264 }
265 if ((major_opcode == 0 || major_opcode == 1) &&
266 (kprobe_inst & (0x1UL << 33))) {
267 /* float Approximation instruction */
268 if (slot == 1 && qp) {
269 printk(KERN_WARNING "Kprobes on float Approx "
270 "instr at <0x%lx> is not supported\n",
271 addr);
272 return -EINVAL;
273 }
274 qp = 0;
275 }
276 }
277 return qp;
278}
279
280/*
209 * In this function we override the bundle with 281 * In this function we override the bundle with
210 * the break instruction at the given slot. 282 * the break instruction at the given slot.
211 */ 283 */
212static void __kprobes prepare_break_inst(uint template, uint slot, 284static void __kprobes prepare_break_inst(uint template, uint slot,
213 uint major_opcode, 285 uint major_opcode,
214 unsigned long kprobe_inst, 286 unsigned long kprobe_inst,
215 struct kprobe *p) 287 struct kprobe *p,
288 int qp)
216{ 289{
217 unsigned long break_inst = BREAK_INST; 290 unsigned long break_inst = BREAK_INST;
218 bundle_t *bundle = &p->opcode.bundle; 291 bundle_t *bundle = &p->opcode.bundle;
219 292
220 /* 293 /*
221 * Copy the original kprobe_inst qualifying predicate(qp) 294 * Copy the original kprobe_inst qualifying predicate(qp)
222 * to the break instruction iff !is_cmp_ctype_unc_inst 295 * to the break instruction
223 * because for cmp instruction with ctype equal to unc,
224 * which is a special instruction always needs to be
225 * executed regradless of qp
226 */ 296 */
227 if (!is_cmp_ctype_unc_inst(template, slot, major_opcode, kprobe_inst)) 297 break_inst |= qp;
228 break_inst |= (0x3f & kprobe_inst);
229 298
230 switch (slot) { 299 switch (slot) {
231 case 0: 300 case 0:
@@ -296,12 +365,6 @@ static int __kprobes valid_kprobe_addr(int template, int slot,
296 return -EINVAL; 365 return -EINVAL;
297 } 366 }
298 367
299 if (slot == 1 && bundle_encoding[template][1] != L) {
300 printk(KERN_WARNING "Inserting kprobes on slot #1 "
301 "is not supported\n");
302 return -EINVAL;
303 }
304
305 return 0; 368 return 0;
306} 369}
307 370
@@ -427,6 +490,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
427 unsigned long kprobe_inst=0; 490 unsigned long kprobe_inst=0;
428 unsigned int slot = addr & 0xf, template, major_opcode = 0; 491 unsigned int slot = addr & 0xf, template, major_opcode = 0;
429 bundle_t *bundle; 492 bundle_t *bundle;
493 int qp;
430 494
431 bundle = &((kprobe_opcode_t *)kprobe_addr)->bundle; 495 bundle = &((kprobe_opcode_t *)kprobe_addr)->bundle;
432 template = bundle->quad0.template; 496 template = bundle->quad0.template;
@@ -441,9 +505,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
441 /* Get kprobe_inst and major_opcode from the bundle */ 505 /* Get kprobe_inst and major_opcode from the bundle */
442 get_kprobe_inst(bundle, slot, &kprobe_inst, &major_opcode); 506 get_kprobe_inst(bundle, slot, &kprobe_inst, &major_opcode);
443 507
444 if (unsupported_inst(template, slot, major_opcode, kprobe_inst, addr)) 508 qp = unsupported_inst(template, slot, major_opcode, kprobe_inst, addr);
445 return -EINVAL; 509 if (qp < 0)
446 510 return -EINVAL;
447 511
448 p->ainsn.insn = get_insn_slot(); 512 p->ainsn.insn = get_insn_slot();
449 if (!p->ainsn.insn) 513 if (!p->ainsn.insn)
@@ -451,30 +515,56 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
451 memcpy(&p->opcode, kprobe_addr, sizeof(kprobe_opcode_t)); 515 memcpy(&p->opcode, kprobe_addr, sizeof(kprobe_opcode_t));
452 memcpy(p->ainsn.insn, kprobe_addr, sizeof(kprobe_opcode_t)); 516 memcpy(p->ainsn.insn, kprobe_addr, sizeof(kprobe_opcode_t));
453 517
454 prepare_break_inst(template, slot, major_opcode, kprobe_inst, p); 518 prepare_break_inst(template, slot, major_opcode, kprobe_inst, p, qp);
455 519
456 return 0; 520 return 0;
457} 521}
458 522
459void __kprobes arch_arm_kprobe(struct kprobe *p) 523void __kprobes arch_arm_kprobe(struct kprobe *p)
460{ 524{
461 unsigned long addr = (unsigned long)p->addr; 525 unsigned long arm_addr;
462 unsigned long arm_addr = addr & ~0xFULL; 526 bundle_t *src, *dest;
527
528 arm_addr = ((unsigned long)p->addr) & ~0xFUL;
529 dest = &((kprobe_opcode_t *)arm_addr)->bundle;
530 src = &p->opcode.bundle;
463 531
464 flush_icache_range((unsigned long)p->ainsn.insn, 532 flush_icache_range((unsigned long)p->ainsn.insn,
465 (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t)); 533 (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t));
466 memcpy((char *)arm_addr, &p->opcode, sizeof(kprobe_opcode_t)); 534 switch (p->ainsn.slot) {
535 case 0:
536 dest->quad0.slot0 = src->quad0.slot0;
537 break;
538 case 1:
539 dest->quad1.slot1_p1 = src->quad1.slot1_p1;
540 break;
541 case 2:
542 dest->quad1.slot2 = src->quad1.slot2;
543 break;
544 }
467 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t)); 545 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t));
468} 546}
469 547
470void __kprobes arch_disarm_kprobe(struct kprobe *p) 548void __kprobes arch_disarm_kprobe(struct kprobe *p)
471{ 549{
472 unsigned long addr = (unsigned long)p->addr; 550 unsigned long arm_addr;
473 unsigned long arm_addr = addr & ~0xFULL; 551 bundle_t *src, *dest;
474 552
553 arm_addr = ((unsigned long)p->addr) & ~0xFUL;
554 dest = &((kprobe_opcode_t *)arm_addr)->bundle;
475 /* p->ainsn.insn contains the original unaltered kprobe_opcode_t */ 555 /* p->ainsn.insn contains the original unaltered kprobe_opcode_t */
476 memcpy((char *) arm_addr, (char *) p->ainsn.insn, 556 src = &p->ainsn.insn->bundle;
477 sizeof(kprobe_opcode_t)); 557 switch (p->ainsn.slot) {
558 case 0:
559 dest->quad0.slot0 = src->quad0.slot0;
560 break;
561 case 1:
562 dest->quad1.slot1_p1 = src->quad1.slot1_p1;
563 break;
564 case 2:
565 dest->quad1.slot2 = src->quad1.slot2;
566 break;
567 }
478 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t)); 568 flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t));
479} 569}
480 570
@@ -807,7 +897,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
807 switch(val) { 897 switch(val) {
808 case DIE_BREAK: 898 case DIE_BREAK:
809 /* err is break number from ia64_bad_break() */ 899 /* err is break number from ia64_bad_break() */
810 if (args->err == 0x80200 || args->err == 0x80300 || args->err == 0) 900 if ((args->err >> 12) == (__IA64_BREAK_KPROBE >> 12)
901 || args->err == __IA64_BREAK_JPROBE
902 || args->err == 0)
811 if (pre_kprobes_handler(args)) 903 if (pre_kprobes_handler(args))
812 ret = NOTIFY_STOP; 904 ret = NOTIFY_STOP;
813 break; 905 break;
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
index 468233fa2cee..e2ccc9f660c5 100644
--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -19,8 +19,11 @@
19#include <asm/delay.h> 19#include <asm/delay.h>
20#include <asm/meminit.h> 20#include <asm/meminit.h>
21 21
22typedef void (*relocate_new_kernel_t)(unsigned long, unsigned long, 22typedef NORET_TYPE void (*relocate_new_kernel_t)(
23 struct ia64_boot_param *, unsigned long); 23 unsigned long indirection_page,
24 unsigned long start_address,
25 struct ia64_boot_param *boot_param,
26 unsigned long pal_addr) ATTRIB_NORET;
24 27
25struct kimage *ia64_kimage; 28struct kimage *ia64_kimage;
26 29
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 87c1c4f42872..a76add3e76a2 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1239,7 +1239,7 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1239 } else { 1239 } else {
1240 /* Dump buffered message to console */ 1240 /* Dump buffered message to console */
1241 ia64_mlogbuf_finish(1); 1241 ia64_mlogbuf_finish(1);
1242#ifdef CONFIG_CRASH_DUMP 1242#ifdef CONFIG_KEXEC
1243 atomic_set(&kdump_in_progress, 1); 1243 atomic_set(&kdump_in_progress, 1);
1244 monarch_cpu = -1; 1244 monarch_cpu = -1;
1245#endif 1245#endif
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 14e1200376a9..ad567b8d432e 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -256,7 +256,7 @@ reserve_memory (void)
256 256
257#ifdef CONFIG_KEXEC 257#ifdef CONFIG_KEXEC
258 /* crashkernel=size@offset specifies the size to reserve for a crash 258 /* crashkernel=size@offset specifies the size to reserve for a crash
259 * kernel.(offset is ingored for keep compatibility with other archs) 259 * kernel. If offset is 0, then it is determined automatically.
260 * By reserving this memory we guarantee that linux never set's it 260 * By reserving this memory we guarantee that linux never set's it
261 * up as a DMA target.Useful for holding code to do something 261 * up as a DMA target.Useful for holding code to do something
262 * appropriate after a kernel panic. 262 * appropriate after a kernel panic.
@@ -266,10 +266,16 @@ reserve_memory (void)
266 unsigned long base, size; 266 unsigned long base, size;
267 if (from) { 267 if (from) {
268 size = memparse(from + 12, &from); 268 size = memparse(from + 12, &from);
269 if (*from == '@')
270 base = memparse(from+1, &from);
271 else
272 base = 0;
269 if (size) { 273 if (size) {
270 sort_regions(rsvd_region, n); 274 if (!base) {
271 base = kdump_find_rsvd_region(size, 275 sort_regions(rsvd_region, n);
272 rsvd_region, n); 276 base = kdump_find_rsvd_region(size,
277 rsvd_region, n);
278 }
273 if (base != ~0UL) { 279 if (base != ~0UL) {
274 rsvd_region[n].start = 280 rsvd_region[n].start =
275 (unsigned long)__va(base); 281 (unsigned long)__va(base);
@@ -434,6 +440,21 @@ static __init int setup_nomca(char *s)
434} 440}
435early_param("nomca", setup_nomca); 441early_param("nomca", setup_nomca);
436 442
443#ifdef CONFIG_PROC_VMCORE
444/* elfcorehdr= specifies the location of elf core header
445 * stored by the crashed kernel.
446 */
447static int __init parse_elfcorehdr(char *arg)
448{
449 if (!arg)
450 return -EINVAL;
451
452 elfcorehdr_addr = memparse(arg, &arg);
453 return 0;
454}
455early_param("elfcorehdr", parse_elfcorehdr);
456#endif /* CONFIG_PROC_VMCORE */
457
437void __init 458void __init
438setup_arch (char **cmdline_p) 459setup_arch (char **cmdline_p)
439{ 460{
@@ -653,6 +674,7 @@ get_model_name(__u8 family, __u8 model)
653{ 674{
654 char brand[128]; 675 char brand[128];
655 676
677 memcpy(brand, "Unknown", 8);
656 if (ia64_pal_get_brand_info(brand)) { 678 if (ia64_pal_get_brand_info(brand)) {
657 if (family == 0x7) 679 if (family == 0x7)
658 memcpy(brand, "Merced", 7); 680 memcpy(brand, "Merced", 7);
@@ -660,8 +682,7 @@ get_model_name(__u8 family, __u8 model)
660 case 0: memcpy(brand, "McKinley", 9); break; 682 case 0: memcpy(brand, "McKinley", 9); break;
661 case 1: memcpy(brand, "Madison", 8); break; 683 case 1: memcpy(brand, "Madison", 8); break;
662 case 2: memcpy(brand, "Madison up to 9M cache", 23); break; 684 case 2: memcpy(brand, "Madison up to 9M cache", 23); break;
663 } else 685 }
664 memcpy(brand, "Unknown", 8);
665 } 686 }
666 if (brandname[0] == '\0') 687 if (brandname[0] == '\0')
667 return strcpy(brandname, brand); 688 return strcpy(brandname, brand);
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index b1b9aa4364b9..f4c7f7769cf7 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -157,7 +157,7 @@ handle_IPI (int irq, void *dev_id)
157 case IPI_CPU_STOP: 157 case IPI_CPU_STOP:
158 stop_this_cpu(); 158 stop_this_cpu();
159 break; 159 break;
160#ifdef CONFIG_CRASH_DUMP 160#ifdef CONFIG_KEXEC
161 case IPI_KDUMP_CPU_STOP: 161 case IPI_KDUMP_CPU_STOP:
162 unw_init_running(kdump_cpu_freeze, NULL); 162 unw_init_running(kdump_cpu_freeze, NULL);
163 break; 163 break;
@@ -219,7 +219,7 @@ send_IPI_self (int op)
219 send_IPI_single(smp_processor_id(), op); 219 send_IPI_single(smp_processor_id(), op);
220} 220}
221 221
222#ifdef CONFIG_CRASH_DUMP 222#ifdef CONFIG_KEXEC
223void 223void
224kdump_smp_send_stop() 224kdump_smp_send_stop()
225{ 225{
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index fffa9e0826bc..ab684747036f 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -307,6 +307,15 @@ fp_emulate (int fp_fault, void *bundle, long *ipsr, long *fpsr, long *isr, long
307 return ret.status; 307 return ret.status;
308} 308}
309 309
310struct fpu_swa_msg {
311 unsigned long count;
312 unsigned long time;
313};
314static DEFINE_PER_CPU(struct fpu_swa_msg, cpulast);
315DECLARE_PER_CPU(struct fpu_swa_msg, cpulast);
316static struct fpu_swa_msg last __cacheline_aligned;
317
318
310/* 319/*
311 * Handle floating-point assist faults and traps. 320 * Handle floating-point assist faults and traps.
312 */ 321 */
@@ -316,8 +325,6 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
316 long exception, bundle[2]; 325 long exception, bundle[2];
317 unsigned long fault_ip; 326 unsigned long fault_ip;
318 struct siginfo siginfo; 327 struct siginfo siginfo;
319 static int fpu_swa_count = 0;
320 static unsigned long last_time;
321 328
322 fault_ip = regs->cr_iip; 329 fault_ip = regs->cr_iip;
323 if (!fp_fault && (ia64_psr(regs)->ri == 0)) 330 if (!fp_fault && (ia64_psr(regs)->ri == 0))
@@ -325,14 +332,37 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
325 if (copy_from_user(bundle, (void __user *) fault_ip, sizeof(bundle))) 332 if (copy_from_user(bundle, (void __user *) fault_ip, sizeof(bundle)))
326 return -1; 333 return -1;
327 334
328 if (jiffies - last_time > 5*HZ) 335 if (!(current->thread.flags & IA64_THREAD_FPEMU_NOPRINT)) {
329 fpu_swa_count = 0; 336 unsigned long count, current_jiffies = jiffies;
330 if ((fpu_swa_count < 4) && !(current->thread.flags & IA64_THREAD_FPEMU_NOPRINT)) { 337 struct fpu_swa_msg *cp = &__get_cpu_var(cpulast);
331 last_time = jiffies; 338
332 ++fpu_swa_count; 339 if (unlikely(current_jiffies > cp->time))
333 printk(KERN_WARNING 340 cp->count = 0;
334 "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n", 341 if (unlikely(cp->count < 5)) {
335 current->comm, current->pid, regs->cr_iip + ia64_psr(regs)->ri, isr); 342 cp->count++;
343 cp->time = current_jiffies + 5 * HZ;
344
345 /* minimize races by grabbing a copy of count BEFORE checking last.time. */
346 count = last.count;
347 barrier();
348
349 /*
350 * Lower 4 bits are used as a count. Upper bits are a sequence
351 * number that is updated when count is reset. The cmpxchg will
352 * fail is seqno has changed. This minimizes mutiple cpus
353 * reseting the count.
354 */
355 if (current_jiffies > last.time)
356 (void) cmpxchg_acq(&last.count, count, 16 + (count & ~15));
357
358 /* used fetchadd to atomically update the count */
359 if ((last.count & 15) < 5 && (ia64_fetchadd(1, &last.count, acq) & 15) < 5) {
360 last.time = current_jiffies + 5 * HZ;
361 printk(KERN_WARNING
362 "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
363 current->comm, current->pid, regs->cr_iip + ia64_psr(regs)->ri, isr);
364 }
365 }
336 } 366 }
337 367
338 exception = fp_emulate(fp_fault, bundle, &regs->cr_ipsr, &regs->ar_fpsr, &isr, &regs->pr, 368 exception = fp_emulate(fp_fault, bundle, &regs->cr_ipsr, &regs->ar_fpsr, &isr, &regs->pr,
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 82deaa3a7c48..1e79551231b9 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -174,6 +174,12 @@ find_memory (void)
174 reserve_bootmem(bootmap_start, bootmap_size); 174 reserve_bootmem(bootmap_start, bootmap_size);
175 175
176 find_initrd(); 176 find_initrd();
177
178#ifdef CONFIG_CRASH_DUMP
179 /* If we are doing a crash dump, we still need to know the real mem
180 * size before original memory map is * reset. */
181 saved_max_pfn = max_pfn;
182#endif
177} 183}
178 184
179#ifdef CONFIG_SMP 185#ifdef CONFIG_SMP
@@ -226,7 +232,6 @@ void __init
226paging_init (void) 232paging_init (void)
227{ 233{
228 unsigned long max_dma; 234 unsigned long max_dma;
229 unsigned long nid = 0;
230 unsigned long max_zone_pfns[MAX_NR_ZONES]; 235 unsigned long max_zone_pfns[MAX_NR_ZONES];
231 236
232 num_physpages = 0; 237 num_physpages = 0;
@@ -238,7 +243,7 @@ paging_init (void)
238 max_zone_pfns[ZONE_NORMAL] = max_low_pfn; 243 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
239 244
240#ifdef CONFIG_VIRTUAL_MEM_MAP 245#ifdef CONFIG_VIRTUAL_MEM_MAP
241 efi_memmap_walk(register_active_ranges, &nid); 246 efi_memmap_walk(register_active_ranges, NULL);
242 efi_memmap_walk(find_largest_hole, (u64 *)&max_gap); 247 efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
243 if (max_gap < LARGE_GAP) { 248 if (max_gap < LARGE_GAP) {
244 vmem_map = (struct page *) 0; 249 vmem_map = (struct page *) 0;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 56dc2024220e..1a3d8a2feb94 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -595,14 +595,9 @@ find_largest_hole (u64 start, u64 end, void *arg)
595} 595}
596 596
597int __init 597int __init
598register_active_ranges(u64 start, u64 end, void *nid) 598register_active_ranges(u64 start, u64 end, void *arg)
599{ 599{
600 BUG_ON(nid == NULL); 600 add_active_range(0, __pa(start) >> PAGE_SHIFT, __pa(end) >> PAGE_SHIFT);
601 BUG_ON(*(unsigned long *)nid >= MAX_NUMNODES);
602
603 add_active_range(*(unsigned long *)nid,
604 __pa(start) >> PAGE_SHIFT,
605 __pa(end) >> PAGE_SHIFT);
606 return 0; 601 return 0;
607} 602}
608#endif /* CONFIG_VIRTUAL_MEM_MAP */ 603#endif /* CONFIG_VIRTUAL_MEM_MAP */
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index a934ad069425..8571e52c2efd 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -580,7 +580,7 @@ void __cpuinit sn_cpu_init(void)
580 int slice; 580 int slice;
581 int cnode; 581 int cnode;
582 int i; 582 int i;
583 static int wars_have_been_checked; 583 static int wars_have_been_checked, set_cpu0_number;
584 584
585 cpuid = smp_processor_id(); 585 cpuid = smp_processor_id();
586 if (cpuid == 0 && IS_MEDUSA()) { 586 if (cpuid == 0 && IS_MEDUSA()) {
@@ -605,8 +605,16 @@ void __cpuinit sn_cpu_init(void)
605 /* 605 /*
606 * Don't check status. The SAL call is not supported on all PROMs 606 * Don't check status. The SAL call is not supported on all PROMs
607 * but a failure is harmless. 607 * but a failure is harmless.
608 * Architechtuallly, cpu_init is always called twice on cpu 0. We
609 * should set cpu_number on cpu 0 once.
608 */ 610 */
609 (void) ia64_sn_set_cpu_number(cpuid); 611 if (cpuid == 0) {
612 if (!set_cpu0_number) {
613 (void) ia64_sn_set_cpu_number(cpuid);
614 set_cpu0_number = 1;
615 }
616 } else
617 (void) ia64_sn_set_cpu_number(cpuid);
610 618
611 /* 619 /*
612 * The boot cpu makes this call again after platform initialization is 620 * The boot cpu makes this call again after platform initialization is
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 462ea178f49a..33367996d72d 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -189,7 +189,7 @@ static void print_pci_topology(struct seq_file *s)
189 int e; 189 int e;
190 190
191 for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) { 191 for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) {
192 if (!(p = (char *)kmalloc(sz, GFP_KERNEL))) 192 if (!(p = kmalloc(sz, GFP_KERNEL)))
193 break; 193 break;
194 e = ia64_sn_ioif_get_pci_topology(__pa(p), sz); 194 e = ia64_sn_ioif_get_pci_topology(__pa(p), sz);
195 if (e == SALRET_OK) 195 if (e == SALRET_OK)
diff --git a/arch/ia64/sn/kernel/xpc_channel.c b/arch/ia64/sn/kernel/xpc_channel.c
index 1f3540826e68..c08db9c2375d 100644
--- a/arch/ia64/sn/kernel/xpc_channel.c
+++ b/arch/ia64/sn/kernel/xpc_channel.c
@@ -632,7 +632,7 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
632 ch->number, ch->partid); 632 ch->number, ch->partid);
633 633
634 spin_unlock_irqrestore(&ch->lock, *irq_flags); 634 spin_unlock_irqrestore(&ch->lock, *irq_flags);
635 xpc_create_kthreads(ch, 1); 635 xpc_create_kthreads(ch, 1, 0);
636 spin_lock_irqsave(&ch->lock, *irq_flags); 636 spin_lock_irqsave(&ch->lock, *irq_flags);
637} 637}
638 638
@@ -754,12 +754,12 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
754 754
755 /* make sure all activity has settled down first */ 755 /* make sure all activity has settled down first */
756 756
757 if (atomic_read(&ch->references) > 0 || 757 if (atomic_read(&ch->kthreads_assigned) > 0 ||
758 ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) && 758 atomic_read(&ch->references) > 0) {
759 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE))) {
760 return; 759 return;
761 } 760 }
762 DBUG_ON(atomic_read(&ch->kthreads_assigned) != 0); 761 DBUG_ON((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
762 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE));
763 763
764 if (part->act_state == XPC_P_DEACTIVATING) { 764 if (part->act_state == XPC_P_DEACTIVATING) {
765 /* can't proceed until the other side disengages from us */ 765 /* can't proceed until the other side disengages from us */
@@ -1651,6 +1651,11 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1651 /* wake all idle kthreads so they can exit */ 1651 /* wake all idle kthreads so they can exit */
1652 if (atomic_read(&ch->kthreads_idle) > 0) { 1652 if (atomic_read(&ch->kthreads_idle) > 0) {
1653 wake_up_all(&ch->idle_wq); 1653 wake_up_all(&ch->idle_wq);
1654
1655 } else if ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
1656 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) {
1657 /* start a kthread that will do the xpcDisconnecting callout */
1658 xpc_create_kthreads(ch, 1, 1);
1654 } 1659 }
1655 1660
1656 /* wake those waiting to allocate an entry from the local msg queue */ 1661 /* wake those waiting to allocate an entry from the local msg queue */
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index fa96dfc0e1aa..7a387d237363 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -681,7 +681,7 @@ xpc_activate_kthreads(struct xpc_channel *ch, int needed)
681 dev_dbg(xpc_chan, "create %d new kthreads, partid=%d, channel=%d\n", 681 dev_dbg(xpc_chan, "create %d new kthreads, partid=%d, channel=%d\n",
682 needed, ch->partid, ch->number); 682 needed, ch->partid, ch->number);
683 683
684 xpc_create_kthreads(ch, needed); 684 xpc_create_kthreads(ch, needed, 0);
685} 685}
686 686
687 687
@@ -775,26 +775,28 @@ xpc_daemonize_kthread(void *args)
775 xpc_kthread_waitmsgs(part, ch); 775 xpc_kthread_waitmsgs(part, ch);
776 } 776 }
777 777
778 if (atomic_dec_return(&ch->kthreads_assigned) == 0) { 778 /* let registerer know that connection is disconnecting */
779 spin_lock_irqsave(&ch->lock, irq_flags);
780 if ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
781 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) {
782 ch->flags |= XPC_C_DISCONNECTINGCALLOUT;
783 spin_unlock_irqrestore(&ch->lock, irq_flags);
784 779
785 xpc_disconnect_callout(ch, xpcDisconnecting); 780 spin_lock_irqsave(&ch->lock, irq_flags);
786 781 if ((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
787 spin_lock_irqsave(&ch->lock, irq_flags); 782 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) {
788 ch->flags |= XPC_C_DISCONNECTINGCALLOUT_MADE; 783 ch->flags |= XPC_C_DISCONNECTINGCALLOUT;
789 }
790 spin_unlock_irqrestore(&ch->lock, irq_flags); 784 spin_unlock_irqrestore(&ch->lock, irq_flags);
785
786 xpc_disconnect_callout(ch, xpcDisconnecting);
787
788 spin_lock_irqsave(&ch->lock, irq_flags);
789 ch->flags |= XPC_C_DISCONNECTINGCALLOUT_MADE;
790 }
791 spin_unlock_irqrestore(&ch->lock, irq_flags);
792
793 if (atomic_dec_return(&ch->kthreads_assigned) == 0) {
791 if (atomic_dec_return(&part->nchannels_engaged) == 0) { 794 if (atomic_dec_return(&part->nchannels_engaged) == 0) {
792 xpc_mark_partition_disengaged(part); 795 xpc_mark_partition_disengaged(part);
793 xpc_IPI_send_disengage(part); 796 xpc_IPI_send_disengage(part);
794 } 797 }
795 } 798 }
796 799
797
798 xpc_msgqueue_deref(ch); 800 xpc_msgqueue_deref(ch);
799 801
800 dev_dbg(xpc_chan, "kthread exiting, partid=%d, channel=%d\n", 802 dev_dbg(xpc_chan, "kthread exiting, partid=%d, channel=%d\n",
@@ -818,7 +820,8 @@ xpc_daemonize_kthread(void *args)
818 * partition. 820 * partition.
819 */ 821 */
820void 822void
821xpc_create_kthreads(struct xpc_channel *ch, int needed) 823xpc_create_kthreads(struct xpc_channel *ch, int needed,
824 int ignore_disconnecting)
822{ 825{
823 unsigned long irq_flags; 826 unsigned long irq_flags;
824 pid_t pid; 827 pid_t pid;
@@ -833,16 +836,38 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed)
833 * kthread. That kthread is responsible for doing the 836 * kthread. That kthread is responsible for doing the
834 * counterpart to the following before it exits. 837 * counterpart to the following before it exits.
835 */ 838 */
839 if (ignore_disconnecting) {
840 if (!atomic_inc_not_zero(&ch->kthreads_assigned)) {
841 /* kthreads assigned had gone to zero */
842 BUG_ON(!(ch->flags &
843 XPC_C_DISCONNECTINGCALLOUT_MADE));
844 break;
845 }
846
847 } else if (ch->flags & XPC_C_DISCONNECTING) {
848 break;
849
850 } else if (atomic_inc_return(&ch->kthreads_assigned) == 1) {
851 if (atomic_inc_return(&part->nchannels_engaged) == 1)
852 xpc_mark_partition_engaged(part);
853 }
836 (void) xpc_part_ref(part); 854 (void) xpc_part_ref(part);
837 xpc_msgqueue_ref(ch); 855 xpc_msgqueue_ref(ch);
838 if (atomic_inc_return(&ch->kthreads_assigned) == 1 &&
839 atomic_inc_return(&part->nchannels_engaged) == 1) {
840 xpc_mark_partition_engaged(part);
841 }
842 856
843 pid = kernel_thread(xpc_daemonize_kthread, (void *) args, 0); 857 pid = kernel_thread(xpc_daemonize_kthread, (void *) args, 0);
844 if (pid < 0) { 858 if (pid < 0) {
845 /* the fork failed */ 859 /* the fork failed */
860
861 /*
862 * NOTE: if (ignore_disconnecting &&
863 * !(ch->flags & XPC_C_DISCONNECTINGCALLOUT)) is true,
864 * then we'll deadlock if all other kthreads assigned
865 * to this channel are blocked in the channel's
866 * registerer, because the only thing that will unblock
867 * them is the xpcDisconnecting callout that this
868 * failed kernel_thread would have made.
869 */
870
846 if (atomic_dec_return(&ch->kthreads_assigned) == 0 && 871 if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
847 atomic_dec_return(&part->nchannels_engaged) == 0) { 872 atomic_dec_return(&part->nchannels_engaged) == 0) {
848 xpc_mark_partition_disengaged(part); 873 xpc_mark_partition_disengaged(part);
@@ -857,9 +882,6 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed)
857 * Flag this as an error only if we have an 882 * Flag this as an error only if we have an
858 * insufficient #of kthreads for the channel 883 * insufficient #of kthreads for the channel
859 * to function. 884 * to function.
860 *
861 * No xpc_msgqueue_ref() is needed here since
862 * the channel mgr is doing this.
863 */ 885 */
864 spin_lock_irqsave(&ch->lock, irq_flags); 886 spin_lock_irqsave(&ch->lock, irq_flags);
865 XPC_DISCONNECT_CHANNEL(ch, xpcLackOfResources, 887 XPC_DISCONNECT_CHANNEL(ch, xpcLackOfResources,
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index b54ef1726c55..46b7d6035aab 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -59,7 +59,7 @@ static struct vm_struct *get_io_area(unsigned long size)
59 unsigned long addr; 59 unsigned long addr;
60 struct vm_struct **p, *tmp, *area; 60 struct vm_struct **p, *tmp, *area;
61 61
62 area = (struct vm_struct *)kmalloc(sizeof(*area), GFP_KERNEL); 62 area = kmalloc(sizeof(*area), GFP_KERNEL);
63 if (!area) 63 if (!area)
64 return NULL; 64 return NULL;
65 addr = KMAP_START; 65 addr = KMAP_START;
diff --git a/arch/mips/kernel/apm.c b/arch/mips/kernel/apm.c
index 528e731049c1..ba16d07588cb 100644
--- a/arch/mips/kernel/apm.c
+++ b/arch/mips/kernel/apm.c
@@ -356,7 +356,7 @@ static int apm_open(struct inode * inode, struct file * filp)
356{ 356{
357 struct apm_user *as; 357 struct apm_user *as;
358 358
359 as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL); 359 as = kzalloc(sizeof(*as), GFP_KERNEL);
360 if (as) { 360 if (as) {
361 /* 361 /*
362 * XXX - this is a tiny bit broken, when we consider BSD 362 * XXX - this is a tiny bit broken, when we consider BSD
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index ea2d15370bb7..30245c09d025 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -203,6 +203,31 @@ static inline void kunmap_coherent(struct page *page)
203 preempt_check_resched(); 203 preempt_check_resched();
204} 204}
205 205
206void copy_user_highpage(struct page *to, struct page *from,
207 unsigned long vaddr, struct vm_area_struct *vma)
208{
209 void *vfrom, *vto;
210
211 vto = kmap_atomic(to, KM_USER1);
212 if (cpu_has_dc_aliases) {
213 vfrom = kmap_coherent(from, vaddr);
214 copy_page(vto, vfrom);
215 kunmap_coherent(from);
216 } else {
217 vfrom = kmap_atomic(from, KM_USER0);
218 copy_page(vto, vfrom);
219 kunmap_atomic(vfrom, KM_USER0);
220 }
221 if (((vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc) ||
222 pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
223 flush_data_cache_page((unsigned long)vto);
224 kunmap_atomic(vto, KM_USER1);
225 /* Make sure this page is cleared on other CPU's too before using it */
226 smp_wmb();
227}
228
229EXPORT_SYMBOL(copy_user_highpage);
230
206void copy_to_user_page(struct vm_area_struct *vma, 231void copy_to_user_page(struct vm_area_struct *vma,
207 struct page *page, unsigned long vaddr, void *dst, const void *src, 232 struct page *page, unsigned long vaddr, void *dst, const void *src,
208 unsigned long len) 233 unsigned long len)
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index d88309209f56..04c2ff444396 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -475,7 +475,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
475 printk(KERN_DEBUG "len of arg1 = %d\n", len); 475 printk(KERN_DEBUG "len of arg1 = %d\n", len);
476 if (len == 0) 476 if (len == 0)
477 return 0; 477 return 0;
478 fsname = (char *) kmalloc(len, GFP_KERNEL); 478 fsname = kmalloc(len, GFP_KERNEL);
479 if ( !fsname ) { 479 if ( !fsname ) {
480 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 480 printk(KERN_DEBUG "failed to kmalloc fsname\n");
481 return 0; 481 return 0;
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index 920bdbf8404f..c10ab47d81fa 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -343,7 +343,7 @@ void unwind_frame_init_from_blocked_task(struct unwind_frame_info *info, struct
343 struct pt_regs *r = &t->thread.regs; 343 struct pt_regs *r = &t->thread.regs;
344 struct pt_regs *r2; 344 struct pt_regs *r2;
345 345
346 r2 = (struct pt_regs *)kmalloc(sizeof(struct pt_regs), GFP_KERNEL); 346 r2 = kmalloc(sizeof(struct pt_regs), GFP_KERNEL);
347 if (!r2) 347 if (!r2)
348 return; 348 return;
349 *r2 = *r; 349 *r2 = *r;
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 6960f090991e..869cebbba967 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -505,7 +505,7 @@ static int nvram_scan_partitions(void)
505 return -ENODEV; 505 return -ENODEV;
506 total_size = ppc_md.nvram_size(); 506 total_size = ppc_md.nvram_size();
507 507
508 header = (char *) kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL); 508 header = kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL);
509 if (!header) { 509 if (!header) {
510 printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n"); 510 printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n");
511 return -ENOMEM; 511 return -ENOMEM;
@@ -574,7 +574,7 @@ static int __init nvram_init(void)
574 } 574 }
575 575
576 /* initialize our anchor for the nvram partition list */ 576 /* initialize our anchor for the nvram partition list */
577 nvram_part = (struct nvram_partition *) kmalloc(sizeof(struct nvram_partition), GFP_KERNEL); 577 nvram_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
578 if (!nvram_part) { 578 if (!nvram_part) {
579 printk(KERN_ERR "nvram_init: Failed kmalloc\n"); 579 printk(KERN_ERR "nvram_init: Failed kmalloc\n");
580 return -ENOMEM; 580 return -ENOMEM;
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 8336deafc624..2847cd51a2d7 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -670,7 +670,7 @@ pcibios_make_OF_bus_map(void)
670 struct pci_controller* hose; 670 struct pci_controller* hose;
671 struct property *map_prop; 671 struct property *map_prop;
672 672
673 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); 673 pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL);
674 if (!pci_to_OF_bus_map) { 674 if (!pci_to_OF_bus_map) {
675 printk(KERN_ERR "Can't allocate OF bus map !\n"); 675 printk(KERN_ERR "Can't allocate OF bus map !\n");
676 return; 676 return;
diff --git a/arch/powerpc/mm/imalloc.c b/arch/powerpc/mm/imalloc.c
index add8c1a9af68..c831815c31f0 100644
--- a/arch/powerpc/mm/imalloc.c
+++ b/arch/powerpc/mm/imalloc.c
@@ -138,7 +138,7 @@ static struct vm_struct * split_im_region(unsigned long v_addr,
138 struct vm_struct *vm2 = NULL; 138 struct vm_struct *vm2 = NULL;
139 struct vm_struct *new_vm = NULL; 139 struct vm_struct *new_vm = NULL;
140 140
141 vm1 = (struct vm_struct *) kmalloc(sizeof(*vm1), GFP_KERNEL); 141 vm1 = kmalloc(sizeof(*vm1), GFP_KERNEL);
142 if (vm1 == NULL) { 142 if (vm1 == NULL) {
143 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); 143 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__);
144 return NULL; 144 return NULL;
@@ -172,7 +172,7 @@ static struct vm_struct * split_im_region(unsigned long v_addr,
172 * uppermost remainder, and use existing parent one for the 172 * uppermost remainder, and use existing parent one for the
173 * lower remainder of parent range 173 * lower remainder of parent range
174 */ 174 */
175 vm2 = (struct vm_struct *) kmalloc(sizeof(*vm2), GFP_KERNEL); 175 vm2 = kmalloc(sizeof(*vm2), GFP_KERNEL);
176 if (vm2 == NULL) { 176 if (vm2 == NULL) {
177 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); 177 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__);
178 kfree(vm1); 178 kfree(vm1);
@@ -206,7 +206,7 @@ static struct vm_struct * __add_new_im_area(unsigned long req_addr,
206 break; 206 break;
207 } 207 }
208 208
209 area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL); 209 area = kmalloc(sizeof(*area), GFP_KERNEL);
210 if (!area) 210 if (!area)
211 return NULL; 211 return NULL;
212 area->flags = 0; 212 area->flags = 0;
diff --git a/arch/powerpc/platforms/4xx/Kconfig b/arch/powerpc/platforms/4xx/Kconfig
index ed39d6a3d22a..2f2a13ed7667 100644
--- a/arch/powerpc/platforms/4xx/Kconfig
+++ b/arch/powerpc/platforms/4xx/Kconfig
@@ -179,7 +179,7 @@ config BIOS_FIXUP
179# OAK doesn't exist but wanted to keep this around for any future 403GCX boards 179# OAK doesn't exist but wanted to keep this around for any future 403GCX boards
180config 403GCX 180config 403GCX
181 bool 181 bool
182 depends OAK 182 depends on OAK
183 default y 183 default y
184 184
185config 405EP 185config 405EP
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index ddbe398fbd48..b3c2ce4cb7a8 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -35,7 +35,7 @@ config HDPU
35 Select HDPU if configuring a Sky Computers Compute Blade. 35 Select HDPU if configuring a Sky Computers Compute Blade.
36 36
37config HDPU_FEATURES 37config HDPU_FEATURES
38 depends HDPU 38 depends on HDPU
39 tristate "HDPU-Features" 39 tristate "HDPU-Features"
40 help 40 help
41 Select to enable HDPU enhanced features. 41 Select to enable HDPU enhanced features.
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index b6b462d3c604..f2bae04424f8 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -153,7 +153,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
153 return piar; 153 return piar;
154 } 154 }
155 } 155 }
156 piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 156 piar = kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
157 if (!piar) 157 if (!piar)
158 return NULL; 158 return NULL;
159 159
diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c
index 709952c25f29..06b84c372e58 100644
--- a/arch/ppc/8260_io/fcc_enet.c
+++ b/arch/ppc/8260_io/fcc_enet.c
@@ -1892,10 +1892,10 @@ init_fcc_param(fcc_info_t *fip, struct net_device *dev,
1892 /* Allocate space for the buffer descriptors from regular memory. 1892 /* Allocate space for the buffer descriptors from regular memory.
1893 * Initialize base addresses for the buffer descriptors. 1893 * Initialize base addresses for the buffer descriptors.
1894 */ 1894 */
1895 cep->rx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * RX_RING_SIZE, 1895 cep->rx_bd_base = kmalloc(sizeof(cbd_t) * RX_RING_SIZE,
1896 GFP_KERNEL | GFP_DMA); 1896 GFP_KERNEL | GFP_DMA);
1897 ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base); 1897 ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base);
1898 cep->tx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * TX_RING_SIZE, 1898 cep->tx_bd_base = kmalloc(sizeof(cbd_t) * TX_RING_SIZE,
1899 GFP_KERNEL | GFP_DMA); 1899 GFP_KERNEL | GFP_DMA);
1900 ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base); 1900 ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base);
1901 1901
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
index c71ef3c2e7bf..b7bb5f0b3c5f 100644
--- a/arch/ppc/8xx_io/cs4218_tdm.c
+++ b/arch/ppc/8xx_io/cs4218_tdm.c
@@ -2601,7 +2601,7 @@ int __init tdm8xx_sound_init(void)
2601 /* Initialize beep stuff */ 2601 /* Initialize beep stuff */
2602 orig_mksound = kd_mksound; 2602 orig_mksound = kd_mksound;
2603 kd_mksound = cs_mksound; 2603 kd_mksound = cs_mksound;
2604 beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); 2604 beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
2605 if (beep_buf == NULL) 2605 if (beep_buf == NULL)
2606 printk(KERN_WARNING "dmasound: no memory for " 2606 printk(KERN_WARNING "dmasound: no memory for "
2607 "beep buffer\n"); 2607 "beep buffer\n");
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 692b5ba53209..8eb82efe05a1 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -624,7 +624,7 @@ config HDPU
624 Select HDPU if configuring a Sky Computers Compute Blade. 624 Select HDPU if configuring a Sky Computers Compute Blade.
625 625
626config HDPU_FEATURES 626config HDPU_FEATURES
627 depends HDPU 627 depends on HDPU
628 tristate "HDPU-Features" 628 tristate "HDPU-Features"
629 help 629 help
630 Select to enable HDPU enhanced features. 630 Select to enable HDPU enhanced features.
@@ -735,7 +735,7 @@ config LITE5200
735 735
736config LITE5200B 736config LITE5200B
737 bool "Freescale LITE5200B" 737 bool "Freescale LITE5200B"
738 depends LITE5200 738 depends on LITE5200
739 help 739 help
740 Support for the LITE5200B dev board for the MPC5200 from Freescale. 740 Support for the LITE5200B dev board for the MPC5200 from Freescale.
741 This is the new board with 2 PCI slots. 741 This is the new board with 2 PCI slots.
diff --git a/arch/ppc/platforms/4xx/Kconfig b/arch/ppc/platforms/4xx/Kconfig
index 293bd489e7d9..6980de420e92 100644
--- a/arch/ppc/platforms/4xx/Kconfig
+++ b/arch/ppc/platforms/4xx/Kconfig
@@ -189,7 +189,7 @@ config BIOS_FIXUP
189# OAK doesn't exist but wanted to keep this around for any future 403GCX boards 189# OAK doesn't exist but wanted to keep this around for any future 403GCX boards
190config 403GCX 190config 403GCX
191 bool 191 bool
192 depends OAK 192 depends on OAK
193 default y 193 default y
194 194
195config 405EP 195config 405EP
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index ff690564edbd..12272361c018 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -407,7 +407,7 @@ config APPLDATA_BASE
407 407
408config APPLDATA_MEM 408config APPLDATA_MEM
409 tristate "Monitor memory management statistics" 409 tristate "Monitor memory management statistics"
410 depends on APPLDATA_BASE 410 depends on APPLDATA_BASE && VM_EVENT_COUNTERS
411 help 411 help
412 This provides memory management related data to the Linux - VM Monitor 412 This provides memory management related data to the Linux - VM Monitor
413 Stream, like paging/swapping rate, memory utilisation, etc. 413 Stream, like paging/swapping rate, memory utilisation, etc.
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index ef5266fbce62..bb57bc0e3fc8 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -191,13 +191,13 @@ debug_areas_alloc(int pages_per_area, int nr_areas)
191 debug_entry_t*** areas; 191 debug_entry_t*** areas;
192 int i,j; 192 int i,j;
193 193
194 areas = (debug_entry_t ***) kmalloc(nr_areas * 194 areas = kmalloc(nr_areas *
195 sizeof(debug_entry_t**), 195 sizeof(debug_entry_t**),
196 GFP_KERNEL); 196 GFP_KERNEL);
197 if (!areas) 197 if (!areas)
198 goto fail_malloc_areas; 198 goto fail_malloc_areas;
199 for (i = 0; i < nr_areas; i++) { 199 for (i = 0; i < nr_areas; i++) {
200 areas[i] = (debug_entry_t**) kmalloc(pages_per_area * 200 areas[i] = kmalloc(pages_per_area *
201 sizeof(debug_entry_t*),GFP_KERNEL); 201 sizeof(debug_entry_t*),GFP_KERNEL);
202 if (!areas[i]) { 202 if (!areas[i]) {
203 goto fail_malloc_areas2; 203 goto fail_malloc_areas2;
@@ -242,7 +242,7 @@ debug_info_alloc(char *name, int pages_per_area, int nr_areas, int buf_size,
242 242
243 /* alloc everything */ 243 /* alloc everything */
244 244
245 rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_KERNEL); 245 rc = kmalloc(sizeof(debug_info_t), GFP_KERNEL);
246 if(!rc) 246 if(!rc)
247 goto fail_malloc_rc; 247 goto fail_malloc_rc;
248 rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL); 248 rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL);
@@ -634,7 +634,7 @@ found:
634 rc = -ENOMEM; 634 rc = -ENOMEM;
635 goto out; 635 goto out;
636 } 636 }
637 p_info = (file_private_info_t *) kmalloc(sizeof(file_private_info_t), 637 p_info = kmalloc(sizeof(file_private_info_t),
638 GFP_KERNEL); 638 GFP_KERNEL);
639 if(!p_info){ 639 if(!p_info){
640 if(debug_info_snapshot) 640 if(debug_info_snapshot)
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index 4faf96f8a834..bc5beaa8f98e 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -37,7 +37,7 @@ int register_external_interrupt(__u16 code, ext_int_handler_t handler)
37 ext_int_info_t *p; 37 ext_int_info_t *p;
38 int index; 38 int index;
39 39
40 p = (ext_int_info_t *) kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC); 40 p = kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC);
41 if (p == NULL) 41 if (p == NULL)
42 return -ENOMEM; 42 return -ENOMEM;
43 p->code = code; 43 p->code = code;
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index c8cb211b9072..5b4841d067c1 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -425,7 +425,7 @@ int request_fast_irq(unsigned int irq,
425 } 425 }
426 426
427 if (action == NULL) 427 if (action == NULL)
428 action = (struct irqaction *)kmalloc(sizeof(struct irqaction), 428 action = kmalloc(sizeof(struct irqaction),
429 GFP_ATOMIC); 429 GFP_ATOMIC);
430 430
431 if (!action) { 431 if (!action) {
@@ -528,7 +528,7 @@ int request_irq(unsigned int irq,
528 } 528 }
529 529
530 if (action == NULL) 530 if (action == NULL)
531 action = (struct irqaction *)kmalloc(sizeof(struct irqaction), 531 action = kmalloc(sizeof(struct irqaction),
532 GFP_ATOMIC); 532 GFP_ATOMIC);
533 533
534 if (!action) { 534 if (!action) {
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index cf1b8baa57ea..0e27e226e0e2 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -327,7 +327,7 @@ int sun4d_request_irq(unsigned int irq,
327 } 327 }
328 328
329 if (action == NULL) 329 if (action == NULL)
330 action = (struct irqaction *)kmalloc(sizeof(struct irqaction), 330 action = kmalloc(sizeof(struct irqaction),
331 GFP_ATOMIC); 331 GFP_ATOMIC);
332 332
333 if (!action) { 333 if (!action) {
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index 4446f66590fa..2ebc2c051383 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -1055,7 +1055,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
1055 break; 1055 break;
1056 case 2: 1056 case 2:
1057 rval = -EFAULT; 1057 rval = -EFAULT;
1058 kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, 1058 kmbuf = kmalloc(sizeof(struct msgbuf) + arg3,
1059 GFP_KERNEL); 1059 GFP_KERNEL);
1060 if (!kmbuf) 1060 if (!kmbuf)
1061 break; 1061 break;
@@ -1078,7 +1078,7 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
1078 break; 1078 break;
1079 case 3: 1079 case 3:
1080 rval = -EFAULT; 1080 rval = -EFAULT;
1081 kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, 1081 kmbuf = kmalloc(sizeof(struct msgbuf) + arg3,
1082 GFP_KERNEL); 1082 GFP_KERNEL);
1083 if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2, 1083 if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2,
1084 kmbuf, arg3)) 1084 kmbuf, arg3))
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 286bc0b3207f..afe3d427ddfa 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -72,9 +72,11 @@ static int uml_net_rx(struct net_device *dev)
72 return pkt_len; 72 return pkt_len;
73} 73}
74 74
75static void uml_dev_close(void* dev) 75static void uml_dev_close(struct work_struct *work)
76{ 76{
77 dev_close( (struct net_device *) dev); 77 struct uml_net_private *lp =
78 container_of(work, struct uml_net_private, work);
79 dev_close(lp->dev);
78} 80}
79 81
80irqreturn_t uml_net_interrupt(int irq, void *dev_id) 82irqreturn_t uml_net_interrupt(int irq, void *dev_id)
@@ -89,7 +91,6 @@ irqreturn_t uml_net_interrupt(int irq, void *dev_id)
89 spin_lock(&lp->lock); 91 spin_lock(&lp->lock);
90 while((err = uml_net_rx(dev)) > 0) ; 92 while((err = uml_net_rx(dev)) > 0) ;
91 if(err < 0) { 93 if(err < 0) {
92 DECLARE_WORK(close_work, uml_dev_close, dev);
93 printk(KERN_ERR 94 printk(KERN_ERR
94 "Device '%s' read returned %d, shutting it down\n", 95 "Device '%s' read returned %d, shutting it down\n",
95 dev->name, err); 96 dev->name, err);
@@ -97,9 +98,10 @@ irqreturn_t uml_net_interrupt(int irq, void *dev_id)
97 * again lp->lock. 98 * again lp->lock.
98 * And dev_close() can be safely called multiple times on the 99 * And dev_close() can be safely called multiple times on the
99 * same device, since it tests for (dev->flags & IFF_UP). So 100 * same device, since it tests for (dev->flags & IFF_UP). So
100 * there's no harm in delaying the device shutdown. */ 101 * there's no harm in delaying the device shutdown.
101 schedule_work(&close_work); 102 * Furthermore, the workqueue will not re-enqueue an already
102#error this is not permitted - close_work will go out of scope 103 * enqueued work item. */
104 schedule_work(&lp->work);
103 goto out; 105 goto out;
104 } 106 }
105 reactivate_fd(lp->fd, UM_ETH_IRQ); 107 reactivate_fd(lp->fd, UM_ETH_IRQ);
@@ -334,13 +336,12 @@ static int eth_configure(int n, void *init, char *mac,
334 size = transport->private_size + sizeof(struct uml_net_private) + 336 size = transport->private_size + sizeof(struct uml_net_private) +
335 sizeof(((struct uml_net_private *) 0)->user); 337 sizeof(((struct uml_net_private *) 0)->user);
336 338
337 device = kmalloc(sizeof(*device), GFP_KERNEL); 339 device = kzalloc(sizeof(*device), GFP_KERNEL);
338 if (device == NULL) { 340 if (device == NULL) {
339 printk(KERN_ERR "eth_configure failed to allocate uml_net\n"); 341 printk(KERN_ERR "eth_configure failed to allocate uml_net\n");
340 return(1); 342 return(1);
341 } 343 }
342 344
343 memset(device, 0, sizeof(*device));
344 INIT_LIST_HEAD(&device->list); 345 INIT_LIST_HEAD(&device->list);
345 device->index = n; 346 device->index = n;
346 347
@@ -366,6 +367,7 @@ static int eth_configure(int n, void *init, char *mac,
366 /* This points to the transport private data. It's still clear, but we 367 /* This points to the transport private data. It's still clear, but we
367 * must memset it to 0 *now*. Let's help the drivers. */ 368 * must memset it to 0 *now*. Let's help the drivers. */
368 memset(lp, 0, size); 369 memset(lp, 0, size);
370 INIT_WORK(&lp->work, uml_dev_close);
369 371
370 /* sysfs register */ 372 /* sysfs register */
371 if (!driver_registered) { 373 if (!driver_registered) {
diff --git a/arch/um/include/net_kern.h b/arch/um/include/net_kern.h
index 280459fb0b26..218f8b47fdcd 100644
--- a/arch/um/include/net_kern.h
+++ b/arch/um/include/net_kern.h
@@ -11,6 +11,7 @@
11#include <linux/skbuff.h> 11#include <linux/skbuff.h>
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/workqueue.h>
14 15
15struct uml_net { 16struct uml_net {
16 struct list_head list; 17 struct list_head list;
@@ -26,6 +27,7 @@ struct uml_net_private {
26 struct net_device *dev; 27 struct net_device *dev;
27 struct timer_list tl; 28 struct timer_list tl;
28 struct net_device_stats stats; 29 struct net_device_stats stats;
30 struct work_struct work;
29 int fd; 31 int fd;
30 unsigned char mac[ETH_ALEN]; 32 unsigned char mac[ETH_ALEN];
31 unsigned short (*protocol)(struct sk_buff *); 33 unsigned short (*protocol)(struct sk_buff *);
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 49057d8bc668..5db7737df0ff 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -166,7 +166,7 @@ static long read_ldt_from_host(void __user * ptr, unsigned long bytecount)
166 struct ptrace_ldt ptrace_ldt = (struct ptrace_ldt) { 166 struct ptrace_ldt ptrace_ldt = (struct ptrace_ldt) {
167 .func = 0, 167 .func = 0,
168 .bytecount = bytecount, 168 .bytecount = bytecount,
169 .ptr = (void *)kmalloc(bytecount, GFP_KERNEL)}; 169 .ptr = kmalloc(bytecount, GFP_KERNEL)};
170 u32 cpu; 170 u32 cpu;
171 171
172 if(ptrace_ldt.ptr == NULL) 172 if(ptrace_ldt.ptr == NULL)
@@ -426,7 +426,7 @@ void ldt_get_host_info(void)
426 host_ldt_entries = dummy_list; 426 host_ldt_entries = dummy_list;
427 else { 427 else {
428 size = (size + 1) * sizeof(dummy_list[0]); 428 size = (size + 1) * sizeof(dummy_list[0]);
429 host_ldt_entries = (short *)kmalloc(size, GFP_KERNEL); 429 host_ldt_entries = kmalloc(size, GFP_KERNEL);
430 if(host_ldt_entries == NULL) { 430 if(host_ldt_entries == NULL) {
431 printk("ldt_get_host_info: couldn't allocate host ldt list\n"); 431 printk("ldt_get_host_info: couldn't allocate host ldt list\n");
432 goto out_free; 432 goto out_free;
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig
index bcf825875d17..f0d4d72e560f 100644
--- a/arch/v850/Kconfig
+++ b/arch/v850/Kconfig
@@ -105,17 +105,17 @@ menu "Processor type and features"
105 # currently support 105 # currently support
106 config V850E_MA1 106 config V850E_MA1
107 bool 107 bool
108 depends RTE_CB_MA1 108 depends on RTE_CB_MA1
109 default y 109 default y
110 # Similarly for the RTE-V850E/NB85E-CB - V850E/TEG 110 # Similarly for the RTE-V850E/NB85E-CB - V850E/TEG
111 config V850E_TEG 111 config V850E_TEG
112 bool 112 bool
113 depends RTE_CB_NB85E 113 depends on RTE_CB_NB85E
114 default y 114 default y
115 # ... and the RTE-V850E/ME2-CB - V850E/ME2 115 # ... and the RTE-V850E/ME2-CB - V850E/ME2
116 config V850E_ME2 116 config V850E_ME2
117 bool 117 bool
118 depends RTE_CB_ME2 118 depends on RTE_CB_ME2
119 default y 119 default y
120 120
121 121
@@ -123,7 +123,7 @@ menu "Processor type and features"
123 123
124 config V850E2_SIM85E2 124 config V850E2_SIM85E2
125 bool 125 bool
126 depends V850E2_SIM85E2C || V850E2_SIM85E2S 126 depends on V850E2_SIM85E2C || V850E2_SIM85E2S
127 default y 127 default y
128 128
129 129
@@ -132,7 +132,7 @@ menu "Processor type and features"
132 # V850E2 processors 132 # V850E2 processors
133 config V850E2 133 config V850E2
134 bool 134 bool
135 depends V850E2_SIM85E2 || V850E2_FPGA85E2C || V850E2_ANNA 135 depends on V850E2_SIM85E2 || V850E2_FPGA85E2C || V850E2_ANNA
136 default y 136 default y
137 137
138 138
@@ -141,7 +141,7 @@ menu "Processor type and features"
141 # Boards in the RTE-x-CB series 141 # Boards in the RTE-x-CB series
142 config RTE_CB 142 config RTE_CB
143 bool 143 bool
144 depends RTE_CB_MA1 || RTE_CB_NB85E || RTE_CB_ME2 144 depends on RTE_CB_MA1 || RTE_CB_NB85E || RTE_CB_ME2
145 default y 145 default y
146 146
147 config RTE_CB_MULTI 147 config RTE_CB_MULTI
@@ -149,28 +149,28 @@ menu "Processor type and features"
149 # RTE_CB_NB85E can either have multi ROM support or not, but 149 # RTE_CB_NB85E can either have multi ROM support or not, but
150 # other platforms (currently only RTE_CB_MA1) require it. 150 # other platforms (currently only RTE_CB_MA1) require it.
151 prompt "Multi monitor ROM support" if RTE_CB_NB85E 151 prompt "Multi monitor ROM support" if RTE_CB_NB85E
152 depends RTE_CB_MA1 || RTE_CB_NB85E 152 depends on RTE_CB_MA1 || RTE_CB_NB85E
153 default y 153 default y
154 154
155 config RTE_CB_MULTI_DBTRAP 155 config RTE_CB_MULTI_DBTRAP
156 bool "Pass illegal insn trap / dbtrap to kernel" 156 bool "Pass illegal insn trap / dbtrap to kernel"
157 depends RTE_CB_MULTI 157 depends on RTE_CB_MULTI
158 default n 158 default n
159 159
160 config RTE_CB_MA1_KSRAM 160 config RTE_CB_MA1_KSRAM
161 bool "Kernel in SRAM (limits size of kernel)" 161 bool "Kernel in SRAM (limits size of kernel)"
162 depends RTE_CB_MA1 && RTE_CB_MULTI 162 depends on RTE_CB_MA1 && RTE_CB_MULTI
163 default n 163 default n
164 164
165 config RTE_MB_A_PCI 165 config RTE_MB_A_PCI
166 bool "Mother-A PCI support" 166 bool "Mother-A PCI support"
167 depends RTE_CB 167 depends on RTE_CB
168 default y 168 default y
169 169
170 # The GBUS is used to talk to the RTE-MOTHER-A board 170 # The GBUS is used to talk to the RTE-MOTHER-A board
171 config RTE_GBUS_INT 171 config RTE_GBUS_INT
172 bool 172 bool
173 depends RTE_MB_A_PCI 173 depends on RTE_MB_A_PCI
174 default y 174 default y
175 175
176 # The only PCI bus we support is on the RTE-MOTHER-A board 176 # The only PCI bus we support is on the RTE-MOTHER-A board
@@ -209,7 +209,7 @@ menu "Processor type and features"
209 209
210 config ROM_KERNEL 210 config ROM_KERNEL
211 bool "Kernel in ROM" 211 bool "Kernel in ROM"
212 depends V850E2_ANNA || V850E_AS85EP1 || RTE_CB_ME2 212 depends on V850E2_ANNA || V850E_AS85EP1 || RTE_CB_ME2
213 213
214 # Some platforms pre-zero memory, in which case the kernel doesn't need to 214 # Some platforms pre-zero memory, in which case the kernel doesn't need to
215 config ZERO_BSS 215 config ZERO_BSS
@@ -225,10 +225,10 @@ menu "Processor type and features"
225 225
226 config V850E_HIGHRES_TIMER 226 config V850E_HIGHRES_TIMER
227 bool "High resolution timer support" 227 bool "High resolution timer support"
228 depends V850E_TIMER_D 228 depends on V850E_TIMER_D
229 config TIME_BOOTUP 229 config TIME_BOOTUP
230 bool "Time bootup" 230 bool "Time bootup"
231 depends V850E_HIGHRES_TIMER 231 depends on V850E_HIGHRES_TIMER
232 232
233 config RESET_GUARD 233 config RESET_GUARD
234 bool "Reset Guard" 234 bool "Reset Guard"
diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig
index 81f1562e5393..3abcfa3e1ed7 100644
--- a/arch/x86_64/kernel/cpufreq/Kconfig
+++ b/arch/x86_64/kernel/cpufreq/Kconfig
@@ -27,10 +27,13 @@ config X86_POWERNOW_K8_ACPI
27 default y 27 default y
28 28
29config X86_SPEEDSTEP_CENTRINO 29config X86_SPEEDSTEP_CENTRINO
30 tristate "Intel Enhanced SpeedStep" 30 tristate "Intel Enhanced SpeedStep (deprecated)"
31 select CPU_FREQ_TABLE 31 select CPU_FREQ_TABLE
32 depends on ACPI_PROCESSOR 32 depends on ACPI_PROCESSOR
33 help 33 help
34 This is deprecated and this functionality is now merged into
35 acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
36 speedstep_centrino.
34 This adds the CPUFreq driver for Enhanced SpeedStep enabled 37 This adds the CPUFreq driver for Enhanced SpeedStep enabled
35 mobile CPUs. This means Intel Pentium M (Centrino) CPUs 38 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
36 or 64bit enabled Intel Xeons. 39 or 64bit enabled Intel Xeons.
@@ -50,6 +53,7 @@ config X86_ACPI_CPUFREQ
50 help 53 help
51 This driver adds a CPUFreq driver which utilizes the ACPI 54 This driver adds a CPUFreq driver which utilizes the ACPI
52 Processor Performance States. 55 Processor Performance States.
56 This driver also supports Intel Enhanced Speedstep.
53 57
54 For details, take a look at <file:Documentation/cpu-freq/>. 58 For details, take a look at <file:Documentation/cpu-freq/>.
55 59
diff --git a/arch/x86_64/kernel/cpufreq/Makefile b/arch/x86_64/kernel/cpufreq/Makefile
index d8b593879224..753ce1dd418e 100644
--- a/arch/x86_64/kernel/cpufreq/Makefile
+++ b/arch/x86_64/kernel/cpufreq/Makefile
@@ -5,8 +5,8 @@
5SRCDIR := ../../../i386/kernel/cpu/cpufreq 5SRCDIR := ../../../i386/kernel/cpu/cpufreq
6 6
7obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o 7obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o
8obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
9obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o 8obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o
9obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
10obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o 10obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o
11obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o 11obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o
12 12
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index d573017a5dde..71f733c4f66d 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds
6 6
7 7
8obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o semaphore.o \ 8obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o semaphore.o \
9 setup.o signal.o syscalls.o time.o traps.o vectors.o platform.o \ 9 setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \
10 pci-dma.o 10 pci-dma.o
11 11
12## windowspill.o 12## windowspill.o
diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c
index 418268f49766..fe3834bc1dbf 100644
--- a/arch/xtensa/kernel/syscall.c
+++ b/arch/xtensa/kernel/syscall.c
@@ -16,7 +16,7 @@
16 * 16 *
17 */ 17 */
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <asm/syscalls.h> 19#include <asm/syscall.h>
20#include <asm/unistd.h> 20#include <asm/unistd.h>
21#include <linux/linkage.h> 21#include <linux/linkage.h>
22#include <linux/stringify.h> 22#include <linux/stringify.h>