aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-iop32x/n2100.c11
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c37
-rw-r--r--arch/arm/mm/consistent.c1
-rw-r--r--arch/avr32/Kconfig3
-rw-r--r--arch/avr32/mach-at32ap/at32ap7000.c4
-rw-r--r--arch/avr32/mach-at32ap/hsmc.c1
-rw-r--r--arch/avr32/mach-at32ap/intc.c4
-rw-r--r--arch/cris/Kconfig19
-rw-r--r--arch/cris/arch-v10/defconfig2
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig3
-rw-r--r--arch/cris/arch-v10/drivers/axisflashmap.c8
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c15
-rw-r--r--arch/cris/arch-v10/kernel/entry.S77
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c327
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c2
-rw-r--r--arch/cris/arch-v10/kernel/irq.c59
-rw-r--r--arch/cris/arch-v10/kernel/setup.c5
-rw-r--r--arch/cris/arch-v10/kernel/time.c11
-rw-r--r--arch/cris/arch-v10/lib/memset.c82
-rw-r--r--arch/cris/arch-v10/lib/string.c54
-rw-r--r--arch/cris/arch-v10/lib/usercopy.c314
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig2
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c9
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c2
-rw-r--r--arch/cris/arch-v32/kernel/cache.c33
-rw-r--r--arch/cris/arch-v32/kernel/cacheflush.S94
-rw-r--r--arch/cris/arch-v32/kernel/io.c2
-rw-r--r--arch/cris/arch-v32/kernel/setup.c6
-rw-r--r--arch/cris/defconfig78
-rw-r--r--arch/cris/kernel/crisksyms.c17
-rw-r--r--arch/cris/kernel/irq.c6
-rw-r--r--arch/cris/kernel/process.c5
-rw-r--r--arch/cris/kernel/ptrace.c6
-rw-r--r--arch/cris/kernel/sys_cris.c1
-rw-r--r--arch/cris/kernel/time.c10
-rw-r--r--arch/ia64/kernel/efi.c6
-rw-r--r--arch/mips/Kconfig11
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/kernel/cevt-bcm1480.c6
-rw-r--r--arch/mips/kernel/cevt-sb1250.c6
-rw-r--r--arch/mips/kernel/cpu-probe.c5
-rw-r--r--arch/mips/kernel/csrc-sb1250.c2
-rw-r--r--arch/mips/kernel/genex.S2
-rw-r--r--arch/mips/kernel/irixsig.c1
-rw-r--r--arch/mips/kernel/irq-rm7000.c2
-rw-r--r--arch/mips/kernel/irq-rm9000.c2
-rw-r--r--arch/mips/kernel/irq_cpu.c2
-rw-r--r--arch/mips/kernel/proc.c2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/traps.c68
-rw-r--r--arch/mips/kernel/vpe.c14
-rw-r--r--arch/mips/lasat/interrupt.c22
-rw-r--r--arch/mips/mm/c-r4k.c7
-rw-r--r--arch/mips/mm/cerr-sb1.c6
-rw-r--r--arch/mips/mm/init.c2
-rw-r--r--arch/mips/pci/fixup-sni.c23
-rw-r--r--arch/mips/pci/pci-lasat.c32
-rw-r--r--arch/mips/pci/pci-vr41xx.c1
-rw-r--r--arch/mips/qemu/Makefile3
-rw-r--r--arch/mips/qemu/q-console.c26
-rw-r--r--arch/mips/qemu/q-firmware.c6
-rw-r--r--arch/mips/qemu/q-setup.c3
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c21
-rw-r--r--arch/mips/sni/pcimt.c2
-rw-r--r--arch/mips/vr41xx/common/icu.c2
-rw-r--r--arch/powerpc/Makefile3
-rw-r--r--arch/powerpc/kernel/btext.c4
-rw-r--r--arch/powerpc/kernel/entry_32.S6
-rw-r--r--arch/powerpc/kernel/rtas.c99
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--arch/powerpc/mm/init_64.c16
-rw-r--r--arch/powerpc/mm/stab.c1
-rw-r--r--arch/powerpc/mm/tlb_64.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/prpmc2800.c1
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig2
-rw-r--r--arch/powerpc/sysdev/cpm_common.c4
-rw-r--r--arch/ppc/kernel/entry.S6
-rw-r--r--arch/um/Makefile6
-rw-r--r--arch/um/drivers/net_kern.c14
-rw-r--r--arch/um/include/user.h13
-rw-r--r--arch/um/kernel/irq.c13
-rw-r--r--arch/um/kernel/skas/clone.c1
-rw-r--r--arch/um/os-Linux/file.c3
-rw-r--r--arch/x86/Kconfig (renamed from arch/x86/Kconfig.i386)567
-rw-r--r--arch/x86/Kconfig.cpu121
-rw-r--r--arch/x86/Kconfig.x86_64839
-rw-r--r--arch/x86/Makefile10
-rw-r--r--arch/x86/Makefile_328
-rw-r--r--arch/x86/Makefile_648
-rw-r--r--arch/x86/boot/Makefile6
-rw-r--r--arch/x86/boot/cpucheck.c6
-rw-r--r--arch/x86/kernel/Makefile_323
-rw-r--r--arch/x86/kernel/Makefile_642
-rw-r--r--arch/x86/kernel/acpi/boot.c32
-rw-r--r--arch/x86/kernel/cpu/cpufreq/Kconfig (renamed from arch/x86/kernel/cpu/cpufreq/Kconfig_32)69
-rw-r--r--arch/x86/kernel/cpu/cpufreq/Kconfig_64108
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c90
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.h20
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c20
-rw-r--r--arch/x86/kernel/cpu/proc.c8
-rw-r--r--arch/x86/kernel/reboot_fixups_32.c1
-rw-r--r--arch/x86/kernel/setup_64.c9
-rw-r--r--arch/x86/kernel/time_64.c41
-rw-r--r--arch/x86/lib/delay_32.c3
-rw-r--r--arch/x86/lib/delay_64.c11
-rw-r--r--arch/x86/mach-voyager/voyager_cat.c2
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c4
-rw-r--r--arch/x86/pci/acpi.c6
-rw-r--r--arch/x86/vdso/Makefile2
-rw-r--r--arch/x86/vdso/vgetcpu.c19
110 files changed, 1703 insertions, 2107 deletions
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index 1873bd8cd1b2..bc91d6e66bc4 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/f75375s.h>
19#include <linux/delay.h> 20#include <linux/delay.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/pci.h> 22#include <linux/pci.h>
@@ -200,11 +201,21 @@ static struct platform_device n2100_serial_device = {
200 .resource = &n2100_uart_resource, 201 .resource = &n2100_uart_resource,
201}; 202};
202 203
204static struct f75375s_platform_data n2100_f75375s = {
205 .pwm = { 255, 255 },
206 .pwm_enable = { 0, 0 },
207};
208
203static struct i2c_board_info __initdata n2100_i2c_devices[] = { 209static struct i2c_board_info __initdata n2100_i2c_devices[] = {
204 { 210 {
205 I2C_BOARD_INFO("rtc-rs5c372", 0x32), 211 I2C_BOARD_INFO("rtc-rs5c372", 0x32),
206 .type = "rs5c372b", 212 .type = "rs5c372b",
207 }, 213 },
214 {
215 I2C_BOARD_INFO("f75375", 0x2e),
216 .type = "f75375",
217 .platform_data = &n2100_f75375s,
218 },
208}; 219};
209 220
210/* 221/*
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 5da798282a54..61d9c9d69e6b 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -150,22 +150,45 @@ static void clk_pxa3xx_cken_disable(struct clk *clk)
150 local_irq_enable(); 150 local_irq_enable();
151} 151}
152 152
153static const struct clkops clk_pxa3xx_cken_ops = {
154 .enable = clk_pxa3xx_cken_enable,
155 .disable = clk_pxa3xx_cken_disable,
156};
157
153static const struct clkops clk_pxa3xx_hsio_ops = { 158static const struct clkops clk_pxa3xx_hsio_ops = {
154 .enable = clk_pxa3xx_cken_enable, 159 .enable = clk_pxa3xx_cken_enable,
155 .disable = clk_pxa3xx_cken_disable, 160 .disable = clk_pxa3xx_cken_disable,
156 .getrate = clk_pxa3xx_hsio_getrate, 161 .getrate = clk_pxa3xx_hsio_getrate,
157}; 162};
158 163
164#define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \
165 { \
166 .name = _name, \
167 .dev = _dev, \
168 .ops = &clk_pxa3xx_cken_ops, \
169 .rate = _rate, \
170 .cken = CKEN_##_cken, \
171 .delay = _delay, \
172 }
173
174#define PXA3xx_CK(_name, _cken, _ops, _dev) \
175 { \
176 .name = _name, \
177 .dev = _dev, \
178 .ops = _ops, \
179 .cken = CKEN_##_cken, \
180 }
181
159static struct clk pxa3xx_clks[] = { 182static struct clk pxa3xx_clks[] = {
160 INIT_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), 183 PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
161 INIT_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), 184 PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
162 185
163 INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), 186 PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
164 INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), 187 PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
165 INIT_CKEN("UARTCLK", STUART, 14857000, 1, NULL), 188 PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL),
166 189
167 INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), 190 PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev),
168 INIT_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), 191 PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev),
169}; 192};
170 193
171void __init pxa3xx_init_irq(void) 194void __init pxa3xx_init_irq(void)
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index cefdf2f9f26e..333a82a3717e 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -322,7 +322,6 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma,
322 322
323 if (off < kern_size && 323 if (off < kern_size &&
324 user_size <= (kern_size - off)) { 324 user_size <= (kern_size - off)) {
325 vma->vm_flags |= VM_RESERVED;
326 ret = remap_pfn_range(vma, vma->vm_start, 325 ret = remap_pfn_range(vma, vma->vm_start,
327 page_to_pfn(c->vm_pages) + off, 326 page_to_pfn(c->vm_pages) + off,
328 user_size << PAGE_SHIFT, 327 user_size << PAGE_SHIFT,
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index bbecbd8469b5..4f402c924504 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -19,9 +19,6 @@ config AVR32
19 There is an AVR32 Linux project with a web page at 19 There is an AVR32 Linux project with a web page at
20 http://avr32linux.org/. 20 http://avr32linux.org/.
21 21
22config UID16
23 bool
24
25config GENERIC_GPIO 22config GENERIC_GPIO
26 bool 23 bool
27 default y 24 default y
diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap7000.c
index a9d9ec081e3d..7c4388f4f17f 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -474,7 +474,7 @@ static struct resource at32ap700x_rtc0_resource[] = {
474static struct resource at32_wdt0_resource[] = { 474static struct resource at32_wdt0_resource[] = {
475 { 475 {
476 .start = 0xfff000b0, 476 .start = 0xfff000b0,
477 .end = 0xfff000bf, 477 .end = 0xfff000cf,
478 .flags = IORESOURCE_MEM, 478 .flags = IORESOURCE_MEM,
479 }, 479 },
480}; 480};
@@ -690,7 +690,7 @@ static struct resource atmel_usart0_resource[] = {
690 IRQ(6), 690 IRQ(6),
691}; 691};
692DEFINE_DEV_DATA(atmel_usart, 0); 692DEFINE_DEV_DATA(atmel_usart, 0);
693DEV_CLK(usart, atmel_usart0, pba, 4); 693DEV_CLK(usart, atmel_usart0, pba, 3);
694 694
695static struct atmel_uart_data atmel_usart1_data = { 695static struct atmel_uart_data atmel_usart1_data = {
696 .use_dma_tx = 1, 696 .use_dma_tx = 1,
diff --git a/arch/avr32/mach-at32ap/hsmc.c b/arch/avr32/mach-at32ap/hsmc.c
index 704607fbcc69..fa427ed42787 100644
--- a/arch/avr32/mach-at32ap/hsmc.c
+++ b/arch/avr32/mach-at32ap/hsmc.c
@@ -7,7 +7,6 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#define DEBUG
11#include <linux/clk.h> 10#include <linux/clk.h>
12#include <linux/err.h> 11#include <linux/err.h>
13#include <linux/init.h> 12#include <linux/init.h>
diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c
index dd5c009cf224..0b286cd53028 100644
--- a/arch/avr32/mach-at32ap/intc.c
+++ b/arch/avr32/mach-at32ap/intc.c
@@ -13,6 +13,7 @@
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15 15
16#include <asm/intc.h>
16#include <asm/io.h> 17#include <asm/io.h>
17 18
18#include "intc.h" 19#include "intc.h"
@@ -136,7 +137,8 @@ fail:
136 panic("Interrupt controller initialization failed!\n"); 137 panic("Interrupt controller initialization failed!\n");
137} 138}
138 139
139unsigned long intc_get_pending(int group) 140unsigned long intc_get_pending(unsigned int group)
140{ 141{
141 return intc_readl(&intc0, INTREQ0 + 4 * group); 142 return intc_readl(&intc0, INTREQ0 + 4 * group);
142} 143}
144EXPORT_SYMBOL_GPL(intc_get_pending);
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 21900a9378bb..222da1501f47 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -13,6 +13,10 @@ config ZONE_DMA
13 bool 13 bool
14 default y 14 default y
15 15
16config NO_DMA
17 bool
18 default y
19
16config RWSEM_GENERIC_SPINLOCK 20config RWSEM_GENERIC_SPINLOCK
17 bool 21 bool
18 default y 22 default y
@@ -57,6 +61,10 @@ menu "General setup"
57 61
58source "fs/Kconfig.binfmt" 62source "fs/Kconfig.binfmt"
59 63
64config GENERIC_HARDIRQS
65 bool
66 default y
67
60config ETRAX_CMDLINE 68config ETRAX_CMDLINE
61 string "Kernel command line" 69 string "Kernel command line"
62 default "root=/dev/mtdblock3" 70 default "root=/dev/mtdblock3"
@@ -149,7 +157,8 @@ source "net/Kconfig"
149 157
150# bring in ETRAX built-in drivers 158# bring in ETRAX built-in drivers
151menu "Drivers for built-in interfaces" 159menu "Drivers for built-in interfaces"
152source arch/cris/arch-v10/drivers/Kconfig 160# arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32)
161source arch/cris/arch/drivers/Kconfig
153 162
154endmenu 163endmenu
155 164
@@ -180,6 +189,10 @@ source "drivers/isdn/Kconfig"
180 189
181source "drivers/telephony/Kconfig" 190source "drivers/telephony/Kconfig"
182 191
192source "drivers/i2c/Kconfig"
193
194source "drivers/rtc/Kconfig"
195
183# 196#
184# input before char - char/joystick depends on it. As does USB. 197# input before char - char/joystick depends on it. As does USB.
185# 198#
@@ -194,6 +207,10 @@ source "fs/Kconfig"
194 207
195source "sound/Kconfig" 208source "sound/Kconfig"
196 209
210source "drivers/pcmcia/Kconfig"
211
212source "drivers/pci/Kconfig"
213
197source "drivers/usb/Kconfig" 214source "drivers/usb/Kconfig"
198 215
199source "kernel/Kconfig.instrumentation" 216source "kernel/Kconfig.instrumentation"
diff --git a/arch/cris/arch-v10/defconfig b/arch/cris/arch-v10/defconfig
index 710c20ba2be7..572f11926399 100644
--- a/arch/cris/arch-v10/defconfig
+++ b/arch/cris/arch-v10/defconfig
@@ -99,7 +99,6 @@ CONFIG_MTD=y
99CONFIG_MTD_CFI=y 99CONFIG_MTD_CFI=y
100# CONFIG_MTD_CFI_INTELEXT is not set 100# CONFIG_MTD_CFI_INTELEXT is not set
101CONFIG_MTD_CFI_AMDSTD=y 101CONFIG_MTD_CFI_AMDSTD=y
102CONFIG_MTD_AMDSTD=y
103CONFIG_MTD_CHAR=y 102CONFIG_MTD_CHAR=y
104CONFIG_MTD_BLOCK=y 103CONFIG_MTD_BLOCK=y
105CONFIG_ETRAX_I2C=y 104CONFIG_ETRAX_I2C=y
@@ -145,7 +144,6 @@ CONFIG_MTD_CFI=y
145# CONFIG_MTD_CFI_GEOMETRY is not set 144# CONFIG_MTD_CFI_GEOMETRY is not set
146# CONFIG_MTD_CFI_INTELEXT is not set 145# CONFIG_MTD_CFI_INTELEXT is not set
147CONFIG_MTD_CFI_AMDSTD=y 146CONFIG_MTD_CFI_AMDSTD=y
148CONFIG_MTD_AMDSTD=y
149# CONFIG_MTD_SHARP is not set 147# CONFIG_MTD_SHARP is not set
150# CONFIG_MTD_PHYSMAP is not set 148# CONFIG_MTD_PHYSMAP is not set
151# CONFIG_MTD_NORA is not set 149# CONFIG_MTD_NORA is not set
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 03e2e68f947d..faf8b4d3ca01 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -2,6 +2,7 @@ config ETRAX_ETHERNET
2 bool "Ethernet support" 2 bool "Ethernet support"
3 depends on ETRAX_ARCH_V10 3 depends on ETRAX_ARCH_V10
4 select NET_ETHERNET 4 select NET_ETHERNET
5 select MII
5 help 6 help
6 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 7 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
7 controller. 8 controller.
@@ -605,8 +606,6 @@ config ETRAX_AXISFLASHMAP
605 select MTD 606 select MTD
606 select MTD_CFI 607 select MTD_CFI
607 select MTD_CFI_AMDSTD 608 select MTD_CFI_AMDSTD
608 select MTD_OBSOLETE_CHIPS
609 select MTD_AMDSTD
610 select MTD_CHAR 609 select MTD_CHAR
611 select MTD_BLOCK 610 select MTD_BLOCK
612 select MTD_PARTITIONS 611 select MTD_PARTITIONS
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
index efd7b0f3a910..ea3cf2e39a14 100644
--- a/arch/cris/arch-v10/drivers/axisflashmap.c
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c
@@ -312,12 +312,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
312 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", 312 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
313 map_cs->name, map_cs->size, map_cs->map_priv_1); 313 map_cs->name, map_cs->size, map_cs->map_priv_1);
314 314
315#ifdef CONFIG_MTD_AMDSTD
316 mtd_cs = do_map_probe("amd_flash", map_cs);
317#endif
318#ifdef CONFIG_MTD_CFI 315#ifdef CONFIG_MTD_CFI
316 mtd_cs = do_map_probe("cfi_probe", map_cs);
317#endif
318#ifdef CONFIG_MTD_JEDECPROBE
319 if (!mtd_cs) { 319 if (!mtd_cs) {
320 mtd_cs = do_map_probe("cfi_probe", map_cs); 320 mtd_cs = do_map_probe("jedec_probe", map_cs);
321 } 321 }
322#endif 322#endif
323 323
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index f389ed6998fe..0d347a705835 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -297,8 +297,10 @@ gpio_poll(struct file *file,
297 data = *R_PORT_PB_DATA; 297 data = *R_PORT_PB_DATA;
298 else if (priv->minor == GPIO_MINOR_G) 298 else if (priv->minor == GPIO_MINOR_G)
299 data = *R_PORT_G_DATA; 299 data = *R_PORT_G_DATA;
300 else 300 else {
301 spin_unlock(&gpio_lock);
301 return 0; 302 return 0;
303 }
302 304
303 if ((data & priv->highalarm) || 305 if ((data & priv->highalarm) ||
304 (~data & priv->lowalarm)) { 306 (~data & priv->lowalarm)) {
@@ -381,18 +383,21 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
381 383
382 ssize_t retval = count; 384 ssize_t retval = count;
383 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) { 385 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) {
384 return -EFAULT; 386 retval = -EFAULT;
387 goto out;
385 } 388 }
386 389
387 if (!access_ok(VERIFY_READ, buf, count)) { 390 if (!access_ok(VERIFY_READ, buf, count)) {
388 return -EFAULT; 391 retval = -EFAULT;
392 goto out;
389 } 393 }
390 clk_mask = priv->clk_mask; 394 clk_mask = priv->clk_mask;
391 data_mask = priv->data_mask; 395 data_mask = priv->data_mask;
392 /* It must have been configured using the IO_CFG_WRITE_MODE */ 396 /* It must have been configured using the IO_CFG_WRITE_MODE */
393 /* Perhaps a better error code? */ 397 /* Perhaps a better error code? */
394 if (clk_mask == 0 || data_mask == 0) { 398 if (clk_mask == 0 || data_mask == 0) {
395 return -EPERM; 399 retval = -EPERM;
400 goto out;
396 } 401 }
397 write_msb = priv->write_msb; 402 write_msb = priv->write_msb;
398 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb)); 403 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb));
@@ -425,6 +430,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
425 } 430 }
426 } 431 }
427 } 432 }
433out:
428 spin_unlock(&gpio_lock); 434 spin_unlock(&gpio_lock);
429 return retval; 435 return retval;
430} 436}
@@ -506,6 +512,7 @@ gpio_release(struct inode *inode, struct file *filp)
506 while (p) { 512 while (p) {
507 if (p->highalarm | p->lowalarm) { 513 if (p->highalarm | p->lowalarm) {
508 gpio_some_alarms = 1; 514 gpio_some_alarms = 1;
515 spin_unlock(&gpio_lock);
509 return 0; 516 return 0;
510 } 517 }
511 p = p->next; 518 p = p->next;
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index c5844cb70f09..ec62c951fa3c 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -500,9 +500,8 @@ _work_notifysig:
500 ;; deal with pending signals and notify-resume requests 500 ;; deal with pending signals and notify-resume requests
501 501
502 move.d $r9, $r10 ; do_notify_resume syscall/irq param 502 move.d $r9, $r10 ; do_notify_resume syscall/irq param
503 moveq 0, $r11 ; oldset param - 0 in this case 503 move.d $sp, $r11 ; the regs param
504 move.d $sp, $r12 ; the regs param 504 move.d $r1, $r12 ; the thread_info_flags parameter
505 move.d $r1, $r13 ; the thread_info_flags parameter
506 jsr do_notify_resume 505 jsr do_notify_resume
507 506
508 ba _Rexit 507 ba _Rexit
@@ -678,13 +677,19 @@ IRQ1_interrupt:
678 push $r10 ; push orig_r10 677 push $r10 ; push orig_r10
679 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 678 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
680 679
680 ;; If there is a glitch on the NMI pin shorter than ~100ns
681 ;; (i.e. non-active by the time we get here) then the nmi_pin bit
682 ;; in R_IRQ_MASK0_RD will already be cleared. The watchdog_nmi bit
683 ;; is cleared by us however (when feeding the watchdog), which is why
684 ;; we use that bit to determine what brought us here.
685
681 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog? 686 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
682 and.d 0x80000000, $r1 687 and.d (1<<30), $r1
683 beq wdog 688 bne wdog
684 move.d $sp, $r10 689 move.d $sp, $r10
685 jsr handle_nmi 690 jsr handle_nmi
686 setf m ; Enable NMI again 691 setf m ; Enable NMI again
687 retb ; Return from NMI 692 ba _Rexit ; Return the standard way
688 nop 693 nop
689wdog: 694wdog:
690#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 695#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
@@ -775,22 +780,9 @@ multiple_interrupt:
775 push $r10 ; push orig_r10 780 push $r10 ; push orig_r10
776 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 781 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
777 782
778 moveq 2, $r2 ; first bit we care about is the timer0 irq 783 move.d $sp, $r10
779 move.d [R_VECT_MASK_RD], $r0; read the irq bits that triggered the multiple irq 784 jsr do_multiple_IRQ
780 move.d $r0, [R_VECT_MASK_CLR] ; Block all active IRQs
7811:
782 btst $r2, $r0 ; check for the irq given by bit r2
783 bpl 2f
784 move.d $r2, $r10 ; First argument to do_IRQ
785 move.d $sp, $r11 ; second argument to do_IRQ
786 jsr do_IRQ
7872:
788 addq 1, $r2 ; next vector bit
789 cmp.b 32, $r2
790 bne 1b ; process all irq's up to and including number 31
791 moveq 0, $r9 ; make ret_from_intr realise we came from an ir
792 785
793 move.d $r0, [R_VECT_MASK_SET] ; Unblock all the IRQs
794 jump ret_from_intr 786 jump ret_from_intr
795 787
796do_sigtrap: 788do_sigtrap:
@@ -837,6 +829,13 @@ _ugdb_handle_breakpoint:
837 ba do_sigtrap ; SIGTRAP the offending process. 829 ba do_sigtrap ; SIGTRAP the offending process.
838 pop $dccr ; Restore dccr in delay slot. 830 pop $dccr ; Restore dccr in delay slot.
839 831
832 .global kernel_execve
833kernel_execve:
834 move.d __NR_execve, $r9
835 break 13
836 ret
837 nop
838
840 .data 839 .data
841 840
842hw_bp_trigs: 841hw_bp_trigs:
@@ -1135,6 +1134,42 @@ sys_call_table:
1135 .long sys_add_key 1134 .long sys_add_key
1136 .long sys_request_key 1135 .long sys_request_key
1137 .long sys_keyctl 1136 .long sys_keyctl
1137 .long sys_ioprio_set
1138 .long sys_ioprio_get /* 290 */
1139 .long sys_inotify_init
1140 .long sys_inotify_add_watch
1141 .long sys_inotify_rm_watch
1142 .long sys_migrate_pages
1143 .long sys_openat /* 295 */
1144 .long sys_mkdirat
1145 .long sys_mknodat
1146 .long sys_fchownat
1147 .long sys_futimesat
1148 .long sys_fstatat64 /* 300 */
1149 .long sys_unlinkat
1150 .long sys_renameat
1151 .long sys_linkat
1152 .long sys_symlinkat
1153 .long sys_readlinkat /* 305 */
1154 .long sys_fchmodat
1155 .long sys_faccessat
1156 .long sys_pselect6
1157 .long sys_ppoll
1158 .long sys_unshare /* 310 */
1159 .long sys_set_robust_list
1160 .long sys_get_robust_list
1161 .long sys_splice
1162 .long sys_sync_file_range
1163 .long sys_tee /* 315 */
1164 .long sys_vmsplice
1165 .long sys_move_pages
1166 .long sys_getcpu
1167 .long sys_epoll_pwait
1168 .long sys_utimensat /* 320 */
1169 .long sys_signalfd
1170 .long sys_timerfd
1171 .long sys_eventfd
1172 .long sys_fallocate
1138 1173
1139 /* 1174 /*
1140 * NOTE!! This doesn't have to be exact - we just have 1175 * NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index d3ea052e5ee1..c1a3a2100ee7 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -1,97 +1,9 @@
1/* $Id: fasttimer.c,v 1.9 2005/03/04 08:16:16 starvik Exp $ 1/*
2 * linux/arch/cris/kernel/fasttimer.c 2 * linux/arch/cris/kernel/fasttimer.c
3 * 3 *
4 * Fast timers for ETRAX100/ETRAX100LX 4 * Fast timers for ETRAX100/ETRAX100LX
5 * This may be useful in other OS than Linux so use 2 space indentation...
6 * 5 *
7 * $Log: fasttimer.c,v $ 6 * Copyright (C) 2000-2007 Axis Communications AB, Lund, Sweden
8 * Revision 1.9 2005/03/04 08:16:16 starvik
9 * Merge of Linux 2.6.11.
10 *
11 * Revision 1.8 2005/01/05 06:09:29 starvik
12 * cli()/sti() will be obsolete in 2.6.11.
13 *
14 * Revision 1.7 2005/01/03 13:35:46 starvik
15 * Removed obsolete stuff.
16 * Mark fast timer IRQ as not shared.
17 *
18 * Revision 1.6 2004/05/14 10:18:39 starvik
19 * Export fast_timer_list
20 *
21 * Revision 1.5 2004/05/14 07:58:01 starvik
22 * Merge of changes from 2.4
23 *
24 * Revision 1.4 2003/07/04 08:27:41 starvik
25 * Merge of Linux 2.5.74
26 *
27 * Revision 1.3 2002/12/12 08:26:32 starvik
28 * Don't use C-comments inside CVS comments
29 *
30 * Revision 1.2 2002/12/11 15:42:02 starvik
31 * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
32 *
33 * Revision 1.1 2002/11/18 07:58:06 starvik
34 * Fast timers (from Linux 2.4)
35 *
36 * Revision 1.5 2002/10/15 06:21:39 starvik
37 * Added call to init_waitqueue_head
38 *
39 * Revision 1.4 2002/05/28 17:47:59 johana
40 * Added del_fast_timer()
41 *
42 * Revision 1.3 2002/05/28 16:16:07 johana
43 * Handle empty fast_timer_list
44 *
45 * Revision 1.2 2002/05/27 15:38:42 johana
46 * Made it compile without warnings on Linux 2.4.
47 * (includes, wait_queue, PROC_FS and snprintf)
48 *
49 * Revision 1.1 2002/05/27 15:32:25 johana
50 * arch/etrax100/kernel/fasttimer.c v1.8 from the elinux tree.
51 *
52 * Revision 1.8 2001/11/27 13:50:40 pkj
53 * Disable interrupts while stopping the timer and while modifying the
54 * list of active timers in timer1_handler() as it may be interrupted
55 * by other interrupts (e.g., the serial interrupt) which may add fast
56 * timers.
57 *
58 * Revision 1.7 2001/11/22 11:50:32 pkj
59 * * Only store information about the last 16 timers.
60 * * proc_fasttimer_read() now uses an allocated buffer, since it
61 * requires more space than just a page even for only writing the
62 * last 16 timers. The buffer is only allocated on request, so
63 * unless /proc/fasttimer is read, it is never allocated.
64 * * Renamed fast_timer_started to fast_timers_started to match
65 * fast_timers_added and fast_timers_expired.
66 * * Some clean-up.
67 *
68 * Revision 1.6 2000/12/13 14:02:08 johana
69 * Removed volatile for fast_timer_list
70 *
71 * Revision 1.5 2000/12/13 13:55:35 johana
72 * Added DEBUG_LOG, added som cli() and cleanup
73 *
74 * Revision 1.4 2000/12/05 13:48:50 johana
75 * Added range check when writing proc file, modified timer int handling
76 *
77 * Revision 1.3 2000/11/23 10:10:20 johana
78 * More debug/logging possibilities.
79 * Moved GET_JIFFIES_USEC() to timex.h and time.c
80 *
81 * Revision 1.2 2000/11/01 13:41:04 johana
82 * Clean up and bugfixes.
83 * Created new do_gettimeofday_fast() that gets a timeval struct
84 * with time based on jiffies and *R_TIMER0_DATA, uses a table
85 * for fast conversion of timer value to microseconds.
86 * (Much faster the standard do_gettimeofday() and we don't really
87 * want to use the true time - we want the "uptime" so timers don't screw up
88 * when we change the time.
89 * TODO: Add efficient support for continuous timers as well.
90 *
91 * Revision 1.1 2000/10/26 15:49:16 johana
92 * Added fasttimer, highresolution timers.
93 *
94 * Copyright (C) 2000,2001 2002 Axis Communications AB, Lund, Sweden
95 */ 7 */
96 8
97#include <linux/errno.h> 9#include <linux/errno.h>
@@ -125,7 +37,7 @@
125 37
126#ifdef FAST_TIMER_SANITY_CHECKS 38#ifdef FAST_TIMER_SANITY_CHECKS
127#define SANITYCHECK(x) x 39#define SANITYCHECK(x) x
128static int sanity_failed = 0; 40static int sanity_failed;
129#else 41#else
130#define SANITYCHECK(x) 42#define SANITYCHECK(x)
131#endif 43#endif
@@ -134,15 +46,13 @@ static int sanity_failed = 0;
134#define D2(x) 46#define D2(x)
135#define DP(x) 47#define DP(x)
136 48
137#define __INLINE__ inline 49static unsigned int fast_timer_running;
138 50static unsigned int fast_timers_added;
139static int fast_timer_running = 0; 51static unsigned int fast_timers_started;
140static int fast_timers_added = 0; 52static unsigned int fast_timers_expired;
141static int fast_timers_started = 0; 53static unsigned int fast_timers_deleted;
142static int fast_timers_expired = 0; 54static unsigned int fast_timer_is_init;
143static int fast_timers_deleted = 0; 55static unsigned int fast_timer_ints;
144static int fast_timer_is_init = 0;
145static int fast_timer_ints = 0;
146 56
147struct fast_timer *fast_timer_list = NULL; 57struct fast_timer *fast_timer_list = NULL;
148 58
@@ -150,8 +60,8 @@ struct fast_timer *fast_timer_list = NULL;
150#define DEBUG_LOG_MAX 128 60#define DEBUG_LOG_MAX 128
151static const char * debug_log_string[DEBUG_LOG_MAX]; 61static const char * debug_log_string[DEBUG_LOG_MAX];
152static unsigned long debug_log_value[DEBUG_LOG_MAX]; 62static unsigned long debug_log_value[DEBUG_LOG_MAX];
153static int debug_log_cnt = 0; 63static unsigned int debug_log_cnt;
154static int debug_log_cnt_wrapped = 0; 64static unsigned int debug_log_cnt_wrapped;
155 65
156#define DEBUG_LOG(string, value) \ 66#define DEBUG_LOG(string, value) \
157{ \ 67{ \
@@ -206,45 +116,29 @@ int timer_freq_settings[NUM_TIMER_STATS];
206int timer_delay_settings[NUM_TIMER_STATS]; 116int timer_delay_settings[NUM_TIMER_STATS];
207 117
208/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */ 118/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */
209void __INLINE__ do_gettimeofday_fast(struct timeval *tv) 119inline void do_gettimeofday_fast(struct fasttime_t *tv)
210{ 120{
211 unsigned long sec = jiffies; 121 tv->tv_jiff = jiffies;
212 unsigned long usec = GET_JIFFIES_USEC(); 122 tv->tv_usec = GET_JIFFIES_USEC();
213
214 usec += (sec % HZ) * (1000000 / HZ);
215 sec = sec / HZ;
216
217 if (usec > 1000000)
218 {
219 usec -= 1000000;
220 sec++;
221 }
222 tv->tv_sec = sec;
223 tv->tv_usec = usec;
224} 123}
225 124
226int __INLINE__ timeval_cmp(struct timeval *t0, struct timeval *t1) 125inline int fasttime_cmp(struct fasttime_t *t0, struct fasttime_t *t1)
227{ 126{
228 if (t0->tv_sec < t1->tv_sec) 127 /* Compare jiffies. Takes care of wrapping */
229 { 128 if (time_before(t0->tv_jiff, t1->tv_jiff))
230 return -1; 129 return -1;
231 } 130 else if (time_after(t0->tv_jiff, t1->tv_jiff))
232 else if (t0->tv_sec > t1->tv_sec) 131 return 1;
233 { 132
234 return 1; 133 /* Compare us */
235 } 134 if (t0->tv_usec < t1->tv_usec)
236 if (t0->tv_usec < t1->tv_usec) 135 return -1;
237 { 136 else if (t0->tv_usec > t1->tv_usec)
238 return -1; 137 return 1;
239 } 138 return 0;
240 else if (t0->tv_usec > t1->tv_usec)
241 {
242 return 1;
243 }
244 return 0;
245} 139}
246 140
247void __INLINE__ start_timer1(unsigned long delay_us) 141inline void start_timer1(unsigned long delay_us)
248{ 142{
249 int freq_index = 0; /* This is the lowest resolution */ 143 int freq_index = 0; /* This is the lowest resolution */
250 unsigned long upper_limit = MAX_DELAY_US; 144 unsigned long upper_limit = MAX_DELAY_US;
@@ -285,7 +179,7 @@ void __INLINE__ start_timer1(unsigned long delay_us)
285 timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index; 179 timer_freq_settings[fast_timers_started % NUM_TIMER_STATS] = freq_index;
286 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us; 180 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us;
287 181
288 D1(printk("start_timer1 : %d us freq: %i div: %i\n", 182 D1(printk(KERN_DEBUG "start_timer1 : %d us freq: %i div: %i\n",
289 delay_us, freq_index, div)); 183 delay_us, freq_index, div));
290 /* Clear timer1 irq */ 184 /* Clear timer1 irq */
291 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); 185 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr);
@@ -340,7 +234,7 @@ void start_one_shot_timer(struct fast_timer *t,
340 printk(KERN_WARNING 234 printk(KERN_WARNING
341 "timer name: %s data: 0x%08lX already in list!\n", name, data); 235 "timer name: %s data: 0x%08lX already in list!\n", name, data);
342 sanity_failed++; 236 sanity_failed++;
343 return; 237 goto done;
344 } 238 }
345 else 239 else
346 { 240 {
@@ -356,11 +250,11 @@ void start_one_shot_timer(struct fast_timer *t,
356 t->name = name; 250 t->name = name;
357 251
358 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000; 252 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000;
359 t->tv_expires.tv_sec = t->tv_set.tv_sec + delay_us / 1000000; 253 t->tv_expires.tv_jiff = t->tv_set.tv_jiff + delay_us / 1000000 / HZ;
360 if (t->tv_expires.tv_usec > 1000000) 254 if (t->tv_expires.tv_usec > 1000000)
361 { 255 {
362 t->tv_expires.tv_usec -= 1000000; 256 t->tv_expires.tv_usec -= 1000000;
363 t->tv_expires.tv_sec++; 257 t->tv_expires.tv_jiff += HZ;
364 } 258 }
365#ifdef FAST_TIMER_LOG 259#ifdef FAST_TIMER_LOG
366 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t; 260 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t;
@@ -368,7 +262,7 @@ void start_one_shot_timer(struct fast_timer *t,
368 fast_timers_added++; 262 fast_timers_added++;
369 263
370 /* Check if this should timeout before anything else */ 264 /* Check if this should timeout before anything else */
371 if (tmp == NULL || timeval_cmp(&t->tv_expires, &tmp->tv_expires) < 0) 265 if (tmp == NULL || fasttime_cmp(&t->tv_expires, &tmp->tv_expires) < 0)
372 { 266 {
373 /* Put first in list and modify the timer value */ 267 /* Put first in list and modify the timer value */
374 t->prev = NULL; 268 t->prev = NULL;
@@ -384,8 +278,8 @@ void start_one_shot_timer(struct fast_timer *t,
384 start_timer1(delay_us); 278 start_timer1(delay_us);
385 } else { 279 } else {
386 /* Put in correct place in list */ 280 /* Put in correct place in list */
387 while (tmp->next && 281 while (tmp->next && fasttime_cmp(&t->tv_expires,
388 timeval_cmp(&t->tv_expires, &tmp->next->tv_expires) > 0) 282 &tmp->next->tv_expires) > 0)
389 { 283 {
390 tmp = tmp->next; 284 tmp = tmp->next;
391 } 285 }
@@ -401,6 +295,7 @@ void start_one_shot_timer(struct fast_timer *t,
401 295
402 D2(printk("start_one_shot_timer: %d us done\n", delay_us)); 296 D2(printk("start_one_shot_timer: %d us done\n", delay_us));
403 297
298done:
404 local_irq_restore(flags); 299 local_irq_restore(flags);
405} /* start_one_shot_timer */ 300} /* start_one_shot_timer */
406 301
@@ -444,11 +339,18 @@ int del_fast_timer(struct fast_timer * t)
444/* Timer 1 interrupt handler */ 339/* Timer 1 interrupt handler */
445 340
446static irqreturn_t 341static irqreturn_t
447timer1_handler(int irq, void *dev_id, struct pt_regs *regs) 342timer1_handler(int irq, void *dev_id)
448{ 343{
449 struct fast_timer *t; 344 struct fast_timer *t;
450 unsigned long flags; 345 unsigned long flags;
451 346
347 /* We keep interrupts disabled not only when we modify the
348 * fast timer list, but any time we hold a reference to a
349 * timer in the list, since del_fast_timer may be called
350 * from (another) interrupt context. Thus, the only time
351 * when interrupts are enabled is when calling the timer
352 * callback function.
353 */
452 local_irq_save(flags); 354 local_irq_save(flags);
453 355
454 /* Clear timer1 irq */ 356 /* Clear timer1 irq */
@@ -466,18 +368,19 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
466 fast_timer_running = 0; 368 fast_timer_running = 0;
467 fast_timer_ints++; 369 fast_timer_ints++;
468 370
469 local_irq_restore(flags);
470
471 t = fast_timer_list; 371 t = fast_timer_list;
472 while (t) 372 while (t)
473 { 373 {
474 struct timeval tv; 374 struct fasttime_t tv;
375 fast_timer_function_type *f;
376 unsigned long d;
475 377
476 /* Has it really expired? */ 378 /* Has it really expired? */
477 do_gettimeofday_fast(&tv); 379 do_gettimeofday_fast(&tv);
478 D1(printk("t: %is %06ius\n", tv.tv_sec, tv.tv_usec)); 380 D1(printk(KERN_DEBUG "t: %is %06ius\n",
381 tv.tv_jiff, tv.tv_usec));
479 382
480 if (timeval_cmp(&t->tv_expires, &tv) <= 0) 383 if (fasttime_cmp(&t->tv_expires, &tv) <= 0)
481 { 384 {
482 /* Yes it has expired */ 385 /* Yes it has expired */
483#ifdef FAST_TIMER_LOG 386#ifdef FAST_TIMER_LOG
@@ -486,7 +389,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
486 fast_timers_expired++; 389 fast_timers_expired++;
487 390
488 /* Remove this timer before call, since it may reuse the timer */ 391 /* Remove this timer before call, since it may reuse the timer */
489 local_irq_save(flags);
490 if (t->prev) 392 if (t->prev)
491 { 393 {
492 t->prev->next = t->next; 394 t->prev->next = t->next;
@@ -501,16 +403,23 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
501 } 403 }
502 t->prev = NULL; 404 t->prev = NULL;
503 t->next = NULL; 405 t->next = NULL;
504 local_irq_restore(flags);
505 406
506 if (t->function != NULL) 407 /* Save function callback data before enabling
507 { 408 * interrupts, since the timer may be removed and
508 t->function(t->data); 409 * we don't know how it was allocated
509 } 410 * (e.g. ->function and ->data may become overwritten
510 else 411 * after deletion if the timer was stack-allocated).
511 { 412 */
413 f = t->function;
414 d = t->data;
415
416 if (f != NULL) {
417 /* Run callback with interrupts enabled. */
418 local_irq_restore(flags);
419 f(d);
420 local_irq_save(flags);
421 } else
512 DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints); 422 DEBUG_LOG("!timer1 %i function==NULL!\n", fast_timer_ints);
513 }
514 } 423 }
515 else 424 else
516 { 425 {
@@ -518,16 +427,20 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
518 D1(printk(".\n")); 427 D1(printk(".\n"));
519 } 428 }
520 429
521 local_irq_save(flags);
522 if ((t = fast_timer_list) != NULL) 430 if ((t = fast_timer_list) != NULL)
523 { 431 {
524 /* Start next timer.. */ 432 /* Start next timer.. */
525 long us; 433 long us = 0;
526 struct timeval tv; 434 struct fasttime_t tv;
527 435
528 do_gettimeofday_fast(&tv); 436 do_gettimeofday_fast(&tv);
529 us = ((t->tv_expires.tv_sec - tv.tv_sec) * 1000000 + 437
530 t->tv_expires.tv_usec - tv.tv_usec); 438 /* time_after_eq takes care of wrapping */
439 if (time_after_eq(t->tv_expires.tv_jiff, tv.tv_jiff))
440 us = ((t->tv_expires.tv_jiff - tv.tv_jiff) *
441 1000000 / HZ + t->tv_expires.tv_usec -
442 tv.tv_usec);
443
531 if (us > 0) 444 if (us > 0)
532 { 445 {
533 if (!fast_timer_running) 446 if (!fast_timer_running)
@@ -537,7 +450,6 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
537#endif 450#endif
538 start_timer1(us); 451 start_timer1(us);
539 } 452 }
540 local_irq_restore(flags);
541 break; 453 break;
542 } 454 }
543 else 455 else
@@ -548,9 +460,10 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
548 D1(printk("e! %d\n", us)); 460 D1(printk("e! %d\n", us));
549 } 461 }
550 } 462 }
551 local_irq_restore(flags);
552 } 463 }
553 464
465 local_irq_restore(flags);
466
554 if (!t) 467 if (!t)
555 { 468 {
556 D1(printk("t1 stop!\n")); 469 D1(printk("t1 stop!\n"));
@@ -575,28 +488,17 @@ static void wake_up_func(unsigned long data)
575void schedule_usleep(unsigned long us) 488void schedule_usleep(unsigned long us)
576{ 489{
577 struct fast_timer t; 490 struct fast_timer t;
578#ifdef DECLARE_WAITQUEUE
579 wait_queue_head_t sleep_wait; 491 wait_queue_head_t sleep_wait;
580 init_waitqueue_head(&sleep_wait); 492 init_waitqueue_head(&sleep_wait);
581 {
582 DECLARE_WAITQUEUE(wait, current);
583#else
584 struct wait_queue *sleep_wait = NULL;
585 struct wait_queue wait = { current, NULL };
586#endif
587 493
588 D1(printk("schedule_usleep(%d)\n", us)); 494 D1(printk("schedule_usleep(%d)\n", us));
589 add_wait_queue(&sleep_wait, &wait);
590 set_current_state(TASK_INTERRUPTIBLE);
591 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us, 495 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us,
592 "usleep"); 496 "usleep");
593 schedule(); 497 /* Uninterruptible sleep on the fast timer. (The condition is somewhat
594 set_current_state(TASK_RUNNING); 498 * redundant since the timer is what wakes us up.) */
595 remove_wait_queue(&sleep_wait, &wait); 499 wait_event(sleep_wait, !fast_timer_pending(&t));
500
596 D1(printk("done schedule_usleep(%d)\n", us)); 501 D1(printk("done schedule_usleep(%d)\n", us));
597#ifdef DECLARE_WAITQUEUE
598 }
599#endif
600} 502}
601 503
602#ifdef CONFIG_PROC_FS 504#ifdef CONFIG_PROC_FS
@@ -616,7 +518,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
616 unsigned long flags; 518 unsigned long flags;
617 int i = 0; 519 int i = 0;
618 int num_to_show; 520 int num_to_show;
619 struct timeval tv; 521 struct fasttime_t tv;
620 struct fast_timer *t, *nextt; 522 struct fast_timer *t, *nextt;
621 static char *bigbuf = NULL; 523 static char *bigbuf = NULL;
622 static unsigned long used; 524 static unsigned long used;
@@ -624,7 +526,8 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
624 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE))) 526 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE)))
625 { 527 {
626 used = 0; 528 used = 0;
627 bigbuf[0] = '\0'; 529 if (buf)
530 buf[0] = '\0';
628 return 0; 531 return 0;
629 } 532 }
630 533
@@ -646,7 +549,7 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
646 used += sprintf(bigbuf + used, "Fast timer running: %s\n", 549 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
647 fast_timer_running ? "yes" : "no"); 550 fast_timer_running ? "yes" : "no");
648 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", 551 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
649 (unsigned long)tv.tv_sec, 552 (unsigned long)tv.tv_jiff,
650 (unsigned long)tv.tv_usec); 553 (unsigned long)tv.tv_usec);
651#ifdef FAST_TIMER_SANITY_CHECKS 554#ifdef FAST_TIMER_SANITY_CHECKS
652 used += sprintf(bigbuf + used, "Sanity failed: %i\n", 555 used += sprintf(bigbuf + used, "Sanity failed: %i\n",
@@ -696,9 +599,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
696 "d: %6li us data: 0x%08lX" 599 "d: %6li us data: 0x%08lX"
697 "\n", 600 "\n",
698 t->name, 601 t->name,
699 (unsigned long)t->tv_set.tv_sec, 602 (unsigned long)t->tv_set.tv_jiff,
700 (unsigned long)t->tv_set.tv_usec, 603 (unsigned long)t->tv_set.tv_usec,
701 (unsigned long)t->tv_expires.tv_sec, 604 (unsigned long)t->tv_expires.tv_jiff,
702 (unsigned long)t->tv_expires.tv_usec, 605 (unsigned long)t->tv_expires.tv_usec,
703 t->delay_us, 606 t->delay_us,
704 t->data 607 t->data
@@ -718,9 +621,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
718 "d: %6li us data: 0x%08lX" 621 "d: %6li us data: 0x%08lX"
719 "\n", 622 "\n",
720 t->name, 623 t->name,
721 (unsigned long)t->tv_set.tv_sec, 624 (unsigned long)t->tv_set.tv_jiff,
722 (unsigned long)t->tv_set.tv_usec, 625 (unsigned long)t->tv_set.tv_usec,
723 (unsigned long)t->tv_expires.tv_sec, 626 (unsigned long)t->tv_expires.tv_jiff,
724 (unsigned long)t->tv_expires.tv_usec, 627 (unsigned long)t->tv_expires.tv_usec,
725 t->delay_us, 628 t->delay_us,
726 t->data 629 t->data
@@ -738,9 +641,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
738 "d: %6li us data: 0x%08lX" 641 "d: %6li us data: 0x%08lX"
739 "\n", 642 "\n",
740 t->name, 643 t->name,
741 (unsigned long)t->tv_set.tv_sec, 644 (unsigned long)t->tv_set.tv_jiff,
742 (unsigned long)t->tv_set.tv_usec, 645 (unsigned long)t->tv_set.tv_usec,
743 (unsigned long)t->tv_expires.tv_sec, 646 (unsigned long)t->tv_expires.tv_jiff,
744 (unsigned long)t->tv_expires.tv_usec, 647 (unsigned long)t->tv_expires.tv_usec,
745 t->delay_us, 648 t->delay_us,
746 t->data 649 t->data
@@ -761,15 +664,15 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
761/* " func: 0x%08lX" */ 664/* " func: 0x%08lX" */
762 "\n", 665 "\n",
763 t->name, 666 t->name,
764 (unsigned long)t->tv_set.tv_sec, 667 (unsigned long)t->tv_set.tv_jiff,
765 (unsigned long)t->tv_set.tv_usec, 668 (unsigned long)t->tv_set.tv_usec,
766 (unsigned long)t->tv_expires.tv_sec, 669 (unsigned long)t->tv_expires.tv_jiff,
767 (unsigned long)t->tv_expires.tv_usec, 670 (unsigned long)t->tv_expires.tv_usec,
768 t->delay_us, 671 t->delay_us,
769 t->data 672 t->data
770/* , t->function */ 673/* , t->function */
771 ); 674 );
772 local_irq_disable(); 675 local_irq_save(flags);
773 if (t->next != nextt) 676 if (t->next != nextt)
774 { 677 {
775 printk(KERN_WARNING "timer removed!\n"); 678 printk(KERN_WARNING "timer removed!\n");
@@ -798,7 +701,7 @@ static volatile int num_test_timeout = 0;
798static struct fast_timer tr[10]; 701static struct fast_timer tr[10];
799static int exp_num[10]; 702static int exp_num[10];
800 703
801static struct timeval tv_exp[100]; 704static struct fasttime_t tv_exp[100];
802 705
803static void test_timeout(unsigned long data) 706static void test_timeout(unsigned long data)
804{ 707{
@@ -836,7 +739,7 @@ static void fast_timer_test(void)
836 int prev_num; 739 int prev_num;
837 int j; 740 int j;
838 741
839 struct timeval tv, tv0, tv1, tv2; 742 struct fasttime_t tv, tv0, tv1, tv2;
840 743
841 printk("fast_timer_test() start\n"); 744 printk("fast_timer_test() start\n");
842 do_gettimeofday_fast(&tv); 745 do_gettimeofday_fast(&tv);
@@ -849,7 +752,8 @@ static void fast_timer_test(void)
849 { 752 {
850 do_gettimeofday_fast(&tv_exp[j]); 753 do_gettimeofday_fast(&tv_exp[j]);
851 } 754 }
852 printk("fast_timer_test() %is %06i\n", tv.tv_sec, tv.tv_usec); 755 printk(KERN_DEBUG "fast_timer_test() %is %06i\n",
756 tv.tv_jiff, tv.tv_usec);
853 757
854 for (j = 0; j < 1000; j++) 758 for (j = 0; j < 1000; j++)
855 { 759 {
@@ -858,12 +762,12 @@ static void fast_timer_test(void)
858 } 762 }
859 for (j = 0; j < 100; j++) 763 for (j = 0; j < 100; j++)
860 { 764 {
861 printk("%i.%i %i.%i %i.%i %i.%i %i.%i\n", 765 printk(KERN_DEBUG "%i.%i %i.%i %i.%i %i.%i %i.%i\n",
862 tv_exp[j].tv_sec,tv_exp[j].tv_usec, 766 tv_exp[j].tv_jiff, tv_exp[j].tv_usec,
863 tv_exp[j+1].tv_sec,tv_exp[j+1].tv_usec, 767 tv_exp[j+1].tv_jiff, tv_exp[j+1].tv_usec,
864 tv_exp[j+2].tv_sec,tv_exp[j+2].tv_usec, 768 tv_exp[j+2].tv_jiff, tv_exp[j+2].tv_usec,
865 tv_exp[j+3].tv_sec,tv_exp[j+3].tv_usec, 769 tv_exp[j+3].tv_jiff, tv_exp[j+3].tv_usec,
866 tv_exp[j+4].tv_sec,tv_exp[j+4].tv_usec); 770 tv_exp[j+4].tv_jiff, tv_exp[j+4].tv_usec);
867 j += 4; 771 j += 4;
868 } 772 }
869 do_gettimeofday_fast(&tv0); 773 do_gettimeofday_fast(&tv0);
@@ -895,9 +799,12 @@ static void fast_timer_test(void)
895 } 799 }
896 } 800 }
897 do_gettimeofday_fast(&tv2); 801 do_gettimeofday_fast(&tv2);
898 printk("Timers started %is %06i\n", tv0.tv_sec, tv0.tv_usec); 802 printk(KERN_DEBUG "Timers started %is %06i\n",
899 printk("Timers started at %is %06i\n", tv1.tv_sec, tv1.tv_usec); 803 tv0.tv_jiff, tv0.tv_usec);
900 printk("Timers done %is %06i\n", tv2.tv_sec, tv2.tv_usec); 804 printk(KERN_DEBUG "Timers started at %is %06i\n",
805 tv1.tv_jiff, tv1.tv_usec);
806 printk(KERN_DEBUG "Timers done %is %06i\n",
807 tv2.tv_jiff, tv2.tv_usec);
901 DP(printk("buf0:\n"); 808 DP(printk("buf0:\n");
902 printk(buf0); 809 printk(buf0);
903 printk("buf1:\n"); 810 printk("buf1:\n");
@@ -919,9 +826,9 @@ static void fast_timer_test(void)
919 printk("%-10s set: %6is %06ius exp: %6is %06ius " 826 printk("%-10s set: %6is %06ius exp: %6is %06ius "
920 "data: 0x%08X func: 0x%08X\n", 827 "data: 0x%08X func: 0x%08X\n",
921 t->name, 828 t->name,
922 t->tv_set.tv_sec, 829 t->tv_set.tv_jiff,
923 t->tv_set.tv_usec, 830 t->tv_set.tv_usec,
924 t->tv_expires.tv_sec, 831 t->tv_expires.tv_jiff,
925 t->tv_expires.tv_usec, 832 t->tv_expires.tv_usec,
926 t->data, 833 t->data,
927 t->function 834 t->function
@@ -929,10 +836,12 @@ static void fast_timer_test(void)
929 836
930 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n", 837 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n",
931 t->delay_us, 838 t->delay_us,
932 tv_exp[j].tv_sec, 839 tv_exp[j].tv_jiff,
933 tv_exp[j].tv_usec, 840 tv_exp[j].tv_usec,
934 exp_num[j], 841 exp_num[j],
935 (tv_exp[j].tv_sec - t->tv_expires.tv_sec)*1000000 + tv_exp[j].tv_usec - t->tv_expires.tv_usec); 842 (tv_exp[j].tv_jiff - t->tv_expires.tv_jiff) *
843 1000000 + tv_exp[j].tv_usec -
844 t->tv_expires.tv_usec);
936 } 845 }
937 proc_fasttimer_read(buf5, NULL, 0, 0, 0); 846 proc_fasttimer_read(buf5, NULL, 0, 0, 0);
938 printk("buf5 after all done:\n"); 847 printk("buf5 after all done:\n");
@@ -942,7 +851,7 @@ static void fast_timer_test(void)
942#endif 851#endif
943 852
944 853
945void fast_timer_init(void) 854int fast_timer_init(void)
946{ 855{
947 /* For some reason, request_irq() hangs when called froom time_init() */ 856 /* For some reason, request_irq() hangs when called froom time_init() */
948 if (!fast_timer_is_init) 857 if (!fast_timer_is_init)
@@ -975,4 +884,6 @@ void fast_timer_init(void)
975 fast_timer_test(); 884 fast_timer_test();
976#endif 885#endif
977 } 886 }
887 return 0;
978} 888}
889__initcall(fast_timer_init);
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
index 29d48ad00df9..3a9114e89edf 100644
--- a/arch/cris/arch-v10/kernel/io_interface_mux.c
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -304,7 +304,7 @@ static unsigned char clear_group_from_set(const unsigned char groups, struct if_
304static struct if_group *get_group(const unsigned char groups) 304static struct if_group *get_group(const unsigned char groups)
305{ 305{
306 int i; 306 int i;
307 for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) { 307 for (i = 0; i < ARRAY_SIZE(if_groups); i++) {
308 if (groups & if_groups[i].group) { 308 if (groups & if_groups[i].group) {
309 return &if_groups[i]; 309 return &if_groups[i];
310 } 310 }
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index 845c95f6e871..e06ab0050d37 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -12,10 +12,16 @@
12 */ 12 */
13 13
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/current.h>
15#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/interrupt.h>
16#include <linux/kernel.h> 18#include <linux/kernel.h>
17#include <linux/init.h> 19#include <linux/init.h>
18 20
21/* From kgdb.c. */
22extern void kgdb_init(void);
23extern void breakpoint(void);
24
19#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr)); 25#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
20#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr)); 26#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
21 27
@@ -75,8 +81,8 @@ BUILD_IRQ(12, 0x1000)
75BUILD_IRQ(13, 0x2000) 81BUILD_IRQ(13, 0x2000)
76void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */ 82void mmu_bus_fault(void); /* IRQ 14 is the bus fault interrupt */
77void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */ 83void multiple_interrupt(void); /* IRQ 15 is the multiple IRQ interrupt */
78BUILD_IRQ(16, 0x10000) 84BUILD_IRQ(16, 0x10000 | 0x20000) /* ethernet tx interrupt needs to block rx */
79BUILD_IRQ(17, 0x20000) 85BUILD_IRQ(17, 0x20000 | 0x10000) /* ...and vice versa */
80BUILD_IRQ(18, 0x40000) 86BUILD_IRQ(18, 0x40000)
81BUILD_IRQ(19, 0x80000) 87BUILD_IRQ(19, 0x80000)
82BUILD_IRQ(20, 0x100000) 88BUILD_IRQ(20, 0x100000)
@@ -147,6 +153,55 @@ void system_call(void); /* from entry.S */
147void do_sigtrap(void); /* from entry.S */ 153void do_sigtrap(void); /* from entry.S */
148void gdb_handle_breakpoint(void); /* from entry.S */ 154void gdb_handle_breakpoint(void); /* from entry.S */
149 155
156extern void do_IRQ(int irq, struct pt_regs * regs);
157
158/* Handle multiple IRQs */
159void do_multiple_IRQ(struct pt_regs* regs)
160{
161 int bit;
162 unsigned masked;
163 unsigned mask;
164 unsigned ethmask = 0;
165
166 /* Get interrupts to mask and handle */
167 mask = masked = *R_VECT_MASK_RD;
168
169 /* Never mask timer IRQ */
170 mask &= ~(IO_MASK(R_VECT_MASK_RD, timer0));
171
172 /*
173 * If either ethernet interrupt (rx or tx) is active then block
174 * the other one too. Unblock afterwards also.
175 */
176 if (mask &
177 (IO_STATE(R_VECT_MASK_RD, dma0, active) |
178 IO_STATE(R_VECT_MASK_RD, dma1, active))) {
179 ethmask = (IO_MASK(R_VECT_MASK_RD, dma0) |
180 IO_MASK(R_VECT_MASK_RD, dma1));
181 }
182
183 /* Block them */
184 *R_VECT_MASK_CLR = (mask | ethmask);
185
186 /* An extra irq_enter here to prevent softIRQs to run after
187 * each do_IRQ. This will decrease the interrupt latency.
188 */
189 irq_enter();
190
191 /* Handle all IRQs */
192 for (bit = 2; bit < 32; bit++) {
193 if (masked & (1 << bit)) {
194 do_IRQ(bit, regs);
195 }
196 }
197
198 /* This irq_exit() will trigger the soft IRQs. */
199 irq_exit();
200
201 /* Unblock the IRQs again */
202 *R_VECT_MASK_SET = (masked | ethmask);
203}
204
150/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and 205/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and
151 setting the irq vector table. 206 setting the irq vector table.
152*/ 207*/
diff --git a/arch/cris/arch-v10/kernel/setup.c b/arch/cris/arch-v10/kernel/setup.c
index 682ef955aec4..de27b50b72a2 100644
--- a/arch/cris/arch-v10/kernel/setup.c
+++ b/arch/cris/arch-v10/kernel/setup.c
@@ -13,6 +13,7 @@
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/param.h>
16 17
17#ifdef CONFIG_PROC_FS 18#ifdef CONFIG_PROC_FS
18#define HAS_FPU 0x0001 19#define HAS_FPU 0x0001
@@ -56,8 +57,8 @@ int show_cpuinfo(struct seq_file *m, void *v)
56 57
57 revision = rdvr(); 58 revision = rdvr();
58 59
59 if (revision >= sizeof cpu_info/sizeof *cpu_info) 60 if (revision >= ARRAY_SIZE(cpu_info))
60 info = &cpu_info[sizeof cpu_info/sizeof *cpu_info - 1]; 61 info = &cpu_info[ARRAY_SIZE(cpu_info) - 1];
61 else 62 else
62 info = &cpu_info[revision]; 63 info = &cpu_info[revision];
63 64
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 575a14bb1106..5976f6199c47 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -1,5 +1,4 @@
1/* $Id: time.c,v 1.5 2004/09/29 06:12:46 starvik Exp $ 1/*
2 *
3 * linux/arch/cris/arch-v10/kernel/time.c 2 * linux/arch/cris/arch-v10/kernel/time.c
4 * 3 *
5 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
@@ -20,6 +19,7 @@
20#include <asm/io.h> 19#include <asm/io.h>
21#include <asm/delay.h> 20#include <asm/delay.h>
22#include <asm/rtc.h> 21#include <asm/rtc.h>
22#include <asm/irq_regs.h>
23 23
24/* define this if you need to use print_timestamp */ 24/* define this if you need to use print_timestamp */
25/* it will make jiffies at 96 hz instead of 100 hz though */ 25/* it will make jiffies at 96 hz instead of 100 hz though */
@@ -201,8 +201,9 @@ static long last_rtc_update = 0;
201extern void cris_do_profile(struct pt_regs *regs); 201extern void cris_do_profile(struct pt_regs *regs);
202 202
203static inline irqreturn_t 203static inline irqreturn_t
204timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 204timer_interrupt(int irq, void *dev_id)
205{ 205{
206 struct pt_regs *regs = get_irq_regs();
206 /* acknowledge the timer irq */ 207 /* acknowledge the timer irq */
207 208
208#ifdef USE_CASCADE_TIMERS 209#ifdef USE_CASCADE_TIMERS
@@ -221,9 +222,11 @@ timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
221#endif 222#endif
222 223
223 /* reset watchdog otherwise it resets us! */ 224 /* reset watchdog otherwise it resets us! */
224
225 reset_watchdog(); 225 reset_watchdog();
226 226
227 /* Update statistics. */
228 update_process_times(user_mode(regs));
229
227 /* call the real timer interrupt handler */ 230 /* call the real timer interrupt handler */
228 231
229 do_timer(1); 232 do_timer(1);
diff --git a/arch/cris/arch-v10/lib/memset.c b/arch/cris/arch-v10/lib/memset.c
index 82bb66839171..42c1101043a3 100644
--- a/arch/cris/arch-v10/lib/memset.c
+++ b/arch/cris/arch-v10/lib/memset.c
@@ -66,7 +66,7 @@ void *memset(void *pdst,
66 66
67 { 67 {
68 register char *dst __asm__ ("r13") = pdst; 68 register char *dst __asm__ ("r13") = pdst;
69 69
70 /* This is NONPORTABLE, but since this whole routine is */ 70 /* This is NONPORTABLE, but since this whole routine is */
71 /* grossly nonportable that doesn't matter. */ 71 /* grossly nonportable that doesn't matter. */
72 72
@@ -110,52 +110,52 @@ void *memset(void *pdst,
110 If you want to check that the allocation was right; then 110 If you want to check that the allocation was right; then
111 check the equalities in the first comment. It should say 111 check the equalities in the first comment. It should say
112 "r13=r13, r12=r12, r11=r11" */ 112 "r13=r13, r12=r12, r11=r11" */
113 __asm__ volatile (" 113 __asm__ volatile ("\n\
114 ;; Check that the following is true (same register names on 114 ;; Check that the following is true (same register names on \n\
115 ;; both sides of equal sign, as in r8=r8): 115 ;; both sides of equal sign, as in r8=r8): \n\
116 ;; %0=r13, %1=r12, %4=r11 116 ;; %0=r13, %1=r12, %4=r11 \n\
117 ;; 117 ;; \n\
118 ;; Save the registers we'll clobber in the movem process 118 ;; Save the registers we'll clobber in the movem process \n\
119 ;; on the stack. Don't mention them to gcc, it will only be 119 ;; on the stack. Don't mention them to gcc, it will only be \n\
120 ;; upset. 120 ;; upset. \n\
121 subq 11*4,$sp 121 subq 11*4,$sp \n\
122 movem $r10,[$sp] 122 movem $r10,[$sp] \n\
123 123 \n\
124 move.d $r11,$r0 124 move.d $r11,$r0 \n\
125 move.d $r11,$r1 125 move.d $r11,$r1 \n\
126 move.d $r11,$r2 126 move.d $r11,$r2 \n\
127 move.d $r11,$r3 127 move.d $r11,$r3 \n\
128 move.d $r11,$r4 128 move.d $r11,$r4 \n\
129 move.d $r11,$r5 129 move.d $r11,$r5 \n\
130 move.d $r11,$r6 130 move.d $r11,$r6 \n\
131 move.d $r11,$r7 131 move.d $r11,$r7 \n\
132 move.d $r11,$r8 132 move.d $r11,$r8 \n\
133 move.d $r11,$r9 133 move.d $r11,$r9 \n\
134 move.d $r11,$r10 134 move.d $r11,$r10 \n\
135 135 \n\
136 ;; Now we've got this: 136 ;; Now we've got this: \n\
137 ;; r13 - dst 137 ;; r13 - dst \n\
138 ;; r12 - n 138 ;; r12 - n \n\
139 139 \n\
140 ;; Update n for the first loop 140 ;; Update n for the first loop \n\
141 subq 12*4,$r12 141 subq 12*4,$r12 \n\
1420: 1420: \n\
143 subq 12*4,$r12 143 subq 12*4,$r12 \n\
144 bge 0b 144 bge 0b \n\
145 movem $r11,[$r13+] 145 movem $r11,[$r13+] \n\
146 146 \n\
147 addq 12*4,$r12 ;; compensate for last loop underflowing n 147 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\
148 148 \n\
149 ;; Restore registers from stack 149 ;; Restore registers from stack \n\
150 movem [$sp+],$r10" 150 movem [$sp+],$r10"
151 151
152 /* Outputs */ : "=r" (dst), "=r" (n) 152 /* Outputs */ : "=r" (dst), "=r" (n)
153 /* Inputs */ : "0" (dst), "1" (n), "r" (lc)); 153 /* Inputs */ : "0" (dst), "1" (n), "r" (lc));
154 154
155 } 155 }
156 156
157 /* Either we directly starts copying, using dword copying 157 /* Either we directly starts copying, using dword copying
158 in a loop, or we copy as much as possible with 'movem' 158 in a loop, or we copy as much as possible with 'movem'
159 and then the last block (<44 bytes) is copied here. 159 and then the last block (<44 bytes) is copied here.
160 This will work since 'movem' will have updated src,dst,n. */ 160 This will work since 'movem' will have updated src,dst,n. */
161 161
diff --git a/arch/cris/arch-v10/lib/string.c b/arch/cris/arch-v10/lib/string.c
index 15d6662b03b1..7161a2bef4fe 100644
--- a/arch/cris/arch-v10/lib/string.c
+++ b/arch/cris/arch-v10/lib/string.c
@@ -95,33 +95,33 @@ void *memcpy(void *pdst,
95 If you want to check that the allocation was right; then 95 If you want to check that the allocation was right; then
96 check the equalities in the first comment. It should say 96 check the equalities in the first comment. It should say
97 "r13=r13, r11=r11, r12=r12" */ 97 "r13=r13, r11=r11, r12=r12" */
98 __asm__ volatile (" 98 __asm__ volatile ("\n\
99 ;; Check that the following is true (same register names on 99 ;; Check that the following is true (same register names on \n\
100 ;; both sides of equal sign, as in r8=r8): 100 ;; both sides of equal sign, as in r8=r8): \n\
101 ;; %0=r13, %1=r11, %2=r12 101 ;; %0=r13, %1=r11, %2=r12 \n\
102 ;; 102 ;; \n\
103 ;; Save the registers we'll use in the movem process 103 ;; Save the registers we'll use in the movem process \n\
104 ;; on the stack. 104 ;; on the stack. \n\
105 subq 11*4,$sp 105 subq 11*4,$sp \n\
106 movem $r10,[$sp] 106 movem $r10,[$sp] \n\
107 107 \n\
108 ;; Now we've got this: 108 ;; Now we've got this: \n\
109 ;; r11 - src 109 ;; r11 - src \n\
110 ;; r13 - dst 110 ;; r13 - dst \n\
111 ;; r12 - n 111 ;; r12 - n \n\
112 112 \n\
113 ;; Update n for the first loop 113 ;; Update n for the first loop \n\
114 subq 44,$r12 114 subq 44,$r12 \n\
1150: 1150: \n\
116 movem [$r11+],$r10 116 movem [$r11+],$r10 \n\
117 subq 44,$r12 117 subq 44,$r12 \n\
118 bge 0b 118 bge 0b \n\
119 movem $r10,[$r13+] 119 movem $r10,[$r13+] \n\
120 120 \n\
121 addq 44,$r12 ;; compensate for last loop underflowing n 121 addq 44,$r12 ;; compensate for last loop underflowing n \n\
122 122 \n\
123 ;; Restore registers from stack 123 ;; Restore registers from stack \n\
124 movem [$sp+],$r10" 124 movem [$sp+],$r10"
125 125
126 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n) 126 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n)
127 /* Inputs */ : "0" (dst), "1" (src), "2" (n)); 127 /* Inputs */ : "0" (dst), "1" (src), "2" (n));
diff --git a/arch/cris/arch-v10/lib/usercopy.c b/arch/cris/arch-v10/lib/usercopy.c
index a12c708afc9a..b8e6c0430e5b 100644
--- a/arch/cris/arch-v10/lib/usercopy.c
+++ b/arch/cris/arch-v10/lib/usercopy.c
@@ -92,58 +92,58 @@ __copy_user (void __user *pdst, const void *psrc, unsigned long pn)
92 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ 92 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
93 .err \n\ 93 .err \n\
94 .endif \n\ 94 .endif \n\
95 95 \n\
96 ;; Save the registers we'll use in the movem process 96 ;; Save the registers we'll use in the movem process \n\
97 ;; on the stack. 97 ;; on the stack. \n\
98 subq 11*4,$sp 98 subq 11*4,$sp \n\
99 movem $r10,[$sp] 99 movem $r10,[$sp] \n\
100 100 \n\
101 ;; Now we've got this: 101 ;; Now we've got this: \n\
102 ;; r11 - src 102 ;; r11 - src \n\
103 ;; r13 - dst 103 ;; r13 - dst \n\
104 ;; r12 - n 104 ;; r12 - n \n\
105 105 \n\
106 ;; Update n for the first loop 106 ;; Update n for the first loop \n\
107 subq 44,$r12 107 subq 44,$r12 \n\
108 108 \n\
109; Since the noted PC of a faulting instruction in a delay-slot of a taken 109; Since the noted PC of a faulting instruction in a delay-slot of a taken \n\
110; branch, is that of the branch target, we actually point at the from-movem 110; branch, is that of the branch target, we actually point at the from-movem \n\
111; for this case. There is no ambiguity here; if there was a fault in that 111; for this case. There is no ambiguity here; if there was a fault in that \n\
112; instruction (meaning a kernel oops), the faulted PC would be the address 112; instruction (meaning a kernel oops), the faulted PC would be the address \n\
113; after *that* movem. 113; after *that* movem. \n\
114 114 \n\
1150: 1150: \n\
116 movem [$r11+],$r10 116 movem [$r11+],$r10 \n\
117 subq 44,$r12 117 subq 44,$r12 \n\
118 bge 0b 118 bge 0b \n\
119 movem $r10,[$r13+] 119 movem $r10,[$r13+] \n\
1201: 1201: \n\
121 addq 44,$r12 ;; compensate for last loop underflowing n 121 addq 44,$r12 ;; compensate for last loop underflowing n \n\
122 122 \n\
123 ;; Restore registers from stack 123 ;; Restore registers from stack \n\
124 movem [$sp+],$r10 124 movem [$sp+],$r10 \n\
1252: 1252: \n\
126 .section .fixup,\"ax\" 126 .section .fixup,\"ax\" \n\
127 127 \n\
128; To provide a correct count in r10 of bytes that failed to be copied, 128; To provide a correct count in r10 of bytes that failed to be copied, \n\
129; we jump back into the loop if the loop-branch was taken. There is no 129; we jump back into the loop if the loop-branch was taken. There is no \n\
130; performance penalty for sany use; the program will segfault soon enough. 130; performance penalty for sany use; the program will segfault soon enough.\n\
131 131 \n\
1323: 1323: \n\
133 move.d [$sp],$r10 133 move.d [$sp],$r10 \n\
134 addq 44,$r10 134 addq 44,$r10 \n\
135 move.d $r10,[$sp] 135 move.d $r10,[$sp] \n\
136 jump 0b 136 jump 0b \n\
1374: 1374: \n\
138 movem [$sp+],$r10 138 movem [$sp+],$r10 \n\
139 addq 44,$r10 139 addq 44,$r10 \n\
140 addq 44,$r12 140 addq 44,$r12 \n\
141 jump 2b 141 jump 2b \n\
142 142 \n\
143 .previous 143 .previous \n\
144 .section __ex_table,\"a\" 144 .section __ex_table,\"a\" \n\
145 .dword 0b,3b 145 .dword 0b,3b \n\
146 .dword 1b,4b 146 .dword 1b,4b \n\
147 .previous" 147 .previous"
148 148
149 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) 149 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
@@ -253,59 +253,59 @@ __copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn)
253 If you want to check that the allocation was right; then 253 If you want to check that the allocation was right; then
254 check the equalities in the first comment. It should say 254 check the equalities in the first comment. It should say
255 "r13=r13, r11=r11, r12=r12" */ 255 "r13=r13, r11=r11, r12=r12" */
256 __asm__ volatile (" 256 __asm__ volatile ("\n\
257 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\ 257 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
258 .err \n\ 258 .err \n\
259 .endif \n\ 259 .endif \n\
260 260 \n\
261 ;; Save the registers we'll use in the movem process 261 ;; Save the registers we'll use in the movem process \n\
262 ;; on the stack. 262 ;; on the stack. \n\
263 subq 11*4,$sp 263 subq 11*4,$sp \n\
264 movem $r10,[$sp] 264 movem $r10,[$sp] \n\
265 265 \n\
266 ;; Now we've got this: 266 ;; Now we've got this: \n\
267 ;; r11 - src 267 ;; r11 - src \n\
268 ;; r13 - dst 268 ;; r13 - dst \n\
269 ;; r12 - n 269 ;; r12 - n \n\
270 270 \n\
271 ;; Update n for the first loop 271 ;; Update n for the first loop \n\
272 subq 44,$r12 272 subq 44,$r12 \n\
2730: 2730: \n\
274 movem [$r11+],$r10 274 movem [$r11+],$r10 \n\
2751: 2751: \n\
276 subq 44,$r12 276 subq 44,$r12 \n\
277 bge 0b 277 bge 0b \n\
278 movem $r10,[$r13+] 278 movem $r10,[$r13+] \n\
279 279 \n\
280 addq 44,$r12 ;; compensate for last loop underflowing n 280 addq 44,$r12 ;; compensate for last loop underflowing n \n\
281 281 \n\
282 ;; Restore registers from stack 282 ;; Restore registers from stack \n\
283 movem [$sp+],$r10 283 movem [$sp+],$r10 \n\
2844: 2844: \n\
285 .section .fixup,\"ax\" 285 .section .fixup,\"ax\" \n\
286 286 \n\
287;; Do not jump back into the loop if we fail. For some uses, we get a 287;; Do not jump back into the loop if we fail. For some uses, we get a \n\
288;; page fault somewhere on the line. Without checking for page limits, 288;; page fault somewhere on the line. Without checking for page limits, \n\
289;; we don't know where, but we need to copy accurately and keep an 289;; we don't know where, but we need to copy accurately and keep an \n\
290;; accurate count; not just clear the whole line. To do that, we fall 290;; accurate count; not just clear the whole line. To do that, we fall \n\
291;; down in the code below, proceeding with smaller amounts. It should 291;; down in the code below, proceeding with smaller amounts. It should \n\
292;; be kept in mind that we have to cater to code like what at one time 292;; be kept in mind that we have to cater to code like what at one time \n\
293;; was in fs/super.c: 293;; was in fs/super.c: \n\
294;; i = size - copy_from_user((void *)page, data, size); 294;; i = size - copy_from_user((void *)page, data, size); \n\
295;; which would cause repeated faults while clearing the remainder of 295;; which would cause repeated faults while clearing the remainder of \n\
296;; the SIZE bytes at PAGE after the first fault. 296;; the SIZE bytes at PAGE after the first fault. \n\
297;; A caveat here is that we must not fall through from a failing page 297;; A caveat here is that we must not fall through from a failing page \n\
298;; to a valid page. 298;; to a valid page. \n\
299 299 \n\
3003: 3003: \n\
301 movem [$sp+],$r10 301 movem [$sp+],$r10 \n\
302 addq 44,$r12 ;; Get back count before faulting point. 302 addq 44,$r12 ;; Get back count before faulting point. \n\
303 subq 44,$r11 ;; Get back pointer to faulting movem-line. 303 subq 44,$r11 ;; Get back pointer to faulting movem-line. \n\
304 jump 4b ;; Fall through, pretending the fault didn't happen. 304 jump 4b ;; Fall through, pretending the fault didn't happen.\n\
305 305 \n\
306 .previous 306 .previous \n\
307 .section __ex_table,\"a\" 307 .section __ex_table,\"a\" \n\
308 .dword 1b,3b 308 .dword 1b,3b \n\
309 .previous" 309 .previous"
310 310
311 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn) 311 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
@@ -425,64 +425,64 @@ __do_clear_user (void __user *pto, unsigned long pn)
425 If you want to check that the allocation was right; then 425 If you want to check that the allocation was right; then
426 check the equalities in the first comment. It should say 426 check the equalities in the first comment. It should say
427 something like "r13=r13, r11=r11, r12=r12". */ 427 something like "r13=r13, r11=r11, r12=r12". */
428 __asm__ volatile (" 428 __asm__ volatile ("\n\
429 .ifnc %0%1%2,$r13$r12$r10 \n\ 429 .ifnc %0%1%2,$r13$r12$r10 \n\
430 .err \n\ 430 .err \n\
431 .endif \n\ 431 .endif \n\
432 432 \n\
433 ;; Save the registers we'll clobber in the movem process 433 ;; Save the registers we'll clobber in the movem process \n\
434 ;; on the stack. Don't mention them to gcc, it will only be 434 ;; on the stack. Don't mention them to gcc, it will only be \n\
435 ;; upset. 435 ;; upset. \n\
436 subq 11*4,$sp 436 subq 11*4,$sp \n\
437 movem $r10,[$sp] 437 movem $r10,[$sp] \n\
438 438 \n\
439 clear.d $r0 439 clear.d $r0 \n\
440 clear.d $r1 440 clear.d $r1 \n\
441 clear.d $r2 441 clear.d $r2 \n\
442 clear.d $r3 442 clear.d $r3 \n\
443 clear.d $r4 443 clear.d $r4 \n\
444 clear.d $r5 444 clear.d $r5 \n\
445 clear.d $r6 445 clear.d $r6 \n\
446 clear.d $r7 446 clear.d $r7 \n\
447 clear.d $r8 447 clear.d $r8 \n\
448 clear.d $r9 448 clear.d $r9 \n\
449 clear.d $r10 449 clear.d $r10 \n\
450 clear.d $r11 450 clear.d $r11 \n\
451 451 \n\
452 ;; Now we've got this: 452 ;; Now we've got this: \n\
453 ;; r13 - dst 453 ;; r13 - dst \n\
454 ;; r12 - n 454 ;; r12 - n \n\
455 455 \n\
456 ;; Update n for the first loop 456 ;; Update n for the first loop \n\
457 subq 12*4,$r12 457 subq 12*4,$r12 \n\
4580: 4580: \n\
459 subq 12*4,$r12 459 subq 12*4,$r12 \n\
460 bge 0b 460 bge 0b \n\
461 movem $r11,[$r13+] 461 movem $r11,[$r13+] \n\
4621: 4621: \n\
463 addq 12*4,$r12 ;; compensate for last loop underflowing n 463 addq 12*4,$r12 ;; compensate for last loop underflowing n\n\
464 464 \n\
465 ;; Restore registers from stack 465 ;; Restore registers from stack \n\
466 movem [$sp+],$r10 466 movem [$sp+],$r10 \n\
4672: 4672: \n\
468 .section .fixup,\"ax\" 468 .section .fixup,\"ax\" \n\
4693: 4693: \n\
470 move.d [$sp],$r10 470 move.d [$sp],$r10 \n\
471 addq 12*4,$r10 471 addq 12*4,$r10 \n\
472 move.d $r10,[$sp] 472 move.d $r10,[$sp] \n\
473 clear.d $r10 473 clear.d $r10 \n\
474 jump 0b 474 jump 0b \n\
475 475 \n\
4764: 4764: \n\
477 movem [$sp+],$r10 477 movem [$sp+],$r10 \n\
478 addq 12*4,$r10 478 addq 12*4,$r10 \n\
479 addq 12*4,$r12 479 addq 12*4,$r12 \n\
480 jump 2b 480 jump 2b \n\
481 481 \n\
482 .previous 482 .previous \n\
483 .section __ex_table,\"a\" 483 .section __ex_table,\"a\" \n\
484 .dword 0b,3b 484 .dword 0b,3b \n\
485 .dword 1b,4b 485 .dword 1b,4b \n\
486 .previous" 486 .previous"
487 487
488 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn) 488 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn)
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index cc6ba5423754..7f72d7c9e1ce 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -362,8 +362,6 @@ config ETRAX_AXISFLASHMAP
362 select MTD 362 select MTD
363 select MTD_CFI 363 select MTD_CFI
364 select MTD_CFI_AMDSTD 364 select MTD_CFI_AMDSTD
365 select MTD_OBSOLETE_CHIPS
366 select MTD_AMDSTD
367 select MTD_CHAR 365 select MTD_CHAR
368 select MTD_BLOCK 366 select MTD_BLOCK
369 select MTD_PARTITIONS 367 select MTD_PARTITIONS
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
index 3ec12ea44e8e..c5ff95e18269 100644
--- a/arch/cris/arch-v32/drivers/axisflashmap.c
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -190,13 +190,12 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n", 190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
191 map_cs->name, map_cs->size, map_cs->map_priv_1); 191 map_cs->name, map_cs->size, map_cs->map_priv_1);
192 192
193#ifdef CONFIG_MTD_AMDSTD
194 mtd_cs = do_map_probe("amd_flash", map_cs);
195#endif
196#ifdef CONFIG_MTD_CFI 193#ifdef CONFIG_MTD_CFI
197 if (!mtd_cs) {
198 mtd_cs = do_map_probe("cfi_probe", map_cs); 194 mtd_cs = do_map_probe("cfi_probe", map_cs);
199 } 195#endif
196#ifdef CONFIG_MTD_JEDECPROBE
197 if (!mtd_cs)
198 mtd_cs = do_map_probe("jedec_probe", map_cs);
200#endif 199#endif
201 200
202 return mtd_cs; 201 return mtd_cs;
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index df89298aafc4..d581b0a92a3f 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -185,7 +185,7 @@ static struct sync_port ports[]=
185 } 185 }
186}; 186};
187 187
188#define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port)) 188#define NUMBER_OF_PORTS ARRAY_SIZE(ports)
189 189
190static const struct file_operations sync_serial_fops = { 190static const struct file_operations sync_serial_fops = {
191 .owner = THIS_MODULE, 191 .owner = THIS_MODULE,
diff --git a/arch/cris/arch-v32/kernel/cache.c b/arch/cris/arch-v32/kernel/cache.c
new file mode 100644
index 000000000000..80da7b88a72b
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/cache.c
@@ -0,0 +1,33 @@
1#include <linux/module.h>
2#include <asm/io.h>
3#include <asm/arch/cache.h>
4#include <asm/arch/hwregs/dma.h>
5
6/* This file is used to workaround a cache bug, Guinness TR 106. */
7
8inline void flush_dma_descr(struct dma_descr_data *descr, int flush_buf)
9{
10 /* Flush descriptor to make sure we get correct in_eop and after. */
11 asm volatile ("ftagd [%0]" :: "r" (descr));
12 /* Flush buffer pointed out by descriptor. */
13 if (flush_buf)
14 cris_flush_cache_range(phys_to_virt((unsigned)descr->buf),
15 (unsigned)(descr->after - descr->buf));
16}
17EXPORT_SYMBOL(flush_dma_descr);
18
19void flush_dma_list(struct dma_descr_data *descr)
20{
21 while (1) {
22 flush_dma_descr(descr, 1);
23 if (descr->eol)
24 break;
25 descr = phys_to_virt((unsigned)descr->next);
26 }
27}
28EXPORT_SYMBOL(flush_dma_list);
29
30/* From cacheflush.S */
31EXPORT_SYMBOL(cris_flush_cache);
32/* From cacheflush.S */
33EXPORT_SYMBOL(cris_flush_cache_range);
diff --git a/arch/cris/arch-v32/kernel/cacheflush.S b/arch/cris/arch-v32/kernel/cacheflush.S
new file mode 100644
index 000000000000..956e8fb82f01
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/cacheflush.S
@@ -0,0 +1,94 @@
1 .global cris_flush_cache_range
2cris_flush_cache_range:
3 move.d 1024, $r12
4 cmp.d $r11, $r12
5 bhi cris_flush_1KB
6 nop
7 add.d $r10, $r11
8 ftagd [$r10]
9cris_flush_last:
10 addq 32, $r10
11 cmp.d $r11, $r10
12 blt cris_flush_last
13 ftagd [$r10]
14 ret
15 nop
16cris_flush_1KB:
17 ftagd [$r10]
18 addq 32, $r10
19 ftagd [$r10]
20 addq 32, $r10
21 ftagd [$r10]
22 addq 32, $r10
23 ftagd [$r10]
24 addq 32, $r10
25 ftagd [$r10]
26 addq 32, $r10
27 ftagd [$r10]
28 addq 32, $r10
29 ftagd [$r10]
30 addq 32, $r10
31 ftagd [$r10]
32 addq 32, $r10
33 ftagd [$r10]
34 addq 32, $r10
35 ftagd [$r10]
36 addq 32, $r10
37 ftagd [$r10]
38 addq 32, $r10
39 ftagd [$r10]
40 addq 32, $r10
41 ftagd [$r10]
42 addq 32, $r10
43 ftagd [$r10]
44 addq 32, $r10
45 ftagd [$r10]
46 addq 32, $r10
47 ftagd [$r10]
48 addq 32, $r10
49 ftagd [$r10]
50 addq 32, $r10
51 ftagd [$r10]
52 addq 32, $r10
53 ftagd [$r10]
54 addq 32, $r10
55 ftagd [$r10]
56 addq 32, $r10
57 ftagd [$r10]
58 addq 32, $r10
59 ftagd [$r10]
60 addq 32, $r10
61 ftagd [$r10]
62 addq 32, $r10
63 ftagd [$r10]
64 addq 32, $r10
65 ftagd [$r10]
66 addq 32, $r10
67 ftagd [$r10]
68 addq 32, $r10
69 ftagd [$r10]
70 addq 32, $r10
71 ftagd [$r10]
72 addq 32, $r10
73 ftagd [$r10]
74 addq 32, $r10
75 ftagd [$r10]
76 addq 32, $r10
77 ftagd [$r10]
78 addq 32, $r10
79 ftagd [$r10]
80 addq 32, $r10
81 ba cris_flush_cache_range
82 sub.d $r12, $r11
83
84 .global cris_flush_cache
85cris_flush_cache:
86 moveq 0, $r10
87cris_flush_line:
88 move.d 16*1024, $r11
89 addq 16, $r10
90 cmp.d $r10, $r11
91 blt cris_flush_line
92 fidxd [$r10]
93 ret
94 nop
diff --git a/arch/cris/arch-v32/kernel/io.c b/arch/cris/arch-v32/kernel/io.c
index dfbfcb8d2585..a22a9e02e093 100644
--- a/arch/cris/arch-v32/kernel/io.c
+++ b/arch/cris/arch-v32/kernel/io.c
@@ -49,7 +49,7 @@ struct crisv32_ioport crisv32_ioports[] =
49 } 49 }
50}; 50};
51 51
52#define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport) 52#define NBR_OF_PORTS ARRAY_SIZE(crisv32_ioports)
53 53
54struct crisv32_iopin crisv32_led1_green; 54struct crisv32_iopin crisv32_led1_green;
55struct crisv32_iopin crisv32_led1_red; 55struct crisv32_iopin crisv32_led1_red;
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
index 4662f363df63..72e9e8331f63 100644
--- a/arch/cris/arch-v32/kernel/setup.c
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -54,12 +54,10 @@ show_cpuinfo(struct seq_file *m, void *v)
54{ 54{
55 int i; 55 int i;
56 int cpu = (int)v - 1; 56 int cpu = (int)v - 1;
57 int entries;
58 unsigned long revision; 57 unsigned long revision;
59 struct cpu_info *info; 58 struct cpu_info *info;
60 59
61 entries = sizeof cpinfo / sizeof(struct cpu_info); 60 info = &cpinfo[ARRAY_SIZE(cpinfo) - 1];
62 info = &cpinfo[entries - 1];
63 61
64#ifdef CONFIG_SMP 62#ifdef CONFIG_SMP
65 if (!cpu_online(cpu)) 63 if (!cpu_online(cpu))
@@ -68,7 +66,7 @@ show_cpuinfo(struct seq_file *m, void *v)
68 66
69 revision = rdvr(); 67 revision = rdvr();
70 68
71 for (i = 0; i < entries; i++) { 69 for (i = 0; i < ARRAY_SIZE(cpinfo); i++) {
72 if (cpinfo[i].rev == revision) { 70 if (cpinfo[i].rev == revision) {
73 info = &cpinfo[i]; 71 info = &cpinfo[i];
74 break; 72 break;
diff --git a/arch/cris/defconfig b/arch/cris/defconfig
index 142a10818af3..9c33ae659934 100644
--- a/arch/cris/defconfig
+++ b/arch/cris/defconfig
@@ -226,8 +226,6 @@ CONFIG_MTD_CFI_UTIL=y
226CONFIG_MTD_RAM=y 226CONFIG_MTD_RAM=y
227# CONFIG_MTD_ROM is not set 227# CONFIG_MTD_ROM is not set
228# CONFIG_MTD_ABSENT is not set 228# CONFIG_MTD_ABSENT is not set
229CONFIG_MTD_OBSOLETE_CHIPS=y
230CONFIG_MTD_AMDSTD=y
231# CONFIG_MTD_SHARP is not set 229# CONFIG_MTD_SHARP is not set
232# CONFIG_MTD_JEDEC is not set 230# CONFIG_MTD_JEDEC is not set
233 231
@@ -276,6 +274,7 @@ CONFIG_MTDRAM_ABS_POS=0x0
276# CONFIG_BLK_DEV_FD is not set 274# CONFIG_BLK_DEV_FD is not set
277# CONFIG_BLK_DEV_COW_COMMON is not set 275# CONFIG_BLK_DEV_COW_COMMON is not set
278# CONFIG_BLK_DEV_LOOP is not set 276# CONFIG_BLK_DEV_LOOP is not set
277# CONFIG_BLK_DEV_CRYPTOLOOP is not set
279# CONFIG_BLK_DEV_NBD is not set 278# CONFIG_BLK_DEV_NBD is not set
280# CONFIG_BLK_DEV_UB is not set 279# CONFIG_BLK_DEV_UB is not set
281CONFIG_BLK_DEV_RAM=y 280CONFIG_BLK_DEV_RAM=y
@@ -302,16 +301,14 @@ CONFIG_IOSCHED_CFQ=y
302# 301#
303# ATA/ATAPI/MFM/RLL support 302# ATA/ATAPI/MFM/RLL support
304# 303#
305CONFIG_IDE=y 304# CONFIG_IDE is not set
306CONFIG_BLK_DEV_IDE=y 305# CONFIG_PARIDE is not set
307 306
308# 307#
309# Please see Documentation/ide.txt for help/info on IDE drives 308# Please see Documentation/ide.txt for help/info on IDE drives
310# 309#
311# CONFIG_BLK_DEV_IDE_SATA is not set 310# CONFIG_BLK_DEV_IDE_SATA is not set
312CONFIG_BLK_DEV_IDEDISK=y
313# CONFIG_IDEDISK_MULTI_MODE is not set 311# CONFIG_IDEDISK_MULTI_MODE is not set
314CONFIG_BLK_DEV_IDECD=y
315# CONFIG_BLK_DEV_IDETAPE is not set 312# CONFIG_BLK_DEV_IDETAPE is not set
316# CONFIG_BLK_DEV_IDEFLOPPY is not set 313# CONFIG_BLK_DEV_IDEFLOPPY is not set
317# CONFIG_IDE_TASK_IOCTL is not set 314# CONFIG_IDE_TASK_IOCTL is not set
@@ -321,7 +318,6 @@ CONFIG_BLK_DEV_IDECD=y
321# 318#
322# CONFIG_IDE_GENERIC is not set 319# CONFIG_IDE_GENERIC is not set
323# CONFIG_IDE_ARM is not set 320# CONFIG_IDE_ARM is not set
324CONFIG_BLK_DEV_IDEDMA=y
325# CONFIG_IDEDMA_AUTO is not set 321# CONFIG_IDEDMA_AUTO is not set
326# CONFIG_BLK_DEV_HD is not set 322# CONFIG_BLK_DEV_HD is not set
327 323
@@ -329,6 +325,7 @@ CONFIG_BLK_DEV_IDEDMA=y
329# SCSI device support 325# SCSI device support
330# 326#
331# CONFIG_SCSI is not set 327# CONFIG_SCSI is not set
328# CONFIG_ISCSI_TCP is not set
332 329
333# 330#
334# IEEE 1394 (FireWire) support 331# IEEE 1394 (FireWire) support
@@ -414,26 +411,11 @@ CONFIG_NETFILTER=y
414# CONFIG_NET_POLL_CONTROLLER is not set 411# CONFIG_NET_POLL_CONTROLLER is not set
415# CONFIG_HAMRADIO is not set 412# CONFIG_HAMRADIO is not set
416# CONFIG_IRDA is not set 413# CONFIG_IRDA is not set
417CONFIG_BT=y 414# CONFIG_AF_RXRPC is not set
418CONFIG_BT_L2CAP=y 415# CONFIG_AF_RXRPC_DEBUG is not set
419# CONFIG_BT_SCO is not set 416# CONFIG_BT is not set
420CONFIG_BT_RFCOMM=y 417# CONFIG_I2C is not set
421# CONFIG_BT_RFCOMM_TTY is not set 418
422CONFIG_BT_BNEP=y
423# CONFIG_BT_BNEP_MC_FILTER is not set
424# CONFIG_BT_BNEP_PROTO_FILTER is not set
425# CONFIG_BT_HIDP is not set
426
427#
428# Bluetooth device drivers
429#
430CONFIG_BT_HCIUSB=y
431# CONFIG_BT_HCIUSB_SCO is not set
432# CONFIG_BT_HCIUART is not set
433# CONFIG_BT_HCIBCM203X is not set
434# CONFIG_BT_HCIBPA10X is not set
435# CONFIG_BT_HCIBFUSB is not set
436# CONFIG_BT_HCIVHCI is not set
437CONFIG_NETDEVICES=y 419CONFIG_NETDEVICES=y
438# CONFIG_DUMMY is not set 420# CONFIG_DUMMY is not set
439# CONFIG_BONDING is not set 421# CONFIG_BONDING is not set
@@ -485,31 +467,17 @@ CONFIG_NET_ETHERNET=y
485# 467#
486# Input device support 468# Input device support
487# 469#
488CONFIG_INPUT=y 470# CONFIG_INPUT is not set
489
490#
491# Userland interfaces
492#
493CONFIG_INPUT_MOUSEDEV=y
494CONFIG_INPUT_MOUSEDEV_PSAUX=y
495CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
496CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
497# CONFIG_INPUT_JOYDEV is not set
498# CONFIG_INPUT_TSDEV is not set
499# CONFIG_INPUT_EVDEV is not set
500# CONFIG_INPUT_EVBUG is not set
501 471
502# 472#
503# Input I/O drivers 473# Input I/O drivers
504# 474#
505# CONFIG_GAMEPORT is not set
506CONFIG_SOUND_GAMEPORT=y
507CONFIG_SERIO=y 475CONFIG_SERIO=y
508# CONFIG_SERIO_I8042 is not set 476# CONFIG_SERIO_I8042 is not set
509# CONFIG_SERIO_SERPORT is not set 477# CONFIG_SERIO_SERPORT is not set
510# CONFIG_SERIO_CT82C710 is not set 478# CONFIG_SERIO_LIBPS2 is not set
511CONFIG_SERIO_LIBPS2=y
512# CONFIG_SERIO_RAW is not set 479# CONFIG_SERIO_RAW is not set
480# CONFIG_GAMEPORT is not set
513 481
514# 482#
515# Input Device Drivers 483# Input Device Drivers
@@ -525,6 +493,7 @@ CONFIG_MOUSE_PS2=y
525# CONFIG_MOUSE_SERIAL is not set 493# CONFIG_MOUSE_SERIAL is not set
526# CONFIG_MOUSE_VSXXXAA is not set 494# CONFIG_MOUSE_VSXXXAA is not set
527# CONFIG_INPUT_JOYSTICK is not set 495# CONFIG_INPUT_JOYSTICK is not set
496# CONFIG_INPUT_TABLET is not set
528# CONFIG_INPUT_TOUCHSCREEN is not set 497# CONFIG_INPUT_TOUCHSCREEN is not set
529# CONFIG_INPUT_MISC is not set 498# CONFIG_INPUT_MISC is not set
530 499
@@ -542,6 +511,8 @@ CONFIG_MOUSE_PS2=y
542# 511#
543# Non-8250 serial port support 512# Non-8250 serial port support
544# 513#
514CONFIG_SERIAL_CORE=y
515CONFIG_SERIAL_CORE_CONSOLE=y
545CONFIG_UNIX98_PTYS=y 516CONFIG_UNIX98_PTYS=y
546CONFIG_LEGACY_PTYS=y 517CONFIG_LEGACY_PTYS=y
547CONFIG_LEGACY_PTY_COUNT=256 518CONFIG_LEGACY_PTY_COUNT=256
@@ -559,6 +530,8 @@ CONFIG_LEGACY_PTY_COUNT=256
559# CONFIG_GEN_RTC is not set 530# CONFIG_GEN_RTC is not set
560# CONFIG_DTLK is not set 531# CONFIG_DTLK is not set
561# CONFIG_R3964 is not set 532# CONFIG_R3964 is not set
533# CONFIG_RTC_LIB is not set
534# CONFIG_RTC_CLASS is not set
562 535
563# 536#
564# Ftape, the floppy tape device driver 537# Ftape, the floppy tape device driver
@@ -660,7 +633,9 @@ CONFIG_NFS_V3=y
660# CONFIG_NFSD is not set 633# CONFIG_NFSD is not set
661CONFIG_LOCKD=y 634CONFIG_LOCKD=y
662CONFIG_LOCKD_V4=y 635CONFIG_LOCKD_V4=y
636CONFIG_NFS_COMMON=y
663CONFIG_SUNRPC=y 637CONFIG_SUNRPC=y
638# CONFIG_SUNRPC_BIND34 is not set
664# CONFIG_RPCSEC_GSS_KRB5 is not set 639# CONFIG_RPCSEC_GSS_KRB5 is not set
665# CONFIG_RPCSEC_GSS_SPKM3 is not set 640# CONFIG_RPCSEC_GSS_SPKM3 is not set
666# CONFIG_SMB_FS is not set 641# CONFIG_SMB_FS is not set
@@ -686,9 +661,21 @@ CONFIG_MSDOS_PARTITION=y
686# CONFIG_SOUND is not set 661# CONFIG_SOUND is not set
687 662
688# 663#
664# Generic devices
665#
666# CONFIG_SND_MPU401_UART is not set
667# CONFIG_SND_DUMMY is not set
668# CONFIG_SND_VIRMIDI is not set
669# CONFIG_SND_MTPAV is not set
670# CONFIG_SND_SERIAL_U16550 is not set
671# CONFIG_SND_MPU401 is not set
672
673#
689# PCCARD (PCMCIA/CardBus) support 674# PCCARD (PCMCIA/CardBus) support
690# 675#
691# CONFIG_PCCARD is not set 676# CONFIG_PCCARD is not set
677# CONFIG_PARPORT_PC_PCMCIA is not set
678# CONFIG_NET_PCMCIA is not set
692 679
693# 680#
694# PC-card bridges 681# PC-card bridges
@@ -734,6 +721,7 @@ CONFIG_USB_DEVICEFS=y
734# USB Input Devices 721# USB Input Devices
735# 722#
736# CONFIG_USB_HID is not set 723# CONFIG_USB_HID is not set
724# HID_SUPPORT is not set
737 725
738# 726#
739# USB HID Boot Protocol drivers 727# USB HID Boot Protocol drivers
@@ -829,7 +817,7 @@ CONFIG_USB_RTL8150=y
829 817
830# 818#
831# Hardware crypto devices 819# Hardware crypto devices
832# 820# CONFIG_CRYPTO_HW is not set
833 821
834# 822#
835# Library routines 823# Library routines
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 105bb5ed48f7..62f0e752915a 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -27,6 +27,7 @@ extern void __Mod(void);
27extern void __ashldi3(void); 27extern void __ashldi3(void);
28extern void __ashrdi3(void); 28extern void __ashrdi3(void);
29extern void __lshrdi3(void); 29extern void __lshrdi3(void);
30extern void __negdi2(void);
30extern void iounmap(volatile void * __iomem); 31extern void iounmap(volatile void * __iomem);
31 32
32/* Platform dependent support */ 33/* Platform dependent support */
@@ -34,19 +35,6 @@ EXPORT_SYMBOL(kernel_thread);
34EXPORT_SYMBOL(get_cmos_time); 35EXPORT_SYMBOL(get_cmos_time);
35EXPORT_SYMBOL(loops_per_usec); 36EXPORT_SYMBOL(loops_per_usec);
36 37
37/* String functions */
38EXPORT_SYMBOL(memcmp);
39EXPORT_SYMBOL(memmove);
40EXPORT_SYMBOL(strstr);
41EXPORT_SYMBOL(strcpy);
42EXPORT_SYMBOL(strchr);
43EXPORT_SYMBOL(strcmp);
44EXPORT_SYMBOL(strlen);
45EXPORT_SYMBOL(strcat);
46EXPORT_SYMBOL(strncat);
47EXPORT_SYMBOL(strncmp);
48EXPORT_SYMBOL(strncpy);
49
50/* Math functions */ 38/* Math functions */
51EXPORT_SYMBOL(__Udiv); 39EXPORT_SYMBOL(__Udiv);
52EXPORT_SYMBOL(__Umod); 40EXPORT_SYMBOL(__Umod);
@@ -55,6 +43,7 @@ EXPORT_SYMBOL(__Mod);
55EXPORT_SYMBOL(__ashldi3); 43EXPORT_SYMBOL(__ashldi3);
56EXPORT_SYMBOL(__ashrdi3); 44EXPORT_SYMBOL(__ashrdi3);
57EXPORT_SYMBOL(__lshrdi3); 45EXPORT_SYMBOL(__lshrdi3);
46EXPORT_SYMBOL(__negdi2);
58 47
59/* Memory functions */ 48/* Memory functions */
60EXPORT_SYMBOL(__ioremap); 49EXPORT_SYMBOL(__ioremap);
@@ -84,4 +73,4 @@ EXPORT_SYMBOL(start_one_shot_timer);
84EXPORT_SYMBOL(del_fast_timer); 73EXPORT_SYMBOL(del_fast_timer);
85EXPORT_SYMBOL(schedule_usleep); 74EXPORT_SYMBOL(schedule_usleep);
86#endif 75#endif
87 76EXPORT_SYMBOL(csum_partial);
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 5c27ff86121b..2dfac8c79090 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * linux/arch/cris/kernel/irq.c 3 * linux/arch/cris/kernel/irq.c
4 * 4 *
5 * Copyright (c) 2000,2001 Axis Communications AB 5 * Copyright (c) 2000,2007 Axis Communications AB
6 * 6 *
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
@@ -92,14 +92,16 @@ skip:
92asmlinkage void do_IRQ(int irq, struct pt_regs * regs) 92asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
93{ 93{
94 unsigned long sp; 94 unsigned long sp;
95 struct pt_regs *old_regs = set_irq_regs(regs);
95 irq_enter(); 96 irq_enter();
96 sp = rdsp(); 97 sp = rdsp();
97 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) { 98 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
98 printk("do_IRQ: stack overflow: %lX\n", sp); 99 printk("do_IRQ: stack overflow: %lX\n", sp);
99 show_stack(NULL, (unsigned long *)sp); 100 show_stack(NULL, (unsigned long *)sp);
100 } 101 }
101 __do_IRQ(irq, regs); 102 __do_IRQ(irq);
102 irq_exit(); 103 irq_exit();
104 set_irq_regs(old_regs);
103} 105}
104 106
105void weird_irq(void) 107void weird_irq(void)
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 123451c44154..9ca558fc5bc8 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -195,6 +195,11 @@ EXPORT_SYMBOL(enable_hlt);
195 */ 195 */
196void (*pm_idle)(void); 196void (*pm_idle)(void);
197 197
198extern void default_idle(void);
199
200void (*pm_power_off)(void);
201EXPORT_SYMBOL(pm_power_off);
202
198/* 203/*
199 * The idle thread. There's no useful work to be 204 * The idle thread. There's no useful work to be
200 * done, so just try to conserve power and have a 205 * done, so just try to conserve power and have a
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index 1085d037027b..3ccd20e85dce 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -81,13 +81,13 @@
81/* notification of userspace execution resumption 81/* notification of userspace execution resumption
82 * - triggered by current->work.notify_resume 82 * - triggered by current->work.notify_resume
83 */ 83 */
84extern int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs); 84extern int do_signal(int canrestart, struct pt_regs *regs);
85 85
86 86
87void do_notify_resume(int canrestart, sigset_t *oldset, struct pt_regs *regs, 87void do_notify_resume(int canrestart, struct pt_regs *regs,
88 __u32 thread_info_flags ) 88 __u32 thread_info_flags )
89{ 89{
90 /* deal with pending signal delivery */ 90 /* deal with pending signal delivery */
91 if (thread_info_flags & _TIF_SIGPENDING) 91 if (thread_info_flags & _TIF_SIGPENDING)
92 do_signal(canrestart,oldset,regs); 92 do_signal(canrestart,regs);
93} 93}
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 514359b8122e..8b9984197edc 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -13,6 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/syscalls.h> 14#include <linux/syscalls.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/fs.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
17#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
18#include <linux/sem.h> 19#include <linux/sem.h>
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index acfd04559405..7a2cc7efbcf8 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -171,10 +171,6 @@ get_cmos_time(void)
171 mon = CMOS_READ(RTC_MONTH); 171 mon = CMOS_READ(RTC_MONTH);
172 year = CMOS_READ(RTC_YEAR); 172 year = CMOS_READ(RTC_YEAR);
173 173
174 printk(KERN_DEBUG
175 "rtc: sec 0x%x min 0x%x hour 0x%x day 0x%x mon 0x%x year 0x%x\n",
176 sec, min, hour, day, mon, year);
177
178 BCD_TO_BIN(sec); 174 BCD_TO_BIN(sec);
179 BCD_TO_BIN(min); 175 BCD_TO_BIN(min);
180 BCD_TO_BIN(hour); 176 BCD_TO_BIN(hour);
@@ -207,12 +203,12 @@ void
207cris_do_profile(struct pt_regs* regs) 203cris_do_profile(struct pt_regs* regs)
208{ 204{
209 205
210#if CONFIG_SYSTEM_PROFILER 206#ifdef CONFIG_SYSTEM_PROFILER
211 cris_profile_sample(regs); 207 cris_profile_sample(regs);
212#endif 208#endif
213 209
214#if CONFIG_PROFILING 210#ifdef CONFIG_PROFILING
215 profile_tick(CPU_PROFILING, regs); 211 profile_tick(CPU_PROFILING);
216#endif 212#endif
217} 213}
218 214
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 5181bf551f3c..8e8f8b6193ee 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1113,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1113 if (md->num_pages == 0) /* should not happen */ 1113 if (md->num_pages == 0) /* should not happen */
1114 continue; 1114 continue;
1115 1115
1116 flags = IORESOURCE_MEM; 1116 flags = IORESOURCE_MEM | IORESOURCE_BUSY;
1117 switch (md->type) { 1117 switch (md->type) {
1118 1118
1119 case EFI_MEMORY_MAPPED_IO: 1119 case EFI_MEMORY_MAPPED_IO:
@@ -1135,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1135 1135
1136 case EFI_ACPI_MEMORY_NVS: 1136 case EFI_ACPI_MEMORY_NVS:
1137 name = "ACPI Non-volatile Storage"; 1137 name = "ACPI Non-volatile Storage";
1138 flags |= IORESOURCE_BUSY;
1139 break; 1138 break;
1140 1139
1141 case EFI_UNUSABLE_MEMORY: 1140 case EFI_UNUSABLE_MEMORY:
1142 name = "reserved"; 1141 name = "reserved";
1143 flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED; 1142 flags |= IORESOURCE_DISABLED;
1144 break; 1143 break;
1145 1144
1146 case EFI_RESERVED_TYPE: 1145 case EFI_RESERVED_TYPE:
@@ -1149,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1149 case EFI_ACPI_RECLAIM_MEMORY: 1148 case EFI_ACPI_RECLAIM_MEMORY:
1150 default: 1149 default:
1151 name = "reserved"; 1150 name = "reserved";
1152 flags |= IORESOURCE_BUSY;
1153 break; 1151 break;
1154 } 1152 }
1155 1153
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2c7d6c240b73..2f2ce0c28bc0 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -361,10 +361,10 @@ config QEMU
361 select PCSPEAKER 361 select PCSPEAKER
362 select SWAP_IO_SPACE 362 select SWAP_IO_SPACE
363 select SYS_HAS_CPU_MIPS32_R1 363 select SYS_HAS_CPU_MIPS32_R1
364 select SYS_HAS_EARLY_PRINTK
364 select SYS_SUPPORTS_32BIT_KERNEL 365 select SYS_SUPPORTS_32BIT_KERNEL
365 select SYS_SUPPORTS_BIG_ENDIAN 366 select SYS_SUPPORTS_BIG_ENDIAN
366 select SYS_SUPPORTS_LITTLE_ENDIAN 367 select SYS_SUPPORTS_LITTLE_ENDIAN
367 select ARCH_SPARSEMEM_ENABLE
368 select GENERIC_HARDIRQS_NO__DO_IRQ 368 select GENERIC_HARDIRQS_NO__DO_IRQ
369 select NR_CPUS_DEFAULT_1 369 select NR_CPUS_DEFAULT_1
370 select SYS_SUPPORTS_SMP 370 select SYS_SUPPORTS_SMP
@@ -1409,7 +1409,6 @@ config MIPS_MT_SMP
1409 depends on SYS_SUPPORTS_MULTITHREADING 1409 depends on SYS_SUPPORTS_MULTITHREADING
1410 select CPU_MIPSR2_IRQ_VI 1410 select CPU_MIPSR2_IRQ_VI
1411 select CPU_MIPSR2_IRQ_EI 1411 select CPU_MIPSR2_IRQ_EI
1412 select CPU_MIPSR2_SRS
1413 select MIPS_MT 1412 select MIPS_MT
1414 select NR_CPUS_DEFAULT_2 1413 select NR_CPUS_DEFAULT_2
1415 select SMP 1414 select SMP
@@ -1426,7 +1425,6 @@ config MIPS_MT_SMTC
1426 select GENERIC_CLOCKEVENTS_BROADCAST 1425 select GENERIC_CLOCKEVENTS_BROADCAST
1427 select CPU_MIPSR2_IRQ_VI 1426 select CPU_MIPSR2_IRQ_VI
1428 select CPU_MIPSR2_IRQ_EI 1427 select CPU_MIPSR2_IRQ_EI
1429 select CPU_MIPSR2_SRS
1430 select MIPS_MT 1428 select MIPS_MT
1431 select NR_CPUS_DEFAULT_8 1429 select NR_CPUS_DEFAULT_8
1432 select SMP 1430 select SMP
@@ -1453,7 +1451,6 @@ config MIPS_VPE_LOADER
1453 depends on SYS_SUPPORTS_MULTITHREADING 1451 depends on SYS_SUPPORTS_MULTITHREADING
1454 select CPU_MIPSR2_IRQ_VI 1452 select CPU_MIPSR2_IRQ_VI
1455 select CPU_MIPSR2_IRQ_EI 1453 select CPU_MIPSR2_IRQ_EI
1456 select CPU_MIPSR2_SRS
1457 select MIPS_MT 1454 select MIPS_MT
1458 help 1455 help
1459 Includes a loader for loading an elf relocatable object 1456 Includes a loader for loading an elf relocatable object
@@ -1582,12 +1579,6 @@ config CPU_MIPSR2_IRQ_VI
1582config CPU_MIPSR2_IRQ_EI 1579config CPU_MIPSR2_IRQ_EI
1583 bool 1580 bool
1584 1581
1585#
1586# Shadow registers are an R2 feature
1587#
1588config CPU_MIPSR2_SRS
1589 bool
1590
1591config CPU_HAS_SYNC 1582config CPU_HAS_SYNC
1592 bool 1583 bool
1593 depends on !CPU_R3000 1584 depends on !CPU_R3000
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 23c17755eca0..a1f8d8b96b03 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -44,7 +44,7 @@ endif
44 44
45ifneq ($(SUBARCH),$(ARCH)) 45ifneq ($(SUBARCH),$(ARCH))
46 ifeq ($(CROSS_COMPILE),) 46 ifeq ($(CROSS_COMPILE),)
47 CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-gnu-linux- $(tool-archpref)-unknown-gnu-linux-) 47 CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)
48 endif 48 endif
49endif 49endif
50 50
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
index 21e6d63eb4d1..0a57f86945f1 100644
--- a/arch/mips/kernel/cevt-bcm1480.c
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -75,6 +75,7 @@ static int sibyte_next_event(unsigned long delta, struct clock_event_device *cd)
75 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); 75 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
76 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)); 76 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
77 77
78 __raw_writeq(0, cfg);
78 __raw_writeq(delta - 1, init); 79 __raw_writeq(delta - 1, init);
79 __raw_writeq(M_SCD_TIMER_ENABLE, cfg); 80 __raw_writeq(M_SCD_TIMER_ENABLE, cfg);
80 81
@@ -122,7 +123,7 @@ void __cpuinit sb1480_clockevent_init(void)
122 CLOCK_EVT_FEAT_ONESHOT; 123 CLOCK_EVT_FEAT_ONESHOT;
123 clockevent_set_clock(cd, V_SCD_TIMER_FREQ); 124 clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
124 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd); 125 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
125 cd->min_delta_ns = clockevent_delta2ns(1, cd); 126 cd->min_delta_ns = clockevent_delta2ns(2, cd);
126 cd->rating = 200; 127 cd->rating = 200;
127 cd->irq = irq; 128 cd->irq = irq;
128 cd->cpumask = cpumask_of_cpu(cpu); 129 cd->cpumask = cpumask_of_cpu(cpu);
@@ -143,7 +144,10 @@ void __cpuinit sb1480_clockevent_init(void)
143 144
144 action->handler = sibyte_counter_handler; 145 action->handler = sibyte_counter_handler;
145 action->flags = IRQF_DISABLED | IRQF_PERCPU; 146 action->flags = IRQF_DISABLED | IRQF_PERCPU;
147 action->mask = cpumask_of_cpu(cpu);
146 action->name = name; 148 action->name = name;
147 action->dev_id = cd; 149 action->dev_id = cd;
150
151 irq_set_affinity(irq, cpumask_of_cpu(cpu));
148 setup_irq(irq, action); 152 setup_irq(irq, action);
149} 153}
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
index e2029d0fc39b..63ac3ad462bc 100644
--- a/arch/mips/kernel/cevt-sb1250.c
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -73,6 +73,7 @@ static int sibyte_next_event(unsigned long delta, struct clock_event_device *cd)
73 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)); 73 cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
74 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT)); 74 init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
75 75
76 __raw_writeq(0, cfg);
76 __raw_writeq(delta - 1, init); 77 __raw_writeq(delta - 1, init);
77 __raw_writeq(M_SCD_TIMER_ENABLE, cfg); 78 __raw_writeq(M_SCD_TIMER_ENABLE, cfg);
78 79
@@ -121,7 +122,7 @@ void __cpuinit sb1250_clockevent_init(void)
121 CLOCK_EVT_FEAT_ONESHOT; 122 CLOCK_EVT_FEAT_ONESHOT;
122 clockevent_set_clock(cd, V_SCD_TIMER_FREQ); 123 clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
123 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd); 124 cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
124 cd->min_delta_ns = clockevent_delta2ns(1, cd); 125 cd->min_delta_ns = clockevent_delta2ns(2, cd);
125 cd->rating = 200; 126 cd->rating = 200;
126 cd->irq = irq; 127 cd->irq = irq;
127 cd->cpumask = cpumask_of_cpu(cpu); 128 cd->cpumask = cpumask_of_cpu(cpu);
@@ -142,7 +143,10 @@ void __cpuinit sb1250_clockevent_init(void)
142 143
143 action->handler = sibyte_counter_handler; 144 action->handler = sibyte_counter_handler;
144 action->flags = IRQF_DISABLED | IRQF_PERCPU; 145 action->flags = IRQF_DISABLED | IRQF_PERCPU;
146 action->mask = cpumask_of_cpu(cpu);
145 action->name = name; 147 action->name = name;
146 action->dev_id = cd; 148 action->dev_id = cd;
149
150 irq_set_affinity(irq, cpumask_of_cpu(cpu));
147 setup_irq(irq, action); 151 setup_irq(irq, action);
148} 152}
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index c8c47a2d1972..5c2794391bf5 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -943,6 +943,11 @@ __init void cpu_probe(void)
943 } 943 }
944 944
945 __cpu_name[cpu] = cpu_to_name(c); 945 __cpu_name[cpu] = cpu_to_name(c);
946
947 if (cpu_has_mips_r2)
948 c->srsets = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
949 else
950 c->srsets = 1;
946} 951}
947 952
948__init void cpu_report(void) 953__init void cpu_report(void)
diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
index ebb16e668877..92212bbb8e45 100644
--- a/arch/mips/kernel/csrc-sb1250.c
+++ b/arch/mips/kernel/csrc-sb1250.c
@@ -43,7 +43,7 @@ static cycle_t sb1250_hpt_read(void)
43} 43}
44 44
45struct clocksource bcm1250_clocksource = { 45struct clocksource bcm1250_clocksource = {
46 .name = "MIPS", 46 .name = "bcm1250-counter-3",
47 .rating = 200, 47 .rating = 200,
48 .read = sb1250_hpt_read, 48 .read = sb1250_hpt_read,
49 .mask = CLOCKSOURCE_MASK(23), 49 .mask = CLOCKSOURCE_MASK(23),
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index c0f19d638b98..e76a76bf0b3d 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -146,7 +146,7 @@ NESTED(handle_int, PT_SIZE, sp)
146 and k0, ST0_IEP 146 and k0, ST0_IEP
147 bnez k0, 1f 147 bnez k0, 1f
148 148
149 mfc0 k0, EP0_EPC 149 mfc0 k0, CP0_EPC
150 .set noreorder 150 .set noreorder
151 j k0 151 j k0
152 rfe 152 rfe
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 33506ff25910..5b10ac133ec8 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -430,6 +430,7 @@ asmlinkage int irix_sigprocmask(int how, irix_sigset_t __user *new,
430 break; 430 break;
431 431
432 default: 432 default:
433 spin_unlock_irq(&current->sighand->siglock);
433 return -EINVAL; 434 return -EINVAL;
434 } 435 }
435 recalc_sigpending(); 436 recalc_sigpending();
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index 250732883488..971adf6ef4f4 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -44,5 +44,5 @@ void __init rm7k_cpu_irq_init(void)
44 44
45 for (i = base; i < base + 4; i++) 45 for (i = base; i < base + 4; i++)
46 set_irq_chip_and_handler(i, &rm7k_irq_controller, 46 set_irq_chip_and_handler(i, &rm7k_irq_controller,
47 handle_level_irq); 47 handle_percpu_irq);
48} 48}
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index ae83d2df6f31..7b04583bd800 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -104,5 +104,5 @@ void __init rm9k_cpu_irq_init(void)
104 104
105 rm9000_perfcount_irq = base + 1; 105 rm9000_perfcount_irq = base + 1;
106 set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq, 106 set_irq_chip_and_handler(rm9000_perfcount_irq, &rm9k_perfcounter_irq,
107 handle_level_irq); 107 handle_percpu_irq);
108} 108}
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 7b66e03b5899..0ee2567b780d 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -116,5 +116,5 @@ void __init mips_cpu_irq_init(void)
116 116
117 for (i = irq_base + 2; i < irq_base + 8; i++) 117 for (i = irq_base + 2; i < irq_base + 8; i++)
118 set_irq_chip_and_handler(i, &mips_cpu_irq_controller, 118 set_irq_chip_and_handler(i, &mips_cpu_irq_controller,
119 handle_level_irq); 119 handle_percpu_irq);
120} 120}
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index efd2d1314123..6e6e947cce1e 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -60,6 +60,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
60 cpu_has_dsp ? " dsp" : "", 60 cpu_has_dsp ? " dsp" : "",
61 cpu_has_mipsmt ? " mt" : "" 61 cpu_has_mipsmt ? " mt" : ""
62 ); 62 );
63 seq_printf(m, "shadow register sets\t: %d\n",
64 cpu_data[n].srsets);
63 65
64 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", 66 sprintf(fmt, "VCE%%c exceptions\t\t: %s\n",
65 cpu_has_vce ? "%u" : "not available"); 67 cpu_has_vce ? "%u" : "not available");
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 118be24224f2..01993ec3368b 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -293,7 +293,7 @@ EXPORT(sysn32_call_table)
293 PTR sys_ni_syscall /* 6170, was get_kernel_syms */ 293 PTR sys_ni_syscall /* 6170, was get_kernel_syms */
294 PTR sys_ni_syscall /* was query_module */ 294 PTR sys_ni_syscall /* was query_module */
295 PTR sys_quotactl 295 PTR sys_quotactl
296 PTR sys_nfsservctl 296 PTR compat_sys_nfsservctl
297 PTR sys_ni_syscall /* res. for getpmsg */ 297 PTR sys_ni_syscall /* res. for getpmsg */
298 PTR sys_ni_syscall /* 6175 for putpmsg */ 298 PTR sys_ni_syscall /* 6175 for putpmsg */
299 PTR sys_ni_syscall /* res. for afs_syscall */ 299 PTR sys_ni_syscall /* res. for afs_syscall */
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index fa500787152d..23e73d0650a3 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1100,59 +1100,6 @@ void *set_except_vector(int n, void *addr)
1100 return (void *)old_handler; 1100 return (void *)old_handler;
1101} 1101}
1102 1102
1103#ifdef CONFIG_CPU_MIPSR2_SRS
1104/*
1105 * MIPSR2 shadow register set allocation
1106 * FIXME: SMP...
1107 */
1108
1109static struct shadow_registers {
1110 /*
1111 * Number of shadow register sets supported
1112 */
1113 unsigned long sr_supported;
1114 /*
1115 * Bitmap of allocated shadow registers
1116 */
1117 unsigned long sr_allocated;
1118} shadow_registers;
1119
1120static void mips_srs_init(void)
1121{
1122 shadow_registers.sr_supported = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
1123 printk(KERN_INFO "%ld MIPSR2 register sets available\n",
1124 shadow_registers.sr_supported);
1125 shadow_registers.sr_allocated = 1; /* Set 0 used by kernel */
1126}
1127
1128int mips_srs_max(void)
1129{
1130 return shadow_registers.sr_supported;
1131}
1132
1133int mips_srs_alloc(void)
1134{
1135 struct shadow_registers *sr = &shadow_registers;
1136 int set;
1137
1138again:
1139 set = find_first_zero_bit(&sr->sr_allocated, sr->sr_supported);
1140 if (set >= sr->sr_supported)
1141 return -1;
1142
1143 if (test_and_set_bit(set, &sr->sr_allocated))
1144 goto again;
1145
1146 return set;
1147}
1148
1149void mips_srs_free(int set)
1150{
1151 struct shadow_registers *sr = &shadow_registers;
1152
1153 clear_bit(set, &sr->sr_allocated);
1154}
1155
1156static asmlinkage void do_default_vi(void) 1103static asmlinkage void do_default_vi(void)
1157{ 1104{
1158 show_regs(get_irq_regs()); 1105 show_regs(get_irq_regs());
@@ -1163,6 +1110,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1163{ 1110{
1164 unsigned long handler; 1111 unsigned long handler;
1165 unsigned long old_handler = vi_handlers[n]; 1112 unsigned long old_handler = vi_handlers[n];
1113 int srssets = current_cpu_data.srsets;
1166 u32 *w; 1114 u32 *w;
1167 unsigned char *b; 1115 unsigned char *b;
1168 1116
@@ -1178,7 +1126,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1178 1126
1179 b = (unsigned char *)(ebase + 0x200 + n*VECTORSPACING); 1127 b = (unsigned char *)(ebase + 0x200 + n*VECTORSPACING);
1180 1128
1181 if (srs >= mips_srs_max()) 1129 if (srs >= srssets)
1182 panic("Shadow register set %d not supported", srs); 1130 panic("Shadow register set %d not supported", srs);
1183 1131
1184 if (cpu_has_veic) { 1132 if (cpu_has_veic) {
@@ -1186,7 +1134,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1186 board_bind_eic_interrupt(n, srs); 1134 board_bind_eic_interrupt(n, srs);
1187 } else if (cpu_has_vint) { 1135 } else if (cpu_has_vint) {
1188 /* SRSMap is only defined if shadow sets are implemented */ 1136 /* SRSMap is only defined if shadow sets are implemented */
1189 if (mips_srs_max() > 1) 1137 if (srssets > 1)
1190 change_c0_srsmap(0xf << n*4, srs << n*4); 1138 change_c0_srsmap(0xf << n*4, srs << n*4);
1191 } 1139 }
1192 1140
@@ -1253,14 +1201,6 @@ void *set_vi_handler(int n, vi_handler_t addr)
1253 return set_vi_srs_handler(n, addr, 0); 1201 return set_vi_srs_handler(n, addr, 0);
1254} 1202}
1255 1203
1256#else
1257
1258static inline void mips_srs_init(void)
1259{
1260}
1261
1262#endif /* CONFIG_CPU_MIPSR2_SRS */
1263
1264/* 1204/*
1265 * This is used by native signal handling 1205 * This is used by native signal handling
1266 */ 1206 */
@@ -1503,8 +1443,6 @@ void __init trap_init(void)
1503 else 1443 else
1504 ebase = CAC_BASE; 1444 ebase = CAC_BASE;
1505 1445
1506 mips_srs_init();
1507
1508 per_cpu_trap_init(); 1446 per_cpu_trap_init();
1509 1447
1510 /* 1448 /*
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 436a64ff3989..38bd33fa2a23 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -1003,6 +1003,7 @@ static void cleanup_tc(struct tc *tc)
1003 write_tc_c0_tcstatus(tmp); 1003 write_tc_c0_tcstatus(tmp);
1004 1004
1005 write_tc_c0_tchalt(TCHALT_H); 1005 write_tc_c0_tchalt(TCHALT_H);
1006 mips_ihb();
1006 1007
1007 /* bind it to anything other than VPE1 */ 1008 /* bind it to anything other than VPE1 */
1008// write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE 1009// write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE
@@ -1235,9 +1236,12 @@ int vpe_free(vpe_handle vpe)
1235 settc(t->index); 1236 settc(t->index);
1236 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA); 1237 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~VPECONF0_VPA);
1237 1238
1238 /* mark the TC unallocated and halt'ed */ 1239 /* halt the TC */
1239 write_tc_c0_tcstatus(read_tc_c0_tcstatus() & ~TCSTATUS_A);
1240 write_tc_c0_tchalt(TCHALT_H); 1240 write_tc_c0_tchalt(TCHALT_H);
1241 mips_ihb();
1242
1243 /* mark the TC unallocated */
1244 write_tc_c0_tcstatus(read_tc_c0_tcstatus() & ~TCSTATUS_A);
1241 1245
1242 v->state = VPE_STATE_UNUSED; 1246 v->state = VPE_STATE_UNUSED;
1243 1247
@@ -1533,14 +1537,16 @@ static int __init vpe_module_init(void)
1533 t->pvpe = get_vpe(0); /* set the parent vpe */ 1537 t->pvpe = get_vpe(0); /* set the parent vpe */
1534 } 1538 }
1535 1539
1540 /* halt the TC */
1541 write_tc_c0_tchalt(TCHALT_H);
1542 mips_ihb();
1543
1536 tmp = read_tc_c0_tcstatus(); 1544 tmp = read_tc_c0_tcstatus();
1537 1545
1538 /* mark not activated and not dynamically allocatable */ 1546 /* mark not activated and not dynamically allocatable */
1539 tmp &= ~(TCSTATUS_A | TCSTATUS_DA); 1547 tmp &= ~(TCSTATUS_A | TCSTATUS_DA);
1540 tmp |= TCSTATUS_IXMT; /* interrupt exempt */ 1548 tmp |= TCSTATUS_IXMT; /* interrupt exempt */
1541 write_tc_c0_tcstatus(tmp); 1549 write_tc_c0_tcstatus(tmp);
1542
1543 write_tc_c0_tchalt(TCHALT_H);
1544 } 1550 }
1545 } 1551 }
1546 1552
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index ba9692be3564..cfeab669782f 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -19,17 +19,14 @@
19 * Lasat boards. 19 * Lasat boards.
20 */ 20 */
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/irq.h>
23#include <linux/sched.h>
24#include <linux/slab.h>
25#include <linux/interrupt.h> 22#include <linux/interrupt.h>
26#include <linux/kernel_stat.h> 23#include <linux/irq.h>
27 24
28#include <asm/bootinfo.h> 25#include <asm/bootinfo.h>
29#include <asm/irq_cpu.h> 26#include <asm/irq_cpu.h>
30#include <asm/lasat/lasatint.h> 27#include <asm/lasat/lasatint.h>
31#include <asm/time.h> 28
32#include <asm/gdb-stub.h> 29#include <irq.h>
33 30
34static volatile int *lasat_int_status; 31static volatile int *lasat_int_status;
35static volatile int *lasat_int_mask; 32static volatile int *lasat_int_mask;
@@ -97,12 +94,18 @@ asmlinkage void plat_irq_dispatch(void)
97 94
98 /* if int_status == 0, then the interrupt has already been cleared */ 95 /* if int_status == 0, then the interrupt has already been cleared */
99 if (int_status) { 96 if (int_status) {
100 irq = LASATINT_BASE + ls1bit32(int_status); 97 irq = LASAT_IRQ_BASE + ls1bit32(int_status);
101 98
102 do_IRQ(irq); 99 do_IRQ(irq);
103 } 100 }
104} 101}
105 102
103static struct irqaction cascade = {
104 .handler = no_action,
105 .mask = CPU_MASK_NONE,
106 .name = "cascade",
107};
108
106void __init arch_init_irq(void) 109void __init arch_init_irq(void)
107{ 110{
108 int i; 111 int i;
@@ -127,6 +130,9 @@ void __init arch_init_irq(void)
127 } 130 }
128 131
129 mips_cpu_irq_init(); 132 mips_cpu_irq_init();
130 for (i = LASATINT_BASE; i <= LASATINT_END; i++) 133
134 for (i = LASAT_IRQ_BASE; i <= LASAT_IRQ_END; i++)
131 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq); 135 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq);
136
137 setup_irq(LASAT_CASCADE_IRQ, &cascade);
132} 138}
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 6806d58211b2..9355f1c9325f 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -7,6 +7,7 @@
7 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Ralf Baechle (ralf@gnu.org) 7 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Ralf Baechle (ralf@gnu.org)
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */ 9 */
10#include <linux/hardirq.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/highmem.h> 12#include <linux/highmem.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -507,7 +508,11 @@ static inline void local_r4k_flush_data_cache_page(void * addr)
507 508
508static void r4k_flush_data_cache_page(unsigned long addr) 509static void r4k_flush_data_cache_page(unsigned long addr)
509{ 510{
510 r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1); 511 if (in_atomic())
512 local_r4k_flush_data_cache_page((void *)addr);
513 else
514 r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr,
515 1, 1);
511} 516}
512 517
513struct flush_icache_range_args { 518struct flush_icache_range_args {
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index e7f539e3284b..1bd1f18ac23c 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -154,7 +154,7 @@ static void check_bus_watcher(void)
154 if (status & ~(1UL << 31)) { 154 if (status & ~(1UL << 31)) {
155 l2_err = csr_in32(IOADDR(A_BUS_L2_ERRORS)); 155 l2_err = csr_in32(IOADDR(A_BUS_L2_ERRORS));
156#ifdef DUMP_L2_ECC_TAG_ON_ERROR 156#ifdef DUMP_L2_ECC_TAG_ON_ERROR
157 l2_tag = in64(IO_SPACE_BASE | A_L2_ECC_TAG); 157 l2_tag = in64(IOADDR(A_L2_ECC_TAG));
158#endif 158#endif
159 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS)); 159 memio_err = csr_in32(IOADDR(A_BUS_MEM_IO_ERRORS));
160 printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err); 160 printk("Bus watcher error counters: %08x %08x\n", l2_err, memio_err);
@@ -183,9 +183,9 @@ asmlinkage void sb1_cache_error(void)
183#ifdef CONFIG_SIBYTE_BW_TRACE 183#ifdef CONFIG_SIBYTE_BW_TRACE
184 /* Freeze the trace buffer now */ 184 /* Freeze the trace buffer now */
185#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 185#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
186 csr_out32(M_BCM1480_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG); 186 csr_out32(M_BCM1480_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
187#else 187#else
188 csr_out32(M_SCD_TRACE_CFG_FREEZE, IO_SPACE_BASE | A_SCD_TRACE_CFG); 188 csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
189#endif 189#endif
190 printk("Trace buffer frozen\n"); 190 printk("Trace buffer frozen\n");
191#endif 191#endif
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 110ee7656b41..ec3b9e9f30f4 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -426,7 +426,7 @@ void __init mem_init(void)
426 426
427#ifdef CONFIG_HIGHMEM 427#ifdef CONFIG_HIGHMEM
428 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) { 428 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
429 struct page *page = mem_map + tmp; 429 struct page *page = pfn_to_page(tmp);
430 430
431 if (!page_is_ram(tmp)) { 431 if (!page_is_ram(tmp)) {
432 SetPageReserved(page); 432 SetPageReserved(page);
diff --git a/arch/mips/pci/fixup-sni.c b/arch/mips/pci/fixup-sni.c
index a45bedd17233..5c8a79bb2661 100644
--- a/arch/mips/pci/fixup-sni.c
+++ b/arch/mips/pci/fixup-sni.c
@@ -113,6 +113,16 @@ static char irq_tab_pcit[13][5] __initdata = {
113 { 0, INTA, INTB, INTC, INTD }, /* Slot 5 */ 113 { 0, INTA, INTB, INTC, INTD }, /* Slot 5 */
114}; 114};
115 115
116static char irq_tab_pcit_cplus[13][5] __initdata = {
117 /* INTA INTB INTC INTD */
118 { 0, 0, 0, 0, 0 }, /* HOST bridge */
119 { 0, INTB, INTC, INTD, INTA }, /* PCI Slot 9 */
120 { 0, 0, 0, 0, 0 }, /* PCI-EISA */
121 { 0, 0, 0, 0, 0 }, /* Unused */
122 { 0, INTA, INTB, INTC, INTD }, /* PCI-PCI bridge */
123 { 0, INTB, INTC, INTD, INTA }, /* fixup */
124};
125
116static inline int is_rm300_revd(void) 126static inline int is_rm300_revd(void)
117{ 127{
118 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR; 128 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
@@ -123,8 +133,19 @@ static inline int is_rm300_revd(void)
123int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 133int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
124{ 134{
125 switch (sni_brd_type) { 135 switch (sni_brd_type) {
126 case SNI_BRD_PCI_TOWER:
127 case SNI_BRD_PCI_TOWER_CPLUS: 136 case SNI_BRD_PCI_TOWER_CPLUS:
137 if (slot == 4) {
138 /*
139 * SNI messed up interrupt wiring for onboard
140 * PCI bus 1; we need to fix this up here
141 */
142 while (dev && dev->bus->number != 1)
143 dev = dev->bus->self;
144 if (dev && dev->devfn >= PCI_DEVFN(4, 0))
145 slot = 5;
146 }
147 return irq_tab_pcit_cplus[slot][pin];
148 case SNI_BRD_PCI_TOWER:
128 return irq_tab_pcit[slot][pin]; 149 return irq_tab_pcit[slot][pin];
129 150
130 case SNI_BRD_PCI_MTOWER: 151 case SNI_BRD_PCI_MTOWER:
diff --git a/arch/mips/pci/pci-lasat.c b/arch/mips/pci/pci-lasat.c
index 174f314933b5..e70ae3236e0b 100644
--- a/arch/mips/pci/pci-lasat.c
+++ b/arch/mips/pci/pci-lasat.c
@@ -5,12 +5,14 @@
5 * 5 *
6 * Copyright (C) 2000, 2001, 04 Keith M Wesolowski 6 * Copyright (C) 2000, 2001, 04 Keith M Wesolowski
7 */ 7 */
8#include <linux/kernel.h>
9#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/kernel.h>
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/types.h> 11#include <linux/types.h>
12
12#include <asm/bootinfo.h> 13#include <asm/bootinfo.h>
13#include <asm/lasat/lasatint.h> 14
15#include <irq.h>
14 16
15extern struct pci_ops nile4_pci_ops; 17extern struct pci_ops nile4_pci_ops;
16extern struct pci_ops gt64xxx_pci0_ops; 18extern struct pci_ops gt64xxx_pci0_ops;
@@ -55,15 +57,15 @@ static int __init lasat_pci_setup(void)
55 57
56arch_initcall(lasat_pci_setup); 58arch_initcall(lasat_pci_setup);
57 59
58#define LASATINT_ETH1 (LASATINT_BASE + 0) 60#define LASAT_IRQ_ETH1 (LASAT_IRQ_BASE + 0)
59#define LASATINT_ETH0 (LASATINT_BASE + 1) 61#define LASAT_IRQ_ETH0 (LASAT_IRQ_BASE + 1)
60#define LASATINT_HDC (LASATINT_BASE + 2) 62#define LASAT_IRQ_HDC (LASAT_IRQ_BASE + 2)
61#define LASATINT_COMP (LASATINT_BASE + 3) 63#define LASAT_IRQ_COMP (LASAT_IRQ_BASE + 3)
62#define LASATINT_HDLC (LASATINT_BASE + 4) 64#define LASAT_IRQ_HDLC (LASAT_IRQ_BASE + 4)
63#define LASATINT_PCIA (LASATINT_BASE + 5) 65#define LASAT_IRQ_PCIA (LASAT_IRQ_BASE + 5)
64#define LASATINT_PCIB (LASATINT_BASE + 6) 66#define LASAT_IRQ_PCIB (LASAT_IRQ_BASE + 6)
65#define LASATINT_PCIC (LASATINT_BASE + 7) 67#define LASAT_IRQ_PCIC (LASAT_IRQ_BASE + 7)
66#define LASATINT_PCID (LASATINT_BASE + 8) 68#define LASAT_IRQ_PCID (LASAT_IRQ_BASE + 8)
67 69
68int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 70int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
69{ 71{
@@ -71,13 +73,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
71 case 1: 73 case 1:
72 case 2: 74 case 2:
73 case 3: 75 case 3:
74 return LASATINT_PCIA + (((slot-1) + (pin-1)) % 4); 76 return LASAT_IRQ_PCIA + (((slot-1) + (pin-1)) % 4);
75 case 4: 77 case 4:
76 return LASATINT_ETH1; /* Ethernet 1 (LAN 2) */ 78 return LASAT_IRQ_ETH1; /* Ethernet 1 (LAN 2) */
77 case 5: 79 case 5:
78 return LASATINT_ETH0; /* Ethernet 0 (LAN 1) */ 80 return LASAT_IRQ_ETH0; /* Ethernet 0 (LAN 1) */
79 case 6: 81 case 6:
80 return LASATINT_HDC; /* IDE controller */ 82 return LASAT_IRQ_HDC; /* IDE controller */
81 default: 83 default:
82 return 0xff; /* Illegal */ 84 return 0xff; /* Illegal */
83 } 85 }
diff --git a/arch/mips/pci/pci-vr41xx.c b/arch/mips/pci/pci-vr41xx.c
index 240df9e33813..33c4f683d067 100644
--- a/arch/mips/pci/pci-vr41xx.c
+++ b/arch/mips/pci/pci-vr41xx.c
@@ -154,6 +154,7 @@ static int __init vr41xx_pciu_init(void)
154 pciu_write(PCICLKSELREG, QUARTER_VTCLOCK); 154 pciu_write(PCICLKSELREG, QUARTER_VTCLOCK);
155 else { 155 else {
156 printk(KERN_ERR "PCI Clock is over 33MHz.\n"); 156 printk(KERN_ERR "PCI Clock is over 33MHz.\n");
157 iounmap(pciu_base);
157 return -EINVAL; 158 return -EINVAL;
158 } 159 }
159 160
diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
index cec24c117f6e..2ba4ef34b4a7 100644
--- a/arch/mips/qemu/Makefile
+++ b/arch/mips/qemu/Makefile
@@ -4,6 +4,7 @@
4 4
5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o 5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o
6 6
7obj-$(CONFIG_SMP) += q-smp.o 7obj-$(CONFIG_EARLY_PRINTK) += q-console.o
8obj-$(CONFIG_SMP) += q-smp.o
8 9
9EXTRA_CFLAGS += -Werror 10EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/qemu/q-console.c b/arch/mips/qemu/q-console.c
new file mode 100644
index 000000000000..81101ae5017a
--- /dev/null
+++ b/arch/mips/qemu/q-console.c
@@ -0,0 +1,26 @@
1#include <linux/console.h>
2#include <linux/init.h>
3#include <linux/serial_reg.h>
4#include <asm/io.h>
5
6#define PORT(offset) (0x3f8 + (offset))
7
8static inline unsigned int serial_in(int offset)
9{
10 return inb(PORT(offset));
11}
12
13static inline void serial_out(int offset, int value)
14{
15 outb(value, PORT(offset));
16}
17
18int prom_putchar(char c)
19{
20 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
21 ;
22
23 serial_out(UART_TX, c);
24
25 return 1;
26}
diff --git a/arch/mips/qemu/q-firmware.c b/arch/mips/qemu/q-firmware.c
index c2239b417587..3ed43f416cd1 100644
--- a/arch/mips/qemu/q-firmware.c
+++ b/arch/mips/qemu/q-firmware.c
@@ -2,6 +2,9 @@
2#include <linux/string.h> 2#include <linux/string.h>
3#include <asm/addrspace.h> 3#include <asm/addrspace.h>
4#include <asm/bootinfo.h> 4#include <asm/bootinfo.h>
5#include <asm/io.h>
6
7#define QEMU_PORT_BASE 0xb4000000
5 8
6void __init prom_init(void) 9void __init prom_init(void)
7{ 10{
@@ -15,4 +18,7 @@ void __init prom_init(void)
15 } else { 18 } else {
16 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM); 19 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM);
17 } 20 }
21
22
23 set_io_port_base(QEMU_PORT_BASE);
18} 24}
diff --git a/arch/mips/qemu/q-setup.c b/arch/mips/qemu/q-setup.c
index 23d34c1917c0..969cedc8d8b9 100644
--- a/arch/mips/qemu/q-setup.c
+++ b/arch/mips/qemu/q-setup.c
@@ -6,8 +6,6 @@
6 6
7extern void qemu_reboot_setup(void); 7extern void qemu_reboot_setup(void);
8 8
9#define QEMU_PORT_BASE 0xb4000000
10
11const char *get_system_type(void) 9const char *get_system_type(void)
12{ 10{
13 return "Qemu"; 11 return "Qemu";
@@ -20,6 +18,5 @@ void __init plat_time_init(void)
20 18
21void __init plat_mem_setup(void) 19void __init plat_mem_setup(void)
22{ 20{
23 set_io_port_base(QEMU_PORT_BASE);
24 qemu_reboot_setup(); 21 qemu_reboot_setup();
25} 22}
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index e28d626255a3..db372a0f106d 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -370,11 +370,11 @@ void __init arch_init_irq(void)
370#endif 370#endif
371 /* Setup uart 1 settings, mapper */ 371 /* Setup uart 1 settings, mapper */
372 /* QQQ FIXME */ 372 /* QQQ FIXME */
373 __raw_writeq(M_DUART_IMR_BRK, IO_SPACE_BASE + A_DUART_IMRREG(kgdb_port)); 373 __raw_writeq(M_DUART_IMR_BRK, IOADDR(A_DUART_IMRREG(kgdb_port)));
374 374
375 __raw_writeq(IMR_IP6_VAL, 375 __raw_writeq(IMR_IP6_VAL,
376 IO_SPACE_BASE + A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) + 376 IOADDR(A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) +
377 (kgdb_irq<<3)); 377 (kgdb_irq << 3)));
378 bcm1480_unmask_irq(0, kgdb_irq); 378 bcm1480_unmask_irq(0, kgdb_irq);
379 379
380#ifdef CONFIG_GDB_CONSOLE 380#ifdef CONFIG_GDB_CONSOLE
@@ -412,18 +412,6 @@ static void bcm1480_kgdb_interrupt(void)
412 412
413extern void bcm1480_mailbox_interrupt(void); 413extern void bcm1480_mailbox_interrupt(void);
414 414
415static inline void dispatch_ip4(void)
416{
417 int cpu = smp_processor_id();
418 int irq = K_BCM1480_INT_TIMER_0 + cpu;
419
420 /* Reset the timer */
421 __raw_writeq(M_SCD_TIMER_ENABLE|M_SCD_TIMER_MODE_CONTINUOUS,
422 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
423
424 do_IRQ(irq);
425}
426
427static inline void dispatch_ip2(void) 415static inline void dispatch_ip2(void)
428{ 416{
429 unsigned long long mask_h, mask_l; 417 unsigned long long mask_h, mask_l;
@@ -451,6 +439,7 @@ static inline void dispatch_ip2(void)
451 439
452asmlinkage void plat_irq_dispatch(void) 440asmlinkage void plat_irq_dispatch(void)
453{ 441{
442 unsigned int cpu = smp_processor_id();
454 unsigned int pending; 443 unsigned int pending;
455 444
456#ifdef CONFIG_SIBYTE_BCM1480_PROF 445#ifdef CONFIG_SIBYTE_BCM1480_PROF
@@ -467,7 +456,7 @@ asmlinkage void plat_irq_dispatch(void)
467#endif 456#endif
468 457
469 if (pending & CAUSEF_IP4) 458 if (pending & CAUSEF_IP4)
470 dispatch_ip4(); 459 do_IRQ(K_BCM1480_INT_TIMER_0 + cpu);
471#ifdef CONFIG_SMP 460#ifdef CONFIG_SMP
472 else if (pending & CAUSEF_IP3) 461 else if (pending & CAUSEF_IP3)
473 bcm1480_mailbox_interrupt(); 462 bcm1480_mailbox_interrupt();
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 4df070f2ff5d..834650f371e0 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -244,7 +244,7 @@ static void pcimt_hwint1(void)
244 if (pend & IT_EISA) { 244 if (pend & IT_EISA) {
245 int irq; 245 int irq;
246 /* 246 /*
247 * Note: ASIC PCI's builtin interrupt achknowledge feature is 247 * Note: ASIC PCI's builtin interrupt acknowledge feature is
248 * broken. Using it may result in loss of some or all i8259 248 * broken. Using it may result in loss of some or all i8259
249 * interrupts, so don't use PCIMT_INT_ACKNOWLEDGE ... 249 * interrupts, so don't use PCIMT_INT_ACKNOWLEDGE ...
250 */ 250 */
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index 1899601e5862..3f23d9fda662 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -525,6 +525,7 @@ static inline int set_sysint1_assign(unsigned int irq, unsigned char assign)
525 intassign1 |= (uint16_t)assign << 9; 525 intassign1 |= (uint16_t)assign << 9;
526 break; 526 break;
527 default: 527 default:
528 spin_unlock_irq(&desc->lock);
528 return -EINVAL; 529 return -EINVAL;
529 } 530 }
530 531
@@ -592,6 +593,7 @@ static inline int set_sysint2_assign(unsigned int irq, unsigned char assign)
592 intassign3 |= (uint16_t)assign << 12; 593 intassign3 |= (uint16_t)assign << 12;
593 break; 594 break;
594 default: 595 default:
596 spin_unlock_irq(&desc->lock);
595 return -EINVAL; 597 return -EINVAL;
596 } 598 }
597 599
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 4e165342210a..bd87626c1f60 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -107,6 +107,9 @@ endif
107# No AltiVec instruction when building kernel 107# No AltiVec instruction when building kernel
108KBUILD_CFLAGS += $(call cc-option,-mno-altivec) 108KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
109 109
110# No SPE instruction when building kernel
111KBUILD_CFLAGS += $(call cc-option,-mno-spe)
112
110# Enable unit-at-a-time mode when possible. It shrinks the 113# Enable unit-at-a-time mode when possible. It shrinks the
111# kernel considerably. 114# kernel considerably.
112KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) 115KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 3ef51fb6f107..9c74fdf29eec 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -186,7 +186,9 @@ int btext_initialize(struct device_node *np)
186 pitch = *prop; 186 pitch = *prop;
187 if (pitch == 1) 187 if (pitch == 1)
188 pitch = 0x1000; 188 pitch = 0x1000;
189 prop = of_get_property(np, "address", NULL); 189 prop = of_get_property(np, "linux,bootx-addr", NULL);
190 if (prop == NULL)
191 prop = of_get_property(np, "address", NULL);
190 if (prop) 192 if (prop)
191 address = *prop; 193 address = *prop;
192 194
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index a7572cf464bd..69a91bd46115 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -251,6 +251,9 @@ syscall_exit_cont:
251 bne- 2f 251 bne- 2f
2521: 2521:
253#endif /* CONFIG_44x */ 253#endif /* CONFIG_44x */
254BEGIN_FTR_SECTION
255 lwarx r7,0,r1
256END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
254 stwcx. r0,0,r1 /* to clear the reservation */ 257 stwcx. r0,0,r1 /* to clear the reservation */
255 lwz r4,_LINK(r1) 258 lwz r4,_LINK(r1)
256 lwz r5,_CCR(r1) 259 lwz r5,_CCR(r1)
@@ -717,6 +720,9 @@ restore:
717 mtctr r11 720 mtctr r11
718 721
719 PPC405_ERR77(0,r1) 722 PPC405_ERR77(0,r1)
723BEGIN_FTR_SECTION
724 lwarx r11,0,r1
725END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
720 stwcx. r0,0,r1 /* to clear the reservation */ 726 stwcx. r0,0,r1 /* to clear the reservation */
721 727
722#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 728#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 214780798289..52e95c2158c0 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -19,6 +19,9 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/smp.h>
23#include <linux/completion.h>
24#include <linux/cpumask.h>
22 25
23#include <asm/prom.h> 26#include <asm/prom.h>
24#include <asm/rtas.h> 27#include <asm/rtas.h>
@@ -34,6 +37,8 @@
34#include <asm/lmb.h> 37#include <asm/lmb.h>
35#include <asm/udbg.h> 38#include <asm/udbg.h>
36#include <asm/syscalls.h> 39#include <asm/syscalls.h>
40#include <asm/smp.h>
41#include <asm/atomic.h>
37 42
38struct rtas_t rtas = { 43struct rtas_t rtas = {
39 .lock = SPIN_LOCK_UNLOCKED 44 .lock = SPIN_LOCK_UNLOCKED
@@ -41,8 +46,10 @@ struct rtas_t rtas = {
41EXPORT_SYMBOL(rtas); 46EXPORT_SYMBOL(rtas);
42 47
43struct rtas_suspend_me_data { 48struct rtas_suspend_me_data {
44 long waiting; 49 atomic_t working; /* number of cpus accessing this struct */
45 struct rtas_args *args; 50 int token; /* ibm,suspend-me */
51 int error;
52 struct completion *complete; /* wait on this until working == 0 */
46}; 53};
47 54
48DEFINE_SPINLOCK(rtas_data_buf_lock); 55DEFINE_SPINLOCK(rtas_data_buf_lock);
@@ -657,50 +664,62 @@ static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
657#ifdef CONFIG_PPC_PSERIES 664#ifdef CONFIG_PPC_PSERIES
658static void rtas_percpu_suspend_me(void *info) 665static void rtas_percpu_suspend_me(void *info)
659{ 666{
660 int i;
661 long rc; 667 long rc;
662 long flags; 668 unsigned long msr_save;
669 int cpu;
663 struct rtas_suspend_me_data *data = 670 struct rtas_suspend_me_data *data =
664 (struct rtas_suspend_me_data *)info; 671 (struct rtas_suspend_me_data *)info;
665 672
666 /* 673 atomic_inc(&data->working);
667 * We use "waiting" to indicate our state. As long 674
668 * as it is >0, we are still trying to all join up. 675 /* really need to ensure MSR.EE is off for H_JOIN */
669 * If it goes to 0, we have successfully joined up and 676 msr_save = mfmsr();
670 * one thread got H_CONTINUE. If any error happens, 677 mtmsr(msr_save & ~(MSR_EE));
671 * we set it to <0. 678
672 */ 679 rc = plpar_hcall_norets(H_JOIN);
673 local_irq_save(flags); 680
674 do { 681 mtmsr(msr_save);
675 rc = plpar_hcall_norets(H_JOIN);
676 smp_rmb();
677 } while (rc == H_SUCCESS && data->waiting > 0);
678 if (rc == H_SUCCESS)
679 goto out;
680 682
681 if (rc == H_CONTINUE) { 683 if (rc == H_SUCCESS) {
682 data->waiting = 0; 684 /* This cpu was prodded and the suspend is complete. */
683 data->args->args[data->args->nargs] = 685 goto out;
684 rtas_call(ibm_suspend_me_token, 0, 1, NULL); 686 } else if (rc == H_CONTINUE) {
685 for_each_possible_cpu(i) 687 /* All other cpus are in H_JOIN, this cpu does
686 plpar_hcall_norets(H_PROD,i); 688 * the suspend.
689 */
690 printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n",
691 smp_processor_id());
692 data->error = rtas_call(data->token, 0, 1, NULL);
693
694 if (data->error)
695 printk(KERN_DEBUG "ibm,suspend-me returned %d\n",
696 data->error);
687 } else { 697 } else {
688 data->waiting = -EBUSY; 698 printk(KERN_ERR "H_JOIN on cpu %i failed with rc = %ld\n",
689 printk(KERN_ERR "Error on H_JOIN hypervisor call\n"); 699 smp_processor_id(), rc);
700 data->error = rc;
690 } 701 }
691 702 /* This cpu did the suspend or got an error; in either case,
703 * we need to prod all other other cpus out of join state.
704 * Extra prods are harmless.
705 */
706 for_each_online_cpu(cpu)
707 plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
692out: 708out:
693 local_irq_restore(flags); 709 if (atomic_dec_return(&data->working) == 0)
694 return; 710 complete(data->complete);
695} 711}
696 712
697static int rtas_ibm_suspend_me(struct rtas_args *args) 713static int rtas_ibm_suspend_me(struct rtas_args *args)
698{ 714{
699 int i;
700 long state; 715 long state;
701 long rc; 716 long rc;
702 unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 717 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
703 struct rtas_suspend_me_data data; 718 struct rtas_suspend_me_data data;
719 DECLARE_COMPLETION_ONSTACK(done);
720
721 if (!rtas_service_present("ibm,suspend-me"))
722 return -ENOSYS;
704 723
705 /* Make sure the state is valid */ 724 /* Make sure the state is valid */
706 rc = plpar_hcall(H_VASI_STATE, retbuf, 725 rc = plpar_hcall(H_VASI_STATE, retbuf,
@@ -721,25 +740,23 @@ static int rtas_ibm_suspend_me(struct rtas_args *args)
721 return 0; 740 return 0;
722 } 741 }
723 742
724 data.waiting = 1; 743 atomic_set(&data.working, 0);
725 data.args = args; 744 data.token = rtas_token("ibm,suspend-me");
745 data.error = 0;
746 data.complete = &done;
726 747
727 /* Call function on all CPUs. One of us will make the 748 /* Call function on all CPUs. One of us will make the
728 * rtas call 749 * rtas call
729 */ 750 */
730 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0)) 751 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0))
731 data.waiting = -EINVAL; 752 data.error = -EINVAL;
732 753
733 if (data.waiting != 0) 754 wait_for_completion(&done);
734 printk(KERN_ERR "Error doing global join\n");
735 755
736 /* Prod each CPU. This won't hurt, and will wake 756 if (data.error != 0)
737 * anyone we successfully put to sleep with H_JOIN. 757 printk(KERN_ERR "Error doing global join\n");
738 */
739 for_each_possible_cpu(i)
740 plpar_hcall_norets(H_PROD, i);
741 758
742 return data.waiting; 759 return data.error;
743} 760}
744#else /* CONFIG_PPC_PSERIES */ 761#else /* CONFIG_PPC_PSERIES */
745static int rtas_ibm_suspend_me(struct rtas_args *args) 762static int rtas_ibm_suspend_me(struct rtas_args *args)
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 4beb6329dfb7..c0d77723ba11 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -829,7 +829,7 @@ static void register_decrementer_clockevent(int cpu)
829 *dec = decrementer_clockevent; 829 *dec = decrementer_clockevent;
830 dec->cpumask = cpumask_of_cpu(cpu); 830 dec->cpumask = cpumask_of_cpu(cpu);
831 831
832 printk(KERN_INFO "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n", 832 printk(KERN_DEBUG "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n",
833 dec->name, dec->mult, dec->shift, cpu); 833 dec->name, dec->mult, dec->shift, cpu);
834 834
835 clockevents_register_device(dec); 835 clockevents_register_device(dec);
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index d9c82d3d6482..c0f5cff77035 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -19,8 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#undef DEBUG
23
24#include <linux/signal.h> 22#include <linux/signal.h>
25#include <linux/sched.h> 23#include <linux/sched.h>
26#include <linux/kernel.h> 24#include <linux/kernel.h>
@@ -66,12 +64,6 @@
66 64
67#include "mmu_decl.h" 65#include "mmu_decl.h"
68 66
69#ifdef DEBUG
70#define DBG(fmt...) printk(fmt)
71#else
72#define DBG(fmt...)
73#endif
74
75#if PGTABLE_RANGE > USER_VSID_RANGE 67#if PGTABLE_RANGE > USER_VSID_RANGE
76#warning Limited user VSID range means pagetable space is wasted 68#warning Limited user VSID range means pagetable space is wasted
77#endif 69#endif
@@ -175,8 +167,8 @@ void pgtable_cache_init(void)
175 int size = pgtable_cache_size[i]; 167 int size = pgtable_cache_size[i];
176 const char *name = pgtable_cache_name[i]; 168 const char *name = pgtable_cache_name[i];
177 169
178 DBG("Allocating page table cache %s (#%d) " 170 pr_debug("Allocating page table cache %s (#%d) "
179 "for size: %08x...\n", name, i, size); 171 "for size: %08x...\n", name, i, size);
180 pgtable_cache[i] = kmem_cache_create(name, 172 pgtable_cache[i] = kmem_cache_create(name,
181 size, size, 173 size, size,
182 SLAB_PANIC, 174 SLAB_PANIC,
@@ -239,8 +231,8 @@ int __meminit vmemmap_populate(struct page *start_page,
239 if (!p) 231 if (!p)
240 return -ENOMEM; 232 return -ENOMEM;
241 233
242 printk(KERN_WARNING "vmemmap %08lx allocated at %p, " 234 pr_debug("vmemmap %08lx allocated at %p, physical %08lx.\n",
243 "physical %08lx.\n", start, p, __pa(p)); 235 start, p, __pa(p));
244 236
245 mapped = htab_bolt_mapping(start, start + page_size, 237 mapped = htab_bolt_mapping(start, start + page_size,
246 __pa(p), mode_rw, mmu_linear_psize, 238 __pa(p), mode_rw, mmu_linear_psize,
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 9e85bda76216..50448d5de9d2 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -20,6 +20,7 @@
20#include <asm/lmb.h> 20#include <asm/lmb.h>
21#include <asm/abs_addr.h> 21#include <asm/abs_addr.h>
22#include <asm/firmware.h> 22#include <asm/firmware.h>
23#include <asm/iseries/hv_call.h>
23 24
24struct stab_entry { 25struct stab_entry {
25 unsigned long esid_data; 26 unsigned long esid_data;
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index eafbca52bff9..e2d867ce1c7e 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -54,12 +54,10 @@ unsigned long pte_freelist_forced_free;
54 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ 54 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \
55 / sizeof(pgtable_free_t)) 55 / sizeof(pgtable_free_t))
56 56
57#ifdef CONFIG_SMP
58static void pte_free_smp_sync(void *arg) 57static void pte_free_smp_sync(void *arg)
59{ 58{
60 /* Do nothing, just ensure we sync with all CPUs */ 59 /* Do nothing, just ensure we sync with all CPUs */
61} 60}
62#endif
63 61
64/* This is only called when we are critically out of memory 62/* This is only called when we are critically out of memory
65 * (and fail to get a page in pte_free_tlb). 63 * (and fail to get a page in pte_free_tlb).
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index e484cac75095..653a5eb91c90 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -144,6 +144,7 @@ static int __init prpmc2800_probe(void)
144 strncpy(prpmc2800_platform_name, m, 144 strncpy(prpmc2800_platform_name, m,
145 min((int)len, PLATFORM_NAME_MAX - 1)); 145 min((int)len, PLATFORM_NAME_MAX - 1));
146 146
147 _set_L2CR(_get_L2CR() | L2CR_L2E);
147 return 1; 148 return 1;
148} 149}
149 150
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 16e4e401b820..306a9d07491d 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -21,7 +21,7 @@ config PPC_SPLPAR
21 21
22config EEH 22config EEH
23 bool "PCI Extended Error Handling (EEH)" if EMBEDDED 23 bool "PCI Extended Error Handling (EEH)" if EMBEDDED
24 depends on PPC_PSERIES 24 depends on PPC_PSERIES && PCI
25 default y if !EMBEDDED 25 default y if !EMBEDDED
26 26
27config SCANLOG 27config SCANLOG
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 66c8ad4cfce6..165981c87786 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -77,8 +77,6 @@ int __init cpm_muram_init(void)
77 int i = 0; 77 int i = 0;
78 int ret = 0; 78 int ret = 0;
79 79
80 printk("cpm_muram_init\n");
81
82 spin_lock_init(&cpm_muram_lock); 80 spin_lock_init(&cpm_muram_lock);
83 /* initialize the info header */ 81 /* initialize the info header */
84 rh_init(&cpm_muram_info, 1, 82 rh_init(&cpm_muram_info, 1,
@@ -193,7 +191,7 @@ void __iomem *cpm_muram_addr(unsigned long offset)
193EXPORT_SYMBOL(cpm_muram_addr); 191EXPORT_SYMBOL(cpm_muram_addr);
194 192
195/** 193/**
196 * cpm_muram_phys - turn a muram virtual address into a DMA address 194 * cpm_muram_dma - turn a muram virtual address into a DMA address
197 * @offset: virtual address from cpm_muram_addr() to convert 195 * @offset: virtual address from cpm_muram_addr() to convert
198 */ 196 */
199dma_addr_t cpm_muram_dma(void __iomem *addr) 197dma_addr_t cpm_muram_dma(void __iomem *addr)
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index b19bfef2034d..59e77eb63338 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -251,6 +251,9 @@ syscall_exit_cont:
251 bne- 2f 251 bne- 2f
2521: 2521:
253#endif /* CONFIG_44x */ 253#endif /* CONFIG_44x */
254BEGIN_FTR_SECTION
255 lwarx r7,0,r1
256END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
254 stwcx. r0,0,r1 /* to clear the reservation */ 257 stwcx. r0,0,r1 /* to clear the reservation */
255 lwz r4,_LINK(r1) 258 lwz r4,_LINK(r1)
256 lwz r5,_CCR(r1) 259 lwz r5,_CCR(r1)
@@ -713,6 +716,9 @@ restore:
713 mtctr r11 716 mtctr r11
714 717
715 PPC405_ERR77(0,r1) 718 PPC405_ERR77(0,r1)
719BEGIN_FTR_SECTION
720 lwarx r11,0,r1
721END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
716 stwcx. r0,0,r1 /* to clear the reservation */ 722 stwcx. r0,0,r1 /* to clear the reservation */
717 723
718#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 724#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 768a5d14b755..31999bc1c8a4 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -168,7 +168,7 @@ ifneq ($(KBUILD_SRC),)
168 $(Q)mkdir -p $(objtree)/include/asm-um 168 $(Q)mkdir -p $(objtree)/include/asm-um
169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch 169 $(Q)ln -fsn $(srctree)/include/asm-$(HEADER_ARCH) include/asm-um/arch
170else 170else
171 $(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(HEADER_ARCH) arch 171 $(Q)cd $(TOPDIR)/include/asm-um && ln -fsn ../asm-$(SUBARCH) arch
172endif 172endif
173 173
174$(objtree)/$(ARCH_DIR)/include: 174$(objtree)/$(ARCH_DIR)/include:
@@ -180,7 +180,7 @@ $(ARCH_DIR)/include/sysdep: $(objtree)/$(ARCH_DIR)/include
180ifneq ($(KBUILD_SRC),) 180ifneq ($(KBUILD_SRC),)
181 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep 181 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) $(ARCH_DIR)/include/sysdep
182else 182else
183 $(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep 183 $(Q)cd $(ARCH_DIR)/include && ln -fsn sysdep-$(SUBARCH) sysdep
184endif 184endif
185 185
186$(ARCH_DIR)/os: 186$(ARCH_DIR)/os:
@@ -188,7 +188,7 @@ $(ARCH_DIR)/os:
188ifneq ($(KBUILD_SRC),) 188ifneq ($(KBUILD_SRC),)
189 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os 189 $(Q)ln -fsn $(srctree)/$(ARCH_DIR)/os-$(OS) $(ARCH_DIR)/os
190else 190else
191 $(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os 191 $(Q)cd $(ARCH_DIR) && ln -fsn os-$(OS) os
192endif 192endif
193 193
194# Generated files 194# Generated files
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 8c01fa81a1ae..73681f14f9fc 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -753,6 +753,7 @@ static struct mc_device net_mc = {
753 .remove = net_remove, 753 .remove = net_remove,
754}; 754};
755 755
756#ifdef CONFIG_INET
756static int uml_inetaddr_event(struct notifier_block *this, unsigned long event, 757static int uml_inetaddr_event(struct notifier_block *this, unsigned long event,
757 void *ptr) 758 void *ptr)
758{ 759{
@@ -789,14 +790,13 @@ struct notifier_block uml_inetaddr_notifier = {
789 .notifier_call = uml_inetaddr_event, 790 .notifier_call = uml_inetaddr_event,
790}; 791};
791 792
792static int uml_net_init(void) 793static void inet_register(void)
793{ 794{
794 struct list_head *ele; 795 struct list_head *ele;
795 struct uml_net_private *lp; 796 struct uml_net_private *lp;
796 struct in_device *ip; 797 struct in_device *ip;
797 struct in_ifaddr *in; 798 struct in_ifaddr *in;
798 799
799 mconsole_register_dev(&net_mc);
800 register_inetaddr_notifier(&uml_inetaddr_notifier); 800 register_inetaddr_notifier(&uml_inetaddr_notifier);
801 801
802 /* Devices may have been opened already, so the uml_inetaddr_notifier 802 /* Devices may have been opened already, so the uml_inetaddr_notifier
@@ -816,7 +816,17 @@ static int uml_net_init(void)
816 } 816 }
817 } 817 }
818 spin_unlock(&opened_lock); 818 spin_unlock(&opened_lock);
819}
820#else
821static inline void inet_register(void)
822{
823}
824#endif
819 825
826static int uml_net_init(void)
827{
828 mconsole_register_dev(&net_mc);
829 inet_register();
820 return 0; 830 return 0;
821} 831}
822 832
diff --git a/arch/um/include/user.h b/arch/um/include/user.h
index 99033ff28a78..1723fac6f40d 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -1,11 +1,13 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __USER_H__ 6#ifndef __USER_H__
7#define __USER_H__ 7#define __USER_H__
8 8
9#include "uml-config.h"
10
9/* 11/*
10 * The usual definition - copied here because the kernel provides its own, 12 * The usual definition - copied here because the kernel provides its own,
11 * fancier, type-safe, definition. Using that one would require 13 * fancier, type-safe, definition. Using that one would require
@@ -23,8 +25,17 @@
23 25
24extern void panic(const char *fmt, ...) 26extern void panic(const char *fmt, ...)
25 __attribute__ ((format (printf, 1, 2))); 27 __attribute__ ((format (printf, 1, 2)));
28
29#ifdef UML_CONFIG_PRINTK
26extern int printk(const char *fmt, ...) 30extern int printk(const char *fmt, ...)
27 __attribute__ ((format (printf, 1, 2))); 31 __attribute__ ((format (printf, 1, 2)));
32#else
33static inline int printk(const char *fmt, ...)
34{
35 return 0;
36}
37#endif
38
28extern void schedule(void); 39extern void schedule(void);
29extern int in_aton(char *str); 40extern int in_aton(char *str);
30extern int open_gdb_chan(void); 41extern int open_gdb_chan(void);
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 70c2d625b070..ba11ccd6a8a3 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -347,14 +347,15 @@ int um_request_irq(unsigned int irq, int fd, int type,
347{ 347{
348 int err; 348 int err;
349 349
350 err = request_irq(irq, handler, irqflags, devname, dev_id); 350 if (fd != -1) {
351 if (err)
352 return err;
353
354 if (fd != -1)
355 err = activate_fd(irq, fd, type, dev_id); 351 err = activate_fd(irq, fd, type, dev_id);
356 return err; 352 if (err)
353 return err;
354 }
355
356 return request_irq(irq, handler, irqflags, devname, dev_id);
357} 357}
358
358EXPORT_SYMBOL(um_request_irq); 359EXPORT_SYMBOL(um_request_irq);
359EXPORT_SYMBOL(reactivate_fd); 360EXPORT_SYMBOL(reactivate_fd);
360 361
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index d119f4f7d897..8d07a7acb909 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -3,7 +3,6 @@
3#include <sys/mman.h> 3#include <sys/mman.h>
4#include <sys/time.h> 4#include <sys/time.h>
5#include <asm/unistd.h> 5#include <asm/unistd.h>
6#include <asm/page.h>
7#include "as-layout.h" 6#include "as-layout.h"
8#include "ptrace_user.h" 7#include "ptrace_user.h"
9#include "skas.h" 8#include "skas.h"
diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index b542a3a021bf..f83462758627 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
@@ -496,8 +496,7 @@ int os_rcv_fd(int fd, int *helper_pid_out)
496 n = recvmsg(fd, &msg, 0); 496 n = recvmsg(fd, &msg, 0);
497 if(n < 0) 497 if(n < 0)
498 return -errno; 498 return -errno;
499 499 else if(n != iov.iov_len)
500 else if(n != sizeof(iov.iov_len))
501 *helper_pid_out = -1; 500 *helper_pid_out = -1;
502 501
503 cmsg = CMSG_FIRSTHDR(&msg); 502 cmsg = CMSG_FIRSTHDR(&msg);
diff --git a/arch/x86/Kconfig.i386 b/arch/x86/Kconfig
index 7331efe891a7..368864dfe6eb 100644
--- a/arch/x86/Kconfig.i386
+++ b/arch/x86/Kconfig
@@ -1,18 +1,24 @@
1# 1# x86 configuration
2# For a description of the syntax of this configuration file, 2mainmenu "Linux Kernel Configuration for x86"
3# see Documentation/kbuild/kconfig-language.txt.
4#
5 3
6mainmenu "Linux Kernel Configuration" 4# Select 32 or 64 bit
5config 64BIT
6 bool "64-bit kernel" if ARCH = "x86"
7 default ARCH = "x86_64"
8 help
9 Say yes to build a 64-bit kernel - formerly known as x86_64
10 Say no to build a 32-bit kernel - formerly known as i386
7 11
8config X86_32 12config X86_32
13 def_bool !64BIT
14
15config X86_64
16 def_bool 64BIT
17
18### Arch settings
19config X86
9 bool 20 bool
10 default y 21 default y
11 help
12 This is Linux's home port. Linux was originally native to the Intel
13 386, and runs on all the later x86 processors including the Intel
14 486, 586, Pentiums, and various instruction-set-compatible chips by
15 AMD, Cyrix, and others.
16 22
17config GENERIC_TIME 23config GENERIC_TIME
18 bool 24 bool
@@ -33,7 +39,7 @@ config GENERIC_CLOCKEVENTS
33config GENERIC_CLOCKEVENTS_BROADCAST 39config GENERIC_CLOCKEVENTS_BROADCAST
34 bool 40 bool
35 default y 41 default y
36 depends on X86_LOCAL_APIC 42 depends on X86_64 || (X86_32 && X86_LOCAL_APIC)
37 43
38config LOCKDEP_SUPPORT 44config LOCKDEP_SUPPORT
39 bool 45 bool
@@ -47,10 +53,6 @@ config SEMAPHORE_SLEEPERS
47 bool 53 bool
48 default y 54 default y
49 55
50config X86
51 bool
52 default y
53
54config MMU 56config MMU
55 bool 57 bool
56 default y 58 default y
@@ -61,7 +63,7 @@ config ZONE_DMA
61 63
62config QUICKLIST 64config QUICKLIST
63 bool 65 bool
64 default y 66 default X86_32
65 67
66config SBUS 68config SBUS
67 bool 69 bool
@@ -91,6 +93,76 @@ config DMI
91 bool 93 bool
92 default y 94 default y
93 95
96config RWSEM_GENERIC_SPINLOCK
97 def_bool !X86_XADD
98
99config RWSEM_XCHGADD_ALGORITHM
100 def_bool X86_XADD
101
102config ARCH_HAS_ILOG2_U32
103 def_bool n
104
105config ARCH_HAS_ILOG2_U64
106 def_bool n
107
108config GENERIC_CALIBRATE_DELAY
109 def_bool y
110
111config GENERIC_TIME_VSYSCALL
112 bool
113 default X86_64
114
115
116
117
118
119config ZONE_DMA32
120 bool
121 default X86_64
122
123config ARCH_POPULATES_NODE_MAP
124 def_bool y
125
126config AUDIT_ARCH
127 bool
128 default X86_64
129
130# Use the generic interrupt handling code in kernel/irq/:
131config GENERIC_HARDIRQS
132 bool
133 default y
134
135config GENERIC_IRQ_PROBE
136 bool
137 default y
138
139config GENERIC_PENDING_IRQ
140 bool
141 depends on GENERIC_HARDIRQS && SMP
142 default y
143
144config X86_SMP
145 bool
146 depends on X86_32 && SMP && !X86_VOYAGER
147 default y
148
149config X86_HT
150 bool
151 depends on SMP && !(X86_VISWS || X86_VOYAGER || MK8)
152 default y
153
154config X86_BIOS_REBOOT
155 bool
156 depends on X86_32 && !(X86_VISWS || X86_VOYAGER)
157 default y
158
159config X86_TRAMPOLINE
160 bool
161 depends on X86_SMP || (X86_VOYAGER && SMP)
162 default y
163
164config KTIME_SCALAR
165 def_bool X86_32
94source "init/Kconfig" 166source "init/Kconfig"
95 167
96menu "Processor type and features" 168menu "Processor type and features"
@@ -137,6 +209,7 @@ config X86_PC
137 209
138config X86_ELAN 210config X86_ELAN
139 bool "AMD Elan" 211 bool "AMD Elan"
212 depends on X86_32
140 help 213 help
141 Select this for an AMD Elan processor. 214 Select this for an AMD Elan processor.
142 215
@@ -146,6 +219,7 @@ config X86_ELAN
146 219
147config X86_VOYAGER 220config X86_VOYAGER
148 bool "Voyager (NCR)" 221 bool "Voyager (NCR)"
222 depends on X86_32
149 select SMP if !BROKEN 223 select SMP if !BROKEN
150 help 224 help
151 Voyager is an MCA-based 32-way capable SMP architecture proprietary 225 Voyager is an MCA-based 32-way capable SMP architecture proprietary
@@ -160,6 +234,7 @@ config X86_NUMAQ
160 bool "NUMAQ (IBM/Sequent)" 234 bool "NUMAQ (IBM/Sequent)"
161 select SMP 235 select SMP
162 select NUMA 236 select NUMA
237 depends on X86_32
163 help 238 help
164 This option is used for getting Linux to run on a (IBM/Sequent) NUMA 239 This option is used for getting Linux to run on a (IBM/Sequent) NUMA
165 multiquad box. This changes the way that processors are bootstrapped, 240 multiquad box. This changes the way that processors are bootstrapped,
@@ -169,7 +244,7 @@ config X86_NUMAQ
169 244
170config X86_SUMMIT 245config X86_SUMMIT
171 bool "Summit/EXA (IBM x440)" 246 bool "Summit/EXA (IBM x440)"
172 depends on SMP 247 depends on X86_32 && SMP
173 help 248 help
174 This option is needed for IBM systems that use the Summit/EXA chipset. 249 This option is needed for IBM systems that use the Summit/EXA chipset.
175 In particular, it is needed for the x440. 250 In particular, it is needed for the x440.
@@ -179,7 +254,7 @@ config X86_SUMMIT
179 254
180config X86_BIGSMP 255config X86_BIGSMP
181 bool "Support for other sub-arch SMP systems with more than 8 CPUs" 256 bool "Support for other sub-arch SMP systems with more than 8 CPUs"
182 depends on SMP 257 depends on X86_32 && SMP
183 help 258 help
184 This option is needed for the systems that have more than 8 CPUs 259 This option is needed for the systems that have more than 8 CPUs
185 and if the system is not of any sub-arch type above. 260 and if the system is not of any sub-arch type above.
@@ -188,6 +263,7 @@ config X86_BIGSMP
188 263
189config X86_VISWS 264config X86_VISWS
190 bool "SGI 320/540 (Visual Workstation)" 265 bool "SGI 320/540 (Visual Workstation)"
266 depends on X86_32
191 help 267 help
192 The SGI Visual Workstation series is an IA32-based workstation 268 The SGI Visual Workstation series is an IA32-based workstation
193 based on SGI systems chips with some legacy PC hardware attached. 269 based on SGI systems chips with some legacy PC hardware attached.
@@ -199,6 +275,7 @@ config X86_VISWS
199 275
200config X86_GENERICARCH 276config X86_GENERICARCH
201 bool "Generic architecture (Summit, bigsmp, ES7000, default)" 277 bool "Generic architecture (Summit, bigsmp, ES7000, default)"
278 depends on X86_32
202 help 279 help
203 This option compiles in the Summit, bigsmp, ES7000, default subarchitectures. 280 This option compiles in the Summit, bigsmp, ES7000, default subarchitectures.
204 It is intended for a generic binary kernel. 281 It is intended for a generic binary kernel.
@@ -206,18 +283,27 @@ config X86_GENERICARCH
206 283
207config X86_ES7000 284config X86_ES7000
208 bool "Support for Unisys ES7000 IA32 series" 285 bool "Support for Unisys ES7000 IA32 series"
209 depends on SMP 286 depends on X86_32 && SMP
210 help 287 help
211 Support for Unisys ES7000 systems. Say 'Y' here if this kernel is 288 Support for Unisys ES7000 systems. Say 'Y' here if this kernel is
212 supposed to run on an IA32-based Unisys ES7000 system. 289 supposed to run on an IA32-based Unisys ES7000 system.
213 Only choose this option if you have such a system, otherwise you 290 Only choose this option if you have such a system, otherwise you
214 should say N here. 291 should say N here.
215 292
293config X86_VSMP
294 bool "Support for ScaleMP vSMP"
295 depends on X86_64 && PCI
296 help
297 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is
298 supposed to run on these EM64T-based machines. Only choose this option
299 if you have one of these machines.
300
216endchoice 301endchoice
217 302
218config SCHED_NO_NO_OMIT_FRAME_POINTER 303config SCHED_NO_NO_OMIT_FRAME_POINTER
219 bool "Single-depth WCHAN output" 304 bool "Single-depth WCHAN output"
220 default y 305 default y
306 depends on X86_32
221 help 307 help
222 Calculate simpler /proc/<PID>/wchan values. If this option 308 Calculate simpler /proc/<PID>/wchan values. If this option
223 is disabled then wchan values will recurse back to the 309 is disabled then wchan values will recurse back to the
@@ -228,7 +314,7 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
228 314
229config PARAVIRT 315config PARAVIRT
230 bool 316 bool
231 depends on !(X86_VISWS || X86_VOYAGER) 317 depends on X86_32 && !(X86_VISWS || X86_VOYAGER)
232 help 318 help
233 This changes the kernel so it can modify itself when it is run 319 This changes the kernel so it can modify itself when it is run
234 under a hypervisor, potentially improving performance significantly 320 under a hypervisor, potentially improving performance significantly
@@ -237,6 +323,7 @@ config PARAVIRT
237 323
238menuconfig PARAVIRT_GUEST 324menuconfig PARAVIRT_GUEST
239 bool "Paravirtualized guest support" 325 bool "Paravirtualized guest support"
326 depends on X86_32
240 help 327 help
241 Say Y here to get to see options related to running Linux under 328 Say Y here to get to see options related to running Linux under
242 various hypervisors. This option alone does not add any kernel code. 329 various hypervisors. This option alone does not add any kernel code.
@@ -264,7 +351,7 @@ endif
264config ACPI_SRAT 351config ACPI_SRAT
265 bool 352 bool
266 default y 353 default y
267 depends on ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH) 354 depends on X86_32 && ACPI && NUMA && (X86_SUMMIT || X86_GENERICARCH)
268 select ACPI_NUMA 355 select ACPI_NUMA
269 356
270config HAVE_ARCH_PARSE_SRAT 357config HAVE_ARCH_PARSE_SRAT
@@ -275,12 +362,12 @@ config HAVE_ARCH_PARSE_SRAT
275config X86_SUMMIT_NUMA 362config X86_SUMMIT_NUMA
276 bool 363 bool
277 default y 364 default y
278 depends on NUMA && (X86_SUMMIT || X86_GENERICARCH) 365 depends on X86_32 && NUMA && (X86_SUMMIT || X86_GENERICARCH)
279 366
280config X86_CYCLONE_TIMER 367config X86_CYCLONE_TIMER
281 bool 368 bool
282 default y 369 default y
283 depends on X86_SUMMIT || X86_GENERICARCH 370 depends on X86_32 && X86_SUMMIT || X86_GENERICARCH
284 371
285config ES7000_CLUSTERED_APIC 372config ES7000_CLUSTERED_APIC
286 bool 373 bool
@@ -290,21 +377,89 @@ config ES7000_CLUSTERED_APIC
290source "arch/x86/Kconfig.cpu" 377source "arch/x86/Kconfig.cpu"
291 378
292config HPET_TIMER 379config HPET_TIMER
293 bool "HPET Timer Support" 380 bool
381 prompt "HPET Timer Support" if X86_32
382 default X86_64
294 help 383 help
295 This enables the use of the HPET for the kernel's internal timer. 384 Use the IA-PC HPET (High Precision Event Timer) to manage
296 HPET is the next generation timer replacing legacy 8254s. 385 time in preference to the PIT and RTC, if a HPET is
297 You can safely choose Y here. However, HPET will only be 386 present.
298 activated if the platform and the BIOS support this feature. 387 HPET is the next generation timer replacing legacy 8254s.
299 Otherwise the 8254 will be used for timing services. 388 The HPET provides a stable time base on SMP
389 systems, unlike the TSC, but it is more expensive to access,
390 as it is off-chip. You can find the HPET spec at
391 <http://www.intel.com/hardwaredesign/hpetspec.htm>.
392
393 You can safely choose Y here. However, HPET will only be
394 activated if the platform and the BIOS support this feature.
395 Otherwise the 8254 will be used for timing services.
300 396
301 Choose N to continue using the legacy 8254 timer. 397 Choose N to continue using the legacy 8254 timer.
302 398
303config HPET_EMULATE_RTC 399config HPET_EMULATE_RTC
304 bool 400 bool
305 depends on HPET_TIMER && RTC=y 401 depends on HPET_TIMER && RTC=y
306 default y 402 default y
307 403
404# Mark as embedded because too many people got it wrong.
405# The code disables itself when not needed.
406config GART_IOMMU
407 bool "GART IOMMU support" if EMBEDDED
408 default y
409 select SWIOTLB
410 select AGP
411 depends on X86_64 && PCI
412 help
413 Support for full DMA access of devices with 32bit memory access only
414 on systems with more than 3GB. This is usually needed for USB,
415 sound, many IDE/SATA chipsets and some other devices.
416 Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART
417 based hardware IOMMU and a software bounce buffer based IOMMU used
418 on Intel systems and as fallback.
419 The code is only active when needed (enough memory and limited
420 device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified
421 too.
422
423config CALGARY_IOMMU
424 bool "IBM Calgary IOMMU support"
425 select SWIOTLB
426 depends on X86_64 && PCI && EXPERIMENTAL
427 help
428 Support for hardware IOMMUs in IBM's xSeries x366 and x460
429 systems. Needed to run systems with more than 3GB of memory
430 properly with 32-bit PCI devices that do not support DAC
431 (Double Address Cycle). Calgary also supports bus level
432 isolation, where all DMAs pass through the IOMMU. This
433 prevents them from going anywhere except their intended
434 destination. This catches hard-to-find kernel bugs and
435 mis-behaving drivers and devices that do not use the DMA-API
436 properly to set up their DMA buffers. The IOMMU can be
437 turned off at boot time with the iommu=off parameter.
438 Normally the kernel will make the right choice by itself.
439 If unsure, say Y.
440
441config CALGARY_IOMMU_ENABLED_BY_DEFAULT
442 bool "Should Calgary be enabled by default?"
443 default y
444 depends on CALGARY_IOMMU
445 help
446 Should Calgary be enabled by default? if you choose 'y', Calgary
447 will be used (if it exists). If you choose 'n', Calgary will not be
448 used even if it exists. If you choose 'n' and would like to use
449 Calgary anyway, pass 'iommu=calgary' on the kernel command line.
450 If unsure, say Y.
451
452# need this always selected by IOMMU for the VIA workaround
453config SWIOTLB
454 bool
455 help
456 Support for software bounce buffers used on x86-64 systems
457 which don't have a hardware IOMMU (e.g. the current generation
458 of Intel's x86-64 CPUs). Using this PCI devices which can only
459 access 32-bits of memory can be used on systems with more than
460 3 GB of memory. If unsure, say Y.
461
462
308config NR_CPUS 463config NR_CPUS
309 int "Maximum number of CPUs (2-255)" 464 int "Maximum number of CPUs (2-255)"
310 range 2 255 465 range 2 255
@@ -321,7 +476,7 @@ config NR_CPUS
321 476
322config SCHED_SMT 477config SCHED_SMT
323 bool "SMT (Hyperthreading) scheduler support" 478 bool "SMT (Hyperthreading) scheduler support"
324 depends on X86_HT 479 depends on (X86_64 && SMP) || (X86_32 && X86_HT)
325 help 480 help
326 SMT scheduler support improves the CPU scheduler's decision making 481 SMT scheduler support improves the CPU scheduler's decision making
327 when dealing with Intel Pentium 4 chips with HyperThreading at a 482 when dealing with Intel Pentium 4 chips with HyperThreading at a
@@ -330,7 +485,7 @@ config SCHED_SMT
330 485
331config SCHED_MC 486config SCHED_MC
332 bool "Multi-core scheduler support" 487 bool "Multi-core scheduler support"
333 depends on X86_HT 488 depends on (X86_64 && SMP) || (X86_32 && X86_HT)
334 default y 489 default y
335 help 490 help
336 Multi-core scheduler support improves the CPU scheduler's decision 491 Multi-core scheduler support improves the CPU scheduler's decision
@@ -341,7 +496,7 @@ source "kernel/Kconfig.preempt"
341 496
342config X86_UP_APIC 497config X86_UP_APIC
343 bool "Local APIC support on uniprocessors" 498 bool "Local APIC support on uniprocessors"
344 depends on !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH) 499 depends on X86_32 && !SMP && !(X86_VISWS || X86_VOYAGER || X86_GENERICARCH)
345 help 500 help
346 A local APIC (Advanced Programmable Interrupt Controller) is an 501 A local APIC (Advanced Programmable Interrupt Controller) is an
347 integrated interrupt controller in the CPU. If you have a single-CPU 502 integrated interrupt controller in the CPU. If you have a single-CPU
@@ -366,17 +521,17 @@ config X86_UP_IOAPIC
366 521
367config X86_LOCAL_APIC 522config X86_LOCAL_APIC
368 bool 523 bool
369 depends on X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH 524 depends on X86_64 || (X86_32 && (X86_UP_APIC || ((X86_VISWS || SMP) && !X86_VOYAGER) || X86_GENERICARCH))
370 default y 525 default y
371 526
372config X86_IO_APIC 527config X86_IO_APIC
373 bool 528 bool
374 depends on X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH 529 depends on X86_64 || (X86_32 && (X86_UP_IOAPIC || (SMP && !(X86_VISWS || X86_VOYAGER)) || X86_GENERICARCH))
375 default y 530 default y
376 531
377config X86_VISWS_APIC 532config X86_VISWS_APIC
378 bool 533 bool
379 depends on X86_VISWS 534 depends on X86_32 && X86_VISWS
380 default y 535 default y
381 536
382config X86_MCE 537config X86_MCE
@@ -396,9 +551,25 @@ config X86_MCE
396 to disable it. MCE support simply ignores non-MCE processors like 551 to disable it. MCE support simply ignores non-MCE processors like
397 the 386 and 486, so nearly everyone can say Y here. 552 the 386 and 486, so nearly everyone can say Y here.
398 553
554config X86_MCE_INTEL
555 bool "Intel MCE features"
556 depends on X86_64 && X86_MCE && X86_LOCAL_APIC
557 default y
558 help
559 Additional support for intel specific MCE features such as
560 the thermal monitor.
561
562config X86_MCE_AMD
563 bool "AMD MCE features"
564 depends on X86_64 && X86_MCE && X86_LOCAL_APIC
565 default y
566 help
567 Additional support for AMD specific MCE features such as
568 the DRAM Error Threshold.
569
399config X86_MCE_NONFATAL 570config X86_MCE_NONFATAL
400 tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4" 571 tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4"
401 depends on X86_MCE 572 depends on X86_32 && X86_MCE
402 help 573 help
403 Enabling this feature starts a timer that triggers every 5 seconds which 574 Enabling this feature starts a timer that triggers every 5 seconds which
404 will look at the machine check registers to see if anything happened. 575 will look at the machine check registers to see if anything happened.
@@ -411,14 +582,15 @@ config X86_MCE_NONFATAL
411 582
412config X86_MCE_P4THERMAL 583config X86_MCE_P4THERMAL
413 bool "check for P4 thermal throttling interrupt." 584 bool "check for P4 thermal throttling interrupt."
414 depends on X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS 585 depends on X86_32 && X86_MCE && (X86_UP_APIC || SMP) && !X86_VISWS
415 help 586 help
416 Enabling this feature will cause a message to be printed when the P4 587 Enabling this feature will cause a message to be printed when the P4
417 enters thermal throttling. 588 enters thermal throttling.
418 589
419config VM86 590config VM86
420 default y
421 bool "Enable VM86 support" if EMBEDDED 591 bool "Enable VM86 support" if EMBEDDED
592 default y
593 depends on X86_32
422 help 594 help
423 This option is required by programs like DOSEMU to run 16-bit legacy 595 This option is required by programs like DOSEMU to run 16-bit legacy
424 code on X86 processors. It also may be needed by software like 596 code on X86 processors. It also may be needed by software like
@@ -427,6 +599,7 @@ config VM86
427 599
428config TOSHIBA 600config TOSHIBA
429 tristate "Toshiba Laptop support" 601 tristate "Toshiba Laptop support"
602 depends on X86_32
430 ---help--- 603 ---help---
431 This adds a driver to safely access the System Management Mode of 604 This adds a driver to safely access the System Management Mode of
432 the CPU on Toshiba portables with a genuine Toshiba BIOS. It does 605 the CPU on Toshiba portables with a genuine Toshiba BIOS. It does
@@ -442,6 +615,7 @@ config TOSHIBA
442 615
443config I8K 616config I8K
444 tristate "Dell laptop support" 617 tristate "Dell laptop support"
618 depends on X86_32
445 ---help--- 619 ---help---
446 This adds a driver to safely access the System Management Mode 620 This adds a driver to safely access the System Management Mode
447 of the CPU on the Dell Inspiron 8000. The System Management Mode 621 of the CPU on the Dell Inspiron 8000. The System Management Mode
@@ -462,7 +636,7 @@ config I8K
462 636
463config X86_REBOOTFIXUPS 637config X86_REBOOTFIXUPS
464 bool "Enable X86 board specific fixups for reboot" 638 bool "Enable X86 board specific fixups for reboot"
465 depends on X86 639 depends on X86_32 && X86
466 default n 640 default n
467 ---help--- 641 ---help---
468 This enables chipset and/or board specific fixups to be done 642 This enables chipset and/or board specific fixups to be done
@@ -517,12 +691,11 @@ config X86_CPUID
517 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to 691 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
518 /dev/cpu/31/cpuid. 692 /dev/cpu/31/cpuid.
519 693
520source "drivers/firmware/Kconfig"
521
522choice 694choice
523 prompt "High Memory Support" 695 prompt "High Memory Support"
524 default HIGHMEM4G if !X86_NUMAQ 696 default HIGHMEM4G if !X86_NUMAQ
525 default HIGHMEM64G if X86_NUMAQ 697 default HIGHMEM64G if X86_NUMAQ
698 depends on X86_32
526 699
527config NOHIGHMEM 700config NOHIGHMEM
528 bool "off" 701 bool "off"
@@ -582,6 +755,7 @@ choice
582 depends on EXPERIMENTAL 755 depends on EXPERIMENTAL
583 prompt "Memory split" if EMBEDDED 756 prompt "Memory split" if EMBEDDED
584 default VMSPLIT_3G 757 default VMSPLIT_3G
758 depends on X86_32
585 help 759 help
586 Select the desired split between kernel and user memory. 760 Select the desired split between kernel and user memory.
587 761
@@ -619,16 +793,17 @@ config PAGE_OFFSET
619 default 0x78000000 if VMSPLIT_2G_OPT 793 default 0x78000000 if VMSPLIT_2G_OPT
620 default 0x40000000 if VMSPLIT_1G 794 default 0x40000000 if VMSPLIT_1G
621 default 0xC0000000 795 default 0xC0000000
796 depends on X86_32
622 797
623config HIGHMEM 798config HIGHMEM
624 bool 799 bool
625 depends on HIGHMEM64G || HIGHMEM4G 800 depends on X86_32 && (HIGHMEM64G || HIGHMEM4G)
626 default y 801 default y
627 802
628config X86_PAE 803config X86_PAE
629 bool "PAE (Physical Address Extension) Support" 804 bool "PAE (Physical Address Extension) Support"
630 default n 805 default n
631 depends on !HIGHMEM4G 806 depends on X86_32 && !HIGHMEM4G
632 select RESOURCES_64BIT 807 select RESOURCES_64BIT
633 help 808 help
634 PAE is required for NX support, and furthermore enables 809 PAE is required for NX support, and furthermore enables
@@ -639,46 +814,82 @@ config X86_PAE
639# Common NUMA Features 814# Common NUMA Features
640config NUMA 815config NUMA
641 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)" 816 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
642 depends on SMP && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL 817 depends on SMP
818 depends on X86_64 || (X86_32 && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL)
643 default n if X86_PC 819 default n if X86_PC
644 default y if (X86_NUMAQ || X86_SUMMIT) 820 default y if (X86_NUMAQ || X86_SUMMIT)
645 help 821 help
646 NUMA support for i386. This is currently highly experimental 822 Enable NUMA (Non Uniform Memory Access) support.
647 and should be only used for kernel development. It might also 823 The kernel will try to allocate memory used by a CPU on the
648 cause boot failures. 824 local memory controller of the CPU and add some more
825 NUMA awareness to the kernel.
826
827 For i386 this is currently highly experimental and should be only
828 used for kernel development. It might also cause boot failures.
829 For x86_64 this is recommended on all multiprocessor Opteron systems.
830 If the system is EM64T, you should say N unless your system is
831 EM64T NUMA.
649 832
650comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" 833comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI"
651 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI) 834 depends on X86_32 && X86_SUMMIT && (!HIGHMEM64G || !ACPI)
835
836config K8_NUMA
837 bool "Old style AMD Opteron NUMA detection"
838 depends on X86_64 && NUMA && PCI
839 default y
840 help
841 Enable K8 NUMA node topology detection. You should say Y here if
842 you have a multi processor AMD K8 system. This uses an old
843 method to read the NUMA configuration directly from the builtin
844 Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA
845 instead, which also takes priority if both are compiled in.
846
847config X86_64_ACPI_NUMA
848 bool "ACPI NUMA detection"
849 depends on X86_64 && NUMA && ACPI && PCI
850 select ACPI_NUMA
851 default y
852 help
853 Enable ACPI SRAT based node topology detection.
854
855config NUMA_EMU
856 bool "NUMA emulation"
857 depends on X86_64 && NUMA
858 help
859 Enable NUMA emulation. A flat machine will be split
860 into virtual nodes when booted with "numa=fake=N", where N is the
861 number of nodes. This is only useful for debugging.
652 862
653config NODES_SHIFT 863config NODES_SHIFT
654 int 864 int
865 default "6" if X86_64
655 default "4" if X86_NUMAQ 866 default "4" if X86_NUMAQ
656 default "3" 867 default "3"
657 depends on NEED_MULTIPLE_NODES 868 depends on NEED_MULTIPLE_NODES
658 869
659config HAVE_ARCH_BOOTMEM_NODE 870config HAVE_ARCH_BOOTMEM_NODE
660 bool 871 bool
661 depends on NUMA 872 depends on X86_32 && NUMA
662 default y 873 default y
663 874
664config ARCH_HAVE_MEMORY_PRESENT 875config ARCH_HAVE_MEMORY_PRESENT
665 bool 876 bool
666 depends on DISCONTIGMEM 877 depends on X86_32 && DISCONTIGMEM
667 default y 878 default y
668 879
669config NEED_NODE_MEMMAP_SIZE 880config NEED_NODE_MEMMAP_SIZE
670 bool 881 bool
671 depends on DISCONTIGMEM || SPARSEMEM 882 depends on X86_32 && (DISCONTIGMEM || SPARSEMEM)
672 default y 883 default y
673 884
674config HAVE_ARCH_ALLOC_REMAP 885config HAVE_ARCH_ALLOC_REMAP
675 bool 886 bool
676 depends on NUMA 887 depends on X86_32 && NUMA
677 default y 888 default y
678 889
679config ARCH_FLATMEM_ENABLE 890config ARCH_FLATMEM_ENABLE
680 def_bool y 891 def_bool y
681 depends on (ARCH_SELECT_MEMORY_MODEL && X86_PC) 892 depends on (X86_32 && ARCH_SELECT_MEMORY_MODEL && X86_PC) || (X86_64 && !NUMA)
682 893
683config ARCH_DISCONTIGMEM_ENABLE 894config ARCH_DISCONTIGMEM_ENABLE
684 def_bool y 895 def_bool y
@@ -690,21 +901,23 @@ config ARCH_DISCONTIGMEM_DEFAULT
690 901
691config ARCH_SPARSEMEM_ENABLE 902config ARCH_SPARSEMEM_ENABLE
692 def_bool y 903 def_bool y
693 depends on (NUMA || (X86_PC && EXPERIMENTAL)) 904 depends on NUMA || (EXPERIMENTAL && (X86_PC || X86_64))
694 select SPARSEMEM_STATIC 905 select SPARSEMEM_STATIC if X86_32
906 select SPARSEMEM_VMEMMAP_ENABLE if X86_64
695 907
696config ARCH_SELECT_MEMORY_MODEL 908config ARCH_SELECT_MEMORY_MODEL
697 def_bool y 909 def_bool y
698 depends on ARCH_SPARSEMEM_ENABLE 910 depends on X86_32 && ARCH_SPARSEMEM_ENABLE
699 911
700config ARCH_POPULATES_NODE_MAP 912config ARCH_MEMORY_PROBE
701 def_bool y 913 def_bool X86_64
914 depends on MEMORY_HOTPLUG
702 915
703source "mm/Kconfig" 916source "mm/Kconfig"
704 917
705config HIGHPTE 918config HIGHPTE
706 bool "Allocate 3rd-level pagetables from highmem" 919 bool "Allocate 3rd-level pagetables from highmem"
707 depends on HIGHMEM4G || HIGHMEM64G 920 depends on X86_32 && (HIGHMEM4G || HIGHMEM64G)
708 help 921 help
709 The VM uses one page table entry for each page of physical memory. 922 The VM uses one page table entry for each page of physical memory.
710 For systems with a lot of RAM, this can be wasteful of precious 923 For systems with a lot of RAM, this can be wasteful of precious
@@ -712,7 +925,8 @@ config HIGHPTE
712 entries in high memory. 925 entries in high memory.
713 926
714config MATH_EMULATION 927config MATH_EMULATION
715 bool "Math emulation" 928 bool
929 prompt "Math emulation" if X86_32
716 ---help--- 930 ---help---
717 Linux can emulate a math coprocessor (used for floating point 931 Linux can emulate a math coprocessor (used for floating point
718 operations) if you don't have one. 486DX and Pentium processors have 932 operations) if you don't have one. 486DX and Pentium processors have
@@ -772,7 +986,7 @@ config MTRR
772 986
773config EFI 987config EFI
774 bool "Boot from EFI support" 988 bool "Boot from EFI support"
775 depends on ACPI 989 depends on X86_32 && ACPI
776 default n 990 default n
777 ---help--- 991 ---help---
778 This enables the kernel to boot on EFI platforms using 992 This enables the kernel to boot on EFI platforms using
@@ -789,18 +1003,18 @@ config EFI
789 kernel should continue to boot on existing non-EFI platforms. 1003 kernel should continue to boot on existing non-EFI platforms.
790 1004
791config IRQBALANCE 1005config IRQBALANCE
792 bool "Enable kernel irq balancing" 1006 bool "Enable kernel irq balancing"
793 depends on SMP && X86_IO_APIC 1007 depends on X86_32 && SMP && X86_IO_APIC
794 default y 1008 default y
795 help 1009 help
796 The default yes will allow the kernel to do irq load balancing. 1010 The default yes will allow the kernel to do irq load balancing.
797 Saying no will keep the kernel from doing irq load balancing. 1011 Saying no will keep the kernel from doing irq load balancing.
798 1012
799# turning this on wastes a bunch of space. 1013# turning this on wastes a bunch of space.
800# Summit needs it only when NUMA is on 1014# Summit needs it only when NUMA is on
801config BOOT_IOREMAP 1015config BOOT_IOREMAP
802 bool 1016 bool
803 depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI)) 1017 depends on X86_32 && (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI))
804 default y 1018 default y
805 1019
806config SECCOMP 1020config SECCOMP
@@ -820,6 +1034,30 @@ config SECCOMP
820 1034
821 If unsure, say Y. Only embedded should say N here. 1035 If unsure, say Y. Only embedded should say N here.
822 1036
1037config CC_STACKPROTECTOR
1038 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
1039 depends on X86_64 && EXPERIMENTAL
1040 help
1041 This option turns on the -fstack-protector GCC feature. This
1042 feature puts, at the beginning of critical functions, a canary
1043 value on the stack just before the return address, and validates
1044 the value just before actually returning. Stack based buffer
1045 overflows (that need to overwrite this return address) now also
1046 overwrite the canary, which gets detected and the attack is then
1047 neutralized via a kernel panic.
1048
1049 This feature requires gcc version 4.2 or above, or a distribution
1050 gcc with the feature backported. Older versions are automatically
1051 detected and for those versions, this configuration option is ignored.
1052
1053config CC_STACKPROTECTOR_ALL
1054 bool "Use stack-protector for all functions"
1055 depends on CC_STACKPROTECTOR
1056 help
1057 Normally, GCC only inserts the canary value protection for
1058 functions that use large-ish on-stack buffers. By enabling
1059 this option, GCC will be asked to do this for ALL functions.
1060
823source kernel/Kconfig.hz 1061source kernel/Kconfig.hz
824 1062
825config KEXEC 1063config KEXEC
@@ -841,7 +1079,7 @@ config KEXEC
841config CRASH_DUMP 1079config CRASH_DUMP
842 bool "kernel crash dumps (EXPERIMENTAL)" 1080 bool "kernel crash dumps (EXPERIMENTAL)"
843 depends on EXPERIMENTAL 1081 depends on EXPERIMENTAL
844 depends on HIGHMEM 1082 depends on X86_64 || (X86_32 && HIGHMEM)
845 help 1083 help
846 Generate crash dump after being started by kexec. 1084 Generate crash dump after being started by kexec.
847 This should be normally only set in special crash dump kernels 1085 This should be normally only set in special crash dump kernels
@@ -856,6 +1094,7 @@ config CRASH_DUMP
856config PHYSICAL_START 1094config PHYSICAL_START
857 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) 1095 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
858 default "0x1000000" if X86_NUMAQ 1096 default "0x1000000" if X86_NUMAQ
1097 default "0x200000" if X86_64
859 default "0x100000" 1098 default "0x100000"
860 help 1099 help
861 This gives the physical address where the kernel is loaded. 1100 This gives the physical address where the kernel is loaded.
@@ -908,25 +1147,31 @@ config RELOCATABLE
908 must live at a different physical address than the primary 1147 must live at a different physical address than the primary
909 kernel. 1148 kernel.
910 1149
1150 Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
1151 it has been loaded at and the compile time physical address
1152 (CONFIG_PHYSICAL_START) is ignored.
1153
911config PHYSICAL_ALIGN 1154config PHYSICAL_ALIGN
912 hex "Alignment value to which kernel should be aligned" 1155 hex
913 default "0x100000" 1156 prompt "Alignment value to which kernel should be aligned" if X86_32
1157 default "0x100000" if X86_32
1158 default "0x200000" if X86_64
914 range 0x2000 0x400000 1159 range 0x2000 0x400000
915 help 1160 help
916 This value puts the alignment restrictions on physical address 1161 This value puts the alignment restrictions on physical address
917 where kernel is loaded and run from. Kernel is compiled for an 1162 where kernel is loaded and run from. Kernel is compiled for an
918 address which meets above alignment restriction. 1163 address which meets above alignment restriction.
919 1164
920 If bootloader loads the kernel at a non-aligned address and 1165 If bootloader loads the kernel at a non-aligned address and
921 CONFIG_RELOCATABLE is set, kernel will move itself to nearest 1166 CONFIG_RELOCATABLE is set, kernel will move itself to nearest
922 address aligned to above value and run from there. 1167 address aligned to above value and run from there.
923 1168
924 If bootloader loads the kernel at a non-aligned address and 1169 If bootloader loads the kernel at a non-aligned address and
925 CONFIG_RELOCATABLE is not set, kernel will ignore the run time 1170 CONFIG_RELOCATABLE is not set, kernel will ignore the run time
926 load address and decompress itself to the address it has been 1171 load address and decompress itself to the address it has been
927 compiled for and run from there. The address for which kernel is 1172 compiled for and run from there. The address for which kernel is
928 compiled already meets above alignment restrictions. Hence the 1173 compiled already meets above alignment restrictions. Hence the
929 end result is that kernel runs from a physical address meeting 1174 end result is that kernel runs from a physical address meeting
930 above alignment restrictions. 1175 above alignment restrictions.
931 1176
932 Don't change this unless you know what you are doing. 1177 Don't change this unless you know what you are doing.
@@ -938,10 +1183,13 @@ config HOTPLUG_CPU
938 Say Y here to experiment with turning CPUs off and on, and to 1183 Say Y here to experiment with turning CPUs off and on, and to
939 enable suspend on SMP systems. CPUs can be controlled through 1184 enable suspend on SMP systems. CPUs can be controlled through
940 /sys/devices/system/cpu. 1185 /sys/devices/system/cpu.
1186 Say N if you want to disable CPU hotplug and don't need to
1187 suspend.
941 1188
942config COMPAT_VDSO 1189config COMPAT_VDSO
943 bool "Compat VDSO support" 1190 bool "Compat VDSO support"
944 default y 1191 default y
1192 depends on X86_32
945 help 1193 help
946 Map the VDSO to the predictable old-style address too. 1194 Map the VDSO to the predictable old-style address too.
947 ---help--- 1195 ---help---
@@ -955,18 +1203,35 @@ endmenu
955 1203
956config ARCH_ENABLE_MEMORY_HOTPLUG 1204config ARCH_ENABLE_MEMORY_HOTPLUG
957 def_bool y 1205 def_bool y
958 depends on HIGHMEM 1206 depends on X86_64 || (X86_32 && HIGHMEM)
1207
1208config MEMORY_HOTPLUG_RESERVE
1209 def_bool X86_64
1210 depends on (MEMORY_HOTPLUG && DISCONTIGMEM)
1211
1212config HAVE_ARCH_EARLY_PFN_TO_NID
1213 def_bool X86_64
1214 depends on NUMA
959 1215
960menu "Power management options (ACPI, APM)" 1216config OUT_OF_LINE_PFN_TO_PAGE
1217 def_bool X86_64
1218 depends on DISCONTIGMEM
1219
1220menu "Power management options"
961 depends on !X86_VOYAGER 1221 depends on !X86_VOYAGER
962 1222
963source kernel/power/Kconfig 1223config ARCH_HIBERNATION_HEADER
1224 bool
1225 depends on X86_64 && HIBERNATION
1226 default y
1227
1228source "kernel/power/Kconfig"
964 1229
965source "drivers/acpi/Kconfig" 1230source "drivers/acpi/Kconfig"
966 1231
967menuconfig APM 1232menuconfig APM
968 tristate "APM (Advanced Power Management) BIOS support" 1233 tristate "APM (Advanced Power Management) BIOS support"
969 depends on PM_SLEEP && !X86_VISWS 1234 depends on X86_32 && PM_SLEEP && !X86_VISWS
970 ---help--- 1235 ---help---
971 APM is a BIOS specification for saving power using several different 1236 APM is a BIOS specification for saving power using several different
972 techniques. This is mostly useful for battery powered laptops with 1237 techniques. This is mostly useful for battery powered laptops with
@@ -1092,13 +1357,14 @@ config APM_REAL_MODE_POWER_OFF
1092 1357
1093endif # APM 1358endif # APM
1094 1359
1095source "arch/x86/kernel/cpu/cpufreq/Kconfig_32" 1360source "arch/x86/kernel/cpu/cpufreq/Kconfig"
1096 1361
1097source "drivers/cpuidle/Kconfig" 1362source "drivers/cpuidle/Kconfig"
1098 1363
1099endmenu 1364endmenu
1100 1365
1101menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" 1366
1367menu "Bus options (PCI etc.)"
1102 1368
1103config PCI 1369config PCI
1104 bool "PCI support" if !X86_VISWS 1370 bool "PCI support" if !X86_VISWS
@@ -1118,7 +1384,7 @@ config PCI
1118 1384
1119choice 1385choice
1120 prompt "PCI access mode" 1386 prompt "PCI access mode"
1121 depends on PCI && !X86_VISWS 1387 depends on X86_32 && PCI && !X86_VISWS
1122 default PCI_GOANY 1388 default PCI_GOANY
1123 ---help--- 1389 ---help---
1124 On PCI systems, the BIOS can be used to detect the PCI devices and 1390 On PCI systems, the BIOS can be used to detect the PCI devices and
@@ -1151,17 +1417,18 @@ endchoice
1151 1417
1152config PCI_BIOS 1418config PCI_BIOS
1153 bool 1419 bool
1154 depends on !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY) 1420 depends on X86_32 && !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY)
1155 default y 1421 default y
1156 1422
1423# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
1157config PCI_DIRECT 1424config PCI_DIRECT
1158 bool 1425 bool
1159 depends on PCI && ((PCI_GODIRECT || PCI_GOANY) || X86_VISWS) 1426 depends on PCI && (X86_64 || (PCI_GODIRECT || PCI_GOANY) || X86_VISWS)
1160 default y 1427 default y
1161 1428
1162config PCI_MMCONFIG 1429config PCI_MMCONFIG
1163 bool 1430 bool
1164 depends on PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY) 1431 depends on X86_32 && PCI && ACPI && (PCI_GOMMCONFIG || PCI_GOANY)
1165 default y 1432 default y
1166 1433
1167config PCI_DOMAINS 1434config PCI_DOMAINS
@@ -1169,14 +1436,52 @@ config PCI_DOMAINS
1169 depends on PCI 1436 depends on PCI
1170 default y 1437 default y
1171 1438
1439config PCI_MMCONFIG
1440 bool "Support mmconfig PCI config space access"
1441 depends on X86_64 && PCI && ACPI
1442
1443config DMAR
1444 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
1445 depends on X86_64 && PCI_MSI && ACPI && EXPERIMENTAL
1446 help
1447 DMA remapping (DMAR) devices support enables independent address
1448 translations for Direct Memory Access (DMA) from devices.
1449 These DMA remapping devices are reported via ACPI tables
1450 and include PCI device scope covered by these DMA
1451 remapping devices.
1452
1453config DMAR_GFX_WA
1454 bool "Support for Graphics workaround"
1455 depends on DMAR
1456 default y
1457 help
1458 Current Graphics drivers tend to use physical address
1459 for DMA and avoid using DMA APIs. Setting this config
1460 option permits the IOMMU driver to set a unity map for
1461 all the OS-visible memory. Hence the driver can continue
1462 to use physical addresses for DMA.
1463
1464config DMAR_FLOPPY_WA
1465 bool
1466 depends on DMAR
1467 default y
1468 help
1469 Floppy disk drivers are know to bypass DMA API calls
1470 thereby failing to work when IOMMU is enabled. This
1471 workaround will setup a 1:1 mapping for the first
1472 16M to make floppy (an ISA device) work.
1473
1172source "drivers/pci/pcie/Kconfig" 1474source "drivers/pci/pcie/Kconfig"
1173 1475
1174source "drivers/pci/Kconfig" 1476source "drivers/pci/Kconfig"
1175 1477
1478# x86_64 have no ISA slots, but do have ISA-style DMA.
1176config ISA_DMA_API 1479config ISA_DMA_API
1177 bool 1480 bool
1178 default y 1481 default y
1179 1482
1483if X86_32
1484
1180config ISA 1485config ISA
1181 bool "ISA support" 1486 bool "ISA support"
1182 depends on !(X86_VOYAGER || X86_VISWS) 1487 depends on !(X86_VOYAGER || X86_VISWS)
@@ -1248,9 +1553,11 @@ config GEODE_MFGPT_TIMER
1248 MFGPTs have a better resolution and max interval than the 1553 MFGPTs have a better resolution and max interval than the
1249 generic PIT, and are suitable for use as high-res timers. 1554 generic PIT, and are suitable for use as high-res timers.
1250 1555
1556endif # X86_32
1557
1251config K8_NB 1558config K8_NB
1252 def_bool y 1559 def_bool y
1253 depends on AGP_AMD64 1560 depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA)))
1254 1561
1255source "drivers/pcmcia/Kconfig" 1562source "drivers/pcmcia/Kconfig"
1256 1563
@@ -1258,16 +1565,48 @@ source "drivers/pci/hotplug/Kconfig"
1258 1565
1259endmenu 1566endmenu
1260 1567
1261menu "Executable file formats" 1568
1569menu "Executable file formats / Emulations"
1262 1570
1263source "fs/Kconfig.binfmt" 1571source "fs/Kconfig.binfmt"
1264 1572
1573config IA32_EMULATION
1574 bool "IA32 Emulation"
1575 depends on X86_64
1576 help
1577 Include code to run 32-bit programs under a 64-bit kernel. You should
1578 likely turn this on, unless you're 100% sure that you don't have any
1579 32-bit programs left.
1580
1581config IA32_AOUT
1582 tristate "IA32 a.out support"
1583 depends on IA32_EMULATION
1584 help
1585 Support old a.out binaries in the 32bit emulation.
1586
1587config COMPAT
1588 bool
1589 depends on IA32_EMULATION
1590 default y
1591
1592config COMPAT_FOR_U64_ALIGNMENT
1593 def_bool COMPAT
1594 depends on X86_64
1595
1596config SYSVIPC_COMPAT
1597 bool
1598 depends on X86_64 && COMPAT && SYSVIPC
1599 default y
1600
1265endmenu 1601endmenu
1266 1602
1603
1267source "net/Kconfig" 1604source "net/Kconfig"
1268 1605
1269source "drivers/Kconfig" 1606source "drivers/Kconfig"
1270 1607
1608source "drivers/firmware/Kconfig"
1609
1271source "fs/Kconfig" 1610source "fs/Kconfig"
1272 1611
1273source "kernel/Kconfig.instrumentation" 1612source "kernel/Kconfig.instrumentation"
@@ -1279,43 +1618,3 @@ source "security/Kconfig"
1279source "crypto/Kconfig" 1618source "crypto/Kconfig"
1280 1619
1281source "lib/Kconfig" 1620source "lib/Kconfig"
1282
1283#
1284# Use the generic interrupt handling code in kernel/irq/:
1285#
1286config GENERIC_HARDIRQS
1287 bool
1288 default y
1289
1290config GENERIC_IRQ_PROBE
1291 bool
1292 default y
1293
1294config GENERIC_PENDING_IRQ
1295 bool
1296 depends on GENERIC_HARDIRQS && SMP
1297 default y
1298
1299config X86_SMP
1300 bool
1301 depends on SMP && !X86_VOYAGER
1302 default y
1303
1304config X86_HT
1305 bool
1306 depends on SMP && !(X86_VISWS || X86_VOYAGER)
1307 default y
1308
1309config X86_BIOS_REBOOT
1310 bool
1311 depends on !(X86_VISWS || X86_VOYAGER)
1312 default y
1313
1314config X86_TRAMPOLINE
1315 bool
1316 depends on X86_SMP || (X86_VOYAGER && SMP)
1317 default y
1318
1319config KTIME_SCALAR
1320 bool
1321 default y
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 0e2adadf5905..c30162202dc4 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -3,11 +3,12 @@ if !X86_ELAN
3 3
4choice 4choice
5 prompt "Processor family" 5 prompt "Processor family"
6 default M686 6 default M686 if X86_32
7 default GENERIC_CPU if X86_64
7 8
8config M386 9config M386
9 bool "386" 10 bool "386"
10 depends on !UML 11 depends on X86_32 && !UML
11 ---help--- 12 ---help---
12 This is the processor type of your CPU. This information is used for 13 This is the processor type of your CPU. This information is used for
13 optimizing purposes. In order to compile a kernel that can run on 14 optimizing purposes. In order to compile a kernel that can run on
@@ -49,6 +50,7 @@ config M386
49 50
50config M486 51config M486
51 bool "486" 52 bool "486"
53 depends on X86_32
52 help 54 help
53 Select this for a 486 series processor, either Intel or one of the 55 Select this for a 486 series processor, either Intel or one of the
54 compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX, 56 compatible processors from AMD, Cyrix, IBM, or Intel. Includes DX,
@@ -57,6 +59,7 @@ config M486
57 59
58config M586 60config M586
59 bool "586/K5/5x86/6x86/6x86MX" 61 bool "586/K5/5x86/6x86/6x86MX"
62 depends on X86_32
60 help 63 help
61 Select this for an 586 or 686 series processor such as the AMD K5, 64 Select this for an 586 or 686 series processor such as the AMD K5,
62 the Cyrix 5x86, 6x86 and 6x86MX. This choice does not 65 the Cyrix 5x86, 6x86 and 6x86MX. This choice does not
@@ -64,18 +67,21 @@ config M586
64 67
65config M586TSC 68config M586TSC
66 bool "Pentium-Classic" 69 bool "Pentium-Classic"
70 depends on X86_32
67 help 71 help
68 Select this for a Pentium Classic processor with the RDTSC (Read 72 Select this for a Pentium Classic processor with the RDTSC (Read
69 Time Stamp Counter) instruction for benchmarking. 73 Time Stamp Counter) instruction for benchmarking.
70 74
71config M586MMX 75config M586MMX
72 bool "Pentium-MMX" 76 bool "Pentium-MMX"
77 depends on X86_32
73 help 78 help
74 Select this for a Pentium with the MMX graphics/multimedia 79 Select this for a Pentium with the MMX graphics/multimedia
75 extended instructions. 80 extended instructions.
76 81
77config M686 82config M686
78 bool "Pentium-Pro" 83 bool "Pentium-Pro"
84 depends on X86_32
79 help 85 help
80 Select this for Intel Pentium Pro chips. This enables the use of 86 Select this for Intel Pentium Pro chips. This enables the use of
81 Pentium Pro extended instructions, and disables the init-time guard 87 Pentium Pro extended instructions, and disables the init-time guard
@@ -83,6 +89,7 @@ config M686
83 89
84config MPENTIUMII 90config MPENTIUMII
85 bool "Pentium-II/Celeron(pre-Coppermine)" 91 bool "Pentium-II/Celeron(pre-Coppermine)"
92 depends on X86_32
86 help 93 help
87 Select this for Intel chips based on the Pentium-II and 94 Select this for Intel chips based on the Pentium-II and
88 pre-Coppermine Celeron core. This option enables an unaligned 95 pre-Coppermine Celeron core. This option enables an unaligned
@@ -92,6 +99,7 @@ config MPENTIUMII
92 99
93config MPENTIUMIII 100config MPENTIUMIII
94 bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon" 101 bool "Pentium-III/Celeron(Coppermine)/Pentium-III Xeon"
102 depends on X86_32
95 help 103 help
96 Select this for Intel chips based on the Pentium-III and 104 Select this for Intel chips based on the Pentium-III and
97 Celeron-Coppermine core. This option enables use of some 105 Celeron-Coppermine core. This option enables use of some
@@ -100,19 +108,14 @@ config MPENTIUMIII
100 108
101config MPENTIUMM 109config MPENTIUMM
102 bool "Pentium M" 110 bool "Pentium M"
111 depends on X86_32
103 help 112 help
104 Select this for Intel Pentium M (not Pentium-4 M) 113 Select this for Intel Pentium M (not Pentium-4 M)
105 notebook chips. 114 notebook chips.
106 115
107config MCORE2
108 bool "Core 2/newer Xeon"
109 help
110 Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
111 CPUs. You can distinguish newer from older Xeons by the CPU family
112 in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo)
113
114config MPENTIUM4 116config MPENTIUM4
115 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon" 117 bool "Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon"
118 depends on X86_32
116 help 119 help
117 Select this for Intel Pentium 4 chips. This includes the 120 Select this for Intel Pentium 4 chips. This includes the
118 Pentium 4, Pentium D, P4-based Celeron and Xeon, and 121 Pentium 4, Pentium D, P4-based Celeron and Xeon, and
@@ -148,6 +151,7 @@ config MPENTIUM4
148 151
149config MK6 152config MK6
150 bool "K6/K6-II/K6-III" 153 bool "K6/K6-II/K6-III"
154 depends on X86_32
151 help 155 help
152 Select this for an AMD K6-family processor. Enables use of 156 Select this for an AMD K6-family processor. Enables use of
153 some extended instructions, and passes appropriate optimization 157 some extended instructions, and passes appropriate optimization
@@ -155,6 +159,7 @@ config MK6
155 159
156config MK7 160config MK7
157 bool "Athlon/Duron/K7" 161 bool "Athlon/Duron/K7"
162 depends on X86_32
158 help 163 help
159 Select this for an AMD Athlon K7-family processor. Enables use of 164 Select this for an AMD Athlon K7-family processor. Enables use of
160 some extended instructions, and passes appropriate optimization 165 some extended instructions, and passes appropriate optimization
@@ -169,6 +174,7 @@ config MK8
169 174
170config MCRUSOE 175config MCRUSOE
171 bool "Crusoe" 176 bool "Crusoe"
177 depends on X86_32
172 help 178 help
173 Select this for a Transmeta Crusoe processor. Treats the processor 179 Select this for a Transmeta Crusoe processor. Treats the processor
174 like a 586 with TSC, and sets some GCC optimization flags (like a 180 like a 586 with TSC, and sets some GCC optimization flags (like a
@@ -176,11 +182,13 @@ config MCRUSOE
176 182
177config MEFFICEON 183config MEFFICEON
178 bool "Efficeon" 184 bool "Efficeon"
185 depends on X86_32
179 help 186 help
180 Select this for a Transmeta Efficeon processor. 187 Select this for a Transmeta Efficeon processor.
181 188
182config MWINCHIPC6 189config MWINCHIPC6
183 bool "Winchip-C6" 190 bool "Winchip-C6"
191 depends on X86_32
184 help 192 help
185 Select this for an IDT Winchip C6 chip. Linux and GCC 193 Select this for an IDT Winchip C6 chip. Linux and GCC
186 treat this chip as a 586TSC with some extended instructions 194 treat this chip as a 586TSC with some extended instructions
@@ -188,6 +196,7 @@ config MWINCHIPC6
188 196
189config MWINCHIP2 197config MWINCHIP2
190 bool "Winchip-2" 198 bool "Winchip-2"
199 depends on X86_32
191 help 200 help
192 Select this for an IDT Winchip-2. Linux and GCC 201 Select this for an IDT Winchip-2. Linux and GCC
193 treat this chip as a 586TSC with some extended instructions 202 treat this chip as a 586TSC with some extended instructions
@@ -195,6 +204,7 @@ config MWINCHIP2
195 204
196config MWINCHIP3D 205config MWINCHIP3D
197 bool "Winchip-2A/Winchip-3" 206 bool "Winchip-2A/Winchip-3"
207 depends on X86_32
198 help 208 help
199 Select this for an IDT Winchip-2A or 3. Linux and GCC 209 Select this for an IDT Winchip-2A or 3. Linux and GCC
200 treat this chip as a 586TSC with some extended instructions 210 treat this chip as a 586TSC with some extended instructions
@@ -204,16 +214,19 @@ config MWINCHIP3D
204 214
205config MGEODEGX1 215config MGEODEGX1
206 bool "GeodeGX1" 216 bool "GeodeGX1"
217 depends on X86_32
207 help 218 help
208 Select this for a Geode GX1 (Cyrix MediaGX) chip. 219 Select this for a Geode GX1 (Cyrix MediaGX) chip.
209 220
210config MGEODE_LX 221config MGEODE_LX
211 bool "Geode GX/LX" 222 bool "Geode GX/LX"
223 depends on X86_32
212 help 224 help
213 Select this for AMD Geode GX and LX processors. 225 Select this for AMD Geode GX and LX processors.
214 226
215config MCYRIXIII 227config MCYRIXIII
216 bool "CyrixIII/VIA-C3" 228 bool "CyrixIII/VIA-C3"
229 depends on X86_32
217 help 230 help
218 Select this for a Cyrix III or C3 chip. Presently Linux and GCC 231 Select this for a Cyrix III or C3 chip. Presently Linux and GCC
219 treat this chip as a generic 586. Whilst the CPU is 686 class, 232 treat this chip as a generic 586. Whilst the CPU is 686 class,
@@ -225,6 +238,7 @@ config MCYRIXIII
225 238
226config MVIAC3_2 239config MVIAC3_2
227 bool "VIA C3-2 (Nehemiah)" 240 bool "VIA C3-2 (Nehemiah)"
241 depends on X86_32
228 help 242 help
229 Select this for a VIA C3 "Nehemiah". Selecting this enables usage 243 Select this for a VIA C3 "Nehemiah". Selecting this enables usage
230 of SSE and tells gcc to treat the CPU as a 686. 244 of SSE and tells gcc to treat the CPU as a 686.
@@ -232,15 +246,42 @@ config MVIAC3_2
232 246
233config MVIAC7 247config MVIAC7
234 bool "VIA C7" 248 bool "VIA C7"
249 depends on X86_32
235 help 250 help
236 Select this for a VIA C7. Selecting this uses the correct cache 251 Select this for a VIA C7. Selecting this uses the correct cache
237 shift and tells gcc to treat the CPU as a 686. 252 shift and tells gcc to treat the CPU as a 686.
238 253
254config MPSC
255 bool "Intel P4 / older Netburst based Xeon"
256 depends on X86_64
257 help
258 Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey
259 Xeon CPUs with Intel 64bit which is compatible with x86-64.
260 Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the
261 Netburst core and shouldn't use this option. You can distinguish them
262 using the cpu family field
263 in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.
264
265config MCORE2
266 bool "Core 2/newer Xeon"
267 help
268 Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
269 CPUs. You can distinguish newer from older Xeons by the CPU family
270 in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo)
271
272config GENERIC_CPU
273 bool "Generic-x86-64"
274 depends on X86_64
275 help
276 Generic x86-64 CPU.
277 Run equally well on all x86-64 CPUs.
278
239endchoice 279endchoice
240 280
241config X86_GENERIC 281config X86_GENERIC
242 bool "Generic x86 support" 282 bool "Generic x86 support"
243 help 283 depends on X86_32
284 help
244 Instead of just including optimizations for the selected 285 Instead of just including optimizations for the selected
245 x86 variant (e.g. PII, Crusoe or Athlon), include some more 286 x86 variant (e.g. PII, Crusoe or Athlon), include some more
246 generic optimizations as well. This will make the kernel 287 generic optimizations as well. This will make the kernel
@@ -253,44 +294,31 @@ endif
253 294
254# 295#
255# Define implied options from the CPU selection here 296# Define implied options from the CPU selection here
256# 297config X86_L1_CACHE_BYTES
298 int
299 default "128" if GENERIC_CPU || MPSC
300 default "64" if MK8 || MCORE2
301 depends on X86_64
302
303config X86_INTERNODE_CACHE_BYTES
304 int
305 default "4096" if X86_VSMP
306 default X86_L1_CACHE_BYTES if !X86_VSMP
307 depends on X86_64
308
257config X86_CMPXCHG 309config X86_CMPXCHG
258 bool 310 def_bool X86_64 || (X86_32 && !M386)
259 depends on !M386
260 default y
261 311
262config X86_L1_CACHE_SHIFT 312config X86_L1_CACHE_SHIFT
263 int 313 int
264 default "7" if MPENTIUM4 || X86_GENERIC 314 default "7" if MPENTIUM4 || X86_GENERIC || GENERIC_CPU || MPSC
265 default "4" if X86_ELAN || M486 || M386 || MGEODEGX1 315 default "4" if X86_ELAN || M486 || M386 || MGEODEGX1
266 default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX 316 default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
267 default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7 317 default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MVIAC7
268 318
269config X86_XADD 319config X86_XADD
270 bool 320 bool
271 depends on !M386 321 depends on X86_32 && !M386
272 default y
273
274config RWSEM_GENERIC_SPINLOCK
275 bool
276 depends on !X86_XADD
277 default y
278
279config RWSEM_XCHGADD_ALGORITHM
280 bool
281 depends on X86_XADD
282 default y
283
284config ARCH_HAS_ILOG2_U32
285 bool
286 default n
287
288config ARCH_HAS_ILOG2_U64
289 bool
290 default n
291
292config GENERIC_CALIBRATE_DELAY
293 bool
294 default y 322 default y
295 323
296config X86_PPRO_FENCE 324config X86_PPRO_FENCE
@@ -305,22 +333,22 @@ config X86_F00F_BUG
305 333
306config X86_WP_WORKS_OK 334config X86_WP_WORKS_OK
307 bool 335 bool
308 depends on !M386 336 depends on X86_32 && !M386
309 default y 337 default y
310 338
311config X86_INVLPG 339config X86_INVLPG
312 bool 340 bool
313 depends on !M386 341 depends on X86_32 && !M386
314 default y 342 default y
315 343
316config X86_BSWAP 344config X86_BSWAP
317 bool 345 bool
318 depends on !M386 346 depends on X86_32 && !M386
319 default y 347 default y
320 348
321config X86_POPAD_OK 349config X86_POPAD_OK
322 bool 350 bool
323 depends on !M386 351 depends on X86_32 && !M386
324 default y 352 default y
325 353
326config X86_ALIGNMENT_16 354config X86_ALIGNMENT_16
@@ -330,7 +358,7 @@ config X86_ALIGNMENT_16
330 358
331config X86_GOOD_APIC 359config X86_GOOD_APIC
332 bool 360 bool
333 depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 361 depends on MK7 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || MK8 || MEFFICEON || MCORE2 || MVIAC7 || X86_64
334 default y 362 default y
335 363
336config X86_INTEL_USERCOPY 364config X86_INTEL_USERCOPY
@@ -355,7 +383,7 @@ config X86_OOSTORE
355 383
356config X86_TSC 384config X86_TSC
357 bool 385 bool
358 depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ 386 depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64
359 default y 387 default y
360 388
361# this should be set for all -march=.. options where the compiler 389# this should be set for all -march=.. options where the compiler
@@ -367,6 +395,7 @@ config X86_CMOV
367 395
368config X86_MINIMUM_CPU_FAMILY 396config X86_MINIMUM_CPU_FAMILY
369 int 397 int
370 default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK 398 default "64" if X86_64
399 default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK)
371 default "3" 400 default "3"
372 401
diff --git a/arch/x86/Kconfig.x86_64 b/arch/x86/Kconfig.x86_64
deleted file mode 100644
index cc468ea61240..000000000000
--- a/arch/x86/Kconfig.x86_64
+++ /dev/null
@@ -1,839 +0,0 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5# Note: ISA is disabled and will hopefully never be enabled.
6# If you managed to buy an ISA x86-64 box you'll have to fix all the
7# ISA drivers you need yourself.
8#
9
10mainmenu "Linux Kernel Configuration"
11
12config X86_64
13 bool
14 default y
15 help
16 Port to the x86-64 architecture. x86-64 is a 64-bit extension to the
17 classical 32-bit x86 architecture. For details see
18 <http://www.x86-64.org/>.
19
20config 64BIT
21 def_bool y
22
23config X86
24 bool
25 default y
26
27config GENERIC_TIME
28 bool
29 default y
30
31config GENERIC_TIME_VSYSCALL
32 bool
33 default y
34
35config GENERIC_CMOS_UPDATE
36 bool
37 default y
38
39config CLOCKSOURCE_WATCHDOG
40 bool
41 default y
42
43config GENERIC_CLOCKEVENTS
44 bool
45 default y
46
47config GENERIC_CLOCKEVENTS_BROADCAST
48 bool
49 default y
50
51config ZONE_DMA32
52 bool
53 default y
54
55config LOCKDEP_SUPPORT
56 bool
57 default y
58
59config STACKTRACE_SUPPORT
60 bool
61 default y
62
63config SEMAPHORE_SLEEPERS
64 bool
65 default y
66
67config MMU
68 bool
69 default y
70
71config ZONE_DMA
72 bool
73 default y
74
75config ISA
76 bool
77
78config SBUS
79 bool
80
81config RWSEM_GENERIC_SPINLOCK
82 bool
83 default y
84
85config RWSEM_XCHGADD_ALGORITHM
86 bool
87
88config GENERIC_HWEIGHT
89 bool
90 default y
91
92config GENERIC_CALIBRATE_DELAY
93 bool
94 default y
95
96config X86_CMPXCHG
97 bool
98 default y
99
100config GENERIC_ISA_DMA
101 bool
102 default y
103
104config GENERIC_IOMAP
105 bool
106 default y
107
108config ARCH_MAY_HAVE_PC_FDC
109 bool
110 default y
111
112config ARCH_POPULATES_NODE_MAP
113 def_bool y
114
115config DMI
116 bool
117 default y
118
119config AUDIT_ARCH
120 bool
121 default y
122
123config GENERIC_BUG
124 bool
125 default y
126 depends on BUG
127
128config ARCH_HAS_ILOG2_U32
129 bool
130 default n
131
132config ARCH_HAS_ILOG2_U64
133 bool
134 default n
135
136source "init/Kconfig"
137
138
139menu "Processor type and features"
140
141source "kernel/time/Kconfig"
142
143choice
144 prompt "Subarchitecture Type"
145 default X86_PC
146
147config X86_PC
148 bool "PC-compatible"
149 help
150 Choose this option if your computer is a standard PC or compatible.
151
152config X86_VSMP
153 bool "Support for ScaleMP vSMP"
154 depends on PCI
155 help
156 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is
157 supposed to run on these EM64T-based machines. Only choose this option
158 if you have one of these machines.
159
160endchoice
161
162choice
163 prompt "Processor family"
164 default GENERIC_CPU
165
166config MK8
167 bool "AMD-Opteron/Athlon64"
168 help
169 Optimize for AMD Opteron/Athlon64/Hammer/K8 CPUs.
170
171config MPSC
172 bool "Intel P4 / older Netburst based Xeon"
173 help
174 Optimize for Intel Pentium 4, Pentium D and older Nocona/Dempsey
175 Xeon CPUs with Intel 64bit which is compatible with x86-64.
176 Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the
177 Netburst core and shouldn't use this option. You can distinguish them
178 using the cpu family field
179 in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one.
180
181config MCORE2
182 bool "Intel Core2 / newer Xeon"
183 help
184 Optimize for Intel Core2 and newer Xeons (51xx)
185 You can distinguish the newer Xeons from the older ones using
186 the cpu family field in /proc/cpuinfo. 15 is an older Xeon
187 (use CONFIG_MPSC then), 6 is a newer one.
188
189config GENERIC_CPU
190 bool "Generic-x86-64"
191 help
192 Generic x86-64 CPU.
193 Run equally well on all x86-64 CPUs.
194
195endchoice
196
197#
198# Define implied options from the CPU selection here
199#
200config X86_L1_CACHE_BYTES
201 int
202 default "128" if GENERIC_CPU || MPSC
203 default "64" if MK8 || MCORE2
204
205config X86_L1_CACHE_SHIFT
206 int
207 default "7" if GENERIC_CPU || MPSC
208 default "6" if MK8 || MCORE2
209
210config X86_INTERNODE_CACHE_BYTES
211 int
212 default "4096" if X86_VSMP
213 default X86_L1_CACHE_BYTES if !X86_VSMP
214
215config X86_TSC
216 bool
217 default y
218
219config X86_GOOD_APIC
220 bool
221 default y
222
223config MICROCODE
224 tristate "/dev/cpu/microcode - Intel CPU microcode support"
225 select FW_LOADER
226 ---help---
227 If you say Y here the 'File systems' section, you will be
228 able to update the microcode on Intel processors. You will
229 obviously need the actual microcode binary data itself which is
230 not shipped with the Linux kernel.
231
232 For latest news and information on obtaining all the required
233 ingredients for this driver, check:
234 <http://www.urbanmyth.org/microcode/>.
235
236 To compile this driver as a module, choose M here: the
237 module will be called microcode.
238 If you use modprobe or kmod you may also want to add the line
239 'alias char-major-10-184 microcode' to your /etc/modules.conf file.
240
241config MICROCODE_OLD_INTERFACE
242 bool
243 depends on MICROCODE
244 default y
245
246config X86_MSR
247 tristate "/dev/cpu/*/msr - Model-specific register support"
248 help
249 This device gives privileged processes access to the x86
250 Model-Specific Registers (MSRs). It is a character device with
251 major 202 and minors 0 to 31 for /dev/cpu/0/msr to /dev/cpu/31/msr.
252 MSR accesses are directed to a specific CPU on multi-processor
253 systems.
254
255config X86_CPUID
256 tristate "/dev/cpu/*/cpuid - CPU information support"
257 help
258 This device gives processes access to the x86 CPUID instruction to
259 be executed on a specific processor. It is a character device
260 with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
261 /dev/cpu/31/cpuid.
262
263config X86_HT
264 bool
265 depends on SMP && !MK8
266 default y
267
268config MATH_EMULATION
269 bool
270
271config MCA
272 bool
273
274config EISA
275 bool
276
277config X86_IO_APIC
278 bool
279 default y
280
281config X86_LOCAL_APIC
282 bool
283 default y
284
285config MTRR
286 bool "MTRR (Memory Type Range Register) support"
287 ---help---
288 On Intel P6 family processors (Pentium Pro, Pentium II and later)
289 the Memory Type Range Registers (MTRRs) may be used to control
290 processor access to memory ranges. This is most useful if you have
291 a video (VGA) card on a PCI or AGP bus. Enabling write-combining
292 allows bus write transfers to be combined into a larger transfer
293 before bursting over the PCI/AGP bus. This can increase performance
294 of image write operations 2.5 times or more. Saying Y here creates a
295 /proc/mtrr file which may be used to manipulate your processor's
296 MTRRs. Typically the X server should use this.
297
298 This code has a reasonably generic interface so that similar
299 control registers on other processors can be easily supported
300 as well.
301
302 Saying Y here also fixes a problem with buggy SMP BIOSes which only
303 set the MTRRs for the boot CPU and not for the secondary CPUs. This
304 can lead to all sorts of problems, so it's good to say Y here.
305
306 Just say Y here, all x86-64 machines support MTRRs.
307
308 See <file:Documentation/mtrr.txt> for more information.
309
310config SMP
311 bool "Symmetric multi-processing support"
312 ---help---
313 This enables support for systems with more than one CPU. If you have
314 a system with only one CPU, like most personal computers, say N. If
315 you have a system with more than one CPU, say Y.
316
317 If you say N here, the kernel will run on single and multiprocessor
318 machines, but will use only one CPU of a multiprocessor machine. If
319 you say Y here, the kernel will run on many, but not all,
320 singleprocessor machines. On a singleprocessor machine, the kernel
321 will run faster if you say N here.
322
323 If you don't know what to do here, say N.
324
325config SCHED_SMT
326 bool "SMT (Hyperthreading) scheduler support"
327 depends on SMP
328 default n
329 help
330 SMT scheduler support improves the CPU scheduler's decision making
331 when dealing with Intel Pentium 4 chips with HyperThreading at a
332 cost of slightly increased overhead in some places. If unsure say
333 N here.
334
335config SCHED_MC
336 bool "Multi-core scheduler support"
337 depends on SMP
338 default y
339 help
340 Multi-core scheduler support improves the CPU scheduler's decision
341 making when dealing with multi-core CPU chips at a cost of slightly
342 increased overhead in some places. If unsure say N here.
343
344source "kernel/Kconfig.preempt"
345
346config NUMA
347 bool "Non Uniform Memory Access (NUMA) Support"
348 depends on SMP
349 help
350 Enable NUMA (Non Uniform Memory Access) support. The kernel
351 will try to allocate memory used by a CPU on the local memory
352 controller of the CPU and add some more NUMA awareness to the kernel.
353 This code is recommended on all multiprocessor Opteron systems.
354 If the system is EM64T, you should say N unless your system is EM64T
355 NUMA.
356
357config K8_NUMA
358 bool "Old style AMD Opteron NUMA detection"
359 depends on NUMA && PCI
360 default y
361 help
362 Enable K8 NUMA node topology detection. You should say Y here if
363 you have a multi processor AMD K8 system. This uses an old
364 method to read the NUMA configuration directly from the builtin
365 Northbridge of Opteron. It is recommended to use X86_64_ACPI_NUMA
366 instead, which also takes priority if both are compiled in.
367
368config NODES_SHIFT
369 int
370 default "6"
371 depends on NEED_MULTIPLE_NODES
372
373# Dummy CONFIG option to select ACPI_NUMA from drivers/acpi/Kconfig.
374
375config X86_64_ACPI_NUMA
376 bool "ACPI NUMA detection"
377 depends on NUMA
378 select ACPI
379 select PCI
380 select ACPI_NUMA
381 default y
382 help
383 Enable ACPI SRAT based node topology detection.
384
385config NUMA_EMU
386 bool "NUMA emulation"
387 depends on NUMA
388 help
389 Enable NUMA emulation. A flat machine will be split
390 into virtual nodes when booted with "numa=fake=N", where N is the
391 number of nodes. This is only useful for debugging.
392
393config ARCH_DISCONTIGMEM_ENABLE
394 bool
395 depends on NUMA
396 default y
397
398config ARCH_DISCONTIGMEM_DEFAULT
399 def_bool y
400 depends on NUMA
401
402config ARCH_SPARSEMEM_ENABLE
403 def_bool y
404 depends on (NUMA || EXPERIMENTAL)
405 select SPARSEMEM_VMEMMAP_ENABLE
406
407config ARCH_MEMORY_PROBE
408 def_bool y
409 depends on MEMORY_HOTPLUG
410
411config ARCH_FLATMEM_ENABLE
412 def_bool y
413 depends on !NUMA
414
415source "mm/Kconfig"
416
417config MEMORY_HOTPLUG_RESERVE
418 def_bool y
419 depends on (MEMORY_HOTPLUG && DISCONTIGMEM)
420
421config HAVE_ARCH_EARLY_PFN_TO_NID
422 def_bool y
423 depends on NUMA
424
425config OUT_OF_LINE_PFN_TO_PAGE
426 def_bool y
427 depends on DISCONTIGMEM
428
429config NR_CPUS
430 int "Maximum number of CPUs (2-255)"
431 range 2 255
432 depends on SMP
433 default "8"
434 help
435 This allows you to specify the maximum number of CPUs which this
436 kernel will support. Current maximum is 255 CPUs due to
437 APIC addressing limits. Less depending on the hardware.
438
439 This is purely to save memory - each supported CPU requires
440 memory in the static kernel configuration.
441
442config PHYSICAL_ALIGN
443 hex
444 default "0x200000"
445
446config HOTPLUG_CPU
447 bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)"
448 depends on SMP && HOTPLUG && EXPERIMENTAL
449 help
450 Say Y here to experiment with turning CPUs off and on. CPUs
451 can be controlled through /sys/devices/system/cpu/cpu#.
452 This is also required for suspend/hibernation on SMP systems.
453
454 Say N if you want to disable CPU hotplug and don't need to
455 suspend.
456
457config ARCH_ENABLE_MEMORY_HOTPLUG
458 def_bool y
459
460config HPET_TIMER
461 bool
462 default y
463 help
464 Use the IA-PC HPET (High Precision Event Timer) to manage
465 time in preference to the PIT and RTC, if a HPET is
466 present. The HPET provides a stable time base on SMP
467 systems, unlike the TSC, but it is more expensive to access,
468 as it is off-chip. You can find the HPET spec at
469 <http://www.intel.com/hardwaredesign/hpetspec.htm>.
470
471config HPET_EMULATE_RTC
472 bool
473 depends on HPET_TIMER && RTC=y
474 default y
475
476# Mark as embedded because too many people got it wrong.
477# The code disables itself when not needed.
478config GART_IOMMU
479 bool "GART IOMMU support" if EMBEDDED
480 default y
481 select SWIOTLB
482 select AGP
483 depends on PCI
484 help
485 Support for full DMA access of devices with 32bit memory access only
486 on systems with more than 3GB. This is usually needed for USB,
487 sound, many IDE/SATA chipsets and some other devices.
488 Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART
489 based hardware IOMMU and a software bounce buffer based IOMMU used
490 on Intel systems and as fallback.
491 The code is only active when needed (enough memory and limited
492 device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified
493 too.
494
495config CALGARY_IOMMU
496 bool "IBM Calgary IOMMU support"
497 select SWIOTLB
498 depends on PCI && EXPERIMENTAL
499 help
500 Support for hardware IOMMUs in IBM's xSeries x366 and x460
501 systems. Needed to run systems with more than 3GB of memory
502 properly with 32-bit PCI devices that do not support DAC
503 (Double Address Cycle). Calgary also supports bus level
504 isolation, where all DMAs pass through the IOMMU. This
505 prevents them from going anywhere except their intended
506 destination. This catches hard-to-find kernel bugs and
507 mis-behaving drivers and devices that do not use the DMA-API
508 properly to set up their DMA buffers. The IOMMU can be
509 turned off at boot time with the iommu=off parameter.
510 Normally the kernel will make the right choice by itself.
511 If unsure, say Y.
512
513config CALGARY_IOMMU_ENABLED_BY_DEFAULT
514 bool "Should Calgary be enabled by default?"
515 default y
516 depends on CALGARY_IOMMU
517 help
518 Should Calgary be enabled by default? if you choose 'y', Calgary
519 will be used (if it exists). If you choose 'n', Calgary will not be
520 used even if it exists. If you choose 'n' and would like to use
521 Calgary anyway, pass 'iommu=calgary' on the kernel command line.
522 If unsure, say Y.
523
524# need this always selected by IOMMU for the VIA workaround
525config SWIOTLB
526 bool
527 help
528 Support for software bounce buffers used on x86-64 systems
529 which don't have a hardware IOMMU (e.g. the current generation
530 of Intel's x86-64 CPUs). Using this PCI devices which can only
531 access 32-bits of memory can be used on systems with more than
532 3 GB of memory. If unsure, say Y.
533
534config X86_MCE
535 bool "Machine check support" if EMBEDDED
536 default y
537 help
538 Include a machine check error handler to report hardware errors.
539 This version will require the mcelog utility to decode some
540 machine check error logs. See
541 ftp://ftp.x86-64.org/pub/linux/tools/mcelog
542
543config X86_MCE_INTEL
544 bool "Intel MCE features"
545 depends on X86_MCE && X86_LOCAL_APIC
546 default y
547 help
548 Additional support for intel specific MCE features such as
549 the thermal monitor.
550
551config X86_MCE_AMD
552 bool "AMD MCE features"
553 depends on X86_MCE && X86_LOCAL_APIC
554 default y
555 help
556 Additional support for AMD specific MCE features such as
557 the DRAM Error Threshold.
558
559config KEXEC
560 bool "kexec system call"
561 help
562 kexec is a system call that implements the ability to shutdown your
563 current kernel, and to start another kernel. It is like a reboot
564 but it is independent of the system firmware. And like a reboot
565 you can start any kernel with it, not just Linux.
566
567 The name comes from the similarity to the exec system call.
568
569 It is an ongoing process to be certain the hardware in a machine
570 is properly shutdown, so do not be surprised if this code does not
571 initially work for you. It may help to enable device hotplugging
572 support. As of this writing the exact hardware interface is
573 strongly in flux, so no good recommendation can be made.
574
575config CRASH_DUMP
576 bool "kernel crash dumps (EXPERIMENTAL)"
577 depends on EXPERIMENTAL
578 help
579 Generate crash dump after being started by kexec.
580 This should be normally only set in special crash dump kernels
581 which are loaded in the main kernel with kexec-tools into
582 a specially reserved region and then later executed after
583 a crash by kdump/kexec. The crash dump kernel must be compiled
584 to a memory address not used by the main kernel or BIOS using
585 PHYSICAL_START, or it must be built as a relocatable image
586 (CONFIG_RELOCATABLE=y).
587 For more details see Documentation/kdump/kdump.txt
588
589config RELOCATABLE
590 bool "Build a relocatable kernel (EXPERIMENTAL)"
591 depends on EXPERIMENTAL
592 help
593 Builds a relocatable kernel. This enables loading and running
594 a kernel binary from a different physical address than it has
595 been compiled for.
596
597 One use is for the kexec on panic case where the recovery kernel
598 must live at a different physical address than the primary
599 kernel.
600
601 Note: If CONFIG_RELOCATABLE=y, then the kernel runs from the address
602 it has been loaded at and the compile time physical address
603 (CONFIG_PHYSICAL_START) is ignored.
604
605config PHYSICAL_START
606 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
607 default "0x200000"
608 help
609 This gives the physical address where the kernel is loaded. It
610 should be aligned to 2MB boundary.
611
612 If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then
613 bzImage will decompress itself to above physical address and
614 run from there. Otherwise, bzImage will run from the address where
615 it has been loaded by the boot loader and will ignore above physical
616 address.
617
618 In normal kdump cases one does not have to set/change this option
619 as now bzImage can be compiled as a completely relocatable image
620 (CONFIG_RELOCATABLE=y) and be used to load and run from a different
621 address. This option is mainly useful for the folks who don't want
622 to use a bzImage for capturing the crash dump and want to use a
623 vmlinux instead.
624
625 So if you are using bzImage for capturing the crash dump, leave
626 the value here unchanged to 0x200000 and set CONFIG_RELOCATABLE=y.
627 Otherwise if you plan to use vmlinux for capturing the crash dump
628 change this value to start of the reserved region (Typically 16MB
629 0x1000000). In other words, it can be set based on the "X" value as
630 specified in the "crashkernel=YM@XM" command line boot parameter
631 passed to the panic-ed kernel. Typically this parameter is set as
632 crashkernel=64M@16M. Please take a look at
633 Documentation/kdump/kdump.txt for more details about crash dumps.
634
635 Usage of bzImage for capturing the crash dump is advantageous as
636 one does not have to build two kernels. Same kernel can be used
637 as production kernel and capture kernel.
638
639 Don't change this unless you know what you are doing.
640
641config SECCOMP
642 bool "Enable seccomp to safely compute untrusted bytecode"
643 depends on PROC_FS
644 default y
645 help
646 This kernel feature is useful for number crunching applications
647 that may need to compute untrusted bytecode during their
648 execution. By using pipes or other transports made available to
649 the process as file descriptors supporting the read/write
650 syscalls, it's possible to isolate those applications in
651 their own address space using seccomp. Once seccomp is
652 enabled via /proc/<pid>/seccomp, it cannot be disabled
653 and the task is only allowed to execute a few safe syscalls
654 defined by each seccomp mode.
655
656 If unsure, say Y. Only embedded should say N here.
657
658config CC_STACKPROTECTOR
659 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
660 depends on EXPERIMENTAL
661 help
662 This option turns on the -fstack-protector GCC feature. This
663 feature puts, at the beginning of critical functions, a canary
664 value on the stack just before the return address, and validates
665 the value just before actually returning. Stack based buffer
666 overflows (that need to overwrite this return address) now also
667 overwrite the canary, which gets detected and the attack is then
668 neutralized via a kernel panic.
669
670 This feature requires gcc version 4.2 or above, or a distribution
671 gcc with the feature backported. Older versions are automatically
672 detected and for those versions, this configuration option is ignored.
673
674config CC_STACKPROTECTOR_ALL
675 bool "Use stack-protector for all functions"
676 depends on CC_STACKPROTECTOR
677 help
678 Normally, GCC only inserts the canary value protection for
679 functions that use large-ish on-stack buffers. By enabling
680 this option, GCC will be asked to do this for ALL functions.
681
682source kernel/Kconfig.hz
683
684config K8_NB
685 def_bool y
686 depends on AGP_AMD64 || GART_IOMMU || (PCI && NUMA)
687
688endmenu
689
690#
691# Use the generic interrupt handling code in kernel/irq/:
692#
693config GENERIC_HARDIRQS
694 bool
695 default y
696
697config GENERIC_IRQ_PROBE
698 bool
699 default y
700
701# we have no ISA slots, but we do have ISA-style DMA.
702config ISA_DMA_API
703 bool
704 default y
705
706config GENERIC_PENDING_IRQ
707 bool
708 depends on GENERIC_HARDIRQS && SMP
709 default y
710
711menu "Power management options"
712
713source kernel/power/Kconfig
714
715config ARCH_HIBERNATION_HEADER
716 bool
717 depends on HIBERNATION
718 default y
719
720source "drivers/acpi/Kconfig"
721
722source "arch/x86/kernel/cpu/cpufreq/Kconfig_64"
723
724source "drivers/cpuidle/Kconfig"
725
726endmenu
727
728menu "Bus options (PCI etc.)"
729
730config PCI
731 bool "PCI support"
732 select ARCH_SUPPORTS_MSI if (X86_LOCAL_APIC && X86_IO_APIC)
733
734# x86-64 doesn't support PCI BIOS access from long mode so always go direct.
735config PCI_DIRECT
736 bool
737 depends on PCI
738 default y
739
740config PCI_MMCONFIG
741 bool "Support mmconfig PCI config space access"
742 depends on PCI && ACPI
743
744config PCI_DOMAINS
745 bool
746 depends on PCI
747 default y
748
749config DMAR
750 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
751 depends on PCI_MSI && ACPI && EXPERIMENTAL
752 help
753 DMA remapping (DMAR) devices support enables independent address
754 translations for Direct Memory Access (DMA) from devices.
755 These DMA remapping devices are reported via ACPI tables
756 and include PCI device scope covered by these DMA
757 remapping devices.
758
759config DMAR_GFX_WA
760 bool "Support for Graphics workaround"
761 depends on DMAR
762 default y
763 help
764 Current Graphics drivers tend to use physical address
765 for DMA and avoid using DMA APIs. Setting this config
766 option permits the IOMMU driver to set a unity map for
767 all the OS-visible memory. Hence the driver can continue
768 to use physical addresses for DMA.
769
770config DMAR_FLOPPY_WA
771 bool
772 depends on DMAR
773 default y
774 help
775 Floppy disk drivers are know to bypass DMA API calls
776 thereby failing to work when IOMMU is enabled. This
777 workaround will setup a 1:1 mapping for the first
778 16M to make floppy (an ISA device) work.
779
780source "drivers/pci/pcie/Kconfig"
781
782source "drivers/pci/Kconfig"
783
784source "drivers/pcmcia/Kconfig"
785
786source "drivers/pci/hotplug/Kconfig"
787
788endmenu
789
790
791menu "Executable file formats / Emulations"
792
793source "fs/Kconfig.binfmt"
794
795config IA32_EMULATION
796 bool "IA32 Emulation"
797 help
798 Include code to run 32-bit programs under a 64-bit kernel. You should
799 likely turn this on, unless you're 100% sure that you don't have any
800 32-bit programs left.
801
802config IA32_AOUT
803 tristate "IA32 a.out support"
804 depends on IA32_EMULATION
805 help
806 Support old a.out binaries in the 32bit emulation.
807
808config COMPAT
809 bool
810 depends on IA32_EMULATION
811 default y
812
813config COMPAT_FOR_U64_ALIGNMENT
814 def_bool COMPAT
815
816config SYSVIPC_COMPAT
817 bool
818 depends on COMPAT && SYSVIPC
819 default y
820
821endmenu
822
823source "net/Kconfig"
824
825source drivers/Kconfig
826
827source "drivers/firmware/Kconfig"
828
829source fs/Kconfig
830
831source "kernel/Kconfig.instrumentation"
832
833source "arch/x86/Kconfig.debug"
834
835source "security/Kconfig"
836
837source "crypto/Kconfig"
838
839source "lib/Kconfig"
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 309597386a77..116b03a45636 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -1,12 +1,16 @@
1# Unified Makefile for i386 and x86_64 1# Unified Makefile for i386 and x86_64
2 2
3# select defconfig based on actual architecture 3# select defconfig based on actual architecture
4KBUILD_DEFCONFIG := $(ARCH)_defconfig 4ifeq ($(ARCH),x86)
5 KBUILD_DEFCONFIG := i386_defconfig
6else
7 KBUILD_DEFCONFIG := $(ARCH)_defconfig
8endif
5 9
6# # No need to remake these files 10# No need to remake these files
7$(srctree)/arch/x86/Makefile%: ; 11$(srctree)/arch/x86/Makefile%: ;
8 12
9ifeq ($(ARCH),i386) 13ifeq ($(CONFIG_X86_32),y)
10 include $(srctree)/arch/x86/Makefile_32 14 include $(srctree)/arch/x86/Makefile_32
11else 15else
12 include $(srctree)/arch/x86/Makefile_64 16 include $(srctree)/arch/x86/Makefile_64
diff --git a/arch/x86/Makefile_32 b/arch/x86/Makefile_32
index 346ac0766875..50394da2f6c1 100644
--- a/arch/x86/Makefile_32
+++ b/arch/x86/Makefile_32
@@ -160,7 +160,7 @@ archclean:
160 $(Q)$(MAKE) $(clean)=arch/x86/boot 160 $(Q)$(MAKE) $(clean)=arch/x86/boot
161 161
162define archhelp 162define archhelp
163 echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' 163 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
164 echo ' install - Install kernel using' 164 echo ' install - Install kernel using'
165 echo ' (your) ~/bin/installkernel or' 165 echo ' (your) ~/bin/installkernel or'
166 echo ' (distribution) /sbin/installkernel or' 166 echo ' (distribution) /sbin/installkernel or'
@@ -170,6 +170,6 @@ define archhelp
170 echo ' isoimage - Create a boot CD-ROM image' 170 echo ' isoimage - Create a boot CD-ROM image'
171endef 171endef
172 172
173CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ 173CLEAN_FILES += arch/x86/boot/fdimage \
174 arch/$(ARCH)/boot/image.iso \ 174 arch/x86/boot/image.iso \
175 arch/$(ARCH)/boot/mtools.conf 175 arch/x86/boot/mtools.conf
diff --git a/arch/x86/Makefile_64 b/arch/x86/Makefile_64
index 57e714a47af7..a804860022e6 100644
--- a/arch/x86/Makefile_64
+++ b/arch/x86/Makefile_64
@@ -127,7 +127,7 @@ archclean:
127 $(Q)$(MAKE) $(clean)=$(boot) 127 $(Q)$(MAKE) $(clean)=$(boot)
128 128
129define archhelp 129define archhelp
130 echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)' 130 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
131 echo ' install - Install kernel using' 131 echo ' install - Install kernel using'
132 echo ' (your) ~/bin/installkernel or' 132 echo ' (your) ~/bin/installkernel or'
133 echo ' (distribution) /sbin/installkernel or' 133 echo ' (distribution) /sbin/installkernel or'
@@ -137,8 +137,8 @@ define archhelp
137 echo ' isoimage - Create a boot CD-ROM image' 137 echo ' isoimage - Create a boot CD-ROM image'
138endef 138endef
139 139
140CLEAN_FILES += arch/$(ARCH)/boot/fdimage \ 140CLEAN_FILES += arch/x86/boot/fdimage \
141 arch/$(ARCH)/boot/image.iso \ 141 arch/x86/boot/image.iso \
142 arch/$(ARCH)/boot/mtools.conf 142 arch/x86/boot/mtools.conf
143 143
144 144
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 89dbf970e058..7a3116ccf387 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -49,10 +49,10 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE)
49 49
50# How to compile the 16-bit code. Note we always compile for -march=i386, 50# How to compile the 16-bit code. Note we always compile for -march=i386,
51# that way we can complain to the user if the CPU is insufficient. 51# that way we can complain to the user if the CPU is insufficient.
52cflags-i386 := 52cflags-$(CONFIG_X86_32) :=
53cflags-x86_64 := -m32 53cflags-$(CONFIG_X86_64) := -m32
54KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ 54KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
55 $(cflags-$(ARCH)) \ 55 $(cflags-y) \
56 -Wall -Wstrict-prototypes \ 56 -Wall -Wstrict-prototypes \
57 -march=i386 -mregparm=3 \ 57 -march=i386 -mregparm=3 \
58 -include $(srctree)/$(src)/code16gcc.h \ 58 -include $(srctree)/$(src)/code16gcc.h \
diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c
index e655a89c5510..769065bd23d7 100644
--- a/arch/x86/boot/cpucheck.c
+++ b/arch/x86/boot/cpucheck.c
@@ -42,13 +42,7 @@ static struct cpu_features cpu;
42static u32 cpu_vendor[3]; 42static u32 cpu_vendor[3];
43static u32 err_flags[NCAPINTS]; 43static u32 err_flags[NCAPINTS];
44 44
45#ifdef CONFIG_X86_64
46static const int req_level = 64;
47#elif defined(CONFIG_X86_MINIMUM_CPU_FAMILY)
48static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY; 45static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY;
49#else
50static const int req_level = 3;
51#endif
52 46
53static const u32 req_flags[NCAPINTS] = 47static const u32 req_flags[NCAPINTS] =
54{ 48{
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index b9d679820306..a7bc93c27662 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -3,6 +3,7 @@
3# 3#
4 4
5extra-y := head_32.o init_task.o vmlinux.lds 5extra-y := head_32.o init_task.o vmlinux.lds
6CPPFLAGS_vmlinux.lds += -Ui386
6 7
7obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ 8obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
8 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ 9 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
@@ -60,7 +61,7 @@ quiet_cmd_syscall = SYSCALL $@
60 cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \ 61 cmd_syscall = $(CC) -m elf_i386 -nostdlib $(SYSCFLAGS_$(@F)) \
61 -Wl,-T,$(filter-out FORCE,$^) -o $@ 62 -Wl,-T,$(filter-out FORCE,$^) -o $@
62 63
63export CPPFLAGS_vsyscall_32.lds += -P -C -U$(ARCH) 64export CPPFLAGS_vsyscall_32.lds += -P -C -Ui386
64 65
65vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \ 66vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
66 $(call ld-option, -Wl$(comma)--hash-style=sysv) 67 $(call ld-option, -Wl$(comma)--hash-style=sysv)
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 24671c3838b3..5a88890d8ee9 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -3,7 +3,9 @@
3# 3#
4 4
5extra-y := head_64.o head64.o init_task.o vmlinux.lds 5extra-y := head_64.o head64.o init_task.o vmlinux.lds
6CPPFLAGS_vmlinux.lds += -Ux86_64
6EXTRA_AFLAGS := -traditional 7EXTRA_AFLAGS := -traditional
8
7obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ 9obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
8 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ 10 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \
9 x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \ 11 x8664_ksyms_64.o i387_64.o syscall_64.o vsyscall_64.o \
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 289247d974c6..0ca27c7b0e8d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -637,6 +637,38 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
637 } 637 }
638 638
639 hpet_address = hpet_tbl->address.address; 639 hpet_address = hpet_tbl->address.address;
640
641 /*
642 * Some broken BIOSes advertise HPET at 0x0. We really do not
643 * want to allocate a resource there.
644 */
645 if (!hpet_address) {
646 printk(KERN_WARNING PREFIX
647 "HPET id: %#x base: %#lx is invalid\n",
648 hpet_tbl->id, hpet_address);
649 return 0;
650 }
651#ifdef CONFIG_X86_64
652 /*
653 * Some even more broken BIOSes advertise HPET at
654 * 0xfed0000000000000 instead of 0xfed00000. Fix it up and add
655 * some noise:
656 */
657 if (hpet_address == 0xfed0000000000000UL) {
658 if (!hpet_force_user) {
659 printk(KERN_WARNING PREFIX "HPET id: %#x "
660 "base: 0xfed0000000000000 is bogus\n "
661 "try hpet=force on the kernel command line to "
662 "fix it up to 0xfed00000.\n", hpet_tbl->id);
663 hpet_address = 0;
664 return 0;
665 }
666 printk(KERN_WARNING PREFIX
667 "HPET id: %#x base: 0xfed0000000000000 fixed up "
668 "to 0xfed00000.\n", hpet_tbl->id);
669 hpet_address >>= 32;
670 }
671#endif
640 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 672 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
641 hpet_tbl->id, hpet_address); 673 hpet_tbl->id, hpet_address);
642 674
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig_32 b/arch/x86/kernel/cpu/cpufreq/Kconfig
index d8c6f132dc7a..151eda0a23fc 100644
--- a/arch/x86/kernel/cpu/cpufreq/Kconfig_32
+++ b/arch/x86/kernel/cpu/cpufreq/Kconfig
@@ -19,6 +19,9 @@ config X86_ACPI_CPUFREQ
19 Processor Performance States. 19 Processor Performance States.
20 This driver also supports Intel Enhanced Speedstep. 20 This driver also supports Intel Enhanced Speedstep.
21 21
22 To compile this driver as a module, choose M here: the
23 module will be called acpi-cpufreq.
24
22 For details, take a look at <file:Documentation/cpu-freq/>. 25 For details, take a look at <file:Documentation/cpu-freq/>.
23 26
24 If in doubt, say N. 27 If in doubt, say N.
@@ -26,7 +29,7 @@ config X86_ACPI_CPUFREQ
26config ELAN_CPUFREQ 29config ELAN_CPUFREQ
27 tristate "AMD Elan SC400 and SC410" 30 tristate "AMD Elan SC400 and SC410"
28 select CPU_FREQ_TABLE 31 select CPU_FREQ_TABLE
29 depends on X86_ELAN 32 depends on X86_32 && X86_ELAN
30 ---help--- 33 ---help---
31 This adds the CPUFreq driver for AMD Elan SC400 and SC410 34 This adds the CPUFreq driver for AMD Elan SC400 and SC410
32 processors. 35 processors.
@@ -42,7 +45,7 @@ config ELAN_CPUFREQ
42config SC520_CPUFREQ 45config SC520_CPUFREQ
43 tristate "AMD Elan SC520" 46 tristate "AMD Elan SC520"
44 select CPU_FREQ_TABLE 47 select CPU_FREQ_TABLE
45 depends on X86_ELAN 48 depends on X86_32 && X86_ELAN
46 ---help--- 49 ---help---
47 This adds the CPUFreq driver for AMD Elan SC520 processor. 50 This adds the CPUFreq driver for AMD Elan SC520 processor.
48 51
@@ -54,6 +57,7 @@ config SC520_CPUFREQ
54config X86_POWERNOW_K6 57config X86_POWERNOW_K6
55 tristate "AMD Mobile K6-2/K6-3 PowerNow!" 58 tristate "AMD Mobile K6-2/K6-3 PowerNow!"
56 select CPU_FREQ_TABLE 59 select CPU_FREQ_TABLE
60 depends on X86_32
57 help 61 help
58 This adds the CPUFreq driver for mobile AMD K6-2+ and mobile 62 This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
59 AMD K6-3+ processors. 63 AMD K6-3+ processors.
@@ -65,6 +69,7 @@ config X86_POWERNOW_K6
65config X86_POWERNOW_K7 69config X86_POWERNOW_K7
66 tristate "AMD Mobile Athlon/Duron PowerNow!" 70 tristate "AMD Mobile Athlon/Duron PowerNow!"
67 select CPU_FREQ_TABLE 71 select CPU_FREQ_TABLE
72 depends on X86_32
68 help 73 help
69 This adds the CPUFreq driver for mobile AMD K7 mobile processors. 74 This adds the CPUFreq driver for mobile AMD K7 mobile processors.
70 75
@@ -76,23 +81,27 @@ config X86_POWERNOW_K7_ACPI
76 bool 81 bool
77 depends on X86_POWERNOW_K7 && ACPI_PROCESSOR 82 depends on X86_POWERNOW_K7 && ACPI_PROCESSOR
78 depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m) 83 depends on !(X86_POWERNOW_K7 = y && ACPI_PROCESSOR = m)
84 depends on X86_32
79 default y 85 default y
80 86
81config X86_POWERNOW_K8 87config X86_POWERNOW_K8
82 tristate "AMD Opteron/Athlon64 PowerNow!" 88 tristate "AMD Opteron/Athlon64 PowerNow!"
83 select CPU_FREQ_TABLE 89 select CPU_FREQ_TABLE
84 depends on EXPERIMENTAL
85 help 90 help
86 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. 91 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
87 92
93 To compile this driver as a module, choose M here: the
94 module will be called powernow-k8.
95
88 For details, take a look at <file:Documentation/cpu-freq/>. 96 For details, take a look at <file:Documentation/cpu-freq/>.
89 97
90 If in doubt, say N. 98 If in doubt, say N.
91 99
92config X86_POWERNOW_K8_ACPI 100config X86_POWERNOW_K8_ACPI
93 bool "ACPI Support" 101 bool
94 select ACPI_PROCESSOR 102 prompt "ACPI Support" if X86_32
95 depends on ACPI && X86_POWERNOW_K8 103 depends on ACPI && X86_POWERNOW_K8 && ACPI_PROCESSOR
104 depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m)
96 default y 105 default y
97 help 106 help
98 This provides access to the K8s Processor Performance States via ACPI. 107 This provides access to the K8s Processor Performance States via ACPI.
@@ -104,7 +113,7 @@ config X86_POWERNOW_K8_ACPI
104 113
105config X86_GX_SUSPMOD 114config X86_GX_SUSPMOD
106 tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation" 115 tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
107 depends on PCI 116 depends on X86_32 && PCI
108 help 117 help
109 This add the CPUFreq driver for NatSemi Geode processors which 118 This add the CPUFreq driver for NatSemi Geode processors which
110 support suspend modulation. 119 support suspend modulation.
@@ -114,15 +123,20 @@ config X86_GX_SUSPMOD
114 If in doubt, say N. 123 If in doubt, say N.
115 124
116config X86_SPEEDSTEP_CENTRINO 125config X86_SPEEDSTEP_CENTRINO
117 tristate "Intel Enhanced SpeedStep" 126 tristate "Intel Enhanced SpeedStep (deprecated)"
118 select CPU_FREQ_TABLE 127 select CPU_FREQ_TABLE
119 select X86_SPEEDSTEP_CENTRINO_TABLE 128 select X86_SPEEDSTEP_CENTRINO_TABLE if X86_32
129 depends on X86_32 || (X86_64 && ACPI_PROCESSOR)
120 help 130 help
131 This is deprecated and this functionality is now merged into
132 acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
133 speedstep_centrino.
121 This adds the CPUFreq driver for Enhanced SpeedStep enabled 134 This adds the CPUFreq driver for Enhanced SpeedStep enabled
122 mobile CPUs. This means Intel Pentium M (Centrino) CPUs. However, 135 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
123 you also need to say Y to "Use ACPI tables to decode..." below 136 or 64bit enabled Intel Xeons.
124 [which might imply enabling ACPI] if you want to use this driver 137
125 on non-Banias CPUs. 138 To compile this driver as a module, choose M here: the
139 module will be called speedstep-centrino.
126 140
127 For details, take a look at <file:Documentation/cpu-freq/>. 141 For details, take a look at <file:Documentation/cpu-freq/>.
128 142
@@ -130,7 +144,7 @@ config X86_SPEEDSTEP_CENTRINO
130 144
131config X86_SPEEDSTEP_CENTRINO_TABLE 145config X86_SPEEDSTEP_CENTRINO_TABLE
132 bool "Built-in tables for Banias CPUs" 146 bool "Built-in tables for Banias CPUs"
133 depends on X86_SPEEDSTEP_CENTRINO 147 depends on X86_32 && X86_SPEEDSTEP_CENTRINO
134 default y 148 default y
135 help 149 help
136 Use built-in tables for Banias CPUs if ACPI encoding 150 Use built-in tables for Banias CPUs if ACPI encoding
@@ -141,6 +155,7 @@ config X86_SPEEDSTEP_CENTRINO_TABLE
141config X86_SPEEDSTEP_ICH 155config X86_SPEEDSTEP_ICH
142 tristate "Intel Speedstep on ICH-M chipsets (ioport interface)" 156 tristate "Intel Speedstep on ICH-M chipsets (ioport interface)"
143 select CPU_FREQ_TABLE 157 select CPU_FREQ_TABLE
158 depends on X86_32
144 help 159 help
145 This adds the CPUFreq driver for certain mobile Intel Pentium III 160 This adds the CPUFreq driver for certain mobile Intel Pentium III
146 (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all 161 (Coppermine), all mobile Intel Pentium III-M (Tualatin) and all
@@ -154,7 +169,7 @@ config X86_SPEEDSTEP_ICH
154config X86_SPEEDSTEP_SMI 169config X86_SPEEDSTEP_SMI
155 tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)" 170 tristate "Intel SpeedStep on 440BX/ZX/MX chipsets (SMI interface)"
156 select CPU_FREQ_TABLE 171 select CPU_FREQ_TABLE
157 depends on EXPERIMENTAL 172 depends on X86_32 && EXPERIMENTAL
158 help 173 help
159 This adds the CPUFreq driver for certain mobile Intel Pentium III 174 This adds the CPUFreq driver for certain mobile Intel Pentium III
160 (Coppermine), all mobile Intel Pentium III-M (Tualatin) 175 (Coppermine), all mobile Intel Pentium III-M (Tualatin)
@@ -169,15 +184,24 @@ config X86_P4_CLOCKMOD
169 select CPU_FREQ_TABLE 184 select CPU_FREQ_TABLE
170 help 185 help
171 This adds the CPUFreq driver for Intel Pentium 4 / XEON 186 This adds the CPUFreq driver for Intel Pentium 4 / XEON
172 processors. 187 processors. When enabled it will lower CPU temperature by skipping
188 clocks.
189
190 This driver should be only used in exceptional
191 circumstances when very low power is needed because it causes severe
192 slowdowns and noticeable latencies. Normally Speedstep should be used
193 instead.
194
195 To compile this driver as a module, choose M here: the
196 module will be called p4-clockmod.
173 197
174 For details, take a look at <file:Documentation/cpu-freq/>. 198 For details, take a look at <file:Documentation/cpu-freq/>.
175 199
176 If in doubt, say N. 200 Unless you are absolutely sure say N.
177 201
178config X86_CPUFREQ_NFORCE2 202config X86_CPUFREQ_NFORCE2
179 tristate "nVidia nForce2 FSB changing" 203 tristate "nVidia nForce2 FSB changing"
180 depends on EXPERIMENTAL 204 depends on X86_32 && EXPERIMENTAL
181 help 205 help
182 This adds the CPUFreq driver for FSB changing on nVidia nForce2 206 This adds the CPUFreq driver for FSB changing on nVidia nForce2
183 platforms. 207 platforms.
@@ -188,6 +212,7 @@ config X86_CPUFREQ_NFORCE2
188 212
189config X86_LONGRUN 213config X86_LONGRUN
190 tristate "Transmeta LongRun" 214 tristate "Transmeta LongRun"
215 depends on X86_32
191 help 216 help
192 This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors 217 This adds the CPUFreq driver for Transmeta Crusoe and Efficeon processors
193 which support LongRun. 218 which support LongRun.
@@ -199,7 +224,7 @@ config X86_LONGRUN
199config X86_LONGHAUL 224config X86_LONGHAUL
200 tristate "VIA Cyrix III Longhaul" 225 tristate "VIA Cyrix III Longhaul"
201 select CPU_FREQ_TABLE 226 select CPU_FREQ_TABLE
202 depends on ACPI_PROCESSOR 227 depends on X86_32 && ACPI_PROCESSOR
203 help 228 help
204 This adds the CPUFreq driver for VIA Samuel/CyrixIII, 229 This adds the CPUFreq driver for VIA Samuel/CyrixIII,
205 VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T 230 VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T
@@ -212,7 +237,7 @@ config X86_LONGHAUL
212config X86_E_POWERSAVER 237config X86_E_POWERSAVER
213 tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)" 238 tristate "VIA C7 Enhanced PowerSaver (EXPERIMENTAL)"
214 select CPU_FREQ_TABLE 239 select CPU_FREQ_TABLE
215 depends on EXPERIMENTAL 240 depends on X86_32 && EXPERIMENTAL
216 help 241 help
217 This adds the CPUFreq driver for VIA C7 processors. 242 This adds the CPUFreq driver for VIA C7 processors.
218 243
@@ -233,11 +258,11 @@ config X86_ACPI_CPUFREQ_PROC_INTF
233 258
234config X86_SPEEDSTEP_LIB 259config X86_SPEEDSTEP_LIB
235 tristate 260 tristate
236 default X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD 261 default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD)
237 262
238config X86_SPEEDSTEP_RELAXED_CAP_CHECK 263config X86_SPEEDSTEP_RELAXED_CAP_CHECK
239 bool "Relaxed speedstep capability checks" 264 bool "Relaxed speedstep capability checks"
240 depends on (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH) 265 depends on X86_32 && (X86_SPEEDSTEP_SMI || X86_SPEEDSTEP_ICH)
241 help 266 help
242 Don't perform all checks for a speedstep capable system which would 267 Don't perform all checks for a speedstep capable system which would
243 normally be done. Some ancient or strange systems, though speedstep 268 normally be done. Some ancient or strange systems, though speedstep
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig_64 b/arch/x86/kernel/cpu/cpufreq/Kconfig_64
deleted file mode 100644
index 9c9699fdcf52..000000000000
--- a/arch/x86/kernel/cpu/cpufreq/Kconfig_64
+++ /dev/null
@@ -1,108 +0,0 @@
1#
2# CPU Frequency scaling
3#
4
5menu "CPU Frequency scaling"
6
7source "drivers/cpufreq/Kconfig"
8
9if CPU_FREQ
10
11comment "CPUFreq processor drivers"
12
13config X86_POWERNOW_K8
14 tristate "AMD Opteron/Athlon64 PowerNow!"
15 select CPU_FREQ_TABLE
16 help
17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
18
19 To compile this driver as a module, choose M here: the
20 module will be called powernow-k8.
21
22 For details, take a look at <file:Documentation/cpu-freq/>.
23
24 If in doubt, say N.
25
26config X86_POWERNOW_K8_ACPI
27 bool
28 depends on X86_POWERNOW_K8 && ACPI_PROCESSOR
29 depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m)
30 default y
31
32config X86_SPEEDSTEP_CENTRINO
33 tristate "Intel Enhanced SpeedStep (deprecated)"
34 select CPU_FREQ_TABLE
35 depends on ACPI_PROCESSOR
36 help
37 This is deprecated and this functionality is now merged into
38 acpi_cpufreq (X86_ACPI_CPUFREQ). Use that driver instead of
39 speedstep_centrino.
40 This adds the CPUFreq driver for Enhanced SpeedStep enabled
41 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
42 or 64bit enabled Intel Xeons.
43
44 To compile this driver as a module, choose M here: the
45 module will be called speedstep-centrino.
46
47 For details, take a look at <file:Documentation/cpu-freq/>.
48
49 If in doubt, say N.
50
51config X86_ACPI_CPUFREQ
52 tristate "ACPI Processor P-States driver"
53 select CPU_FREQ_TABLE
54 depends on ACPI_PROCESSOR
55 help
56 This driver adds a CPUFreq driver which utilizes the ACPI
57 Processor Performance States.
58 This driver also supports Intel Enhanced Speedstep.
59
60 To compile this driver as a module, choose M here: the
61 module will be called acpi-cpufreq.
62
63 For details, take a look at <file:Documentation/cpu-freq/>.
64
65 If in doubt, say N.
66
67comment "shared options"
68
69config X86_ACPI_CPUFREQ_PROC_INTF
70 bool "/proc/acpi/processor/../performance interface (deprecated)"
71 depends on PROC_FS
72 depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K8_ACPI
73 help
74 This enables the deprecated /proc/acpi/processor/../performance
75 interface. While it is helpful for debugging, the generic,
76 cross-architecture cpufreq interfaces should be used.
77
78 If in doubt, say N.
79
80config X86_P4_CLOCKMOD
81 tristate "Intel Pentium 4 clock modulation"
82 depends on EMBEDDED
83 select CPU_FREQ_TABLE
84 help
85 This adds the clock modulation driver for Intel Pentium 4 / XEON
86 processors. When enabled it will lower CPU temperature by skipping
87 clocks.
88
89 This driver should be only used in exceptional
90 circumstances when very low power is needed because it causes severe
91 slowdowns and noticeable latencies. Normally Speedstep should be used
92 instead.
93
94 To compile this driver as a module, choose M here: the
95 module will be called p4-clockmod.
96
97 For details, take a look at <file:Documentation/cpu-freq/>.
98
99 Unless you are absolutely sure say N.
100
101
102config X86_SPEEDSTEP_LIB
103 tristate
104 default X86_P4_CLOCKMOD
105
106endif
107
108endmenu
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 9c36a53676b7..99e1ef9939be 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -46,7 +46,7 @@
46 46
47#define PFX "powernow-k8: " 47#define PFX "powernow-k8: "
48#define BFX PFX "BIOS error: " 48#define BFX PFX "BIOS error: "
49#define VERSION "version 2.00.00" 49#define VERSION "version 2.20.00"
50#include "powernow-k8.h" 50#include "powernow-k8.h"
51 51
52/* serialize freq changes */ 52/* serialize freq changes */
@@ -73,33 +73,11 @@ static u32 find_khz_freq_from_fid(u32 fid)
73 return 1000 * find_freq_from_fid(fid); 73 return 1000 * find_freq_from_fid(fid);
74} 74}
75 75
76/* Return a frequency in MHz, given an input fid and did */ 76static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data, u32 pstate)
77static u32 find_freq_from_fiddid(u32 fid, u32 did)
78{ 77{
79 if (current_cpu_data.x86 == 0x10) 78 return data[pstate].frequency;
80 return 100 * (fid + 0x10) >> did;
81 else
82 return 100 * (fid + 0x8) >> did;
83}
84
85static u32 find_khz_freq_from_fiddid(u32 fid, u32 did)
86{
87 return 1000 * find_freq_from_fiddid(fid, did);
88}
89
90static u32 find_fid_from_pstate(u32 pstate)
91{
92 u32 hi, lo;
93 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
94 return lo & HW_PSTATE_FID_MASK;
95} 79}
96 80
97static u32 find_did_from_pstate(u32 pstate)
98{
99 u32 hi, lo;
100 rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi);
101 return (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
102}
103 81
104/* Return the vco fid for an input fid 82/* Return the vco fid for an input fid
105 * 83 *
@@ -142,9 +120,7 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
142 if (cpu_family == CPU_HW_PSTATE) { 120 if (cpu_family == CPU_HW_PSTATE) {
143 rdmsr(MSR_PSTATE_STATUS, lo, hi); 121 rdmsr(MSR_PSTATE_STATUS, lo, hi);
144 i = lo & HW_PSTATE_MASK; 122 i = lo & HW_PSTATE_MASK;
145 rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi); 123 data->currpstate = i;
146 data->currfid = lo & HW_PSTATE_FID_MASK;
147 data->currdid = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
148 return 0; 124 return 0;
149 } 125 }
150 do { 126 do {
@@ -295,7 +271,7 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid,
295static int transition_pstate(struct powernow_k8_data *data, u32 pstate) 271static int transition_pstate(struct powernow_k8_data *data, u32 pstate)
296{ 272{
297 wrmsr(MSR_PSTATE_CTRL, pstate, 0); 273 wrmsr(MSR_PSTATE_CTRL, pstate, 0);
298 data->currfid = find_fid_from_pstate(pstate); 274 data->currpstate = pstate;
299 return 0; 275 return 0;
300} 276}
301 277
@@ -845,17 +821,20 @@ err_out:
845static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table) 821static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table)
846{ 822{
847 int i; 823 int i;
824 u32 hi = 0, lo = 0;
825 rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo);
826 data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
848 827
849 for (i = 0; i < data->acpi_data.state_count; i++) { 828 for (i = 0; i < data->acpi_data.state_count; i++) {
850 u32 index; 829 u32 index;
851 u32 hi = 0, lo = 0; 830 u32 hi = 0, lo = 0;
852 u32 fid;
853 u32 did;
854 831
855 index = data->acpi_data.states[i].control & HW_PSTATE_MASK; 832 index = data->acpi_data.states[i].control & HW_PSTATE_MASK;
856 if (index > MAX_HW_PSTATE) { 833 if (index > data->max_hw_pstate) {
857 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index); 834 printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index);
858 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n"); 835 printk(KERN_ERR PFX "Please report to BIOS manufacturer\n");
836 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
837 continue;
859 } 838 }
860 rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); 839 rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
861 if (!(hi & HW_PSTATE_VALID_MASK)) { 840 if (!(hi & HW_PSTATE_VALID_MASK)) {
@@ -864,22 +843,9 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpuf
864 continue; 843 continue;
865 } 844 }
866 845
867 fid = lo & HW_PSTATE_FID_MASK; 846 powernow_table[i].index = index;
868 did = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT;
869 847
870 dprintk(" %d : fid 0x%x, did 0x%x\n", index, fid, did); 848 powernow_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000;
871
872 powernow_table[i].index = index | (fid << HW_FID_INDEX_SHIFT) | (did << HW_DID_INDEX_SHIFT);
873
874 powernow_table[i].frequency = find_khz_freq_from_fiddid(fid, did);
875
876 if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) {
877 printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n",
878 powernow_table[i].frequency,
879 (unsigned int) (data->acpi_data.states[i].core_frequency * 1000));
880 powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID;
881 continue;
882 }
883 } 849 }
884 return 0; 850 return 0;
885} 851}
@@ -1020,22 +986,18 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i
1020/* Take a frequency, and issue the hardware pstate transition command */ 986/* Take a frequency, and issue the hardware pstate transition command */
1021static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index) 987static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index)
1022{ 988{
1023 u32 fid = 0;
1024 u32 did = 0;
1025 u32 pstate = 0; 989 u32 pstate = 0;
1026 int res, i; 990 int res, i;
1027 struct cpufreq_freqs freqs; 991 struct cpufreq_freqs freqs;
1028 992
1029 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); 993 dprintk("cpu %d transition to index %u\n", smp_processor_id(), index);
1030 994
1031 /* get fid did for hardware pstate transition */ 995 /* get MSR index for hardware pstate transition */
1032 pstate = index & HW_PSTATE_MASK; 996 pstate = index & HW_PSTATE_MASK;
1033 if (pstate > MAX_HW_PSTATE) 997 if (pstate > data->max_hw_pstate)
1034 return 0; 998 return 0;
1035 fid = (index & HW_FID_INDEX_MASK) >> HW_FID_INDEX_SHIFT; 999 freqs.old = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1036 did = (index & HW_DID_INDEX_MASK) >> HW_DID_INDEX_SHIFT; 1000 freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
1037 freqs.old = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1038 freqs.new = find_khz_freq_from_fiddid(fid, did);
1039 1001
1040 for_each_cpu_mask(i, *(data->available_cores)) { 1002 for_each_cpu_mask(i, *(data->available_cores)) {
1041 freqs.cpu = i; 1003 freqs.cpu = i;
@@ -1043,9 +1005,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
1043 } 1005 }
1044 1006
1045 res = transition_pstate(data, pstate); 1007 res = transition_pstate(data, pstate);
1046 data->currfid = find_fid_from_pstate(pstate); 1008 freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
1047 data->currdid = find_did_from_pstate(pstate);
1048 freqs.new = find_khz_freq_from_fiddid(data->currfid, data->currdid);
1049 1009
1050 for_each_cpu_mask(i, *(data->available_cores)) { 1010 for_each_cpu_mask(i, *(data->available_cores)) {
1051 freqs.cpu = i; 1011 freqs.cpu = i;
@@ -1090,10 +1050,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1090 if (query_current_values_with_pending_wait(data)) 1050 if (query_current_values_with_pending_wait(data))
1091 goto err_out; 1051 goto err_out;
1092 1052
1093 if (cpu_family == CPU_HW_PSTATE) 1053 if (cpu_family != CPU_HW_PSTATE) {
1094 dprintk("targ: curr fid 0x%x, did 0x%x\n",
1095 data->currfid, data->currdid);
1096 else {
1097 dprintk("targ: curr fid 0x%x, vid 0x%x\n", 1054 dprintk("targ: curr fid 0x%x, vid 0x%x\n",
1098 data->currfid, data->currvid); 1055 data->currfid, data->currvid);
1099 1056
@@ -1124,7 +1081,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1124 mutex_unlock(&fidvid_mutex); 1081 mutex_unlock(&fidvid_mutex);
1125 1082
1126 if (cpu_family == CPU_HW_PSTATE) 1083 if (cpu_family == CPU_HW_PSTATE)
1127 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1084 pol->cur = find_khz_freq_from_pstate(data->powernow_table, newstate);
1128 else 1085 else
1129 pol->cur = find_khz_freq_from_fid(data->currfid); 1086 pol->cur = find_khz_freq_from_fid(data->currfid);
1130 ret = 0; 1087 ret = 0;
@@ -1223,7 +1180,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1223 + (3 * (1 << data->irt) * 10)) * 1000; 1180 + (3 * (1 << data->irt) * 10)) * 1000;
1224 1181
1225 if (cpu_family == CPU_HW_PSTATE) 1182 if (cpu_family == CPU_HW_PSTATE)
1226 pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1183 pol->cur = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1227 else 1184 else
1228 pol->cur = find_khz_freq_from_fid(data->currfid); 1185 pol->cur = find_khz_freq_from_fid(data->currfid);
1229 dprintk("policy current frequency %d kHz\n", pol->cur); 1186 dprintk("policy current frequency %d kHz\n", pol->cur);
@@ -1240,8 +1197,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1240 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); 1197 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
1241 1198
1242 if (cpu_family == CPU_HW_PSTATE) 1199 if (cpu_family == CPU_HW_PSTATE)
1243 dprintk("cpu_init done, current fid 0x%x, did 0x%x\n", 1200 dprintk("cpu_init done, current pstate 0x%x\n", data->currpstate);
1244 data->currfid, data->currdid);
1245 else 1201 else
1246 dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n", 1202 dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n",
1247 data->currfid, data->currvid); 1203 data->currfid, data->currvid);
@@ -1297,7 +1253,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
1297 goto out; 1253 goto out;
1298 1254
1299 if (cpu_family == CPU_HW_PSTATE) 1255 if (cpu_family == CPU_HW_PSTATE)
1300 khz = find_khz_freq_from_fiddid(data->currfid, data->currdid); 1256 khz = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
1301 else 1257 else
1302 khz = find_khz_freq_from_fid(data->currfid); 1258 khz = find_khz_freq_from_fid(data->currfid);
1303 1259
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
index 7c4f6e0faed4..afd2b520d35c 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
@@ -10,6 +10,7 @@ struct powernow_k8_data {
10 10
11 u32 numps; /* number of p-states */ 11 u32 numps; /* number of p-states */
12 u32 batps; /* number of p-states supported on battery */ 12 u32 batps; /* number of p-states supported on battery */
13 u32 max_hw_pstate; /* maximum legal hardware pstate */
13 14
14 /* these values are constant when the PSB is used to determine 15 /* these values are constant when the PSB is used to determine
15 * vid/fid pairings, but are modified during the ->target() call 16 * vid/fid pairings, but are modified during the ->target() call
@@ -21,8 +22,8 @@ struct powernow_k8_data {
21 u32 plllock; /* pll lock time, units 1 us */ 22 u32 plllock; /* pll lock time, units 1 us */
22 u32 exttype; /* extended interface = 1 */ 23 u32 exttype; /* extended interface = 1 */
23 24
24 /* keep track of the current fid / vid or did */ 25 /* keep track of the current fid / vid or pstate */
25 u32 currvid, currfid, currdid; 26 u32 currvid, currfid, currpstate;
26 27
27 /* the powernow_table includes all frequency and vid/fid pairings: 28 /* the powernow_table includes all frequency and vid/fid pairings:
28 * fid are the lower 8 bits of the index, vid are the upper 8 bits. 29 * fid are the lower 8 bits of the index, vid are the upper 8 bits.
@@ -87,23 +88,14 @@ struct powernow_k8_data {
87 88
88/* Hardware Pstate _PSS and MSR definitions */ 89/* Hardware Pstate _PSS and MSR definitions */
89#define USE_HW_PSTATE 0x00000080 90#define USE_HW_PSTATE 0x00000080
90#define HW_PSTATE_FID_MASK 0x0000003f
91#define HW_PSTATE_DID_MASK 0x000001c0
92#define HW_PSTATE_DID_SHIFT 6
93#define HW_PSTATE_MASK 0x00000007 91#define HW_PSTATE_MASK 0x00000007
94#define HW_PSTATE_VALID_MASK 0x80000000 92#define HW_PSTATE_VALID_MASK 0x80000000
95#define HW_FID_INDEX_SHIFT 8 93#define HW_PSTATE_MAX_MASK 0x000000f0
96#define HW_FID_INDEX_MASK 0x0000ff00 94#define HW_PSTATE_MAX_SHIFT 4
97#define HW_DID_INDEX_SHIFT 16
98#define HW_DID_INDEX_MASK 0x00ff0000
99#define HW_WATTS_MASK 0xff
100#define HW_PWR_DVR_MASK 0x300
101#define HW_PWR_DVR_SHIFT 8
102#define HW_PWR_MAX_MULT 3
103#define MAX_HW_PSTATE 8 /* hw pstate supports up to 8 */
104#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */ 95#define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */
105#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */ 96#define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */
106#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */ 97#define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */
98#define MSR_PSTATE_CUR_LIMIT 0xc0010061 /* pstate current limit MSR */
107 99
108/* define the two driver architectures */ 100/* define the two driver architectures */
109#define CPU_OPTERON 0 101#define CPU_OPTERON 0
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index b9f802e35209..4b21d29fb5aa 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -802,13 +802,15 @@ static struct sysdev_attribute *mce_attributes[] = {
802 NULL 802 NULL
803}; 803};
804 804
805static cpumask_t mce_device_initialized = CPU_MASK_NONE;
806
805/* Per cpu sysdev init. All of the cpus still share the same ctl bank */ 807/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
806static __cpuinit int mce_create_device(unsigned int cpu) 808static __cpuinit int mce_create_device(unsigned int cpu)
807{ 809{
808 int err; 810 int err;
809 int i; 811 int i;
810 812
811 if (!mce_available(&cpu_data(cpu))) 813 if (!mce_available(&boot_cpu_data))
812 return -EIO; 814 return -EIO;
813 815
814 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); 816 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
@@ -825,6 +827,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
825 if (err) 827 if (err)
826 goto error; 828 goto error;
827 } 829 }
830 cpu_set(cpu, mce_device_initialized);
828 831
829 return 0; 832 return 0;
830error: 833error:
@@ -841,10 +844,14 @@ static void mce_remove_device(unsigned int cpu)
841{ 844{
842 int i; 845 int i;
843 846
847 if (!cpu_isset(cpu, mce_device_initialized))
848 return;
849
844 for (i = 0; mce_attributes[i]; i++) 850 for (i = 0; mce_attributes[i]; i++)
845 sysdev_remove_file(&per_cpu(device_mce,cpu), 851 sysdev_remove_file(&per_cpu(device_mce,cpu),
846 mce_attributes[i]); 852 mce_attributes[i]);
847 sysdev_unregister(&per_cpu(device_mce,cpu)); 853 sysdev_unregister(&per_cpu(device_mce,cpu));
854 cpu_clear(cpu, mce_device_initialized);
848} 855}
849 856
850/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 857/* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@ -852,21 +859,18 @@ static int
852mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 859mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
853{ 860{
854 unsigned int cpu = (unsigned long)hcpu; 861 unsigned int cpu = (unsigned long)hcpu;
855 int err = 0;
856 862
857 switch (action) { 863 switch (action) {
858 case CPU_UP_PREPARE: 864 case CPU_ONLINE:
859 case CPU_UP_PREPARE_FROZEN: 865 case CPU_ONLINE_FROZEN:
860 err = mce_create_device(cpu); 866 mce_create_device(cpu);
861 break; 867 break;
862 case CPU_UP_CANCELED:
863 case CPU_UP_CANCELED_FROZEN:
864 case CPU_DEAD: 868 case CPU_DEAD:
865 case CPU_DEAD_FROZEN: 869 case CPU_DEAD_FROZEN:
866 mce_remove_device(cpu); 870 mce_remove_device(cpu);
867 break; 871 break;
868 } 872 }
869 return err ? NOTIFY_BAD : NOTIFY_OK; 873 return NOTIFY_OK;
870} 874}
871 875
872static struct notifier_block mce_cpu_notifier = { 876static struct notifier_block mce_cpu_notifier = {
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 066f8c6af4df..3900e46d66db 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -89,8 +89,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
89 int fpu_exception; 89 int fpu_exception;
90 90
91#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
92 if (!cpu_online(n))
93 return 0;
94 n = c->cpu_index; 92 n = c->cpu_index;
95#endif 93#endif
96 seq_printf(m, "processor\t: %d\n" 94 seq_printf(m, "processor\t: %d\n"
@@ -177,14 +175,14 @@ static int show_cpuinfo(struct seq_file *m, void *v)
177static void *c_start(struct seq_file *m, loff_t *pos) 175static void *c_start(struct seq_file *m, loff_t *pos)
178{ 176{
179 if (*pos == 0) /* just in case, cpu 0 is not the first */ 177 if (*pos == 0) /* just in case, cpu 0 is not the first */
180 *pos = first_cpu(cpu_possible_map); 178 *pos = first_cpu(cpu_online_map);
181 if ((*pos) < NR_CPUS && cpu_possible(*pos)) 179 if ((*pos) < NR_CPUS && cpu_online(*pos))
182 return &cpu_data(*pos); 180 return &cpu_data(*pos);
183 return NULL; 181 return NULL;
184} 182}
185static void *c_next(struct seq_file *m, void *v, loff_t *pos) 183static void *c_next(struct seq_file *m, void *v, loff_t *pos)
186{ 184{
187 *pos = next_cpu(*pos, cpu_possible_map); 185 *pos = next_cpu(*pos, cpu_online_map);
188 return c_start(m, pos); 186 return c_start(m, pos);
189} 187}
190static void c_stop(struct seq_file *m, void *v) 188static void c_stop(struct seq_file *m, void *v)
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 1a07bbea7be3..f452726c0fe2 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -39,6 +39,7 @@ struct device_fixup {
39static struct device_fixup fixups_table[] = { 39static struct device_fixup fixups_table[] = {
40{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset }, 40{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset },
41{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset }, 41{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset },
42{ PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE, cs5530a_warm_reset },
42}; 43};
43 44
44/* 45/*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 238633d3d09a..30d94d1d5f5f 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -892,7 +892,6 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
892 892
893#ifdef CONFIG_SMP 893#ifdef CONFIG_SMP
894 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; 894 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
895 c->cpu_index = 0;
896#endif 895#endif
897} 896}
898 897
@@ -1078,8 +1077,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1078 1077
1079 1078
1080#ifdef CONFIG_SMP 1079#ifdef CONFIG_SMP
1081 if (!cpu_online(c->cpu_index))
1082 return 0;
1083 cpu = c->cpu_index; 1080 cpu = c->cpu_index;
1084#endif 1081#endif
1085 1082
@@ -1171,15 +1168,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1171static void *c_start(struct seq_file *m, loff_t *pos) 1168static void *c_start(struct seq_file *m, loff_t *pos)
1172{ 1169{
1173 if (*pos == 0) /* just in case, cpu 0 is not the first */ 1170 if (*pos == 0) /* just in case, cpu 0 is not the first */
1174 *pos = first_cpu(cpu_possible_map); 1171 *pos = first_cpu(cpu_online_map);
1175 if ((*pos) < NR_CPUS && cpu_possible(*pos)) 1172 if ((*pos) < NR_CPUS && cpu_online(*pos))
1176 return &cpu_data(*pos); 1173 return &cpu_data(*pos);
1177 return NULL; 1174 return NULL;
1178} 1175}
1179 1176
1180static void *c_next(struct seq_file *m, void *v, loff_t *pos) 1177static void *c_next(struct seq_file *m, void *v, loff_t *pos)
1181{ 1178{
1182 *pos = next_cpu(*pos, cpu_possible_map); 1179 *pos = next_cpu(*pos, cpu_online_map);
1183 return c_start(m, pos); 1180 return c_start(m, pos);
1184} 1181}
1185 1182
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c
index c821edc32216..368b1942b39a 100644
--- a/arch/x86/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
@@ -82,18 +82,15 @@ static int set_rtc_mmss(unsigned long nowtime)
82 int retval = 0; 82 int retval = 0;
83 int real_seconds, real_minutes, cmos_minutes; 83 int real_seconds, real_minutes, cmos_minutes;
84 unsigned char control, freq_select; 84 unsigned char control, freq_select;
85 unsigned long flags;
85 86
86/* 87/*
87 * IRQs are disabled when we're called from the timer interrupt, 88 * set_rtc_mmss is called when irqs are enabled, so disable irqs here
88 * no need for spin_lock_irqsave()
89 */ 89 */
90 90 spin_lock_irqsave(&rtc_lock, flags);
91 spin_lock(&rtc_lock);
92
93/* 91/*
94 * Tell the clock it's being set and stop it. 92 * Tell the clock it's being set and stop it.
95 */ 93 */
96
97 control = CMOS_READ(RTC_CONTROL); 94 control = CMOS_READ(RTC_CONTROL);
98 CMOS_WRITE(control | RTC_SET, RTC_CONTROL); 95 CMOS_WRITE(control | RTC_SET, RTC_CONTROL);
99 96
@@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime)
138 CMOS_WRITE(control, RTC_CONTROL); 135 CMOS_WRITE(control, RTC_CONTROL);
139 CMOS_WRITE(freq_select, RTC_FREQ_SELECT); 136 CMOS_WRITE(freq_select, RTC_FREQ_SELECT);
140 137
141 spin_unlock(&rtc_lock); 138 spin_unlock_irqrestore(&rtc_lock, flags);
142 139
143 return retval; 140 return retval;
144} 141}
@@ -164,21 +161,27 @@ unsigned long read_persistent_clock(void)
164 unsigned century = 0; 161 unsigned century = 0;
165 162
166 spin_lock_irqsave(&rtc_lock, flags); 163 spin_lock_irqsave(&rtc_lock, flags);
164 /*
165 * if UIP is clear, then we have >= 244 microseconds before RTC
166 * registers will be updated. Spec sheet says that this is the
167 * reliable way to read RTC - registers invalid (off bus) during update
168 */
169 while ((CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
170 cpu_relax();
167 171
168 do { 172
169 sec = CMOS_READ(RTC_SECONDS); 173 /* now read all RTC registers while stable with interrupts disabled */
170 min = CMOS_READ(RTC_MINUTES); 174 sec = CMOS_READ(RTC_SECONDS);
171 hour = CMOS_READ(RTC_HOURS); 175 min = CMOS_READ(RTC_MINUTES);
172 day = CMOS_READ(RTC_DAY_OF_MONTH); 176 hour = CMOS_READ(RTC_HOURS);
173 mon = CMOS_READ(RTC_MONTH); 177 day = CMOS_READ(RTC_DAY_OF_MONTH);
174 year = CMOS_READ(RTC_YEAR); 178 mon = CMOS_READ(RTC_MONTH);
179 year = CMOS_READ(RTC_YEAR);
175#ifdef CONFIG_ACPI 180#ifdef CONFIG_ACPI
176 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && 181 if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID &&
177 acpi_gbl_FADT.century) 182 acpi_gbl_FADT.century)
178 century = CMOS_READ(acpi_gbl_FADT.century); 183 century = CMOS_READ(acpi_gbl_FADT.century);
179#endif 184#endif
180 } while (sec != CMOS_READ(RTC_SECONDS));
181
182 spin_unlock_irqrestore(&rtc_lock, flags); 185 spin_unlock_irqrestore(&rtc_lock, flags);
183 186
184 /* 187 /*
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c
index 952e7a89c2ac..aad9d95469dc 100644
--- a/arch/x86/lib/delay_32.c
+++ b/arch/x86/lib/delay_32.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/preempt.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
16 17
17#include <asm/processor.h> 18#include <asm/processor.h>
@@ -42,11 +43,13 @@ static void delay_tsc(unsigned long loops)
42{ 43{
43 unsigned long bclock, now; 44 unsigned long bclock, now;
44 45
46 preempt_disable(); /* TSC's are per-cpu */
45 rdtscl(bclock); 47 rdtscl(bclock);
46 do { 48 do {
47 rep_nop(); 49 rep_nop();
48 rdtscl(now); 50 rdtscl(now);
49 } while ((now-bclock) < loops); 51 } while ((now-bclock) < loops);
52 preempt_enable();
50} 53}
51 54
52/* 55/*
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c
index 0ebbfb9e7c7f..45cdd3fbd91c 100644
--- a/arch/x86/lib/delay_64.c
+++ b/arch/x86/lib/delay_64.c
@@ -10,7 +10,9 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/preempt.h>
13#include <linux/delay.h> 14#include <linux/delay.h>
15
14#include <asm/delay.h> 16#include <asm/delay.h>
15#include <asm/msr.h> 17#include <asm/msr.h>
16 18
@@ -27,14 +29,15 @@ int read_current_timer(unsigned long *timer_value)
27void __delay(unsigned long loops) 29void __delay(unsigned long loops)
28{ 30{
29 unsigned bclock, now; 31 unsigned bclock, now;
30 32
33 preempt_disable(); /* TSC's are pre-cpu */
31 rdtscl(bclock); 34 rdtscl(bclock);
32 do 35 do {
33 {
34 rep_nop(); 36 rep_nop();
35 rdtscl(now); 37 rdtscl(now);
36 } 38 }
37 while((now-bclock) < loops); 39 while ((now-bclock) < loops);
40 preempt_enable();
38} 41}
39EXPORT_SYMBOL(__delay); 42EXPORT_SYMBOL(__delay);
40 43
diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c
index 26a2d4c54b68..2132ca652df1 100644
--- a/arch/x86/mach-voyager/voyager_cat.c
+++ b/arch/x86/mach-voyager/voyager_cat.c
@@ -568,7 +568,7 @@ static voyager_module_t *voyager_initial_module;
568 * boot cpu *after* all memory initialisation has been done (so we can 568 * boot cpu *after* all memory initialisation has been done (so we can
569 * use kmalloc) but before smp initialisation, so we can probe the SMP 569 * use kmalloc) but before smp initialisation, so we can probe the SMP
570 * configuration and pick up necessary information. */ 570 * configuration and pick up necessary information. */
571void 571void __init
572voyager_cat_init(void) 572voyager_cat_init(void)
573{ 573{
574 voyager_module_t **modpp = &voyager_initial_module; 574 voyager_module_t **modpp = &voyager_initial_module;
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 69371434b0cf..88124dd35406 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -1900,7 +1900,7 @@ voyager_smp_prepare_cpus(unsigned int max_cpus)
1900 smp_boot_cpus(); 1900 smp_boot_cpus();
1901} 1901}
1902 1902
1903static void __devinit voyager_smp_prepare_boot_cpu(void) 1903static void __cpuinit voyager_smp_prepare_boot_cpu(void)
1904{ 1904{
1905 init_gdt(smp_processor_id()); 1905 init_gdt(smp_processor_id());
1906 switch_to_new_gdt(); 1906 switch_to_new_gdt();
@@ -1911,7 +1911,7 @@ static void __devinit voyager_smp_prepare_boot_cpu(void)
1911 cpu_set(smp_processor_id(), cpu_present_map); 1911 cpu_set(smp_processor_id(), cpu_present_map);
1912} 1912}
1913 1913
1914static int __devinit 1914static int __cpuinit
1915voyager_cpu_up(unsigned int cpu) 1915voyager_cpu_up(unsigned int cpu)
1916{ 1916{
1917 /* This only works at boot for x86. See "rewrite" above. */ 1917 /* This only works at boot for x86. See "rewrite" above. */
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 2d88f7c6d6ac..7e35078673a4 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -77,6 +77,9 @@ count_resource(struct acpi_resource *acpi_res, void *data)
77 struct acpi_resource_address64 addr; 77 struct acpi_resource_address64 addr;
78 acpi_status status; 78 acpi_status status;
79 79
80 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
81 return AE_OK;
82
80 status = resource_to_addr(acpi_res, &addr); 83 status = resource_to_addr(acpi_res, &addr);
81 if (ACPI_SUCCESS(status)) 84 if (ACPI_SUCCESS(status))
82 info->res_num++; 85 info->res_num++;
@@ -93,6 +96,9 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
93 unsigned long flags; 96 unsigned long flags;
94 struct resource *root; 97 struct resource *root;
95 98
99 if (info->res_num >= PCI_BUS_NUM_RESOURCES)
100 return AE_OK;
101
96 status = resource_to_addr(acpi_res, &addr); 102 status = resource_to_addr(acpi_res, &addr);
97 if (!ACPI_SUCCESS(status)) 103 if (!ACPI_SUCCESS(status))
98 return AE_OK; 104 return AE_OK;
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 7a2ba4583939..e7bff0fbac23 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -20,7 +20,7 @@ quiet_cmd_syscall = SYSCALL $@
20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \ 20 cmd_syscall = $(CC) -m elf_x86_64 -nostdlib $(SYSCFLAGS_$(@F)) \
21 -Wl,-T,$(filter-out FORCE,$^) -o $@ 21 -Wl,-T,$(filter-out FORCE,$^) -o $@
22 22
23export CPPFLAGS_vdso.lds += -P -C -U$(ARCH) 23export CPPFLAGS_vdso.lds += -P -C
24 24
25vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \ 25vdso-flags = -fPIC -shared -Wl,-soname=linux-vdso.so.1 \
26 $(call ld-option, -Wl$(comma)--hash-style=sysv) \ 26 $(call ld-option, -Wl$(comma)--hash-style=sysv) \
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index 91f6e85d0fc2..3b1ae1abfba9 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -13,32 +13,17 @@
13#include <asm/vgtod.h> 13#include <asm/vgtod.h>
14#include "vextern.h" 14#include "vextern.h"
15 15
16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) 16long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
17{ 17{
18 unsigned int dummy, p; 18 unsigned int dummy, p;
19 unsigned long j = 0;
20 19
21 /* Fast cache - only recompute value once per jiffies and avoid 20 if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) {
22 relatively costly rdtscp/cpuid otherwise.
23 This works because the scheduler usually keeps the process
24 on the same CPU and this syscall doesn't guarantee its
25 results anyways.
26 We do this here because otherwise user space would do it on
27 its own in a likely inferior way (no access to jiffies).
28 If you don't like it pass NULL. */
29 if (tcache && tcache->blob[0] == (j = *vdso_jiffies)) {
30 p = tcache->blob[1];
31 } else if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) {
32 /* Load per CPU data from RDTSCP */ 21 /* Load per CPU data from RDTSCP */
33 rdtscp(dummy, dummy, p); 22 rdtscp(dummy, dummy, p);
34 } else { 23 } else {
35 /* Load per CPU data from GDT */ 24 /* Load per CPU data from GDT */
36 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 25 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
37 } 26 }
38 if (tcache) {
39 tcache->blob[0] = j;
40 tcache->blob[1] = p;
41 }
42 if (cpu) 27 if (cpu)
43 *cpu = p & 0xfff; 28 *cpu = p & 0xfff;
44 if (node) 29 if (node)