aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 18:58:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 18:58:21 -0400
commit0195c00244dc2e9f522475868fa278c473ba7339 (patch)
treef97ca98ae64ede2c33ad3de05ed7bbfa4f4495ed /arch/mips
parentf21ce8f8447c8be8847dadcfdbcc76b0d7365fa5 (diff)
parent141124c02059eee9dbc5c86ea797b1ca888e77f7 (diff)
Merge tag 'split-asm_system_h-for-linus-20120328' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-asm_system
Pull "Disintegrate and delete asm/system.h" from David Howells: "Here are a bunch of patches to disintegrate asm/system.h into a set of separate bits to relieve the problem of circular inclusion dependencies. I've built all the working defconfigs from all the arches that I can and made sure that they don't break. The reason for these patches is that I recently encountered a circular dependency problem that came about when I produced some patches to optimise get_order() by rewriting it to use ilog2(). This uses bitops - and on the SH arch asm/bitops.h drags in asm-generic/get_order.h by a circuituous route involving asm/system.h. The main difficulty seems to be asm/system.h. It holds a number of low level bits with no/few dependencies that are commonly used (eg. memory barriers) and a number of bits with more dependencies that aren't used in many places (eg. switch_to()). These patches break asm/system.h up into the following core pieces: (1) asm/barrier.h Move memory barriers here. This already done for MIPS and Alpha. (2) asm/switch_to.h Move switch_to() and related stuff here. (3) asm/exec.h Move arch_align_stack() here. Other process execution related bits could perhaps go here from asm/processor.h. (4) asm/cmpxchg.h Move xchg() and cmpxchg() here as they're full word atomic ops and frequently used by atomic_xchg() and atomic_cmpxchg(). (5) asm/bug.h Move die() and related bits. (6) asm/auxvec.h Move AT_VECTOR_SIZE_ARCH here. Other arch headers are created as needed on a per-arch basis." Fixed up some conflicts from other header file cleanups and moving code around that has happened in the meantime, so David's testing is somewhat weakened by that. We'll find out anything that got broken and fix it.. * tag 'split-asm_system_h-for-linus-20120328' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-asm_system: (38 commits) Delete all instances of asm/system.h Remove all #inclusions of asm/system.h Add #includes needed to permit the removal of asm/system.h Move all declarations of free_initmem() to linux/mm.h Disintegrate asm/system.h for OpenRISC Split arch_align_stack() out from asm-generic/system.h Split the switch_to() wrapper out of asm-generic/system.h Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h Create asm-generic/barrier.h Make asm-generic/cmpxchg.h #include asm-generic/cmpxchg-local.h Disintegrate asm/system.h for Xtensa Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt] Disintegrate asm/system.h for Tile Disintegrate asm/system.h for Sparc Disintegrate asm/system.h for SH Disintegrate asm/system.h for Score Disintegrate asm/system.h for S390 Disintegrate asm/system.h for PowerPC Disintegrate asm/system.h for PA-RISC Disintegrate asm/system.h for MN10300 ...
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/cavium-octeon/setup.c1
-rw-r--r--arch/mips/cavium-octeon/smp.c2
-rw-r--r--arch/mips/dec/ecc-berr.c1
-rw-r--r--arch/mips/dec/kn01-berr.c1
-rw-r--r--arch/mips/dec/kn02xa-berr.c1
-rw-r--r--arch/mips/dec/wbflush.c2
-rw-r--r--arch/mips/emma/markeins/irq.c1
-rw-r--r--arch/mips/fw/arc/misc.c1
-rw-r--r--arch/mips/include/asm/atomic.h2
-rw-r--r--arch/mips/include/asm/barrier.h2
-rw-r--r--arch/mips/include/asm/cmpxchg.h124
-rw-r--r--arch/mips/include/asm/dma.h1
-rw-r--r--arch/mips/include/asm/exec.h17
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1000_dma.h1
-rw-r--r--arch/mips/include/asm/processor.h7
-rw-r--r--arch/mips/include/asm/setup.h11
-rw-r--r--arch/mips/include/asm/switch_to.h85
-rw-r--r--arch/mips/include/asm/system.h235
-rw-r--r--arch/mips/include/asm/txx9/jmr3927.h1
-rw-r--r--arch/mips/kernel/cpu-bugs64.c2
-rw-r--r--arch/mips/kernel/cpu-probe.c1
-rw-r--r--arch/mips/kernel/irq-rm7000.c1
-rw-r--r--arch/mips/kernel/irq-rm9000.c1
-rw-r--r--arch/mips/kernel/irq.c1
-rw-r--r--arch/mips/kernel/irq_cpu.c1
-rw-r--r--arch/mips/kernel/mips-mt.c1
-rw-r--r--arch/mips/kernel/process.c1
-rw-r--r--arch/mips/kernel/ptrace.c1
-rw-r--r--arch/mips/kernel/ptrace32.c1
-rw-r--r--arch/mips/kernel/rtlx.c1
-rw-r--r--arch/mips/kernel/setup.c1
-rw-r--r--arch/mips/kernel/signal.c1
-rw-r--r--arch/mips/kernel/signal32.c2
-rw-r--r--arch/mips/kernel/signal_n32.c1
-rw-r--r--arch/mips/kernel/smp-bmips.c1
-rw-r--r--arch/mips/kernel/smp-cmp.c1
-rw-r--r--arch/mips/kernel/smp-mt.c1
-rw-r--r--arch/mips/kernel/smp.c2
-rw-r--r--arch/mips/kernel/smtc-proc.c1
-rw-r--r--arch/mips/kernel/smtc.c1
-rw-r--r--arch/mips/kernel/spram.c1
-rw-r--r--arch/mips/kernel/syscall.c1
-rw-r--r--arch/mips/kernel/traps.c1
-rw-r--r--arch/mips/kernel/unaligned.c1
-rw-r--r--arch/mips/kernel/vpe.c1
-rw-r--r--arch/mips/lasat/reset.c1
-rw-r--r--arch/mips/math-emu/dsemul.c1
-rw-r--r--arch/mips/mipssim/sim_smtc.c1
-rw-r--r--arch/mips/mipssim/sim_time.c1
-rw-r--r--arch/mips/mm/c-octeon.c1
-rw-r--r--arch/mips/mm/c-r3k.c1
-rw-r--r--arch/mips/mm/c-r4k.c1
-rw-r--r--arch/mips/mm/c-tx39.c1
-rw-r--r--arch/mips/mm/fault.c1
-rw-r--r--arch/mips/mm/page.c1
-rw-r--r--arch/mips/mm/sc-ip22.c1
-rw-r--r--arch/mips/mm/sc-mips.c1
-rw-r--r--arch/mips/mm/sc-r5k.c1
-rw-r--r--arch/mips/mm/tlb-r3k.c1
-rw-r--r--arch/mips/mm/tlb-r4k.c1
-rw-r--r--arch/mips/mm/tlb-r8k.c1
-rw-r--r--arch/mips/mm/tlbex.c1
-rw-r--r--arch/mips/mti-malta/malta-init.c1
-rw-r--r--arch/mips/mti-malta/malta-int.c1
-rw-r--r--arch/mips/mti-malta/malta-time.c1
-rw-r--r--arch/mips/netlogic/common/irq.c1
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c1
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_irq_per.c1
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c1
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c1
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c1
-rw-r--r--arch/mips/pnx833x/common/interrupts.c1
-rw-r--r--arch/mips/powertv/asic/asic_int.c1
-rw-r--r--arch/mips/powertv/asic/irq_asic.c1
-rw-r--r--arch/mips/powertv/init.c1
-rw-r--r--arch/mips/rb532/irq.c1
-rw-r--r--arch/mips/sgi-ip22/ip22-berr.c1
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c1
-rw-r--r--arch/mips/sgi-ip22/ip28-berr.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-reset.c1
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c1
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c1
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c1
-rw-r--r--arch/mips/sibyte/common/sb_tbprof.c1
-rw-r--r--arch/mips/sibyte/sb1250/bus_watcher.c1
-rw-r--r--arch/mips/sibyte/sb1250/irq.c1
-rw-r--r--arch/mips/sni/reset.c1
-rw-r--r--arch/mips/vr41xx/common/irq.c1
-rw-r--r--arch/mips/vr41xx/common/pmu.c1
90 files changed, 259 insertions, 311 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 260b27367347..d3a9f012aa0a 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -24,7 +24,6 @@
24#include <asm/processor.h> 24#include <asm/processor.h>
25#include <asm/reboot.h> 25#include <asm/reboot.h>
26#include <asm/smp-ops.h> 26#include <asm/smp-ops.h>
27#include <asm/system.h>
28#include <asm/irq_cpu.h> 27#include <asm/irq_cpu.h>
29#include <asm/mipsregs.h> 28#include <asm/mipsregs.h>
30#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index b1535fe409d4..c3e2b85c3b02 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -15,8 +15,8 @@
15#include <linux/module.h> 15#include <linux/module.h>
16 16
17#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
18#include <asm/system.h>
19#include <asm/time.h> 18#include <asm/time.h>
19#include <asm/setup.h>
20 20
21#include <asm/octeon/octeon.h> 21#include <asm/octeon/octeon.h>
22 22
diff --git a/arch/mips/dec/ecc-berr.c b/arch/mips/dec/ecc-berr.c
index 7abce661b90f..5abf4e894216 100644
--- a/arch/mips/dec/ecc-berr.c
+++ b/arch/mips/dec/ecc-berr.c
@@ -24,7 +24,6 @@
24#include <asm/irq_regs.h> 24#include <asm/irq_regs.h>
25#include <asm/processor.h> 25#include <asm/processor.h>
26#include <asm/ptrace.h> 26#include <asm/ptrace.h>
27#include <asm/system.h>
28#include <asm/traps.h> 27#include <asm/traps.h>
29 28
30#include <asm/dec/ecc.h> 29#include <asm/dec/ecc.h>
diff --git a/arch/mips/dec/kn01-berr.c b/arch/mips/dec/kn01-berr.c
index 94d23b4a7dc3..44d8a87a8a68 100644
--- a/arch/mips/dec/kn01-berr.c
+++ b/arch/mips/dec/kn01-berr.c
@@ -22,7 +22,6 @@
22#include <asm/mipsregs.h> 22#include <asm/mipsregs.h>
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
25#include <asm/system.h>
26#include <asm/traps.h> 25#include <asm/traps.h>
27#include <asm/uaccess.h> 26#include <asm/uaccess.h>
28 27
diff --git a/arch/mips/dec/kn02xa-berr.c b/arch/mips/dec/kn02xa-berr.c
index 07ca5405d48d..ebb73c51d821 100644
--- a/arch/mips/dec/kn02xa-berr.c
+++ b/arch/mips/dec/kn02xa-berr.c
@@ -21,7 +21,6 @@
21#include <asm/addrspace.h> 21#include <asm/addrspace.h>
22#include <asm/irq_regs.h> 22#include <asm/irq_regs.h>
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/system.h>
25#include <asm/traps.h> 24#include <asm/traps.h>
26 25
27#include <asm/dec/kn02ca.h> 26#include <asm/dec/kn02ca.h>
diff --git a/arch/mips/dec/wbflush.c b/arch/mips/dec/wbflush.c
index 925c0525344b..43feddd5e19c 100644
--- a/arch/mips/dec/wbflush.c
+++ b/arch/mips/dec/wbflush.c
@@ -17,8 +17,8 @@
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19#include <asm/bootinfo.h> 19#include <asm/bootinfo.h>
20#include <asm/system.h>
21#include <asm/wbflush.h> 20#include <asm/wbflush.h>
21#include <asm/barrier.h>
22 22
23static void wbflush_kn01(void); 23static void wbflush_kn01(void);
24static void wbflush_kn210(void); 24static void wbflush_kn210(void);
diff --git a/arch/mips/emma/markeins/irq.c b/arch/mips/emma/markeins/irq.c
index 7798887a1288..b5f08255d9c7 100644
--- a/arch/mips/emma/markeins/irq.c
+++ b/arch/mips/emma/markeins/irq.c
@@ -27,7 +27,6 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28 28
29#include <asm/irq_cpu.h> 29#include <asm/irq_cpu.h>
30#include <asm/system.h>
31#include <asm/mipsregs.h> 30#include <asm/mipsregs.h>
32#include <asm/addrspace.h> 31#include <asm/addrspace.h>
33#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
diff --git a/arch/mips/fw/arc/misc.c b/arch/mips/fw/arc/misc.c
index 29627fbae7ad..7cf80ca2c1d2 100644
--- a/arch/mips/fw/arc/misc.c
+++ b/arch/mips/fw/arc/misc.c
@@ -17,7 +17,6 @@
17#include <asm/fw/arc/types.h> 17#include <asm/fw/arc/types.h>
18#include <asm/sgialib.h> 18#include <asm/sgialib.h>
19#include <asm/bootinfo.h> 19#include <asm/bootinfo.h>
20#include <asm/system.h>
21 20
22VOID 21VOID
23ArcHalt(VOID) 22ArcHalt(VOID)
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 1d93f81d57e7..3f4c5cb6433e 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -18,8 +18,8 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/barrier.h> 19#include <asm/barrier.h>
20#include <asm/cpu-features.h> 20#include <asm/cpu-features.h>
21#include <asm/cmpxchg.h>
21#include <asm/war.h> 22#include <asm/war.h>
22#include <asm/system.h>
23 23
24#define ATOMIC_INIT(i) { (i) } 24#define ATOMIC_INIT(i) { (i) }
25 25
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h
index c0884f02d3a6..f7fdc24e972d 100644
--- a/arch/mips/include/asm/barrier.h
+++ b/arch/mips/include/asm/barrier.h
@@ -8,6 +8,8 @@
8#ifndef __ASM_BARRIER_H 8#ifndef __ASM_BARRIER_H
9#define __ASM_BARRIER_H 9#define __ASM_BARRIER_H
10 10
11#include <asm/addrspace.h>
12
11/* 13/*
12 * read_barrier_depends - Flush all pending reads that subsequents reads 14 * read_barrier_depends - Flush all pending reads that subsequents reads
13 * depend on. 15 * depend on.
diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
index d8d1c2805ac7..285a41fa0b18 100644
--- a/arch/mips/include/asm/cmpxchg.h
+++ b/arch/mips/include/asm/cmpxchg.h
@@ -9,6 +9,130 @@
9#define __ASM_CMPXCHG_H 9#define __ASM_CMPXCHG_H
10 10
11#include <linux/irqflags.h> 11#include <linux/irqflags.h>
12#include <asm/war.h>
13
14static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
15{
16 __u32 retval;
17
18 smp_mb__before_llsc();
19
20 if (kernel_uses_llsc && R10000_LLSC_WAR) {
21 unsigned long dummy;
22
23 __asm__ __volatile__(
24 " .set mips3 \n"
25 "1: ll %0, %3 # xchg_u32 \n"
26 " .set mips0 \n"
27 " move %2, %z4 \n"
28 " .set mips3 \n"
29 " sc %2, %1 \n"
30 " beqzl %2, 1b \n"
31 " .set mips0 \n"
32 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
33 : "R" (*m), "Jr" (val)
34 : "memory");
35 } else if (kernel_uses_llsc) {
36 unsigned long dummy;
37
38 do {
39 __asm__ __volatile__(
40 " .set mips3 \n"
41 " ll %0, %3 # xchg_u32 \n"
42 " .set mips0 \n"
43 " move %2, %z4 \n"
44 " .set mips3 \n"
45 " sc %2, %1 \n"
46 " .set mips0 \n"
47 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
48 : "R" (*m), "Jr" (val)
49 : "memory");
50 } while (unlikely(!dummy));
51 } else {
52 unsigned long flags;
53
54 raw_local_irq_save(flags);
55 retval = *m;
56 *m = val;
57 raw_local_irq_restore(flags); /* implies memory barrier */
58 }
59
60 smp_llsc_mb();
61
62 return retval;
63}
64
65#ifdef CONFIG_64BIT
66static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
67{
68 __u64 retval;
69
70 smp_mb__before_llsc();
71
72 if (kernel_uses_llsc && R10000_LLSC_WAR) {
73 unsigned long dummy;
74
75 __asm__ __volatile__(
76 " .set mips3 \n"
77 "1: lld %0, %3 # xchg_u64 \n"
78 " move %2, %z4 \n"
79 " scd %2, %1 \n"
80 " beqzl %2, 1b \n"
81 " .set mips0 \n"
82 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
83 : "R" (*m), "Jr" (val)
84 : "memory");
85 } else if (kernel_uses_llsc) {
86 unsigned long dummy;
87
88 do {
89 __asm__ __volatile__(
90 " .set mips3 \n"
91 " lld %0, %3 # xchg_u64 \n"
92 " move %2, %z4 \n"
93 " scd %2, %1 \n"
94 " .set mips0 \n"
95 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
96 : "R" (*m), "Jr" (val)
97 : "memory");
98 } while (unlikely(!dummy));
99 } else {
100 unsigned long flags;
101
102 raw_local_irq_save(flags);
103 retval = *m;
104 *m = val;
105 raw_local_irq_restore(flags); /* implies memory barrier */
106 }
107
108 smp_llsc_mb();
109
110 return retval;
111}
112#else
113extern __u64 __xchg_u64_unsupported_on_32bit_kernels(volatile __u64 * m, __u64 val);
114#define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels
115#endif
116
117static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
118{
119 switch (size) {
120 case 4:
121 return __xchg_u32(ptr, x);
122 case 8:
123 return __xchg_u64(ptr, x);
124 }
125
126 return x;
127}
128
129#define xchg(ptr, x) \
130({ \
131 BUILD_BUG_ON(sizeof(*(ptr)) & ~0xc); \
132 \
133 ((__typeof__(*(ptr))) \
134 __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))); \
135})
12 136
13#define __HAVE_ARCH_CMPXCHG 1 137#define __HAVE_ARCH_CMPXCHG 1
14 138
diff --git a/arch/mips/include/asm/dma.h b/arch/mips/include/asm/dma.h
index 2d47da62d5a7..f5097f65a8ab 100644
--- a/arch/mips/include/asm/dma.h
+++ b/arch/mips/include/asm/dma.h
@@ -15,7 +15,6 @@
15#include <asm/io.h> /* need byte IO */ 15#include <asm/io.h> /* need byte IO */
16#include <linux/spinlock.h> /* And spinlocks */ 16#include <linux/spinlock.h> /* And spinlocks */
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <asm/system.h>
19 18
20 19
21#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER 20#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
diff --git a/arch/mips/include/asm/exec.h b/arch/mips/include/asm/exec.h
new file mode 100644
index 000000000000..c1f6afa4bc4f
--- /dev/null
+++ b/arch/mips/include/asm/exec.h
@@ -0,0 +1,17 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003, 06 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Kevin D. Kissell, kevink@mips.org and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 */
12#ifndef _ASM_EXEC_H
13#define _ASM_EXEC_H
14
15extern unsigned long arch_align_stack(unsigned long sp);
16
17#endif /* _ASM_EXEC_H */
diff --git a/arch/mips/include/asm/mach-au1x00/au1000_dma.h b/arch/mips/include/asm/mach-au1x00/au1000_dma.h
index 59f5b55b2200..ba4cf0e91c8b 100644
--- a/arch/mips/include/asm/mach-au1x00/au1000_dma.h
+++ b/arch/mips/include/asm/mach-au1x00/au1000_dma.h
@@ -33,7 +33,6 @@
33#include <linux/io.h> /* need byte IO */ 33#include <linux/io.h> /* need byte IO */
34#include <linux/spinlock.h> /* And spinlocks */ 34#include <linux/spinlock.h> /* And spinlocks */
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <asm/system.h>
37 36
38#define NUM_AU1000_DMA_CHANNELS 8 37#define NUM_AU1000_DMA_CHANNELS 8
39 38
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index c104f1039a69..20e9dcf42b27 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -19,7 +19,6 @@
19#include <asm/cpu-info.h> 19#include <asm/cpu-info.h>
20#include <asm/mipsregs.h> 20#include <asm/mipsregs.h>
21#include <asm/prefetch.h> 21#include <asm/prefetch.h>
22#include <asm/system.h>
23 22
24/* 23/*
25 * Return current * instruction pointer ("program counter"). 24 * Return current * instruction pointer ("program counter").
@@ -356,6 +355,12 @@ unsigned long get_wchan(struct task_struct *p);
356#define ARCH_HAS_PREFETCHW 355#define ARCH_HAS_PREFETCHW
357#define prefetchw(x) __builtin_prefetch((x), 1, 1) 356#define prefetchw(x) __builtin_prefetch((x), 1, 1)
358 357
358/*
359 * See Documentation/scheduler/sched-arch.txt; prevents deadlock on SMP
360 * systems.
361 */
362#define __ARCH_WANT_UNLOCKED_CTXSW
363
359#endif 364#endif
360 365
361#endif /* _ASM_PROCESSOR_H */ 366#endif /* _ASM_PROCESSOR_H */
diff --git a/arch/mips/include/asm/setup.h b/arch/mips/include/asm/setup.h
index 50511aac04e9..6dce6d8d09ab 100644
--- a/arch/mips/include/asm/setup.h
+++ b/arch/mips/include/asm/setup.h
@@ -5,6 +5,17 @@
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7extern void setup_early_printk(void); 7extern void setup_early_printk(void);
8
9extern void set_handler(unsigned long offset, void *addr, unsigned long len);
10extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len);
11
12typedef void (*vi_handler_t)(void);
13extern void *set_vi_handler(int n, vi_handler_t addr);
14
15extern void *set_except_vector(int n, void *addr);
16extern unsigned long ebase;
17extern void per_cpu_trap_init(void);
18
8#endif /* __KERNEL__ */ 19#endif /* __KERNEL__ */
9 20
10#endif /* __SETUP_H */ 21#endif /* __SETUP_H */
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
new file mode 100644
index 000000000000..5d33621b5658
--- /dev/null
+++ b/arch/mips/include/asm/switch_to.h
@@ -0,0 +1,85 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003, 06 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Kevin D. Kissell, kevink@mips.org and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 */
12#ifndef _ASM_SWITCH_TO_H
13#define _ASM_SWITCH_TO_H
14
15#include <asm/cpu-features.h>
16#include <asm/watch.h>
17#include <asm/dsp.h>
18
19struct task_struct;
20
21/*
22 * switch_to(n) should switch tasks to task nr n, first
23 * checking that n isn't the current task, in which case it does nothing.
24 */
25extern asmlinkage void *resume(void *last, void *next, void *next_ti);
26
27extern unsigned int ll_bit;
28extern struct task_struct *ll_task;
29
30#ifdef CONFIG_MIPS_MT_FPAFF
31
32/*
33 * Handle the scheduler resume end of FPU affinity management. We do this
34 * inline to try to keep the overhead down. If we have been forced to run on
35 * a "CPU" with an FPU because of a previous high level of FP computation,
36 * but did not actually use the FPU during the most recent time-slice (CU1
37 * isn't set), we undo the restriction on cpus_allowed.
38 *
39 * We're not calling set_cpus_allowed() here, because we have no need to
40 * force prompt migration - we're already switching the current CPU to a
41 * different thread.
42 */
43
44#define __mips_mt_fpaff_switch_to(prev) \
45do { \
46 struct thread_info *__prev_ti = task_thread_info(prev); \
47 \
48 if (cpu_has_fpu && \
49 test_ti_thread_flag(__prev_ti, TIF_FPUBOUND) && \
50 (!(KSTK_STATUS(prev) & ST0_CU1))) { \
51 clear_ti_thread_flag(__prev_ti, TIF_FPUBOUND); \
52 prev->cpus_allowed = prev->thread.user_cpus_allowed; \
53 } \
54 next->thread.emulated_fp = 0; \
55} while(0)
56
57#else
58#define __mips_mt_fpaff_switch_to(prev) do { (void) (prev); } while (0)
59#endif
60
61#define __clear_software_ll_bit() \
62do { \
63 if (!__builtin_constant_p(cpu_has_llsc) || !cpu_has_llsc) \
64 ll_bit = 0; \
65} while (0)
66
67#define switch_to(prev, next, last) \
68do { \
69 __mips_mt_fpaff_switch_to(prev); \
70 if (cpu_has_dsp) \
71 __save_dsp(prev); \
72 __clear_software_ll_bit(); \
73 (last) = resume(prev, next, task_thread_info(next)); \
74} while (0)
75
76#define finish_arch_switch(prev) \
77do { \
78 if (cpu_has_dsp) \
79 __restore_dsp(current); \
80 if (cpu_has_userlocal) \
81 write_c0_userlocal(current_thread_info()->tp_value); \
82 __restore_watch(); \
83} while (0)
84
85#endif /* _ASM_SWITCH_TO_H */
diff --git a/arch/mips/include/asm/system.h b/arch/mips/include/asm/system.h
deleted file mode 100644
index 6018c80ce37a..000000000000
--- a/arch/mips/include/asm/system.h
+++ /dev/null
@@ -1,235 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003, 06 by Ralf Baechle
7 * Copyright (C) 1996 by Paul M. Antoine
8 * Copyright (C) 1999 Silicon Graphics
9 * Kevin D. Kissell, kevink@mips.org and Carsten Langgaard, carstenl@mips.com
10 * Copyright (C) 2000 MIPS Technologies, Inc.
11 */
12#ifndef _ASM_SYSTEM_H
13#define _ASM_SYSTEM_H
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/irqflags.h>
18
19#include <asm/addrspace.h>
20#include <asm/barrier.h>
21#include <asm/cmpxchg.h>
22#include <asm/cpu-features.h>
23#include <asm/dsp.h>
24#include <asm/watch.h>
25#include <asm/war.h>
26
27
28/*
29 * switch_to(n) should switch tasks to task nr n, first
30 * checking that n isn't the current task, in which case it does nothing.
31 */
32extern asmlinkage void *resume(void *last, void *next, void *next_ti);
33
34struct task_struct;
35
36extern unsigned int ll_bit;
37extern struct task_struct *ll_task;
38
39#ifdef CONFIG_MIPS_MT_FPAFF
40
41/*
42 * Handle the scheduler resume end of FPU affinity management. We do this
43 * inline to try to keep the overhead down. If we have been forced to run on
44 * a "CPU" with an FPU because of a previous high level of FP computation,
45 * but did not actually use the FPU during the most recent time-slice (CU1
46 * isn't set), we undo the restriction on cpus_allowed.
47 *
48 * We're not calling set_cpus_allowed() here, because we have no need to
49 * force prompt migration - we're already switching the current CPU to a
50 * different thread.
51 */
52
53#define __mips_mt_fpaff_switch_to(prev) \
54do { \
55 struct thread_info *__prev_ti = task_thread_info(prev); \
56 \
57 if (cpu_has_fpu && \
58 test_ti_thread_flag(__prev_ti, TIF_FPUBOUND) && \
59 (!(KSTK_STATUS(prev) & ST0_CU1))) { \
60 clear_ti_thread_flag(__prev_ti, TIF_FPUBOUND); \
61 prev->cpus_allowed = prev->thread.user_cpus_allowed; \
62 } \
63 next->thread.emulated_fp = 0; \
64} while(0)
65
66#else
67#define __mips_mt_fpaff_switch_to(prev) do { (void) (prev); } while (0)
68#endif
69
70#define __clear_software_ll_bit() \
71do { \
72 if (!__builtin_constant_p(cpu_has_llsc) || !cpu_has_llsc) \
73 ll_bit = 0; \
74} while (0)
75
76#define switch_to(prev, next, last) \
77do { \
78 __mips_mt_fpaff_switch_to(prev); \
79 if (cpu_has_dsp) \
80 __save_dsp(prev); \
81 __clear_software_ll_bit(); \
82 (last) = resume(prev, next, task_thread_info(next)); \
83} while (0)
84
85#define finish_arch_switch(prev) \
86do { \
87 if (cpu_has_dsp) \
88 __restore_dsp(current); \
89 if (cpu_has_userlocal) \
90 write_c0_userlocal(current_thread_info()->tp_value); \
91 __restore_watch(); \
92} while (0)
93
94static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
95{
96 __u32 retval;
97
98 smp_mb__before_llsc();
99
100 if (kernel_uses_llsc && R10000_LLSC_WAR) {
101 unsigned long dummy;
102
103 __asm__ __volatile__(
104 " .set mips3 \n"
105 "1: ll %0, %3 # xchg_u32 \n"
106 " .set mips0 \n"
107 " move %2, %z4 \n"
108 " .set mips3 \n"
109 " sc %2, %1 \n"
110 " beqzl %2, 1b \n"
111 " .set mips0 \n"
112 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
113 : "R" (*m), "Jr" (val)
114 : "memory");
115 } else if (kernel_uses_llsc) {
116 unsigned long dummy;
117
118 do {
119 __asm__ __volatile__(
120 " .set mips3 \n"
121 " ll %0, %3 # xchg_u32 \n"
122 " .set mips0 \n"
123 " move %2, %z4 \n"
124 " .set mips3 \n"
125 " sc %2, %1 \n"
126 " .set mips0 \n"
127 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
128 : "R" (*m), "Jr" (val)
129 : "memory");
130 } while (unlikely(!dummy));
131 } else {
132 unsigned long flags;
133
134 raw_local_irq_save(flags);
135 retval = *m;
136 *m = val;
137 raw_local_irq_restore(flags); /* implies memory barrier */
138 }
139
140 smp_llsc_mb();
141
142 return retval;
143}
144
145#ifdef CONFIG_64BIT
146static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
147{
148 __u64 retval;
149
150 smp_mb__before_llsc();
151
152 if (kernel_uses_llsc && R10000_LLSC_WAR) {
153 unsigned long dummy;
154
155 __asm__ __volatile__(
156 " .set mips3 \n"
157 "1: lld %0, %3 # xchg_u64 \n"
158 " move %2, %z4 \n"
159 " scd %2, %1 \n"
160 " beqzl %2, 1b \n"
161 " .set mips0 \n"
162 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
163 : "R" (*m), "Jr" (val)
164 : "memory");
165 } else if (kernel_uses_llsc) {
166 unsigned long dummy;
167
168 do {
169 __asm__ __volatile__(
170 " .set mips3 \n"
171 " lld %0, %3 # xchg_u64 \n"
172 " move %2, %z4 \n"
173 " scd %2, %1 \n"
174 " .set mips0 \n"
175 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
176 : "R" (*m), "Jr" (val)
177 : "memory");
178 } while (unlikely(!dummy));
179 } else {
180 unsigned long flags;
181
182 raw_local_irq_save(flags);
183 retval = *m;
184 *m = val;
185 raw_local_irq_restore(flags); /* implies memory barrier */
186 }
187
188 smp_llsc_mb();
189
190 return retval;
191}
192#else
193extern __u64 __xchg_u64_unsupported_on_32bit_kernels(volatile __u64 * m, __u64 val);
194#define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels
195#endif
196
197static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
198{
199 switch (size) {
200 case 4:
201 return __xchg_u32(ptr, x);
202 case 8:
203 return __xchg_u64(ptr, x);
204 }
205
206 return x;
207}
208
209#define xchg(ptr, x) \
210({ \
211 BUILD_BUG_ON(sizeof(*(ptr)) & ~0xc); \
212 \
213 ((__typeof__(*(ptr))) \
214 __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))); \
215})
216
217extern void set_handler(unsigned long offset, void *addr, unsigned long len);
218extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len);
219
220typedef void (*vi_handler_t)(void);
221extern void *set_vi_handler(int n, vi_handler_t addr);
222
223extern void *set_except_vector(int n, void *addr);
224extern unsigned long ebase;
225extern void per_cpu_trap_init(void);
226
227/*
228 * See include/asm-ia64/system.h; prevents deadlock on SMP
229 * systems.
230 */
231#define __ARCH_WANT_UNLOCKED_CTXSW
232
233extern unsigned long arch_align_stack(unsigned long sp);
234
235#endif /* _ASM_SYSTEM_H */
diff --git a/arch/mips/include/asm/txx9/jmr3927.h b/arch/mips/include/asm/txx9/jmr3927.h
index a409c446bf18..8808d7f82da0 100644
--- a/arch/mips/include/asm/txx9/jmr3927.h
+++ b/arch/mips/include/asm/txx9/jmr3927.h
@@ -12,7 +12,6 @@
12 12
13#include <asm/txx9/tx3927.h> 13#include <asm/txx9/tx3927.h>
14#include <asm/addrspace.h> 14#include <asm/addrspace.h>
15#include <asm/system.h>
16#include <asm/txx9irq.h> 15#include <asm/txx9irq.h>
17 16
18/* CS */ 17/* CS */
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c
index f305ca14351b..d6a18644365a 100644
--- a/arch/mips/kernel/cpu-bugs64.c
+++ b/arch/mips/kernel/cpu-bugs64.c
@@ -16,7 +16,7 @@
16#include <asm/cpu.h> 16#include <asm/cpu.h>
17#include <asm/fpu.h> 17#include <asm/fpu.h>
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/system.h> 19#include <asm/setup.h>
20 20
21static char bug64hit[] __initdata = 21static char bug64hit[] __initdata =
22 "reliable operation impossible!\n%s"; 22 "reliable operation impossible!\n%s";
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 0bab464b8e33..5099201fb7bc 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -22,7 +22,6 @@
22#include <asm/cpu.h> 22#include <asm/cpu.h>
23#include <asm/fpu.h> 23#include <asm/fpu.h>
24#include <asm/mipsregs.h> 24#include <asm/mipsregs.h>
25#include <asm/system.h>
26#include <asm/watch.h> 25#include <asm/watch.h>
27#include <asm/elf.h> 26#include <asm/elf.h>
28#include <asm/spram.h> 27#include <asm/spram.h>
diff --git a/arch/mips/kernel/irq-rm7000.c b/arch/mips/kernel/irq-rm7000.c
index a8a8977d5887..b0662cf97ea8 100644
--- a/arch/mips/kernel/irq-rm7000.c
+++ b/arch/mips/kernel/irq-rm7000.c
@@ -16,7 +16,6 @@
16 16
17#include <asm/irq_cpu.h> 17#include <asm/irq_cpu.h>
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/system.h>
20 19
21static inline void unmask_rm7k_irq(struct irq_data *d) 20static inline void unmask_rm7k_irq(struct irq_data *d)
22{ 21{
diff --git a/arch/mips/kernel/irq-rm9000.c b/arch/mips/kernel/irq-rm9000.c
index 38874a4b9255..1282b9ae81c4 100644
--- a/arch/mips/kernel/irq-rm9000.c
+++ b/arch/mips/kernel/irq-rm9000.c
@@ -17,7 +17,6 @@
17 17
18#include <asm/irq_cpu.h> 18#include <asm/irq_cpu.h>
19#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
20#include <asm/system.h>
21 20
22static inline void unmask_rm9k_irq(struct irq_data *d) 21static inline void unmask_rm9k_irq(struct irq_data *d)
23{ 22{
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 7f50318061b5..a5aa43d07c8e 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -23,7 +23,6 @@
23#include <linux/ftrace.h> 23#include <linux/ftrace.h>
24 24
25#include <linux/atomic.h> 25#include <linux/atomic.h>
26#include <asm/system.h>
27#include <asm/uaccess.h> 26#include <asm/uaccess.h>
28 27
29#ifdef CONFIG_KGDB 28#ifdef CONFIG_KGDB
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
index 191eb52228c4..972263bcf403 100644
--- a/arch/mips/kernel/irq_cpu.c
+++ b/arch/mips/kernel/irq_cpu.c
@@ -35,7 +35,6 @@
35#include <asm/irq_cpu.h> 35#include <asm/irq_cpu.h>
36#include <asm/mipsregs.h> 36#include <asm/mipsregs.h>
37#include <asm/mipsmtregs.h> 37#include <asm/mipsmtregs.h>
38#include <asm/system.h>
39 38
40static inline void unmask_mips_irq(struct irq_data *d) 39static inline void unmask_mips_irq(struct irq_data *d)
41{ 40{
diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c
index c23d11f6851d..7f3376b1c219 100644
--- a/arch/mips/kernel/mips-mt.c
+++ b/arch/mips/kernel/mips-mt.c
@@ -13,7 +13,6 @@
13#include <asm/cpu.h> 13#include <asm/cpu.h>
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <asm/system.h>
17#include <asm/hardirq.h> 16#include <asm/hardirq.h>
18#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
19#include <asm/mipsmtregs.h> 18#include <asm/mipsmtregs.h>
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 61f1cb45a1d5..e9a5fd7277f4 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -32,7 +32,6 @@
32#include <asm/dsp.h> 32#include <asm/dsp.h>
33#include <asm/fpu.h> 33#include <asm/fpu.h>
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
35#include <asm/system.h>
36#include <asm/mipsregs.h> 35#include <asm/mipsregs.h>
37#include <asm/processor.h> 36#include <asm/processor.h>
38#include <asm/uaccess.h> 37#include <asm/uaccess.h>
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 7786b608d932..7c24c2973c6d 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -34,7 +34,6 @@
34#include <asm/mipsmtregs.h> 34#include <asm/mipsmtregs.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/system.h>
38#include <asm/uaccess.h> 37#include <asm/uaccess.h>
39#include <asm/bootinfo.h> 38#include <asm/bootinfo.h>
40#include <asm/reg.h> 39#include <asm/reg.h>
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 32644b4a0714..a3b017815eff 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -32,7 +32,6 @@
32#include <asm/mipsmtregs.h> 32#include <asm/mipsmtregs.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34#include <asm/page.h> 34#include <asm/page.h>
35#include <asm/system.h>
36#include <asm/uaccess.h> 35#include <asm/uaccess.h>
37#include <asm/bootinfo.h> 36#include <asm/bootinfo.h>
38 37
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index a9d801dec6b0..b8c18dcdd2c4 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -38,7 +38,6 @@
38#include <linux/atomic.h> 38#include <linux/atomic.h>
39#include <asm/cpu.h> 39#include <asm/cpu.h>
40#include <asm/processor.h> 40#include <asm/processor.h>
41#include <asm/system.h>
42#include <asm/vpe.h> 41#include <asm/vpe.h>
43#include <asm/rtlx.h> 42#include <asm/rtlx.h>
44 43
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 058e964e7303..c504b212f8f3 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -31,7 +31,6 @@
31#include <asm/sections.h> 31#include <asm/sections.h>
32#include <asm/setup.h> 32#include <asm/setup.h>
33#include <asm/smp-ops.h> 33#include <asm/smp-ops.h>
34#include <asm/system.h>
35#include <asm/prom.h> 34#include <asm/prom.h>
36 35
37struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly; 36struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index f8524003676a..185ca00c4c84 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -34,6 +34,7 @@
34#include <asm/cpu-features.h> 34#include <asm/cpu-features.h>
35#include <asm/war.h> 35#include <asm/war.h>
36#include <asm/vdso.h> 36#include <asm/vdso.h>
37#include <asm/dsp.h>
37 38
38#include "signal-common.h" 39#include "signal-common.h"
39 40
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index aae986613795..06b5da392e24 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -29,10 +29,10 @@
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30#include <asm/sim.h> 30#include <asm/sim.h>
31#include <asm/ucontext.h> 31#include <asm/ucontext.h>
32#include <asm/system.h>
33#include <asm/fpu.h> 32#include <asm/fpu.h>
34#include <asm/war.h> 33#include <asm/war.h>
35#include <asm/vdso.h> 34#include <asm/vdso.h>
35#include <asm/dsp.h>
36 36
37#include "signal-common.h" 37#include "signal-common.h"
38 38
diff --git a/arch/mips/kernel/signal_n32.c b/arch/mips/kernel/signal_n32.c
index ee24d814d5b9..ae29e894ab8d 100644
--- a/arch/mips/kernel/signal_n32.c
+++ b/arch/mips/kernel/signal_n32.c
@@ -35,7 +35,6 @@
35#include <asm/sim.h> 35#include <asm/sim.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/ucontext.h> 37#include <asm/ucontext.h>
38#include <asm/system.h>
39#include <asm/fpu.h> 38#include <asm/fpu.h>
40#include <asm/cpu-features.h> 39#include <asm/cpu-features.h>
41#include <asm/war.h> 40#include <asm/war.h>
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index d5e950ab8527..ca673569fd24 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -28,7 +28,6 @@
28#include <asm/time.h> 28#include <asm/time.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/processor.h> 30#include <asm/processor.h>
31#include <asm/system.h>
32#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
33#include <asm/pmon.h> 32#include <asm/pmon.h>
34#include <asm/cacheflush.h> 33#include <asm/cacheflush.h>
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c
index fe3095160655..e7e03ecf5495 100644
--- a/arch/mips/kernel/smp-cmp.c
+++ b/arch/mips/kernel/smp-cmp.c
@@ -29,7 +29,6 @@
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30#include <asm/cpu.h> 30#include <asm/cpu.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <asm/system.h>
33#include <asm/hardirq.h> 32#include <asm/hardirq.h>
34#include <asm/mmu_context.h> 33#include <asm/mmu_context.h>
35#include <asm/smp.h> 34#include <asm/smp.h>
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index ce9e286f0a74..ff17868734cf 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -28,7 +28,6 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/cpu.h> 29#include <asm/cpu.h>
30#include <asm/processor.h> 30#include <asm/processor.h>
31#include <asm/system.h>
32#include <asm/hardirq.h> 31#include <asm/hardirq.h>
33#include <asm/mmu_context.h> 32#include <asm/mmu_context.h>
34#include <asm/time.h> 33#include <asm/time.h>
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 32c1e954cd37..9c1cce9de35f 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -38,9 +38,9 @@
38#include <asm/cpu.h> 38#include <asm/cpu.h>
39#include <asm/processor.h> 39#include <asm/processor.h>
40#include <asm/r4k-timer.h> 40#include <asm/r4k-timer.h>
41#include <asm/system.h>
42#include <asm/mmu_context.h> 41#include <asm/mmu_context.h>
43#include <asm/time.h> 42#include <asm/time.h>
43#include <asm/setup.h>
44 44
45#ifdef CONFIG_MIPS_MT_SMTC 45#ifdef CONFIG_MIPS_MT_SMTC
46#include <asm/mipsmtregs.h> 46#include <asm/mipsmtregs.h>
diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c
index 928a5a61e1a6..145771c0ed7a 100644
--- a/arch/mips/kernel/smtc-proc.c
+++ b/arch/mips/kernel/smtc-proc.c
@@ -11,7 +11,6 @@
11#include <asm/cpu.h> 11#include <asm/cpu.h>
12#include <asm/processor.h> 12#include <asm/processor.h>
13#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <asm/system.h>
15#include <asm/hardirq.h> 14#include <asm/hardirq.h>
16#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
17#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 0a42ff3ff6a1..c4f75bbc0bd6 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -31,7 +31,6 @@
31#include <asm/cpu.h> 31#include <asm/cpu.h>
32#include <asm/processor.h> 32#include <asm/processor.h>
33#include <linux/atomic.h> 33#include <linux/atomic.h>
34#include <asm/system.h>
35#include <asm/hardirq.h> 34#include <asm/hardirq.h>
36#include <asm/hazards.h> 35#include <asm/hazards.h>
37#include <asm/irq.h> 36#include <asm/irq.h>
diff --git a/arch/mips/kernel/spram.c b/arch/mips/kernel/spram.c
index 1821d12a6410..6af08d896e20 100644
--- a/arch/mips/kernel/spram.c
+++ b/arch/mips/kernel/spram.c
@@ -15,7 +15,6 @@
15 15
16#include <asm/fpu.h> 16#include <asm/fpu.h>
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/system.h>
19#include <asm/r4kcache.h> 18#include <asm/r4kcache.h>
20#include <asm/hazards.h> 19#include <asm/hazards.h>
21 20
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index d02765708ddb..b08220c82113 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -37,6 +37,7 @@
37#include <asm/shmparam.h> 37#include <asm/shmparam.h>
38#include <asm/sysmips.h> 38#include <asm/sysmips.h>
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#include <asm/switch_to.h>
40 41
41/* 42/*
42 * For historic reasons the pipe(2) syscall on MIPS has an unusual calling 43 * For historic reasons the pipe(2) syscall on MIPS has an unusual calling
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index d79ae5437b58..cfdaaa4cffc0 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -45,7 +45,6 @@
45#include <asm/pgtable.h> 45#include <asm/pgtable.h>
46#include <asm/ptrace.h> 46#include <asm/ptrace.h>
47#include <asm/sections.h> 47#include <asm/sections.h>
48#include <asm/system.h>
49#include <asm/tlbdebug.h> 48#include <asm/tlbdebug.h>
50#include <asm/traps.h> 49#include <asm/traps.h>
51#include <asm/uaccess.h> 50#include <asm/uaccess.h>
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index aedb8941caa5..9c58bdf58f23 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -85,7 +85,6 @@
85#include <asm/cop2.h> 85#include <asm/cop2.h>
86#include <asm/inst.h> 86#include <asm/inst.h>
87#include <asm/uaccess.h> 87#include <asm/uaccess.h>
88#include <asm/system.h>
89 88
90#define STR(x) __STR(x) 89#define STR(x) __STR(x)
91#define __STR(x) #x 90#define __STR(x) #x
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index bfa12a4f97b9..f6f91523cb1c 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -49,7 +49,6 @@
49#include <asm/cpu.h> 49#include <asm/cpu.h>
50#include <asm/mips_mt.h> 50#include <asm/mips_mt.h>
51#include <asm/processor.h> 51#include <asm/processor.h>
52#include <asm/system.h>
53#include <asm/vpe.h> 52#include <asm/vpe.h>
54#include <asm/kspd.h> 53#include <asm/kspd.h>
55 54
diff --git a/arch/mips/lasat/reset.c b/arch/mips/lasat/reset.c
index b1e7a89fb730..e21f0b9a586e 100644
--- a/arch/mips/lasat/reset.c
+++ b/arch/mips/lasat/reset.c
@@ -21,7 +21,6 @@
21#include <linux/pm.h> 21#include <linux/pm.h>
22 22
23#include <asm/reboot.h> 23#include <asm/reboot.h>
24#include <asm/system.h>
25#include <asm/lasat/lasat.h> 24#include <asm/lasat/lasat.h>
26 25
27#include "picvue.h" 26#include "picvue.h"
diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c
index 3c4a8c5ba7f2..384a3b0091ea 100644
--- a/arch/mips/math-emu/dsemul.c
+++ b/arch/mips/math-emu/dsemul.c
@@ -12,7 +12,6 @@
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <asm/branch.h> 13#include <asm/branch.h>
14#include <asm/mipsregs.h> 14#include <asm/mipsregs.h>
15#include <asm/system.h>
16#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
17 16
18#include <asm/fpu_emulator.h> 17#include <asm/fpu_emulator.h>
diff --git a/arch/mips/mipssim/sim_smtc.c b/arch/mips/mipssim/sim_smtc.c
index 915063991f6e..3c104abd8aa5 100644
--- a/arch/mips/mipssim/sim_smtc.c
+++ b/arch/mips/mipssim/sim_smtc.c
@@ -28,7 +28,6 @@
28#include <asm/cpu.h> 28#include <asm/cpu.h>
29#include <asm/processor.h> 29#include <asm/processor.h>
30#include <asm/smtc.h> 30#include <asm/smtc.h>
31#include <asm/system.h>
32#include <asm/mmu_context.h> 31#include <asm/mmu_context.h>
33#include <asm/smtc_ipi.h> 32#include <asm/smtc_ipi.h>
34 33
diff --git a/arch/mips/mipssim/sim_time.c b/arch/mips/mipssim/sim_time.c
index 5492c42f7650..77bad3c04280 100644
--- a/arch/mips/mipssim/sim_time.c
+++ b/arch/mips/mipssim/sim_time.c
@@ -11,6 +11,7 @@
11#include <asm/hardirq.h> 11#include <asm/hardirq.h>
12#include <asm/div64.h> 12#include <asm/div64.h>
13#include <asm/cpu.h> 13#include <asm/cpu.h>
14#include <asm/setup.h>
14#include <asm/time.h> 15#include <asm/time.h>
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/mc146818-time.h> 17#include <asm/mc146818-time.h>
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index cf7895db0739..1f9ca07f53c8 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -21,7 +21,6 @@
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/r4kcache.h> 23#include <asm/r4kcache.h>
24#include <asm/system.h>
25#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
26#include <asm/war.h> 25#include <asm/war.h>
27 26
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index 0765583d0c92..031c4c2cdf2e 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -18,7 +18,6 @@
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
21#include <asm/system.h>
22#include <asm/isadep.h> 21#include <asm/isadep.h>
23#include <asm/io.h> 22#include <asm/io.h>
24#include <asm/bootinfo.h> 23#include <asm/bootinfo.h>
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index c97087d12d07..bda8eb26ece7 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -29,7 +29,6 @@
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/r4kcache.h> 30#include <asm/r4kcache.h>
31#include <asm/sections.h> 31#include <asm/sections.h>
32#include <asm/system.h>
33#include <asm/mmu_context.h> 32#include <asm/mmu_context.h>
34#include <asm/war.h> 33#include <asm/war.h>
35#include <asm/cacheflush.h> /* for run_uncached() */ 34#include <asm/cacheflush.h> /* for run_uncached() */
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index a43c197ccf8c..87d23cada6d6 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -18,7 +18,6 @@
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
21#include <asm/system.h>
22#include <asm/isadep.h> 21#include <asm/isadep.h>
23#include <asm/io.h> 22#include <asm/io.h>
24#include <asm/bootinfo.h> 23#include <asm/bootinfo.h>
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 69ebd586d7ff..c14f6dfed995 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -22,7 +22,6 @@
22 22
23#include <asm/branch.h> 23#include <asm/branch.h>
24#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
25#include <asm/system.h>
26#include <asm/uaccess.h> 25#include <asm/uaccess.h>
27#include <asm/ptrace.h> 26#include <asm/ptrace.h>
28#include <asm/highmem.h> /* For VMALLOC_END */ 27#include <asm/highmem.h> /* For VMALLOC_END */
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 36272f7d3744..cc0b626858b3 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -22,7 +22,6 @@
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/prefetch.h> 24#include <asm/prefetch.h>
25#include <asm/system.h>
26#include <asm/bootinfo.h> 25#include <asm/bootinfo.h>
27#include <asm/mipsregs.h> 26#include <asm/mipsregs.h>
28#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
diff --git a/arch/mips/mm/sc-ip22.c b/arch/mips/mm/sc-ip22.c
index a6bd11fba7bf..1eb708ef75ff 100644
--- a/arch/mips/mm/sc-ip22.c
+++ b/arch/mips/mm/sc-ip22.c
@@ -12,7 +12,6 @@
12#include <asm/bcache.h> 12#include <asm/bcache.h>
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15#include <asm/system.h>
16#include <asm/bootinfo.h> 15#include <asm/bootinfo.h>
17#include <asm/sgi/ip22.h> 16#include <asm/sgi/ip22.h>
18#include <asm/sgi/mc.h> 17#include <asm/sgi/mc.h>
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index 9cca8de00545..93d937b4b1ba 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -11,7 +11,6 @@
11#include <asm/cacheops.h> 11#include <asm/cacheops.h>
12#include <asm/page.h> 12#include <asm/page.h>
13#include <asm/pgtable.h> 13#include <asm/pgtable.h>
14#include <asm/system.h>
15#include <asm/mmu_context.h> 14#include <asm/mmu_context.h>
16#include <asm/r4kcache.h> 15#include <asm/r4kcache.h>
17 16
diff --git a/arch/mips/mm/sc-r5k.c b/arch/mips/mm/sc-r5k.c
index ae1e533a096e..8d90ff25b123 100644
--- a/arch/mips/mm/sc-r5k.c
+++ b/arch/mips/mm/sc-r5k.c
@@ -12,7 +12,6 @@
12#include <asm/cacheops.h> 12#include <asm/cacheops.h>
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15#include <asm/system.h>
16#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
17#include <asm/r4kcache.h> 16#include <asm/r4kcache.h>
18 17
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c
index ed1fa460f84e..a63d1ed0827f 100644
--- a/arch/mips/mm/tlb-r3k.c
+++ b/arch/mips/mm/tlb-r3k.c
@@ -19,7 +19,6 @@
19#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
22#include <asm/system.h>
23#include <asm/tlbmisc.h> 22#include <asm/tlbmisc.h>
24#include <asm/isadep.h> 23#include <asm/isadep.h>
25#include <asm/io.h> 24#include <asm/io.h>
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 2dc625346c40..d2572cb232db 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -18,7 +18,6 @@
18#include <asm/bootinfo.h> 18#include <asm/bootinfo.h>
19#include <asm/mmu_context.h> 19#include <asm/mmu_context.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/system.h>
22#include <asm/tlbmisc.h> 21#include <asm/tlbmisc.h>
23 22
24extern void build_tlb_refill_handler(void); 23extern void build_tlb_refill_handler(void);
diff --git a/arch/mips/mm/tlb-r8k.c b/arch/mips/mm/tlb-r8k.c
index 3d95f76c106b..91c2499f806a 100644
--- a/arch/mips/mm/tlb-r8k.c
+++ b/arch/mips/mm/tlb-r8k.c
@@ -17,7 +17,6 @@
17#include <asm/bootinfo.h> 17#include <asm/bootinfo.h>
18#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20#include <asm/system.h>
21 20
22extern void build_tlb_refill_handler(void); 21extern void build_tlb_refill_handler(void);
23 22
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index e06370f58ef3..0bc485b3cd60 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -32,6 +32,7 @@
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/war.h> 33#include <asm/war.h>
34#include <asm/uasm.h> 34#include <asm/uasm.h>
35#include <asm/setup.h>
35 36
36/* 37/*
37 * TLB load/store/modify handlers. 38 * TLB load/store/modify handlers.
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index 4b988b9a30d5..27a6cdb36e37 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -26,7 +26,6 @@
26#include <asm/bootinfo.h> 26#include <asm/bootinfo.h>
27#include <asm/gt64120.h> 27#include <asm/gt64120.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/system.h>
30#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
31#include <asm/smp-ops.h> 30#include <asm/smp-ops.h>
32#include <asm/traps.h> 31#include <asm/traps.h>
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index a588b5cef8d2..7b13a4caeea4 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -44,6 +44,7 @@
44#include <asm/msc01_ic.h> 44#include <asm/msc01_ic.h>
45#include <asm/gic.h> 45#include <asm/gic.h>
46#include <asm/gcmpregs.h> 46#include <asm/gcmpregs.h>
47#include <asm/setup.h>
47 48
48int gcmp_present = -1; 49int gcmp_present = -1;
49int gic_present; 50int gic_present;
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c
index f8ee945ee411..115f5bc06003 100644
--- a/arch/mips/mti-malta/malta-time.c
+++ b/arch/mips/mti-malta/malta-time.c
@@ -35,6 +35,7 @@
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/div64.h> 36#include <asm/div64.h>
37#include <asm/cpu.h> 37#include <asm/cpu.h>
38#include <asm/setup.h>
38#include <asm/time.h> 39#include <asm/time.h>
39#include <asm/mc146818-time.h> 40#include <asm/mc146818-time.h>
40#include <asm/msc01_ic.h> 41#include <asm/msc01_ic.h>
diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c
index 49a4f6cf71e5..e52bfcbce093 100644
--- a/arch/mips/netlogic/common/irq.c
+++ b/arch/mips/netlogic/common/irq.c
@@ -43,7 +43,6 @@
43 43
44#include <asm/errno.h> 44#include <asm/errno.h>
45#include <asm/signal.h> 45#include <asm/signal.h>
46#include <asm/system.h>
47#include <asm/ptrace.h> 46#include <asm/ptrace.h>
48#include <asm/mipsregs.h> 47#include <asm/mipsregs.h>
49#include <asm/thread_info.h> 48#include <asm/thread_info.h>
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c b/arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c
index c4fa2d775d8b..2e6f7cab24c1 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c
@@ -16,7 +16,6 @@
16#include <linux/irq.h> 16#include <linux/irq.h>
17 17
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/system.h>
20 19
21#include <msp_cic_int.h> 20#include <msp_cic_int.h>
22#include <msp_regs.h> 21#include <msp_regs.h>
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c b/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c
index 98fd0099d964..598b6a66b970 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_irq_per.c
@@ -16,7 +16,6 @@
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17 17
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/system.h>
20 19
21#include <msp_cic_int.h> 20#include <msp_cic_int.h>
22#include <msp_regs.h> 21#include <msp_regs.h>
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c b/arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c
index 5bbcc47da6b9..83a1c5eae3f8 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c
@@ -16,7 +16,6 @@
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17 17
18#include <asm/mipsregs.h> 18#include <asm/mipsregs.h>
19#include <asm/system.h>
20 19
21#include <msp_slp_int.h> 20#include <msp_slp_int.h>
22#include <msp_regs.h> 21#include <msp_regs.h>
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
index 25bbbf428be9..6590812daa56 100644
--- a/arch/mips/pmc-sierra/yosemite/irq.c
+++ b/arch/mips/pmc-sierra/yosemite/irq.c
@@ -44,7 +44,6 @@
44#include <asm/irq.h> 44#include <asm/irq.h>
45#include <asm/irq_cpu.h> 45#include <asm/irq_cpu.h>
46#include <asm/mipsregs.h> 46#include <asm/mipsregs.h>
47#include <asm/system.h>
48#include <asm/titan_dep.h> 47#include <asm/titan_dep.h>
49 48
50/* Hypertransport specific */ 49/* Hypertransport specific */
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
index dcc926e06fce..6a2754c4f106 100644
--- a/arch/mips/pmc-sierra/yosemite/prom.c
+++ b/arch/mips/pmc-sierra/yosemite/prom.c
@@ -20,7 +20,6 @@
20#include <asm/processor.h> 20#include <asm/processor.h>
21#include <asm/reboot.h> 21#include <asm/reboot.h>
22#include <asm/smp-ops.h> 22#include <asm/smp-ops.h>
23#include <asm/system.h>
24#include <asm/bootinfo.h> 23#include <asm/bootinfo.h>
25#include <asm/pmon.h> 24#include <asm/pmon.h>
26 25
diff --git a/arch/mips/pnx833x/common/interrupts.c b/arch/mips/pnx833x/common/interrupts.c
index adc171c8846f..a86d5d5fceb0 100644
--- a/arch/mips/pnx833x/common/interrupts.c
+++ b/arch/mips/pnx833x/common/interrupts.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <asm/mipsregs.h> 26#include <asm/mipsregs.h>
27#include <asm/irq_cpu.h> 27#include <asm/irq_cpu.h>
28#include <asm/setup.h>
28#include <irq.h> 29#include <irq.h>
29#include <irq-mapping.h> 30#include <irq-mapping.h>
30#include <gpio.h> 31#include <gpio.h>
diff --git a/arch/mips/powertv/asic/asic_int.c b/arch/mips/powertv/asic/asic_int.c
index 529c44a52d64..99d82e10000b 100644
--- a/arch/mips/powertv/asic/asic_int.c
+++ b/arch/mips/powertv/asic/asic_int.c
@@ -34,6 +34,7 @@
34#include <asm/irq_cpu.h> 34#include <asm/irq_cpu.h>
35#include <linux/io.h> 35#include <linux/io.h>
36#include <asm/irq_regs.h> 36#include <asm/irq_regs.h>
37#include <asm/setup.h>
37#include <asm/mips-boards/generic.h> 38#include <asm/mips-boards/generic.h>
38 39
39#include <asm/mach-powertv/asic_regs.h> 40#include <asm/mach-powertv/asic_regs.h>
diff --git a/arch/mips/powertv/asic/irq_asic.c b/arch/mips/powertv/asic/irq_asic.c
index 7fb97fb0931e..fa9ae9584710 100644
--- a/arch/mips/powertv/asic/irq_asic.c
+++ b/arch/mips/powertv/asic/irq_asic.c
@@ -17,7 +17,6 @@
17 17
18#include <asm/irq_cpu.h> 18#include <asm/irq_cpu.h>
19#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
20#include <asm/system.h>
21 20
22#include <asm/mach-powertv/asic_regs.h> 21#include <asm/mach-powertv/asic_regs.h>
23 22
diff --git a/arch/mips/powertv/init.c b/arch/mips/powertv/init.c
index 83552288e802..1cf5abbef715 100644
--- a/arch/mips/powertv/init.c
+++ b/arch/mips/powertv/init.c
@@ -26,7 +26,6 @@
26 26
27#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <asm/system.h>
30#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
31#include <asm/traps.h> 30#include <asm/traps.h>
32 31
diff --git a/arch/mips/rb532/irq.c b/arch/mips/rb532/irq.c
index 7c6db74e3fad..f298430cff07 100644
--- a/arch/mips/rb532/irq.c
+++ b/arch/mips/rb532/irq.c
@@ -42,7 +42,6 @@
42#include <asm/bootinfo.h> 42#include <asm/bootinfo.h>
43#include <asm/time.h> 43#include <asm/time.h>
44#include <asm/mipsregs.h> 44#include <asm/mipsregs.h>
45#include <asm/system.h>
46 45
47#include <asm/mach-rc32434/irq.h> 46#include <asm/mach-rc32434/irq.h>
48#include <asm/mach-rc32434/gpio.h> 47#include <asm/mach-rc32434/gpio.h>
diff --git a/arch/mips/sgi-ip22/ip22-berr.c b/arch/mips/sgi-ip22/ip22-berr.c
index 911d3999c0c7..3f6ccd53c15d 100644
--- a/arch/mips/sgi-ip22/ip22-berr.c
+++ b/arch/mips/sgi-ip22/ip22-berr.c
@@ -9,7 +9,6 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10 10
11#include <asm/addrspace.h> 11#include <asm/addrspace.h>
12#include <asm/system.h>
13#include <asm/traps.h> 12#include <asm/traps.h>
14#include <asm/branch.h> 13#include <asm/branch.h>
15#include <asm/irq_regs.h> 14#include <asm/irq_regs.h>
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 45b6694c2079..20363d29cb58 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -18,7 +18,6 @@
18 18
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/system.h>
22#include <asm/reboot.h> 21#include <asm/reboot.h>
23#include <asm/sgialib.h> 22#include <asm/sgialib.h>
24#include <asm/sgi/ioc.h> 23#include <asm/sgi/ioc.h>
diff --git a/arch/mips/sgi-ip22/ip28-berr.c b/arch/mips/sgi-ip22/ip28-berr.c
index 88c684e05a3d..0626555fd1a3 100644
--- a/arch/mips/sgi-ip22/ip28-berr.c
+++ b/arch/mips/sgi-ip22/ip28-berr.c
@@ -11,7 +11,6 @@
11#include <linux/seq_file.h> 11#include <linux/seq_file.h>
12 12
13#include <asm/addrspace.h> 13#include <asm/addrspace.h>
14#include <asm/system.h>
15#include <asm/traps.h> 14#include <asm/traps.h>
16#include <asm/branch.h> 15#include <asm/branch.h>
17#include <asm/irq_regs.h> 16#include <asm/irq_regs.h>
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 23642238c689..69a939ae65e4 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -27,7 +27,6 @@
27#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/mipsregs.h> 29#include <asm/mipsregs.h>
30#include <asm/system.h>
31 30
32#include <asm/processor.h> 31#include <asm/processor.h>
33#include <asm/pci/bridge.h> 32#include <asm/pci/bridge.h>
diff --git a/arch/mips/sgi-ip27/ip27-reset.c b/arch/mips/sgi-ip27/ip27-reset.c
index c17076108d47..f347bc6b7954 100644
--- a/arch/mips/sgi-ip27/ip27-reset.c
+++ b/arch/mips/sgi-ip27/ip27-reset.c
@@ -19,7 +19,6 @@
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/reboot.h> 21#include <asm/reboot.h>
22#include <asm/system.h>
23#include <asm/sgialib.h> 22#include <asm/sgialib.h>
24#include <asm/sn/addrs.h> 23#include <asm/sn/addrs.h>
25#include <asm/sn/arch.h> 24#include <asm/sn/arch.h>
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index a092860d5196..e7d5054de8c8 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -22,7 +22,6 @@
22#include <asm/irq_cpu.h> 22#include <asm/irq_cpu.h>
23#include <asm/mipsregs.h> 23#include <asm/mipsregs.h>
24#include <asm/signal.h> 24#include <asm/signal.h>
25#include <asm/system.h>
26#include <asm/time.h> 25#include <asm/time.h>
27#include <asm/ip32/crime.h> 26#include <asm/ip32/crime.h>
28#include <asm/ip32/mace.h> 27#include <asm/ip32/mace.h>
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 9b95d80ebc6e..1f823da4c77b 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -20,7 +20,6 @@
20#include <asm/addrspace.h> 20#include <asm/addrspace.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/reboot.h> 22#include <asm/reboot.h>
23#include <asm/system.h>
24#include <asm/wbflush.h> 23#include <asm/wbflush.h>
25#include <asm/ip32/mace.h> 24#include <asm/ip32/mace.h>
26#include <asm/ip32/crime.h> 25#include <asm/ip32/crime.h>
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 09740d60e187..215713e1f3c4 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -27,7 +27,6 @@
27#include <asm/errno.h> 27#include <asm/errno.h>
28#include <asm/irq_regs.h> 28#include <asm/irq_regs.h>
29#include <asm/signal.h> 29#include <asm/signal.h>
30#include <asm/system.h>
31#include <asm/io.h> 30#include <asm/io.h>
32 31
33#include <asm/sibyte/bcm1480_regs.h> 32#include <asm/sibyte/bcm1480_regs.h>
diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c
index 48853ab5bcf0..e8c4538c5f61 100644
--- a/arch/mips/sibyte/common/sb_tbprof.c
+++ b/arch/mips/sibyte/common/sb_tbprof.c
@@ -53,7 +53,6 @@
53#define K_INT_PERF_CNT K_BCM1480_INT_PERF_CNT 53#define K_INT_PERF_CNT K_BCM1480_INT_PERF_CNT
54#endif 54#endif
55 55
56#include <asm/system.h>
57#include <asm/uaccess.h> 56#include <asm/uaccess.h>
58 57
59#define SBPROF_TB_MAJOR 240 58#define SBPROF_TB_MAJOR 240
diff --git a/arch/mips/sibyte/sb1250/bus_watcher.c b/arch/mips/sibyte/sb1250/bus_watcher.c
index 45274bd3cd8b..86e6e54dd15d 100644
--- a/arch/mips/sibyte/sb1250/bus_watcher.c
+++ b/arch/mips/sibyte/sb1250/bus_watcher.c
@@ -30,7 +30,6 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <asm/system.h>
34#include <asm/io.h> 33#include <asm/io.h>
35 34
36#include <asm/sibyte/sb1250.h> 35#include <asm/sibyte/sb1250.h>
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 76ee045e2ce4..340aaf626659 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -26,7 +26,6 @@
26 26
27#include <asm/errno.h> 27#include <asm/errno.h>
28#include <asm/signal.h> 28#include <asm/signal.h>
29#include <asm/system.h>
30#include <asm/time.h> 29#include <asm/time.h>
31#include <asm/io.h> 30#include <asm/io.h>
32 31
diff --git a/arch/mips/sni/reset.c b/arch/mips/sni/reset.c
index 79f8d70f48c9..244f9427625b 100644
--- a/arch/mips/sni/reset.c
+++ b/arch/mips/sni/reset.c
@@ -5,7 +5,6 @@
5 */ 5 */
6#include <asm/io.h> 6#include <asm/io.h>
7#include <asm/reboot.h> 7#include <asm/reboot.h>
8#include <asm/system.h>
9#include <asm/sni.h> 8#include <asm/sni.h>
10 9
11/* 10/*
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index fad2bef432cd..ae0e4ee6c617 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -22,7 +22,6 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23 23
24#include <asm/irq_cpu.h> 24#include <asm/irq_cpu.h>
25#include <asm/system.h>
26#include <asm/vr41xx/irq.h> 25#include <asm/vr41xx/irq.h>
27 26
28typedef struct irq_cascade { 27typedef struct irq_cascade {
diff --git a/arch/mips/vr41xx/common/pmu.c b/arch/mips/vr41xx/common/pmu.c
index 692b4e85b7fc..9fbf5f0d1faf 100644
--- a/arch/mips/vr41xx/common/pmu.c
+++ b/arch/mips/vr41xx/common/pmu.c
@@ -30,7 +30,6 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <asm/reboot.h> 32#include <asm/reboot.h>
33#include <asm/system.h>
34 33
35#define PMU_TYPE1_BASE 0x0b0000a0UL 34#define PMU_TYPE1_BASE 0x0b0000a0UL
36#define PMU_TYPE1_SIZE 0x0eUL 35#define PMU_TYPE1_SIZE 0x0eUL