aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/alpha_ksyms.c3
-rw-r--r--arch/alpha/kernel/entry.S10
-rw-r--r--arch/alpha/kernel/osf_sys.c34
-rw-r--r--arch/alpha/kernel/proto.h15
-rw-r--r--arch/alpha/kernel/srmcons.c2
-rw-r--r--arch/alpha/kernel/time.c15
-rw-r--r--arch/alpha/mm/Makefile2
-rw-r--r--arch/alpha/mm/remap.c86
-rw-r--r--arch/arm/kernel/ecard.c2
-rw-r--r--arch/arm/kernel/setup.c2
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/kernel/sys_arm.c4
-rw-r--r--arch/arm/kernel/time.c10
-rw-r--r--arch/arm/mach-pnx4008/clock.c11
-rw-r--r--arch/arm/vfp/vfpsingle.c2
-rw-r--r--arch/arm26/kernel/setup.c2
-rw-r--r--arch/arm26/kernel/sys_arm.c4
-rw-r--r--arch/arm26/kernel/time.c12
-rw-r--r--arch/avr32/kernel/sys_avr32.c14
-rw-r--r--arch/avr32/mm/ioremap.c120
-rw-r--r--arch/cris/arch-v32/kernel/smp.c1
-rw-r--r--arch/cris/kernel/setup.c2
-rw-r--r--arch/cris/kernel/time.c7
-rw-r--r--arch/cris/mm/ioremap.c88
-rw-r--r--arch/frv/Kconfig8
-rw-r--r--arch/frv/kernel/Makefile2
-rw-r--r--arch/frv/kernel/kernel_execve.S33
-rw-r--r--arch/h8300/kernel/sys_h8300.c24
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/boot/video.S2
-rw-r--r--arch/i386/defconfig7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c56
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c2
-rw-r--r--arch/i386/kernel/crash.c10
-rw-r--r--arch/i386/kernel/i8237.c5
-rw-r--r--arch/i386/kernel/kprobes.c41
-rw-r--r--arch/i386/kernel/nmi.c4
-rw-r--r--arch/i386/kernel/process.c11
-rw-r--r--arch/i386/kernel/setup.c10
-rw-r--r--arch/i386/kernel/smp.c27
-rw-r--r--arch/i386/kernel/smpboot.c3
-rw-r--r--arch/i386/kernel/sys_i386.c42
-rw-r--r--arch/i386/kernel/time.c3
-rw-r--r--arch/i386/kernel/traps.c8
-rw-r--r--arch/i386/lib/delay.c1
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c7
-rw-r--r--arch/i386/mm/highmem.c18
-rw-r--r--arch/i386/mm/init.c1
-rw-r--r--arch/i386/mm/ioremap.c84
-rw-r--r--arch/i386/pci/mmconfig.c5
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/hp/sim/simserial.c2
-rw-r--r--arch/ia64/ia32/sys_ia32.c23
-rw-r--r--arch/ia64/kernel/entry.S4
-rw-r--r--arch/ia64/kernel/kprobes.c98
-rw-r--r--arch/ia64/kernel/mca.c2
-rw-r--r--arch/ia64/kernel/numa.c1
-rw-r--r--arch/ia64/kernel/process.c2
-rw-r--r--arch/ia64/kernel/time.c2
-rw-r--r--arch/ia64/mm/numa.c18
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c2
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_ate.c2
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c2
-rw-r--r--arch/m32r/kernel/sys_m32r.c22
-rw-r--r--arch/m32r/kernel/time.c11
-rw-r--r--arch/m32r/mm/ioremap.c93
-rw-r--r--arch/m68k/kernel/sys_m68k.c16
-rw-r--r--arch/m68k/kernel/time.c16
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c15
-rw-r--r--arch/m68knommu/kernel/time.c7
-rw-r--r--arch/mips/Kconfig9
-rw-r--r--arch/mips/basler/excite/excite_flashtest.c294
-rw-r--r--arch/mips/configs/atlas_defconfig3
-rw-r--r--arch/mips/configs/bigsur_defconfig3
-rw-r--r--arch/mips/configs/capcella_defconfig3
-rw-r--r--arch/mips/configs/cobalt_defconfig3
-rw-r--r--arch/mips/configs/db1000_defconfig3
-rw-r--r--arch/mips/configs/db1100_defconfig3
-rw-r--r--arch/mips/configs/db1200_defconfig3
-rw-r--r--arch/mips/configs/db1500_defconfig3
-rw-r--r--arch/mips/configs/db1550_defconfig3
-rw-r--r--arch/mips/configs/ddb5477_defconfig3
-rw-r--r--arch/mips/configs/decstation_defconfig3
-rw-r--r--arch/mips/configs/e55_defconfig2
-rw-r--r--arch/mips/configs/emma2rh_defconfig3
-rw-r--r--arch/mips/configs/ev64120_defconfig3
-rw-r--r--arch/mips/configs/excite_defconfig3
-rw-r--r--arch/mips/configs/ip22_defconfig3
-rw-r--r--arch/mips/configs/ip27_defconfig3
-rw-r--r--arch/mips/configs/ip32_defconfig3
-rw-r--r--arch/mips/configs/it8172_defconfig3
-rw-r--r--arch/mips/configs/ivr_defconfig3
-rw-r--r--arch/mips/configs/jaguar-atx_defconfig3
-rw-r--r--arch/mips/configs/jmr3927_defconfig3
-rw-r--r--arch/mips/configs/lasat200_defconfig3
-rw-r--r--arch/mips/configs/malta_defconfig3
-rw-r--r--arch/mips/configs/mipssim_defconfig3
-rw-r--r--arch/mips/configs/mpc30x_defconfig2
-rw-r--r--arch/mips/configs/ocelot_3_defconfig3
-rw-r--r--arch/mips/configs/ocelot_c_defconfig3
-rw-r--r--arch/mips/configs/ocelot_defconfig3
-rw-r--r--arch/mips/configs/ocelot_g_defconfig3
-rw-r--r--arch/mips/configs/pb1100_defconfig3
-rw-r--r--arch/mips/configs/pb1500_defconfig3
-rw-r--r--arch/mips/configs/pb1550_defconfig3
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig3
-rw-r--r--arch/mips/configs/pnx8550-v2pci_defconfig3
-rw-r--r--arch/mips/configs/qemu_defconfig3
-rw-r--r--arch/mips/configs/rbhma4500_defconfig3
-rw-r--r--arch/mips/configs/rm200_defconfig3
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig3
-rw-r--r--arch/mips/configs/sead_defconfig3
-rw-r--r--arch/mips/configs/tb0226_defconfig3
-rw-r--r--arch/mips/configs/tb0229_defconfig3
-rw-r--r--arch/mips/configs/tb0287_defconfig3
-rw-r--r--arch/mips/configs/workpad_defconfig2
-rw-r--r--arch/mips/configs/wrppmc_defconfig3
-rw-r--r--arch/mips/configs/yosemite_defconfig3
-rw-r--r--arch/mips/defconfig3
-rw-r--r--arch/mips/kernel/Makefile1
-rw-r--r--arch/mips/kernel/genex.S8
-rw-r--r--arch/mips/kernel/i8259.c4
-rw-r--r--arch/mips/kernel/linux32.c4
-rw-r--r--arch/mips/kernel/process.c37
-rw-r--r--arch/mips/kernel/scall32-o32.S13
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/stacktrace.c85
-rw-r--r--arch/mips/kernel/syscall.c56
-rw-r--r--arch/mips/kernel/sysirix.c22
-rw-r--r--arch/mips/kernel/time.c12
-rw-r--r--arch/mips/kernel/traps.c40
-rw-r--r--arch/mips/mm/c-r3k.c21
-rw-r--r--arch/mips/mm/c-r4k.c77
-rw-r--r--arch/mips/mm/c-sb1.c61
-rw-r--r--arch/mips/mm/c-tx39.c29
-rw-r--r--arch/mips/mm/cache.c1
-rw-r--r--arch/mips/mm/tlbex-fault.S4
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c3
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c2
-rw-r--r--arch/parisc/hpux/fs.c6
-rw-r--r--arch/parisc/hpux/sys_hpux.c37
-rw-r--r--arch/parisc/kernel/firmware.c7
-rw-r--r--arch/parisc/kernel/process.c9
-rw-r--r--arch/parisc/kernel/sys_parisc32.c19
-rw-r--r--arch/parisc/kernel/time.c5
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/kernel/kprobes.c33
-rw-r--r--arch/powerpc/kernel/misc_32.S2
-rw-r--r--arch/powerpc/kernel/misc_64.S2
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/setup_32.c4
-rw-r--r--arch/powerpc/kernel/setup_64.c7
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c15
-rw-r--r--arch/powerpc/kernel/syscalls.c14
-rw-r--r--arch/powerpc/kernel/time.c7
-rw-r--r--arch/powerpc/platforms/iseries/mf.c2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c2
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c4
-rw-r--r--arch/powerpc/platforms/pseries/setup.c2
-rw-r--r--arch/ppc/4xx_io/serial_sicc.c2
-rw-r--r--arch/ppc/kernel/misc.S18
-rw-r--r--arch/ppc/kernel/setup.c4
-rw-r--r--arch/ppc/kernel/time.c11
-rw-r--r--arch/s390/hypfs/inode.c17
-rw-r--r--arch/s390/kernel/compat_linux.c5
-rw-r--r--arch/s390/kernel/head31.S11
-rw-r--r--arch/s390/kernel/head64.S11
-rw-r--r--arch/s390/kernel/kprobes.c9
-rw-r--r--arch/s390/kernel/sys_s390.c20
-rw-r--r--arch/s390/kernel/time.c7
-rw-r--r--arch/s390/lib/spinlock.c62
-rw-r--r--arch/sh/kernel/setup.c2
-rw-r--r--arch/sh/kernel/smp.c1
-rw-r--r--arch/sh/kernel/sys_sh.c19
-rw-r--r--arch/sh/kernel/time.c10
-rw-r--r--arch/sh64/kernel/process.c270
-rw-r--r--arch/sh64/kernel/sys_sh64.c21
-rw-r--r--arch/sh64/kernel/time.c12
-rw-r--r--arch/sparc/kernel/pcic.c16
-rw-r--r--arch/sparc/kernel/sys_sparc.c27
-rw-r--r--arch/sparc/kernel/sys_sunos.c31
-rw-r--r--arch/sparc/kernel/time.c18
-rw-r--r--arch/sparc64/Kconfig2
-rw-r--r--arch/sparc64/kernel/power.c5
-rw-r--r--arch/sparc64/kernel/sys_sparc.c25
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c5
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c22
-rw-r--r--arch/sparc64/kernel/time.c2
-rw-r--r--arch/sparc64/solaris/fs.c7
-rw-r--r--arch/sparc64/solaris/misc.c6
-rw-r--r--arch/um/drivers/line.c6
-rw-r--r--arch/um/drivers/mconsole_kern.c6
-rw-r--r--arch/um/drivers/ubd_kern.c2
-rw-r--r--arch/um/include/line.h7
-rw-r--r--arch/um/kernel/syscall.c35
-rw-r--r--arch/um/kernel/um_arch.c6
-rw-r--r--arch/um/os-Linux/process.c5
-rw-r--r--arch/um/os-Linux/sys-i386/tls.c5
-rw-r--r--arch/um/os-Linux/tls.c8
-rw-r--r--arch/um/sys-i386/unmap.c11
-rw-r--r--arch/um/sys-x86_64/syscalls.c2
-rw-r--r--arch/um/sys-x86_64/sysrq.c2
-rw-r--r--arch/um/sys-x86_64/unmap.c11
-rw-r--r--arch/v850/kernel/memcons.c4
-rw-r--r--arch/v850/kernel/rte_cb_leds.c2
-rw-r--r--arch/v850/kernel/rte_mb_a_pci.c12
-rw-r--r--arch/v850/kernel/simcons.c2
-rw-r--r--arch/v850/kernel/syscalls.c20
-rw-r--r--arch/x86_64/Kconfig6
-rw-r--r--arch/x86_64/defconfig8
-rw-r--r--arch/x86_64/ia32/sys_ia32.c45
-rw-r--r--arch/x86_64/kernel/apic.c54
-rw-r--r--arch/x86_64/kernel/entry.S4
-rw-r--r--arch/x86_64/kernel/kprobes.c48
-rw-r--r--arch/x86_64/kernel/mpparse.c37
-rw-r--r--arch/x86_64/kernel/nmi.c4
-rw-r--r--arch/x86_64/kernel/pci-dma.c93
-rw-r--r--arch/x86_64/kernel/process.c6
-rw-r--r--arch/x86_64/kernel/setup.c11
-rw-r--r--arch/x86_64/kernel/sys_x86_64.c2
-rw-r--r--arch/x86_64/kernel/time.c12
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S17
-rw-r--r--arch/x86_64/kernel/vsyscall.c11
-rw-r--r--arch/x86_64/mm/init.c38
-rw-r--r--arch/x86_64/mm/ioremap.c111
-rw-r--r--arch/x86_64/mm/srat.c66
-rw-r--r--arch/xtensa/kernel/syscalls.c22
-rw-r--r--arch/xtensa/kernel/time.c13
-rw-r--r--arch/xtensa/platform-iss/console.c2
233 files changed, 1577 insertions, 2180 deletions
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
index f042cc42b00f..dbe327d32b6f 100644
--- a/arch/alpha/kernel/alpha_ksyms.c
+++ b/arch/alpha/kernel/alpha_ksyms.c
@@ -36,7 +36,6 @@
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#include <asm/vga.h> 37#include <asm/vga.h>
38 38
39#define __KERNEL_SYSCALLS__
40#include <asm/unistd.h> 39#include <asm/unistd.h>
41 40
42extern struct hwrpb_struct *hwrpb; 41extern struct hwrpb_struct *hwrpb;
@@ -116,7 +115,7 @@ EXPORT_SYMBOL(sys_dup);
116EXPORT_SYMBOL(sys_exit); 115EXPORT_SYMBOL(sys_exit);
117EXPORT_SYMBOL(sys_write); 116EXPORT_SYMBOL(sys_write);
118EXPORT_SYMBOL(sys_lseek); 117EXPORT_SYMBOL(sys_lseek);
119EXPORT_SYMBOL(execve); 118EXPORT_SYMBOL(kernel_execve);
120EXPORT_SYMBOL(sys_setsid); 119EXPORT_SYMBOL(sys_setsid);
121EXPORT_SYMBOL(sys_wait4); 120EXPORT_SYMBOL(sys_wait4);
122 121
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index 01ecd09d4a64..c95e95e1ab04 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -655,12 +655,12 @@ kernel_thread:
655.end kernel_thread 655.end kernel_thread
656 656
657/* 657/*
658 * execve(path, argv, envp) 658 * kernel_execve(path, argv, envp)
659 */ 659 */
660 .align 4 660 .align 4
661 .globl execve 661 .globl kernel_execve
662 .ent execve 662 .ent kernel_execve
663execve: 663kernel_execve:
664 /* We can be called from a module. */ 664 /* We can be called from a module. */
665 ldgp $gp, 0($27) 665 ldgp $gp, 0($27)
666 lda $sp, -(32+SIZEOF_PT_REGS+8)($sp) 666 lda $sp, -(32+SIZEOF_PT_REGS+8)($sp)
@@ -704,7 +704,7 @@ execve:
704 704
7051: lda $sp, 32+SIZEOF_PT_REGS+8($sp) 7051: lda $sp, 32+SIZEOF_PT_REGS+8($sp)
706 ret 706 ret
707.end execve 707.end kernel_execve
708 708
709 709
710/* 710/*
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 73c7622b5297..ad6173651995 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -111,22 +111,26 @@ struct osf_dirent_callback {
111 111
112static int 112static int
113osf_filldir(void *__buf, const char *name, int namlen, loff_t offset, 113osf_filldir(void *__buf, const char *name, int namlen, loff_t offset,
114 ino_t ino, unsigned int d_type) 114 u64 ino, unsigned int d_type)
115{ 115{
116 struct osf_dirent __user *dirent; 116 struct osf_dirent __user *dirent;
117 struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf; 117 struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf;
118 unsigned int reclen = ROUND_UP(NAME_OFFSET + namlen + 1); 118 unsigned int reclen = ROUND_UP(NAME_OFFSET + namlen + 1);
119 unsigned int d_ino;
119 120
120 buf->error = -EINVAL; /* only used if we fail */ 121 buf->error = -EINVAL; /* only used if we fail */
121 if (reclen > buf->count) 122 if (reclen > buf->count)
122 return -EINVAL; 123 return -EINVAL;
124 d_ino = ino;
125 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
126 return -EOVERFLOW;
123 if (buf->basep) { 127 if (buf->basep) {
124 if (put_user(offset, buf->basep)) 128 if (put_user(offset, buf->basep))
125 return -EFAULT; 129 return -EFAULT;
126 buf->basep = NULL; 130 buf->basep = NULL;
127 } 131 }
128 dirent = buf->dirent; 132 dirent = buf->dirent;
129 put_user(ino, &dirent->d_ino); 133 put_user(d_ino, &dirent->d_ino);
130 put_user(namlen, &dirent->d_namlen); 134 put_user(namlen, &dirent->d_namlen);
131 put_user(reclen, &dirent->d_reclen); 135 put_user(reclen, &dirent->d_reclen);
132 if (copy_to_user(dirent->d_name, name, namlen) || 136 if (copy_to_user(dirent->d_name, name, namlen) ||
@@ -402,15 +406,15 @@ osf_utsname(char __user *name)
402 406
403 down_read(&uts_sem); 407 down_read(&uts_sem);
404 error = -EFAULT; 408 error = -EFAULT;
405 if (copy_to_user(name + 0, system_utsname.sysname, 32)) 409 if (copy_to_user(name + 0, utsname()->sysname, 32))
406 goto out; 410 goto out;
407 if (copy_to_user(name + 32, system_utsname.nodename, 32)) 411 if (copy_to_user(name + 32, utsname()->nodename, 32))
408 goto out; 412 goto out;
409 if (copy_to_user(name + 64, system_utsname.release, 32)) 413 if (copy_to_user(name + 64, utsname()->release, 32))
410 goto out; 414 goto out;
411 if (copy_to_user(name + 96, system_utsname.version, 32)) 415 if (copy_to_user(name + 96, utsname()->version, 32))
412 goto out; 416 goto out;
413 if (copy_to_user(name + 128, system_utsname.machine, 32)) 417 if (copy_to_user(name + 128, utsname()->machine, 32))
414 goto out; 418 goto out;
415 419
416 error = 0; 420 error = 0;
@@ -449,8 +453,8 @@ osf_getdomainname(char __user *name, int namelen)
449 453
450 down_read(&uts_sem); 454 down_read(&uts_sem);
451 for (i = 0; i < len; ++i) { 455 for (i = 0; i < len; ++i) {
452 __put_user(system_utsname.domainname[i], name + i); 456 __put_user(utsname()->domainname[i], name + i);
453 if (system_utsname.domainname[i] == '\0') 457 if (utsname()->domainname[i] == '\0')
454 break; 458 break;
455 } 459 }
456 up_read(&uts_sem); 460 up_read(&uts_sem);
@@ -607,12 +611,12 @@ osf_sigstack(struct sigstack __user *uss, struct sigstack __user *uoss)
607asmlinkage long 611asmlinkage long
608osf_sysinfo(int command, char __user *buf, long count) 612osf_sysinfo(int command, char __user *buf, long count)
609{ 613{
610 static char * sysinfo_table[] = { 614 char *sysinfo_table[] = {
611 system_utsname.sysname, 615 utsname()->sysname,
612 system_utsname.nodename, 616 utsname()->nodename,
613 system_utsname.release, 617 utsname()->release,
614 system_utsname.version, 618 utsname()->version,
615 system_utsname.machine, 619 utsname()->machine,
616 "alpha", /* instruction set architecture */ 620 "alpha", /* instruction set architecture */
617 "dummy", /* hardware serial number */ 621 "dummy", /* hardware serial number */
618 "dummy", /* hardware manufacturer */ 622 "dummy", /* hardware manufacturer */
diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h
index 2a6e3da8144f..21f71287b6f5 100644
--- a/arch/alpha/kernel/proto.h
+++ b/arch/alpha/kernel/proto.h
@@ -1,5 +1,7 @@
1#include <linux/interrupt.h> 1#include <linux/interrupt.h>
2#include <linux/io.h>
2 3
4#include <asm/pgtable.h>
3 5
4/* Prototypes of functions used across modules here in this directory. */ 6/* Prototypes of functions used across modules here in this directory. */
5 7
@@ -181,9 +183,16 @@ extern void titan_dispatch_irqs(u64, struct pt_regs *);
181extern void switch_to_system_map(void); 183extern void switch_to_system_map(void);
182extern void srm_paging_stop(void); 184extern void srm_paging_stop(void);
183 185
184/* ../mm/remap.c */ 186static inline int
185extern int __alpha_remap_area_pages(unsigned long, unsigned long, 187__alpha_remap_area_pages(unsigned long address, unsigned long phys_addr,
186 unsigned long, unsigned long); 188 unsigned long size, unsigned long flags)
189{
190 pgprot_t prot;
191
192 prot = __pgprot(_PAGE_VALID | _PAGE_ASM | _PAGE_KRE
193 | _PAGE_KWE | flags);
194 return ioremap_page_range(address, address + size, phys_addr, prot);
195}
187 196
188/* irq.c */ 197/* irq.c */
189 198
diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c
index 9d7dff27f815..756923203860 100644
--- a/arch/alpha/kernel/srmcons.c
+++ b/arch/alpha/kernel/srmcons.c
@@ -229,7 +229,7 @@ srmcons_close(struct tty_struct *tty, struct file *filp)
229 229
230static struct tty_driver *srmcons_driver; 230static struct tty_driver *srmcons_driver;
231 231
232static struct tty_operations srmcons_ops = { 232static const struct tty_operations srmcons_ops = {
233 .open = srmcons_open, 233 .open = srmcons_open,
234 .close = srmcons_close, 234 .close = srmcons_close,
235 .write = srmcons_write, 235 .write = srmcons_write,
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 7c1e44420a78..581ddcc22fc5 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -54,8 +54,6 @@
54#include "proto.h" 54#include "proto.h"
55#include "irq_impl.h" 55#include "irq_impl.h"
56 56
57extern unsigned long wall_jiffies; /* kernel/timer.c */
58
59static int set_rtc_mmss(unsigned long); 57static int set_rtc_mmss(unsigned long);
60 58
61DEFINE_SPINLOCK(rtc_lock); 59DEFINE_SPINLOCK(rtc_lock);
@@ -413,7 +411,7 @@ void
413do_gettimeofday(struct timeval *tv) 411do_gettimeofday(struct timeval *tv)
414{ 412{
415 unsigned long flags; 413 unsigned long flags;
416 unsigned long sec, usec, lost, seq; 414 unsigned long sec, usec, seq;
417 unsigned long delta_cycles, delta_usec, partial_tick; 415 unsigned long delta_cycles, delta_usec, partial_tick;
418 416
419 do { 417 do {
@@ -423,14 +421,13 @@ do_gettimeofday(struct timeval *tv)
423 sec = xtime.tv_sec; 421 sec = xtime.tv_sec;
424 usec = (xtime.tv_nsec / 1000); 422 usec = (xtime.tv_nsec / 1000);
425 partial_tick = state.partial_tick; 423 partial_tick = state.partial_tick;
426 lost = jiffies - wall_jiffies;
427 424
428 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 425 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
429 426
430#ifdef CONFIG_SMP 427#ifdef CONFIG_SMP
431 /* Until and unless we figure out how to get cpu cycle counters 428 /* Until and unless we figure out how to get cpu cycle counters
432 in sync and keep them there, we can't use the rpcc tricks. */ 429 in sync and keep them there, we can't use the rpcc tricks. */
433 delta_usec = lost * (1000000 / HZ); 430 delta_usec = 0;
434#else 431#else
435 /* 432 /*
436 * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks) 433 * usec = cycles * ticks_per_cycle * 2**48 * 1e6 / (2**48 * ticks)
@@ -446,8 +443,7 @@ do_gettimeofday(struct timeval *tv)
446 */ 443 */
447 444
448 delta_usec = (delta_cycles * state.scaled_ticks_per_cycle 445 delta_usec = (delta_cycles * state.scaled_ticks_per_cycle
449 + partial_tick 446 + partial_tick) * 15625;
450 + (lost << FIX_SHIFT)) * 15625;
451 delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2; 447 delta_usec = ((delta_usec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
452#endif 448#endif
453 449
@@ -480,12 +476,11 @@ do_settimeofday(struct timespec *tv)
480 time. Without this, a full-tick error is possible. */ 476 time. Without this, a full-tick error is possible. */
481 477
482#ifdef CONFIG_SMP 478#ifdef CONFIG_SMP
483 delta_nsec = (jiffies - wall_jiffies) * (NSEC_PER_SEC / HZ); 479 delta_nsec = 0;
484#else 480#else
485 delta_nsec = rpcc() - state.last_time; 481 delta_nsec = rpcc() - state.last_time;
486 delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle 482 delta_nsec = (delta_nsec * state.scaled_ticks_per_cycle
487 + state.partial_tick 483 + state.partial_tick) * 15625;
488 + ((jiffies - wall_jiffies) << FIX_SHIFT)) * 15625;
489 delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2; 484 delta_nsec = ((delta_nsec / ((1UL << (FIX_SHIFT-6-1)) * HZ)) + 1) / 2;
490 delta_nsec *= 1000; 485 delta_nsec *= 1000;
491#endif 486#endif
diff --git a/arch/alpha/mm/Makefile b/arch/alpha/mm/Makefile
index 6edd9a09ea4f..09399c5386cb 100644
--- a/arch/alpha/mm/Makefile
+++ b/arch/alpha/mm/Makefile
@@ -4,6 +4,6 @@
4 4
5EXTRA_CFLAGS := -Werror 5EXTRA_CFLAGS := -Werror
6 6
7obj-y := init.o fault.o extable.o remap.o 7obj-y := init.o fault.o extable.o
8 8
9obj-$(CONFIG_DISCONTIGMEM) += numa.o 9obj-$(CONFIG_DISCONTIGMEM) += numa.o
diff --git a/arch/alpha/mm/remap.c b/arch/alpha/mm/remap.c
deleted file mode 100644
index a78356c3ead5..000000000000
--- a/arch/alpha/mm/remap.c
+++ /dev/null
@@ -1,86 +0,0 @@
1#include <linux/vmalloc.h>
2#include <asm/pgalloc.h>
3#include <asm/cacheflush.h>
4
5static inline void
6remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
7 unsigned long phys_addr, unsigned long flags)
8{
9 unsigned long end;
10 unsigned long pfn;
11
12 address &= ~PMD_MASK;
13 end = address + size;
14 if (end > PMD_SIZE)
15 end = PMD_SIZE;
16 if (address >= end)
17 BUG();
18 pfn = phys_addr >> PAGE_SHIFT;
19 do {
20 if (!pte_none(*pte)) {
21 printk("remap_area_pte: page already exists\n");
22 BUG();
23 }
24 set_pte(pte, pfn_pte(pfn,
25 __pgprot(_PAGE_VALID | _PAGE_ASM |
26 _PAGE_KRE | _PAGE_KWE | flags)));
27 address += PAGE_SIZE;
28 pfn++;
29 pte++;
30 } while (address && (address < end));
31}
32
33static inline int
34remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
35 unsigned long phys_addr, unsigned long flags)
36{
37 unsigned long end;
38
39 address &= ~PGDIR_MASK;
40 end = address + size;
41 if (end > PGDIR_SIZE)
42 end = PGDIR_SIZE;
43 phys_addr -= address;
44 if (address >= end)
45 BUG();
46 do {
47 pte_t * pte = pte_alloc_kernel(pmd, address);
48 if (!pte)
49 return -ENOMEM;
50 remap_area_pte(pte, address, end - address,
51 address + phys_addr, flags);
52 address = (address + PMD_SIZE) & PMD_MASK;
53 pmd++;
54 } while (address && (address < end));
55 return 0;
56}
57
58int
59__alpha_remap_area_pages(unsigned long address, unsigned long phys_addr,
60 unsigned long size, unsigned long flags)
61{
62 pgd_t * dir;
63 int error = 0;
64 unsigned long end = address + size;
65
66 phys_addr -= address;
67 dir = pgd_offset(&init_mm, address);
68 flush_cache_all();
69 if (address >= end)
70 BUG();
71 do {
72 pmd_t *pmd;
73 pmd = pmd_alloc(&init_mm, dir, address);
74 error = -ENOMEM;
75 if (!pmd)
76 break;
77 if (remap_area_pmd(pmd, address, end - address,
78 phys_addr + address, flags))
79 break;
80 error = 0;
81 address = (address + PGDIR_SIZE) & PGDIR_MASK;
82 dir++;
83 } while (address && (address < end));
84 return error;
85}
86
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index eca248d9eba4..3e14b1348c0b 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -295,7 +295,7 @@ ecard_task(void * unused)
295 */ 295 */
296static void ecard_call(struct ecard_request *req) 296static void ecard_call(struct ecard_request *req)
297{ 297{
298 DECLARE_COMPLETION(completion); 298 DECLARE_COMPLETION_ONSTACK(completion);
299 299
300 req->complete = &completion; 300 req->complete = &completion;
301 301
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 0a722e77c143..6bbd93dd186a 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -348,7 +348,7 @@ static void __init setup_processor(void)
348 cpu_name, processor_id, (int)processor_id & 15, 348 cpu_name, processor_id, (int)processor_id & 15,
349 proc_arch[cpu_architecture()], cr_alignment); 349 proc_arch[cpu_architecture()], cr_alignment);
350 350
351 sprintf(system_utsname.machine, "%s%c", list->arch_name, ENDIANNESS); 351 sprintf(init_utsname()->machine, "%s%c", list->arch_name, ENDIANNESS);
352 sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS); 352 sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS);
353 elf_hwcap = list->elf_hwcap; 353 elf_hwcap = list->elf_hwcap;
354#ifndef CONFIG_ARM_THUMB 354#ifndef CONFIG_ARM_THUMB
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 68e9634d260a..421329f5e18e 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -36,7 +36,9 @@
36 * The online bitmask indicates that the CPU is up and running. 36 * The online bitmask indicates that the CPU is up and running.
37 */ 37 */
38cpumask_t cpu_possible_map; 38cpumask_t cpu_possible_map;
39EXPORT_SYMBOL(cpu_possible_map);
39cpumask_t cpu_online_map; 40cpumask_t cpu_online_map;
41EXPORT_SYMBOL(cpu_online_map);
40 42
41/* 43/*
42 * as from 2.5, kernels no longer have an init_tasks structure 44 * as from 2.5, kernels no longer have an init_tasks structure
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 8170af471439..00c18d35913c 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -279,7 +279,7 @@ out:
279 return error; 279 return error;
280} 280}
281 281
282long execve(const char *filename, char **argv, char **envp) 282int kernel_execve(const char *filename, char *const argv[], char *const envp[])
283{ 283{
284 struct pt_regs regs; 284 struct pt_regs regs;
285 int ret; 285 int ret;
@@ -317,7 +317,7 @@ long execve(const char *filename, char **argv, char **envp)
317 out: 317 out:
318 return ret; 318 return ret;
319} 319}
320EXPORT_SYMBOL(execve); 320EXPORT_SYMBOL(kernel_execve);
321 321
322/* 322/*
323 * Since loff_t is a 64 bit type we avoid a lot of ABI hastle 323 * Since loff_t is a 64 bit type we avoid a lot of ABI hastle
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index f7d5165796ef..b030320b17c7 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -37,8 +37,6 @@
37 */ 37 */
38struct sys_timer *system_timer; 38struct sys_timer *system_timer;
39 39
40extern unsigned long wall_jiffies;
41
42/* this needs a better home */ 40/* this needs a better home */
43DEFINE_SPINLOCK(rtc_lock); 41DEFINE_SPINLOCK(rtc_lock);
44 42
@@ -237,16 +235,11 @@ void do_gettimeofday(struct timeval *tv)
237{ 235{
238 unsigned long flags; 236 unsigned long flags;
239 unsigned long seq; 237 unsigned long seq;
240 unsigned long usec, sec, lost; 238 unsigned long usec, sec;
241 239
242 do { 240 do {
243 seq = read_seqbegin_irqsave(&xtime_lock, flags); 241 seq = read_seqbegin_irqsave(&xtime_lock, flags);
244 usec = system_timer->offset(); 242 usec = system_timer->offset();
245
246 lost = jiffies - wall_jiffies;
247 if (lost)
248 usec += lost * USECS_PER_JIFFY;
249
250 sec = xtime.tv_sec; 243 sec = xtime.tv_sec;
251 usec += xtime.tv_nsec / 1000; 244 usec += xtime.tv_nsec / 1000;
252 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 245 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -279,7 +272,6 @@ int do_settimeofday(struct timespec *tv)
279 * done, and then undo it! 272 * done, and then undo it!
280 */ 273 */
281 nsec -= system_timer->offset() * NSEC_PER_USEC; 274 nsec -= system_timer->offset() * NSEC_PER_USEC;
282 nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
283 275
284 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 276 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
285 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 277 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/arm/mach-pnx4008/clock.c b/arch/arm/mach-pnx4008/clock.c
index f582ed2ec43c..daa8d3d98eff 100644
--- a/arch/arm/mach-pnx4008/clock.c
+++ b/arch/arm/mach-pnx4008/clock.c
@@ -735,6 +735,16 @@ static struct clk uart6_ck = {
735 .enable_reg = UARTCLKCTRL_REG, 735 .enable_reg = UARTCLKCTRL_REG,
736}; 736};
737 737
738static struct clk wdt_ck = {
739 .name = "wdt_ck",
740 .parent = &per_ck,
741 .flags = NEEDS_INITIALIZATION,
742 .round_rate = &on_off_round_rate,
743 .set_rate = &on_off_set_rate,
744 .enable_shift = 0,
745 .enable_reg = TIMCLKCTRL_REG,
746};
747
738/* These clocks are visible outside this module 748/* These clocks are visible outside this module
739 * and can be initialized 749 * and can be initialized
740 */ 750 */
@@ -765,6 +775,7 @@ static struct clk *onchip_clks[] = {
765 &uart4_ck, 775 &uart4_ck,
766 &uart5_ck, 776 &uart5_ck,
767 &uart6_ck, 777 &uart6_ck,
778 &wdt_ck,
768}; 779};
769 780
770static int local_clk_enable(struct clk *clk) 781static int local_clk_enable(struct clk *clk)
diff --git a/arch/arm/vfp/vfpsingle.c b/arch/arm/vfp/vfpsingle.c
index ab5e9503bae5..0221ba3bc799 100644
--- a/arch/arm/vfp/vfpsingle.c
+++ b/arch/arm/vfp/vfpsingle.c
@@ -198,8 +198,10 @@ u32 vfp_single_normaliseround(int sd, struct vfp_single *vs, u32 fpscr, u32 exce
198 vfp_single_dump("pack: final", vs); 198 vfp_single_dump("pack: final", vs);
199 { 199 {
200 s32 d = vfp_single_pack(vs); 200 s32 d = vfp_single_pack(vs);
201#ifdef DEBUG
201 pr_debug("VFP: %s: d(s%d)=%08x exceptions=%08x\n", func, 202 pr_debug("VFP: %s: d(s%d)=%08x exceptions=%08x\n", func,
202 sd, d, exceptions); 203 sd, d, exceptions);
204#endif
203 vfp_put_float(d, sd); 205 vfp_put_float(d, sd);
204 } 206 }
205 207
diff --git a/arch/arm26/kernel/setup.c b/arch/arm26/kernel/setup.c
index e7eb070f794f..466ddb54b44f 100644
--- a/arch/arm26/kernel/setup.c
+++ b/arch/arm26/kernel/setup.c
@@ -143,7 +143,7 @@ static void __init setup_processor(void)
143 143
144 dump_cpu_info(); 144 dump_cpu_info();
145 145
146 sprintf(system_utsname.machine, "%s", list->arch_name); 146 sprintf(init_utsname()->machine, "%s", list->arch_name);
147 sprintf(elf_platform, "%s", list->elf_name); 147 sprintf(elf_platform, "%s", list->elf_name);
148 elf_hwcap = list->elf_hwcap; 148 elf_hwcap = list->elf_hwcap;
149 149
diff --git a/arch/arm26/kernel/sys_arm.c b/arch/arm26/kernel/sys_arm.c
index 85457897b8a9..dc05aba58baf 100644
--- a/arch/arm26/kernel/sys_arm.c
+++ b/arch/arm26/kernel/sys_arm.c
@@ -283,7 +283,7 @@ out:
283} 283}
284 284
285/* FIXME - see if this is correct for arm26 */ 285/* FIXME - see if this is correct for arm26 */
286long execve(const char *filename, char **argv, char **envp) 286int kernel_execve(const char *filename, char *const argv[], char *const envp[])
287{ 287{
288 struct pt_regs regs; 288 struct pt_regs regs;
289 int ret; 289 int ret;
@@ -320,4 +320,4 @@ long execve(const char *filename, char **argv, char **envp)
320 return ret; 320 return ret;
321} 321}
322 322
323EXPORT_SYMBOL(execve); 323EXPORT_SYMBOL(kernel_execve);
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c
index 80adbd005fc5..1206469b2b86 100644
--- a/arch/arm26/kernel/time.c
+++ b/arch/arm26/kernel/time.c
@@ -33,8 +33,6 @@
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/ioc.h> 34#include <asm/ioc.h>
35 35
36extern unsigned long wall_jiffies;
37
38/* this needs a better home */ 36/* this needs a better home */
39DEFINE_SPINLOCK(rtc_lock); 37DEFINE_SPINLOCK(rtc_lock);
40 38
@@ -136,16 +134,11 @@ void do_gettimeofday(struct timeval *tv)
136{ 134{
137 unsigned long flags; 135 unsigned long flags;
138 unsigned long seq; 136 unsigned long seq;
139 unsigned long usec, sec, lost; 137 unsigned long usec, sec;
140 138
141 do { 139 do {
142 seq = read_seqbegin_irqsave(&xtime_lock, flags); 140 seq = read_seqbegin_irqsave(&xtime_lock, flags);
143 usec = gettimeoffset(); 141 usec = gettimeoffset();
144
145 lost = jiffies - wall_jiffies;
146 if (lost)
147 usec += lost * USECS_PER_JIFFY;
148
149 sec = xtime.tv_sec; 142 sec = xtime.tv_sec;
150 usec += xtime.tv_nsec / 1000; 143 usec += xtime.tv_nsec / 1000;
151 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 144 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -174,8 +167,7 @@ int do_settimeofday(struct timespec *tv)
174 * wall time. Discover what correction gettimeofday() would have 167 * wall time. Discover what correction gettimeofday() would have
175 * done, and then undo it! 168 * done, and then undo it!
176 */ 169 */
177 tv->tv_nsec -= 1000 * (gettimeoffset() + 170 tv->tv_nsec -= 1000 * gettimeoffset();
178 (jiffies - wall_jiffies) * USECS_PER_JIFFY);
179 171
180 while (tv->tv_nsec < 0) { 172 while (tv->tv_nsec < 0) {
181 tv->tv_nsec += NSEC_PER_SEC; 173 tv->tv_nsec += NSEC_PER_SEC;
diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c
index 6ec5693da448..8deb6003ee62 100644
--- a/arch/avr32/kernel/sys_avr32.c
+++ b/arch/avr32/kernel/sys_avr32.c
@@ -49,3 +49,17 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
49 fput(file); 49 fput(file);
50 return error; 50 return error;
51} 51}
52
53int kernel_execve(const char *file, char **argv, char **envp)
54{
55 register long scno asm("r8") = __NR_execve;
56 register long sc1 asm("r12") = (long)file;
57 register long sc2 asm("r11") = (long)argv;
58 register long sc3 asm("r10") = (long)envp;
59
60 asm volatile("scall"
61 : "=r"(sc1)
62 : "r"(scno), "0"(sc1), "r"(sc2), "r"(sc3)
63 : "cc", "memory");
64 return sc1;
65}
diff --git a/arch/avr32/mm/ioremap.c b/arch/avr32/mm/ioremap.c
index 536021877df6..8cfec65e37f7 100644
--- a/arch/avr32/mm/ioremap.c
+++ b/arch/avr32/mm/ioremap.c
@@ -7,119 +7,11 @@
7 */ 7 */
8#include <linux/vmalloc.h> 8#include <linux/vmalloc.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/io.h>
10 11
11#include <asm/io.h>
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13#include <asm/cacheflush.h>
14#include <asm/tlbflush.h>
15#include <asm/addrspace.h> 13#include <asm/addrspace.h>
16 14
17static inline int remap_area_pte(pte_t *pte, unsigned long address,
18 unsigned long end, unsigned long phys_addr,
19 pgprot_t prot)
20{
21 unsigned long pfn;
22
23 pfn = phys_addr >> PAGE_SHIFT;
24 do {
25 WARN_ON(!pte_none(*pte));
26
27 set_pte(pte, pfn_pte(pfn, prot));
28 address += PAGE_SIZE;
29 pfn++;
30 pte++;
31 } while (address && (address < end));
32
33 return 0;
34}
35
36static inline int remap_area_pmd(pmd_t *pmd, unsigned long address,
37 unsigned long end, unsigned long phys_addr,
38 pgprot_t prot)
39{
40 unsigned long next;
41
42 phys_addr -= address;
43
44 do {
45 pte_t *pte = pte_alloc_kernel(pmd, address);
46 if (!pte)
47 return -ENOMEM;
48
49 next = (address + PMD_SIZE) & PMD_MASK;
50 if (remap_area_pte(pte, address, next,
51 address + phys_addr, prot))
52 return -ENOMEM;
53
54 address = next;
55 pmd++;
56 } while (address && (address < end));
57 return 0;
58}
59
60static int remap_area_pud(pud_t *pud, unsigned long address,
61 unsigned long end, unsigned long phys_addr,
62 pgprot_t prot)
63{
64 unsigned long next;
65
66 phys_addr -= address;
67
68 do {
69 pmd_t *pmd = pmd_alloc(&init_mm, pud, address);
70 if (!pmd)
71 return -ENOMEM;
72 next = (address + PUD_SIZE) & PUD_MASK;
73 if (remap_area_pmd(pmd, address, next,
74 phys_addr + address, prot))
75 return -ENOMEM;
76
77 address = next;
78 pud++;
79 } while (address && address < end);
80
81 return 0;
82}
83
84static int remap_area_pages(unsigned long address, unsigned long phys_addr,
85 size_t size, pgprot_t prot)
86{
87 unsigned long end = address + size;
88 unsigned long next;
89 pgd_t *pgd;
90 int err = 0;
91
92 phys_addr -= address;
93
94 pgd = pgd_offset_k(address);
95 flush_cache_all();
96 BUG_ON(address >= end);
97
98 spin_lock(&init_mm.page_table_lock);
99 do {
100 pud_t *pud = pud_alloc(&init_mm, pgd, address);
101
102 err = -ENOMEM;
103 if (!pud)
104 break;
105
106 next = (address + PGDIR_SIZE) & PGDIR_MASK;
107 if (next < address || next > end)
108 next = end;
109 err = remap_area_pud(pud, address, next,
110 phys_addr + address, prot);
111 if (err)
112 break;
113
114 address = next;
115 pgd++;
116 } while (address && (address < end));
117
118 spin_unlock(&init_mm.page_table_lock);
119 flush_tlb_all();
120 return err;
121}
122
123/* 15/*
124 * Re-map an arbitrary physical address space into the kernel virtual 16 * Re-map an arbitrary physical address space into the kernel virtual
125 * address space. Needed when the kernel wants to access physical 17 * address space. Needed when the kernel wants to access physical
@@ -128,7 +20,7 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr,
128void __iomem *__ioremap(unsigned long phys_addr, size_t size, 20void __iomem *__ioremap(unsigned long phys_addr, size_t size,
129 unsigned long flags) 21 unsigned long flags)
130{ 22{
131 void *addr; 23 unsigned long addr;
132 struct vm_struct *area; 24 struct vm_struct *area;
133 unsigned long offset, last_addr; 25 unsigned long offset, last_addr;
134 pgprot_t prot; 26 pgprot_t prot;
@@ -159,7 +51,7 @@ void __iomem *__ioremap(unsigned long phys_addr, size_t size,
159 phys_addr &= PAGE_MASK; 51 phys_addr &= PAGE_MASK;
160 size = PAGE_ALIGN(last_addr + 1) - phys_addr; 52 size = PAGE_ALIGN(last_addr + 1) - phys_addr;
161 53
162 prot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY 54 prot = __pgprot(_PAGE_PRESENT | _PAGE_GLOBAL | _PAGE_RW | _PAGE_DIRTY
163 | _PAGE_ACCESSED | _PAGE_TYPE_SMALL | flags); 55 | _PAGE_ACCESSED | _PAGE_TYPE_SMALL | flags);
164 56
165 /* 57 /*
@@ -169,9 +61,9 @@ void __iomem *__ioremap(unsigned long phys_addr, size_t size,
169 if (!area) 61 if (!area)
170 return NULL; 62 return NULL;
171 area->phys_addr = phys_addr; 63 area->phys_addr = phys_addr;
172 addr = area->addr; 64 addr = (unsigned long )area->addr;
173 if (remap_area_pages((unsigned long)addr, phys_addr, size, prot)) { 65 if (ioremap_page_range(addr, addr + size, phys_addr, prot)) {
174 vunmap(addr); 66 vunmap((void *)addr);
175 return NULL; 67 return NULL;
176 } 68 }
177 69
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index 464ecaec3bc0..2d0023f2d49b 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -28,6 +28,7 @@ spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};
28 28
29/* CPU masks */ 29/* CPU masks */
30cpumask_t cpu_online_map = CPU_MASK_NONE; 30cpumask_t cpu_online_map = CPU_MASK_NONE;
31EXPORT_SYMBOL(cpu_online_map);
31cpumask_t phys_cpu_present_map = CPU_MASK_NONE; 32cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
32EXPORT_SYMBOL(phys_cpu_present_map); 33EXPORT_SYMBOL(phys_cpu_present_map);
33 34
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 7af3d5d43e43..ca8b45a0fe2e 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -160,7 +160,7 @@ setup_arch(char **cmdline_p)
160 show_etrax_copyright(); 160 show_etrax_copyright();
161 161
162 /* Setup utsname */ 162 /* Setup utsname */
163 strcpy(system_utsname.machine, cris_machine_name); 163 strcpy(init_utsname()->machine, cris_machine_name);
164} 164}
165 165
166static void *c_start(struct seq_file *m, loff_t *pos) 166static void *c_start(struct seq_file *m, loff_t *pos)
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 66ba8898db07..0f9213cbd48e 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -37,7 +37,6 @@ int have_rtc; /* used to remember if we have an RTC or not */;
37 37
38#define TICK_SIZE tick 38#define TICK_SIZE tick
39 39
40extern unsigned long wall_jiffies;
41extern unsigned long loops_per_jiffy; /* init/main.c */ 40extern unsigned long loops_per_jiffy; /* init/main.c */
42unsigned long loops_per_usec; 41unsigned long loops_per_usec;
43 42
@@ -58,11 +57,6 @@ void do_gettimeofday(struct timeval *tv)
58 local_irq_save(flags); 57 local_irq_save(flags);
59 local_irq_disable(); 58 local_irq_disable();
60 usec = do_gettimeoffset(); 59 usec = do_gettimeoffset();
61 {
62 unsigned long lost = jiffies - wall_jiffies;
63 if (lost)
64 usec += lost * (1000000 / HZ);
65 }
66 60
67 /* 61 /*
68 * If time_adjust is negative then NTP is slowing the clock 62 * If time_adjust is negative then NTP is slowing the clock
@@ -103,7 +97,6 @@ int do_settimeofday(struct timespec *tv)
103 * made, and then undo it! 97 * made, and then undo it!
104 */ 98 */
105 nsec -= do_gettimeoffset() * NSEC_PER_USEC; 99 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
106 nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
107 100
108 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 101 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
109 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 102 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/cris/mm/ioremap.c b/arch/cris/mm/ioremap.c
index 1780df3ed9e5..8b0b9348b574 100644
--- a/arch/cris/mm/ioremap.c
+++ b/arch/cris/mm/ioremap.c
@@ -10,93 +10,10 @@
10 */ 10 */
11 11
12#include <linux/vmalloc.h> 12#include <linux/vmalloc.h>
13#include <asm/io.h> 13#include <linux/io.h>
14#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
15#include <asm/cacheflush.h>
16#include <asm/tlbflush.h>
17#include <asm/arch/memmap.h> 15#include <asm/arch/memmap.h>
18 16
19static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
20 unsigned long phys_addr, pgprot_t prot)
21{
22 unsigned long end;
23
24 address &= ~PMD_MASK;
25 end = address + size;
26 if (end > PMD_SIZE)
27 end = PMD_SIZE;
28 if (address >= end)
29 BUG();
30 do {
31 if (!pte_none(*pte)) {
32 printk("remap_area_pte: page already exists\n");
33 BUG();
34 }
35 set_pte(pte, mk_pte_phys(phys_addr, prot));
36 address += PAGE_SIZE;
37 phys_addr += PAGE_SIZE;
38 pte++;
39 } while (address && (address < end));
40}
41
42static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
43 unsigned long phys_addr, pgprot_t prot)
44{
45 unsigned long end;
46
47 address &= ~PGDIR_MASK;
48 end = address + size;
49 if (end > PGDIR_SIZE)
50 end = PGDIR_SIZE;
51 phys_addr -= address;
52 if (address >= end)
53 BUG();
54 do {
55 pte_t * pte = pte_alloc_kernel(pmd, address);
56 if (!pte)
57 return -ENOMEM;
58 remap_area_pte(pte, address, end - address, address + phys_addr, prot);
59 address = (address + PMD_SIZE) & PMD_MASK;
60 pmd++;
61 } while (address && (address < end));
62 return 0;
63}
64
65static int remap_area_pages(unsigned long address, unsigned long phys_addr,
66 unsigned long size, pgprot_t prot)
67{
68 int error;
69 pgd_t * dir;
70 unsigned long end = address + size;
71
72 phys_addr -= address;
73 dir = pgd_offset(&init_mm, address);
74 flush_cache_all();
75 if (address >= end)
76 BUG();
77 do {
78 pud_t *pud;
79 pmd_t *pmd;
80
81 error = -ENOMEM;
82 pud = pud_alloc(&init_mm, dir, address);
83 if (!pud)
84 break;
85 pmd = pmd_alloc(&init_mm, pud, address);
86
87 if (!pmd)
88 break;
89 if (remap_area_pmd(pmd, address, end - address,
90 phys_addr + address, prot))
91 break;
92 error = 0;
93 address = (address + PGDIR_SIZE) & PGDIR_MASK;
94 dir++;
95 } while (address && (address < end));
96 flush_tlb_all();
97 return error;
98}
99
100/* 17/*
101 * Generic mapping function (not visible outside): 18 * Generic mapping function (not visible outside):
102 */ 19 */
@@ -135,7 +52,8 @@ void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgpro
135 if (!area) 52 if (!area)
136 return NULL; 53 return NULL;
137 addr = (void __iomem *)area->addr; 54 addr = (void __iomem *)area->addr;
138 if (remap_area_pages((unsigned long) addr, phys_addr, size, prot)) { 55 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
56 phys_addr, prot)) {
139 vfree((void __force *)addr); 57 vfree((void __force *)addr);
140 return NULL; 58 return NULL;
141 } 59 }
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index f7b171b92ea2..cf1c446e003a 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -86,6 +86,14 @@ config HIGHPTE
86 with a lot of RAM, this can be wasteful of precious low memory. 86 with a lot of RAM, this can be wasteful of precious low memory.
87 Setting this option will put user-space page tables in high memory. 87 Setting this option will put user-space page tables in high memory.
88 88
89config LARGE_ALLOCS
90 bool "Allow allocating large blocks (> 1MB) of memory"
91 help
92 Allow the slab memory allocator to keep chains for very large memory
93 sizes - up to 32MB. You may need this if your system has a lot of
94 RAM, and you need to able to allocate very large contiguous chunks.
95 If unsure, say N.
96
89source "mm/Kconfig" 97source "mm/Kconfig"
90 98
91choice 99choice
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile
index 32db3499c461..e8f73ed28b52 100644
--- a/arch/frv/kernel/Makefile
+++ b/arch/frv/kernel/Makefile
@@ -8,7 +8,7 @@ heads-$(CONFIG_MMU) := head-mmu-fr451.o
8extra-y:= head.o init_task.o vmlinux.lds 8extra-y:= head.o init_task.o vmlinux.lds
9 9
10obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \ 10obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \
11 process.o traps.o ptrace.o signal.o dma.o \ 11 kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \
12 sys_frv.o time.o semaphore.o setup.o frv_ksyms.o \ 12 sys_frv.o time.o semaphore.o setup.o frv_ksyms.o \
13 debug-stub.o irq.o sleep.o uaccess.o 13 debug-stub.o irq.o sleep.o uaccess.o
14 14
diff --git a/arch/frv/kernel/kernel_execve.S b/arch/frv/kernel/kernel_execve.S
new file mode 100644
index 000000000000..9b074a16a052
--- /dev/null
+++ b/arch/frv/kernel/kernel_execve.S
@@ -0,0 +1,33 @@
1/* in-kernel program execution
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/linkage.h>
13#include <asm/unistd.h>
14
15###############################################################################
16#
17# Do a system call from kernel instead of calling sys_execve so we end up with
18# proper pt_regs.
19#
20# int kernel_execve(const char *filename, char *const argv[], char *const envp[])
21#
22# On entry: GR8/GR9/GR10: arguments to function
23# On return: GR8: syscall return.
24#
25###############################################################################
26 .globl kernel_execve
27 .type kernel_execve,@function
28kernel_execve:
29 setlos __NR_execve,gr7
30 tira gr0,#0
31 bralr
32
33 .size kernel_execve,.-kernel_execve
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 0f61b7ad69ab..302a2dfe634a 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -25,6 +25,7 @@
25#include <asm/cachectl.h> 25#include <asm/cachectl.h>
26#include <asm/traps.h> 26#include <asm/traps.h>
27#include <asm/ipc.h> 27#include <asm/ipc.h>
28#include <asm/unistd.h>
28 29
29/* 30/*
30 * sys_pipe() is the normal C calling standard for creating 31 * sys_pipe() is the normal C calling standard for creating
@@ -280,3 +281,26 @@ asmlinkage void syscall_print(void *dummy,...)
280 ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0); 281 ((regs->pc)&0xffffff)-2,regs->orig_er0,regs->er1,regs->er2,regs->er3,regs->er0);
281} 282}
282#endif 283#endif
284
285/*
286 * Do a system call from kernel instead of calling sys_execve so we
287 * end up with proper pt_regs.
288 */
289int kernel_execve(const char *filename, char *const argv[], char *const envp[])
290{
291 register long res __asm__("er0");
292 register const char * _a __asm__("er1") = filename;
293 register void *_b __asm__("er2") = argv;
294 register void *_c __asm__("er3") = envp;
295 __asm__ __volatile__ ("mov.l %1,er0\n\t"
296 "trapa #0\n\t"
297 : "=r" (res)
298 : "g" (__NR_execve),
299 "g" (_a),
300 "g" (_b),
301 "g" (_c)
302 : "cc", "memory");
303 return res;
304}
305
306
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 3fd2f256f2be..af219e51734f 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -1142,7 +1142,7 @@ source "arch/i386/oprofile/Kconfig"
1142 1142
1143config KPROBES 1143config KPROBES
1144 bool "Kprobes (EXPERIMENTAL)" 1144 bool "Kprobes (EXPERIMENTAL)"
1145 depends on EXPERIMENTAL && MODULES 1145 depends on KALLSYMS && EXPERIMENTAL && MODULES
1146 help 1146 help
1147 Kprobes allows you to trap at almost any kernel address and 1147 Kprobes allows you to trap at almost any kernel address and
1148 execute a callback function. register_kprobe() establishes 1148 execute a callback function. register_kprobe() establishes
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 8c2a6faeeae5..2c5b5cc55f79 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -11,8 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14#include <linux/config.h> /* for CONFIG_VIDEO_* */
15
16/* Enable autodetection of SVGA adapters and modes. */ 14/* Enable autodetection of SVGA adapters and modes. */
17#undef CONFIG_VIDEO_SVGA 15#undef CONFIG_VIDEO_SVGA
18 16
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 1a29bfa26d0c..ee2d79bd8af7 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-git5 3# Linux kernel version: 2.6.18-git7
4# Tue Sep 26 09:30:47 2006 4# Wed Sep 27 21:53:10 2006
5# 5#
6CONFIG_X86_32=y 6CONFIG_X86_32=y
7CONFIG_GENERIC_TIME=y 7CONFIG_GENERIC_TIME=y
@@ -210,6 +210,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
210CONFIG_PM=y 210CONFIG_PM=y
211CONFIG_PM_LEGACY=y 211CONFIG_PM_LEGACY=y
212# CONFIG_PM_DEBUG is not set 212# CONFIG_PM_DEBUG is not set
213CONFIG_PM_SYSFS_DEPRECATED=y
213 214
214# 215#
215# ACPI (Advanced Configuration and Power Interface) Support 216# ACPI (Advanced Configuration and Power Interface) Support
@@ -292,6 +293,7 @@ CONFIG_PCI_DIRECT=y
292CONFIG_PCI_MMCONFIG=y 293CONFIG_PCI_MMCONFIG=y
293# CONFIG_PCIEPORTBUS is not set 294# CONFIG_PCIEPORTBUS is not set
294CONFIG_PCI_MSI=y 295CONFIG_PCI_MSI=y
296# CONFIG_PCI_MULTITHREAD_PROBE is not set
295# CONFIG_PCI_DEBUG is not set 297# CONFIG_PCI_DEBUG is not set
296CONFIG_ISA_DMA_API=y 298CONFIG_ISA_DMA_API=y
297# CONFIG_ISA is not set 299# CONFIG_ISA is not set
@@ -1427,6 +1429,7 @@ CONFIG_KPROBES=y
1427# 1429#
1428CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1430CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1429# CONFIG_PRINTK_TIME is not set 1431# CONFIG_PRINTK_TIME is not set
1432# CONFIG_ENABLE_MUST_CHECK is not set
1430CONFIG_MAGIC_SYSRQ=y 1433CONFIG_MAGIC_SYSRQ=y
1431CONFIG_UNUSED_SYMBOLS=y 1434CONFIG_UNUSED_SYMBOLS=y
1432CONFIG_DEBUG_KERNEL=y 1435CONFIG_DEBUG_KERNEL=y
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index ea19d091fd41..57c880bf0bd6 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -396,13 +396,13 @@ static int acpi_cpufreq_early_init_acpi(void)
396 */ 396 */
397static int bios_with_sw_any_bug; 397static int bios_with_sw_any_bug;
398 398
399static int __init sw_any_bug_found(struct dmi_system_id *d) 399static int sw_any_bug_found(struct dmi_system_id *d)
400{ 400{
401 bios_with_sw_any_bug = 1; 401 bios_with_sw_any_bug = 1;
402 return 0; 402 return 0;
403} 403}
404 404
405static struct dmi_system_id __initdata sw_any_bug_dmi_table[] = { 405static struct dmi_system_id sw_any_bug_dmi_table[] = {
406 { 406 {
407 .callback = sw_any_bug_found, 407 .callback = sw_any_bug_found,
408 .ident = "Supermicro Server X6DLP", 408 .ident = "Supermicro Server X6DLP",
@@ -597,7 +597,6 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
597 .name = "acpi-cpufreq", 597 .name = "acpi-cpufreq",
598 .owner = THIS_MODULE, 598 .owner = THIS_MODULE,
599 .attr = acpi_cpufreq_attr, 599 .attr = acpi_cpufreq_attr,
600 .flags = CPUFREQ_STICKY,
601}; 600};
602 601
603 602
@@ -608,7 +607,7 @@ acpi_cpufreq_init (void)
608 607
609 acpi_cpufreq_early_init_acpi(); 608 acpi_cpufreq_early_init_acpi();
610 609
611 return cpufreq_register_driver(&acpi_cpufreq_driver); 610 return cpufreq_register_driver(&acpi_cpufreq_driver);
612} 611}
613 612
614 613
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index f5cc9f5c9bab..7233abe5d695 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -178,11 +178,17 @@ static void do_powersaver(int cx_address, unsigned int clock_ratio_index)
178 safe_halt(); 178 safe_halt();
179 /* Change frequency on next halt or sleep */ 179 /* Change frequency on next halt or sleep */
180 wrmsrl(MSR_VIA_LONGHAUL, longhaul.val); 180 wrmsrl(MSR_VIA_LONGHAUL, longhaul.val);
181 ACPI_FLUSH_CPU_CACHE(); 181 if (port22_en) {
182 /* Invoke C3 */ 182 ACPI_FLUSH_CPU_CACHE();
183 inb(cx_address); 183 /* Invoke C1 */
184 /* Dummy op - must do something useless after P_LVL3 read */ 184 halt();
185 t = inl(acpi_fadt.xpm_tmr_blk.address); 185 } else {
186 ACPI_FLUSH_CPU_CACHE();
187 /* Invoke C3 */
188 inb(cx_address);
189 /* Dummy op - must do something useless after P_LVL3 read */
190 t = inl(acpi_fadt.xpm_tmr_blk.address);
191 }
186 192
187 /* Disable bus ratio bit */ 193 /* Disable bus ratio bit */
188 local_irq_disable(); 194 local_irq_disable();
@@ -567,16 +573,23 @@ static acpi_status longhaul_walk_callback(acpi_handle obj_handle,
567static int enable_arbiter_disable(void) 573static int enable_arbiter_disable(void)
568{ 574{
569 struct pci_dev *dev; 575 struct pci_dev *dev;
576 int reg;
570 u8 pci_cmd; 577 u8 pci_cmd;
571 578
572 /* Find PLE133 host bridge */ 579 /* Find PLE133 host bridge */
580 reg = 0x78;
573 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, NULL); 581 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, NULL);
582 /* Find CLE266 host bridge */
583 if (dev == NULL) {
584 reg = 0x76;
585 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL);
586 }
574 if (dev != NULL) { 587 if (dev != NULL) {
575 /* Enable access to port 0x22 */ 588 /* Enable access to port 0x22 */
576 pci_read_config_byte(dev, 0x78, &pci_cmd); 589 pci_read_config_byte(dev, reg, &pci_cmd);
577 if ( !(pci_cmd & 1<<7) ) { 590 if ( !(pci_cmd & 1<<7) ) {
578 pci_cmd |= 1<<7; 591 pci_cmd |= 1<<7;
579 pci_write_config_byte(dev, 0x78, pci_cmd); 592 pci_write_config_byte(dev, reg, pci_cmd);
580 } 593 }
581 return 1; 594 return 1;
582 } 595 }
@@ -680,20 +693,25 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
680 if (longhaul_version == TYPE_POWERSAVER) { 693 if (longhaul_version == TYPE_POWERSAVER) {
681 /* Check ACPI support for C3 state */ 694 /* Check ACPI support for C3 state */
682 cx = &pr->power.states[ACPI_STATE_C3]; 695 cx = &pr->power.states[ACPI_STATE_C3];
683 if (cx->address == 0 || 696 if (cx->address > 0 &&
684 (cx->latency > 1000 && ignore_latency == 0) ) 697 (cx->latency <= 1000 || ignore_latency != 0) ) {
698 goto print_support_type;
699 }
700 }
701 /* Check ACPI support for bus master arbiter disable */
702 if (!pr->flags.bm_control) {
703 if (enable_arbiter_disable()) {
704 port22_en = 1;
705 } else {
685 goto err_acpi; 706 goto err_acpi;
686
687 } else {
688 /* Check ACPI support for bus master arbiter disable */
689 if (!pr->flags.bm_control) {
690 if (!enable_arbiter_disable()) {
691 printk(KERN_ERR PFX "No ACPI support. No VT8601 host bridge. Aborting.\n");
692 return -ENODEV;
693 } else
694 port22_en = 1;
695 } 707 }
696 } 708 }
709print_support_type:
710 if (!port22_en) {
711 printk (KERN_INFO PFX "Using ACPI support.\n");
712 } else {
713 printk (KERN_INFO PFX "Using northbridge support.\n");
714 }
697 715
698 ret = longhaul_get_ranges(); 716 ret = longhaul_get_ranges();
699 if (ret != 0) 717 if (ret != 0)
@@ -716,7 +734,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
716 return 0; 734 return 0;
717 735
718err_acpi: 736err_acpi:
719 printk(KERN_ERR PFX "No ACPI support for CPU frequency changes.\n"); 737 printk(KERN_ERR PFX "No ACPI support. No VT8601 or VT8623 northbridge. Aborting.\n");
720 return -ENODEV; 738 return -ENODEV;
721} 739}
722 740
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index 7a9325349e94..e8993baf3d14 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -386,7 +386,7 @@ static int centrino_cpu_early_init_acpi(void)
386 * than OS intended it to run at. Detect it and handle it cleanly. 386 * than OS intended it to run at. Detect it and handle it cleanly.
387 */ 387 */
388static int bios_with_sw_any_bug; 388static int bios_with_sw_any_bug;
389static int __init sw_any_bug_found(struct dmi_system_id *d) 389static int sw_any_bug_found(struct dmi_system_id *d)
390{ 390{
391 bios_with_sw_any_bug = 1; 391 bios_with_sw_any_bug = 1;
392 return 0; 392 return 0;
diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c
index 67d297dc1003..144b43288965 100644
--- a/arch/i386/kernel/crash.c
+++ b/arch/i386/kernel/crash.c
@@ -23,6 +23,7 @@
23#include <asm/hw_irq.h> 23#include <asm/hw_irq.h>
24#include <asm/apic.h> 24#include <asm/apic.h>
25#include <asm/kdebug.h> 25#include <asm/kdebug.h>
26#include <asm/smp.h>
26 27
27#include <mach_ipi.h> 28#include <mach_ipi.h>
28 29
@@ -88,7 +89,7 @@ static void crash_save_self(struct pt_regs *regs)
88{ 89{
89 int cpu; 90 int cpu;
90 91
91 cpu = smp_processor_id(); 92 cpu = safe_smp_processor_id();
92 crash_save_this_cpu(regs, cpu); 93 crash_save_this_cpu(regs, cpu);
93} 94}
94 95
@@ -133,7 +134,10 @@ static int crash_nmi_callback(struct notifier_block *self,
133 134
134static void smp_send_nmi_allbutself(void) 135static void smp_send_nmi_allbutself(void)
135{ 136{
136 send_IPI_allbutself(NMI_VECTOR); 137 cpumask_t mask = cpu_online_map;
138 cpu_clear(safe_smp_processor_id(), mask);
139 if (!cpus_empty(mask))
140 send_IPI_mask(mask, NMI_VECTOR);
137} 141}
138 142
139static struct notifier_block crash_nmi_nb = { 143static struct notifier_block crash_nmi_nb = {
@@ -185,7 +189,7 @@ void machine_crash_shutdown(struct pt_regs *regs)
185 local_irq_disable(); 189 local_irq_disable();
186 190
187 /* Make a note of crashing cpu. Will be used in NMI callback.*/ 191 /* Make a note of crashing cpu. Will be used in NMI callback.*/
188 crashing_cpu = smp_processor_id(); 192 crashing_cpu = safe_smp_processor_id();
189 nmi_shootdown_cpus(); 193 nmi_shootdown_cpus();
190 lapic_shutdown(); 194 lapic_shutdown();
191#if defined(CONFIG_X86_IO_APIC) 195#if defined(CONFIG_X86_IO_APIC)
diff --git a/arch/i386/kernel/i8237.c b/arch/i386/kernel/i8237.c
index c36d1c006c2f..6f508e8d7c57 100644
--- a/arch/i386/kernel/i8237.c
+++ b/arch/i386/kernel/i8237.c
@@ -2,6 +2,11 @@
2 * i8237.c: 8237A DMA controller suspend functions. 2 * i8237.c: 8237A DMA controller suspend functions.
3 * 3 *
4 * Written by Pierre Ossman, 2005. 4 * Written by Pierre Ossman, 2005.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
5 */ 10 */
6 11
7#include <linux/init.h> 12#include <linux/init.h>
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index afe6505ca0b3..d98e44b16fe2 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -230,20 +230,20 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
230 struct pt_regs *regs) 230 struct pt_regs *regs)
231{ 231{
232 unsigned long *sara = (unsigned long *)&regs->esp; 232 unsigned long *sara = (unsigned long *)&regs->esp;
233 struct kretprobe_instance *ri;
234 233
235 if ((ri = get_free_rp_inst(rp)) != NULL) { 234 struct kretprobe_instance *ri;
236 ri->rp = rp; 235
237 ri->task = current; 236 if ((ri = get_free_rp_inst(rp)) != NULL) {
237 ri->rp = rp;
238 ri->task = current;
238 ri->ret_addr = (kprobe_opcode_t *) *sara; 239 ri->ret_addr = (kprobe_opcode_t *) *sara;
239 240
240 /* Replace the return addr with trampoline addr */ 241 /* Replace the return addr with trampoline addr */
241 *sara = (unsigned long) &kretprobe_trampoline; 242 *sara = (unsigned long) &kretprobe_trampoline;
242 243 add_rp_inst(ri);
243 add_rp_inst(ri); 244 } else {
244 } else { 245 rp->nmissed++;
245 rp->nmissed++; 246 }
246 }
247} 247}
248 248
249/* 249/*
@@ -359,7 +359,7 @@ no_kprobe:
359 void __kprobes kretprobe_trampoline_holder(void) 359 void __kprobes kretprobe_trampoline_holder(void)
360 { 360 {
361 asm volatile ( ".global kretprobe_trampoline\n" 361 asm volatile ( ".global kretprobe_trampoline\n"
362 "kretprobe_trampoline: \n" 362 "kretprobe_trampoline: \n"
363 " pushf\n" 363 " pushf\n"
364 /* skip cs, eip, orig_eax, es, ds */ 364 /* skip cs, eip, orig_eax, es, ds */
365 " subl $20, %esp\n" 365 " subl $20, %esp\n"
@@ -395,14 +395,15 @@ no_kprobe:
395 */ 395 */
396fastcall void *__kprobes trampoline_handler(struct pt_regs *regs) 396fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
397{ 397{
398 struct kretprobe_instance *ri = NULL; 398 struct kretprobe_instance *ri = NULL;
399 struct hlist_head *head; 399 struct hlist_head *head, empty_rp;
400 struct hlist_node *node, *tmp; 400 struct hlist_node *node, *tmp;
401 unsigned long flags, orig_ret_address = 0; 401 unsigned long flags, orig_ret_address = 0;
402 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; 402 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
403 403
404 INIT_HLIST_HEAD(&empty_rp);
404 spin_lock_irqsave(&kretprobe_lock, flags); 405 spin_lock_irqsave(&kretprobe_lock, flags);
405 head = kretprobe_inst_table_head(current); 406 head = kretprobe_inst_table_head(current);
406 407
407 /* 408 /*
408 * It is possible to have multiple instances associated with a given 409 * It is possible to have multiple instances associated with a given
@@ -413,14 +414,14 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
413 * We can handle this because: 414 * We can handle this because:
414 * - instances are always inserted at the head of the list 415 * - instances are always inserted at the head of the list
415 * - when multiple return probes are registered for the same 416 * - when multiple return probes are registered for the same
416 * function, the first instance's ret_addr will point to the 417 * function, the first instance's ret_addr will point to the
417 * real return address, and all the rest will point to 418 * real return address, and all the rest will point to
418 * kretprobe_trampoline 419 * kretprobe_trampoline
419 */ 420 */
420 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { 421 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
421 if (ri->task != current) 422 if (ri->task != current)
422 /* another task is sharing our hash bucket */ 423 /* another task is sharing our hash bucket */
423 continue; 424 continue;
424 425
425 if (ri->rp && ri->rp->handler){ 426 if (ri->rp && ri->rp->handler){
426 __get_cpu_var(current_kprobe) = &ri->rp->kp; 427 __get_cpu_var(current_kprobe) = &ri->rp->kp;
@@ -429,7 +430,7 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
429 } 430 }
430 431
431 orig_ret_address = (unsigned long)ri->ret_addr; 432 orig_ret_address = (unsigned long)ri->ret_addr;
432 recycle_rp_inst(ri); 433 recycle_rp_inst(ri, &empty_rp);
433 434
434 if (orig_ret_address != trampoline_address) 435 if (orig_ret_address != trampoline_address)
435 /* 436 /*
@@ -444,6 +445,10 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
444 445
445 spin_unlock_irqrestore(&kretprobe_lock, flags); 446 spin_unlock_irqrestore(&kretprobe_lock, flags);
446 447
448 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
449 hlist_del(&ri->hlist);
450 kfree(ri);
451 }
447 return (void*)orig_ret_address; 452 return (void*)orig_ret_address;
448} 453}
449 454
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index dbda706fdd14..3e8e3adb0489 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -13,7 +13,6 @@
13 * Mikael Pettersson : PM converted to driver model. Disable/enable API. 13 * Mikael Pettersson : PM converted to driver model. Disable/enable API.
14 */ 14 */
15 15
16#include <linux/config.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <linux/module.h> 18#include <linux/module.h>
@@ -31,6 +30,9 @@
31 30
32#include "mach_traps.h" 31#include "mach_traps.h"
33 32
33int unknown_nmi_panic;
34int nmi_watchdog_enabled;
35
34/* perfctr_nmi_owner tracks the ownership of the perfctr registers: 36/* perfctr_nmi_owner tracks the ownership of the perfctr registers:
35 * evtsel_nmi_owner tracks the ownership of the event selection 37 * evtsel_nmi_owner tracks the ownership of the event selection
36 * - different performance counters/ event selection may be reserved for 38 * - different performance counters/ event selection may be reserved for
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index 8c190ca7ae44..dad02a960e03 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -297,9 +297,9 @@ void show_regs(struct pt_regs * regs)
297 if (user_mode_vm(regs)) 297 if (user_mode_vm(regs))
298 printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); 298 printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
299 printk(" EFLAGS: %08lx %s (%s %.*s)\n", 299 printk(" EFLAGS: %08lx %s (%s %.*s)\n",
300 regs->eflags, print_tainted(), system_utsname.release, 300 regs->eflags, print_tainted(), init_utsname()->release,
301 (int)strcspn(system_utsname.version, " "), 301 (int)strcspn(init_utsname()->version, " "),
302 system_utsname.version); 302 init_utsname()->version);
303 printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", 303 printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
304 regs->eax,regs->ebx,regs->ecx,regs->edx); 304 regs->eax,regs->ebx,regs->ecx,regs->edx);
305 printk("ESI: %08lx EDI: %08lx EBP: %08lx", 305 printk("ESI: %08lx EDI: %08lx EBP: %08lx",
@@ -425,13 +425,12 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
425 425
426 tsk = current; 426 tsk = current;
427 if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { 427 if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
428 p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL); 428 p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr,
429 IO_BITMAP_BYTES, GFP_KERNEL);
429 if (!p->thread.io_bitmap_ptr) { 430 if (!p->thread.io_bitmap_ptr) {
430 p->thread.io_bitmap_max = 0; 431 p->thread.io_bitmap_max = 0;
431 return -ENOMEM; 432 return -ENOMEM;
432 } 433 }
433 memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr,
434 IO_BITMAP_BYTES);
435 set_tsk_thread_flag(p, TIF_IO_BITMAP); 434 set_tsk_thread_flag(p, TIF_IO_BITMAP);
436 } 435 }
437 436
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 814cdebf7377..000cf03751fe 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -209,9 +209,6 @@ static struct resource adapter_rom_resources[] = { {
209 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM 209 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
210} }; 210} };
211 211
212#define ADAPTER_ROM_RESOURCES \
213 (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0])
214
215static struct resource video_rom_resource = { 212static struct resource video_rom_resource = {
216 .name = "Video ROM", 213 .name = "Video ROM",
217 .start = 0xc0000, 214 .start = 0xc0000,
@@ -273,9 +270,6 @@ static struct resource standard_io_resources[] = { {
273 .flags = IORESOURCE_BUSY | IORESOURCE_IO 270 .flags = IORESOURCE_BUSY | IORESOURCE_IO
274} }; 271} };
275 272
276#define STANDARD_IO_RESOURCES \
277 (sizeof standard_io_resources / sizeof standard_io_resources[0])
278
279#define romsignature(x) (*(unsigned short *)(x) == 0xaa55) 273#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
280 274
281static int __init romchecksum(unsigned char *rom, unsigned long length) 275static int __init romchecksum(unsigned char *rom, unsigned long length)
@@ -332,7 +326,7 @@ static void __init probe_roms(void)
332 } 326 }
333 327
334 /* check for adapter roms on 2k boundaries */ 328 /* check for adapter roms on 2k boundaries */
335 for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) { 329 for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper; start += 2048) {
336 rom = isa_bus_to_virt(start); 330 rom = isa_bus_to_virt(start);
337 if (!romsignature(rom)) 331 if (!romsignature(rom))
338 continue; 332 continue;
@@ -1272,7 +1266,7 @@ static int __init request_standard_resources(void)
1272 request_resource(&iomem_resource, &video_ram_resource); 1266 request_resource(&iomem_resource, &video_ram_resource);
1273 1267
1274 /* request I/O space for devices used on all i[345]86 PCs */ 1268 /* request I/O space for devices used on all i[345]86 PCs */
1275 for (i = 0; i < STANDARD_IO_RESOURCES; i++) 1269 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
1276 request_resource(&ioport_resource, &standard_io_resources[i]); 1270 request_resource(&ioport_resource, &standard_io_resources[i]);
1277 return 0; 1271 return 0;
1278} 1272}
diff --git a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c
index 465188e2d701..1b080ab8a49f 100644
--- a/arch/i386/kernel/smp.c
+++ b/arch/i386/kernel/smp.c
@@ -700,3 +700,30 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
700 return 0; 700 return 0;
701} 701}
702EXPORT_SYMBOL(smp_call_function_single); 702EXPORT_SYMBOL(smp_call_function_single);
703
704static int convert_apicid_to_cpu(int apic_id)
705{
706 int i;
707
708 for (i = 0; i < NR_CPUS; i++) {
709 if (x86_cpu_to_apicid[i] == apic_id)
710 return i;
711 }
712 return -1;
713}
714
715int safe_smp_processor_id(void)
716{
717 int apicid, cpuid;
718
719 if (!boot_cpu_has(X86_FEATURE_APIC))
720 return 0;
721
722 apicid = hard_smp_processor_id();
723 if (apicid == BAD_APICID)
724 return 0;
725
726 cpuid = convert_apicid_to_cpu(apicid);
727
728 return cpuid >= 0 ? cpuid : 0;
729}
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 82b26d5ce476..9d93ecf6d999 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -612,6 +612,7 @@ extern struct {
612/* which logical CPUs are on which nodes */ 612/* which logical CPUs are on which nodes */
613cpumask_t node_2_cpu_mask[MAX_NUMNODES] __read_mostly = 613cpumask_t node_2_cpu_mask[MAX_NUMNODES] __read_mostly =
614 { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE }; 614 { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE };
615EXPORT_SYMBOL(node_2_cpu_mask);
615/* which node each logical CPU is on */ 616/* which node each logical CPU is on */
616int cpu_2_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; 617int cpu_2_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 };
617EXPORT_SYMBOL(cpu_2_node); 618EXPORT_SYMBOL(cpu_2_node);
@@ -1061,7 +1062,7 @@ static void __cpuinit do_warm_boot_cpu(void *p)
1061 1062
1062static int __cpuinit __smp_prepare_cpu(int cpu) 1063static int __cpuinit __smp_prepare_cpu(int cpu)
1063{ 1064{
1064 DECLARE_COMPLETION(done); 1065 DECLARE_COMPLETION_ONSTACK(done);
1065 struct warm_boot_cpu_info info; 1066 struct warm_boot_cpu_info info;
1066 struct work_struct task; 1067 struct work_struct task;
1067 int apicid, ret; 1068 int apicid, ret;
diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c
index 8fdb1fb17a5f..4048397f1740 100644
--- a/arch/i386/kernel/sys_i386.c
+++ b/arch/i386/kernel/sys_i386.c
@@ -21,6 +21,7 @@
21#include <linux/utsname.h> 21#include <linux/utsname.h>
22 22
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <asm/unistd.h>
24#include <asm/ipc.h> 25#include <asm/ipc.h>
25 26
26/* 27/*
@@ -210,7 +211,7 @@ asmlinkage int sys_uname(struct old_utsname __user * name)
210 if (!name) 211 if (!name)
211 return -EFAULT; 212 return -EFAULT;
212 down_read(&uts_sem); 213 down_read(&uts_sem);
213 err=copy_to_user(name, &system_utsname, sizeof (*name)); 214 err = copy_to_user(name, utsname(), sizeof (*name));
214 up_read(&uts_sem); 215 up_read(&uts_sem);
215 return err?-EFAULT:0; 216 return err?-EFAULT:0;
216} 217}
@@ -226,16 +227,21 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
226 227
227 down_read(&uts_sem); 228 down_read(&uts_sem);
228 229
229 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); 230 error = __copy_to_user(&name->sysname, &utsname()->sysname,
230 error |= __put_user(0,name->sysname+__OLD_UTS_LEN); 231 __OLD_UTS_LEN);
231 error |= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); 232 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
232 error |= __put_user(0,name->nodename+__OLD_UTS_LEN); 233 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
233 error |= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); 234 __OLD_UTS_LEN);
234 error |= __put_user(0,name->release+__OLD_UTS_LEN); 235 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
235 error |= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); 236 error |= __copy_to_user(&name->release, &utsname()->release,
236 error |= __put_user(0,name->version+__OLD_UTS_LEN); 237 __OLD_UTS_LEN);
237 error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 238 error |= __put_user(0, name->release + __OLD_UTS_LEN);
238 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 239 error |= __copy_to_user(&name->version, &utsname()->version,
240 __OLD_UTS_LEN);
241 error |= __put_user(0, name->version + __OLD_UTS_LEN);
242 error |= __copy_to_user(&name->machine, &utsname()->machine,
243 __OLD_UTS_LEN);
244 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
239 245
240 up_read(&uts_sem); 246 up_read(&uts_sem);
241 247
@@ -243,3 +249,17 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
243 249
244 return error; 250 return error;
245} 251}
252
253
254/*
255 * Do a system call from kernel instead of calling sys_execve so we
256 * end up with proper pt_regs.
257 */
258int kernel_execve(const char *filename, char *const argv[], char *const envp[])
259{
260 long __res;
261 asm volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx"
262 : "=a" (__res)
263 : "0" (__NR_execve),"ri" (filename),"c" (argv), "d" (envp) : "memory");
264 return __res;
265}
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index 86944acfb647..58a2d5582419 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -76,8 +76,6 @@ int pit_latch_buggy; /* extern */
76unsigned int cpu_khz; /* Detected as we calibrate the TSC */ 76unsigned int cpu_khz; /* Detected as we calibrate the TSC */
77EXPORT_SYMBOL(cpu_khz); 77EXPORT_SYMBOL(cpu_khz);
78 78
79extern unsigned long wall_jiffies;
80
81DEFINE_SPINLOCK(rtc_lock); 79DEFINE_SPINLOCK(rtc_lock);
82EXPORT_SYMBOL(rtc_lock); 80EXPORT_SYMBOL(rtc_lock);
83 81
@@ -329,7 +327,6 @@ static int timer_resume(struct sys_device *dev)
329 do_settimeofday(&ts); 327 do_settimeofday(&ts);
330 write_seqlock_irqsave(&xtime_lock, flags); 328 write_seqlock_irqsave(&xtime_lock, flags);
331 jiffies_64 += sleep_length; 329 jiffies_64 += sleep_length;
332 wall_jiffies += sleep_length;
333 write_sequnlock_irqrestore(&xtime_lock, flags); 330 write_sequnlock_irqrestore(&xtime_lock, flags);
334 touch_softlockup_watchdog(); 331 touch_softlockup_watchdog();
335 return 0; 332 return 0;
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index a13037fe0ee3..00489b706d27 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -57,6 +57,8 @@
57 57
58#include "mach_traps.h" 58#include "mach_traps.h"
59 59
60int panic_on_unrecovered_nmi;
61
60asmlinkage int system_call(void); 62asmlinkage int system_call(void);
61 63
62struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, 64struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
@@ -355,9 +357,9 @@ void show_registers(struct pt_regs *regs)
355 KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n" 357 KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n"
356 KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n", 358 KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n",
357 smp_processor_id(), 0xffff & regs->xcs, regs->eip, 359 smp_processor_id(), 0xffff & regs->xcs, regs->eip,
358 print_tainted(), regs->eflags, system_utsname.release, 360 print_tainted(), regs->eflags, init_utsname()->release,
359 (int)strcspn(system_utsname.version, " "), 361 (int)strcspn(init_utsname()->version, " "),
360 system_utsname.version); 362 init_utsname()->version);
361 print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); 363 print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip);
362 printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", 364 printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
363 regs->eax, regs->ebx, regs->ecx, regs->edx); 365 regs->eax, regs->ebx, regs->ecx, regs->edx);
diff --git a/arch/i386/lib/delay.c b/arch/i386/lib/delay.c
index 3c0714c4b669..f6edb11364df 100644
--- a/arch/i386/lib/delay.c
+++ b/arch/i386/lib/delay.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/config.h>
15#include <linux/sched.h> 14#include <linux/sched.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17 16
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 6c86575ffdcb..856c73fcb7e7 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -99,6 +99,7 @@ static void do_boot_cpu(__u8 cpuid);
99static void do_quad_bootstrap(void); 99static void do_quad_bootstrap(void);
100 100
101int hard_smp_processor_id(void); 101int hard_smp_processor_id(void);
102int safe_smp_processor_id(void);
102 103
103/* Inline functions */ 104/* Inline functions */
104static inline void 105static inline void
@@ -1247,6 +1248,12 @@ hard_smp_processor_id(void)
1247 return 0; 1248 return 0;
1248} 1249}
1249 1250
1251int
1252safe_smp_processor_id(void)
1253{
1254 return hard_smp_processor_id();
1255}
1256
1250/* broadcast a halt to all other CPUs */ 1257/* broadcast a halt to all other CPUs */
1251void 1258void
1252smp_send_stop(void) 1259smp_send_stop(void)
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c
index ba44000b9069..f9f647cdbc7b 100644
--- a/arch/i386/mm/highmem.c
+++ b/arch/i386/mm/highmem.c
@@ -38,22 +38,19 @@ void *kmap_atomic(struct page *page, enum km_type type)
38 38
39 idx = type + KM_TYPE_NR*smp_processor_id(); 39 idx = type + KM_TYPE_NR*smp_processor_id();
40 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 40 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
41#ifdef CONFIG_DEBUG_HIGHMEM
42 if (!pte_none(*(kmap_pte-idx))) 41 if (!pte_none(*(kmap_pte-idx)))
43 BUG(); 42 BUG();
44#endif
45 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot)); 43 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
46 __flush_tlb_one(vaddr);
47 44
48 return (void*) vaddr; 45 return (void*) vaddr;
49} 46}
50 47
51void kunmap_atomic(void *kvaddr, enum km_type type) 48void kunmap_atomic(void *kvaddr, enum km_type type)
52{ 49{
53#ifdef CONFIG_DEBUG_HIGHMEM
54 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 50 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
55 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); 51 enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
56 52
53#ifdef CONFIG_DEBUG_HIGHMEM
57 if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) { 54 if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) {
58 dec_preempt_count(); 55 dec_preempt_count();
59 preempt_check_resched(); 56 preempt_check_resched();
@@ -62,14 +59,14 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
62 59
63 if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx)) 60 if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx))
64 BUG(); 61 BUG();
65 62#endif
66 /* 63 /*
67 * force other mappings to Oops if they'll try to access 64 * Force other mappings to Oops if they'll try to access this pte
68 * this pte without first remap it 65 * without first remap it. Keeping stale mappings around is a bad idea
66 * also, in case the page changes cacheability attributes or becomes
67 * a protected page in a hypervisor.
69 */ 68 */
70 pte_clear(&init_mm, vaddr, kmap_pte-idx); 69 kpte_clear_flush(kmap_pte-idx, vaddr);
71 __flush_tlb_one(vaddr);
72#endif
73 70
74 dec_preempt_count(); 71 dec_preempt_count();
75 preempt_check_resched(); 72 preempt_check_resched();
@@ -88,7 +85,6 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
88 idx = type + KM_TYPE_NR*smp_processor_id(); 85 idx = type + KM_TYPE_NR*smp_processor_id();
89 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 86 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
90 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); 87 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
91 __flush_tlb_one(vaddr);
92 88
93 return (void*) vaddr; 89 return (void*) vaddr;
94} 90}
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 4a5a914b3432..90089c14c23d 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -493,6 +493,7 @@ int __init set_kernel_exec(unsigned long vaddr, int enable)
493 pte->pte_high &= ~(1 << (_PAGE_BIT_NX - 32)); 493 pte->pte_high &= ~(1 << (_PAGE_BIT_NX - 32));
494 else 494 else
495 pte->pte_high |= 1 << (_PAGE_BIT_NX - 32); 495 pte->pte_high |= 1 << (_PAGE_BIT_NX - 32);
496 pte_update_defer(&init_mm, vaddr, pte);
496 __flush_tlb_all(); 497 __flush_tlb_all();
497out: 498out:
498 return ret; 499 return ret;
diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
index 247fde76aaed..fff08ae7b5ed 100644
--- a/arch/i386/mm/ioremap.c
+++ b/arch/i386/mm/ioremap.c
@@ -12,7 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <asm/io.h> 15#include <linux/io.h>
16#include <asm/fixmap.h> 16#include <asm/fixmap.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
@@ -21,82 +21,6 @@
21#define ISA_START_ADDRESS 0xa0000 21#define ISA_START_ADDRESS 0xa0000
22#define ISA_END_ADDRESS 0x100000 22#define ISA_END_ADDRESS 0x100000
23 23
24static int ioremap_pte_range(pmd_t *pmd, unsigned long addr,
25 unsigned long end, unsigned long phys_addr, unsigned long flags)
26{
27 pte_t *pte;
28 unsigned long pfn;
29
30 pfn = phys_addr >> PAGE_SHIFT;
31 pte = pte_alloc_kernel(pmd, addr);
32 if (!pte)
33 return -ENOMEM;
34 do {
35 BUG_ON(!pte_none(*pte));
36 set_pte(pte, pfn_pte(pfn, __pgprot(_PAGE_PRESENT | _PAGE_RW |
37 _PAGE_DIRTY | _PAGE_ACCESSED | flags)));
38 pfn++;
39 } while (pte++, addr += PAGE_SIZE, addr != end);
40 return 0;
41}
42
43static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
44 unsigned long end, unsigned long phys_addr, unsigned long flags)
45{
46 pmd_t *pmd;
47 unsigned long next;
48
49 phys_addr -= addr;
50 pmd = pmd_alloc(&init_mm, pud, addr);
51 if (!pmd)
52 return -ENOMEM;
53 do {
54 next = pmd_addr_end(addr, end);
55 if (ioremap_pte_range(pmd, addr, next, phys_addr + addr, flags))
56 return -ENOMEM;
57 } while (pmd++, addr = next, addr != end);
58 return 0;
59}
60
61static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
62 unsigned long end, unsigned long phys_addr, unsigned long flags)
63{
64 pud_t *pud;
65 unsigned long next;
66
67 phys_addr -= addr;
68 pud = pud_alloc(&init_mm, pgd, addr);
69 if (!pud)
70 return -ENOMEM;
71 do {
72 next = pud_addr_end(addr, end);
73 if (ioremap_pmd_range(pud, addr, next, phys_addr + addr, flags))
74 return -ENOMEM;
75 } while (pud++, addr = next, addr != end);
76 return 0;
77}
78
79static int ioremap_page_range(unsigned long addr,
80 unsigned long end, unsigned long phys_addr, unsigned long flags)
81{
82 pgd_t *pgd;
83 unsigned long next;
84 int err;
85
86 BUG_ON(addr >= end);
87 flush_cache_all();
88 phys_addr -= addr;
89 pgd = pgd_offset_k(addr);
90 do {
91 next = pgd_addr_end(addr, end);
92 err = ioremap_pud_range(pgd, addr, next, phys_addr+addr, flags);
93 if (err)
94 break;
95 } while (pgd++, addr = next, addr != end);
96 flush_tlb_all();
97 return err;
98}
99
100/* 24/*
101 * Generic mapping function (not visible outside): 25 * Generic mapping function (not visible outside):
102 */ 26 */
@@ -115,6 +39,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
115 void __iomem * addr; 39 void __iomem * addr;
116 struct vm_struct * area; 40 struct vm_struct * area;
117 unsigned long offset, last_addr; 41 unsigned long offset, last_addr;
42 pgprot_t prot;
118 43
119 /* Don't allow wraparound or zero size */ 44 /* Don't allow wraparound or zero size */
120 last_addr = phys_addr + size - 1; 45 last_addr = phys_addr + size - 1;
@@ -142,6 +67,9 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
142 return NULL; 67 return NULL;
143 } 68 }
144 69
70 prot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY
71 | _PAGE_ACCESSED | flags);
72
145 /* 73 /*
146 * Mappings have to be page-aligned 74 * Mappings have to be page-aligned
147 */ 75 */
@@ -158,7 +86,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
158 area->phys_addr = phys_addr; 86 area->phys_addr = phys_addr;
159 addr = (void __iomem *) area->addr; 87 addr = (void __iomem *) area->addr;
160 if (ioremap_page_range((unsigned long) addr, 88 if (ioremap_page_range((unsigned long) addr,
161 (unsigned long) addr + size, phys_addr, flags)) { 89 (unsigned long) addr + size, phys_addr, prot)) {
162 vunmap((void __force *) addr); 90 vunmap((void __force *) addr);
163 return NULL; 91 return NULL;
164 } 92 }
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index 05be8db58a8c..d0c3da3aa2aa 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -67,7 +67,10 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
67 return 0; 67 return 0;
68} 68}
69 69
70static inline void pci_exp_set_dev_base(unsigned int base, int bus, int devfn) 70/*
71 * This is always called under pci_config_lock
72 */
73static void pci_exp_set_dev_base(unsigned int base, int bus, int devfn)
71{ 74{
72 u32 dev_base = base | (bus << 20) | (devfn << 12); 75 u32 dev_base = base | (bus << 20) | (devfn << 12);
73 if (dev_base != mmcfg_last_accessed_device) { 76 if (dev_base != mmcfg_last_accessed_device) {
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 0b7f701d5cf7..70f7eb9fed35 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -516,7 +516,7 @@ source "arch/ia64/oprofile/Kconfig"
516 516
517config KPROBES 517config KPROBES
518 bool "Kprobes (EXPERIMENTAL)" 518 bool "Kprobes (EXPERIMENTAL)"
519 depends on EXPERIMENTAL && MODULES 519 depends on KALLSYMS && EXPERIMENTAL && MODULES
520 help 520 help
521 Kprobes allows you to trap at almost any kernel address and 521 Kprobes allows you to trap at almost any kernel address and
522 execute a callback function. register_kprobe() establishes 522 execute a callback function. register_kprobe() establishes
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 0daacc20ed36..246eb3d3757a 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -940,7 +940,7 @@ static inline void show_serial_version(void)
940 printk(KERN_INFO " no serial options enabled\n"); 940 printk(KERN_INFO " no serial options enabled\n");
941} 941}
942 942
943static struct tty_operations hp_ops = { 943static const struct tty_operations hp_ops = {
944 .open = rs_open, 944 .open = rs_open,
945 .close = rs_close, 945 .close = rs_close,
946 .write = rs_write, 946 .write = rs_write,
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index bddbd22706ed..9d6a3f210148 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -125,6 +125,7 @@ sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __use
125 125
126int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf) 126int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
127{ 127{
128 compat_ino_t ino;
128 int err; 129 int err;
129 130
130 if ((u64) stat->size > MAX_NON_LFS || 131 if ((u64) stat->size > MAX_NON_LFS ||
@@ -132,11 +133,15 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
132 !old_valid_dev(stat->rdev)) 133 !old_valid_dev(stat->rdev))
133 return -EOVERFLOW; 134 return -EOVERFLOW;
134 135
136 ino = stat->ino;
137 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
138 return -EOVERFLOW;
139
135 if (clear_user(ubuf, sizeof(*ubuf))) 140 if (clear_user(ubuf, sizeof(*ubuf)))
136 return -EFAULT; 141 return -EFAULT;
137 142
138 err = __put_user(old_encode_dev(stat->dev), &ubuf->st_dev); 143 err = __put_user(old_encode_dev(stat->dev), &ubuf->st_dev);
139 err |= __put_user(stat->ino, &ubuf->st_ino); 144 err |= __put_user(ino, &ubuf->st_ino);
140 err |= __put_user(stat->mode, &ubuf->st_mode); 145 err |= __put_user(stat->mode, &ubuf->st_mode);
141 err |= __put_user(stat->nlink, &ubuf->st_nlink); 146 err |= __put_user(stat->nlink, &ubuf->st_nlink);
142 err |= __put_user(high2lowuid(stat->uid), &ubuf->st_uid); 147 err |= __put_user(high2lowuid(stat->uid), &ubuf->st_uid);
@@ -1222,16 +1227,20 @@ struct readdir32_callback {
1222}; 1227};
1223 1228
1224static int 1229static int
1225filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino, 1230filldir32 (void *__buf, const char *name, int namlen, loff_t offset, u64 ino,
1226 unsigned int d_type) 1231 unsigned int d_type)
1227{ 1232{
1228 struct compat_dirent __user * dirent; 1233 struct compat_dirent __user * dirent;
1229 struct getdents32_callback * buf = (struct getdents32_callback *) __buf; 1234 struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
1230 int reclen = ROUND_UP(offsetof(struct compat_dirent, d_name) + namlen + 1, 4); 1235 int reclen = ROUND_UP(offsetof(struct compat_dirent, d_name) + namlen + 1, 4);
1236 u32 d_ino;
1231 1237
1232 buf->error = -EINVAL; /* only used if we fail.. */ 1238 buf->error = -EINVAL; /* only used if we fail.. */
1233 if (reclen > buf->count) 1239 if (reclen > buf->count)
1234 return -EINVAL; 1240 return -EINVAL;
1241 d_ino = ino;
1242 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
1243 return -EOVERFLOW;
1235 buf->error = -EFAULT; /* only used if we fail.. */ 1244 buf->error = -EFAULT; /* only used if we fail.. */
1236 dirent = buf->previous; 1245 dirent = buf->previous;
1237 if (dirent) 1246 if (dirent)
@@ -1239,7 +1248,7 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
1239 return -EFAULT; 1248 return -EFAULT;
1240 dirent = buf->current_dir; 1249 dirent = buf->current_dir;
1241 buf->previous = dirent; 1250 buf->previous = dirent;
1242 if (put_user(ino, &dirent->d_ino) 1251 if (put_user(d_ino, &dirent->d_ino)
1243 || put_user(reclen, &dirent->d_reclen) 1252 || put_user(reclen, &dirent->d_reclen)
1244 || copy_to_user(dirent->d_name, name, namlen) 1253 || copy_to_user(dirent->d_name, name, namlen)
1245 || put_user(0, dirent->d_name + namlen)) 1254 || put_user(0, dirent->d_name + namlen))
@@ -1287,17 +1296,21 @@ out:
1287} 1296}
1288 1297
1289static int 1298static int
1290fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t ino, 1299fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, u64 ino,
1291 unsigned int d_type) 1300 unsigned int d_type)
1292{ 1301{
1293 struct readdir32_callback * buf = (struct readdir32_callback *) __buf; 1302 struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
1294 struct old_linux32_dirent __user * dirent; 1303 struct old_linux32_dirent __user * dirent;
1304 u32 d_ino;
1295 1305
1296 if (buf->count) 1306 if (buf->count)
1297 return -EINVAL; 1307 return -EINVAL;
1308 d_ino = ino;
1309 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
1310 return -EOVERFLOW;
1298 buf->count++; 1311 buf->count++;
1299 dirent = buf->dirent; 1312 dirent = buf->dirent;
1300 if (put_user(ino, &dirent->d_ino) 1313 if (put_user(d_ino, &dirent->d_ino)
1301 || put_user(offset, &dirent->d_offset) 1314 || put_user(offset, &dirent->d_offset)
1302 || put_user(namlen, &dirent->d_namlen) 1315 || put_user(namlen, &dirent->d_namlen)
1303 || copy_to_user(dirent->d_name, name, namlen) 1316 || copy_to_user(dirent->d_name, name, namlen)
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 12701cf32d99..e5b1be51b197 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -492,11 +492,11 @@ GLOBAL_ENTRY(prefetch_stack)
492 br.ret.sptk.many rp 492 br.ret.sptk.many rp
493END(prefetch_stack) 493END(prefetch_stack)
494 494
495GLOBAL_ENTRY(execve) 495GLOBAL_ENTRY(kernel_execve)
496 mov r15=__NR_execve // put syscall number in place 496 mov r15=__NR_execve // put syscall number in place
497 break __BREAK_SYSCALL 497 break __BREAK_SYSCALL
498 br.ret.sptk.many rp 498 br.ret.sptk.many rp
499END(execve) 499END(kernel_execve)
500 500
501GLOBAL_ENTRY(clone) 501GLOBAL_ENTRY(clone)
502 mov r15=__NR_clone // put syscall number in place 502 mov r15=__NR_clone // put syscall number in place
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 169ec3a7156c..51217d63285e 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -90,7 +90,7 @@ static void __kprobes update_kprobe_inst_flag(uint template, uint slot,
90 p->ainsn.target_br_reg = 0; 90 p->ainsn.target_br_reg = 0;
91 91
92 /* Check for Break instruction 92 /* Check for Break instruction
93 * Bits 37:40 Major opcode to be zero 93 * Bits 37:40 Major opcode to be zero
94 * Bits 27:32 X6 to be zero 94 * Bits 27:32 X6 to be zero
95 * Bits 32:35 X3 to be zero 95 * Bits 32:35 X3 to be zero
96 */ 96 */
@@ -104,19 +104,19 @@ static void __kprobes update_kprobe_inst_flag(uint template, uint slot,
104 switch (major_opcode) { 104 switch (major_opcode) {
105 case INDIRECT_CALL_OPCODE: 105 case INDIRECT_CALL_OPCODE:
106 p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG; 106 p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG;
107 p->ainsn.target_br_reg = ((kprobe_inst >> 6) & 0x7); 107 p->ainsn.target_br_reg = ((kprobe_inst >> 6) & 0x7);
108 break; 108 break;
109 case IP_RELATIVE_PREDICT_OPCODE: 109 case IP_RELATIVE_PREDICT_OPCODE:
110 case IP_RELATIVE_BRANCH_OPCODE: 110 case IP_RELATIVE_BRANCH_OPCODE:
111 p->ainsn.inst_flag |= INST_FLAG_FIX_RELATIVE_IP_ADDR; 111 p->ainsn.inst_flag |= INST_FLAG_FIX_RELATIVE_IP_ADDR;
112 break; 112 break;
113 case IP_RELATIVE_CALL_OPCODE: 113 case IP_RELATIVE_CALL_OPCODE:
114 p->ainsn.inst_flag |= INST_FLAG_FIX_RELATIVE_IP_ADDR; 114 p->ainsn.inst_flag |= INST_FLAG_FIX_RELATIVE_IP_ADDR;
115 p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG; 115 p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG;
116 p->ainsn.target_br_reg = ((kprobe_inst >> 6) & 0x7); 116 p->ainsn.target_br_reg = ((kprobe_inst >> 6) & 0x7);
117 break; 117 break;
118 } 118 }
119 } else if (bundle_encoding[template][slot] == X) { 119 } else if (bundle_encoding[template][slot] == X) {
120 switch (major_opcode) { 120 switch (major_opcode) {
121 case LONG_CALL_OPCODE: 121 case LONG_CALL_OPCODE:
122 p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG; 122 p->ainsn.inst_flag |= INST_FLAG_FIX_BRANCH_REG;
@@ -258,18 +258,18 @@ static void __kprobes get_kprobe_inst(bundle_t *bundle, uint slot,
258 258
259 switch (slot) { 259 switch (slot) {
260 case 0: 260 case 0:
261 *major_opcode = (bundle->quad0.slot0 >> SLOT0_OPCODE_SHIFT); 261 *major_opcode = (bundle->quad0.slot0 >> SLOT0_OPCODE_SHIFT);
262 *kprobe_inst = bundle->quad0.slot0; 262 *kprobe_inst = bundle->quad0.slot0;
263 break; 263 break;
264 case 1: 264 case 1:
265 *major_opcode = (bundle->quad1.slot1_p1 >> SLOT1_p1_OPCODE_SHIFT); 265 *major_opcode = (bundle->quad1.slot1_p1 >> SLOT1_p1_OPCODE_SHIFT);
266 kprobe_inst_p0 = bundle->quad0.slot1_p0; 266 kprobe_inst_p0 = bundle->quad0.slot1_p0;
267 kprobe_inst_p1 = bundle->quad1.slot1_p1; 267 kprobe_inst_p1 = bundle->quad1.slot1_p1;
268 *kprobe_inst = kprobe_inst_p0 | (kprobe_inst_p1 << (64-46)); 268 *kprobe_inst = kprobe_inst_p0 | (kprobe_inst_p1 << (64-46));
269 break; 269 break;
270 case 2: 270 case 2:
271 *major_opcode = (bundle->quad1.slot2 >> SLOT2_OPCODE_SHIFT); 271 *major_opcode = (bundle->quad1.slot2 >> SLOT2_OPCODE_SHIFT);
272 *kprobe_inst = bundle->quad1.slot2; 272 *kprobe_inst = bundle->quad1.slot2;
273 break; 273 break;
274 } 274 }
275} 275}
@@ -290,11 +290,11 @@ static int __kprobes valid_kprobe_addr(int template, int slot,
290 return -EINVAL; 290 return -EINVAL;
291 } 291 }
292 292
293 if (in_ivt_functions(addr)) { 293 if (in_ivt_functions(addr)) {
294 printk(KERN_WARNING "Kprobes can't be inserted inside " 294 printk(KERN_WARNING "Kprobes can't be inserted inside "
295 "IVT functions at 0x%lx\n", addr); 295 "IVT functions at 0x%lx\n", addr);
296 return -EINVAL; 296 return -EINVAL;
297 } 297 }
298 298
299 if (slot == 1 && bundle_encoding[template][1] != L) { 299 if (slot == 1 && bundle_encoding[template][1] != L) {
300 printk(KERN_WARNING "Inserting kprobes on slot #1 " 300 printk(KERN_WARNING "Inserting kprobes on slot #1 "
@@ -338,12 +338,13 @@ static void kretprobe_trampoline(void)
338int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 338int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
339{ 339{
340 struct kretprobe_instance *ri = NULL; 340 struct kretprobe_instance *ri = NULL;
341 struct hlist_head *head; 341 struct hlist_head *head, empty_rp;
342 struct hlist_node *node, *tmp; 342 struct hlist_node *node, *tmp;
343 unsigned long flags, orig_ret_address = 0; 343 unsigned long flags, orig_ret_address = 0;
344 unsigned long trampoline_address = 344 unsigned long trampoline_address =
345 ((struct fnptr *)kretprobe_trampoline)->ip; 345 ((struct fnptr *)kretprobe_trampoline)->ip;
346 346
347 INIT_HLIST_HEAD(&empty_rp);
347 spin_lock_irqsave(&kretprobe_lock, flags); 348 spin_lock_irqsave(&kretprobe_lock, flags);
348 head = kretprobe_inst_table_head(current); 349 head = kretprobe_inst_table_head(current);
349 350
@@ -369,7 +370,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
369 ri->rp->handler(ri, regs); 370 ri->rp->handler(ri, regs);
370 371
371 orig_ret_address = (unsigned long)ri->ret_addr; 372 orig_ret_address = (unsigned long)ri->ret_addr;
372 recycle_rp_inst(ri); 373 recycle_rp_inst(ri, &empty_rp);
373 374
374 if (orig_ret_address != trampoline_address) 375 if (orig_ret_address != trampoline_address)
375 /* 376 /*
@@ -387,6 +388,10 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
387 spin_unlock_irqrestore(&kretprobe_lock, flags); 388 spin_unlock_irqrestore(&kretprobe_lock, flags);
388 preempt_enable_no_resched(); 389 preempt_enable_no_resched();
389 390
391 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
392 hlist_del(&ri->hlist);
393 kfree(ri);
394 }
390 /* 395 /*
391 * By returning a non-zero value, we are telling 396 * By returning a non-zero value, we are telling
392 * kprobe_handler() that we don't want the post_handler 397 * kprobe_handler() that we don't want the post_handler
@@ -424,14 +429,14 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
424 bundle_t *bundle; 429 bundle_t *bundle;
425 430
426 bundle = &((kprobe_opcode_t *)kprobe_addr)->bundle; 431 bundle = &((kprobe_opcode_t *)kprobe_addr)->bundle;
427 template = bundle->quad0.template; 432 template = bundle->quad0.template;
428 433
429 if(valid_kprobe_addr(template, slot, addr)) 434 if(valid_kprobe_addr(template, slot, addr))
430 return -EINVAL; 435 return -EINVAL;
431 436
432 /* Move to slot 2, if bundle is MLX type and kprobe slot is 1 */ 437 /* Move to slot 2, if bundle is MLX type and kprobe slot is 1 */
433 if (slot == 1 && bundle_encoding[template][1] == L) 438 if (slot == 1 && bundle_encoding[template][1] == L)
434 slot++; 439 slot++;
435 440
436 /* Get kprobe_inst and major_opcode from the bundle */ 441 /* Get kprobe_inst and major_opcode from the bundle */
437 get_kprobe_inst(bundle, slot, &kprobe_inst, &major_opcode); 442 get_kprobe_inst(bundle, slot, &kprobe_inst, &major_opcode);
@@ -489,21 +494,22 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
489 */ 494 */
490static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) 495static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
491{ 496{
492 unsigned long bundle_addr = (unsigned long) (&p->ainsn.insn->bundle); 497 unsigned long bundle_addr = (unsigned long) (&p->ainsn.insn->bundle);
493 unsigned long resume_addr = (unsigned long)p->addr & ~0xFULL; 498 unsigned long resume_addr = (unsigned long)p->addr & ~0xFULL;
494 unsigned long template; 499 unsigned long template;
495 int slot = ((unsigned long)p->addr & 0xf); 500 int slot = ((unsigned long)p->addr & 0xf);
496 501
497 template = p->ainsn.insn->bundle.quad0.template; 502 template = p->ainsn.insn->bundle.quad0.template;
498 503
499 if (slot == 1 && bundle_encoding[template][1] == L) 504 if (slot == 1 && bundle_encoding[template][1] == L)
500 slot = 2; 505 slot = 2;
501 506
502 if (p->ainsn.inst_flag) { 507 if (p->ainsn.inst_flag) {
503 508
504 if (p->ainsn.inst_flag & INST_FLAG_FIX_RELATIVE_IP_ADDR) { 509 if (p->ainsn.inst_flag & INST_FLAG_FIX_RELATIVE_IP_ADDR) {
505 /* Fix relative IP address */ 510 /* Fix relative IP address */
506 regs->cr_iip = (regs->cr_iip - bundle_addr) + resume_addr; 511 regs->cr_iip = (regs->cr_iip - bundle_addr) +
512 resume_addr;
507 } 513 }
508 514
509 if (p->ainsn.inst_flag & INST_FLAG_FIX_BRANCH_REG) { 515 if (p->ainsn.inst_flag & INST_FLAG_FIX_BRANCH_REG) {
@@ -540,18 +546,18 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
540 } 546 }
541 547
542 if (slot == 2) { 548 if (slot == 2) {
543 if (regs->cr_iip == bundle_addr + 0x10) { 549 if (regs->cr_iip == bundle_addr + 0x10) {
544 regs->cr_iip = resume_addr + 0x10; 550 regs->cr_iip = resume_addr + 0x10;
545 } 551 }
546 } else { 552 } else {
547 if (regs->cr_iip == bundle_addr) { 553 if (regs->cr_iip == bundle_addr) {
548 regs->cr_iip = resume_addr; 554 regs->cr_iip = resume_addr;
549 } 555 }
550 } 556 }
551 557
552turn_ss_off: 558turn_ss_off:
553 /* Turn off Single Step bit */ 559 /* Turn off Single Step bit */
554 ia64_psr(regs)->ss = 0; 560 ia64_psr(regs)->ss = 0;
555} 561}
556 562
557static void __kprobes prepare_ss(struct kprobe *p, struct pt_regs *regs) 563static void __kprobes prepare_ss(struct kprobe *p, struct pt_regs *regs)
@@ -587,7 +593,7 @@ static int __kprobes is_ia64_break_inst(struct pt_regs *regs)
587 593
588 /* Move to slot 2, if bundle is MLX type and kprobe slot is 1 */ 594 /* Move to slot 2, if bundle is MLX type and kprobe slot is 1 */
589 if (slot == 1 && bundle_encoding[template][1] == L) 595 if (slot == 1 && bundle_encoding[template][1] == L)
590 slot++; 596 slot++;
591 597
592 /* Get Kprobe probe instruction at given slot*/ 598 /* Get Kprobe probe instruction at given slot*/
593 get_kprobe_inst(&bundle, slot, &kprobe_inst, &major_opcode); 599 get_kprobe_inst(&bundle, slot, &kprobe_inst, &major_opcode);
@@ -627,7 +633,7 @@ static int __kprobes pre_kprobes_handler(struct die_args *args)
627 if (p) { 633 if (p) {
628 if ((kcb->kprobe_status == KPROBE_HIT_SS) && 634 if ((kcb->kprobe_status == KPROBE_HIT_SS) &&
629 (p->ainsn.inst_flag == INST_FLAG_BREAK_INST)) { 635 (p->ainsn.inst_flag == INST_FLAG_BREAK_INST)) {
630 ia64_psr(regs)->ss = 0; 636 ia64_psr(regs)->ss = 0;
631 goto no_kprobe; 637 goto no_kprobe;
632 } 638 }
633 /* We have reentered the pre_kprobe_handler(), since 639 /* We have reentered the pre_kprobe_handler(), since
@@ -887,7 +893,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
887 * fix the return address to our jprobe_inst_return() function 893 * fix the return address to our jprobe_inst_return() function
888 * in the jprobes.S file 894 * in the jprobes.S file
889 */ 895 */
890 regs->b0 = ((struct fnptr *)(jprobe_inst_return))->ip; 896 regs->b0 = ((struct fnptr *)(jprobe_inst_return))->ip;
891 897
892 return 1; 898 return 1;
893} 899}
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index bfbd8986153b..663230183254 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -388,7 +388,7 @@ ia64_log_get(int sal_info_type, u8 **buffer, int irq_safe)
388{ 388{
389 sal_log_record_header_t *log_buffer; 389 sal_log_record_header_t *log_buffer;
390 u64 total_len = 0; 390 u64 total_len = 0;
391 int s; 391 unsigned long s;
392 392
393 IA64_LOG_LOCK(sal_info_type); 393 IA64_LOG_LOCK(sal_info_type);
394 394
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
index 20340631179f..a78b45f5fe2f 100644
--- a/arch/ia64/kernel/numa.c
+++ b/arch/ia64/kernel/numa.c
@@ -28,6 +28,7 @@ u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
28EXPORT_SYMBOL(cpu_to_node_map); 28EXPORT_SYMBOL(cpu_to_node_map);
29 29
30cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; 30cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
31EXPORT_SYMBOL(node_to_cpu_mask);
31 32
32void __cpuinit map_cpu_to_node(int cpu, int nid) 33void __cpuinit map_cpu_to_node(int cpu, int nid)
33{ 34{
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index ea914cc6812a..51922b98086a 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -8,8 +8,6 @@
8 * 2005-10-07 Keith Owens <kaos@sgi.com> 8 * 2005-10-07 Keith Owens <kaos@sgi.com>
9 * Add notify_die() hooks. 9 * Add notify_die() hooks.
10 */ 10 */
11#define __KERNEL_SYSCALLS__ /* see <asm/unistd.h> */
12
13#include <linux/cpu.h> 11#include <linux/cpu.h>
14#include <linux/pm.h> 12#include <linux/pm.h>
15#include <linux/elf.h> 13#include <linux/elf.h>
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 16262687a103..62e07f906e05 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -29,8 +29,6 @@
29#include <asm/sections.h> 29#include <asm/sections.h>
30#include <asm/system.h> 30#include <asm/system.h>
31 31
32extern unsigned long wall_jiffies;
33
34volatile int time_keeper_id = 0; /* smp_processor_id() of time-keeper */ 32volatile int time_keeper_id = 0; /* smp_processor_id() of time-keeper */
35 33
36#ifdef CONFIG_IA64_DEBUG_IRQ 34#ifdef CONFIG_IA64_DEBUG_IRQ
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index 64e4c21f311c..7807fc5c0422 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -16,6 +16,7 @@
16#include <linux/node.h> 16#include <linux/node.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/bootmem.h> 18#include <linux/bootmem.h>
19#include <linux/module.h>
19#include <asm/mmzone.h> 20#include <asm/mmzone.h>
20#include <asm/numa.h> 21#include <asm/numa.h>
21 22
@@ -69,4 +70,21 @@ int early_pfn_to_nid(unsigned long pfn)
69 70
70 return 0; 71 return 0;
71} 72}
73
74#ifdef CONFIG_MEMORY_HOTPLUG
75/*
76 * SRAT information is stored in node_memblk[], then we can use SRAT
77 * information at memory-hot-add if necessary.
78 */
79
80int memory_add_physaddr_to_nid(u64 addr)
81{
82 int nid = paddr_to_nid(addr);
83 if (nid < 0)
84 return 0;
85 return nid;
86}
87
88EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
89#endif
72#endif 90#endif
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index b632b9c1e3b3..462ea178f49a 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -423,7 +423,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
423 "coherency_domain %d, " 423 "coherency_domain %d, "
424 "region_size %d\n", 424 "region_size %d\n",
425 425
426 partid, system_utsname.nodename, 426 partid, utsname()->nodename,
427 shubtype ? "shub2" : "shub1", 427 shubtype ? "shub2" : "shub1",
428 (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift, 428 (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift,
429 system_size, sharing_size, coher, region_size); 429 system_size, sharing_size, coher, region_size);
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_ate.c b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
index 1f0253bfe0a0..5eb1e1e078b4 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_ate.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
@@ -160,7 +160,7 @@ void pcibr_ate_free(struct pcibus_info *pcibus_info, int index)
160 160
161 volatile u64 ate; 161 volatile u64 ate;
162 int count; 162 int count;
163 u64 flags; 163 unsigned long flags;
164 164
165 if (pcibr_invalidate_ate) { 165 if (pcibr_invalidate_ate) {
166 /* For debugging purposes, clear the valid bit in the ATE */ 166 /* For debugging purposes, clear the valid bit in the ATE */
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index a86c7b945962..1ee977fb6ebb 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -237,7 +237,7 @@ void sn_dma_flush(u64 addr)
237 int is_tio; 237 int is_tio;
238 int wid_num; 238 int wid_num;
239 int i, j; 239 int i, j;
240 u64 flags; 240 unsigned long flags;
241 u64 itte; 241 u64 itte;
242 struct hubdev_info *hubinfo; 242 struct hubdev_info *hubinfo;
243 struct sn_flush_device_kernel *p; 243 struct sn_flush_device_kernel *p;
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index a9cea32eb824..b567351f3c52 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -25,6 +25,8 @@
25#include <asm/cachectl.h> 25#include <asm/cachectl.h>
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/ipc.h> 27#include <asm/ipc.h>
28#include <asm/syscall.h>
29#include <asm/unistd.h>
28 30
29/* 31/*
30 * sys_tas() - test-and-set 32 * sys_tas() - test-and-set
@@ -205,7 +207,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
205 if (!name) 207 if (!name)
206 return -EFAULT; 208 return -EFAULT;
207 down_read(&uts_sem); 209 down_read(&uts_sem);
208 err=copy_to_user(name, &system_utsname, sizeof (*name)); 210 err = copy_to_user(name, utsname(), sizeof (*name));
209 up_read(&uts_sem); 211 up_read(&uts_sem);
210 return err?-EFAULT:0; 212 return err?-EFAULT:0;
211} 213}
@@ -223,3 +225,21 @@ asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
223 return -ENOSYS; 225 return -ENOSYS;
224} 226}
225 227
228/*
229 * Do a system call from kernel instead of calling sys_execve so we
230 * end up with proper pt_regs.
231 */
232int kernel_execve(const char *filename, char *const argv[], char *const envp[])
233{
234 register long __scno __asm__ ("r7") = __NR_execve;
235 register long __arg3 __asm__ ("r2") = (long)(envp);
236 register long __arg2 __asm__ ("r1") = (long)(argv);
237 register long __res __asm__ ("r0") = (long)(filename);
238 __asm__ __volatile__ (
239 "trap #" SYSCALL_VECTOR "|| nop"
240 : "=r" (__res)
241 : "r" (__scno), "0" (__res), "r" (__arg2),
242 "r" (__arg3)
243 : "memory");
244 return __res;
245}
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 7a896893cd28..d8af155db984 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -38,7 +38,6 @@ extern void send_IPI_allbutself(int, int);
38extern void smp_local_timer_interrupt(struct pt_regs *); 38extern void smp_local_timer_interrupt(struct pt_regs *);
39#endif 39#endif
40 40
41extern unsigned long wall_jiffies;
42#define TICK_SIZE (tick_nsec / 1000) 41#define TICK_SIZE (tick_nsec / 1000)
43 42
44/* 43/*
@@ -108,24 +107,17 @@ void do_gettimeofday(struct timeval *tv)
108 unsigned long max_ntp_tick = tick_usec - tickadj; 107 unsigned long max_ntp_tick = tick_usec - tickadj;
109 108
110 do { 109 do {
111 unsigned long lost;
112
113 seq = read_seqbegin(&xtime_lock); 110 seq = read_seqbegin(&xtime_lock);
114 111
115 usec = do_gettimeoffset(); 112 usec = do_gettimeoffset();
116 lost = jiffies - wall_jiffies;
117 113
118 /* 114 /*
119 * If time_adjust is negative then NTP is slowing the clock 115 * If time_adjust is negative then NTP is slowing the clock
120 * so make sure not to go into next possible interval. 116 * so make sure not to go into next possible interval.
121 * Better to lose some accuracy than have time go backwards.. 117 * Better to lose some accuracy than have time go backwards..
122 */ 118 */
123 if (unlikely(time_adjust < 0)) { 119 if (unlikely(time_adjust < 0))
124 usec = min(usec, max_ntp_tick); 120 usec = min(usec, max_ntp_tick);
125 if (lost)
126 usec += lost * max_ntp_tick;
127 } else if (unlikely(lost))
128 usec += lost * tick_usec;
129 121
130 sec = xtime.tv_sec; 122 sec = xtime.tv_sec;
131 usec += (xtime.tv_nsec / 1000); 123 usec += (xtime.tv_nsec / 1000);
@@ -158,7 +150,6 @@ int do_settimeofday(struct timespec *tv)
158 * made, and then undo it! 150 * made, and then undo it!
159 */ 151 */
160 nsec -= do_gettimeoffset() * NSEC_PER_USEC; 152 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
161 nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
162 153
163 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 154 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
164 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 155 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/m32r/mm/ioremap.c b/arch/m32r/mm/ioremap.c
index a151849a605e..5152c4e6ac80 100644
--- a/arch/m32r/mm/ioremap.c
+++ b/arch/m32r/mm/ioremap.c
@@ -20,92 +20,8 @@
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21 21
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <asm/io.h> 23#include <linux/io.h>
24#include <asm/pgalloc.h> 24#include <asm/pgalloc.h>
25#include <asm/cacheflush.h>
26#include <asm/tlbflush.h>
27
28static inline void
29remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
30 unsigned long phys_addr, unsigned long flags)
31{
32 unsigned long end;
33 unsigned long pfn;
34 pgprot_t pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | _PAGE_READ
35 | _PAGE_WRITE | flags);
36
37 address &= ~PMD_MASK;
38 end = address + size;
39 if (end > PMD_SIZE)
40 end = PMD_SIZE;
41 if (address >= end)
42 BUG();
43 pfn = phys_addr >> PAGE_SHIFT;
44 do {
45 if (!pte_none(*pte)) {
46 printk("remap_area_pte: page already exists\n");
47 BUG();
48 }
49 set_pte(pte, pfn_pte(pfn, pgprot));
50 address += PAGE_SIZE;
51 pfn++;
52 pte++;
53 } while (address && (address < end));
54}
55
56static inline int
57remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
58 unsigned long phys_addr, unsigned long flags)
59{
60 unsigned long end;
61
62 address &= ~PGDIR_MASK;
63 end = address + size;
64 if (end > PGDIR_SIZE)
65 end = PGDIR_SIZE;
66 phys_addr -= address;
67 if (address >= end)
68 BUG();
69 do {
70 pte_t * pte = pte_alloc_kernel(pmd, address);
71 if (!pte)
72 return -ENOMEM;
73 remap_area_pte(pte, address, end - address, address + phys_addr, flags);
74 address = (address + PMD_SIZE) & PMD_MASK;
75 pmd++;
76 } while (address && (address < end));
77 return 0;
78}
79
80static int
81remap_area_pages(unsigned long address, unsigned long phys_addr,
82 unsigned long size, unsigned long flags)
83{
84 int error;
85 pgd_t * dir;
86 unsigned long end = address + size;
87
88 phys_addr -= address;
89 dir = pgd_offset(&init_mm, address);
90 flush_cache_all();
91 if (address >= end)
92 BUG();
93 do {
94 pmd_t *pmd;
95 pmd = pmd_alloc(&init_mm, dir, address);
96 error = -ENOMEM;
97 if (!pmd)
98 break;
99 if (remap_area_pmd(pmd, address, end - address,
100 phys_addr + address, flags))
101 break;
102 error = 0;
103 address = (address + PGDIR_SIZE) & PGDIR_MASK;
104 dir++;
105 } while (address && (address < end));
106 flush_tlb_all();
107 return error;
108}
109 25
110/* 26/*
111 * Generic mapping function (not visible outside): 27 * Generic mapping function (not visible outside):
@@ -129,6 +45,7 @@ __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
129 void __iomem * addr; 45 void __iomem * addr;
130 struct vm_struct * area; 46 struct vm_struct * area;
131 unsigned long offset, last_addr; 47 unsigned long offset, last_addr;
48 pgprot_t pgprot;
132 49
133 /* Don't allow wraparound or zero size */ 50 /* Don't allow wraparound or zero size */
134 last_addr = phys_addr + size - 1; 51 last_addr = phys_addr + size - 1;
@@ -157,6 +74,9 @@ __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
157 return NULL; 74 return NULL;
158 } 75 }
159 76
77 pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | _PAGE_READ
78 | _PAGE_WRITE | flags);
79
160 /* 80 /*
161 * Mappings have to be page-aligned 81 * Mappings have to be page-aligned
162 */ 82 */
@@ -172,7 +92,8 @@ __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
172 return NULL; 92 return NULL;
173 area->phys_addr = phys_addr; 93 area->phys_addr = phys_addr;
174 addr = (void __iomem *) area->addr; 94 addr = (void __iomem *) area->addr;
175 if (remap_area_pages((unsigned long)addr, phys_addr, size, flags)) { 95 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
96 phys_addr, pgprot)) {
176 vunmap((void __force *) addr); 97 vunmap((void __force *) addr);
177 return NULL; 98 return NULL;
178 } 99 }
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 143c552d38f3..90238a8c9e14 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -27,6 +27,7 @@
27#include <asm/traps.h> 27#include <asm/traps.h>
28#include <asm/ipc.h> 28#include <asm/ipc.h>
29#include <asm/page.h> 29#include <asm/page.h>
30#include <asm/unistd.h>
30 31
31/* 32/*
32 * sys_pipe() is the normal C calling standard for creating 33 * sys_pipe() is the normal C calling standard for creating
@@ -663,3 +664,18 @@ asmlinkage int sys_getpagesize(void)
663{ 664{
664 return PAGE_SIZE; 665 return PAGE_SIZE;
665} 666}
667
668/*
669 * Do a system call from kernel instead of calling sys_execve so we
670 * end up with proper pt_regs.
671 */
672int kernel_execve(const char *filename, char *const argv[], char *const envp[])
673{
674 register long __res asm ("%d0") = __NR_execve;
675 register long __a asm ("%d1") = (long)(filename);
676 register long __b asm ("%d2") = (long)(argv);
677 register long __c asm ("%d3") = (long)(envp);
678 asm volatile ("trap #0" : "+d" (__res)
679 : "d" (__a), "d" (__b), "d" (__c));
680 return __res;
681}
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 1072e4946a4a..6cfc984380d9 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -96,31 +96,23 @@ void time_init(void)
96void do_gettimeofday(struct timeval *tv) 96void do_gettimeofday(struct timeval *tv)
97{ 97{
98 unsigned long flags; 98 unsigned long flags;
99 extern unsigned long wall_jiffies;
100 unsigned long seq; 99 unsigned long seq;
101 unsigned long usec, sec, lost; 100 unsigned long usec, sec;
102 unsigned long max_ntp_tick = tick_usec - tickadj; 101 unsigned long max_ntp_tick = tick_usec - tickadj;
103 102
104 do { 103 do {
105 seq = read_seqbegin_irqsave(&xtime_lock, flags); 104 seq = read_seqbegin_irqsave(&xtime_lock, flags);
106 105
107 usec = mach_gettimeoffset(); 106 usec = mach_gettimeoffset();
108 lost = jiffies - wall_jiffies;
109 107
110 /* 108 /*
111 * If time_adjust is negative then NTP is slowing the clock 109 * If time_adjust is negative then NTP is slowing the clock
112 * so make sure not to go into next possible interval. 110 * so make sure not to go into next possible interval.
113 * Better to lose some accuracy than have time go backwards.. 111 * Better to lose some accuracy than have time go backwards..
114 */ 112 */
115 if (unlikely(time_adjust < 0)) { 113 if (unlikely(time_adjust < 0))
116 usec = min(usec, max_ntp_tick); 114 usec = min(usec, max_ntp_tick);
117 115
118 if (lost)
119 usec += lost * max_ntp_tick;
120 }
121 else if (unlikely(lost))
122 usec += lost * tick_usec;
123
124 sec = xtime.tv_sec; 116 sec = xtime.tv_sec;
125 usec += xtime.tv_nsec/1000; 117 usec += xtime.tv_nsec/1000;
126 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 118 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -141,7 +133,6 @@ int do_settimeofday(struct timespec *tv)
141{ 133{
142 time_t wtm_sec, sec = tv->tv_sec; 134 time_t wtm_sec, sec = tv->tv_sec;
143 long wtm_nsec, nsec = tv->tv_nsec; 135 long wtm_nsec, nsec = tv->tv_nsec;
144 extern unsigned long wall_jiffies;
145 136
146 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) 137 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
147 return -EINVAL; 138 return -EINVAL;
@@ -153,8 +144,7 @@ int do_settimeofday(struct timespec *tv)
153 * Discover what correction gettimeofday 144 * Discover what correction gettimeofday
154 * would have done, and then undo it! 145 * would have done, and then undo it!
155 */ 146 */
156 nsec -= 1000 * (mach_gettimeoffset() + 147 nsec -= 1000 * mach_gettimeoffset();
157 (jiffies - wall_jiffies) * (1000000 / HZ));
158 148
159 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 149 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
160 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 150 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index d87e1e0a1336..c3494b8447d1 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -26,6 +26,7 @@
26#include <asm/traps.h> 26#include <asm/traps.h>
27#include <asm/ipc.h> 27#include <asm/ipc.h>
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/unistd.h>
29 30
30/* 31/*
31 * sys_pipe() is the normal C calling standard for creating 32 * sys_pipe() is the normal C calling standard for creating
@@ -206,3 +207,17 @@ asmlinkage int sys_getpagesize(void)
206 return PAGE_SIZE; 207 return PAGE_SIZE;
207} 208}
208 209
210/*
211 * Do a system call from kernel instead of calling sys_execve so we
212 * end up with proper pt_regs.
213 */
214int kernel_execve(const char *filename, char *const argv[], char *const envp[])
215{
216 register long __res asm ("%d0") = __NR_execve;
217 register long __a asm ("%d1") = (long)(filename);
218 register long __b asm ("%d2") = (long)(argv);
219 register long __c asm ("%d3") = (long)(envp);
220 asm volatile ("trap #0" : "+d" (__res)
221 : "d" (__a), "d" (__b), "d" (__c));
222 return __res;
223}
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index db1e1ce0a349..c5667bdddd5e 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -26,8 +26,6 @@
26 26
27#define TICK_SIZE (tick_nsec / 1000) 27#define TICK_SIZE (tick_nsec / 1000)
28 28
29extern unsigned long wall_jiffies;
30
31 29
32static inline int set_rtc_mmss(unsigned long nowtime) 30static inline int set_rtc_mmss(unsigned long nowtime)
33{ 31{
@@ -124,15 +122,12 @@ void time_init(void)
124void do_gettimeofday(struct timeval *tv) 122void do_gettimeofday(struct timeval *tv)
125{ 123{
126 unsigned long flags; 124 unsigned long flags;
127 unsigned long lost, seq; 125 unsigned long seq;
128 unsigned long usec, sec; 126 unsigned long usec, sec;
129 127
130 do { 128 do {
131 seq = read_seqbegin_irqsave(&xtime_lock, flags); 129 seq = read_seqbegin_irqsave(&xtime_lock, flags);
132 usec = mach_gettimeoffset ? mach_gettimeoffset() : 0; 130 usec = mach_gettimeoffset ? mach_gettimeoffset() : 0;
133 lost = jiffies - wall_jiffies;
134 if (lost)
135 usec += lost * (1000000 / HZ);
136 sec = xtime.tv_sec; 131 sec = xtime.tv_sec;
137 usec += (xtime.tv_nsec / 1000); 132 usec += (xtime.tv_nsec / 1000);
138 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 133 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 30750c54bdf5..87cee341eb54 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -537,6 +537,7 @@ config QEMU
537 select SYS_HAS_CPU_MIPS32_R1 537 select SYS_HAS_CPU_MIPS32_R1
538 select SYS_SUPPORTS_32BIT_KERNEL 538 select SYS_SUPPORTS_32BIT_KERNEL
539 select SYS_SUPPORTS_BIG_ENDIAN 539 select SYS_SUPPORTS_BIG_ENDIAN
540 select SYS_SUPPORTS_LITTLE_ENDIAN
540 select ARCH_SPARSEMEM_ENABLE 541 select ARCH_SPARSEMEM_ENABLE
541 help 542 help
542 Qemu is a software emulator which among other architectures also 543 Qemu is a software emulator which among other architectures also
@@ -1841,6 +1842,14 @@ config RWSEM_GENERIC_SPINLOCK
1841 bool 1842 bool
1842 default y 1843 default y
1843 1844
1845config LOCKDEP_SUPPORT
1846 bool
1847 default y
1848
1849config STACKTRACE_SUPPORT
1850 bool
1851 default y
1852
1844source "init/Kconfig" 1853source "init/Kconfig"
1845 1854
1846menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)" 1855menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
diff --git a/arch/mips/basler/excite/excite_flashtest.c b/arch/mips/basler/excite/excite_flashtest.c
deleted file mode 100644
index f0024a8e3294..000000000000
--- a/arch/mips/basler/excite/excite_flashtest.c
+++ /dev/null
@@ -1,294 +0,0 @@
1/*
2* Copyright (C) 2005 by Basler Vision Technologies AG
3* Author: Thies Moeller <thies.moeller@baslerweb.com>
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation; either version 2 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program; if not, write to the Free Software
17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20#include <linux/module.h>
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/kernel.h>
24#include <linux/string.h>
25#include <linux/ioport.h>
26#include <linux/device.h>
27#include <linux/delay.h>
28#include <linux/err.h>
29#include <linux/kernel.h>
30
31#include <excite.h>
32
33#include <asm/io.h>
34
35#include <linux/mtd/mtd.h>
36#include <linux/mtd/nand.h>
37#include <linux/mtd/nand_ecc.h>
38#include <linux/mtd/partitions.h>
39#include <asm/rm9k-ocd.h> // for ocd_write
40#include <linux/workqueue.h> // for queue
41
42#include "excite_nandflash.h"
43#include "nandflash.h"
44
45#define PFX "excite flashtest: "
46typedef void __iomem *io_reg_t;
47
48#define io_readb(__a__) __raw_readb((__a__))
49#define io_writeb(__v__, __a__) __raw_writeb((__v__), (__a__))
50
51
52
53static inline const struct resource *excite_nandflash_get_resource(
54 struct platform_device *d, unsigned long flags, const char *basename)
55{
56 const char fmt[] = "%s_%u";
57 char buf[80];
58
59 if (unlikely(snprintf(buf, sizeof buf, fmt, basename, d->id) >= sizeof buf))
60 return NULL;
61
62 return platform_get_resource_byname(d, flags, buf);
63}
64
65static inline io_reg_t
66excite_nandflash_map_regs(struct platform_device *d, const char *basename)
67{
68 void *result = NULL;
69 const struct resource *const r =
70 excite_nandflash_get_resource(d, IORESOURCE_MEM, basename);
71 if (r)
72 result = ioremap_nocache(r->start, r->end + 1 - r->start);
73 return result;
74}
75
76/* controller and mtd information */
77
78struct excite_nandflash_drvdata {
79 struct mtd_info board_mtd;
80 struct nand_chip board_chip;
81 io_reg_t regs;
82};
83
84
85/* command and control functions */
86static void excite_nandflash_hwcontrol(struct mtd_info *mtd, int cmd)
87{
88 struct nand_chip *this = mtd->priv;
89 io_reg_t regs = container_of(mtd,struct excite_nandflash_drvdata,board_mtd)->regs;
90
91 switch (cmd) {
92 /* Select the command latch */
93 case NAND_CTL_SETCLE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_CMD;
94 break;
95 /* Deselect the command latch */
96 case NAND_CTL_CLRCLE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_DATA;
97 break;
98 /* Select the address latch */
99 case NAND_CTL_SETALE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_ADDR;
100 break;
101 /* Deselect the address latch */
102 case NAND_CTL_CLRALE: this->IO_ADDR_W = regs + EXCITE_NANDFLASH_DATA;
103 break;
104 /* Select the chip -- not used */
105 case NAND_CTL_SETNCE:
106 break;
107 /* Deselect the chip -- not used */
108 case NAND_CTL_CLRNCE:
109 break;
110 }
111
112 this->IO_ADDR_R = this->IO_ADDR_W;
113}
114
115/* excite_nandflash_devready()
116 *
117 * returns 0 if the nand is busy, 1 if it is ready
118 */
119static int excite_nandflash_devready(struct mtd_info *mtd)
120{
121 struct excite_nandflash_drvdata *drvdata =
122 container_of(mtd, struct excite_nandflash_drvdata, board_mtd);
123
124 return io_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS);
125}
126
127/* device management functions */
128
129/* excite_nandflash_remove
130 *
131 * called by device layer to remove the driver
132 * the binding to the mtd and all allocated
133 * resources are released
134 */
135static int excite_nandflash_remove(struct device *dev)
136{
137 struct excite_nandflash_drvdata *this = dev_get_drvdata(dev);
138
139 pr_info(PFX "remove");
140
141 dev_set_drvdata(dev, NULL);
142
143 if (this == NULL) {
144 pr_debug(PFX "call remove without private data!!");
145 return 0;
146 }
147
148
149 /* free the common resources */
150 if (this->regs != NULL) {
151 iounmap(this->regs);
152 this->regs = NULL;
153 }
154
155 kfree(this);
156
157 return 0;
158}
159
160static int elapsed;
161
162void my_workqueue_handler(void *arg)
163{
164 elapsed = 1;
165}
166
167DECLARE_WORK(sigElapsed, my_workqueue_handler, 0);
168
169
170/* excite_nandflash_probe
171 *
172 * called by device layer when it finds a device matching
173 * one our driver can handled. This code checks to see if
174 * it can allocate all necessary resources then calls the
175 * nand layer to look for devices
176*/
177static int excite_nandflash_probe(struct device *dev)
178{
179 struct platform_device *pdev = to_platform_device(dev);
180
181 struct excite_nandflash_drvdata *drvdata; /* private driver data */
182 struct nand_chip *board_chip; /* private flash chip data */
183 struct mtd_info *board_mtd; /* mtd info for this board */
184
185 int err = 0;
186 int count = 0;
187 struct timeval tv,endtv;
188 unsigned int dt;
189
190 pr_info(PFX "probe dev: (%p)\n", dev);
191
192 pr_info(PFX "adjust LB timing\n");
193 ocd_writel(0x00000330, LDP2);
194
195 drvdata = kmalloc(sizeof(*drvdata), GFP_KERNEL);
196 if (unlikely(!drvdata)) {
197 printk(KERN_ERR PFX "no memory for drvdata\n");
198 err = -ENOMEM;
199 goto mem_error;
200 }
201
202 /* Initialize structures */
203 memset(drvdata, 0, sizeof(*drvdata));
204
205 /* bind private data into driver */
206 dev_set_drvdata(dev, drvdata);
207
208 /* allocate and map the resource */
209 drvdata->regs =
210 excite_nandflash_map_regs(pdev, EXCITE_NANDFLASH_RESOURCE_REGS);
211
212 if (unlikely(!drvdata->regs)) {
213 printk(KERN_ERR PFX "cannot reserve register region\n");
214 err = -ENXIO;
215 goto io_error;
216 }
217
218 /* initialise our chip */
219 board_chip = &drvdata->board_chip;
220
221 board_chip->IO_ADDR_R = drvdata->regs + EXCITE_NANDFLASH_DATA;
222 board_chip->IO_ADDR_W = drvdata->regs + EXCITE_NANDFLASH_DATA;
223
224 board_chip->hwcontrol = excite_nandflash_hwcontrol;
225 board_chip->dev_ready = excite_nandflash_devready;
226
227 board_chip->chip_delay = 25;
228 #if 0
229 /* TODO: speedup the initial scan */
230 board_chip->options = NAND_USE_FLASH_BBT;
231 #endif
232 board_chip->eccmode = NAND_ECC_SOFT;
233
234 /* link chip to mtd */
235 board_mtd = &drvdata->board_mtd;
236 board_mtd->priv = board_chip;
237
238
239 pr_info(PFX "FlashTest\n");
240 elapsed = 0;
241/* schedule_delayed_work(&sigElapsed, 1*HZ);
242 while (!elapsed) {
243 io_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS);
244 count++;
245 }
246 pr_info(PFX "reads in 1 sec --> %d\n",count);
247*/
248 do_gettimeofday(&tv);
249 for (count = 0 ; count < 1000000; count ++) {
250 io_readb(drvdata->regs + EXCITE_NANDFLASH_STATUS);
251 }
252 do_gettimeofday(&endtv);
253 dt = (endtv.tv_sec - tv.tv_sec) * 1000000 + endtv.tv_usec - tv.tv_usec;
254 pr_info(PFX "%8d us timeval\n",dt);
255 pr_info(PFX "EndFlashTest\n");
256
257/* return with error to unload everything
258*/
259io_error:
260 iounmap(drvdata->regs);
261
262mem_error:
263 kfree(drvdata);
264
265 if (err == 0)
266 err = -EINVAL;
267 return err;
268}
269
270static struct device_driver excite_nandflash_driver = {
271 .name = "excite_nand",
272 .bus = &platform_bus_type,
273 .probe = excite_nandflash_probe,
274 .remove = excite_nandflash_remove,
275};
276
277static int __init excite_nandflash_init(void)
278{
279 pr_info(PFX "register Driver (Rev: $Revision:$)\n");
280 return driver_register(&excite_nandflash_driver);
281}
282
283static void __exit excite_nandflash_exit(void)
284{
285 driver_unregister(&excite_nandflash_driver);
286 pr_info(PFX "Driver unregistered");
287}
288
289module_init(excite_nandflash_init);
290module_exit(excite_nandflash_exit);
291
292MODULE_AUTHOR("Thies Moeller <thies.moeller@baslerweb.com>");
293MODULE_DESCRIPTION("Basler eXcite NAND-Flash driver");
294MODULE_LICENSE("GPL");
diff --git a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
index d3705284de39..35931bedc3df 100644
--- a/arch/mips/configs/atlas_defconfig
+++ b/arch/mips/configs/atlas_defconfig
@@ -161,6 +161,8 @@ CONFIG_HZ=100
161CONFIG_PREEMPT_NONE=y 161CONFIG_PREEMPT_NONE=y
162# CONFIG_PREEMPT_VOLUNTARY is not set 162# CONFIG_PREEMPT_VOLUNTARY is not set
163# CONFIG_PREEMPT is not set 163# CONFIG_PREEMPT is not set
164CONFIG_LOCKDEP_SUPPORT=y
165CONFIG_STACKTRACE_SUPPORT=y
164CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 166CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
165 167
166# 168#
@@ -1304,6 +1306,7 @@ CONFIG_NLS_UTF8=m
1304# 1306#
1305# Kernel hacking 1307# Kernel hacking
1306# 1308#
1309CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1307# CONFIG_PRINTK_TIME is not set 1310# CONFIG_PRINTK_TIME is not set
1308# CONFIG_MAGIC_SYSRQ is not set 1311# CONFIG_MAGIC_SYSRQ is not set
1309# CONFIG_UNUSED_SYMBOLS is not set 1312# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index e12a475dcbf4..c6a015940b41 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -167,6 +167,8 @@ CONFIG_PREEMPT_NONE=y
167# CONFIG_PREEMPT_VOLUNTARY is not set 167# CONFIG_PREEMPT_VOLUNTARY is not set
168# CONFIG_PREEMPT is not set 168# CONFIG_PREEMPT is not set
169# CONFIG_PREEMPT_BKL is not set 169# CONFIG_PREEMPT_BKL is not set
170CONFIG_LOCKDEP_SUPPORT=y
171CONFIG_STACKTRACE_SUPPORT=y
170CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 172CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
171 173
172# 174#
@@ -904,6 +906,7 @@ CONFIG_MSDOS_PARTITION=y
904# 906#
905# Kernel hacking 907# Kernel hacking
906# 908#
909CONFIG_TRACE_IRQFLAGS_SUPPORT=y
907CONFIG_PRINTK_TIME=y 910CONFIG_PRINTK_TIME=y
908CONFIG_MAGIC_SYSRQ=y 911CONFIG_MAGIC_SYSRQ=y
909# CONFIG_UNUSED_SYMBOLS is not set 912# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index bfade9abb767..e5358121d2da 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -149,6 +149,8 @@ CONFIG_HZ=1000
149CONFIG_PREEMPT_NONE=y 149CONFIG_PREEMPT_NONE=y
150# CONFIG_PREEMPT_VOLUNTARY is not set 150# CONFIG_PREEMPT_VOLUNTARY is not set
151# CONFIG_PREEMPT is not set 151# CONFIG_PREEMPT is not set
152CONFIG_LOCKDEP_SUPPORT=y
153CONFIG_STACKTRACE_SUPPORT=y
152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
153 155
154# 156#
@@ -891,6 +893,7 @@ CONFIG_MSDOS_PARTITION=y
891# 893#
892# Kernel hacking 894# Kernel hacking
893# 895#
896CONFIG_TRACE_IRQFLAGS_SUPPORT=y
894# CONFIG_PRINTK_TIME is not set 897# CONFIG_PRINTK_TIME is not set
895# CONFIG_MAGIC_SYSRQ is not set 898# CONFIG_MAGIC_SYSRQ is not set
896# CONFIG_UNUSED_SYMBOLS is not set 899# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 4baf2ff1128a..adf1e8c98c65 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -146,6 +146,8 @@ CONFIG_HZ=1000
146CONFIG_PREEMPT_NONE=y 146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set 147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
149CONFIG_LOCKDEP_SUPPORT=y
150CONFIG_STACKTRACE_SUPPORT=y
149CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
150 152
151# 153#
@@ -889,6 +891,7 @@ CONFIG_MSDOS_PARTITION=y
889# 891#
890# Kernel hacking 892# Kernel hacking
891# 893#
894CONFIG_TRACE_IRQFLAGS_SUPPORT=y
892# CONFIG_PRINTK_TIME is not set 895# CONFIG_PRINTK_TIME is not set
893# CONFIG_MAGIC_SYSRQ is not set 896# CONFIG_MAGIC_SYSRQ is not set
894# CONFIG_UNUSED_SYMBOLS is not set 897# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index 93cca1585bc3..4fd29ffdfb8d 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
@@ -1006,6 +1008,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1006# 1008#
1007# Kernel hacking 1009# Kernel hacking
1008# 1010#
1011CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1009# CONFIG_PRINTK_TIME is not set 1012# CONFIG_PRINTK_TIME is not set
1010# CONFIG_MAGIC_SYSRQ is not set 1013# CONFIG_MAGIC_SYSRQ is not set
1011# CONFIG_UNUSED_SYMBOLS is not set 1014# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index ffd99252a837..025b960ba990 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
@@ -1006,6 +1008,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1006# 1008#
1007# Kernel hacking 1009# Kernel hacking
1008# 1010#
1011CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1009# CONFIG_PRINTK_TIME is not set 1012# CONFIG_PRINTK_TIME is not set
1010# CONFIG_MAGIC_SYSRQ is not set 1013# CONFIG_MAGIC_SYSRQ is not set
1011# CONFIG_UNUSED_SYMBOLS is not set 1014# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index 63eac5e89b9c..80c9dd98f897 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
@@ -1087,6 +1089,7 @@ CONFIG_NLS_UTF8=m
1087# 1089#
1088# Kernel hacking 1090# Kernel hacking
1089# 1091#
1092CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1090# CONFIG_PRINTK_TIME is not set 1093# CONFIG_PRINTK_TIME is not set
1091# CONFIG_MAGIC_SYSRQ is not set 1094# CONFIG_MAGIC_SYSRQ is not set
1092# CONFIG_UNUSED_SYMBOLS is not set 1095# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index 25a095f7dc4e..6caa90b0e176 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -149,6 +149,8 @@ CONFIG_HZ=1000
149CONFIG_PREEMPT_NONE=y 149CONFIG_PREEMPT_NONE=y
150# CONFIG_PREEMPT_VOLUNTARY is not set 150# CONFIG_PREEMPT_VOLUNTARY is not set
151# CONFIG_PREEMPT is not set 151# CONFIG_PREEMPT is not set
152CONFIG_LOCKDEP_SUPPORT=y
153CONFIG_STACKTRACE_SUPPORT=y
152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
153 155
154# 156#
@@ -1290,6 +1292,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1290# 1292#
1291# Kernel hacking 1293# Kernel hacking
1292# 1294#
1295CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1293# CONFIG_PRINTK_TIME is not set 1296# CONFIG_PRINTK_TIME is not set
1294# CONFIG_MAGIC_SYSRQ is not set 1297# CONFIG_MAGIC_SYSRQ is not set
1295# CONFIG_UNUSED_SYMBOLS is not set 1298# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index dda469c842b3..c6cae86c6ab7 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -148,6 +148,8 @@ CONFIG_HZ=1000
148CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_LOCKDEP_SUPPORT=y
152CONFIG_STACKTRACE_SUPPORT=y
151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 153CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
152 154
153# 155#
@@ -1111,6 +1113,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1111# 1113#
1112# Kernel hacking 1114# Kernel hacking
1113# 1115#
1116CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1114# CONFIG_PRINTK_TIME is not set 1117# CONFIG_PRINTK_TIME is not set
1115# CONFIG_MAGIC_SYSRQ is not set 1118# CONFIG_MAGIC_SYSRQ is not set
1116# CONFIG_UNUSED_SYMBOLS is not set 1119# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
index fcd3dd19bc74..72f24001c99e 100644
--- a/arch/mips/configs/ddb5477_defconfig
+++ b/arch/mips/configs/ddb5477_defconfig
@@ -146,6 +146,8 @@ CONFIG_HZ=1000
146CONFIG_PREEMPT_NONE=y 146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set 147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set 148# CONFIG_PREEMPT is not set
149CONFIG_LOCKDEP_SUPPORT=y
150CONFIG_STACKTRACE_SUPPORT=y
149CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
150 152
151# 153#
@@ -852,6 +854,7 @@ CONFIG_MSDOS_PARTITION=y
852# 854#
853# Kernel hacking 855# Kernel hacking
854# 856#
857CONFIG_TRACE_IRQFLAGS_SUPPORT=y
855# CONFIG_PRINTK_TIME is not set 858# CONFIG_PRINTK_TIME is not set
856# CONFIG_MAGIC_SYSRQ is not set 859# CONFIG_MAGIC_SYSRQ is not set
857# CONFIG_UNUSED_SYMBOLS is not set 860# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index 8683e0df12e0..be901df7fefa 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=128
147CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
@@ -828,6 +830,7 @@ CONFIG_ULTRIX_PARTITION=y
828# 830#
829# Kernel hacking 831# Kernel hacking
830# 832#
833CONFIG_TRACE_IRQFLAGS_SUPPORT=y
831# CONFIG_PRINTK_TIME is not set 834# CONFIG_PRINTK_TIME is not set
832CONFIG_MAGIC_SYSRQ=y 835CONFIG_MAGIC_SYSRQ=y
833# CONFIG_UNUSED_SYMBOLS is not set 836# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index 4ace61c95778..6133c28beb8c 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
diff --git a/arch/mips/configs/emma2rh_defconfig b/arch/mips/configs/emma2rh_defconfig
index 5847c916c130..a484b7d396fc 100644
--- a/arch/mips/configs/emma2rh_defconfig
+++ b/arch/mips/configs/emma2rh_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=1000
147# CONFIG_PREEMPT_VOLUNTARY is not set 147# CONFIG_PREEMPT_VOLUNTARY is not set
148CONFIG_PREEMPT=y 148CONFIG_PREEMPT=y
149CONFIG_PREEMPT_BKL=y 149CONFIG_PREEMPT_BKL=y
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
@@ -1180,6 +1182,7 @@ CONFIG_NLS_UTF8=m
1180# 1182#
1181# Kernel hacking 1183# Kernel hacking
1182# 1184#
1185CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1183# CONFIG_PRINTK_TIME is not set 1186# CONFIG_PRINTK_TIME is not set
1184# CONFIG_MAGIC_SYSRQ is not set 1187# CONFIG_MAGIC_SYSRQ is not set
1185# CONFIG_UNUSED_SYMBOLS is not set 1188# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ev64120_defconfig b/arch/mips/configs/ev64120_defconfig
index bc4c4f125c48..21bfcdebf8f5 100644
--- a/arch/mips/configs/ev64120_defconfig
+++ b/arch/mips/configs/ev64120_defconfig
@@ -148,6 +148,8 @@ CONFIG_HZ=1000
148CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_LOCKDEP_SUPPORT=y
152CONFIG_STACKTRACE_SUPPORT=y
151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 153CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
152 154
153# 155#
@@ -842,6 +844,7 @@ CONFIG_MSDOS_PARTITION=y
842# 844#
843# Kernel hacking 845# Kernel hacking
844# 846#
847CONFIG_TRACE_IRQFLAGS_SUPPORT=y
845# CONFIG_PRINTK_TIME is not set 848# CONFIG_PRINTK_TIME is not set
846# CONFIG_MAGIC_SYSRQ is not set 849# CONFIG_MAGIC_SYSRQ is not set
847# CONFIG_UNUSED_SYMBOLS is not set 850# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/excite_defconfig b/arch/mips/configs/excite_defconfig
index eb87cbbfd037..1a5b06cfb4d6 100644
--- a/arch/mips/configs/excite_defconfig
+++ b/arch/mips/configs/excite_defconfig
@@ -149,6 +149,8 @@ CONFIG_HZ=1000
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150CONFIG_PREEMPT=y 150CONFIG_PREEMPT=y
151CONFIG_PREEMPT_BKL=y 151CONFIG_PREEMPT_BKL=y
152CONFIG_LOCKDEP_SUPPORT=y
153CONFIG_STACKTRACE_SUPPORT=y
152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
153 155
154# 156#
@@ -1184,6 +1186,7 @@ CONFIG_NLS_ISO8859_1=m
1184# 1186#
1185# Kernel hacking 1187# Kernel hacking
1186# 1188#
1189CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1187# CONFIG_PRINTK_TIME is not set 1190# CONFIG_PRINTK_TIME is not set
1188# CONFIG_MAGIC_SYSRQ is not set 1191# CONFIG_MAGIC_SYSRQ is not set
1189# CONFIG_UNUSED_SYMBOLS is not set 1192# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index cc9b24eda9e8..21d53e0c9ee8 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153# CONFIG_PREEMPT_NONE is not set 153# CONFIG_PREEMPT_NONE is not set
154CONFIG_PREEMPT_VOLUNTARY=y 154CONFIG_PREEMPT_VOLUNTARY=y
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -1147,6 +1149,7 @@ CONFIG_NLS_UTF8=m
1147# 1149#
1148# Kernel hacking 1150# Kernel hacking
1149# 1151#
1152CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1150# CONFIG_PRINTK_TIME is not set 1153# CONFIG_PRINTK_TIME is not set
1151# CONFIG_MAGIC_SYSRQ is not set 1154# CONFIG_MAGIC_SYSRQ is not set
1152# CONFIG_UNUSED_SYMBOLS is not set 1155# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 50092ba8aa71..e3e94c7e5ee1 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -162,6 +162,8 @@ CONFIG_PREEMPT_NONE=y
162# CONFIG_PREEMPT is not set 162# CONFIG_PREEMPT is not set
163CONFIG_PREEMPT_BKL=y 163CONFIG_PREEMPT_BKL=y
164# CONFIG_MIPS_INSANE_LARGE is not set 164# CONFIG_MIPS_INSANE_LARGE is not set
165CONFIG_LOCKDEP_SUPPORT=y
166CONFIG_STACKTRACE_SUPPORT=y
165CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 167CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
166 168
167# 169#
@@ -980,6 +982,7 @@ CONFIG_SGI_PARTITION=y
980# 982#
981# Kernel hacking 983# Kernel hacking
982# 984#
985CONFIG_TRACE_IRQFLAGS_SUPPORT=y
983# CONFIG_PRINTK_TIME is not set 986# CONFIG_PRINTK_TIME is not set
984# CONFIG_MAGIC_SYSRQ is not set 987# CONFIG_MAGIC_SYSRQ is not set
985# CONFIG_UNUSED_SYMBOLS is not set 988# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index dec2ba6ba03f..b4ab2bea9723 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153# CONFIG_PREEMPT_NONE is not set 153# CONFIG_PREEMPT_NONE is not set
154CONFIG_PREEMPT_VOLUNTARY=y 154CONFIG_PREEMPT_VOLUNTARY=y
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -922,6 +924,7 @@ CONFIG_SGI_PARTITION=y
922# 924#
923# Kernel hacking 925# Kernel hacking
924# 926#
927CONFIG_TRACE_IRQFLAGS_SUPPORT=y
925# CONFIG_PRINTK_TIME is not set 928# CONFIG_PRINTK_TIME is not set
926# CONFIG_MAGIC_SYSRQ is not set 929# CONFIG_MAGIC_SYSRQ is not set
927# CONFIG_UNUSED_SYMBOLS is not set 930# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/it8172_defconfig b/arch/mips/configs/it8172_defconfig
index 37f9dd7187b1..18d20fb7d5f0 100644
--- a/arch/mips/configs/it8172_defconfig
+++ b/arch/mips/configs/it8172_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
@@ -900,6 +902,7 @@ CONFIG_MSDOS_PARTITION=y
900# 902#
901# Kernel hacking 903# Kernel hacking
902# 904#
905CONFIG_TRACE_IRQFLAGS_SUPPORT=y
903# CONFIG_PRINTK_TIME is not set 906# CONFIG_PRINTK_TIME is not set
904# CONFIG_MAGIC_SYSRQ is not set 907# CONFIG_MAGIC_SYSRQ is not set
905# CONFIG_UNUSED_SYMBOLS is not set 908# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ivr_defconfig b/arch/mips/configs/ivr_defconfig
index 18874a4c24fe..99831d0bf76b 100644
--- a/arch/mips/configs/ivr_defconfig
+++ b/arch/mips/configs/ivr_defconfig
@@ -144,6 +144,8 @@ CONFIG_HZ=1000
144CONFIG_PREEMPT_NONE=y 144CONFIG_PREEMPT_NONE=y
145# CONFIG_PREEMPT_VOLUNTARY is not set 145# CONFIG_PREEMPT_VOLUNTARY is not set
146# CONFIG_PREEMPT is not set 146# CONFIG_PREEMPT is not set
147CONFIG_LOCKDEP_SUPPORT=y
148CONFIG_STACKTRACE_SUPPORT=y
147CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 149CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
148 150
149# 151#
@@ -856,6 +858,7 @@ CONFIG_MSDOS_PARTITION=y
856# 858#
857# Kernel hacking 859# Kernel hacking
858# 860#
861CONFIG_TRACE_IRQFLAGS_SUPPORT=y
859# CONFIG_PRINTK_TIME is not set 862# CONFIG_PRINTK_TIME is not set
860# CONFIG_MAGIC_SYSRQ is not set 863# CONFIG_MAGIC_SYSRQ is not set
861# CONFIG_UNUSED_SYMBOLS is not set 864# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/jaguar-atx_defconfig b/arch/mips/configs/jaguar-atx_defconfig
index 9f1e3048d623..9d4d17ace123 100644
--- a/arch/mips/configs/jaguar-atx_defconfig
+++ b/arch/mips/configs/jaguar-atx_defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153CONFIG_PREEMPT_NONE=y 153CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set 154# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -775,6 +777,7 @@ CONFIG_MSDOS_PARTITION=y
775# 777#
776# Kernel hacking 778# Kernel hacking
777# 779#
780CONFIG_TRACE_IRQFLAGS_SUPPORT=y
778# CONFIG_PRINTK_TIME is not set 781# CONFIG_PRINTK_TIME is not set
779# CONFIG_MAGIC_SYSRQ is not set 782# CONFIG_MAGIC_SYSRQ is not set
780# CONFIG_UNUSED_SYMBOLS is not set 783# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index fded3f73815f..d03746667a96 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -143,6 +143,8 @@ CONFIG_PREEMPT_NONE=y
143# CONFIG_PREEMPT_VOLUNTARY is not set 143# CONFIG_PREEMPT_VOLUNTARY is not set
144# CONFIG_PREEMPT is not set 144# CONFIG_PREEMPT is not set
145CONFIG_RTC_DS1742=y 145CONFIG_RTC_DS1742=y
146CONFIG_LOCKDEP_SUPPORT=y
147CONFIG_STACKTRACE_SUPPORT=y
146CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 148CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
147 149
148# 150#
@@ -872,6 +874,7 @@ CONFIG_MSDOS_PARTITION=y
872# 874#
873# Kernel hacking 875# Kernel hacking
874# 876#
877CONFIG_TRACE_IRQFLAGS_SUPPORT=y
875# CONFIG_PRINTK_TIME is not set 878# CONFIG_PRINTK_TIME is not set
876# CONFIG_MAGIC_SYSRQ is not set 879# CONFIG_MAGIC_SYSRQ is not set
877# CONFIG_UNUSED_SYMBOLS is not set 880# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/lasat200_defconfig b/arch/mips/configs/lasat200_defconfig
index 320b8cdd6e58..1db8249b4c0f 100644
--- a/arch/mips/configs/lasat200_defconfig
+++ b/arch/mips/configs/lasat200_defconfig
@@ -151,6 +151,8 @@ CONFIG_HZ=1000
151CONFIG_PREEMPT_NONE=y 151CONFIG_PREEMPT_NONE=y
152# CONFIG_PREEMPT_VOLUNTARY is not set 152# CONFIG_PREEMPT_VOLUNTARY is not set
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
155 157
156# 158#
@@ -970,6 +972,7 @@ CONFIG_MSDOS_PARTITION=y
970# 972#
971# Kernel hacking 973# Kernel hacking
972# 974#
975CONFIG_TRACE_IRQFLAGS_SUPPORT=y
973# CONFIG_PRINTK_TIME is not set 976# CONFIG_PRINTK_TIME is not set
974# CONFIG_MAGIC_SYSRQ is not set 977# CONFIG_MAGIC_SYSRQ is not set
975# CONFIG_UNUSED_SYMBOLS is not set 978# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 0ba1ef5048fb..aeefe2873e38 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -170,6 +170,8 @@ CONFIG_HZ=100
170CONFIG_PREEMPT_NONE=y 170CONFIG_PREEMPT_NONE=y
171# CONFIG_PREEMPT_VOLUNTARY is not set 171# CONFIG_PREEMPT_VOLUNTARY is not set
172# CONFIG_PREEMPT is not set 172# CONFIG_PREEMPT is not set
173CONFIG_LOCKDEP_SUPPORT=y
174CONFIG_STACKTRACE_SUPPORT=y
173CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 175CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
174 176
175# 177#
@@ -1341,6 +1343,7 @@ CONFIG_NLS_UTF8=m
1341# 1343#
1342# Kernel hacking 1344# Kernel hacking
1343# 1345#
1346CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1344# CONFIG_PRINTK_TIME is not set 1347# CONFIG_PRINTK_TIME is not set
1345# CONFIG_MAGIC_SYSRQ is not set 1348# CONFIG_MAGIC_SYSRQ is not set
1346# CONFIG_UNUSED_SYMBOLS is not set 1349# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index adbeeadddb8f..a3cbd23bf217 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -148,6 +148,8 @@ CONFIG_HZ=1000
148CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_LOCKDEP_SUPPORT=y
152CONFIG_STACKTRACE_SUPPORT=y
151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 153CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
152 154
153# 155#
@@ -799,6 +801,7 @@ CONFIG_MSDOS_PARTITION=y
799# 801#
800# Kernel hacking 802# Kernel hacking
801# 803#
804CONFIG_TRACE_IRQFLAGS_SUPPORT=y
802# CONFIG_PRINTK_TIME is not set 805# CONFIG_PRINTK_TIME is not set
803# CONFIG_MAGIC_SYSRQ is not set 806# CONFIG_MAGIC_SYSRQ is not set
804# CONFIG_UNUSED_SYMBOLS is not set 807# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index 79fd544fcb2a..6570b47426ce 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -148,6 +148,8 @@ CONFIG_HZ=1000
148CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_LOCKDEP_SUPPORT=y
152CONFIG_STACKTRACE_SUPPORT=y
151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 153CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
152 154
153# 155#
diff --git a/arch/mips/configs/ocelot_3_defconfig b/arch/mips/configs/ocelot_3_defconfig
index 4d87da2b99fd..440d65f93a94 100644
--- a/arch/mips/configs/ocelot_3_defconfig
+++ b/arch/mips/configs/ocelot_3_defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153CONFIG_PREEMPT_NONE=y 153CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set 154# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -1091,6 +1093,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1091# 1093#
1092# Kernel hacking 1094# Kernel hacking
1093# 1095#
1096CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1094# CONFIG_PRINTK_TIME is not set 1097# CONFIG_PRINTK_TIME is not set
1095# CONFIG_MAGIC_SYSRQ is not set 1098# CONFIG_MAGIC_SYSRQ is not set
1096# CONFIG_UNUSED_SYMBOLS is not set 1099# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ocelot_c_defconfig b/arch/mips/configs/ocelot_c_defconfig
index a7ac2b0a8273..c2c7ae77da3e 100644
--- a/arch/mips/configs/ocelot_c_defconfig
+++ b/arch/mips/configs/ocelot_c_defconfig
@@ -150,6 +150,8 @@ CONFIG_HZ=1000
150CONFIG_PREEMPT_NONE=y 150CONFIG_PREEMPT_NONE=y
151# CONFIG_PREEMPT_VOLUNTARY is not set 151# CONFIG_PREEMPT_VOLUNTARY is not set
152# CONFIG_PREEMPT is not set 152# CONFIG_PREEMPT is not set
153CONFIG_LOCKDEP_SUPPORT=y
154CONFIG_STACKTRACE_SUPPORT=y
153CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 155CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
154 156
155# 157#
@@ -839,6 +841,7 @@ CONFIG_MSDOS_PARTITION=y
839# 841#
840# Kernel hacking 842# Kernel hacking
841# 843#
844CONFIG_TRACE_IRQFLAGS_SUPPORT=y
842# CONFIG_PRINTK_TIME is not set 845# CONFIG_PRINTK_TIME is not set
843# CONFIG_MAGIC_SYSRQ is not set 846# CONFIG_MAGIC_SYSRQ is not set
844# CONFIG_UNUSED_SYMBOLS is not set 847# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
index 853e7bba5122..67efe270e0cc 100644
--- a/arch/mips/configs/ocelot_defconfig
+++ b/arch/mips/configs/ocelot_defconfig
@@ -154,6 +154,8 @@ CONFIG_HZ=1000
154CONFIG_PREEMPT_NONE=y 154CONFIG_PREEMPT_NONE=y
155# CONFIG_PREEMPT_VOLUNTARY is not set 155# CONFIG_PREEMPT_VOLUNTARY is not set
156# CONFIG_PREEMPT is not set 156# CONFIG_PREEMPT is not set
157CONFIG_LOCKDEP_SUPPORT=y
158CONFIG_STACKTRACE_SUPPORT=y
157CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 159CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
158 160
159# 161#
@@ -788,6 +790,7 @@ CONFIG_MSDOS_PARTITION=y
788# 790#
789# Kernel hacking 791# Kernel hacking
790# 792#
793CONFIG_TRACE_IRQFLAGS_SUPPORT=y
791# CONFIG_PRINTK_TIME is not set 794# CONFIG_PRINTK_TIME is not set
792# CONFIG_MAGIC_SYSRQ is not set 795# CONFIG_MAGIC_SYSRQ is not set
793# CONFIG_UNUSED_SYMBOLS is not set 796# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/ocelot_g_defconfig b/arch/mips/configs/ocelot_g_defconfig
index 8524efa23a49..a10f34de5f7e 100644
--- a/arch/mips/configs/ocelot_g_defconfig
+++ b/arch/mips/configs/ocelot_g_defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153CONFIG_PREEMPT_NONE=y 153CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set 154# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -842,6 +844,7 @@ CONFIG_MSDOS_PARTITION=y
842# 844#
843# Kernel hacking 845# Kernel hacking
844# 846#
847CONFIG_TRACE_IRQFLAGS_SUPPORT=y
845# CONFIG_PRINTK_TIME is not set 848# CONFIG_PRINTK_TIME is not set
846# CONFIG_MAGIC_SYSRQ is not set 849# CONFIG_MAGIC_SYSRQ is not set
847# CONFIG_UNUSED_SYMBOLS is not set 850# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 1a16e92900cb..741f8258075c 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -149,6 +149,8 @@ CONFIG_HZ=1000
149CONFIG_PREEMPT_NONE=y 149CONFIG_PREEMPT_NONE=y
150# CONFIG_PREEMPT_VOLUNTARY is not set 150# CONFIG_PREEMPT_VOLUNTARY is not set
151# CONFIG_PREEMPT is not set 151# CONFIG_PREEMPT is not set
152CONFIG_LOCKDEP_SUPPORT=y
153CONFIG_STACKTRACE_SUPPORT=y
152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
153 155
154# 156#
@@ -1000,6 +1002,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1000# 1002#
1001# Kernel hacking 1003# Kernel hacking
1002# 1004#
1005CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1003# CONFIG_PRINTK_TIME is not set 1006# CONFIG_PRINTK_TIME is not set
1004# CONFIG_MAGIC_SYSRQ is not set 1007# CONFIG_MAGIC_SYSRQ is not set
1005# CONFIG_UNUSED_SYMBOLS is not set 1008# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index 9ea8edea6f29..8576340714da 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -148,6 +148,8 @@ CONFIG_HZ=1000
148CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_LOCKDEP_SUPPORT=y
152CONFIG_STACKTRACE_SUPPORT=y
151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 153CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
152 154
153# 155#
@@ -1106,6 +1108,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1106# 1108#
1107# Kernel hacking 1109# Kernel hacking
1108# 1110#
1111CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1109# CONFIG_PRINTK_TIME is not set 1112# CONFIG_PRINTK_TIME is not set
1110# CONFIG_MAGIC_SYSRQ is not set 1113# CONFIG_MAGIC_SYSRQ is not set
1111# CONFIG_UNUSED_SYMBOLS is not set 1114# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index c4a158976f8f..3db7427d1b55 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -148,6 +148,8 @@ CONFIG_HZ=1000
148CONFIG_PREEMPT_NONE=y 148CONFIG_PREEMPT_NONE=y
149# CONFIG_PREEMPT_VOLUNTARY is not set 149# CONFIG_PREEMPT_VOLUNTARY is not set
150# CONFIG_PREEMPT is not set 150# CONFIG_PREEMPT is not set
151CONFIG_LOCKDEP_SUPPORT=y
152CONFIG_STACKTRACE_SUPPORT=y
151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 153CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
152 154
153# 155#
@@ -1098,6 +1100,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1098# 1100#
1099# Kernel hacking 1101# Kernel hacking
1100# 1102#
1103CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1101# CONFIG_PRINTK_TIME is not set 1104# CONFIG_PRINTK_TIME is not set
1102# CONFIG_MAGIC_SYSRQ is not set 1105# CONFIG_MAGIC_SYSRQ is not set
1103# CONFIG_UNUSED_SYMBOLS is not set 1106# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 1cbf270c301c..26b0b9883496 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153CONFIG_PREEMPT_NONE=y 153CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set 154# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -876,6 +878,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
876# 878#
877# Kernel hacking 879# Kernel hacking
878# 880#
881CONFIG_TRACE_IRQFLAGS_SUPPORT=y
879# CONFIG_PRINTK_TIME is not set 882# CONFIG_PRINTK_TIME is not set
880CONFIG_MAGIC_SYSRQ=y 883CONFIG_MAGIC_SYSRQ=y
881# CONFIG_UNUSED_SYMBOLS is not set 884# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/pnx8550-v2pci_defconfig b/arch/mips/configs/pnx8550-v2pci_defconfig
index bec30b15b9bd..e93266b37dd9 100644
--- a/arch/mips/configs/pnx8550-v2pci_defconfig
+++ b/arch/mips/configs/pnx8550-v2pci_defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153CONFIG_PREEMPT_NONE=y 153CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set 154# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -1057,6 +1059,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1057# 1059#
1058# Kernel hacking 1060# Kernel hacking
1059# 1061#
1062CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1060# CONFIG_PRINTK_TIME is not set 1063# CONFIG_PRINTK_TIME is not set
1061# CONFIG_MAGIC_SYSRQ is not set 1064# CONFIG_MAGIC_SYSRQ is not set
1062# CONFIG_UNUSED_SYMBOLS is not set 1065# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index f5f799e93707..9b0dab822bd0 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -145,6 +145,8 @@ CONFIG_HZ=100
145CONFIG_PREEMPT_NONE=y 145CONFIG_PREEMPT_NONE=y
146# CONFIG_PREEMPT_VOLUNTARY is not set 146# CONFIG_PREEMPT_VOLUNTARY is not set
147# CONFIG_PREEMPT is not set 147# CONFIG_PREEMPT is not set
148CONFIG_LOCKDEP_SUPPORT=y
149CONFIG_STACKTRACE_SUPPORT=y
148CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
149 151
150# 152#
@@ -733,6 +735,7 @@ CONFIG_MSDOS_PARTITION=y
733# 735#
734# Kernel hacking 736# Kernel hacking
735# 737#
738CONFIG_TRACE_IRQFLAGS_SUPPORT=y
736# CONFIG_PRINTK_TIME is not set 739# CONFIG_PRINTK_TIME is not set
737# CONFIG_MAGIC_SYSRQ is not set 740# CONFIG_MAGIC_SYSRQ is not set
738# CONFIG_UNUSED_SYMBOLS is not set 741# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/rbhma4500_defconfig b/arch/mips/configs/rbhma4500_defconfig
index 2f5650227ba3..dd0296036026 100644
--- a/arch/mips/configs/rbhma4500_defconfig
+++ b/arch/mips/configs/rbhma4500_defconfig
@@ -155,6 +155,8 @@ CONFIG_HZ=1000
155CONFIG_PREEMPT_NONE=y 155CONFIG_PREEMPT_NONE=y
156# CONFIG_PREEMPT_VOLUNTARY is not set 156# CONFIG_PREEMPT_VOLUNTARY is not set
157# CONFIG_PREEMPT is not set 157# CONFIG_PREEMPT is not set
158CONFIG_LOCKDEP_SUPPORT=y
159CONFIG_STACKTRACE_SUPPORT=y
158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 160CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
159 161
160# 162#
@@ -1335,6 +1337,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1335# 1337#
1336# Kernel hacking 1338# Kernel hacking
1337# 1339#
1340CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1338# CONFIG_PRINTK_TIME is not set 1341# CONFIG_PRINTK_TIME is not set
1339# CONFIG_MAGIC_SYSRQ is not set 1342# CONFIG_MAGIC_SYSRQ is not set
1340# CONFIG_UNUSED_SYMBOLS is not set 1343# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index 4fee90b2b100..d8a498d64d62 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -158,6 +158,8 @@ CONFIG_HZ=1000
158# CONFIG_PREEMPT_NONE is not set 158# CONFIG_PREEMPT_NONE is not set
159CONFIG_PREEMPT_VOLUNTARY=y 159CONFIG_PREEMPT_VOLUNTARY=y
160# CONFIG_PREEMPT is not set 160# CONFIG_PREEMPT is not set
161CONFIG_LOCKDEP_SUPPORT=y
162CONFIG_STACKTRACE_SUPPORT=y
161CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 163CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
162 164
163# 165#
@@ -1584,6 +1586,7 @@ CONFIG_NLS_UTF8=m
1584# 1586#
1585# Kernel hacking 1587# Kernel hacking
1586# 1588#
1589CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1587# CONFIG_PRINTK_TIME is not set 1590# CONFIG_PRINTK_TIME is not set
1588# CONFIG_MAGIC_SYSRQ is not set 1591# CONFIG_MAGIC_SYSRQ is not set
1589# CONFIG_UNUSED_SYMBOLS is not set 1592# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 9041f095f96f..805a4fe450f5 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -171,6 +171,8 @@ CONFIG_PREEMPT_NONE=y
171# CONFIG_PREEMPT_VOLUNTARY is not set 171# CONFIG_PREEMPT_VOLUNTARY is not set
172# CONFIG_PREEMPT is not set 172# CONFIG_PREEMPT is not set
173CONFIG_PREEMPT_BKL=y 173CONFIG_PREEMPT_BKL=y
174CONFIG_LOCKDEP_SUPPORT=y
175CONFIG_STACKTRACE_SUPPORT=y
174CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 176CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
175 177
176# 178#
@@ -873,6 +875,7 @@ CONFIG_MSDOS_PARTITION=y
873# 875#
874# Kernel hacking 876# Kernel hacking
875# 877#
878CONFIG_TRACE_IRQFLAGS_SUPPORT=y
876# CONFIG_PRINTK_TIME is not set 879# CONFIG_PRINTK_TIME is not set
877# CONFIG_MAGIC_SYSRQ is not set 880# CONFIG_MAGIC_SYSRQ is not set
878# CONFIG_UNUSED_SYMBOLS is not set 881# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
index 02abb2f1bfaf..6fcb656d8d87 100644
--- a/arch/mips/configs/sead_defconfig
+++ b/arch/mips/configs/sead_defconfig
@@ -151,6 +151,8 @@ CONFIG_HZ=1000
151CONFIG_PREEMPT_NONE=y 151CONFIG_PREEMPT_NONE=y
152# CONFIG_PREEMPT_VOLUNTARY is not set 152# CONFIG_PREEMPT_VOLUNTARY is not set
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
155 157
156# 158#
@@ -581,6 +583,7 @@ CONFIG_PARTITION_ADVANCED=y
581# 583#
582# Kernel hacking 584# Kernel hacking
583# 585#
586CONFIG_TRACE_IRQFLAGS_SUPPORT=y
584# CONFIG_PRINTK_TIME is not set 587# CONFIG_PRINTK_TIME is not set
585# CONFIG_MAGIC_SYSRQ is not set 588# CONFIG_MAGIC_SYSRQ is not set
586# CONFIG_UNUSED_SYMBOLS is not set 589# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index ca3d0c4ba15b..dc312f19ada7 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -151,6 +151,8 @@ CONFIG_HZ=1000
151CONFIG_PREEMPT_NONE=y 151CONFIG_PREEMPT_NONE=y
152# CONFIG_PREEMPT_VOLUNTARY is not set 152# CONFIG_PREEMPT_VOLUNTARY is not set
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
155 157
156# 158#
@@ -1059,6 +1061,7 @@ CONFIG_MSDOS_PARTITION=y
1059# 1061#
1060# Kernel hacking 1062# Kernel hacking
1061# 1063#
1064CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1062# CONFIG_PRINTK_TIME is not set 1065# CONFIG_PRINTK_TIME is not set
1063# CONFIG_MAGIC_SYSRQ is not set 1066# CONFIG_MAGIC_SYSRQ is not set
1064# CONFIG_UNUSED_SYMBOLS is not set 1067# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig
index 4e2009ace278..85615d99b01a 100644
--- a/arch/mips/configs/tb0229_defconfig
+++ b/arch/mips/configs/tb0229_defconfig
@@ -151,6 +151,8 @@ CONFIG_HZ=1000
151CONFIG_PREEMPT_NONE=y 151CONFIG_PREEMPT_NONE=y
152# CONFIG_PREEMPT_VOLUNTARY is not set 152# CONFIG_PREEMPT_VOLUNTARY is not set
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
155 157
156# 158#
@@ -968,6 +970,7 @@ CONFIG_MSDOS_PARTITION=y
968# 970#
969# Kernel hacking 971# Kernel hacking
970# 972#
973CONFIG_TRACE_IRQFLAGS_SUPPORT=y
971# CONFIG_PRINTK_TIME is not set 974# CONFIG_PRINTK_TIME is not set
972# CONFIG_MAGIC_SYSRQ is not set 975# CONFIG_MAGIC_SYSRQ is not set
973# CONFIG_UNUSED_SYMBOLS is not set 976# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index 535a813d01a9..ad7271b3f266 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -151,6 +151,8 @@ CONFIG_HZ=1000
151CONFIG_PREEMPT_NONE=y 151CONFIG_PREEMPT_NONE=y
152# CONFIG_PREEMPT_VOLUNTARY is not set 152# CONFIG_PREEMPT_VOLUNTARY is not set
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154CONFIG_LOCKDEP_SUPPORT=y
155CONFIG_STACKTRACE_SUPPORT=y
154CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
155 157
156# 158#
@@ -1146,6 +1148,7 @@ CONFIG_MSDOS_PARTITION=y
1146# 1148#
1147# Kernel hacking 1149# Kernel hacking
1148# 1150#
1151CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1149# CONFIG_PRINTK_TIME is not set 1152# CONFIG_PRINTK_TIME is not set
1150# CONFIG_MAGIC_SYSRQ is not set 1153# CONFIG_MAGIC_SYSRQ is not set
1151# CONFIG_UNUSED_SYMBOLS is not set 1154# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index 3a3ef20b21cc..863f6a7cadfd 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -147,6 +147,8 @@ CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y 147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set 148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set 149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
150CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
151 153
152# 154#
diff --git a/arch/mips/configs/wrppmc_defconfig b/arch/mips/configs/wrppmc_defconfig
index e6b1dea55842..c10267d61cc9 100644
--- a/arch/mips/configs/wrppmc_defconfig
+++ b/arch/mips/configs/wrppmc_defconfig
@@ -155,6 +155,8 @@ CONFIG_HZ=1000
155CONFIG_PREEMPT_NONE=y 155CONFIG_PREEMPT_NONE=y
156# CONFIG_PREEMPT_VOLUNTARY is not set 156# CONFIG_PREEMPT_VOLUNTARY is not set
157# CONFIG_PREEMPT is not set 157# CONFIG_PREEMPT is not set
158CONFIG_LOCKDEP_SUPPORT=y
159CONFIG_STACKTRACE_SUPPORT=y
158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 160CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
159 161
160# 162#
@@ -829,6 +831,7 @@ CONFIG_MSDOS_PARTITION=y
829# 831#
830# Kernel hacking 832# Kernel hacking
831# 833#
834CONFIG_TRACE_IRQFLAGS_SUPPORT=y
832# CONFIG_PRINTK_TIME is not set 835# CONFIG_PRINTK_TIME is not set
833# CONFIG_MAGIC_SYSRQ is not set 836# CONFIG_MAGIC_SYSRQ is not set
834# CONFIG_UNUSED_SYMBOLS is not set 837# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index 06a072b77b1c..4d3c1329f3cf 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -152,6 +152,8 @@ CONFIG_PREEMPT_NONE=y
152# CONFIG_PREEMPT_VOLUNTARY is not set 152# CONFIG_PREEMPT_VOLUNTARY is not set
153# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154CONFIG_PREEMPT_BKL=y 154CONFIG_PREEMPT_BKL=y
155CONFIG_LOCKDEP_SUPPORT=y
156CONFIG_STACKTRACE_SUPPORT=y
155CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 157CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
156 158
157# 159#
@@ -760,6 +762,7 @@ CONFIG_MSDOS_PARTITION=y
760# 762#
761# Kernel hacking 763# Kernel hacking
762# 764#
765CONFIG_TRACE_IRQFLAGS_SUPPORT=y
763# CONFIG_PRINTK_TIME is not set 766# CONFIG_PRINTK_TIME is not set
764# CONFIG_MAGIC_SYSRQ is not set 767# CONFIG_MAGIC_SYSRQ is not set
765# CONFIG_UNUSED_SYMBOLS is not set 768# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
index cc9b24eda9e8..21d53e0c9ee8 100644
--- a/arch/mips/defconfig
+++ b/arch/mips/defconfig
@@ -153,6 +153,8 @@ CONFIG_HZ=1000
153# CONFIG_PREEMPT_NONE is not set 153# CONFIG_PREEMPT_NONE is not set
154CONFIG_PREEMPT_VOLUNTARY=y 154CONFIG_PREEMPT_VOLUNTARY=y
155# CONFIG_PREEMPT is not set 155# CONFIG_PREEMPT is not set
156CONFIG_LOCKDEP_SUPPORT=y
157CONFIG_STACKTRACE_SUPPORT=y
156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 158CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
157 159
158# 160#
@@ -1147,6 +1149,7 @@ CONFIG_NLS_UTF8=m
1147# 1149#
1148# Kernel hacking 1150# Kernel hacking
1149# 1151#
1152CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1150# CONFIG_PRINTK_TIME is not set 1153# CONFIG_PRINTK_TIME is not set
1151# CONFIG_MAGIC_SYSRQ is not set 1154# CONFIG_MAGIC_SYSRQ is not set
1152# CONFIG_UNUSED_SYMBOLS is not set 1155# CONFIG_UNUSED_SYMBOLS is not set
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 881c467c6982..cd9cec9e39e9 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -11,6 +11,7 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
11binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ 11binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
12 irix5sys.o sysirix.o 12 irix5sys.o sysirix.o
13 13
14obj-$(CONFIG_STACKTRACE) += stacktrace.o
14obj-$(CONFIG_MODULES) += mips_ksyms.o module.o 15obj-$(CONFIG_MODULES) += mips_ksyms.o module.o
15 16
16obj-$(CONFIG_APM) += apm.o 17obj-$(CONFIG_APM) += apm.o
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 37fda3dcdfc5..af6ef2fd8300 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -220,8 +220,8 @@ NESTED(except_vec_vi_handler, 0, sp)
220 CLI 220 CLI
221 TRACE_IRQS_OFF 221 TRACE_IRQS_OFF
222 move a0, sp 222 move a0, sp
223 jalr v0 223 PTR_LA ra, ret_from_irq
224 j ret_from_irq 224 jr v0
225 END(except_vec_vi_handler) 225 END(except_vec_vi_handler)
226 226
227/* 227/*
@@ -349,8 +349,8 @@ NESTED(nmi_handler, PT_SIZE, sp)
349 .set at 349 .set at
350 __BUILD_\verbose \exception 350 __BUILD_\verbose \exception
351 move a0, sp 351 move a0, sp
352 jal do_\handler 352 PTR_LA ra, ret_from_exception
353 j ret_from_exception 353 j do_\handler
354 END(handle_\exception) 354 END(handle_\exception)
355 .endm 355 .endm
356 356
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index ea36c8e8852c..48e3418c217b 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -302,11 +302,11 @@ static struct irqaction irq2 = {
302}; 302};
303 303
304static struct resource pic1_io_resource = { 304static struct resource pic1_io_resource = {
305 .name = "pic1", .start = 0x20, .end = 0x3f, .flags = IORESOURCE_BUSY 305 .name = "pic1", .start = 0x20, .end = 0x21, .flags = IORESOURCE_BUSY
306}; 306};
307 307
308static struct resource pic2_io_resource = { 308static struct resource pic2_io_resource = {
309 .name = "pic2", .start = 0xa0, .end = 0xbf, .flags = IORESOURCE_BUSY 309 .name = "pic2", .start = 0xa0, .end = 0xa1, .flags = IORESOURCE_BUSY
310}; 310};
311 311
312/* 312/*
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 43b1162d714f..53f4171fc188 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -77,6 +77,8 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
77 memset(&tmp, 0, sizeof(tmp)); 77 memset(&tmp, 0, sizeof(tmp));
78 tmp.st_dev = new_encode_dev(stat->dev); 78 tmp.st_dev = new_encode_dev(stat->dev);
79 tmp.st_ino = stat->ino; 79 tmp.st_ino = stat->ino;
80 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino)
81 return -EOVERFLOW;
80 tmp.st_mode = stat->mode; 82 tmp.st_mode = stat->mode;
81 tmp.st_nlink = stat->nlink; 83 tmp.st_nlink = stat->nlink;
82 SET_UID(tmp.st_uid, stat->uid); 84 SET_UID(tmp.st_uid, stat->uid);
@@ -1039,7 +1041,7 @@ asmlinkage long sys32_newuname(struct new_utsname __user * name)
1039 int ret = 0; 1041 int ret = 0;
1040 1042
1041 down_read(&uts_sem); 1043 down_read(&uts_sem);
1042 if (copy_to_user(name,&system_utsname,sizeof *name)) 1044 if (copy_to_user(name, utsname(), sizeof *name))
1043 ret = -EFAULT; 1045 ret = -EFAULT;
1044 up_read(&uts_sem); 1046 up_read(&uts_sem);
1045 1047
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 2613a0dd4b82..045d987bc683 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -40,6 +40,7 @@
40#include <asm/elf.h> 40#include <asm/elf.h>
41#include <asm/isadep.h> 41#include <asm/isadep.h>
42#include <asm/inst.h> 42#include <asm/inst.h>
43#include <asm/stacktrace.h>
43#ifdef CONFIG_MIPS_MT_SMTC 44#ifdef CONFIG_MIPS_MT_SMTC
44#include <asm/mipsmtregs.h> 45#include <asm/mipsmtregs.h>
45extern void smtc_idle_loop_hook(void); 46extern void smtc_idle_loop_hook(void);
@@ -398,7 +399,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
398#ifdef CONFIG_KALLSYMS 399#ifdef CONFIG_KALLSYMS
399/* used by show_backtrace() */ 400/* used by show_backtrace() */
400unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, 401unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
401 unsigned long pc, unsigned long ra) 402 unsigned long pc, unsigned long *ra)
402{ 403{
403 unsigned long stack_page; 404 unsigned long stack_page;
404 struct mips_frame_info info; 405 struct mips_frame_info info;
@@ -406,18 +407,42 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
406 char namebuf[KSYM_NAME_LEN + 1]; 407 char namebuf[KSYM_NAME_LEN + 1];
407 unsigned long size, ofs; 408 unsigned long size, ofs;
408 int leaf; 409 int leaf;
410 extern void ret_from_irq(void);
411 extern void ret_from_exception(void);
409 412
410 stack_page = (unsigned long)task_stack_page(task); 413 stack_page = (unsigned long)task_stack_page(task);
411 if (!stack_page) 414 if (!stack_page)
412 return 0; 415 return 0;
413 416
417 /*
418 * If we reached the bottom of interrupt context,
419 * return saved pc in pt_regs.
420 */
421 if (pc == (unsigned long)ret_from_irq ||
422 pc == (unsigned long)ret_from_exception) {
423 struct pt_regs *regs;
424 if (*sp >= stack_page &&
425 *sp + sizeof(*regs) <= stack_page + THREAD_SIZE - 32) {
426 regs = (struct pt_regs *)*sp;
427 pc = regs->cp0_epc;
428 if (__kernel_text_address(pc)) {
429 *sp = regs->regs[29];
430 *ra = regs->regs[31];
431 return pc;
432 }
433 }
434 return 0;
435 }
414 if (!kallsyms_lookup(pc, &size, &ofs, &modname, namebuf)) 436 if (!kallsyms_lookup(pc, &size, &ofs, &modname, namebuf))
415 return 0; 437 return 0;
416 /* 438 /*
417 * Return ra if an exception occured at the first instruction 439 * Return ra if an exception occured at the first instruction
418 */ 440 */
419 if (unlikely(ofs == 0)) 441 if (unlikely(ofs == 0)) {
420 return ra; 442 pc = *ra;
443 *ra = 0;
444 return pc;
445 }
421 446
422 info.func = (void *)(pc - ofs); 447 info.func = (void *)(pc - ofs);
423 info.func_size = ofs; /* analyze from start to ofs */ 448 info.func_size = ofs; /* analyze from start to ofs */
@@ -436,11 +461,12 @@ unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
436 * one. In that cases avoid to return always the 461 * one. In that cases avoid to return always the
437 * same value. 462 * same value.
438 */ 463 */
439 pc = pc != ra ? ra : 0; 464 pc = pc != *ra ? *ra : 0;
440 else 465 else
441 pc = ((unsigned long *)(*sp))[info.pc_offset]; 466 pc = ((unsigned long *)(*sp))[info.pc_offset];
442 467
443 *sp += info.frame_size; 468 *sp += info.frame_size;
469 *ra = 0;
444 return __kernel_text_address(pc) ? pc : 0; 470 return __kernel_text_address(pc) ? pc : 0;
445} 471}
446#endif 472#endif
@@ -453,6 +479,7 @@ unsigned long get_wchan(struct task_struct *task)
453 unsigned long pc = 0; 479 unsigned long pc = 0;
454#ifdef CONFIG_KALLSYMS 480#ifdef CONFIG_KALLSYMS
455 unsigned long sp; 481 unsigned long sp;
482 unsigned long ra = 0;
456#endif 483#endif
457 484
458 if (!task || task == current || task->state == TASK_RUNNING) 485 if (!task || task == current || task->state == TASK_RUNNING)
@@ -466,7 +493,7 @@ unsigned long get_wchan(struct task_struct *task)
466 sp = task->thread.reg29 + schedule_mfi.frame_size; 493 sp = task->thread.reg29 + schedule_mfi.frame_size;
467 494
468 while (in_sched_functions(pc)) 495 while (in_sched_functions(pc))
469 pc = unwind_stack(task, &sp, pc, 0); 496 pc = unwind_stack(task, &sp, pc, &ra);
470#endif 497#endif
471 498
472out: 499out:
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index e71785102206..61362e6fa9ec 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -28,18 +28,7 @@
28NESTED(handle_sys, PT_SIZE, sp) 28NESTED(handle_sys, PT_SIZE, sp)
29 .set noat 29 .set noat
30 SAVE_SOME 30 SAVE_SOME
31#ifdef CONFIG_TRACE_IRQFLAGS 31 TRACE_IRQS_ON_RELOAD
32 TRACE_IRQS_ON
33#ifdef CONFIG_64BIT
34 LONG_L $8, PT_R8(sp)
35 LONG_L $9, PT_R9(sp)
36#endif
37 LONG_L $7, PT_R7(sp)
38 LONG_L $6, PT_R6(sp)
39 LONG_L $5, PT_R5(sp)
40 LONG_L $4, PT_R4(sp)
41 LONG_L $2, PT_R2(sp)
42#endif
43 STI 32 STI
44 .set at 33 .set at
45 34
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 4c22d0b4825d..6c7b5ed0ea6e 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -34,7 +34,7 @@ NESTED(handle_sys64, PT_SIZE, sp)
34 */ 34 */
35 .set noat 35 .set noat
36 SAVE_SOME 36 SAVE_SOME
37 TRACE_IRQS_ON 37 TRACE_IRQS_ON_RELOAD
38 STI 38 STI
39 .set at 39 .set at
40#endif 40#endif
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index f25c2a2f1038..6d9f18727ac5 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -33,7 +33,7 @@ NESTED(handle_sysn32, PT_SIZE, sp)
33#ifndef CONFIG_MIPS32_O32 33#ifndef CONFIG_MIPS32_O32
34 .set noat 34 .set noat
35 SAVE_SOME 35 SAVE_SOME
36 TRACE_IRQS_ON 36 TRACE_IRQS_ON_RELOAD
37 STI 37 STI
38 .set at 38 .set at
39#endif 39#endif
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 288ee4ac4dbb..2e6d0673163e 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -28,7 +28,7 @@
28NESTED(handle_sys, PT_SIZE, sp) 28NESTED(handle_sys, PT_SIZE, sp)
29 .set noat 29 .set noat
30 SAVE_SOME 30 SAVE_SOME
31 TRACE_IRQS_ON 31 TRACE_IRQS_ON_RELOAD
32 STI 32 STI
33 .set at 33 .set at
34 ld t1, PT_EPC(sp) # skip syscall on return 34 ld t1, PT_EPC(sp) # skip syscall on return
diff --git a/arch/mips/kernel/stacktrace.c b/arch/mips/kernel/stacktrace.c
new file mode 100644
index 000000000000..4aabe526a68e
--- /dev/null
+++ b/arch/mips/kernel/stacktrace.c
@@ -0,0 +1,85 @@
1/*
2 * arch/mips/kernel/stacktrace.c
3 *
4 * Stack trace management functions
5 *
6 * Copyright (C) 2006 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
7 */
8#include <linux/sched.h>
9#include <linux/stacktrace.h>
10#include <asm/stacktrace.h>
11
12/*
13 * Save stack-backtrace addresses into a stack_trace buffer:
14 */
15static void save_raw_context_stack(struct stack_trace *trace,
16 unsigned long reg29)
17{
18 unsigned long *sp = (unsigned long *)reg29;
19 unsigned long addr;
20
21 while (!kstack_end(sp)) {
22 addr = *sp++;
23 if (__kernel_text_address(addr)) {
24 if (trace->skip > 0)
25 trace->skip--;
26 else
27 trace->entries[trace->nr_entries++] = addr;
28 if (trace->nr_entries >= trace->max_entries)
29 break;
30 }
31 }
32}
33
34static void save_context_stack(struct stack_trace *trace,
35 struct task_struct *task, struct pt_regs *regs)
36{
37 unsigned long sp = regs->regs[29];
38#ifdef CONFIG_KALLSYMS
39 unsigned long ra = regs->regs[31];
40 unsigned long pc = regs->cp0_epc;
41
42 if (raw_show_trace || !__kernel_text_address(pc)) {
43 unsigned long stack_page =
44 (unsigned long)task_stack_page(task);
45 if (stack_page && sp >= stack_page &&
46 sp <= stack_page + THREAD_SIZE - 32)
47 save_raw_context_stack(trace, sp);
48 return;
49 }
50 do {
51 if (trace->skip > 0)
52 trace->skip--;
53 else
54 trace->entries[trace->nr_entries++] = pc;
55 if (trace->nr_entries >= trace->max_entries)
56 break;
57 pc = unwind_stack(task, &sp, pc, &ra);
58 } while (pc);
59#else
60 save_raw_context_stack(sp);
61#endif
62}
63
64/*
65 * Save stack-backtrace addresses into a stack_trace buffer.
66 */
67void save_stack_trace(struct stack_trace *trace, struct task_struct *task)
68{
69 struct pt_regs dummyregs;
70 struct pt_regs *regs = &dummyregs;
71
72 WARN_ON(trace->nr_entries || !trace->max_entries);
73
74 if (task && task != current) {
75 regs->regs[29] = task->thread.reg29;
76 regs->regs[31] = 0;
77 regs->cp0_epc = task->thread.reg31;
78 } else {
79 if (!task)
80 task = current;
81 prepare_frametrace(regs);
82 }
83
84 save_context_stack(trace, task, regs);
85}
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 9951240cc3fd..26e1a7e78d13 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -231,7 +231,7 @@ out:
231 */ 231 */
232asmlinkage int sys_uname(struct old_utsname __user * name) 232asmlinkage int sys_uname(struct old_utsname __user * name)
233{ 233{
234 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 234 if (name && !copy_to_user(name, utsname(), sizeof (*name)))
235 return 0; 235 return 0;
236 return -EFAULT; 236 return -EFAULT;
237} 237}
@@ -248,16 +248,21 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
248 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) 248 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
249 return -EFAULT; 249 return -EFAULT;
250 250
251 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); 251 error = __copy_to_user(&name->sysname, &utsname()->sysname,
252 error -= __put_user(0,name->sysname+__OLD_UTS_LEN); 252 __OLD_UTS_LEN);
253 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); 253 error -= __put_user(0, name->sysname + __OLD_UTS_LEN);
254 error -= __put_user(0,name->nodename+__OLD_UTS_LEN); 254 error -= __copy_to_user(&name->nodename, &utsname()->nodename,
255 error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); 255 __OLD_UTS_LEN);
256 error -= __put_user(0,name->release+__OLD_UTS_LEN); 256 error -= __put_user(0, name->nodename + __OLD_UTS_LEN);
257 error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); 257 error -= __copy_to_user(&name->release, &utsname()->release,
258 error -= __put_user(0,name->version+__OLD_UTS_LEN); 258 __OLD_UTS_LEN);
259 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 259 error -= __put_user(0, name->release + __OLD_UTS_LEN);
260 error = __put_user(0,name->machine+__OLD_UTS_LEN); 260 error -= __copy_to_user(&name->version, &utsname()->version,
261 __OLD_UTS_LEN);
262 error -= __put_user(0, name->version + __OLD_UTS_LEN);
263 error -= __copy_to_user(&name->machine, &utsname()->machine,
264 __OLD_UTS_LEN);
265 error = __put_user(0, name->machine + __OLD_UTS_LEN);
261 error = error ? -EFAULT : 0; 266 error = error ? -EFAULT : 0;
262 267
263 return error; 268 return error;
@@ -401,3 +406,32 @@ asmlinkage void bad_stack(void)
401{ 406{
402 do_exit(SIGSEGV); 407 do_exit(SIGSEGV);
403} 408}
409
410/*
411 * Do a system call from kernel instead of calling sys_execve so we
412 * end up with proper pt_regs.
413 */
414int kernel_execve(const char *filename, char *const argv[], char *const envp[])
415{
416 register unsigned long __a0 asm("$4") = (unsigned long) filename;
417 register unsigned long __a1 asm("$5") = (unsigned long) argv;
418 register unsigned long __a2 asm("$6") = (unsigned long) envp;
419 register unsigned long __a3 asm("$7");
420 unsigned long __v0;
421
422 __asm__ volatile (" \n"
423 " .set noreorder \n"
424 " li $2, %5 # __NR_execve \n"
425 " syscall \n"
426 " move %0, $2 \n"
427 " .set reorder \n"
428 : "=&r" (__v0), "=r" (__a3)
429 : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve)
430 : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24",
431 "memory");
432
433 if (__a3 == 0)
434 return __v0;
435
436 return -__v0;
437}
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 1137dd6ea7aa..93c74fefff76 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -884,7 +884,7 @@ asmlinkage int irix_getdomainname(char __user *name, int len)
884 down_read(&uts_sem); 884 down_read(&uts_sem);
885 if (len > __NEW_UTS_LEN) 885 if (len > __NEW_UTS_LEN)
886 len = __NEW_UTS_LEN; 886 len = __NEW_UTS_LEN;
887 err = copy_to_user(name, system_utsname.domainname, len) ? -EFAULT : 0; 887 err = copy_to_user(name, utsname()->domainname, len) ? -EFAULT : 0;
888 up_read(&uts_sem); 888 up_read(&uts_sem);
889 889
890 return err; 890 return err;
@@ -1127,11 +1127,11 @@ struct iuname {
1127asmlinkage int irix_uname(struct iuname __user *buf) 1127asmlinkage int irix_uname(struct iuname __user *buf)
1128{ 1128{
1129 down_read(&uts_sem); 1129 down_read(&uts_sem);
1130 if (copy_from_user(system_utsname.sysname, buf->sysname, 65) 1130 if (copy_from_user(utsname()->sysname, buf->sysname, 65)
1131 || copy_from_user(system_utsname.nodename, buf->nodename, 65) 1131 || copy_from_user(utsname()->nodename, buf->nodename, 65)
1132 || copy_from_user(system_utsname.release, buf->release, 65) 1132 || copy_from_user(utsname()->release, buf->release, 65)
1133 || copy_from_user(system_utsname.version, buf->version, 65) 1133 || copy_from_user(utsname()->version, buf->version, 65)
1134 || copy_from_user(system_utsname.machine, buf->machine, 65)) { 1134 || copy_from_user(utsname()->machine, buf->machine, 65)) {
1135 return -EFAULT; 1135 return -EFAULT;
1136 } 1136 }
1137 up_read(&uts_sem); 1137 up_read(&uts_sem);
@@ -1739,12 +1739,13 @@ struct irix_dirent32_callback {
1739#define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1)) 1739#define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
1740 1740
1741static int irix_filldir32(void *__buf, const char *name, 1741static int irix_filldir32(void *__buf, const char *name,
1742 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 1742 int namlen, loff_t offset, u64 ino, unsigned int d_type)
1743{ 1743{
1744 struct irix_dirent32 __user *dirent; 1744 struct irix_dirent32 __user *dirent;
1745 struct irix_dirent32_callback *buf = __buf; 1745 struct irix_dirent32_callback *buf = __buf;
1746 unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1); 1746 unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1);
1747 int err = 0; 1747 int err = 0;
1748 u32 d_ino;
1748 1749
1749#ifdef DEBUG_GETDENTS 1750#ifdef DEBUG_GETDENTS
1750 printk("\nirix_filldir32[reclen<%d>namlen<%d>count<%d>]", 1751 printk("\nirix_filldir32[reclen<%d>namlen<%d>count<%d>]",
@@ -1753,12 +1754,15 @@ static int irix_filldir32(void *__buf, const char *name,
1753 buf->error = -EINVAL; /* only used if we fail.. */ 1754 buf->error = -EINVAL; /* only used if we fail.. */
1754 if (reclen > buf->count) 1755 if (reclen > buf->count)
1755 return -EINVAL; 1756 return -EINVAL;
1757 d_ino = ino;
1758 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
1759 return -EOVERFLOW;
1756 dirent = buf->previous; 1760 dirent = buf->previous;
1757 if (dirent) 1761 if (dirent)
1758 err = __put_user(offset, &dirent->d_off); 1762 err = __put_user(offset, &dirent->d_off);
1759 dirent = buf->current_dir; 1763 dirent = buf->current_dir;
1760 err |= __put_user(dirent, &buf->previous); 1764 err |= __put_user(dirent, &buf->previous);
1761 err |= __put_user(ino, &dirent->d_ino); 1765 err |= __put_user(d_ino, &dirent->d_ino);
1762 err |= __put_user(reclen, &dirent->d_reclen); 1766 err |= __put_user(reclen, &dirent->d_reclen);
1763 err |= copy_to_user((char __user *)dirent->d_name, name, namlen) ? -EFAULT : 0; 1767 err |= copy_to_user((char __user *)dirent->d_name, name, namlen) ? -EFAULT : 0;
1764 err |= __put_user(0, &dirent->d_name[namlen]); 1768 err |= __put_user(0, &dirent->d_name[namlen]);
@@ -1837,7 +1841,7 @@ struct irix_dirent64_callback {
1837#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1)) 1841#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
1838 1842
1839static int irix_filldir64(void *__buf, const char *name, 1843static int irix_filldir64(void *__buf, const char *name,
1840 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 1844 int namlen, loff_t offset, u64 ino, unsigned int d_type)
1841{ 1845{
1842 struct irix_dirent64 __user *dirent; 1846 struct irix_dirent64 __user *dirent;
1843 struct irix_dirent64_callback * buf = __buf; 1847 struct irix_dirent64_callback * buf = __buf;
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 6ab8d975a974..845c7e55505d 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -47,8 +47,6 @@
47/* 47/*
48 * forward reference 48 * forward reference
49 */ 49 */
50extern volatile unsigned long wall_jiffies;
51
52DEFINE_SPINLOCK(rtc_lock); 50DEFINE_SPINLOCK(rtc_lock);
53 51
54/* 52/*
@@ -159,7 +157,6 @@ void (*mips_hpt_init)(unsigned int);
159void do_gettimeofday(struct timeval *tv) 157void do_gettimeofday(struct timeval *tv)
160{ 158{
161 unsigned long seq; 159 unsigned long seq;
162 unsigned long lost;
163 unsigned long usec, sec; 160 unsigned long usec, sec;
164 unsigned long max_ntp_tick; 161 unsigned long max_ntp_tick;
165 162
@@ -168,8 +165,6 @@ void do_gettimeofday(struct timeval *tv)
168 165
169 usec = do_gettimeoffset(); 166 usec = do_gettimeoffset();
170 167
171 lost = jiffies - wall_jiffies;
172
173 /* 168 /*
174 * If time_adjust is negative then NTP is slowing the clock 169 * If time_adjust is negative then NTP is slowing the clock
175 * so make sure not to go into next possible interval. 170 * so make sure not to go into next possible interval.
@@ -178,11 +173,7 @@ void do_gettimeofday(struct timeval *tv)
178 if (unlikely(time_adjust < 0)) { 173 if (unlikely(time_adjust < 0)) {
179 max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj; 174 max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
180 usec = min(usec, max_ntp_tick); 175 usec = min(usec, max_ntp_tick);
181 176 }
182 if (lost)
183 usec += lost * max_ntp_tick;
184 } else if (unlikely(lost))
185 usec += lost * (USEC_PER_SEC / HZ);
186 177
187 sec = xtime.tv_sec; 178 sec = xtime.tv_sec;
188 usec += (xtime.tv_nsec / 1000); 179 usec += (xtime.tv_nsec / 1000);
@@ -217,7 +208,6 @@ int do_settimeofday(struct timespec *tv)
217 * made, and then undo it! 208 * made, and then undo it!
218 */ 209 */
219 nsec -= do_gettimeoffset() * NSEC_PER_USEC; 210 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
220 nsec -= (jiffies - wall_jiffies) * tick_nsec;
221 211
222 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 212 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
223 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 213 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index e51d8fd9a152..b7292a56d4cd 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -41,6 +41,7 @@
41#include <asm/mmu_context.h> 41#include <asm/mmu_context.h>
42#include <asm/watch.h> 42#include <asm/watch.h>
43#include <asm/types.h> 43#include <asm/types.h>
44#include <asm/stacktrace.h>
44 45
45extern asmlinkage void handle_int(void); 46extern asmlinkage void handle_int(void);
46extern asmlinkage void handle_tlbm(void); 47extern asmlinkage void handle_tlbm(void);
@@ -92,16 +93,14 @@ static void show_raw_backtrace(unsigned long reg29)
92} 93}
93 94
94#ifdef CONFIG_KALLSYMS 95#ifdef CONFIG_KALLSYMS
95static int raw_show_trace; 96int raw_show_trace;
96static int __init set_raw_show_trace(char *str) 97static int __init set_raw_show_trace(char *str)
97{ 98{
98 raw_show_trace = 1; 99 raw_show_trace = 1;
99 return 1; 100 return 1;
100} 101}
101__setup("raw_show_trace", set_raw_show_trace); 102__setup("raw_show_trace", set_raw_show_trace);
102 103#endif
103extern unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
104 unsigned long pc, unsigned long ra);
105 104
106static void show_backtrace(struct task_struct *task, struct pt_regs *regs) 105static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
107{ 106{
@@ -116,14 +115,10 @@ static void show_backtrace(struct task_struct *task, struct pt_regs *regs)
116 printk("Call Trace:\n"); 115 printk("Call Trace:\n");
117 do { 116 do {
118 print_ip_sym(pc); 117 print_ip_sym(pc);
119 pc = unwind_stack(task, &sp, pc, ra); 118 pc = unwind_stack(task, &sp, pc, &ra);
120 ra = 0;
121 } while (pc); 119 } while (pc);
122 printk("\n"); 120 printk("\n");
123} 121}
124#else
125#define show_backtrace(task, r) show_raw_backtrace((r)->regs[29]);
126#endif
127 122
128/* 123/*
129 * This routine abuses get_user()/put_user() to reference pointers 124 * This routine abuses get_user()/put_user() to reference pointers
@@ -158,28 +153,6 @@ static void show_stacktrace(struct task_struct *task, struct pt_regs *regs)
158 show_backtrace(task, regs); 153 show_backtrace(task, regs);
159} 154}
160 155
161static __always_inline void prepare_frametrace(struct pt_regs *regs)
162{
163 __asm__ __volatile__(
164 ".set push\n\t"
165 ".set noat\n\t"
166#ifdef CONFIG_64BIT
167 "1: dla $1, 1b\n\t"
168 "sd $1, %0\n\t"
169 "sd $29, %1\n\t"
170 "sd $31, %2\n\t"
171#else
172 "1: la $1, 1b\n\t"
173 "sw $1, %0\n\t"
174 "sw $29, %1\n\t"
175 "sw $31, %2\n\t"
176#endif
177 ".set pop\n\t"
178 : "=m" (regs->cp0_epc),
179 "=m" (regs->regs[29]), "=m" (regs->regs[31])
180 : : "memory");
181}
182
183void show_stack(struct task_struct *task, unsigned long *sp) 156void show_stack(struct task_struct *task, unsigned long *sp)
184{ 157{
185 struct pt_regs regs; 158 struct pt_regs regs;
@@ -206,11 +179,6 @@ void dump_stack(void)
206{ 179{
207 struct pt_regs regs; 180 struct pt_regs regs;
208 181
209 /*
210 * Remove any garbage that may be in regs (specially func
211 * addresses) to avoid show_raw_backtrace() to report them
212 */
213 memset(&regs, 0, sizeof(regs));
214 prepare_frametrace(&regs); 182 prepare_frametrace(&regs);
215 show_backtrace(current, &regs); 183 show_backtrace(current, &regs);
216} 184}
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index e1f35ef81145..d1af42c2a52e 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -268,26 +268,6 @@ static void r3k_flush_data_cache_page(unsigned long addr)
268{ 268{
269} 269}
270 270
271static void r3k_flush_icache_page(struct vm_area_struct *vma, struct page *page)
272{
273 struct mm_struct *mm = vma->vm_mm;
274 unsigned long physpage;
275
276 if (cpu_context(smp_processor_id(), mm) == 0)
277 return;
278
279 if (!(vma->vm_flags & VM_EXEC))
280 return;
281
282#ifdef DEBUG_CACHE
283 printk("cpage[%d,%08lx]", cpu_context(smp_processor_id(), mm), page);
284#endif
285
286 physpage = (unsigned long) page_address(page);
287 if (physpage)
288 r3k_flush_icache_range(physpage, physpage + PAGE_SIZE);
289}
290
291static void r3k_flush_cache_sigtramp(unsigned long addr) 271static void r3k_flush_cache_sigtramp(unsigned long addr)
292{ 272{
293 unsigned long flags; 273 unsigned long flags;
@@ -335,7 +315,6 @@ void __init r3k_cache_init(void)
335 flush_cache_mm = r3k_flush_cache_mm; 315 flush_cache_mm = r3k_flush_cache_mm;
336 flush_cache_range = r3k_flush_cache_range; 316 flush_cache_range = r3k_flush_cache_range;
337 flush_cache_page = r3k_flush_cache_page; 317 flush_cache_page = r3k_flush_cache_page;
338 __flush_icache_page = r3k_flush_icache_page;
339 flush_icache_range = r3k_flush_icache_range; 318 flush_icache_range = r3k_flush_icache_range;
340 319
341 flush_cache_sigtramp = r3k_flush_cache_sigtramp; 320 flush_cache_sigtramp = r3k_flush_cache_sigtramp;
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 0b2da53750bd..cc895dad71d2 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -551,82 +551,6 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
551 instruction_hazard(); 551 instruction_hazard();
552} 552}
553 553
554/*
555 * Ok, this seriously sucks. We use them to flush a user page but don't
556 * know the virtual address, so we have to blast away the whole icache
557 * which is significantly more expensive than the real thing. Otoh we at
558 * least know the kernel address of the page so we can flush it
559 * selectivly.
560 */
561
562struct flush_icache_page_args {
563 struct vm_area_struct *vma;
564 struct page *page;
565};
566
567static inline void local_r4k_flush_icache_page(void *args)
568{
569 struct flush_icache_page_args *fip_args = args;
570 struct vm_area_struct *vma = fip_args->vma;
571 struct page *page = fip_args->page;
572
573 /*
574 * Tricky ... Because we don't know the virtual address we've got the
575 * choice of either invalidating the entire primary and secondary
576 * caches or invalidating the secondary caches also. With the subset
577 * enforcment on R4000SC, R4400SC, R10000 and R12000 invalidating the
578 * secondary cache will result in any entries in the primary caches
579 * also getting invalidated which hopefully is a bit more economical.
580 */
581 if (cpu_has_inclusive_pcaches) {
582 unsigned long addr = (unsigned long) page_address(page);
583
584 r4k_blast_scache_page(addr);
585 ClearPageDcacheDirty(page);
586
587 return;
588 }
589
590 if (!cpu_has_ic_fills_f_dc) {
591 unsigned long addr = (unsigned long) page_address(page);
592 r4k_blast_dcache_page(addr);
593 if (!cpu_icache_snoops_remote_store)
594 r4k_blast_scache_page(addr);
595 ClearPageDcacheDirty(page);
596 }
597
598 /*
599 * We're not sure of the virtual address(es) involved here, so
600 * we have to flush the entire I-cache.
601 */
602 if (cpu_has_vtag_icache && vma->vm_mm == current->active_mm) {
603 int cpu = smp_processor_id();
604
605 if (cpu_context(cpu, vma->vm_mm) != 0)
606 drop_mmu_context(vma->vm_mm, cpu);
607 } else
608 r4k_blast_icache();
609}
610
611static void r4k_flush_icache_page(struct vm_area_struct *vma,
612 struct page *page)
613{
614 struct flush_icache_page_args args;
615
616 /*
617 * If there's no context yet, or the page isn't executable, no I-cache
618 * flush is needed.
619 */
620 if (!(vma->vm_flags & VM_EXEC))
621 return;
622
623 args.vma = vma;
624 args.page = page;
625
626 r4k_on_each_cpu(local_r4k_flush_icache_page, &args, 1, 1);
627}
628
629
630#ifdef CONFIG_DMA_NONCOHERENT 554#ifdef CONFIG_DMA_NONCOHERENT
631 555
632static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size) 556static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
@@ -1291,7 +1215,6 @@ void __init r4k_cache_init(void)
1291 __flush_cache_all = r4k___flush_cache_all; 1215 __flush_cache_all = r4k___flush_cache_all;
1292 flush_cache_mm = r4k_flush_cache_mm; 1216 flush_cache_mm = r4k_flush_cache_mm;
1293 flush_cache_page = r4k_flush_cache_page; 1217 flush_cache_page = r4k_flush_cache_page;
1294 __flush_icache_page = r4k_flush_icache_page;
1295 flush_cache_range = r4k_flush_cache_range; 1218 flush_cache_range = r4k_flush_cache_range;
1296 1219
1297 flush_cache_sigtramp = r4k_flush_cache_sigtramp; 1220 flush_cache_sigtramp = r4k_flush_cache_sigtramp;
diff --git a/arch/mips/mm/c-sb1.c b/arch/mips/mm/c-sb1.c
index 16bad7c0a63f..5537558f19f7 100644
--- a/arch/mips/mm/c-sb1.c
+++ b/arch/mips/mm/c-sb1.c
@@ -307,66 +307,6 @@ void sb1_flush_icache_range(unsigned long start, unsigned long end)
307#endif 307#endif
308 308
309/* 309/*
310 * Flush the icache for a given physical page. Need to writeback the
311 * dcache first, then invalidate the icache. If the page isn't
312 * executable, nothing is required.
313 */
314static void local_sb1_flush_icache_page(struct vm_area_struct *vma,
315 struct page *page)
316{
317 unsigned long start;
318 int cpu = smp_processor_id();
319
320#ifndef CONFIG_SMP
321 if (!(vma->vm_flags & VM_EXEC))
322 return;
323#endif
324
325 /* Need to writeback any dirty data for that page, we have the PA */
326 start = (unsigned long)(page-mem_map) << PAGE_SHIFT;
327 __sb1_writeback_inv_dcache_phys_range(start, start + PAGE_SIZE);
328 /*
329 * If there's a context, bump the ASID (cheaper than a flush,
330 * since we don't know VAs!)
331 */
332 if (vma->vm_mm == current->active_mm) {
333 if (cpu_context(cpu, vma->vm_mm) != 0)
334 drop_mmu_context(vma->vm_mm, cpu);
335 } else
336 __sb1_flush_icache_range(start, start + PAGE_SIZE);
337
338}
339
340#ifdef CONFIG_SMP
341struct flush_icache_page_args {
342 struct vm_area_struct *vma;
343 struct page *page;
344};
345
346static void sb1_flush_icache_page_ipi(void *info)
347{
348 struct flush_icache_page_args *args = info;
349 local_sb1_flush_icache_page(args->vma, args->page);
350}
351
352/* Dirty dcache could be on another CPU, so do the IPIs */
353static void sb1_flush_icache_page(struct vm_area_struct *vma,
354 struct page *page)
355{
356 struct flush_icache_page_args args;
357
358 if (!(vma->vm_flags & VM_EXEC))
359 return;
360 args.vma = vma;
361 args.page = page;
362 on_each_cpu(sb1_flush_icache_page_ipi, (void *) &args, 1, 1);
363}
364#else
365void sb1_flush_icache_page(struct vm_area_struct *vma, struct page *page)
366 __attribute__((alias("local_sb1_flush_icache_page")));
367#endif
368
369/*
370 * A signal trampoline must fit into a single cacheline. 310 * A signal trampoline must fit into a single cacheline.
371 */ 311 */
372static void local_sb1_flush_cache_sigtramp(unsigned long addr) 312static void local_sb1_flush_cache_sigtramp(unsigned long addr)
@@ -526,7 +466,6 @@ void sb1_cache_init(void)
526 466
527 /* These routines are for Icache coherence with the Dcache */ 467 /* These routines are for Icache coherence with the Dcache */
528 flush_icache_range = sb1_flush_icache_range; 468 flush_icache_range = sb1_flush_icache_range;
529 __flush_icache_page = sb1_flush_icache_page;
530 flush_icache_all = __sb1_flush_icache_all; /* local only */ 469 flush_icache_all = __sb1_flush_icache_all; /* local only */
531 470
532 /* This implies an Icache flush too, so can't be nop'ed */ 471 /* This implies an Icache flush too, so can't be nop'ed */
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index 932a09d7ef84..f32ebde30ccf 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -248,33 +248,6 @@ static void tx39_flush_icache_range(unsigned long start, unsigned long end)
248 } 248 }
249} 249}
250 250
251/*
252 * Ok, this seriously sucks. We use them to flush a user page but don't
253 * know the virtual address, so we have to blast away the whole icache
254 * which is significantly more expensive than the real thing. Otoh we at
255 * least know the kernel address of the page so we can flush it
256 * selectivly.
257 */
258static void tx39_flush_icache_page(struct vm_area_struct *vma, struct page *page)
259{
260 unsigned long addr;
261 /*
262 * If there's no context yet, or the page isn't executable, no icache
263 * flush is needed.
264 */
265 if (!(vma->vm_flags & VM_EXEC))
266 return;
267
268 addr = (unsigned long) page_address(page);
269 tx39_blast_dcache_page(addr);
270
271 /*
272 * We're not sure of the virtual address(es) involved here, so
273 * we have to flush the entire I-cache.
274 */
275 tx39_blast_icache();
276}
277
278static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size) 251static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size)
279{ 252{
280 unsigned long end; 253 unsigned long end;
@@ -382,7 +355,6 @@ void __init tx39_cache_init(void)
382 flush_cache_mm = (void *) tx39h_flush_icache_all; 355 flush_cache_mm = (void *) tx39h_flush_icache_all;
383 flush_cache_range = (void *) tx39h_flush_icache_all; 356 flush_cache_range = (void *) tx39h_flush_icache_all;
384 flush_cache_page = (void *) tx39h_flush_icache_all; 357 flush_cache_page = (void *) tx39h_flush_icache_all;
385 __flush_icache_page = (void *) tx39h_flush_icache_all;
386 flush_icache_range = (void *) tx39h_flush_icache_all; 358 flush_icache_range = (void *) tx39h_flush_icache_all;
387 359
388 flush_cache_sigtramp = (void *) tx39h_flush_icache_all; 360 flush_cache_sigtramp = (void *) tx39h_flush_icache_all;
@@ -408,7 +380,6 @@ void __init tx39_cache_init(void)
408 flush_cache_mm = tx39_flush_cache_mm; 380 flush_cache_mm = tx39_flush_cache_mm;
409 flush_cache_range = tx39_flush_cache_range; 381 flush_cache_range = tx39_flush_cache_range;
410 flush_cache_page = tx39_flush_cache_page; 382 flush_cache_page = tx39_flush_cache_page;
411 __flush_icache_page = tx39_flush_icache_page;
412 flush_icache_range = tx39_flush_icache_range; 383 flush_icache_range = tx39_flush_icache_range;
413 384
414 flush_cache_sigtramp = tx39_flush_cache_sigtramp; 385 flush_cache_sigtramp = tx39_flush_cache_sigtramp;
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 40c8b0235183..caf807ded514 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -25,7 +25,6 @@ void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
25void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, 25void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page,
26 unsigned long pfn); 26 unsigned long pfn);
27void (*flush_icache_range)(unsigned long start, unsigned long end); 27void (*flush_icache_range)(unsigned long start, unsigned long end);
28void (*__flush_icache_page)(struct vm_area_struct *vma, struct page *page);
29 28
30/* MIPS specific cache operations */ 29/* MIPS specific cache operations */
31void (*flush_cache_sigtramp)(unsigned long addr); 30void (*flush_cache_sigtramp)(unsigned long addr);
diff --git a/arch/mips/mm/tlbex-fault.S b/arch/mips/mm/tlbex-fault.S
index 9e7f4175b493..e99eaa1fbedc 100644
--- a/arch/mips/mm/tlbex-fault.S
+++ b/arch/mips/mm/tlbex-fault.S
@@ -19,8 +19,8 @@
19 move a0, sp 19 move a0, sp
20 REG_S a2, PT_BVADDR(sp) 20 REG_S a2, PT_BVADDR(sp)
21 li a1, \write 21 li a1, \write
22 jal do_page_fault 22 PTR_LA ra, ret_from_exception
23 j ret_from_exception 23 j do_page_fault
24 END(tlb_do_page_fault_\write) 24 END(tlb_do_page_fault_\write)
25 .endm 25 .endm
26 26
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 8134220ed600..7a941ecff3bb 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -123,7 +123,8 @@ static inline void power_button(void)
123 if (machine_state & MACHINE_PANICED) 123 if (machine_state & MACHINE_PANICED)
124 return; 124 return;
125 125
126 if ((machine_state & MACHINE_SHUTTING_DOWN) || kill_proc(1,SIGINT,1)) { 126 if ((machine_state & MACHINE_SHUTTING_DOWN) ||
127 kill_cad_pid(SIGINT, 1)) {
127 /* No init process or button pressed twice. */ 128 /* No init process or button pressed twice. */
128 sgi_machine_power_off(); 129 sgi_machine_power_off();
129 } 130 }
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index c62a3a9ef867..257ce118e380 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -42,8 +42,6 @@
42static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */ 42static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */
43static long last_rtc_update; /* Last time the rtc clock got updated */ 43static long last_rtc_update; /* Last time the rtc clock got updated */
44 44
45extern volatile unsigned long wall_jiffies;
46
47#if 0 45#if 0
48static int set_rtc_mmss(unsigned long nowtime) 46static int set_rtc_mmss(unsigned long nowtime)
49{ 47{
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 79ddb4605659..fd0932b2d521 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -120,7 +120,7 @@ static inline void ip32_power_button(void)
120 if (has_panicked) 120 if (has_panicked)
121 return; 121 return;
122 122
123 if (shuting_down || kill_proc(1, SIGINT, 1)) { 123 if (shuting_down || kill_cad_pid(SIGINT, 1)) {
124 /* No init process or button pressed twice. */ 124 /* No init process or button pressed twice. */
125 ip32_machine_power_off(); 125 ip32_machine_power_off();
126 } 126 }
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index d7c80edf4489..6e79dbf3f6bd 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -77,17 +77,21 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
77{ 77{
78 struct hpux_dirent * dirent; 78 struct hpux_dirent * dirent;
79 struct getdents_callback * buf = (struct getdents_callback *) __buf; 79 struct getdents_callback * buf = (struct getdents_callback *) __buf;
80 ino_t d_ino;
80 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 81 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
81 82
82 buf->error = -EINVAL; /* only used if we fail.. */ 83 buf->error = -EINVAL; /* only used if we fail.. */
83 if (reclen > buf->count) 84 if (reclen > buf->count)
84 return -EINVAL; 85 return -EINVAL;
86 d_ino = ino;
87 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
88 return -EOVERFLOW;
85 dirent = buf->previous; 89 dirent = buf->previous;
86 if (dirent) 90 if (dirent)
87 put_user(offset, &dirent->d_off); 91 put_user(offset, &dirent->d_off);
88 dirent = buf->current_dir; 92 dirent = buf->current_dir;
89 buf->previous = dirent; 93 buf->previous = dirent;
90 put_user(ino, &dirent->d_ino); 94 put_user(d_ino, &dirent->d_ino);
91 put_user(reclen, &dirent->d_reclen); 95 put_user(reclen, &dirent->d_reclen);
92 put_user(namlen, &dirent->d_namlen); 96 put_user(namlen, &dirent->d_namlen);
93 copy_to_user(dirent->d_name, name, namlen); 97 copy_to_user(dirent->d_name, name, namlen);
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index cb69727027ae..2e2dc4f2c853 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -266,16 +266,21 @@ static int hpux_uname(struct hpux_utsname *name)
266 266
267 down_read(&uts_sem); 267 down_read(&uts_sem);
268 268
269 error = __copy_to_user(&name->sysname,&system_utsname.sysname,HPUX_UTSLEN-1); 269 error = __copy_to_user(&name->sysname, &utsname()->sysname,
270 error |= __put_user(0,name->sysname+HPUX_UTSLEN-1); 270 HPUX_UTSLEN - 1);
271 error |= __copy_to_user(&name->nodename,&system_utsname.nodename,HPUX_UTSLEN-1); 271 error |= __put_user(0, name->sysname + HPUX_UTSLEN - 1);
272 error |= __put_user(0,name->nodename+HPUX_UTSLEN-1); 272 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
273 error |= __copy_to_user(&name->release,&system_utsname.release,HPUX_UTSLEN-1); 273 HPUX_UTSLEN - 1);
274 error |= __put_user(0,name->release+HPUX_UTSLEN-1); 274 error |= __put_user(0, name->nodename + HPUX_UTSLEN - 1);
275 error |= __copy_to_user(&name->version,&system_utsname.version,HPUX_UTSLEN-1); 275 error |= __copy_to_user(&name->release, &utsname()->release,
276 error |= __put_user(0,name->version+HPUX_UTSLEN-1); 276 HPUX_UTSLEN - 1);
277 error |= __copy_to_user(&name->machine,&system_utsname.machine,HPUX_UTSLEN-1); 277 error |= __put_user(0, name->release + HPUX_UTSLEN - 1);
278 error |= __put_user(0,name->machine+HPUX_UTSLEN-1); 278 error |= __copy_to_user(&name->version, &utsname()->version,
279 HPUX_UTSLEN - 1);
280 error |= __put_user(0, name->version + HPUX_UTSLEN - 1);
281 error |= __copy_to_user(&name->machine, &utsname()->machine,
282 HPUX_UTSLEN - 1);
283 error |= __put_user(0, name->machine + HPUX_UTSLEN - 1);
279 284
280 up_read(&uts_sem); 285 up_read(&uts_sem);
281 286
@@ -373,8 +378,8 @@ int hpux_utssys(char *ubuf, int n, int type)
373 /* TODO: print a warning about using this? */ 378 /* TODO: print a warning about using this? */
374 down_write(&uts_sem); 379 down_write(&uts_sem);
375 error = -EFAULT; 380 error = -EFAULT;
376 if (!copy_from_user(system_utsname.sysname, ubuf, len)) { 381 if (!copy_from_user(utsname()->sysname, ubuf, len)) {
377 system_utsname.sysname[len] = 0; 382 utsname()->sysname[len] = 0;
378 error = 0; 383 error = 0;
379 } 384 }
380 up_write(&uts_sem); 385 up_write(&uts_sem);
@@ -400,8 +405,8 @@ int hpux_utssys(char *ubuf, int n, int type)
400 /* TODO: print a warning about this? */ 405 /* TODO: print a warning about this? */
401 down_write(&uts_sem); 406 down_write(&uts_sem);
402 error = -EFAULT; 407 error = -EFAULT;
403 if (!copy_from_user(system_utsname.release, ubuf, len)) { 408 if (!copy_from_user(utsname()->release, ubuf, len)) {
404 system_utsname.release[len] = 0; 409 utsname()->release[len] = 0;
405 error = 0; 410 error = 0;
406 } 411 }
407 up_write(&uts_sem); 412 up_write(&uts_sem);
@@ -422,13 +427,13 @@ int hpux_getdomainname(char *name, int len)
422 427
423 down_read(&uts_sem); 428 down_read(&uts_sem);
424 429
425 nlen = strlen(system_utsname.domainname) + 1; 430 nlen = strlen(utsname()->domainname) + 1;
426 431
427 if (nlen < len) 432 if (nlen < len)
428 len = nlen; 433 len = nlen;
429 if(len > __NEW_UTS_LEN) 434 if(len > __NEW_UTS_LEN)
430 goto done; 435 goto done;
431 if(copy_to_user(name, system_utsname.domainname, len)) 436 if(copy_to_user(name, utsname()->domainname, len))
432 goto done; 437 goto done;
433 err = 0; 438 err = 0;
434done: 439done:
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 4398d2a95789..c2531ae032cf 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -1049,7 +1049,7 @@ void pdc_iodc_putc(unsigned char c)
1049 static int __attribute__((aligned(8))) iodc_retbuf[32]; 1049 static int __attribute__((aligned(8))) iodc_retbuf[32];
1050 static char __attribute__((aligned(64))) iodc_dbuf[4096]; 1050 static char __attribute__((aligned(64))) iodc_dbuf[4096];
1051 unsigned int n; 1051 unsigned int n;
1052 unsigned int flags; 1052 unsigned long flags;
1053 1053
1054 switch (c) { 1054 switch (c) {
1055 case '\n': 1055 case '\n':
@@ -1088,7 +1088,8 @@ void pdc_iodc_putc(unsigned char c)
1088 */ 1088 */
1089void pdc_iodc_outc(unsigned char c) 1089void pdc_iodc_outc(unsigned char c)
1090{ 1090{
1091 unsigned int n, flags; 1091 unsigned int n;
1092 unsigned long flags;
1092 1093
1093 /* fill buffer with one caracter and print it */ 1094 /* fill buffer with one caracter and print it */
1094 static int __attribute__((aligned(8))) iodc_retbuf[32]; 1095 static int __attribute__((aligned(8))) iodc_retbuf[32];
@@ -1113,7 +1114,7 @@ void pdc_iodc_outc(unsigned char c)
1113 */ 1114 */
1114int pdc_iodc_getc(void) 1115int pdc_iodc_getc(void)
1115{ 1116{
1116 unsigned int flags; 1117 unsigned long flags;
1117 static int __attribute__((aligned(8))) iodc_retbuf[32]; 1118 static int __attribute__((aligned(8))) iodc_retbuf[32];
1118 static char __attribute__((aligned(64))) iodc_dbuf[4096]; 1119 static char __attribute__((aligned(64))) iodc_dbuf[4096];
1119 int ch; 1120 int ch;
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 0b485ef4be89..2f9f9dfa66f7 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -368,7 +368,14 @@ out:
368 return error; 368 return error;
369} 369}
370 370
371unsigned long 371extern int __execve(const char *filename, char *const argv[],
372 char *const envp[], struct task_struct *task);
373int kernel_execve(const char *filename, char *const argv[], char *const envp[])
374{
375 return __execve(filename, argv, envp, current);
376}
377
378unsigned long
372get_wchan(struct task_struct *p) 379get_wchan(struct task_struct *p)
373{ 380{
374 struct unwind_frame_info info; 381 struct unwind_frame_info info;
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index b74869803081..e3b30bc36453 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -237,14 +237,19 @@ int sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user
237 237
238int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) 238int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
239{ 239{
240 compat_ino_t ino;
240 int err; 241 int err;
241 242
242 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) || 243 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) ||
243 !new_valid_dev(stat->rdev)) 244 !new_valid_dev(stat->rdev))
244 return -EOVERFLOW; 245 return -EOVERFLOW;
245 246
247 ino = stat->ino;
248 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
249 return -EOVERFLOW;
250
246 err = put_user(new_encode_dev(stat->dev), &statbuf->st_dev); 251 err = put_user(new_encode_dev(stat->dev), &statbuf->st_dev);
247 err |= put_user(stat->ino, &statbuf->st_ino); 252 err |= put_user(ino, &statbuf->st_ino);
248 err |= put_user(stat->mode, &statbuf->st_mode); 253 err |= put_user(stat->mode, &statbuf->st_mode);
249 err |= put_user(stat->nlink, &statbuf->st_nlink); 254 err |= put_user(stat->nlink, &statbuf->st_nlink);
250 err |= put_user(0, &statbuf->st_reserved1); 255 err |= put_user(0, &statbuf->st_reserved1);
@@ -312,16 +317,20 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
312 struct linux32_dirent __user * dirent; 317 struct linux32_dirent __user * dirent;
313 struct getdents32_callback * buf = (struct getdents32_callback *) __buf; 318 struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
314 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4); 319 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
320 u32 d_ino;
315 321
316 buf->error = -EINVAL; /* only used if we fail.. */ 322 buf->error = -EINVAL; /* only used if we fail.. */
317 if (reclen > buf->count) 323 if (reclen > buf->count)
318 return -EINVAL; 324 return -EINVAL;
325 d_ino = ino;
326 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
327 return -EOVERFLOW;
319 dirent = buf->previous; 328 dirent = buf->previous;
320 if (dirent) 329 if (dirent)
321 put_user(offset, &dirent->d_off); 330 put_user(offset, &dirent->d_off);
322 dirent = buf->current_dir; 331 dirent = buf->current_dir;
323 buf->previous = dirent; 332 buf->previous = dirent;
324 put_user(ino, &dirent->d_ino); 333 put_user(d_ino, &dirent->d_ino);
325 put_user(reclen, &dirent->d_reclen); 334 put_user(reclen, &dirent->d_reclen);
326 copy_to_user(dirent->d_name, name, namlen); 335 copy_to_user(dirent->d_name, name, namlen);
327 put_user(0, dirent->d_name + namlen); 336 put_user(0, dirent->d_name + namlen);
@@ -371,12 +380,16 @@ fillonedir32 (void * __buf, const char * name, int namlen, loff_t offset, ino_t
371{ 380{
372 struct readdir32_callback * buf = (struct readdir32_callback *) __buf; 381 struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
373 struct old_linux32_dirent __user * dirent; 382 struct old_linux32_dirent __user * dirent;
383 u32 d_ino;
374 384
375 if (buf->count) 385 if (buf->count)
376 return -EINVAL; 386 return -EINVAL;
387 d_ino = ino;
388 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
389 return -EOVERFLOW;
377 buf->count++; 390 buf->count++;
378 dirent = buf->dirent; 391 dirent = buf->dirent;
379 put_user(ino, &dirent->d_ino); 392 put_user(d_ino, &dirent->d_ino);
380 put_user(offset, &dirent->d_offset); 393 put_user(offset, &dirent->d_offset);
381 put_user(namlen, &dirent->d_namlen); 394 put_user(namlen, &dirent->d_namlen);
382 copy_to_user(dirent->d_name, name, namlen); 395 copy_to_user(dirent->d_name, name, namlen);
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 700df10924dd..ab641d67f551 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -32,9 +32,6 @@
32 32
33#include <linux/timex.h> 33#include <linux/timex.h>
34 34
35/* xtime and wall_jiffies keep wall-clock time */
36extern unsigned long wall_jiffies;
37
38static long clocktick __read_mostly; /* timer cycles per tick */ 35static long clocktick __read_mostly; /* timer cycles per tick */
39static long halftick __read_mostly; 36static long halftick __read_mostly;
40 37
@@ -112,7 +109,7 @@ EXPORT_SYMBOL(profile_pc);
112/*** converted from ia64 ***/ 109/*** converted from ia64 ***/
113/* 110/*
114 * Return the number of micro-seconds that elapsed since the last 111 * Return the number of micro-seconds that elapsed since the last
115 * update to wall time (aka xtime aka wall_jiffies). The xtime_lock 112 * update to wall time (aka xtime). The xtime_lock
116 * must be at least read-locked when calling this routine. 113 * must be at least read-locked when calling this routine.
117 */ 114 */
118static inline unsigned long 115static inline unsigned long
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a0dd1b0ee483..032e6ab5d3c4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -1069,7 +1069,7 @@ source "arch/powerpc/oprofile/Kconfig"
1069 1069
1070config KPROBES 1070config KPROBES
1071 bool "Kprobes (EXPERIMENTAL)" 1071 bool "Kprobes (EXPERIMENTAL)"
1072 depends on PPC64 && EXPERIMENTAL && MODULES 1072 depends on PPC64 && KALLSYMS && EXPERIMENTAL && MODULES
1073 help 1073 help
1074 Kprobes allows you to trap at almost any kernel address and 1074 Kprobes allows you to trap at almost any kernel address and
1075 execute a callback function. register_kprobe() establishes 1075 execute a callback function. register_kprobe() establishes
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index cd65c367b8b6..7b8d12b9026c 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -259,14 +259,15 @@ void kretprobe_trampoline_holder(void)
259 */ 259 */
260int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 260int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
261{ 261{
262 struct kretprobe_instance *ri = NULL; 262 struct kretprobe_instance *ri = NULL;
263 struct hlist_head *head; 263 struct hlist_head *head, empty_rp;
264 struct hlist_node *node, *tmp; 264 struct hlist_node *node, *tmp;
265 unsigned long flags, orig_ret_address = 0; 265 unsigned long flags, orig_ret_address = 0;
266 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; 266 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
267 267
268 INIT_HLIST_HEAD(&empty_rp);
268 spin_lock_irqsave(&kretprobe_lock, flags); 269 spin_lock_irqsave(&kretprobe_lock, flags);
269 head = kretprobe_inst_table_head(current); 270 head = kretprobe_inst_table_head(current);
270 271
271 /* 272 /*
272 * It is possible to have multiple instances associated with a given 273 * It is possible to have multiple instances associated with a given
@@ -277,20 +278,20 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
277 * We can handle this because: 278 * We can handle this because:
278 * - instances are always inserted at the head of the list 279 * - instances are always inserted at the head of the list
279 * - when multiple return probes are registered for the same 280 * - when multiple return probes are registered for the same
280 * function, the first instance's ret_addr will point to the 281 * function, the first instance's ret_addr will point to the
281 * real return address, and all the rest will point to 282 * real return address, and all the rest will point to
282 * kretprobe_trampoline 283 * kretprobe_trampoline
283 */ 284 */
284 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { 285 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
285 if (ri->task != current) 286 if (ri->task != current)
286 /* another task is sharing our hash bucket */ 287 /* another task is sharing our hash bucket */
287 continue; 288 continue;
288 289
289 if (ri->rp && ri->rp->handler) 290 if (ri->rp && ri->rp->handler)
290 ri->rp->handler(ri, regs); 291 ri->rp->handler(ri, regs);
291 292
292 orig_ret_address = (unsigned long)ri->ret_addr; 293 orig_ret_address = (unsigned long)ri->ret_addr;
293 recycle_rp_inst(ri); 294 recycle_rp_inst(ri, &empty_rp);
294 295
295 if (orig_ret_address != trampoline_address) 296 if (orig_ret_address != trampoline_address)
296 /* 297 /*
@@ -308,12 +309,16 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
308 spin_unlock_irqrestore(&kretprobe_lock, flags); 309 spin_unlock_irqrestore(&kretprobe_lock, flags);
309 preempt_enable_no_resched(); 310 preempt_enable_no_resched();
310 311
311 /* 312 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
312 * By returning a non-zero value, we are telling 313 hlist_del(&ri->hlist);
313 * kprobe_handler() that we don't want the post_handler 314 kfree(ri);
314 * to run (and have re-enabled preemption) 315 }
315 */ 316 /*
316 return 1; 317 * By returning a non-zero value, we are telling
318 * kprobe_handler() that we don't want the post_handler
319 * to run (and have re-enabled preemption)
320 */
321 return 1;
317} 322}
318 323
319/* 324/*
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 58758d883361..88fd73fdf048 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -843,7 +843,7 @@ _GLOBAL(kernel_thread)
843 addi r1,r1,16 843 addi r1,r1,16
844 blr 844 blr
845 845
846_GLOBAL(execve) 846_GLOBAL(kernel_execve)
847 li r0,__NR_execve 847 li r0,__NR_execve
848 sc 848 sc
849 bnslr 849 bnslr
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index e3ed21cd3d94..9c54eccad993 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -556,7 +556,7 @@ _GLOBAL(giveup_altivec)
556 556
557#endif /* CONFIG_ALTIVEC */ 557#endif /* CONFIG_ALTIVEC */
558 558
559_GLOBAL(execve) 559_GLOBAL(kernel_execve)
560 li r0,__NR_execve 560 li r0,__NR_execve
561 sc 561 sc
562 bnslr 562 bnslr
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index a127a1e3c097..7b2f6452ba72 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -424,7 +424,7 @@ void show_regs(struct pt_regs * regs)
424 printk("NIP: "REG" LR: "REG" CTR: "REG"\n", 424 printk("NIP: "REG" LR: "REG" CTR: "REG"\n",
425 regs->nip, regs->link, regs->ctr); 425 regs->nip, regs->link, regs->ctr);
426 printk("REGS: %p TRAP: %04lx %s (%s)\n", 426 printk("REGS: %p TRAP: %04lx %s (%s)\n",
427 regs, regs->trap, print_tainted(), system_utsname.release); 427 regs, regs->trap, print_tainted(), init_utsname()->release);
428 printk("MSR: "REG" ", regs->msr); 428 printk("MSR: "REG" ", regs->msr);
429 printbits(regs->msr, msr_bits); 429 printbits(regs->msr, msr_bits);
430 printk(" CR: %08lX XER: %08lX\n", regs->ccr, regs->xer); 430 printk(" CR: %08lX XER: %08lX\n", regs->ccr, regs->xer);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index e0df2ba1ab9f..79a17795d17b 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -67,10 +67,6 @@ int have_of = 1;
67dev_t boot_dev; 67dev_t boot_dev;
68#endif /* CONFIG_PPC_MULTIPLATFORM */ 68#endif /* CONFIG_PPC_MULTIPLATFORM */
69 69
70#ifdef CONFIG_MAGIC_SYSRQ
71unsigned long SYSRQ_KEY = 0x54;
72#endif /* CONFIG_MAGIC_SYSRQ */
73
74#ifdef CONFIG_VGA_CONSOLE 70#ifdef CONFIG_VGA_CONSOLE
75unsigned long vgacon_remap_base; 71unsigned long vgacon_remap_base;
76#endif 72#endif
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 00d6b8addd78..cda2dbe70a76 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -93,11 +93,6 @@ int dcache_bsize;
93int icache_bsize; 93int icache_bsize;
94int ucache_bsize; 94int ucache_bsize;
95 95
96#ifdef CONFIG_MAGIC_SYSRQ
97unsigned long SYSRQ_KEY;
98#endif /* CONFIG_MAGIC_SYSRQ */
99
100
101#ifdef CONFIG_SMP 96#ifdef CONFIG_SMP
102 97
103static int smt_enabled_cmdline; 98static int smt_enabled_cmdline;
@@ -419,7 +414,7 @@ void __init setup_system(void)
419 smp_release_cpus(); 414 smp_release_cpus();
420#endif 415#endif
421 416
422 printk("Starting Linux PPC64 %s\n", system_utsname.version); 417 printk("Starting Linux PPC64 %s\n", init_utsname()->version);
423 418
424 printk("-----------------------------------------------------\n"); 419 printk("-----------------------------------------------------\n");
425 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 420 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 5e391fc25340..d15c33e95959 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -69,16 +69,20 @@ struct readdir_callback32 {
69}; 69};
70 70
71static int fillonedir(void * __buf, const char * name, int namlen, 71static int fillonedir(void * __buf, const char * name, int namlen,
72 off_t offset, ino_t ino, unsigned int d_type) 72 off_t offset, u64 ino, unsigned int d_type)
73{ 73{
74 struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf; 74 struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
75 struct old_linux_dirent32 __user * dirent; 75 struct old_linux_dirent32 __user * dirent;
76 ino_t d_ino;
76 77
77 if (buf->count) 78 if (buf->count)
78 return -EINVAL; 79 return -EINVAL;
80 d_ino = ino;
81 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
82 return -EOVERFLOW;
79 buf->count++; 83 buf->count++;
80 dirent = buf->dirent; 84 dirent = buf->dirent;
81 put_user(ino, &dirent->d_ino); 85 put_user(d_ino, &dirent->d_ino);
82 put_user(offset, &dirent->d_offset); 86 put_user(offset, &dirent->d_offset);
83 put_user(namlen, &dirent->d_namlen); 87 put_user(namlen, &dirent->d_namlen);
84 copy_to_user(dirent->d_name, name, namlen); 88 copy_to_user(dirent->d_name, name, namlen);
@@ -120,15 +124,20 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
120 124
121int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) 125int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
122{ 126{
127 compat_ino_t ino;
123 long err; 128 long err;
124 129
125 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) || 130 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) ||
126 !new_valid_dev(stat->rdev)) 131 !new_valid_dev(stat->rdev))
127 return -EOVERFLOW; 132 return -EOVERFLOW;
128 133
134 ino = stat->ino;
135 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
136 return -EOVERFLOW;
137
129 err = access_ok(VERIFY_WRITE, statbuf, sizeof(*statbuf)) ? 0 : -EFAULT; 138 err = access_ok(VERIFY_WRITE, statbuf, sizeof(*statbuf)) ? 0 : -EFAULT;
130 err |= __put_user(new_encode_dev(stat->dev), &statbuf->st_dev); 139 err |= __put_user(new_encode_dev(stat->dev), &statbuf->st_dev);
131 err |= __put_user(stat->ino, &statbuf->st_ino); 140 err |= __put_user(ino, &statbuf->st_ino);
132 err |= __put_user(stat->mode, &statbuf->st_mode); 141 err |= __put_user(stat->mode, &statbuf->st_mode);
133 err |= __put_user(stat->nlink, &statbuf->st_nlink); 142 err |= __put_user(stat->nlink, &statbuf->st_nlink);
134 err |= __put_user(stat->uid, &statbuf->st_uid); 143 err |= __put_user(stat->uid, &statbuf->st_uid);
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 9b69d99a9103..d358866b880f 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -260,7 +260,7 @@ long ppc_newuname(struct new_utsname __user * name)
260 int err = 0; 260 int err = 0;
261 261
262 down_read(&uts_sem); 262 down_read(&uts_sem);
263 if (copy_to_user(name, &system_utsname, sizeof(*name))) 263 if (copy_to_user(name, utsname(), sizeof(*name)))
264 err = -EFAULT; 264 err = -EFAULT;
265 up_read(&uts_sem); 265 up_read(&uts_sem);
266 if (!err) 266 if (!err)
@@ -273,7 +273,7 @@ int sys_uname(struct old_utsname __user *name)
273 int err = 0; 273 int err = 0;
274 274
275 down_read(&uts_sem); 275 down_read(&uts_sem);
276 if (copy_to_user(name, &system_utsname, sizeof(*name))) 276 if (copy_to_user(name, utsname(), sizeof(*name)))
277 err = -EFAULT; 277 err = -EFAULT;
278 up_read(&uts_sem); 278 up_read(&uts_sem);
279 if (!err) 279 if (!err)
@@ -289,19 +289,19 @@ int sys_olduname(struct oldold_utsname __user *name)
289 return -EFAULT; 289 return -EFAULT;
290 290
291 down_read(&uts_sem); 291 down_read(&uts_sem);
292 error = __copy_to_user(&name->sysname, &system_utsname.sysname, 292 error = __copy_to_user(&name->sysname, &utsname()->sysname,
293 __OLD_UTS_LEN); 293 __OLD_UTS_LEN);
294 error |= __put_user(0, name->sysname + __OLD_UTS_LEN); 294 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
295 error |= __copy_to_user(&name->nodename, &system_utsname.nodename, 295 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
296 __OLD_UTS_LEN); 296 __OLD_UTS_LEN);
297 error |= __put_user(0, name->nodename + __OLD_UTS_LEN); 297 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
298 error |= __copy_to_user(&name->release, &system_utsname.release, 298 error |= __copy_to_user(&name->release, &utsname()->release,
299 __OLD_UTS_LEN); 299 __OLD_UTS_LEN);
300 error |= __put_user(0, name->release + __OLD_UTS_LEN); 300 error |= __put_user(0, name->release + __OLD_UTS_LEN);
301 error |= __copy_to_user(&name->version, &system_utsname.version, 301 error |= __copy_to_user(&name->version, &utsname()->version,
302 __OLD_UTS_LEN); 302 __OLD_UTS_LEN);
303 error |= __put_user(0, name->version + __OLD_UTS_LEN); 303 error |= __put_user(0, name->version + __OLD_UTS_LEN);
304 error |= __copy_to_user(&name->machine, &system_utsname.machine, 304 error |= __copy_to_user(&name->machine, &utsname()->machine,
305 __OLD_UTS_LEN); 305 __OLD_UTS_LEN);
306 error |= override_machine(name->machine); 306 error |= override_machine(name->machine);
307 up_read(&uts_sem); 307 up_read(&uts_sem);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 71f71da98e7d..8b278d85ca4e 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -117,8 +117,6 @@ unsigned tb_to_ns_shift;
117 117
118struct gettimeofday_struct do_gtod; 118struct gettimeofday_struct do_gtod;
119 119
120extern unsigned long wall_jiffies;
121
122extern struct timezone sys_tz; 120extern struct timezone sys_tz;
123static long timezone_offset; 121static long timezone_offset;
124 122
@@ -816,11 +814,6 @@ int do_settimeofday(struct timespec *tv)
816 /* 814 /*
817 * Subtract off the number of nanoseconds since the 815 * Subtract off the number of nanoseconds since the
818 * beginning of the last tick. 816 * beginning of the last tick.
819 * Note that since we don't increment jiffies_64 anywhere other
820 * than in do_timer (since we don't have a lost tick problem),
821 * wall_jiffies will always be the same as jiffies,
822 * and therefore the (jiffies - wall_jiffies) computation
823 * has been removed.
824 */ 817 */
825 tb_delta = tb_ticks_since(tb_last_jiffy); 818 tb_delta = tb_ticks_since(tb_last_jiffy);
826 tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */ 819 tb_delta = mulhdu(tb_delta, do_gtod.varp->tb_to_xs); /* in xsec */
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 1a2c2a50f922..1983b640bac1 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -357,7 +357,7 @@ static int dma_and_signal_ce_msg(char *ce_msg,
357 */ 357 */
358static int shutdown(void) 358static int shutdown(void)
359{ 359{
360 int rc = kill_proc(1, SIGINT, 1); 360 int rc = kill_cad_pid(SIGINT, 1);
361 361
362 if (rc) { 362 if (rc) {
363 printk(KERN_ALERT "mf.c: SIGINT to init failed (%d), " 363 printk(KERN_ALERT "mf.c: SIGINT to init failed (%d), "
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index d30466d74194..9d22361a26d6 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -104,7 +104,7 @@ static void g5_smu_switch_volt(int speed_mode)
104{ 104{
105 struct smu_simple_cmd cmd; 105 struct smu_simple_cmd cmd;
106 106
107 DECLARE_COMPLETION(comp); 107 DECLARE_COMPLETION_ONSTACK(comp);
108 smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 8, smu_done_complete, 108 smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 8, smu_done_complete,
109 &comp, 'V', 'S', 'L', 'E', 'W', 109 &comp, 'V', 'S', 'L', 'E', 'W',
110 0xff, g5_fvt_cur+1, speed_mode); 110 0xff, g5_fvt_cur+1, speed_mode);
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 6a36ea9bf673..692945c14919 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -195,7 +195,7 @@ static void pmu_nvram_complete(struct adb_request *req)
195static unsigned char pmu_nvram_read_byte(int addr) 195static unsigned char pmu_nvram_read_byte(int addr)
196{ 196{
197 struct adb_request req; 197 struct adb_request req;
198 DECLARE_COMPLETION(req_complete); 198 DECLARE_COMPLETION_ONSTACK(req_complete);
199 199
200 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL; 200 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
201 if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM, 201 if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM,
@@ -211,7 +211,7 @@ static unsigned char pmu_nvram_read_byte(int addr)
211static void pmu_nvram_write_byte(int addr, unsigned char val) 211static void pmu_nvram_write_byte(int addr, unsigned char val)
212{ 212{
213 struct adb_request req; 213 struct adb_request req;
214 DECLARE_COMPLETION(req_complete); 214 DECLARE_COMPLETION_ONSTACK(req_complete);
215 215
216 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL; 216 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
217 if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM, 217 if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM,
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index a6398fbe530d..4f0097f31bdb 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -342,7 +342,7 @@ static int __init pSeries_init_panel(void)
342{ 342{
343 /* Manually leave the kernel version on the panel. */ 343 /* Manually leave the kernel version on the panel. */
344 ppc_md.progress("Linux ppc64\n", 0); 344 ppc_md.progress("Linux ppc64\n", 0);
345 ppc_md.progress(system_utsname.release, 0); 345 ppc_md.progress(init_utsname()->version, 0);
346 346
347 return 0; 347 return 0;
348} 348}
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c
index b81a367dc278..87fe9a89dba7 100644
--- a/arch/ppc/4xx_io/serial_sicc.c
+++ b/arch/ppc/4xx_io/serial_sicc.c
@@ -1720,7 +1720,7 @@ static int siccuart_open(struct tty_struct *tty, struct file *filp)
1720 return 0; 1720 return 0;
1721} 1721}
1722 1722
1723static struct tty_operations sicc_ops = { 1723static const struct tty_operations sicc_ops = {
1724 .open = siccuart_open, 1724 .open = siccuart_open,
1725 .close = siccuart_close, 1725 .close = siccuart_close,
1726 .write = siccuart_write, 1726 .write = siccuart_write,
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 50b4bbd06804..5f6684012ded 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -942,20 +942,16 @@ _GLOBAL(kernel_thread)
942 addi r1,r1,16 942 addi r1,r1,16
943 blr 943 blr
944 944
945_GLOBAL(kernel_execve)
946 li r0,__NR_execve
947 sc
948 bnslr
949 neg r3,r3
950 blr
951
945/* 952/*
946 * This routine is just here to keep GCC happy - sigh... 953 * This routine is just here to keep GCC happy - sigh...
947 */ 954 */
948_GLOBAL(__main) 955_GLOBAL(__main)
949 blr 956 blr
950 957
951#define SYSCALL(name) \
952_GLOBAL(name) \
953 li r0,__NR_##name; \
954 sc; \
955 bnslr; \
956 lis r4,errno@ha; \
957 stw r3,errno@l(r4); \
958 li r3,-1; \
959 blr
960
961SYSCALL(execve)
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index 5458ac5da7c3..75fe13815be2 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -86,10 +86,6 @@ int ppc_do_canonicalize_irqs;
86EXPORT_SYMBOL(ppc_do_canonicalize_irqs); 86EXPORT_SYMBOL(ppc_do_canonicalize_irqs);
87#endif 87#endif
88 88
89#ifdef CONFIG_MAGIC_SYSRQ
90unsigned long SYSRQ_KEY = 0x54;
91#endif /* CONFIG_MAGIC_SYSRQ */
92
93#ifdef CONFIG_VGA_CONSOLE 89#ifdef CONFIG_VGA_CONSOLE
94unsigned long vgacon_remap_base; 90unsigned long vgacon_remap_base;
95#endif 91#endif
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index 1e1f31554767..187388625a76 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -80,8 +80,6 @@ unsigned tb_to_us;
80unsigned tb_last_stamp; 80unsigned tb_last_stamp;
81unsigned long tb_to_ns_scale; 81unsigned long tb_to_ns_scale;
82 82
83extern unsigned long wall_jiffies;
84
85/* used for timezone offset */ 83/* used for timezone offset */
86static long timezone_offset; 84static long timezone_offset;
87 85
@@ -173,8 +171,7 @@ void timer_interrupt(struct pt_regs * regs)
173 */ 171 */
174 if ( ppc_md.set_rtc_time && ntp_synced() && 172 if ( ppc_md.set_rtc_time && ntp_synced() &&
175 xtime.tv_sec - last_rtc_update >= 659 && 173 xtime.tv_sec - last_rtc_update >= 659 &&
176 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && 174 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ) {
177 jiffies - wall_jiffies == 1) {
178 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0) 175 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0)
179 last_rtc_update = xtime.tv_sec+1; 176 last_rtc_update = xtime.tv_sec+1;
180 else 177 else
@@ -200,7 +197,7 @@ void do_gettimeofday(struct timeval *tv)
200{ 197{
201 unsigned long flags; 198 unsigned long flags;
202 unsigned long seq; 199 unsigned long seq;
203 unsigned delta, lost_ticks, usec, sec; 200 unsigned delta, usec, sec;
204 201
205 do { 202 do {
206 seq = read_seqbegin_irqsave(&xtime_lock, flags); 203 seq = read_seqbegin_irqsave(&xtime_lock, flags);
@@ -214,10 +211,9 @@ void do_gettimeofday(struct timeval *tv)
214 if (!smp_tb_synchronized) 211 if (!smp_tb_synchronized)
215 delta = 0; 212 delta = 0;
216#endif /* CONFIG_SMP */ 213#endif /* CONFIG_SMP */
217 lost_ticks = jiffies - wall_jiffies;
218 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 214 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
219 215
220 usec += mulhwu(tb_to_us, tb_ticks_per_jiffy * lost_ticks + delta); 216 usec += mulhwu(tb_to_us, delta);
221 while (usec >= 1000000) { 217 while (usec >= 1000000) {
222 sec++; 218 sec++;
223 usec -= 1000000; 219 usec -= 1000000;
@@ -258,7 +254,6 @@ int do_settimeofday(struct timespec *tv)
258 * still reasonable when gettimeofday resolution is 1 jiffy. 254 * still reasonable when gettimeofday resolution is 1 jiffy.
259 */ 255 */
260 tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id())); 256 tb_delta = tb_ticks_since(last_jiffy_stamp(smp_processor_id()));
261 tb_delta += (jiffies - wall_jiffies) * tb_ticks_per_jiffy;
262 257
263 new_nsec -= 1000 * mulhwu(tb_to_us, tb_delta); 258 new_nsec -= 1000 * mulhwu(tb_to_us, tb_delta);
264 259
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 813fc21358f9..cd702ae45d6d 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -134,12 +134,20 @@ static int hypfs_open(struct inode *inode, struct file *filp)
134 return 0; 134 return 0;
135} 135}
136 136
137static ssize_t hypfs_aio_read(struct kiocb *iocb, __user char *buf, 137static ssize_t hypfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
138 size_t count, loff_t offset) 138 unsigned long nr_segs, loff_t offset)
139{ 139{
140 char *data; 140 char *data;
141 size_t len; 141 size_t len;
142 struct file *filp = iocb->ki_filp; 142 struct file *filp = iocb->ki_filp;
143 /* XXX: temporary */
144 char __user *buf = iov[0].iov_base;
145 size_t count = iov[0].iov_len;
146
147 if (nr_segs != 1) {
148 count = -EINVAL;
149 goto out;
150 }
143 151
144 data = filp->private_data; 152 data = filp->private_data;
145 len = strlen(data); 153 len = strlen(data);
@@ -158,12 +166,13 @@ static ssize_t hypfs_aio_read(struct kiocb *iocb, __user char *buf,
158out: 166out:
159 return count; 167 return count;
160} 168}
161static ssize_t hypfs_aio_write(struct kiocb *iocb, const char __user *buf, 169static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
162 size_t count, loff_t pos) 170 unsigned long nr_segs, loff_t offset)
163{ 171{
164 int rc; 172 int rc;
165 struct super_block *sb; 173 struct super_block *sb;
166 struct hypfs_sb_info *fs_info; 174 struct hypfs_sb_info *fs_info;
175 size_t count = iov_length(iov, nr_segs);
167 176
168 sb = iocb->ki_filp->f_dentry->d_inode->i_sb; 177 sb = iocb->ki_filp->f_dentry->d_inode->i_sb;
169 fs_info = sb->s_fs_info; 178 fs_info = sb->s_fs_info;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index c46e3d48e410..e15e1489aef5 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -357,11 +357,16 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
357 357
358int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) 358int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
359{ 359{
360 compat_ino_t ino;
360 int err; 361 int err;
361 362
362 if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev)) 363 if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev))
363 return -EOVERFLOW; 364 return -EOVERFLOW;
364 365
366 ino = stat->ino;
367 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
368 return -EOVERFLOW;
369
365 err = put_user(old_encode_dev(stat->dev), &statbuf->st_dev); 370 err = put_user(old_encode_dev(stat->dev), &statbuf->st_dev);
366 err |= put_user(stat->ino, &statbuf->st_ino); 371 err |= put_user(stat->ino, &statbuf->st_ino);
367 err |= put_user(stat->mode, &statbuf->st_mode); 372 err |= put_user(stat->mode, &statbuf->st_mode);
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S
index 1fa9fa1ca740..1b952a3664e2 100644
--- a/arch/s390/kernel/head31.S
+++ b/arch/s390/kernel/head31.S
@@ -254,6 +254,16 @@ startup_continue:
254 oi 3(%r12),0x80 # set IDTE flag 254 oi 3(%r12),0x80 # set IDTE flag
255.Lchkidte: 255.Lchkidte:
256 256
257#
258# find out if the diag 0x9c is available
259#
260 mvc __LC_PGM_NEW_PSW(8),.Lpcdiag9c-.LPG1(%r13)
261 stap __LC_CPUID+4 # store cpu address
262 lh %r1,__LC_CPUID+4
263 diag %r1,0,0x9c # test diag 0x9c
264 oi 2(%r12),1 # set diag9c flag
265.Lchkdiag9c:
266
257 lpsw .Lentry-.LPG1(13) # jump to _stext in primary-space, 267 lpsw .Lentry-.LPG1(13) # jump to _stext in primary-space,
258 # virtual and never return ... 268 # virtual and never return ...
259 .align 8 269 .align 8
@@ -281,6 +291,7 @@ startup_continue:
281.Lpccsp:.long 0x00080000,0x80000000 + .Lchkcsp 291.Lpccsp:.long 0x00080000,0x80000000 + .Lchkcsp
282.Lpcmvpg:.long 0x00080000,0x80000000 + .Lchkmvpg 292.Lpcmvpg:.long 0x00080000,0x80000000 + .Lchkmvpg
283.Lpcidte:.long 0x00080000,0x80000000 + .Lchkidte 293.Lpcidte:.long 0x00080000,0x80000000 + .Lchkidte
294.Lpcdiag9c:.long 0x00080000,0x80000000 + .Lchkdiag9c
284.Lmemsize:.long memory_size 295.Lmemsize:.long memory_size
285.Lmchunk:.long memory_chunk 296.Lmchunk:.long memory_chunk
286.Lmflags:.long machine_flags 297.Lmflags:.long machine_flags
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index 48998d50b00a..b30e5897cdf7 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -251,6 +251,17 @@ startup_continue:
2510: 2510:
252 252
253# 253#
254# find out if the diag 0x9c is available
255#
256 la %r1,0f-.LPG1(%r13) # set program check address
257 stg %r1,__LC_PGM_NEW_PSW+8
258 stap __LC_CPUID+4 # store cpu address
259 lh %r1,__LC_CPUID+4
260 diag %r1,0,0x9c # test diag 0x9c
261 oi 6(%r12),1 # set diag9c flag
2620:
263
264#
254# find out if we have the MVCOS instruction 265# find out if we have the MVCOS instruction
255# 266#
256 la %r1,0f-.LPG1(%r13) # set program check address 267 la %r1,0f-.LPG1(%r13) # set program check address
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index ca28fb0b3790..4d9ff5ce4cbd 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -369,11 +369,12 @@ void __kprobes kretprobe_trampoline_holder(void)
369int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 369int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
370{ 370{
371 struct kretprobe_instance *ri = NULL; 371 struct kretprobe_instance *ri = NULL;
372 struct hlist_head *head; 372 struct hlist_head *head, empty_rp;
373 struct hlist_node *node, *tmp; 373 struct hlist_node *node, *tmp;
374 unsigned long flags, orig_ret_address = 0; 374 unsigned long flags, orig_ret_address = 0;
375 unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; 375 unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;
376 376
377 INIT_HLIST_HEAD(&empty_rp);
377 spin_lock_irqsave(&kretprobe_lock, flags); 378 spin_lock_irqsave(&kretprobe_lock, flags);
378 head = kretprobe_inst_table_head(current); 379 head = kretprobe_inst_table_head(current);
379 380
@@ -399,7 +400,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
399 ri->rp->handler(ri, regs); 400 ri->rp->handler(ri, regs);
400 401
401 orig_ret_address = (unsigned long)ri->ret_addr; 402 orig_ret_address = (unsigned long)ri->ret_addr;
402 recycle_rp_inst(ri); 403 recycle_rp_inst(ri, &empty_rp);
403 404
404 if (orig_ret_address != trampoline_address) { 405 if (orig_ret_address != trampoline_address) {
405 /* 406 /*
@@ -417,6 +418,10 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
417 spin_unlock_irqrestore(&kretprobe_lock, flags); 418 spin_unlock_irqrestore(&kretprobe_lock, flags);
418 preempt_enable_no_resched(); 419 preempt_enable_no_resched();
419 420
421 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
422 hlist_del(&ri->hlist);
423 kfree(ri);
424 }
420 /* 425 /*
421 * By returning a non-zero value, we are telling 426 * By returning a non-zero value, we are telling
422 * kprobe_handler() that we don't want the post_handler 427 * kprobe_handler() that we don't want the post_handler
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index e351780bb660..584ed95f3380 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -27,6 +27,7 @@
27#include <linux/file.h> 27#include <linux/file.h>
28#include <linux/utsname.h> 28#include <linux/utsname.h>
29#include <linux/personality.h> 29#include <linux/personality.h>
30#include <linux/unistd.h>
30 31
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32#include <asm/ipc.h> 33#include <asm/ipc.h>
@@ -266,3 +267,22 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
266 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); 267 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
267} 268}
268 269
270/*
271 * Do a system call from kernel instead of calling sys_execve so we
272 * end up with proper pt_regs.
273 */
274int kernel_execve(const char *filename, char *const argv[], char *const envp[])
275{
276 register const char *__arg1 asm("2") = filename;
277 register char *const*__arg2 asm("3") = argv;
278 register char *const*__arg3 asm("4") = envp;
279 register long __svcres asm("2");
280 asm volatile(
281 "svc %b1"
282 : "=d" (__svcres)
283 : "i" (__NR_execve),
284 "0" (__arg1),
285 "d" (__arg2),
286 "d" (__arg3) : "memory");
287 return __svcres;
288}
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index abab42e9f5f8..4bf66cc4a267 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -53,8 +53,6 @@ static u64 init_timer_cc;
53static u64 jiffies_timer_cc; 53static u64 jiffies_timer_cc;
54static u64 xtime_cc; 54static u64 xtime_cc;
55 55
56extern unsigned long wall_jiffies;
57
58/* 56/*
59 * Scheduler clock - returns current time in nanosec units. 57 * Scheduler clock - returns current time in nanosec units.
60 */ 58 */
@@ -87,9 +85,8 @@ static inline unsigned long do_gettimeoffset(void)
87{ 85{
88 __u64 now; 86 __u64 now;
89 87
90 now = (get_clock() - jiffies_timer_cc) >> 12; 88 now = (get_clock() - jiffies_timer_cc) >> 12;
91 /* We require the offset from the latest update of xtime */ 89 now -= (__u64) jiffies * USECS_PER_JIFFY;
92 now -= (__u64) wall_jiffies*USECS_PER_JIFFY;
93 return (unsigned long) now; 90 return (unsigned long) now;
94} 91}
95 92
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index b9b7958a226a..8d76403fcf89 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -24,57 +24,76 @@ static int __init spin_retry_setup(char *str)
24} 24}
25__setup("spin_retry=", spin_retry_setup); 25__setup("spin_retry=", spin_retry_setup);
26 26
27static inline void 27static inline void _raw_yield(void)
28_diag44(void)
29{ 28{
30#ifdef CONFIG_64BIT
31 if (MACHINE_HAS_DIAG44) 29 if (MACHINE_HAS_DIAG44)
32#endif
33 asm volatile("diag 0,0,0x44"); 30 asm volatile("diag 0,0,0x44");
34} 31}
35 32
36void 33static inline void _raw_yield_cpu(int cpu)
37_raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc) 34{
35 if (MACHINE_HAS_DIAG9C)
36 asm volatile("diag %0,0,0x9c"
37 : : "d" (__cpu_logical_map[cpu]));
38 else
39 _raw_yield();
40}
41
42void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc)
38{ 43{
39 int count = spin_retry; 44 int count = spin_retry;
45 unsigned int cpu = ~smp_processor_id();
40 46
41 while (1) { 47 while (1) {
42 if (count-- <= 0) { 48 if (count-- <= 0) {
43 _diag44(); 49 unsigned int owner = lp->owner_cpu;
50 if (owner != 0)
51 _raw_yield_cpu(~owner);
44 count = spin_retry; 52 count = spin_retry;
45 } 53 }
46 if (__raw_spin_is_locked(lp)) 54 if (__raw_spin_is_locked(lp))
47 continue; 55 continue;
48 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) 56 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) {
57 lp->owner_pc = pc;
49 return; 58 return;
59 }
50 } 60 }
51} 61}
52EXPORT_SYMBOL(_raw_spin_lock_wait); 62EXPORT_SYMBOL(_raw_spin_lock_wait);
53 63
54int 64int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc)
55_raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc)
56{ 65{
57 int count = spin_retry; 66 unsigned int cpu = ~smp_processor_id();
67 int count;
58 68
59 while (count-- > 0) { 69 for (count = spin_retry; count > 0; count--) {
60 if (__raw_spin_is_locked(lp)) 70 if (__raw_spin_is_locked(lp))
61 continue; 71 continue;
62 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) 72 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) {
73 lp->owner_pc = pc;
63 return 1; 74 return 1;
75 }
64 } 76 }
65 return 0; 77 return 0;
66} 78}
67EXPORT_SYMBOL(_raw_spin_trylock_retry); 79EXPORT_SYMBOL(_raw_spin_trylock_retry);
68 80
69void 81void _raw_spin_relax(raw_spinlock_t *lock)
70_raw_read_lock_wait(raw_rwlock_t *rw) 82{
83 unsigned int cpu = lock->owner_cpu;
84 if (cpu != 0)
85 _raw_yield_cpu(~cpu);
86}
87EXPORT_SYMBOL(_raw_spin_relax);
88
89void _raw_read_lock_wait(raw_rwlock_t *rw)
71{ 90{
72 unsigned int old; 91 unsigned int old;
73 int count = spin_retry; 92 int count = spin_retry;
74 93
75 while (1) { 94 while (1) {
76 if (count-- <= 0) { 95 if (count-- <= 0) {
77 _diag44(); 96 _raw_yield();
78 count = spin_retry; 97 count = spin_retry;
79 } 98 }
80 if (!__raw_read_can_lock(rw)) 99 if (!__raw_read_can_lock(rw))
@@ -86,8 +105,7 @@ _raw_read_lock_wait(raw_rwlock_t *rw)
86} 105}
87EXPORT_SYMBOL(_raw_read_lock_wait); 106EXPORT_SYMBOL(_raw_read_lock_wait);
88 107
89int 108int _raw_read_trylock_retry(raw_rwlock_t *rw)
90_raw_read_trylock_retry(raw_rwlock_t *rw)
91{ 109{
92 unsigned int old; 110 unsigned int old;
93 int count = spin_retry; 111 int count = spin_retry;
@@ -103,14 +121,13 @@ _raw_read_trylock_retry(raw_rwlock_t *rw)
103} 121}
104EXPORT_SYMBOL(_raw_read_trylock_retry); 122EXPORT_SYMBOL(_raw_read_trylock_retry);
105 123
106void 124void _raw_write_lock_wait(raw_rwlock_t *rw)
107_raw_write_lock_wait(raw_rwlock_t *rw)
108{ 125{
109 int count = spin_retry; 126 int count = spin_retry;
110 127
111 while (1) { 128 while (1) {
112 if (count-- <= 0) { 129 if (count-- <= 0) {
113 _diag44(); 130 _raw_yield();
114 count = spin_retry; 131 count = spin_retry;
115 } 132 }
116 if (!__raw_write_can_lock(rw)) 133 if (!__raw_write_can_lock(rw))
@@ -121,8 +138,7 @@ _raw_write_lock_wait(raw_rwlock_t *rw)
121} 138}
122EXPORT_SYMBOL(_raw_write_lock_wait); 139EXPORT_SYMBOL(_raw_write_lock_wait);
123 140
124int 141int _raw_write_trylock_retry(raw_rwlock_t *rw)
125_raw_write_trylock_retry(raw_rwlock_t *rw)
126{ 142{
127 int count = spin_retry; 143 int count = spin_retry;
128 144
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 5f587332234a..77491cf9b259 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -459,7 +459,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
459 seq_printf(m, "machine\t\t: %s\n", get_system_type()); 459 seq_printf(m, "machine\t\t: %s\n", get_system_type());
460 460
461 seq_printf(m, "processor\t: %d\n", cpu); 461 seq_printf(m, "processor\t: %d\n", cpu);
462 seq_printf(m, "cpu family\t: %s\n", system_utsname.machine); 462 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
463 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype()); 463 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype());
464 464
465 show_cpuflags(m); 465 show_cpuflags(m);
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 6c0fb7c4af11..dbebaddcfe39 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -42,6 +42,7 @@ cpumask_t cpu_possible_map;
42EXPORT_SYMBOL(cpu_possible_map); 42EXPORT_SYMBOL(cpu_possible_map);
43 43
44cpumask_t cpu_online_map; 44cpumask_t cpu_online_map;
45EXPORT_SYMBOL(cpu_online_map);
45static atomic_t cpus_booted = ATOMIC_INIT(0); 46static atomic_t cpus_booted = ATOMIC_INIT(0);
46 47
47/* These are defined by the board-specific code. */ 48/* These are defined by the board-specific code. */
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index b68ff705f067..8fde95001c34 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -25,6 +25,7 @@
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/ipc.h> 27#include <asm/ipc.h>
28#include <asm/unistd.h>
28 29
29/* 30/*
30 * sys_pipe() is the normal C calling standard for creating 31 * sys_pipe() is the normal C calling standard for creating
@@ -281,7 +282,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
281 if (!name) 282 if (!name)
282 return -EFAULT; 283 return -EFAULT;
283 down_read(&uts_sem); 284 down_read(&uts_sem);
284 err=copy_to_user(name, &system_utsname, sizeof (*name)); 285 err = copy_to_user(name, utsname(), sizeof (*name));
285 up_read(&uts_sem); 286 up_read(&uts_sem);
286 return err?-EFAULT:0; 287 return err?-EFAULT:0;
287} 288}
@@ -309,3 +310,19 @@ asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
309 (u64)len0 << 32 | len1, advice); 310 (u64)len0 << 32 | len1, advice);
310#endif 311#endif
311} 312}
313
314/*
315 * Do a system call from kernel instead of calling sys_execve so we
316 * end up with proper pt_regs.
317 */
318int kernel_execve(const char *filename, char *const argv[], char *const envp[])
319{
320 register long __sc0 __asm__ ("r3") = __NR_execve;
321 register long __sc4 __asm__ ("r4") = (long) filename;
322 register long __sc5 __asm__ ("r5") = (long) argv;
323 register long __sc6 __asm__ ("r6") = (long) envp;
324 __asm__ __volatile__ ("trapa #0x13" : "=z" (__sc0)
325 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6)
326 : "memory");
327 return __sc0;
328}
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index f664a196c4f5..450c68f1df05 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -18,7 +18,6 @@
18#include <asm/timer.h> 18#include <asm/timer.h>
19#include <asm/kgdb.h> 19#include <asm/kgdb.h>
20 20
21extern unsigned long wall_jiffies;
22struct sys_timer *sys_timer; 21struct sys_timer *sys_timer;
23 22
24/* Move this somewhere more sensible.. */ 23/* Move this somewhere more sensible.. */
@@ -52,16 +51,10 @@ void do_gettimeofday(struct timeval *tv)
52{ 51{
53 unsigned long seq; 52 unsigned long seq;
54 unsigned long usec, sec; 53 unsigned long usec, sec;
55 unsigned long lost;
56 54
57 do { 55 do {
58 seq = read_seqbegin(&xtime_lock); 56 seq = read_seqbegin(&xtime_lock);
59 usec = get_timer_offset(); 57 usec = get_timer_offset();
60
61 lost = jiffies - wall_jiffies;
62 if (lost)
63 usec += lost * (1000000 / HZ);
64
65 sec = xtime.tv_sec; 58 sec = xtime.tv_sec;
66 usec += xtime.tv_nsec / 1000; 59 usec += xtime.tv_nsec / 1000;
67 } while (read_seqretry(&xtime_lock, seq)); 60 } while (read_seqretry(&xtime_lock, seq));
@@ -91,8 +84,7 @@ int do_settimeofday(struct timespec *tv)
91 * wall time. Discover what correction gettimeofday() would have 84 * wall time. Discover what correction gettimeofday() would have
92 * made, and then undo it! 85 * made, and then undo it!
93 */ 86 */
94 nsec -= 1000 * (get_timer_offset() + 87 nsec -= 1000 * get_timer_offset();
95 (jiffies - wall_jiffies) * (1000000 / HZ));
96 88
97 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 89 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
98 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 90 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c
index db475b7833fb..525d0ec19b78 100644
--- a/arch/sh64/kernel/process.c
+++ b/arch/sh64/kernel/process.c
@@ -20,261 +20,16 @@
20/* 20/*
21 * This file handles the architecture-dependent parts of process handling.. 21 * This file handles the architecture-dependent parts of process handling..
22 */ 22 */
23
24/* Temporary flags/tests. All to be removed/undefined. BEGIN */
25#define IDLE_TRACE
26#define VM_SHOW_TABLES
27#define VM_TEST_FAULT
28#define VM_TEST_RTLBMISS
29#define VM_TEST_WTLBMISS
30
31#undef VM_SHOW_TABLES
32#undef IDLE_TRACE
33/* Temporary flags/tests. All to be removed/undefined. END */
34
35#define __KERNEL_SYSCALLS__
36#include <stdarg.h>
37
38#include <linux/kernel.h>
39#include <linux/rwsem.h>
40#include <linux/mm.h> 23#include <linux/mm.h>
41#include <linux/smp.h>
42#include <linux/smp_lock.h>
43#include <linux/ptrace.h> 24#include <linux/ptrace.h>
44#include <linux/slab.h>
45#include <linux/vmalloc.h>
46#include <linux/user.h>
47#include <linux/a.out.h>
48#include <linux/interrupt.h>
49#include <linux/unistd.h>
50#include <linux/delay.h>
51#include <linux/reboot.h> 25#include <linux/reboot.h>
52#include <linux/init.h> 26#include <linux/init.h>
53 27#include <linux/module.h>
54#include <asm/uaccess.h> 28#include <asm/uaccess.h>
55#include <asm/pgtable.h> 29#include <asm/pgtable.h>
56#include <asm/system.h>
57#include <asm/io.h>
58#include <asm/processor.h> /* includes also <asm/registers.h> */
59#include <asm/mmu_context.h>
60#include <asm/elf.h>
61#include <asm/page.h>
62
63#include <linux/irq.h>
64 30
65struct task_struct *last_task_used_math = NULL; 31struct task_struct *last_task_used_math = NULL;
66 32
67#ifdef IDLE_TRACE
68#ifdef VM_SHOW_TABLES
69/* For testing */
70static void print_PTE(long base)
71{
72 int i, skip=0;
73 long long x, y, *p = (long long *) base;
74
75 for (i=0; i< 512; i++, p++){
76 if (*p == 0) {
77 if (!skip) {
78 skip++;
79 printk("(0s) ");
80 }
81 } else {
82 skip=0;
83 x = (*p) >> 32;
84 y = (*p) & 0xffffffff;
85 printk("%08Lx%08Lx ", x, y);
86 if (!((i+1)&0x3)) printk("\n");
87 }
88 }
89}
90
91/* For testing */
92static void print_DIR(long base)
93{
94 int i, skip=0;
95 long *p = (long *) base;
96
97 for (i=0; i< 512; i++, p++){
98 if (*p == 0) {
99 if (!skip) {
100 skip++;
101 printk("(0s) ");
102 }
103 } else {
104 skip=0;
105 printk("%08lx ", *p);
106 if (!((i+1)&0x7)) printk("\n");
107 }
108 }
109}
110
111/* For testing */
112static void print_vmalloc_first_tables(void)
113{
114
115#define PRESENT 0x800 /* Bit 11 */
116
117 /*
118 * Do it really dirty by looking at raw addresses,
119 * raw offsets, no types. If we used pgtable/pgalloc
120 * macros/definitions we could hide potential bugs.
121 *
122 * Note that pointers are 32-bit for CDC.
123 */
124 long pgdt, pmdt, ptet;
125
126 pgdt = (long) &swapper_pg_dir;
127 printk("-->PGD (0x%08lx):\n", pgdt);
128 print_DIR(pgdt);
129 printk("\n");
130
131 /* VMALLOC pool is mapped at 0xc0000000, second (pointer) entry in PGD */
132 pgdt += 4;
133 pmdt = (long) (* (long *) pgdt);
134 if (!(pmdt & PRESENT)) {
135 printk("No PMD\n");
136 return;
137 } else pmdt &= 0xfffff000;
138
139 printk("-->PMD (0x%08lx):\n", pmdt);
140 print_DIR(pmdt);
141 printk("\n");
142
143 /* Get the pmdt displacement for 0xc0000000 */
144 pmdt += 2048;
145
146 /* just look at first two address ranges ... */
147 /* ... 0xc0000000 ... */
148 ptet = (long) (* (long *) pmdt);
149 if (!(ptet & PRESENT)) {
150 printk("No PTE0\n");
151 return;
152 } else ptet &= 0xfffff000;
153
154 printk("-->PTE0 (0x%08lx):\n", ptet);
155 print_PTE(ptet);
156 printk("\n");
157
158 /* ... 0xc0001000 ... */
159 ptet += 4;
160 if (!(ptet & PRESENT)) {
161 printk("No PTE1\n");
162 return;
163 } else ptet &= 0xfffff000;
164 printk("-->PTE1 (0x%08lx):\n", ptet);
165 print_PTE(ptet);
166 printk("\n");
167}
168#else
169#define print_vmalloc_first_tables()
170#endif /* VM_SHOW_TABLES */
171
172static void test_VM(void)
173{
174 void *a, *b, *c;
175
176#ifdef VM_SHOW_TABLES
177 printk("Initial PGD/PMD/PTE\n");
178#endif
179 print_vmalloc_first_tables();
180
181 printk("Allocating 2 bytes\n");
182 a = vmalloc(2);
183 print_vmalloc_first_tables();
184
185 printk("Allocating 4100 bytes\n");
186 b = vmalloc(4100);
187 print_vmalloc_first_tables();
188
189 printk("Allocating 20234 bytes\n");
190 c = vmalloc(20234);
191 print_vmalloc_first_tables();
192
193#ifdef VM_TEST_FAULT
194 /* Here you may want to fault ! */
195
196#ifdef VM_TEST_RTLBMISS
197 printk("Ready to fault upon read.\n");
198 if (* (char *) a) {
199 printk("RTLBMISSed on area a !\n");
200 }
201 printk("RTLBMISSed on area a !\n");
202#endif
203
204#ifdef VM_TEST_WTLBMISS
205 printk("Ready to fault upon write.\n");
206 *((char *) b) = 'L';
207 printk("WTLBMISSed on area b !\n");
208#endif
209
210#endif /* VM_TEST_FAULT */
211
212 printk("Deallocating the 4100 byte chunk\n");
213 vfree(b);
214 print_vmalloc_first_tables();
215
216 printk("Deallocating the 2 byte chunk\n");
217 vfree(a);
218 print_vmalloc_first_tables();
219
220 printk("Deallocating the last chunk\n");
221 vfree(c);
222 print_vmalloc_first_tables();
223}
224
225extern unsigned long volatile jiffies;
226int once = 0;
227unsigned long old_jiffies;
228int pid = -1, pgid = -1;
229
230void idle_trace(void)
231{
232
233 _syscall0(int, getpid)
234 _syscall1(int, getpgid, int, pid)
235
236 if (!once) {
237 /* VM allocation/deallocation simple test */
238 test_VM();
239 pid = getpid();
240
241 printk("Got all through to Idle !!\n");
242 printk("I'm now going to loop forever ...\n");
243 printk("Any ! below is a timer tick.\n");
244 printk("Any . below is a getpgid system call from pid = %d.\n", pid);
245
246
247 old_jiffies = jiffies;
248 once++;
249 }
250
251 if (old_jiffies != jiffies) {
252 old_jiffies = jiffies - old_jiffies;
253 switch (old_jiffies) {
254 case 1:
255 printk("!");
256 break;
257 case 2:
258 printk("!!");
259 break;
260 case 3:
261 printk("!!!");
262 break;
263 case 4:
264 printk("!!!!");
265 break;
266 default:
267 printk("(%d!)", (int) old_jiffies);
268 }
269 old_jiffies = jiffies;
270 }
271 pgid = getpgid(pid);
272 printk(".");
273}
274#else
275#define idle_trace() do { } while (0)
276#endif /* IDLE_TRACE */
277
278static int hlt_counter = 1; 33static int hlt_counter = 1;
279 34
280#define HARD_IDLE_TIMEOUT (HZ / 3) 35#define HARD_IDLE_TIMEOUT (HZ / 3)
@@ -323,7 +78,6 @@ void cpu_idle(void)
323 local_irq_disable(); 78 local_irq_disable();
324 while (!need_resched()) { 79 while (!need_resched()) {
325 local_irq_enable(); 80 local_irq_enable();
326 idle_trace();
327 hlt(); 81 hlt();
328 local_irq_disable(); 82 local_irq_disable();
329 } 83 }
@@ -622,6 +376,10 @@ void free_task_struct(struct task_struct *p)
622/* 376/*
623 * Create a kernel thread 377 * Create a kernel thread
624 */ 378 */
379ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *))
380{
381 do_exit(fn(arg));
382}
625 383
626/* 384/*
627 * This is the mechanism for creating a new kernel thread. 385 * This is the mechanism for creating a new kernel thread.
@@ -633,19 +391,17 @@ void free_task_struct(struct task_struct *p)
633 */ 391 */
634int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) 392int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
635{ 393{
636 /* A bit less processor dependent than older sh ... */ 394 struct pt_regs regs;
637 unsigned int reply;
638 395
639static __inline__ _syscall2(int,clone,unsigned long,flags,unsigned long,newsp) 396 memset(&regs, 0, sizeof(regs));
640static __inline__ _syscall1(int,exit,int,ret) 397 regs.regs[2] = (unsigned long)arg;
398 regs.regs[3] = (unsigned long)fn;
641 399
642 reply = clone(flags | CLONE_VM, 0); 400 regs.pc = (unsigned long)kernel_thread_helper;
643 if (!reply) { 401 regs.sr = (1 << 30);
644 /* Child */
645 reply = exit(fn(arg));
646 }
647 402
648 return reply; 403 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
404 &regs, 0, NULL, NULL);
649} 405}
650 406
651/* 407/*
diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c
index 58ff7d522d81..ad0fa4e003e7 100644
--- a/arch/sh64/kernel/sys_sh64.c
+++ b/arch/sh64/kernel/sys_sh64.c
@@ -32,6 +32,7 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <asm/ipc.h> 33#include <asm/ipc.h>
34#include <asm/ptrace.h> 34#include <asm/ptrace.h>
35#include <asm/unistd.h>
35 36
36#define REG_3 3 37#define REG_3 3
37 38
@@ -279,7 +280,25 @@ asmlinkage int sys_uname(struct old_utsname * name)
279 if (!name) 280 if (!name)
280 return -EFAULT; 281 return -EFAULT;
281 down_read(&uts_sem); 282 down_read(&uts_sem);
282 err=copy_to_user(name, &system_utsname, sizeof (*name)); 283 err = copy_to_user(name, utsname(), sizeof (*name));
283 up_read(&uts_sem); 284 up_read(&uts_sem);
284 return err?-EFAULT:0; 285 return err?-EFAULT:0;
285} 286}
287
288/*
289 * Do a system call from kernel instead of calling sys_execve so we
290 * end up with proper pt_regs.
291 */
292int kernel_execve(const char *filename, char *const argv[], char *const envp[])
293{
294 register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_execve);
295 register unsigned long __sc2 __asm__ ("r2") = (unsigned long) filename;
296 register unsigned long __sc3 __asm__ ("r3") = (unsigned long) argv;
297 register unsigned long __sc4 __asm__ ("r4") = (unsigned long) envp;
298 __asm__ __volatile__ ("trapa %1 !\t\t\t execve(%2,%3,%4)"
299 : "=r" (__sc0)
300 : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) );
301 __asm__ __volatile__ ("!dummy %0 %1 %2 %3"
302 : : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) : "memory");
303 return __sc0;
304}
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 3b61e06f9d72..9c4a38a8698c 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -107,8 +107,6 @@
107 107
108#define TICK_SIZE (tick_nsec / 1000) 108#define TICK_SIZE (tick_nsec / 1000)
109 109
110extern unsigned long wall_jiffies;
111
112static unsigned long tmu_base, rtc_base; 110static unsigned long tmu_base, rtc_base;
113unsigned long cprc_base; 111unsigned long cprc_base;
114 112
@@ -194,13 +192,6 @@ void do_gettimeofday(struct timeval *tv)
194 do { 192 do {
195 seq = read_seqbegin_irqsave(&xtime_lock, flags); 193 seq = read_seqbegin_irqsave(&xtime_lock, flags);
196 usec = usecs_since_tick(); 194 usec = usecs_since_tick();
197 {
198 unsigned long lost = jiffies - wall_jiffies;
199
200 if (lost)
201 usec += lost * (1000000 / HZ);
202 }
203
204 sec = xtime.tv_sec; 195 sec = xtime.tv_sec;
205 usec += xtime.tv_nsec / 1000; 196 usec += xtime.tv_nsec / 1000;
206 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 197 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -229,8 +220,7 @@ int do_settimeofday(struct timespec *tv)
229 * wall time. Discover what correction gettimeofday() would have 220 * wall time. Discover what correction gettimeofday() would have
230 * made, and then undo it! 221 * made, and then undo it!
231 */ 222 */
232 nsec -= 1000 * (usecs_since_tick() + 223 nsec -= 1000 * usecs_since_tick();
233 (jiffies - wall_jiffies) * (1000000 / HZ));
234 224
235 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 225 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
236 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 226 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index e19b1bad9bc5..edb6cc665f56 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -765,8 +765,6 @@ static __inline__ unsigned long do_gettimeoffset(void)
765 return count; 765 return count;
766} 766}
767 767
768extern unsigned long wall_jiffies;
769
770static void pci_do_gettimeofday(struct timeval *tv) 768static void pci_do_gettimeofday(struct timeval *tv)
771{ 769{
772 unsigned long flags; 770 unsigned long flags;
@@ -775,26 +773,17 @@ static void pci_do_gettimeofday(struct timeval *tv)
775 unsigned long max_ntp_tick = tick_usec - tickadj; 773 unsigned long max_ntp_tick = tick_usec - tickadj;
776 774
777 do { 775 do {
778 unsigned long lost;
779
780 seq = read_seqbegin_irqsave(&xtime_lock, flags); 776 seq = read_seqbegin_irqsave(&xtime_lock, flags);
781 usec = do_gettimeoffset(); 777 usec = do_gettimeoffset();
782 lost = jiffies - wall_jiffies;
783 778
784 /* 779 /*
785 * If time_adjust is negative then NTP is slowing the clock 780 * If time_adjust is negative then NTP is slowing the clock
786 * so make sure not to go into next possible interval. 781 * so make sure not to go into next possible interval.
787 * Better to lose some accuracy than have time go backwards.. 782 * Better to lose some accuracy than have time go backwards..
788 */ 783 */
789 if (unlikely(time_adjust < 0)) { 784 if (unlikely(time_adjust < 0))
790 usec = min(usec, max_ntp_tick); 785 usec = min(usec, max_ntp_tick);
791 786
792 if (lost)
793 usec += lost * max_ntp_tick;
794 }
795 else if (unlikely(lost))
796 usec += lost * tick_usec;
797
798 sec = xtime.tv_sec; 787 sec = xtime.tv_sec;
799 usec += (xtime.tv_nsec / 1000); 788 usec += (xtime.tv_nsec / 1000);
800 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 789 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -819,8 +808,7 @@ static int pci_do_settimeofday(struct timespec *tv)
819 * wall time. Discover what correction gettimeofday() would have 808 * wall time. Discover what correction gettimeofday() would have
820 * made, and then undo it! 809 * made, and then undo it!
821 */ 810 */
822 tv->tv_nsec -= 1000 * (do_gettimeoffset() + 811 tv->tv_nsec -= 1000 * do_gettimeoffset();
823 (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ));
824 while (tv->tv_nsec < 0) { 812 while (tv->tv_nsec < 0) {
825 tv->tv_nsec += NSEC_PER_SEC; 813 tv->tv_nsec += NSEC_PER_SEC;
826 tv->tv_sec--; 814 tv->tv_sec--;
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index 896863fb208a..a954a0c00000 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -24,6 +24,7 @@
24 24
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/ipc.h> 26#include <asm/ipc.h>
27#include <asm/unistd.h>
27 28
28/* #define DEBUG_UNIMP_SYSCALL */ 29/* #define DEBUG_UNIMP_SYSCALL */
29 30
@@ -475,16 +476,38 @@ asmlinkage int sys_getdomainname(char __user *name, int len)
475 476
476 down_read(&uts_sem); 477 down_read(&uts_sem);
477 478
478 nlen = strlen(system_utsname.domainname) + 1; 479 nlen = strlen(utsname()->domainname) + 1;
479 err = -EINVAL; 480 err = -EINVAL;
480 if (nlen > len) 481 if (nlen > len)
481 goto out; 482 goto out;
482 483
483 err = -EFAULT; 484 err = -EFAULT;
484 if (!copy_to_user(name, system_utsname.domainname, nlen)) 485 if (!copy_to_user(name, utsname()->domainname, nlen))
485 err = 0; 486 err = 0;
486 487
487out: 488out:
488 up_read(&uts_sem); 489 up_read(&uts_sem);
489 return err; 490 return err;
490} 491}
492
493/*
494 * Do a system call from kernel instead of calling sys_execve so we
495 * end up with proper pt_regs.
496 */
497int kernel_execve(const char *filename, char *const argv[], char *const envp[])
498{
499 long __res;
500 register long __g1 __asm__ ("g1") = __NR_execve;
501 register long __o0 __asm__ ("o0") = (long)(filename);
502 register long __o1 __asm__ ("o1") = (long)(argv);
503 register long __o2 __asm__ ("o2") = (long)(envp);
504 asm volatile ("t 0x10\n\t"
505 "bcc 1f\n\t"
506 "mov %%o0, %0\n\t"
507 "sub %%g0, %%o0, %0\n\t"
508 "1:\n\t"
509 : "=r" (__res), "=&r" (__o0)
510 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1)
511 : "cc");
512 return __res;
513}
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index aa0fb2efb615..6f3ac548ee66 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -325,21 +325,25 @@ struct sunos_dirent_callback {
325#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1)) 325#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
326 326
327static int sunos_filldir(void * __buf, const char * name, int namlen, 327static int sunos_filldir(void * __buf, const char * name, int namlen,
328 loff_t offset, ino_t ino, unsigned int d_type) 328 loff_t offset, u64 ino, unsigned int d_type)
329{ 329{
330 struct sunos_dirent __user *dirent; 330 struct sunos_dirent __user *dirent;
331 struct sunos_dirent_callback * buf = __buf; 331 struct sunos_dirent_callback * buf = __buf;
332 unsigned long d_ino;
332 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 333 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
333 334
334 buf->error = -EINVAL; /* only used if we fail.. */ 335 buf->error = -EINVAL; /* only used if we fail.. */
335 if (reclen > buf->count) 336 if (reclen > buf->count)
336 return -EINVAL; 337 return -EINVAL;
338 d_ino = ino;
339 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
340 return -EOVERFLOW;
337 dirent = buf->previous; 341 dirent = buf->previous;
338 if (dirent) 342 if (dirent)
339 put_user(offset, &dirent->d_off); 343 put_user(offset, &dirent->d_off);
340 dirent = buf->curr; 344 dirent = buf->curr;
341 buf->previous = dirent; 345 buf->previous = dirent;
342 put_user(ino, &dirent->d_ino); 346 put_user(d_ino, &dirent->d_ino);
343 put_user(namlen, &dirent->d_namlen); 347 put_user(namlen, &dirent->d_namlen);
344 put_user(reclen, &dirent->d_reclen); 348 put_user(reclen, &dirent->d_reclen);
345 copy_to_user(dirent->d_name, name, namlen); 349 copy_to_user(dirent->d_name, name, namlen);
@@ -406,19 +410,23 @@ struct sunos_direntry_callback {
406}; 410};
407 411
408static int sunos_filldirentry(void * __buf, const char * name, int namlen, 412static int sunos_filldirentry(void * __buf, const char * name, int namlen,
409 loff_t offset, ino_t ino, unsigned int d_type) 413 loff_t offset, u64 ino, unsigned int d_type)
410{ 414{
411 struct sunos_direntry __user *dirent; 415 struct sunos_direntry __user *dirent;
412 struct sunos_direntry_callback *buf = __buf; 416 struct sunos_direntry_callback *buf = __buf;
417 unsigned long d_ino;
413 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 418 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
414 419
415 buf->error = -EINVAL; /* only used if we fail.. */ 420 buf->error = -EINVAL; /* only used if we fail.. */
416 if (reclen > buf->count) 421 if (reclen > buf->count)
417 return -EINVAL; 422 return -EINVAL;
423 d_ino = ino;
424 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
425 return -EOVERFLOW;
418 dirent = buf->previous; 426 dirent = buf->previous;
419 dirent = buf->curr; 427 dirent = buf->curr;
420 buf->previous = dirent; 428 buf->previous = dirent;
421 put_user(ino, &dirent->d_ino); 429 put_user(d_ino, &dirent->d_ino);
422 put_user(namlen, &dirent->d_namlen); 430 put_user(namlen, &dirent->d_namlen);
423 put_user(reclen, &dirent->d_reclen); 431 put_user(reclen, &dirent->d_reclen);
424 copy_to_user(dirent->d_name, name, namlen); 432 copy_to_user(dirent->d_name, name, namlen);
@@ -483,13 +491,18 @@ asmlinkage int sunos_uname(struct sunos_utsname __user *name)
483{ 491{
484 int ret; 492 int ret;
485 down_read(&uts_sem); 493 down_read(&uts_sem);
486 ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1); 494 ret = copy_to_user(&name->sname[0], &utsname()->sysname[0],
495 sizeof(name->sname) - 1);
487 if (!ret) { 496 if (!ret) {
488 ret |= __copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1); 497 ret |= __copy_to_user(&name->nname[0], &utsname()->nodename[0],
498 sizeof(name->nname) - 1);
489 ret |= __put_user('\0', &name->nname[8]); 499 ret |= __put_user('\0', &name->nname[8]);
490 ret |= __copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1); 500 ret |= __copy_to_user(&name->rel[0], &utsname()->release[0],
491 ret |= __copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1); 501 sizeof(name->rel) - 1);
492 ret |= __copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1); 502 ret |= __copy_to_user(&name->ver[0], &utsname()->version[0],
503 sizeof(name->ver) - 1);
504 ret |= __copy_to_user(&name->mach[0], &utsname()->machine[0],
505 sizeof(name->mach) - 1);
493 } 506 }
494 up_read(&uts_sem); 507 up_read(&uts_sem);
495 return ret ? -EFAULT : 0; 508 return ret ? -EFAULT : 0;
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 6f84fa1b58e5..e10dc831944d 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -43,8 +43,6 @@
43#include <asm/pcic.h> 43#include <asm/pcic.h>
44#include <asm/of_device.h> 44#include <asm/of_device.h>
45 45
46extern unsigned long wall_jiffies;
47
48DEFINE_SPINLOCK(rtc_lock); 46DEFINE_SPINLOCK(rtc_lock);
49enum sparc_clock_type sp_clock_typ; 47enum sparc_clock_type sp_clock_typ;
50DEFINE_SPINLOCK(mostek_lock); 48DEFINE_SPINLOCK(mostek_lock);
@@ -449,7 +447,7 @@ unsigned long long sched_clock(void)
449 447
450/* Ok, my cute asm atomicity trick doesn't work anymore. 448/* Ok, my cute asm atomicity trick doesn't work anymore.
451 * There are just too many variables that need to be protected 449 * There are just too many variables that need to be protected
452 * now (both members of xtime, wall_jiffies, et al.) 450 * now (both members of xtime, et al.)
453 */ 451 */
454void do_gettimeofday(struct timeval *tv) 452void do_gettimeofday(struct timeval *tv)
455{ 453{
@@ -459,26 +457,17 @@ void do_gettimeofday(struct timeval *tv)
459 unsigned long max_ntp_tick = tick_usec - tickadj; 457 unsigned long max_ntp_tick = tick_usec - tickadj;
460 458
461 do { 459 do {
462 unsigned long lost;
463
464 seq = read_seqbegin_irqsave(&xtime_lock, flags); 460 seq = read_seqbegin_irqsave(&xtime_lock, flags);
465 usec = do_gettimeoffset(); 461 usec = do_gettimeoffset();
466 lost = jiffies - wall_jiffies;
467 462
468 /* 463 /*
469 * If time_adjust is negative then NTP is slowing the clock 464 * If time_adjust is negative then NTP is slowing the clock
470 * so make sure not to go into next possible interval. 465 * so make sure not to go into next possible interval.
471 * Better to lose some accuracy than have time go backwards.. 466 * Better to lose some accuracy than have time go backwards..
472 */ 467 */
473 if (unlikely(time_adjust < 0)) { 468 if (unlikely(time_adjust < 0))
474 usec = min(usec, max_ntp_tick); 469 usec = min(usec, max_ntp_tick);
475 470
476 if (lost)
477 usec += lost * max_ntp_tick;
478 }
479 else if (unlikely(lost))
480 usec += lost * tick_usec;
481
482 sec = xtime.tv_sec; 471 sec = xtime.tv_sec;
483 usec += (xtime.tv_nsec / 1000); 472 usec += (xtime.tv_nsec / 1000);
484 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 473 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -521,8 +510,7 @@ static int sbus_do_settimeofday(struct timespec *tv)
521 * wall time. Discover what correction gettimeofday() would have 510 * wall time. Discover what correction gettimeofday() would have
522 * made, and then undo it! 511 * made, and then undo it!
523 */ 512 */
524 nsec -= 1000 * (do_gettimeoffset() + 513 nsec -= 1000 * do_gettimeoffset();
525 (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ));
526 514
527 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 515 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
528 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 516 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 8d8ca716f7a7..b627f8dbcaad 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -420,7 +420,7 @@ source "arch/sparc64/oprofile/Kconfig"
420 420
421config KPROBES 421config KPROBES
422 bool "Kprobes (EXPERIMENTAL)" 422 bool "Kprobes (EXPERIMENTAL)"
423 depends on EXPERIMENTAL && MODULES 423 depends on KALLSYMS && EXPERIMENTAL && MODULES
424 help 424 help
425 Kprobes allows you to trap at almost any kernel address and 425 Kprobes allows you to trap at almost any kernel address and
426 execute a callback function. register_kprobe() establishes 426 execute a callback function. register_kprobe() establishes
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index e55466c77b61..0b9c70627ce4 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -4,8 +4,6 @@
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 */ 5 */
6 6
7#define __KERNEL_SYSCALLS__
8
9#include <linux/kernel.h> 7#include <linux/kernel.h>
10#include <linux/module.h> 8#include <linux/module.h>
11#include <linux/init.h> 9#include <linux/init.h>
@@ -14,6 +12,7 @@
14#include <linux/delay.h> 12#include <linux/delay.h>
15#include <linux/interrupt.h> 13#include <linux/interrupt.h>
16#include <linux/pm.h> 14#include <linux/pm.h>
15#include <linux/syscalls.h>
17 16
18#include <asm/system.h> 17#include <asm/system.h>
19#include <asm/auxio.h> 18#include <asm/auxio.h>
@@ -98,7 +97,7 @@ again:
98 97
99 /* Ok, down we go... */ 98 /* Ok, down we go... */
100 button_pressed = 0; 99 button_pressed = 0;
101 if (execve("/sbin/shutdown", argv, envp) < 0) { 100 if (kernel_execve("/sbin/shutdown", argv, envp) < 0) {
102 printk("powerd: shutdown execution failed\n"); 101 printk("powerd: shutdown execution failed\n");
103 add_wait_queue(&powerd_wait, &wait); 102 add_wait_queue(&powerd_wait, &wait);
104 goto again; 103 goto again;
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index c608c947e6c3..a53d4abb4b49 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -31,6 +31,7 @@
31#include <asm/utrap.h> 31#include <asm/utrap.h>
32#include <asm/perfctr.h> 32#include <asm/perfctr.h>
33#include <asm/a.out.h> 33#include <asm/a.out.h>
34#include <asm/unistd.h>
34 35
35/* #define DEBUG_UNIMP_SYSCALL */ 36/* #define DEBUG_UNIMP_SYSCALL */
36 37
@@ -712,13 +713,13 @@ asmlinkage long sys_getdomainname(char __user *name, int len)
712 713
713 down_read(&uts_sem); 714 down_read(&uts_sem);
714 715
715 nlen = strlen(system_utsname.domainname) + 1; 716 nlen = strlen(utsname()->domainname) + 1;
716 err = -EINVAL; 717 err = -EINVAL;
717 if (nlen > len) 718 if (nlen > len)
718 goto out; 719 goto out;
719 720
720 err = -EFAULT; 721 err = -EFAULT;
721 if (!copy_to_user(name, system_utsname.domainname, nlen)) 722 if (!copy_to_user(name, utsname()->domainname, nlen))
722 err = 0; 723 err = 0;
723 724
724out: 725out:
@@ -963,3 +964,23 @@ asmlinkage long sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1,
963 }; 964 };
964 return err; 965 return err;
965} 966}
967
968/*
969 * Do a system call from kernel instead of calling sys_execve so we
970 * end up with proper pt_regs.
971 */
972int kernel_execve(const char *filename, char *const argv[], char *const envp[])
973{
974 long __res;
975 register long __g1 __asm__ ("g1") = __NR_execve;
976 register long __o0 __asm__ ("o0") = (long)(filename);
977 register long __o1 __asm__ ("o1") = (long)(argv);
978 register long __o2 __asm__ ("o2") = (long)(envp);
979 asm volatile ("t 0x6d\n\t"
980 "sub %%g0, %%o0, %0\n\t"
981 "movcc %%xcc, %%o0, %0\n\t"
982 : "=r" (__res), "=&r" (__o0)
983 : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__g1)
984 : "cc");
985 return __res;
986}
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 69444f266e2d..dbc6d1a3be1f 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -337,12 +337,17 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
337 337
338int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf) 338int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
339{ 339{
340 compat_ino_t ino;
340 int err; 341 int err;
341 342
342 if (stat->size > MAX_NON_LFS || !old_valid_dev(stat->dev) || 343 if (stat->size > MAX_NON_LFS || !old_valid_dev(stat->dev) ||
343 !old_valid_dev(stat->rdev)) 344 !old_valid_dev(stat->rdev))
344 return -EOVERFLOW; 345 return -EOVERFLOW;
345 346
347 ino = stat->ino;
348 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
349 return -EOVERFLOW;
350
346 err = put_user(old_encode_dev(stat->dev), &statbuf->st_dev); 351 err = put_user(old_encode_dev(stat->dev), &statbuf->st_dev);
347 err |= put_user(stat->ino, &statbuf->st_ino); 352 err |= put_user(stat->ino, &statbuf->st_ino);
348 err |= put_user(stat->mode, &statbuf->st_mode); 353 err |= put_user(stat->mode, &statbuf->st_mode);
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index 87ebdf858a3a..e414c8ef0225 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -280,16 +280,20 @@ static int sunos_filldir(void * __buf, const char * name, int namlen,
280 struct sunos_dirent __user *dirent; 280 struct sunos_dirent __user *dirent;
281 struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf; 281 struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) __buf;
282 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 282 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
283 u32 d_ino;
283 284
284 buf->error = -EINVAL; /* only used if we fail.. */ 285 buf->error = -EINVAL; /* only used if we fail.. */
285 if (reclen > buf->count) 286 if (reclen > buf->count)
286 return -EINVAL; 287 return -EINVAL;
288 d_ino = ino;
289 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
290 return -EOVERFLOW;
287 dirent = buf->previous; 291 dirent = buf->previous;
288 if (dirent) 292 if (dirent)
289 put_user(offset, &dirent->d_off); 293 put_user(offset, &dirent->d_off);
290 dirent = buf->curr; 294 dirent = buf->curr;
291 buf->previous = dirent; 295 buf->previous = dirent;
292 put_user(ino, &dirent->d_ino); 296 put_user(d_ino, &dirent->d_ino);
293 put_user(namlen, &dirent->d_namlen); 297 put_user(namlen, &dirent->d_namlen);
294 put_user(reclen, &dirent->d_reclen); 298 put_user(reclen, &dirent->d_reclen);
295 if (copy_to_user(dirent->d_name, name, namlen)) 299 if (copy_to_user(dirent->d_name, name, namlen))
@@ -363,14 +367,18 @@ static int sunos_filldirentry(void * __buf, const char * name, int namlen,
363 struct sunos_direntry_callback * buf = 367 struct sunos_direntry_callback * buf =
364 (struct sunos_direntry_callback *) __buf; 368 (struct sunos_direntry_callback *) __buf;
365 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1); 369 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
370 u32 d_ino;
366 371
367 buf->error = -EINVAL; /* only used if we fail.. */ 372 buf->error = -EINVAL; /* only used if we fail.. */
368 if (reclen > buf->count) 373 if (reclen > buf->count)
369 return -EINVAL; 374 return -EINVAL;
375 d_ino = ino;
376 if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
377 return -EOVERFLOW;
370 dirent = buf->previous; 378 dirent = buf->previous;
371 dirent = buf->curr; 379 dirent = buf->curr;
372 buf->previous = dirent; 380 buf->previous = dirent;
373 put_user(ino, &dirent->d_ino); 381 put_user(d_ino, &dirent->d_ino);
374 put_user(namlen, &dirent->d_namlen); 382 put_user(namlen, &dirent->d_namlen);
375 put_user(reclen, &dirent->d_reclen); 383 put_user(reclen, &dirent->d_reclen);
376 if (copy_to_user(dirent->d_name, name, namlen)) 384 if (copy_to_user(dirent->d_name, name, namlen))
@@ -439,16 +447,16 @@ asmlinkage int sunos_uname(struct sunos_utsname __user *name)
439 int ret; 447 int ret;
440 448
441 down_read(&uts_sem); 449 down_read(&uts_sem);
442 ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], 450 ret = copy_to_user(&name->sname[0], &utsname()->sysname[0],
443 sizeof(name->sname) - 1); 451 sizeof(name->sname) - 1);
444 ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], 452 ret |= copy_to_user(&name->nname[0], &utsname()->nodename[0],
445 sizeof(name->nname) - 1); 453 sizeof(name->nname) - 1);
446 ret |= put_user('\0', &name->nname[8]); 454 ret |= put_user('\0', &name->nname[8]);
447 ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], 455 ret |= copy_to_user(&name->rel[0], &utsname()->release[0],
448 sizeof(name->rel) - 1); 456 sizeof(name->rel) - 1);
449 ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], 457 ret |= copy_to_user(&name->ver[0], &utsname()->version[0],
450 sizeof(name->ver) - 1); 458 sizeof(name->ver) - 1);
451 ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], 459 ret |= copy_to_user(&name->mach[0], &utsname()->machine[0],
452 sizeof(name->mach) - 1); 460 sizeof(name->mach) - 1);
453 up_read(&uts_sem); 461 up_read(&uts_sem);
454 return (ret ? -EFAULT : 0); 462 return (ret ? -EFAULT : 0);
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index ca1193482f07..00f6fc4aaaff 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -53,8 +53,6 @@ void __iomem *mstk48t02_regs = NULL;
53unsigned long ds1287_regs = 0UL; 53unsigned long ds1287_regs = 0UL;
54#endif 54#endif
55 55
56extern unsigned long wall_jiffies;
57
58static void __iomem *mstk48t08_regs; 56static void __iomem *mstk48t08_regs;
59static void __iomem *mstk48t59_regs; 57static void __iomem *mstk48t59_regs;
60 58
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index 0f0eb6aa1c40..12a940cc791f 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -82,12 +82,17 @@ struct sol_stat64 {
82 82
83static inline int putstat(struct sol_stat __user *ubuf, struct kstat *kbuf) 83static inline int putstat(struct sol_stat __user *ubuf, struct kstat *kbuf)
84{ 84{
85 u32 ino;
86
85 if (kbuf->size > MAX_NON_LFS || 87 if (kbuf->size > MAX_NON_LFS ||
86 !sysv_valid_dev(kbuf->dev) || 88 !sysv_valid_dev(kbuf->dev) ||
87 !sysv_valid_dev(kbuf->rdev)) 89 !sysv_valid_dev(kbuf->rdev))
88 return -EOVERFLOW; 90 return -EOVERFLOW;
91 ino = kbuf->ino;
92 if (sizeof(ino) < sizeof(kbuf->ino) && ino != kbuf->ino)
93 return -EOVERFLOW;
89 if (put_user (sysv_encode_dev(kbuf->dev), &ubuf->st_dev) || 94 if (put_user (sysv_encode_dev(kbuf->dev), &ubuf->st_dev) ||
90 __put_user (kbuf->ino, &ubuf->st_ino) || 95 __put_user (ino, &ubuf->st_ino) ||
91 __put_user (kbuf->mode, &ubuf->st_mode) || 96 __put_user (kbuf->mode, &ubuf->st_mode) ||
92 __put_user (kbuf->nlink, &ubuf->st_nlink) || 97 __put_user (kbuf->nlink, &ubuf->st_nlink) ||
93 __put_user (kbuf->uid, &ubuf->st_uid) || 98 __put_user (kbuf->uid, &ubuf->st_uid) ||
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index 9c581328e76a..9ed997982f8d 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -249,7 +249,7 @@ asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2)
249 /* Let's cheat */ 249 /* Let's cheat */
250 err = set_utsfield(v->sysname, "SunOS", 1, 0); 250 err = set_utsfield(v->sysname, "SunOS", 1, 0);
251 down_read(&uts_sem); 251 down_read(&uts_sem);
252 err |= set_utsfield(v->nodename, system_utsname.nodename, 252 err |= set_utsfield(v->nodename, utsname()->nodename,
253 1, 1); 253 1, 1);
254 up_read(&uts_sem); 254 up_read(&uts_sem);
255 err |= set_utsfield(v->release, "2.6", 0, 0); 255 err |= set_utsfield(v->release, "2.6", 0, 0);
@@ -273,7 +273,7 @@ asmlinkage int solaris_utsname(u32 buf)
273 /* Why should we not lie a bit? */ 273 /* Why should we not lie a bit? */
274 down_read(&uts_sem); 274 down_read(&uts_sem);
275 err = set_utsfield(v->sysname, "SunOS", 0, 0); 275 err = set_utsfield(v->sysname, "SunOS", 0, 0);
276 err |= set_utsfield(v->nodename, system_utsname.nodename, 1, 1); 276 err |= set_utsfield(v->nodename, utsname()->nodename, 1, 1);
277 err |= set_utsfield(v->release, "5.6", 0, 0); 277 err |= set_utsfield(v->release, "5.6", 0, 0);
278 err |= set_utsfield(v->version, "Generic", 0, 0); 278 err |= set_utsfield(v->version, "Generic", 0, 0);
279 err |= set_utsfield(v->machine, machine(), 0, 0); 279 err |= set_utsfield(v->machine, machine(), 0, 0);
@@ -305,7 +305,7 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count)
305 case SI_HOSTNAME: 305 case SI_HOSTNAME:
306 r = buffer + 256; 306 r = buffer + 256;
307 down_read(&uts_sem); 307 down_read(&uts_sem);
308 for (p = system_utsname.nodename, q = buffer; 308 for (p = utsname()->nodename, q = buffer;
309 q < r && *p && *p != '.'; *q++ = *p++); 309 q < r && *p && *p != '.'; *q++ = *p++);
310 up_read(&uts_sem); 310 up_read(&uts_sem);
311 *q = 0; 311 *q = 0;
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 563ce7690a1e..24747a413785 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -642,9 +642,9 @@ int line_remove(struct line *lines, unsigned int num, int n)
642} 642}
643 643
644struct tty_driver *line_register_devfs(struct lines *set, 644struct tty_driver *line_register_devfs(struct lines *set,
645 struct line_driver *line_driver, 645 struct line_driver *line_driver,
646 struct tty_operations *ops, struct line *lines, 646 const struct tty_operations *ops,
647 int nlines) 647 struct line *lines, int nlines)
648{ 648{
649 int i; 649 int i;
650 struct tty_driver *driver = alloc_tty_driver(nlines); 650 struct tty_driver *driver = alloc_tty_driver(nlines);
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 773a134e7fdb..a67dcbd78de4 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -106,9 +106,9 @@ void mconsole_version(struct mc_request *req)
106{ 106{
107 char version[256]; 107 char version[256];
108 108
109 sprintf(version, "%s %s %s %s %s", system_utsname.sysname, 109 sprintf(version, "%s %s %s %s %s", utsname()->sysname,
110 system_utsname.nodename, system_utsname.release, 110 utsname()->nodename, utsname()->release,
111 system_utsname.version, system_utsname.machine); 111 utsname()->version, utsname()->machine);
112 mconsole_reply(req, version, 0, 0); 112 mconsole_reply(req, version, 0, 0);
113} 113}
114 114
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 5fa4c8e258a4..fda4a3940698 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -981,8 +981,6 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
981 __u64 offset; 981 __u64 offset;
982 int len; 982 int len;
983 983
984 if(req->rq_status == RQ_INACTIVE) return(1);
985
986 /* This should be impossible now */ 984 /* This should be impossible now */
987 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ 985 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){
988 printk("Write attempted on readonly ubd device %s\n", 986 printk("Write attempted on readonly ubd device %s\n",
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 642c9a0320f9..7be24811bb30 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -91,10 +91,9 @@ extern int line_setup_irq(int fd, int input, int output, struct line *line,
91 void *data); 91 void *data);
92extern void line_close_chan(struct line *line); 92extern void line_close_chan(struct line *line);
93extern struct tty_driver * line_register_devfs(struct lines *set, 93extern struct tty_driver * line_register_devfs(struct lines *set,
94 struct line_driver *line_driver, 94 struct line_driver *line_driver,
95 struct tty_operations *driver, 95 const struct tty_operations *driver,
96 struct line *lines, 96 struct line *lines, int nlines);
97 int nlines);
98extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts); 97extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
99extern void close_lines(struct line *lines, int nlines); 98extern void close_lines(struct line *lines, int nlines);
100 99
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 48cf88dd02d4..f5ed8624648b 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -110,7 +110,7 @@ long sys_uname(struct old_utsname __user * name)
110 if (!name) 110 if (!name)
111 return -EFAULT; 111 return -EFAULT;
112 down_read(&uts_sem); 112 down_read(&uts_sem);
113 err = copy_to_user(name, &system_utsname, sizeof (*name)); 113 err = copy_to_user(name, utsname(), sizeof (*name));
114 up_read(&uts_sem); 114 up_read(&uts_sem);
115 return err?-EFAULT:0; 115 return err?-EFAULT:0;
116} 116}
@@ -126,21 +126,21 @@ long sys_olduname(struct oldold_utsname __user * name)
126 126
127 down_read(&uts_sem); 127 down_read(&uts_sem);
128 128
129 error = __copy_to_user(&name->sysname,&system_utsname.sysname, 129 error = __copy_to_user(&name->sysname, &utsname()->sysname,
130 __OLD_UTS_LEN); 130 __OLD_UTS_LEN);
131 error |= __put_user(0,name->sysname+__OLD_UTS_LEN); 131 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
132 error |= __copy_to_user(&name->nodename,&system_utsname.nodename, 132 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
133 __OLD_UTS_LEN); 133 __OLD_UTS_LEN);
134 error |= __put_user(0,name->nodename+__OLD_UTS_LEN); 134 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
135 error |= __copy_to_user(&name->release,&system_utsname.release, 135 error |= __copy_to_user(&name->release, &utsname()->release,
136 __OLD_UTS_LEN); 136 __OLD_UTS_LEN);
137 error |= __put_user(0,name->release+__OLD_UTS_LEN); 137 error |= __put_user(0, name->release + __OLD_UTS_LEN);
138 error |= __copy_to_user(&name->version,&system_utsname.version, 138 error |= __copy_to_user(&name->version, &utsname()->version,
139 __OLD_UTS_LEN); 139 __OLD_UTS_LEN);
140 error |= __put_user(0,name->version+__OLD_UTS_LEN); 140 error |= __put_user(0, name->version + __OLD_UTS_LEN);
141 error |= __copy_to_user(&name->machine,&system_utsname.machine, 141 error |= __copy_to_user(&name->machine, &utsname()->machine,
142 __OLD_UTS_LEN); 142 __OLD_UTS_LEN);
143 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 143 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
144 144
145 up_read(&uts_sem); 145 up_read(&uts_sem);
146 146
@@ -164,3 +164,16 @@ int next_syscall_index(int limit)
164 spin_unlock(&syscall_lock); 164 spin_unlock(&syscall_lock);
165 return(ret); 165 return(ret);
166} 166}
167
168int kernel_execve(const char *filename, char *const argv[], char *const envp[])
169{
170 mm_segment_t fs;
171 int ret;
172
173 fs = get_fs();
174 set_fs(KERNEL_DS);
175 ret = um_execve(filename, argv, envp);
176 set_fs(fs);
177
178 return ret;
179}
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 55005710dcbb..97d88e7902f7 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -167,7 +167,7 @@ static char *usage_string =
167 167
168static int __init uml_version_setup(char *line, int *add) 168static int __init uml_version_setup(char *line, int *add)
169{ 169{
170 printf("%s\n", system_utsname.release); 170 printf("%s\n", init_utsname()->release);
171 exit(0); 171 exit(0);
172 172
173 return 0; 173 return 0;
@@ -278,7 +278,7 @@ static int __init Usage(char *line, int *add)
278{ 278{
279 const char **p; 279 const char **p;
280 280
281 printf(usage_string, system_utsname.release); 281 printf(usage_string, init_utsname()->release);
282 p = &__uml_help_start; 282 p = &__uml_help_start;
283 while (p < &__uml_help_end) { 283 while (p < &__uml_help_end) {
284 printf("%s", *p); 284 printf("%s", *p);
@@ -403,7 +403,7 @@ int linux_main(int argc, char **argv)
403 /* Reserve up to 4M after the current brk */ 403 /* Reserve up to 4M after the current brk */
404 uml_reserved = ROUND_4M(brk_start) + (1 << 22); 404 uml_reserved = ROUND_4M(brk_start) + (1 << 22);
405 405
406 setup_machinename(system_utsname.machine); 406 setup_machinename(init_utsname()->machine);
407 407
408#ifdef CONFIG_CMDLINE_ON_HOST 408#ifdef CONFIG_CMDLINE_ON_HOST
409 argv1_begin = argv[1]; 409 argv1_begin = argv[1];
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index ff203625a4bd..51f0893640a6 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -11,6 +11,7 @@
11#include <sys/mman.h> 11#include <sys/mman.h>
12#include <sys/wait.h> 12#include <sys/wait.h>
13#include <sys/mman.h> 13#include <sys/mman.h>
14#include <sys/syscall.h>
14#include "ptrace_user.h" 15#include "ptrace_user.h"
15#include "os.h" 16#include "os.h"
16#include "user.h" 17#include "user.h"
@@ -140,11 +141,9 @@ void os_usr1_process(int pid)
140 * syscalls, and also breaks with clone(), which does not unshare the TLS. 141 * syscalls, and also breaks with clone(), which does not unshare the TLS.
141 */ 142 */
142 143
143inline _syscall0(pid_t, getpid)
144
145int os_getpid(void) 144int os_getpid(void)
146{ 145{
147 return(getpid()); 146 return(syscall(__NR_getpid));
148} 147}
149 148
150int os_getpgrp(void) 149int os_getpgrp(void)
diff --git a/arch/um/os-Linux/sys-i386/tls.c b/arch/um/os-Linux/sys-i386/tls.c
index 120abbe4e3ce..6e945ab45843 100644
--- a/arch/um/os-Linux/sys-i386/tls.c
+++ b/arch/um/os-Linux/sys-i386/tls.c
@@ -1,10 +1,9 @@
1#include <errno.h> 1#include <errno.h>
2#include <linux/unistd.h> 2#include <linux/unistd.h>
3#include <sys/syscall.h>
3#include "sysdep/tls.h" 4#include "sysdep/tls.h"
4#include "user_util.h" 5#include "user_util.h"
5 6
6static _syscall1(int, get_thread_area, user_desc_t *, u_info);
7
8/* Checks whether host supports TLS, and sets *tls_min according to the value 7/* Checks whether host supports TLS, and sets *tls_min according to the value
9 * valid on the host. 8 * valid on the host.
10 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */ 9 * i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */
@@ -17,7 +16,7 @@ void check_host_supports_tls(int *supports_tls, int *tls_min) {
17 user_desc_t info; 16 user_desc_t info;
18 info.entry_number = val[i]; 17 info.entry_number = val[i];
19 18
20 if (get_thread_area(&info) == 0) { 19 if (syscall(__NR_get_thread_area, &info) == 0) {
21 *tls_min = val[i]; 20 *tls_min = val[i];
22 *supports_tls = 1; 21 *supports_tls = 1;
23 return; 22 return;
diff --git a/arch/um/os-Linux/tls.c b/arch/um/os-Linux/tls.c
index 9cb09a45546b..a2de2580b8af 100644
--- a/arch/um/os-Linux/tls.c
+++ b/arch/um/os-Linux/tls.c
@@ -1,5 +1,6 @@
1#include <errno.h> 1#include <errno.h>
2#include <sys/ptrace.h> 2#include <sys/ptrace.h>
3#include <sys/syscall.h>
3#include <asm/ldt.h> 4#include <asm/ldt.h>
4#include "sysdep/tls.h" 5#include "sysdep/tls.h"
5#include "uml-config.h" 6#include "uml-config.h"
@@ -48,14 +49,11 @@ int os_get_thread_area(user_desc_t *info, int pid)
48#ifdef UML_CONFIG_MODE_TT 49#ifdef UML_CONFIG_MODE_TT
49#include "linux/unistd.h" 50#include "linux/unistd.h"
50 51
51static _syscall1(int, get_thread_area, user_desc_t *, u_info);
52static _syscall1(int, set_thread_area, user_desc_t *, u_info);
53
54int do_set_thread_area_tt(user_desc_t *info) 52int do_set_thread_area_tt(user_desc_t *info)
55{ 53{
56 int ret; 54 int ret;
57 55
58 ret = set_thread_area(info); 56 ret = syscall(__NR_set_thread_area,info);
59 if (ret < 0) { 57 if (ret < 0) {
60 ret = -errno; 58 ret = -errno;
61 } 59 }
@@ -66,7 +64,7 @@ int do_get_thread_area_tt(user_desc_t *info)
66{ 64{
67 int ret; 65 int ret;
68 66
69 ret = get_thread_area(info); 67 ret = syscall(__NR_get_thread_area,info);
70 if (ret < 0) { 68 if (ret < 0) {
71 ret = -errno; 69 ret = -errno;
72 } 70 }
diff --git a/arch/um/sys-i386/unmap.c b/arch/um/sys-i386/unmap.c
index 1b0ad0e4adcd..8e55cd5d3d07 100644
--- a/arch/um/sys-i386/unmap.c
+++ b/arch/um/sys-i386/unmap.c
@@ -5,20 +5,17 @@
5 5
6#include <linux/mman.h> 6#include <linux/mman.h>
7#include <asm/unistd.h> 7#include <asm/unistd.h>
8#include <sys/syscall.h>
8 9
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap2,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size) 10int switcheroo(int fd, int prot, void *from, void *to, int size)
14{ 11{
15 if(munmap(to, size) < 0){ 12 if (syscall(__NR_munmap, to, size) < 0){
16 return(-1); 13 return(-1);
17 } 14 }
18 if(mmap2(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){ 15 if (syscall(__NR_mmap2, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1 ){
19 return(-1); 16 return(-1);
20 } 17 }
21 if(munmap(from, size) < 0){ 18 if (syscall(__NR_munmap, from, size) < 0){
22 return(-1); 19 return(-1);
23 } 20 }
24 return(0); 21 return(0);
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 6fce9f45dfdc..73ce4463f70c 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -21,7 +21,7 @@ asmlinkage long sys_uname64(struct new_utsname __user * name)
21{ 21{
22 int err; 22 int err;
23 down_read(&uts_sem); 23 down_read(&uts_sem);
24 err = copy_to_user(name, &system_utsname, sizeof (*name)); 24 err = copy_to_user(name, utsname(), sizeof (*name));
25 up_read(&uts_sem); 25 up_read(&uts_sem);
26 if (personality(current->personality) == PER_LINUX32) 26 if (personality(current->personality) == PER_LINUX32)
27 err |= copy_to_user(&name->machine, "i686", 5); 27 err |= copy_to_user(&name->machine, "i686", 5);
diff --git a/arch/um/sys-x86_64/sysrq.c b/arch/um/sys-x86_64/sysrq.c
index d0a25af19a5b..ce3e07fcf283 100644
--- a/arch/um/sys-x86_64/sysrq.c
+++ b/arch/um/sys-x86_64/sysrq.c
@@ -16,7 +16,7 @@ void __show_regs(struct pt_regs * regs)
16 printk("\n"); 16 printk("\n");
17 print_modules(); 17 print_modules();
18 printk("Pid: %d, comm: %.20s %s %s\n", 18 printk("Pid: %d, comm: %.20s %s %s\n",
19 current->pid, current->comm, print_tainted(), system_utsname.release); 19 current->pid, current->comm, print_tainted(), init_utsname()->release);
20 printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff, 20 printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff,
21 PT_REGS_RIP(regs)); 21 PT_REGS_RIP(regs));
22 printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs), 22 printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs),
diff --git a/arch/um/sys-x86_64/unmap.c b/arch/um/sys-x86_64/unmap.c
index f4a4bffd8a18..57c9286a701b 100644
--- a/arch/um/sys-x86_64/unmap.c
+++ b/arch/um/sys-x86_64/unmap.c
@@ -5,20 +5,17 @@
5 5
6#include <linux/mman.h> 6#include <linux/mman.h>
7#include <asm/unistd.h> 7#include <asm/unistd.h>
8#include <sys/syscall.h>
8 9
9static int errno;
10
11static inline _syscall2(int,munmap,void *,start,size_t,len)
12static inline _syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,offset)
13int switcheroo(int fd, int prot, void *from, void *to, int size) 10int switcheroo(int fd, int prot, void *from, void *to, int size)
14{ 11{
15 if(munmap(to, size) < 0){ 12 if (syscall(__NR_munmap, to, size) < 0){
16 return(-1); 13 return(-1);
17 } 14 }
18 if(mmap(to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){ 15 if (syscall(__NR_mmap, to, size, prot, MAP_SHARED | MAP_FIXED, fd, 0) == (void*) -1){
19 return(-1); 16 return(-1);
20 } 17 }
21 if(munmap(from, size) < 0){ 18 if (syscall(__NR_munmap, from, size) < 0){
22 return(-1); 19 return(-1);
23 } 20 }
24 return(0); 21 return(0);
diff --git a/arch/v850/kernel/memcons.c b/arch/v850/kernel/memcons.c
index 491614c435cd..92f514fdcc79 100644
--- a/arch/v850/kernel/memcons.c
+++ b/arch/v850/kernel/memcons.c
@@ -30,7 +30,7 @@ static DEFINE_SPINLOCK(memcons_lock);
30 30
31static size_t write (const char *buf, size_t len) 31static size_t write (const char *buf, size_t len)
32{ 32{
33 int flags; 33 unsigned long flags;
34 char *point; 34 char *point;
35 35
36 spin_lock_irqsave (memcons_lock, flags); 36 spin_lock_irqsave (memcons_lock, flags);
@@ -104,7 +104,7 @@ int memcons_tty_chars_in_buffer (struct tty_struct *tty)
104 return 0; 104 return 0;
105} 105}
106 106
107static struct tty_operations ops = { 107static const struct tty_operations ops = {
108 .open = memcons_tty_open, 108 .open = memcons_tty_open,
109 .write = memcons_tty_write, 109 .write = memcons_tty_write,
110 .write_room = memcons_tty_write_room, 110 .write_room = memcons_tty_write_room,
diff --git a/arch/v850/kernel/rte_cb_leds.c b/arch/v850/kernel/rte_cb_leds.c
index f654088b2760..996bd4f33ecb 100644
--- a/arch/v850/kernel/rte_cb_leds.c
+++ b/arch/v850/kernel/rte_cb_leds.c
@@ -42,7 +42,7 @@ do { \
42 len = LED_NUM_DIGITS - pos; \ 42 len = LED_NUM_DIGITS - pos; \
43 \ 43 \
44 if (len > 0) { \ 44 if (len > 0) { \
45 int _flags; \ 45 unsigned long _flags; \
46 const char *_end = buf + len; \ 46 const char *_end = buf + len; \
47 img_decl = &leds_image[pos]; \ 47 img_decl = &leds_image[pos]; \
48 \ 48 \
diff --git a/arch/v850/kernel/rte_mb_a_pci.c b/arch/v850/kernel/rte_mb_a_pci.c
index f36b778f1432..35213fa9f7d8 100644
--- a/arch/v850/kernel/rte_mb_a_pci.c
+++ b/arch/v850/kernel/rte_mb_a_pci.c
@@ -365,7 +365,7 @@ static DEFINE_SPINLOCK(mb_sram_lock);
365static void *alloc_mb_sram (size_t size) 365static void *alloc_mb_sram (size_t size)
366{ 366{
367 struct mb_sram_free_area *prev, *fa; 367 struct mb_sram_free_area *prev, *fa;
368 int flags; 368 unsigned long flags;
369 void *mem = 0; 369 void *mem = 0;
370 370
371 spin_lock_irqsave (mb_sram_lock, flags); 371 spin_lock_irqsave (mb_sram_lock, flags);
@@ -406,7 +406,7 @@ static void *alloc_mb_sram (size_t size)
406static void free_mb_sram (void *mem, size_t size) 406static void free_mb_sram (void *mem, size_t size)
407{ 407{
408 struct mb_sram_free_area *prev, *fa, *new_fa; 408 struct mb_sram_free_area *prev, *fa, *new_fa;
409 int flags; 409 unsigned long flags;
410 void *end = mem + size; 410 void *end = mem + size;
411 411
412 spin_lock_irqsave (mb_sram_lock, flags); 412 spin_lock_irqsave (mb_sram_lock, flags);
@@ -517,7 +517,7 @@ static DEFINE_SPINLOCK(dma_mappings_lock);
517 517
518static struct dma_mapping *new_dma_mapping (size_t size) 518static struct dma_mapping *new_dma_mapping (size_t size)
519{ 519{
520 int flags; 520 unsigned long flags;
521 struct dma_mapping *mapping; 521 struct dma_mapping *mapping;
522 void *mb_sram_block = alloc_mb_sram (size); 522 void *mb_sram_block = alloc_mb_sram (size);
523 523
@@ -575,7 +575,7 @@ static struct dma_mapping *new_dma_mapping (size_t size)
575 575
576static struct dma_mapping *find_dma_mapping (void *mb_sram_addr) 576static struct dma_mapping *find_dma_mapping (void *mb_sram_addr)
577{ 577{
578 int flags; 578 unsigned long flags;
579 struct dma_mapping *mapping; 579 struct dma_mapping *mapping;
580 580
581 spin_lock_irqsave (dma_mappings_lock, flags); 581 spin_lock_irqsave (dma_mappings_lock, flags);
@@ -592,7 +592,7 @@ static struct dma_mapping *find_dma_mapping (void *mb_sram_addr)
592 592
593static struct dma_mapping *deactivate_dma_mapping (void *mb_sram_addr) 593static struct dma_mapping *deactivate_dma_mapping (void *mb_sram_addr)
594{ 594{
595 int flags; 595 unsigned long flags;
596 struct dma_mapping *mapping, *prev; 596 struct dma_mapping *mapping, *prev;
597 597
598 spin_lock_irqsave (dma_mappings_lock, flags); 598 spin_lock_irqsave (dma_mappings_lock, flags);
@@ -622,7 +622,7 @@ static struct dma_mapping *deactivate_dma_mapping (void *mb_sram_addr)
622static inline void 622static inline void
623free_dma_mapping (struct dma_mapping *mapping) 623free_dma_mapping (struct dma_mapping *mapping)
624{ 624{
625 int flags; 625 unsigned long flags;
626 626
627 free_mb_sram (mapping->mb_sram_addr, mapping->size); 627 free_mb_sram (mapping->mb_sram_addr, mapping->size);
628 628
diff --git a/arch/v850/kernel/simcons.c b/arch/v850/kernel/simcons.c
index 3975aa02cef8..9973596ae304 100644
--- a/arch/v850/kernel/simcons.c
+++ b/arch/v850/kernel/simcons.c
@@ -77,7 +77,7 @@ int simcons_tty_chars_in_buffer (struct tty_struct *tty)
77 return 0; 77 return 0;
78} 78}
79 79
80static struct tty_operations ops = { 80static const struct tty_operations ops = {
81 .open = simcons_tty_open, 81 .open = simcons_tty_open,
82 .write = simcons_tty_write, 82 .write = simcons_tty_write,
83 .write_room = simcons_tty_write_room, 83 .write_room = simcons_tty_write_room,
diff --git a/arch/v850/kernel/syscalls.c b/arch/v850/kernel/syscalls.c
index 2ec0700fc46b..d2b1fb19d243 100644
--- a/arch/v850/kernel/syscalls.c
+++ b/arch/v850/kernel/syscalls.c
@@ -33,6 +33,7 @@
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34#include <asm/ipc.h> 34#include <asm/ipc.h>
35#include <asm/semaphore.h> 35#include <asm/semaphore.h>
36#include <asm/unistd.h>
36 37
37/* 38/*
38 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 39 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
@@ -194,3 +195,22 @@ unsigned long sys_mmap (unsigned long addr, size_t len,
194out: 195out:
195 return err; 196 return err;
196} 197}
198
199/*
200 * Do a system call from kernel instead of calling sys_execve so we
201 * end up with proper pt_regs.
202 */
203int kernel_execve(const char *filename, char *const argv[], char *const envp[])
204{
205 register char *__a __asm__ ("r6") = filename;
206 register void *__b __asm__ ("r7") = argv;
207 register void *__c __asm__ ("r8") = envp;
208 register unsigned long __syscall __asm__ ("r12") = __NR_execve;
209 register unsigned long __ret __asm__ ("r10");
210 __asm__ __volatile__ ("trap 0"
211 : "=r" (__ret), "=r" (__syscall)
212 : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
213 : "r1", "r5", "r11", "r13", "r14",
214 "r15", "r16", "r17", "r18", "r19");
215 return __ret;
216}
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 32ae1378f35c..0a5d8e659aa4 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -367,6 +367,10 @@ config ARCH_FLATMEM_ENABLE
367 367
368source "mm/Kconfig" 368source "mm/Kconfig"
369 369
370config MEMORY_HOTPLUG_RESERVE
371 def_bool y
372 depends on (MEMORY_HOTPLUG && DISCONTIGMEM)
373
370config HAVE_ARCH_EARLY_PFN_TO_NID 374config HAVE_ARCH_EARLY_PFN_TO_NID
371 def_bool y 375 def_bool y
372 depends on NUMA 376 depends on NUMA
@@ -686,7 +690,7 @@ source "arch/x86_64/oprofile/Kconfig"
686 690
687config KPROBES 691config KPROBES
688 bool "Kprobes (EXPERIMENTAL)" 692 bool "Kprobes (EXPERIMENTAL)"
689 depends on EXPERIMENTAL && MODULES 693 depends on KALLSYMS && EXPERIMENTAL && MODULES
690 help 694 help
691 Kprobes allows you to trap at almost any kernel address and 695 Kprobes allows you to trap at almost any kernel address and
692 execute a callback function. register_kprobe() establishes 696 execute a callback function. register_kprobe() establishes
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 647610ecb580..4844b543bed0 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,11 +1,12 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-git5 3# Linux kernel version: 2.6.18-git7
4# Tue Sep 26 09:30:47 2006 4# Wed Sep 27 21:53:10 2006
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
8CONFIG_X86=y 8CONFIG_X86=y
9CONFIG_ZONE_DMA32=y
9CONFIG_LOCKDEP_SUPPORT=y 10CONFIG_LOCKDEP_SUPPORT=y
10CONFIG_STACKTRACE_SUPPORT=y 11CONFIG_STACKTRACE_SUPPORT=y
11CONFIG_SEMAPHORE_SLEEPERS=y 12CONFIG_SEMAPHORE_SLEEPERS=y
@@ -179,6 +180,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
179CONFIG_PM=y 180CONFIG_PM=y
180# CONFIG_PM_LEGACY is not set 181# CONFIG_PM_LEGACY is not set
181# CONFIG_PM_DEBUG is not set 182# CONFIG_PM_DEBUG is not set
183# CONFIG_PM_SYSFS_DEPRECATED is not set
182CONFIG_SOFTWARE_SUSPEND=y 184CONFIG_SOFTWARE_SUSPEND=y
183CONFIG_PM_STD_PARTITION="" 185CONFIG_PM_STD_PARTITION=""
184CONFIG_SUSPEND_SMP=y 186CONFIG_SUSPEND_SMP=y
@@ -251,6 +253,7 @@ CONFIG_PCI_DIRECT=y
251CONFIG_PCI_MMCONFIG=y 253CONFIG_PCI_MMCONFIG=y
252CONFIG_PCIEPORTBUS=y 254CONFIG_PCIEPORTBUS=y
253CONFIG_PCI_MSI=y 255CONFIG_PCI_MSI=y
256# CONFIG_PCI_MULTITHREAD_PROBE is not set
254# CONFIG_PCI_DEBUG is not set 257# CONFIG_PCI_DEBUG is not set
255 258
256# 259#
@@ -1458,6 +1461,7 @@ CONFIG_KPROBES=y
1458# 1461#
1459CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1462CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1460# CONFIG_PRINTK_TIME is not set 1463# CONFIG_PRINTK_TIME is not set
1464# CONFIG_ENABLE_MUST_CHECK is not set
1461CONFIG_MAGIC_SYSRQ=y 1465CONFIG_MAGIC_SYSRQ=y
1462CONFIG_UNUSED_SYMBOLS=y 1466CONFIG_UNUSED_SYMBOLS=y
1463CONFIG_DEBUG_KERNEL=y 1467CONFIG_DEBUG_KERNEL=y
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index f280d3665f4b..c9bac3af29d6 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -76,6 +76,8 @@
76 76
77int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf) 77int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf)
78{ 78{
79 compat_ino_t ino;
80
79 typeof(ubuf->st_uid) uid = 0; 81 typeof(ubuf->st_uid) uid = 0;
80 typeof(ubuf->st_gid) gid = 0; 82 typeof(ubuf->st_gid) gid = 0;
81 SET_UID(uid, kbuf->uid); 83 SET_UID(uid, kbuf->uid);
@@ -84,9 +86,12 @@ int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf)
84 return -EOVERFLOW; 86 return -EOVERFLOW;
85 if (kbuf->size >= 0x7fffffff) 87 if (kbuf->size >= 0x7fffffff)
86 return -EOVERFLOW; 88 return -EOVERFLOW;
89 ino = kbuf->ino;
90 if (sizeof(ino) < sizeof(kbuf->ino) && ino != kbuf->ino)
91 return -EOVERFLOW;
87 if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct compat_stat)) || 92 if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct compat_stat)) ||
88 __put_user (old_encode_dev(kbuf->dev), &ubuf->st_dev) || 93 __put_user (old_encode_dev(kbuf->dev), &ubuf->st_dev) ||
89 __put_user (kbuf->ino, &ubuf->st_ino) || 94 __put_user (ino, &ubuf->st_ino) ||
90 __put_user (kbuf->mode, &ubuf->st_mode) || 95 __put_user (kbuf->mode, &ubuf->st_mode) ||
91 __put_user (kbuf->nlink, &ubuf->st_nlink) || 96 __put_user (kbuf->nlink, &ubuf->st_nlink) ||
92 __put_user (uid, &ubuf->st_uid) || 97 __put_user (uid, &ubuf->st_uid) ||
@@ -784,36 +789,36 @@ asmlinkage long sys32_olduname(struct oldold_utsname __user * name)
784 789
785 if (!name) 790 if (!name)
786 return -EFAULT; 791 return -EFAULT;
787 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) 792 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
788 return -EFAULT; 793 return -EFAULT;
789 794
790 down_read(&uts_sem); 795 down_read(&uts_sem);
791 796
792 err = __copy_to_user(&name->sysname,&system_utsname.sysname, 797 err = __copy_to_user(&name->sysname,&utsname()->sysname,
793 __OLD_UTS_LEN); 798 __OLD_UTS_LEN);
794 err |= __put_user(0,name->sysname+__OLD_UTS_LEN); 799 err |= __put_user(0,name->sysname+__OLD_UTS_LEN);
795 err |= __copy_to_user(&name->nodename,&system_utsname.nodename, 800 err |= __copy_to_user(&name->nodename,&utsname()->nodename,
796 __OLD_UTS_LEN); 801 __OLD_UTS_LEN);
797 err |= __put_user(0,name->nodename+__OLD_UTS_LEN); 802 err |= __put_user(0,name->nodename+__OLD_UTS_LEN);
798 err |= __copy_to_user(&name->release,&system_utsname.release, 803 err |= __copy_to_user(&name->release,&utsname()->release,
799 __OLD_UTS_LEN); 804 __OLD_UTS_LEN);
800 err |= __put_user(0,name->release+__OLD_UTS_LEN); 805 err |= __put_user(0,name->release+__OLD_UTS_LEN);
801 err |= __copy_to_user(&name->version,&system_utsname.version, 806 err |= __copy_to_user(&name->version,&utsname()->version,
802 __OLD_UTS_LEN); 807 __OLD_UTS_LEN);
803 err |= __put_user(0,name->version+__OLD_UTS_LEN); 808 err |= __put_user(0,name->version+__OLD_UTS_LEN);
804 { 809 {
805 char *arch = "x86_64"; 810 char *arch = "x86_64";
806 if (personality(current->personality) == PER_LINUX32) 811 if (personality(current->personality) == PER_LINUX32)
807 arch = "i686"; 812 arch = "i686";
808 813
809 err |= __copy_to_user(&name->machine,arch,strlen(arch)+1); 814 err |= __copy_to_user(&name->machine, arch, strlen(arch)+1);
810 } 815 }
811 816
812 up_read(&uts_sem); 817 up_read(&uts_sem);
813 818
814 err = err ? -EFAULT : 0; 819 err = err ? -EFAULT : 0;
815 820
816 return err; 821 return err;
817} 822}
818 823
819long sys32_uname(struct old_utsname __user * name) 824long sys32_uname(struct old_utsname __user * name)
@@ -822,7 +827,7 @@ long sys32_uname(struct old_utsname __user * name)
822 if (!name) 827 if (!name)
823 return -EFAULT; 828 return -EFAULT;
824 down_read(&uts_sem); 829 down_read(&uts_sem);
825 err=copy_to_user(name, &system_utsname, sizeof (*name)); 830 err = copy_to_user(name, utsname(), sizeof (*name));
826 up_read(&uts_sem); 831 up_read(&uts_sem);
827 if (personality(current->personality) == PER_LINUX32) 832 if (personality(current->personality) == PER_LINUX32)
828 err |= copy_to_user(&name->machine, "i686", 5); 833 err |= copy_to_user(&name->machine, "i686", 5);
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 135ff25e6b44..6472e321cad7 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -25,7 +25,6 @@
25#include <linux/kernel_stat.h> 25#include <linux/kernel_stat.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/ioport.h>
29 28
30#include <asm/atomic.h> 29#include <asm/atomic.h>
31#include <asm/smp.h> 30#include <asm/smp.h>
@@ -46,11 +45,6 @@ int apic_calibrate_pmtmr __initdata;
46 45
47int disable_apic_timer __initdata; 46int disable_apic_timer __initdata;
48 47
49static struct resource lapic_resource = {
50 .name = "Local APIC",
51 .flags = IORESOURCE_MEM | IORESOURCE_BUSY,
52};
53
54/* 48/*
55 * cpu_mask that denotes the CPUs that needs timer interrupt coming in as 49 * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
56 * IPIs in place of local APIC timers 50 * IPIs in place of local APIC timers
@@ -591,40 +585,6 @@ static int __init detect_init_APIC (void)
591 return 0; 585 return 0;
592} 586}
593 587
594#ifdef CONFIG_X86_IO_APIC
595static struct resource * __init ioapic_setup_resources(void)
596{
597#define IOAPIC_RESOURCE_NAME_SIZE 11
598 unsigned long n;
599 struct resource *res;
600 char *mem;
601 int i;
602
603 if (nr_ioapics <= 0)
604 return NULL;
605
606 n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource);
607 n *= nr_ioapics;
608
609 res = alloc_bootmem(n);
610
611 if (!res)
612 return NULL;
613
614 memset(res, 0, n);
615 mem = (void *)&res[nr_ioapics];
616
617 for (i = 0; i < nr_ioapics; i++) {
618 res[i].name = mem;
619 res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
620 snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i);
621 mem += IOAPIC_RESOURCE_NAME_SIZE;
622 }
623
624 return res;
625}
626#endif
627
628void __init init_apic_mappings(void) 588void __init init_apic_mappings(void)
629{ 589{
630 unsigned long apic_phys; 590 unsigned long apic_phys;
@@ -644,11 +604,6 @@ void __init init_apic_mappings(void)
644 apic_mapped = 1; 604 apic_mapped = 1;
645 apic_printk(APIC_VERBOSE,"mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys); 605 apic_printk(APIC_VERBOSE,"mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys);
646 606
647 /* Put local APIC into the resource map. */
648 lapic_resource.start = apic_phys;
649 lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1;
650 insert_resource(&iomem_resource, &lapic_resource);
651
652 /* 607 /*
653 * Fetch the APIC ID of the BSP in case we have a 608 * Fetch the APIC ID of the BSP in case we have a
654 * default configuration (or the MP table is broken). 609 * default configuration (or the MP table is broken).
@@ -658,9 +613,7 @@ void __init init_apic_mappings(void)
658 { 613 {
659 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; 614 unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0;
660 int i; 615 int i;
661 struct resource *ioapic_res;
662 616
663 ioapic_res = ioapic_setup_resources();
664 for (i = 0; i < nr_ioapics; i++) { 617 for (i = 0; i < nr_ioapics; i++) {
665 if (smp_found_config) { 618 if (smp_found_config) {
666 ioapic_phys = mp_ioapics[i].mpc_apicaddr; 619 ioapic_phys = mp_ioapics[i].mpc_apicaddr;
@@ -672,13 +625,6 @@ void __init init_apic_mappings(void)
672 apic_printk(APIC_VERBOSE,"mapped IOAPIC to %016lx (%016lx)\n", 625 apic_printk(APIC_VERBOSE,"mapped IOAPIC to %016lx (%016lx)\n",
673 __fix_to_virt(idx), ioapic_phys); 626 __fix_to_virt(idx), ioapic_phys);
674 idx++; 627 idx++;
675
676 if (ioapic_res) {
677 ioapic_res->start = ioapic_phys;
678 ioapic_res->end = ioapic_phys + (4 * 1024) - 1;
679 insert_resource(&iomem_resource, ioapic_res);
680 ioapic_res++;
681 }
682 } 628 }
683 } 629 }
684} 630}
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 2802524104f3..b8285cf1a9c3 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -1023,7 +1023,7 @@ ENDPROC(child_rip)
1023 * do_sys_execve asm fallback arguments: 1023 * do_sys_execve asm fallback arguments:
1024 * rdi: name, rsi: argv, rdx: envp, fake frame on the stack 1024 * rdi: name, rsi: argv, rdx: envp, fake frame on the stack
1025 */ 1025 */
1026ENTRY(execve) 1026ENTRY(kernel_execve)
1027 CFI_STARTPROC 1027 CFI_STARTPROC
1028 FAKE_STACK_FRAME $0 1028 FAKE_STACK_FRAME $0
1029 SAVE_ALL 1029 SAVE_ALL
@@ -1036,7 +1036,7 @@ ENTRY(execve)
1036 UNFAKE_STACK_FRAME 1036 UNFAKE_STACK_FRAME
1037 ret 1037 ret
1038 CFI_ENDPROC 1038 CFI_ENDPROC
1039ENDPROC(execve) 1039ENDPROC(kernel_execve)
1040 1040
1041KPROBE_ENTRY(page_fault) 1041KPROBE_ENTRY(page_fault)
1042 errorentry do_page_fault 1042 errorentry do_page_fault
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
index ffc73ac72485..ac241567e682 100644
--- a/arch/x86_64/kernel/kprobes.c
+++ b/arch/x86_64/kernel/kprobes.c
@@ -270,20 +270,19 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe *rp,
270 struct pt_regs *regs) 270 struct pt_regs *regs)
271{ 271{
272 unsigned long *sara = (unsigned long *)regs->rsp; 272 unsigned long *sara = (unsigned long *)regs->rsp;
273 struct kretprobe_instance *ri; 273 struct kretprobe_instance *ri;
274 274
275 if ((ri = get_free_rp_inst(rp)) != NULL) { 275 if ((ri = get_free_rp_inst(rp)) != NULL) {
276 ri->rp = rp; 276 ri->rp = rp;
277 ri->task = current; 277 ri->task = current;
278 ri->ret_addr = (kprobe_opcode_t *) *sara; 278 ri->ret_addr = (kprobe_opcode_t *) *sara;
279 279
280 /* Replace the return addr with trampoline addr */ 280 /* Replace the return addr with trampoline addr */
281 *sara = (unsigned long) &kretprobe_trampoline; 281 *sara = (unsigned long) &kretprobe_trampoline;
282 282 add_rp_inst(ri);
283 add_rp_inst(ri); 283 } else {
284 } else { 284 rp->nmissed++;
285 rp->nmissed++; 285 }
286 }
287} 286}
288 287
289int __kprobes kprobe_handler(struct pt_regs *regs) 288int __kprobes kprobe_handler(struct pt_regs *regs)
@@ -405,14 +404,15 @@ no_kprobe:
405 */ 404 */
406int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) 405int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
407{ 406{
408 struct kretprobe_instance *ri = NULL; 407 struct kretprobe_instance *ri = NULL;
409 struct hlist_head *head; 408 struct hlist_head *head, empty_rp;
410 struct hlist_node *node, *tmp; 409 struct hlist_node *node, *tmp;
411 unsigned long flags, orig_ret_address = 0; 410 unsigned long flags, orig_ret_address = 0;
412 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; 411 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
413 412
413 INIT_HLIST_HEAD(&empty_rp);
414 spin_lock_irqsave(&kretprobe_lock, flags); 414 spin_lock_irqsave(&kretprobe_lock, flags);
415 head = kretprobe_inst_table_head(current); 415 head = kretprobe_inst_table_head(current);
416 416
417 /* 417 /*
418 * It is possible to have multiple instances associated with a given 418 * It is possible to have multiple instances associated with a given
@@ -423,20 +423,20 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
423 * We can handle this because: 423 * We can handle this because:
424 * - instances are always inserted at the head of the list 424 * - instances are always inserted at the head of the list
425 * - when multiple return probes are registered for the same 425 * - when multiple return probes are registered for the same
426 * function, the first instance's ret_addr will point to the 426 * function, the first instance's ret_addr will point to the
427 * real return address, and all the rest will point to 427 * real return address, and all the rest will point to
428 * kretprobe_trampoline 428 * kretprobe_trampoline
429 */ 429 */
430 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { 430 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
431 if (ri->task != current) 431 if (ri->task != current)
432 /* another task is sharing our hash bucket */ 432 /* another task is sharing our hash bucket */
433 continue; 433 continue;
434 434
435 if (ri->rp && ri->rp->handler) 435 if (ri->rp && ri->rp->handler)
436 ri->rp->handler(ri, regs); 436 ri->rp->handler(ri, regs);
437 437
438 orig_ret_address = (unsigned long)ri->ret_addr; 438 orig_ret_address = (unsigned long)ri->ret_addr;
439 recycle_rp_inst(ri); 439 recycle_rp_inst(ri, &empty_rp);
440 440
441 if (orig_ret_address != trampoline_address) 441 if (orig_ret_address != trampoline_address)
442 /* 442 /*
@@ -454,12 +454,16 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
454 spin_unlock_irqrestore(&kretprobe_lock, flags); 454 spin_unlock_irqrestore(&kretprobe_lock, flags);
455 preempt_enable_no_resched(); 455 preempt_enable_no_resched();
456 456
457 /* 457 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
458 * By returning a non-zero value, we are telling 458 hlist_del(&ri->hlist);
459 * kprobe_handler() that we don't want the post_handler 459 kfree(ri);
460 }
461 /*
462 * By returning a non-zero value, we are telling
463 * kprobe_handler() that we don't want the post_handler
460 * to run (and have re-enabled preemption) 464 * to run (and have re-enabled preemption)
461 */ 465 */
462 return 1; 466 return 1;
463} 467}
464 468
465/* 469/*
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 20e88f4b564b..b8d53dfa9931 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -152,6 +152,21 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
152 } 152 }
153} 153}
154 154
155static int bad_ioapic(unsigned long address)
156{
157 if (nr_ioapics >= MAX_IO_APICS) {
158 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
159 "(found %d)\n", MAX_IO_APICS, nr_ioapics);
160 panic("Recompile kernel with bigger MAX_IO_APICS!\n");
161 }
162 if (!address) {
163 printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
164 " found in table, skipping!\n");
165 return 1;
166 }
167 return 0;
168}
169
155static void __init MP_ioapic_info (struct mpc_config_ioapic *m) 170static void __init MP_ioapic_info (struct mpc_config_ioapic *m)
156{ 171{
157 if (!(m->mpc_flags & MPC_APIC_USABLE)) 172 if (!(m->mpc_flags & MPC_APIC_USABLE))
@@ -159,16 +174,10 @@ static void __init MP_ioapic_info (struct mpc_config_ioapic *m)
159 174
160 printk("I/O APIC #%d at 0x%X.\n", 175 printk("I/O APIC #%d at 0x%X.\n",
161 m->mpc_apicid, m->mpc_apicaddr); 176 m->mpc_apicid, m->mpc_apicaddr);
162 if (nr_ioapics >= MAX_IO_APICS) { 177
163 printk(KERN_ERR "Max # of I/O APICs (%d) exceeded (found %d).\n", 178 if (bad_ioapic(m->mpc_apicaddr))
164 MAX_IO_APICS, nr_ioapics);
165 panic("Recompile kernel with bigger MAX_IO_APICS!.\n");
166 }
167 if (!m->mpc_apicaddr) {
168 printk(KERN_ERR "WARNING: bogus zero I/O APIC address"
169 " found in MP table, skipping!\n");
170 return; 179 return;
171 } 180
172 mp_ioapics[nr_ioapics] = *m; 181 mp_ioapics[nr_ioapics] = *m;
173 nr_ioapics++; 182 nr_ioapics++;
174} 183}
@@ -647,16 +656,8 @@ void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base)
647{ 656{
648 int idx = 0; 657 int idx = 0;
649 658
650 if (nr_ioapics >= MAX_IO_APICS) { 659 if (bad_ioapic(address))
651 printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded "
652 "(found %d)\n", MAX_IO_APICS, nr_ioapics);
653 panic("Recompile kernel with bigger MAX_IO_APICS!\n");
654 }
655 if (!address) {
656 printk(KERN_ERR "WARNING: Bogus (zero) I/O APIC address"
657 " found in MADT table, skipping!\n");
658 return; 660 return;
659 }
660 661
661 idx = nr_ioapics++; 662 idx = nr_ioapics++;
662 663
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 4d6fb047952e..7af9cb3e2d99 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -28,6 +28,10 @@
28#include <asm/mce.h> 28#include <asm/mce.h>
29#include <asm/intel_arch_perfmon.h> 29#include <asm/intel_arch_perfmon.h>
30 30
31int unknown_nmi_panic;
32int nmi_watchdog_enabled;
33int panic_on_unrecovered_nmi;
34
31/* perfctr_nmi_owner tracks the ownership of the perfctr registers: 35/* perfctr_nmi_owner tracks the ownership of the perfctr registers:
32 * evtsel_nmi_owner tracks the ownership of the event selection 36 * evtsel_nmi_owner tracks the ownership of the event selection
33 * - different performance counters/ event selection may be reserved for 37 * - different performance counters/ event selection may be reserved for
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 4dcb671bd19f..f8d857453f8a 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -170,8 +170,20 @@ void dma_free_coherent(struct device *dev, size_t size,
170} 170}
171EXPORT_SYMBOL(dma_free_coherent); 171EXPORT_SYMBOL(dma_free_coherent);
172 172
173static int forbid_dac __read_mostly;
174
173int dma_supported(struct device *dev, u64 mask) 175int dma_supported(struct device *dev, u64 mask)
174{ 176{
177#ifdef CONFIG_PCI
178 if (mask > 0xffffffff && forbid_dac > 0) {
179
180
181
182 printk(KERN_INFO "PCI: Disallowing DAC for device %s\n", dev->bus_id);
183 return 0;
184 }
185#endif
186
175 if (dma_ops->dma_supported) 187 if (dma_ops->dma_supported)
176 return dma_ops->dma_supported(dev, mask); 188 return dma_ops->dma_supported(dev, mask);
177 189
@@ -231,57 +243,64 @@ EXPORT_SYMBOL(dma_set_mask);
231 allowed overwrite iommu off workarounds for specific chipsets. 243 allowed overwrite iommu off workarounds for specific chipsets.
232 soft Use software bounce buffering (default for Intel machines) 244 soft Use software bounce buffering (default for Intel machines)
233 noaperture Don't touch the aperture for AGP. 245 noaperture Don't touch the aperture for AGP.
246 allowdac Allow DMA >4GB
247 nodac Forbid DMA >4GB
248 panic Force panic when IOMMU overflows
234*/ 249*/
235__init int iommu_setup(char *p) 250__init int iommu_setup(char *p)
236{ 251{
237 iommu_merge = 1; 252 iommu_merge = 1;
238 253
239 if (!p) 254 if (!p)
240 return -EINVAL; 255 return -EINVAL;
241 256
242 while (*p) { 257 while (*p) {
243 if (!strncmp(p,"off",3)) 258 if (!strncmp(p,"off",3))
244 no_iommu = 1; 259 no_iommu = 1;
245 /* gart_parse_options has more force support */ 260 /* gart_parse_options has more force support */
246 if (!strncmp(p,"force",5)) 261 if (!strncmp(p,"force",5))
247 force_iommu = 1; 262 force_iommu = 1;
248 if (!strncmp(p,"noforce",7)) { 263 if (!strncmp(p,"noforce",7)) {
249 iommu_merge = 0; 264 iommu_merge = 0;
250 force_iommu = 0; 265 force_iommu = 0;
251 } 266 }
252 267
253 if (!strncmp(p, "biomerge",8)) { 268 if (!strncmp(p, "biomerge",8)) {
254 iommu_bio_merge = 4096; 269 iommu_bio_merge = 4096;
255 iommu_merge = 1; 270 iommu_merge = 1;
256 force_iommu = 1; 271 force_iommu = 1;
257 } 272 }
258 if (!strncmp(p, "panic",5)) 273 if (!strncmp(p, "panic",5))
259 panic_on_overflow = 1; 274 panic_on_overflow = 1;
260 if (!strncmp(p, "nopanic",7)) 275 if (!strncmp(p, "nopanic",7))
261 panic_on_overflow = 0; 276 panic_on_overflow = 0;
262 if (!strncmp(p, "merge",5)) { 277 if (!strncmp(p, "merge",5)) {
263 iommu_merge = 1; 278 iommu_merge = 1;
264 force_iommu = 1; 279 force_iommu = 1;
265 } 280 }
266 if (!strncmp(p, "nomerge",7)) 281 if (!strncmp(p, "nomerge",7))
267 iommu_merge = 0; 282 iommu_merge = 0;
268 if (!strncmp(p, "forcesac",8)) 283 if (!strncmp(p, "forcesac",8))
269 iommu_sac_force = 1; 284 iommu_sac_force = 1;
285 if (!strncmp(p, "allowdac", 8))
286 forbid_dac = 0;
287 if (!strncmp(p, "nodac", 5))
288 forbid_dac = -1;
270 289
271#ifdef CONFIG_SWIOTLB 290#ifdef CONFIG_SWIOTLB
272 if (!strncmp(p, "soft",4)) 291 if (!strncmp(p, "soft",4))
273 swiotlb = 1; 292 swiotlb = 1;
274#endif 293#endif
275 294
276#ifdef CONFIG_IOMMU 295#ifdef CONFIG_IOMMU
277 gart_parse_options(p); 296 gart_parse_options(p);
278#endif 297#endif
279 298
280 p += strcspn(p, ","); 299 p += strcspn(p, ",");
281 if (*p == ',') 300 if (*p == ',')
282 ++p; 301 ++p;
283 } 302 }
284 return 0; 303 return 0;
285} 304}
286early_param("iommu", iommu_setup); 305early_param("iommu", iommu_setup);
287 306
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 458006ae19f3..de10cb8a2c97 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -294,9 +294,9 @@ void __show_regs(struct pt_regs * regs)
294 print_modules(); 294 print_modules();
295 printk("Pid: %d, comm: %.20s %s %s %.*s\n", 295 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
296 current->pid, current->comm, print_tainted(), 296 current->pid, current->comm, print_tainted(),
297 system_utsname.release, 297 init_utsname()->release,
298 (int)strcspn(system_utsname.version, " "), 298 (int)strcspn(init_utsname()->version, " "),
299 system_utsname.version); 299 init_utsname()->version);
300 printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip); 300 printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
301 printk_address(regs->rip); 301 printk_address(regs->rip);
302 printk("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, 302 printk("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp,
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 0b00bb2ea576..fc944b5e8f4a 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -123,9 +123,6 @@ struct resource standard_io_resources[] = {
123 .flags = IORESOURCE_BUSY | IORESOURCE_IO } 123 .flags = IORESOURCE_BUSY | IORESOURCE_IO }
124}; 124};
125 125
126#define STANDARD_IO_RESOURCES \
127 (sizeof standard_io_resources / sizeof standard_io_resources[0])
128
129#define IORESOURCE_RAM (IORESOURCE_BUSY | IORESOURCE_MEM) 126#define IORESOURCE_RAM (IORESOURCE_BUSY | IORESOURCE_MEM)
130 127
131struct resource data_resource = { 128struct resource data_resource = {
@@ -172,9 +169,6 @@ static struct resource adapter_rom_resources[] = {
172 .flags = IORESOURCE_ROM } 169 .flags = IORESOURCE_ROM }
173}; 170};
174 171
175#define ADAPTER_ROM_RESOURCES \
176 (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0])
177
178static struct resource video_rom_resource = { 172static struct resource video_rom_resource = {
179 .name = "Video ROM", 173 .name = "Video ROM",
180 .start = 0xc0000, 174 .start = 0xc0000,
@@ -245,7 +239,8 @@ static void __init probe_roms(void)
245 } 239 }
246 240
247 /* check for adapter roms on 2k boundaries */ 241 /* check for adapter roms on 2k boundaries */
248 for (i = 0; i < ADAPTER_ROM_RESOURCES && start < upper; start += 2048) { 242 for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper;
243 start += 2048) {
249 rom = isa_bus_to_virt(start); 244 rom = isa_bus_to_virt(start);
250 if (!romsignature(rom)) 245 if (!romsignature(rom))
251 continue; 246 continue;
@@ -537,7 +532,7 @@ void __init setup_arch(char **cmdline_p)
537 { 532 {
538 unsigned i; 533 unsigned i;
539 /* request I/O space for devices used on all i[345]86 PCs */ 534 /* request I/O space for devices used on all i[345]86 PCs */
540 for (i = 0; i < STANDARD_IO_RESOURCES; i++) 535 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
541 request_resource(&ioport_resource, &standard_io_resources[i]); 536 request_resource(&ioport_resource, &standard_io_resources[i]);
542 } 537 }
543 538
diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c
index 6449ea8fe756..76bf7c241fe4 100644
--- a/arch/x86_64/kernel/sys_x86_64.c
+++ b/arch/x86_64/kernel/sys_x86_64.c
@@ -148,7 +148,7 @@ asmlinkage long sys_uname(struct new_utsname __user * name)
148{ 148{
149 int err; 149 int err;
150 down_read(&uts_sem); 150 down_read(&uts_sem);
151 err = copy_to_user(name, &system_utsname, sizeof (*name)); 151 err = copy_to_user(name, utsname(), sizeof (*name));
152 up_read(&uts_sem); 152 up_read(&uts_sem);
153 if (personality(current->personality) == PER_LINUX32) 153 if (personality(current->personality) == PER_LINUX32)
154 err |= copy_to_user(&name->machine, "i686", 5); 154 err |= copy_to_user(&name->machine, "i686", 5);
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 7ea3bf2a858c..557e92af7bea 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -77,7 +77,6 @@ unsigned long long monotonic_base;
77struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ 77struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */
78 78
79volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; 79volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES;
80unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES;
81struct timespec __xtime __section_xtime; 80struct timespec __xtime __section_xtime;
82struct timezone __sys_tz __section_sys_tz; 81struct timezone __sys_tz __section_sys_tz;
83 82
@@ -119,7 +118,7 @@ unsigned int (*do_gettimeoffset)(void) = do_gettimeoffset_tsc;
119 118
120void do_gettimeofday(struct timeval *tv) 119void do_gettimeofday(struct timeval *tv)
121{ 120{
122 unsigned long seq, t; 121 unsigned long seq;
123 unsigned int sec, usec; 122 unsigned int sec, usec;
124 123
125 do { 124 do {
@@ -136,10 +135,7 @@ void do_gettimeofday(struct timeval *tv)
136 be found. Note when you fix it here you need to do the same 135 be found. Note when you fix it here you need to do the same
137 in arch/x86_64/kernel/vsyscall.c and export all needed 136 in arch/x86_64/kernel/vsyscall.c and export all needed
138 variables in vmlinux.lds. -AK */ 137 variables in vmlinux.lds. -AK */
139 138 usec += do_gettimeoffset();
140 t = (jiffies - wall_jiffies) * USEC_PER_TICK +
141 do_gettimeoffset();
142 usec += t;
143 139
144 } while (read_seqretry(&xtime_lock, seq)); 140 } while (read_seqretry(&xtime_lock, seq));
145 141
@@ -165,8 +161,7 @@ int do_settimeofday(struct timespec *tv)
165 161
166 write_seqlock_irq(&xtime_lock); 162 write_seqlock_irq(&xtime_lock);
167 163
168 nsec -= do_gettimeoffset() * NSEC_PER_USEC + 164 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
169 (jiffies - wall_jiffies) * NSEC_PER_TICK;
170 165
171 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 166 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
172 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 167 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
@@ -1071,7 +1066,6 @@ static int timer_resume(struct sys_device *dev)
1071 vxtime.last_tsc = get_cycles_sync(); 1066 vxtime.last_tsc = get_cycles_sync();
1072 write_sequnlock_irqrestore(&xtime_lock,flags); 1067 write_sequnlock_irqrestore(&xtime_lock,flags);
1073 jiffies += sleep_length; 1068 jiffies += sleep_length;
1074 wall_jiffies += sleep_length;
1075 monotonic_base += sleep_length * (NSEC_PER_SEC/HZ); 1069 monotonic_base += sleep_length * (NSEC_PER_SEC/HZ);
1076 touch_softlockup_watchdog(); 1070 touch_softlockup_watchdog();
1077 return 0; 1071 return 0;
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index d0564f1bcb0b..b9df2ab6529f 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -67,13 +67,6 @@ SECTIONS
67 67
68 _edata = .; /* End of data section */ 68 _edata = .; /* End of data section */
69 69
70 __bss_start = .; /* BSS */
71 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
72 *(.bss.page_aligned)
73 *(.bss)
74 }
75 __bss_stop = .;
76
77 . = ALIGN(PAGE_SIZE); 70 . = ALIGN(PAGE_SIZE);
78 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); 71 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
79 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { 72 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
@@ -108,9 +101,6 @@ SECTIONS
108 .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } 101 .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) }
109 vgetcpu_mode = VVIRT(.vgetcpu_mode); 102 vgetcpu_mode = VVIRT(.vgetcpu_mode);
110 103
111 .wall_jiffies : AT(VLOAD(.wall_jiffies)) { *(.wall_jiffies) }
112 wall_jiffies = VVIRT(.wall_jiffies);
113
114 .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) } 104 .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) }
115 sys_tz = VVIRT(.sys_tz); 105 sys_tz = VVIRT(.sys_tz);
116 106
@@ -229,6 +219,13 @@ SECTIONS
229 . = ALIGN(4096); 219 . = ALIGN(4096);
230 __nosave_end = .; 220 __nosave_end = .;
231 221
222 __bss_start = .; /* BSS */
223 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
224 *(.bss.page_aligned)
225 *(.bss)
226 }
227 __bss_stop = .;
228
232 _end = . ; 229 _end = . ;
233 230
234 /* Sections to be discarded */ 231 /* Sections to be discarded */
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
index ac48c3857ddb..a98b460af6a1 100644
--- a/arch/x86_64/kernel/vsyscall.c
+++ b/arch/x86_64/kernel/vsyscall.c
@@ -66,8 +66,7 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
66 sequence = read_seqbegin(&__xtime_lock); 66 sequence = read_seqbegin(&__xtime_lock);
67 67
68 sec = __xtime.tv_sec; 68 sec = __xtime.tv_sec;
69 usec = (__xtime.tv_nsec / 1000) + 69 usec = __xtime.tv_nsec / 1000;
70 (__jiffies - __wall_jiffies) * (1000000 / HZ);
71 70
72 if (__vxtime.mode != VXTIME_HPET) { 71 if (__vxtime.mode != VXTIME_HPET) {
73 t = get_cycles_sync(); 72 t = get_cycles_sync();
@@ -155,8 +154,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
155 We do this here because otherwise user space would do it on 154 We do this here because otherwise user space would do it on
156 its own in a likely inferior way (no access to jiffies). 155 its own in a likely inferior way (no access to jiffies).
157 If you don't like it pass NULL. */ 156 If you don't like it pass NULL. */
158 if (tcache && tcache->t0 == (j = __jiffies)) { 157 if (tcache && tcache->blob[0] == (j = __jiffies)) {
159 p = tcache->t1; 158 p = tcache->blob[1];
160 } else if (__vgetcpu_mode == VGETCPU_RDTSCP) { 159 } else if (__vgetcpu_mode == VGETCPU_RDTSCP) {
161 /* Load per CPU data from RDTSCP */ 160 /* Load per CPU data from RDTSCP */
162 rdtscp(dummy, dummy, p); 161 rdtscp(dummy, dummy, p);
@@ -165,8 +164,8 @@ vgetcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
165 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 164 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
166 } 165 }
167 if (tcache) { 166 if (tcache) {
168 tcache->t0 = j; 167 tcache->blob[0] = j;
169 tcache->t1 = p; 168 tcache->blob[1] = p;
170 } 169 }
171 if (cpu) 170 if (cpu)
172 *cpu = p & 0xfff; 171 *cpu = p & 0xfff;
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 3e16fe08150e..19c72520a868 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -463,19 +463,6 @@ void online_page(struct page *page)
463 463
464#ifdef CONFIG_MEMORY_HOTPLUG 464#ifdef CONFIG_MEMORY_HOTPLUG
465/* 465/*
466 * XXX: memory_add_physaddr_to_nid() is to find node id from physical address
467 * via probe interface of sysfs. If acpi notifies hot-add event, then it
468 * can tell node id by searching dsdt. But, probe interface doesn't have
469 * node id. So, return 0 as node id at this time.
470 */
471#ifdef CONFIG_NUMA
472int memory_add_physaddr_to_nid(u64 start)
473{
474 return 0;
475}
476#endif
477
478/*
479 * Memory is added always to NORMAL zone. This means you will never get 466 * Memory is added always to NORMAL zone. This means you will never get
480 * additional DMA/DMA32 memory. 467 * additional DMA/DMA32 memory.
481 */ 468 */
@@ -487,12 +474,12 @@ int arch_add_memory(int nid, u64 start, u64 size)
487 unsigned long nr_pages = size >> PAGE_SHIFT; 474 unsigned long nr_pages = size >> PAGE_SHIFT;
488 int ret; 475 int ret;
489 476
477 init_memory_mapping(start, (start + size -1));
478
490 ret = __add_pages(zone, start_pfn, nr_pages); 479 ret = __add_pages(zone, start_pfn, nr_pages);
491 if (ret) 480 if (ret)
492 goto error; 481 goto error;
493 482
494 init_memory_mapping(start, (start + size -1));
495
496 return ret; 483 return ret;
497error: 484error:
498 printk("%s: Problem encountered in __add_pages!\n", __func__); 485 printk("%s: Problem encountered in __add_pages!\n", __func__);
@@ -506,7 +493,24 @@ int remove_memory(u64 start, u64 size)
506} 493}
507EXPORT_SYMBOL_GPL(remove_memory); 494EXPORT_SYMBOL_GPL(remove_memory);
508 495
509#else /* CONFIG_MEMORY_HOTPLUG */ 496#ifndef CONFIG_ACPI_NUMA
497int memory_add_physaddr_to_nid(u64 start)
498{
499 return 0;
500}
501EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
502#endif
503
504#ifndef CONFIG_ACPI_NUMA
505int memory_add_physaddr_to_nid(u64 start)
506{
507 return 0;
508}
509#endif
510
511#endif /* CONFIG_MEMORY_HOTPLUG */
512
513#ifdef CONFIG_MEMORY_HOTPLUG_RESERVE
510/* 514/*
511 * Memory Hotadd without sparsemem. The mem_maps have been allocated in advance, 515 * Memory Hotadd without sparsemem. The mem_maps have been allocated in advance,
512 * just online the pages. 516 * just online the pages.
@@ -532,7 +536,7 @@ int __add_pages(struct zone *z, unsigned long start_pfn, unsigned long nr_pages)
532 } 536 }
533 return err; 537 return err;
534} 538}
535#endif /* CONFIG_MEMORY_HOTPLUG */ 539#endif
536 540
537static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules, 541static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
538 kcore_vsyscall; 542 kcore_vsyscall;
diff --git a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c
index 45d7d823c3b8..c6e5e8d401a4 100644
--- a/arch/x86_64/mm/ioremap.c
+++ b/arch/x86_64/mm/ioremap.c
@@ -12,117 +12,16 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <asm/io.h> 15#include <linux/io.h>
16#include <asm/pgalloc.h> 16#include <asm/pgalloc.h>
17#include <asm/fixmap.h> 17#include <asm/fixmap.h>
18#include <asm/cacheflush.h>
19#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include <asm/cacheflush.h>
20#include <asm/proto.h> 20#include <asm/proto.h>
21 21
22#define ISA_START_ADDRESS 0xa0000 22#define ISA_START_ADDRESS 0xa0000
23#define ISA_END_ADDRESS 0x100000 23#define ISA_END_ADDRESS 0x100000
24 24
25static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
26 unsigned long phys_addr, unsigned long flags)
27{
28 unsigned long end;
29 unsigned long pfn;
30
31 address &= ~PMD_MASK;
32 end = address + size;
33 if (end > PMD_SIZE)
34 end = PMD_SIZE;
35 if (address >= end)
36 BUG();
37 pfn = phys_addr >> PAGE_SHIFT;
38 do {
39 if (!pte_none(*pte)) {
40 printk("remap_area_pte: page already exists\n");
41 BUG();
42 }
43 set_pte(pte, pfn_pte(pfn, __pgprot(_PAGE_PRESENT | _PAGE_RW |
44 _PAGE_GLOBAL | _PAGE_DIRTY | _PAGE_ACCESSED | flags)));
45 address += PAGE_SIZE;
46 pfn++;
47 pte++;
48 } while (address && (address < end));
49}
50
51static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
52 unsigned long phys_addr, unsigned long flags)
53{
54 unsigned long end;
55
56 address &= ~PUD_MASK;
57 end = address + size;
58 if (end > PUD_SIZE)
59 end = PUD_SIZE;
60 phys_addr -= address;
61 if (address >= end)
62 BUG();
63 do {
64 pte_t * pte = pte_alloc_kernel(pmd, address);
65 if (!pte)
66 return -ENOMEM;
67 remap_area_pte(pte, address, end - address, address + phys_addr, flags);
68 address = (address + PMD_SIZE) & PMD_MASK;
69 pmd++;
70 } while (address && (address < end));
71 return 0;
72}
73
74static inline int remap_area_pud(pud_t * pud, unsigned long address, unsigned long size,
75 unsigned long phys_addr, unsigned long flags)
76{
77 unsigned long end;
78
79 address &= ~PGDIR_MASK;
80 end = address + size;
81 if (end > PGDIR_SIZE)
82 end = PGDIR_SIZE;
83 phys_addr -= address;
84 if (address >= end)
85 BUG();
86 do {
87 pmd_t * pmd = pmd_alloc(&init_mm, pud, address);
88 if (!pmd)
89 return -ENOMEM;
90 remap_area_pmd(pmd, address, end - address, address + phys_addr, flags);
91 address = (address + PUD_SIZE) & PUD_MASK;
92 pud++;
93 } while (address && (address < end));
94 return 0;
95}
96
97static int remap_area_pages(unsigned long address, unsigned long phys_addr,
98 unsigned long size, unsigned long flags)
99{
100 int error;
101 pgd_t *pgd;
102 unsigned long end = address + size;
103
104 phys_addr -= address;
105 pgd = pgd_offset_k(address);
106 flush_cache_all();
107 if (address >= end)
108 BUG();
109 do {
110 pud_t *pud;
111 pud = pud_alloc(&init_mm, pgd, address);
112 error = -ENOMEM;
113 if (!pud)
114 break;
115 if (remap_area_pud(pud, address, end - address,
116 phys_addr + address, flags))
117 break;
118 error = 0;
119 address = (address + PGDIR_SIZE) & PGDIR_MASK;
120 pgd++;
121 } while (address && (address < end));
122 flush_tlb_all();
123 return error;
124}
125
126/* 25/*
127 * Fix up the linear direct mapping of the kernel to avoid cache attribute 26 * Fix up the linear direct mapping of the kernel to avoid cache attribute
128 * conflicts. 27 * conflicts.
@@ -165,6 +64,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
165 void * addr; 64 void * addr;
166 struct vm_struct * area; 65 struct vm_struct * area;
167 unsigned long offset, last_addr; 66 unsigned long offset, last_addr;
67 pgprot_t pgprot;
168 68
169 /* Don't allow wraparound or zero size */ 69 /* Don't allow wraparound or zero size */
170 last_addr = phys_addr + size - 1; 70 last_addr = phys_addr + size - 1;
@@ -194,6 +94,8 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
194 } 94 }
195#endif 95#endif
196 96
97 pgprot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_GLOBAL
98 | _PAGE_DIRTY | _PAGE_ACCESSED | flags);
197 /* 99 /*
198 * Mappings have to be page-aligned 100 * Mappings have to be page-aligned
199 */ 101 */
@@ -209,7 +111,8 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
209 return NULL; 111 return NULL;
210 area->phys_addr = phys_addr; 112 area->phys_addr = phys_addr;
211 addr = area->addr; 113 addr = area->addr;
212 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 114 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
115 phys_addr, pgprot)) {
213 remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr)); 116 remove_vm_area((void *)(PAGE_MASK & (unsigned long) addr));
214 return NULL; 117 return NULL;
215 } 118 }
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index f8c04d6935c9..3cc0544e25f5 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -23,22 +23,13 @@
23 23
24int acpi_numa __initdata; 24int acpi_numa __initdata;
25 25
26#if (defined(CONFIG_ACPI_HOTPLUG_MEMORY) || \
27 defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)) \
28 && !defined(CONFIG_MEMORY_HOTPLUG)
29#define RESERVE_HOTADD 1
30#endif
31
32static struct acpi_table_slit *acpi_slit; 26static struct acpi_table_slit *acpi_slit;
33 27
34static nodemask_t nodes_parsed __initdata; 28static nodemask_t nodes_parsed __initdata;
35static struct bootnode nodes[MAX_NUMNODES] __initdata; 29static struct bootnode nodes[MAX_NUMNODES] __initdata;
36static struct bootnode nodes_add[MAX_NUMNODES] __initdata; 30static struct bootnode nodes_add[MAX_NUMNODES];
37static int found_add_area __initdata; 31static int found_add_area __initdata;
38int hotadd_percent __initdata = 0; 32int hotadd_percent __initdata = 0;
39#ifndef RESERVE_HOTADD
40#define hotadd_percent 0 /* Ignore all settings */
41#endif
42 33
43/* Too small nodes confuse the VM badly. Usually they result 34/* Too small nodes confuse the VM badly. Usually they result
44 from BIOS bugs. */ 35 from BIOS bugs. */
@@ -160,7 +151,7 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
160 pxm, pa->apic_id, node); 151 pxm, pa->apic_id, node);
161} 152}
162 153
163#ifdef RESERVE_HOTADD 154#ifdef CONFIG_MEMORY_HOTPLUG_RESERVE
164/* 155/*
165 * Protect against too large hotadd areas that would fill up memory. 156 * Protect against too large hotadd areas that would fill up memory.
166 */ 157 */
@@ -203,15 +194,37 @@ static int hotadd_enough_memory(struct bootnode *nd)
203 return 1; 194 return 1;
204} 195}
205 196
197static int update_end_of_memory(unsigned long end)
198{
199 found_add_area = 1;
200 if ((end >> PAGE_SHIFT) > end_pfn)
201 end_pfn = end >> PAGE_SHIFT;
202 return 1;
203}
204
205static inline int save_add_info(void)
206{
207 return hotadd_percent > 0;
208}
209#else
210int update_end_of_memory(unsigned long end) {return 0;}
211static int hotadd_enough_memory(struct bootnode *nd) {return 1;}
212#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
213static inline int save_add_info(void) {return 1;}
214#else
215static inline int save_add_info(void) {return 0;}
216#endif
217#endif
206/* 218/*
207 * It is fine to add this area to the nodes data it will be used later 219 * Update nodes_add and decide if to include add are in the zone.
220 * Both SPARSE and RESERVE need nodes_add infomation.
208 * This code supports one contigious hot add area per node. 221 * This code supports one contigious hot add area per node.
209 */ 222 */
210static int reserve_hotadd(int node, unsigned long start, unsigned long end) 223static int reserve_hotadd(int node, unsigned long start, unsigned long end)
211{ 224{
212 unsigned long s_pfn = start >> PAGE_SHIFT; 225 unsigned long s_pfn = start >> PAGE_SHIFT;
213 unsigned long e_pfn = end >> PAGE_SHIFT; 226 unsigned long e_pfn = end >> PAGE_SHIFT;
214 int changed = 0; 227 int ret = 0, changed = 0;
215 struct bootnode *nd = &nodes_add[node]; 228 struct bootnode *nd = &nodes_add[node];
216 229
217 /* I had some trouble with strange memory hotadd regions breaking 230 /* I had some trouble with strange memory hotadd regions breaking
@@ -240,7 +253,6 @@ static int reserve_hotadd(int node, unsigned long start, unsigned long end)
240 253
241 /* Looks good */ 254 /* Looks good */
242 255
243 found_add_area = 1;
244 if (nd->start == nd->end) { 256 if (nd->start == nd->end) {
245 nd->start = start; 257 nd->start = start;
246 nd->end = end; 258 nd->end = end;
@@ -258,14 +270,12 @@ static int reserve_hotadd(int node, unsigned long start, unsigned long end)
258 printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n"); 270 printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n");
259 } 271 }
260 272
261 if ((nd->end >> PAGE_SHIFT) > end_pfn) 273 ret = update_end_of_memory(nd->end);
262 end_pfn = nd->end >> PAGE_SHIFT;
263 274
264 if (changed) 275 if (changed)
265 printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n", nd->start, nd->end); 276 printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n", nd->start, nd->end);
266 return 0; 277 return ret;
267} 278}
268#endif
269 279
270/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 280/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
271void __init 281void __init
@@ -284,7 +294,7 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
284 } 294 }
285 if (ma->flags.enabled == 0) 295 if (ma->flags.enabled == 0)
286 return; 296 return;
287 if (ma->flags.hot_pluggable && hotadd_percent == 0) 297 if (ma->flags.hot_pluggable && !save_add_info())
288 return; 298 return;
289 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); 299 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
290 end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); 300 end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
@@ -327,15 +337,13 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
327 push_node_boundaries(node, nd->start >> PAGE_SHIFT, 337 push_node_boundaries(node, nd->start >> PAGE_SHIFT,
328 nd->end >> PAGE_SHIFT); 338 nd->end >> PAGE_SHIFT);
329 339
330#ifdef RESERVE_HOTADD 340 if (ma->flags.hot_pluggable && !reserve_hotadd(node, start, end) < 0) {
331 if (ma->flags.hot_pluggable && reserve_hotadd(node, start, end) < 0) {
332 /* Ignore hotadd region. Undo damage */ 341 /* Ignore hotadd region. Undo damage */
333 printk(KERN_NOTICE "SRAT: Hotplug region ignored\n"); 342 printk(KERN_NOTICE "SRAT: Hotplug region ignored\n");
334 *nd = oldnode; 343 *nd = oldnode;
335 if ((nd->start | nd->end) == 0) 344 if ((nd->start | nd->end) == 0)
336 node_clear(node, nodes_parsed); 345 node_clear(node, nodes_parsed);
337 } 346 }
338#endif
339} 347}
340 348
341/* Sanity check to catch more bad SRATs (they are amazingly common). 349/* Sanity check to catch more bad SRATs (they are amazingly common).
@@ -351,7 +359,6 @@ static int nodes_cover_memory(void)
351 unsigned long e = nodes[i].end >> PAGE_SHIFT; 359 unsigned long e = nodes[i].end >> PAGE_SHIFT;
352 pxmram += e - s; 360 pxmram += e - s;
353 pxmram -= absent_pages_in_range(s, e); 361 pxmram -= absent_pages_in_range(s, e);
354 pxmram -= nodes_add[i].end - nodes_add[i].start;
355 if ((long)pxmram < 0) 362 if ((long)pxmram < 0)
356 pxmram = 0; 363 pxmram = 0;
357 } 364 }
@@ -459,3 +466,16 @@ int __node_distance(int a, int b)
459} 466}
460 467
461EXPORT_SYMBOL(__node_distance); 468EXPORT_SYMBOL(__node_distance);
469
470int memory_add_physaddr_to_nid(u64 start)
471{
472 int i, ret = 0;
473
474 for_each_node(i)
475 if (nodes_add[i].start <= start && nodes_add[i].end > start)
476 ret = i;
477
478 return ret;
479}
480EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
481
diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c
index 4688ba2db84d..d9285d4d5565 100644
--- a/arch/xtensa/kernel/syscalls.c
+++ b/arch/xtensa/kernel/syscalls.c
@@ -128,7 +128,7 @@ out:
128 128
129int sys_uname(struct old_utsname * name) 129int sys_uname(struct old_utsname * name)
130{ 130{
131 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 131 if (name && !copy_to_user(name, utsname(), sizeof (*name)))
132 return 0; 132 return 0;
133 return -EFAULT; 133 return -EFAULT;
134} 134}
@@ -266,3 +266,23 @@ void system_call (struct pt_regs *regs)
266 regs->areg[2] = res; 266 regs->areg[2] = res;
267 do_syscall_trace(); 267 do_syscall_trace();
268} 268}
269
270/*
271 * Do a system call from kernel instead of calling sys_execve so we
272 * end up with proper pt_regs.
273 */
274int kernel_execve(const char *filename, char *const argv[], char *const envp[])
275{
276 long __res;
277 asm volatile (
278 " mov a5, %2 \n"
279 " mov a4, %4 \n"
280 " mov a3, %3 \n"
281 " movi a2, %1 \n"
282 " syscall \n"
283 " mov %0, a2 \n"
284 : "=a" (__res)
285 : "i" (__NR_execve), "a" (filename), "a" (argv), "a" (envp)
286 : "a2", "a3", "a4", "a5");
287 return __res;
288}
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 241db201f40e..37347e369987 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -26,8 +26,6 @@
26#include <asm/platform.h> 26#include <asm/platform.h>
27 27
28 28
29extern volatile unsigned long wall_jiffies;
30
31DEFINE_SPINLOCK(rtc_lock); 29DEFINE_SPINLOCK(rtc_lock);
32EXPORT_SYMBOL(rtc_lock); 30EXPORT_SYMBOL(rtc_lock);
33 31
@@ -110,7 +108,6 @@ int do_settimeofday(struct timespec *tv)
110 */ 108 */
111 ccount = get_ccount(); 109 ccount = get_ccount();
112 nsec -= (ccount - last_ccount_stamp) * CCOUNT_NSEC; 110 nsec -= (ccount - last_ccount_stamp) * CCOUNT_NSEC;
113 nsec -= (jiffies - wall_jiffies) * CCOUNT_PER_JIFFY * CCOUNT_NSEC;
114 111
115 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 112 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
116 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec); 113 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
@@ -129,7 +126,7 @@ EXPORT_SYMBOL(do_settimeofday);
129void do_gettimeofday(struct timeval *tv) 126void do_gettimeofday(struct timeval *tv)
130{ 127{
131 unsigned long flags; 128 unsigned long flags;
132 unsigned long sec, usec, delta, lost, seq; 129 unsigned long sec, usec, delta, seq;
133 130
134 do { 131 do {
135 seq = read_seqbegin_irqsave(&xtime_lock, flags); 132 seq = read_seqbegin_irqsave(&xtime_lock, flags);
@@ -137,12 +134,9 @@ void do_gettimeofday(struct timeval *tv)
137 delta = get_ccount() - last_ccount_stamp; 134 delta = get_ccount() - last_ccount_stamp;
138 sec = xtime.tv_sec; 135 sec = xtime.tv_sec;
139 usec = (xtime.tv_nsec / NSEC_PER_USEC); 136 usec = (xtime.tv_nsec / NSEC_PER_USEC);
140
141 lost = jiffies - wall_jiffies;
142
143 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); 137 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
144 138
145 usec += lost * (1000000UL/HZ) + (delta * CCOUNT_NSEC) / NSEC_PER_USEC; 139 usec += (delta * CCOUNT_NSEC) / NSEC_PER_USEC;
146 for (; usec >= 1000000; sec++, usec -= 1000000) 140 for (; usec >= 1000000; sec++, usec -= 1000000)
147 ; 141 ;
148 142
@@ -179,8 +173,7 @@ again:
179 173
180 if (ntp_synced() && 174 if (ntp_synced() &&
181 xtime.tv_sec - last_rtc_update >= 659 && 175 xtime.tv_sec - last_rtc_update >= 659 &&
182 abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ && 176 abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ) {
183 jiffies - wall_jiffies == 1) {
184 177
185 if (platform_set_rtc_time(xtime.tv_sec+1) == 0) 178 if (platform_set_rtc_time(xtime.tv_sec+1) == 0)
186 last_rtc_update = xtime.tv_sec+1; 179 last_rtc_update = xtime.tv_sec+1;
diff --git a/arch/xtensa/platform-iss/console.c b/arch/xtensa/platform-iss/console.c
index 22d3c571a7bc..5c947cae7520 100644
--- a/arch/xtensa/platform-iss/console.c
+++ b/arch/xtensa/platform-iss/console.c
@@ -191,7 +191,7 @@ static int rs_read_proc(char *page, char **start, off_t off, int count,
191} 191}
192 192
193 193
194static struct tty_operations serial_ops = { 194static const struct tty_operations serial_ops = {
195 .open = rs_open, 195 .open = rs_open,
196 .close = rs_close, 196 .close = rs_close,
197 .write = rs_write, 197 .write = rs_write,