aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/Makefile1
-rw-r--r--arch/mips/kernel/asm-offsets.c4
-rw-r--r--arch/mips/kernel/cevt-gt641xx.c10
-rw-r--r--arch/mips/kernel/cpu-probe.c30
-rw-r--r--arch/mips/kernel/ftrace.c2
-rw-r--r--arch/mips/kernel/i8259.c22
-rw-r--r--arch/mips/kernel/irq-gt641xx.c18
-rw-r--r--arch/mips/kernel/linux32.c1
-rw-r--r--arch/mips/kernel/mcount.S2
-rw-r--r--arch/mips/kernel/octeon_switch.S1
-rw-r--r--arch/mips/kernel/rtlx.c1
-rw-r--r--arch/mips/kernel/spinlock_test.c141
-rw-r--r--arch/mips/kernel/traps.c23
-rw-r--r--arch/mips/kernel/vpe.c1
14 files changed, 212 insertions, 45 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 9326af5186fe..ef20957ca14b 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -93,6 +93,7 @@ obj-$(CONFIG_GPIO_TXX9) += gpio_txx9.o
93 93
94obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 94obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
95obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 95obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
96obj-$(CONFIG_SPINLOCK_TEST) += spinlock_test.o
96 97
97CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 98CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
98 99
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 2c1e1d02338b..ca6c83218caa 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -188,11 +188,15 @@ void output_mm_defines(void)
188 DEFINE(_PTE_T_SIZE, sizeof(pte_t)); 188 DEFINE(_PTE_T_SIZE, sizeof(pte_t));
189 BLANK(); 189 BLANK();
190 DEFINE(_PGD_T_LOG2, PGD_T_LOG2); 190 DEFINE(_PGD_T_LOG2, PGD_T_LOG2);
191#ifndef __PAGETABLE_PMD_FOLDED
191 DEFINE(_PMD_T_LOG2, PMD_T_LOG2); 192 DEFINE(_PMD_T_LOG2, PMD_T_LOG2);
193#endif
192 DEFINE(_PTE_T_LOG2, PTE_T_LOG2); 194 DEFINE(_PTE_T_LOG2, PTE_T_LOG2);
193 BLANK(); 195 BLANK();
194 DEFINE(_PGD_ORDER, PGD_ORDER); 196 DEFINE(_PGD_ORDER, PGD_ORDER);
197#ifndef __PAGETABLE_PMD_FOLDED
195 DEFINE(_PMD_ORDER, PMD_ORDER); 198 DEFINE(_PMD_ORDER, PMD_ORDER);
199#endif
196 DEFINE(_PTE_ORDER, PTE_ORDER); 200 DEFINE(_PTE_ORDER, PTE_ORDER);
197 BLANK(); 201 BLANK();
198 DEFINE(_PMD_SHIFT, PMD_SHIFT); 202 DEFINE(_PMD_SHIFT, PMD_SHIFT);
diff --git a/arch/mips/kernel/cevt-gt641xx.c b/arch/mips/kernel/cevt-gt641xx.c
index f5d265eb6eae..392ef3756c56 100644
--- a/arch/mips/kernel/cevt-gt641xx.c
+++ b/arch/mips/kernel/cevt-gt641xx.c
@@ -25,7 +25,7 @@
25#include <asm/gt64120.h> 25#include <asm/gt64120.h>
26#include <asm/time.h> 26#include <asm/time.h>
27 27
28static DEFINE_SPINLOCK(gt641xx_timer_lock); 28static DEFINE_RAW_SPINLOCK(gt641xx_timer_lock);
29static unsigned int gt641xx_base_clock; 29static unsigned int gt641xx_base_clock;
30 30
31void gt641xx_set_base_clock(unsigned int clock) 31void gt641xx_set_base_clock(unsigned int clock)
@@ -49,7 +49,7 @@ static int gt641xx_timer0_set_next_event(unsigned long delta,
49{ 49{
50 u32 ctrl; 50 u32 ctrl;
51 51
52 spin_lock(&gt641xx_timer_lock); 52 raw_spin_lock(&gt641xx_timer_lock);
53 53
54 ctrl = GT_READ(GT_TC_CONTROL_OFS); 54 ctrl = GT_READ(GT_TC_CONTROL_OFS);
55 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK); 55 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -58,7 +58,7 @@ static int gt641xx_timer0_set_next_event(unsigned long delta,
58 GT_WRITE(GT_TC0_OFS, delta); 58 GT_WRITE(GT_TC0_OFS, delta);
59 GT_WRITE(GT_TC_CONTROL_OFS, ctrl); 59 GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
60 60
61 spin_unlock(&gt641xx_timer_lock); 61 raw_spin_unlock(&gt641xx_timer_lock);
62 62
63 return 0; 63 return 0;
64} 64}
@@ -68,7 +68,7 @@ static void gt641xx_timer0_set_mode(enum clock_event_mode mode,
68{ 68{
69 u32 ctrl; 69 u32 ctrl;
70 70
71 spin_lock(&gt641xx_timer_lock); 71 raw_spin_lock(&gt641xx_timer_lock);
72 72
73 ctrl = GT_READ(GT_TC_CONTROL_OFS); 73 ctrl = GT_READ(GT_TC_CONTROL_OFS);
74 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK); 74 ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -86,7 +86,7 @@ static void gt641xx_timer0_set_mode(enum clock_event_mode mode,
86 86
87 GT_WRITE(GT_TC_CONTROL_OFS, ctrl); 87 GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
88 88
89 spin_unlock(&gt641xx_timer_lock); 89 raw_spin_unlock(&gt641xx_timer_lock);
90} 90}
91 91
92static void gt641xx_timer0_event_handler(struct clock_event_device *dev) 92static void gt641xx_timer0_event_handler(struct clock_event_device *dev)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 758ad426c57f..be5bb16be4e0 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -162,6 +162,7 @@ void __init check_wait(void)
162 case CPU_BCM6348: 162 case CPU_BCM6348:
163 case CPU_BCM6358: 163 case CPU_BCM6358:
164 case CPU_CAVIUM_OCTEON: 164 case CPU_CAVIUM_OCTEON:
165 case CPU_CAVIUM_OCTEON_PLUS:
165 cpu_wait = r4k_wait; 166 cpu_wait = r4k_wait;
166 break; 167 break;
167 168
@@ -700,6 +701,19 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
700 return config3 & MIPS_CONF_M; 701 return config3 & MIPS_CONF_M;
701} 702}
702 703
704static inline unsigned int decode_config4(struct cpuinfo_mips *c)
705{
706 unsigned int config4;
707
708 config4 = read_c0_config4();
709
710 if ((config4 & MIPS_CONF4_MMUEXTDEF) == MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT
711 && cpu_has_tlb)
712 c->tlbsize += (config4 & MIPS_CONF4_MMUSIZEEXT) * 0x40;
713
714 return config4 & MIPS_CONF_M;
715}
716
703static void __cpuinit decode_configs(struct cpuinfo_mips *c) 717static void __cpuinit decode_configs(struct cpuinfo_mips *c)
704{ 718{
705 int ok; 719 int ok;
@@ -718,6 +732,8 @@ static void __cpuinit decode_configs(struct cpuinfo_mips *c)
718 ok = decode_config2(c); 732 ok = decode_config2(c);
719 if (ok) 733 if (ok)
720 ok = decode_config3(c); 734 ok = decode_config3(c);
735 if (ok)
736 ok = decode_config4(c);
721 737
722 mips_probe_watch_registers(c); 738 mips_probe_watch_registers(c);
723} 739}
@@ -731,9 +747,6 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
731 __cpu_name[cpu] = "MIPS 4Kc"; 747 __cpu_name[cpu] = "MIPS 4Kc";
732 break; 748 break;
733 case PRID_IMP_4KEC: 749 case PRID_IMP_4KEC:
734 c->cputype = CPU_4KEC;
735 __cpu_name[cpu] = "MIPS 4KEc";
736 break;
737 case PRID_IMP_4KECR2: 750 case PRID_IMP_4KECR2:
738 c->cputype = CPU_4KEC; 751 c->cputype = CPU_4KEC;
739 __cpu_name[cpu] = "MIPS 4KEc"; 752 __cpu_name[cpu] = "MIPS 4KEc";
@@ -899,12 +912,18 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
899 case PRID_IMP_CAVIUM_CN38XX: 912 case PRID_IMP_CAVIUM_CN38XX:
900 case PRID_IMP_CAVIUM_CN31XX: 913 case PRID_IMP_CAVIUM_CN31XX:
901 case PRID_IMP_CAVIUM_CN30XX: 914 case PRID_IMP_CAVIUM_CN30XX:
915 c->cputype = CPU_CAVIUM_OCTEON;
916 __cpu_name[cpu] = "Cavium Octeon";
917 goto platform;
902 case PRID_IMP_CAVIUM_CN58XX: 918 case PRID_IMP_CAVIUM_CN58XX:
903 case PRID_IMP_CAVIUM_CN56XX: 919 case PRID_IMP_CAVIUM_CN56XX:
904 case PRID_IMP_CAVIUM_CN50XX: 920 case PRID_IMP_CAVIUM_CN50XX:
905 case PRID_IMP_CAVIUM_CN52XX: 921 case PRID_IMP_CAVIUM_CN52XX:
906 c->cputype = CPU_CAVIUM_OCTEON; 922 c->cputype = CPU_CAVIUM_OCTEON_PLUS;
907 __cpu_name[cpu] = "Cavium Octeon"; 923 __cpu_name[cpu] = "Cavium Octeon+";
924platform:
925 if (cpu == 0)
926 __elf_platform = "octeon";
908 break; 927 break;
909 default: 928 default:
910 printk(KERN_INFO "Unknown Octeon chip!\n"); 929 printk(KERN_INFO "Unknown Octeon chip!\n");
@@ -914,6 +933,7 @@ static inline void cpu_probe_cavium(struct cpuinfo_mips *c, unsigned int cpu)
914} 933}
915 934
916const char *__cpu_name[NR_CPUS]; 935const char *__cpu_name[NR_CPUS];
936const char *__elf_platform;
917 937
918__cpuinit void cpu_probe(void) 938__cpuinit void cpu_probe(void)
919{ 939{
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 68b067040d8b..e9e64e0ff7aa 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com> 4 * Copyright (C) 2007-2008 Steven Rostedt <srostedt@redhat.com>
5 * Copyright (C) 2009 DSLab, Lanzhou University, China 5 * Copyright (C) 2009 DSLab, Lanzhou University, China
6 * Author: Wu Zhangjin <wuzj@lemote.com> 6 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
7 * 7 *
8 * Thanks goes to Steven Rostedt for writing the original x86 version. 8 * Thanks goes to Steven Rostedt for writing the original x86 version.
9 */ 9 */
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index 01c0885a8061..27799113332c 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -29,7 +29,7 @@
29 */ 29 */
30 30
31static int i8259A_auto_eoi = -1; 31static int i8259A_auto_eoi = -1;
32DEFINE_SPINLOCK(i8259A_lock); 32DEFINE_RAW_SPINLOCK(i8259A_lock);
33static void disable_8259A_irq(unsigned int irq); 33static void disable_8259A_irq(unsigned int irq);
34static void enable_8259A_irq(unsigned int irq); 34static void enable_8259A_irq(unsigned int irq);
35static void mask_and_ack_8259A(unsigned int irq); 35static void mask_and_ack_8259A(unsigned int irq);
@@ -65,13 +65,13 @@ static void disable_8259A_irq(unsigned int irq)
65 65
66 irq -= I8259A_IRQ_BASE; 66 irq -= I8259A_IRQ_BASE;
67 mask = 1 << irq; 67 mask = 1 << irq;
68 spin_lock_irqsave(&i8259A_lock, flags); 68 raw_spin_lock_irqsave(&i8259A_lock, flags);
69 cached_irq_mask |= mask; 69 cached_irq_mask |= mask;
70 if (irq & 8) 70 if (irq & 8)
71 outb(cached_slave_mask, PIC_SLAVE_IMR); 71 outb(cached_slave_mask, PIC_SLAVE_IMR);
72 else 72 else
73 outb(cached_master_mask, PIC_MASTER_IMR); 73 outb(cached_master_mask, PIC_MASTER_IMR);
74 spin_unlock_irqrestore(&i8259A_lock, flags); 74 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
75} 75}
76 76
77static void enable_8259A_irq(unsigned int irq) 77static void enable_8259A_irq(unsigned int irq)
@@ -81,13 +81,13 @@ static void enable_8259A_irq(unsigned int irq)
81 81
82 irq -= I8259A_IRQ_BASE; 82 irq -= I8259A_IRQ_BASE;
83 mask = ~(1 << irq); 83 mask = ~(1 << irq);
84 spin_lock_irqsave(&i8259A_lock, flags); 84 raw_spin_lock_irqsave(&i8259A_lock, flags);
85 cached_irq_mask &= mask; 85 cached_irq_mask &= mask;
86 if (irq & 8) 86 if (irq & 8)
87 outb(cached_slave_mask, PIC_SLAVE_IMR); 87 outb(cached_slave_mask, PIC_SLAVE_IMR);
88 else 88 else
89 outb(cached_master_mask, PIC_MASTER_IMR); 89 outb(cached_master_mask, PIC_MASTER_IMR);
90 spin_unlock_irqrestore(&i8259A_lock, flags); 90 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
91} 91}
92 92
93int i8259A_irq_pending(unsigned int irq) 93int i8259A_irq_pending(unsigned int irq)
@@ -98,12 +98,12 @@ int i8259A_irq_pending(unsigned int irq)
98 98
99 irq -= I8259A_IRQ_BASE; 99 irq -= I8259A_IRQ_BASE;
100 mask = 1 << irq; 100 mask = 1 << irq;
101 spin_lock_irqsave(&i8259A_lock, flags); 101 raw_spin_lock_irqsave(&i8259A_lock, flags);
102 if (irq < 8) 102 if (irq < 8)
103 ret = inb(PIC_MASTER_CMD) & mask; 103 ret = inb(PIC_MASTER_CMD) & mask;
104 else 104 else
105 ret = inb(PIC_SLAVE_CMD) & (mask >> 8); 105 ret = inb(PIC_SLAVE_CMD) & (mask >> 8);
106 spin_unlock_irqrestore(&i8259A_lock, flags); 106 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
107 107
108 return ret; 108 return ret;
109} 109}
@@ -151,7 +151,7 @@ static void mask_and_ack_8259A(unsigned int irq)
151 151
152 irq -= I8259A_IRQ_BASE; 152 irq -= I8259A_IRQ_BASE;
153 irqmask = 1 << irq; 153 irqmask = 1 << irq;
154 spin_lock_irqsave(&i8259A_lock, flags); 154 raw_spin_lock_irqsave(&i8259A_lock, flags);
155 /* 155 /*
156 * Lightweight spurious IRQ detection. We do not want 156 * Lightweight spurious IRQ detection. We do not want
157 * to overdo spurious IRQ handling - it's usually a sign 157 * to overdo spurious IRQ handling - it's usually a sign
@@ -183,7 +183,7 @@ handle_real_irq:
183 outb(0x60+irq, PIC_MASTER_CMD); /* 'Specific EOI to master */ 183 outb(0x60+irq, PIC_MASTER_CMD); /* 'Specific EOI to master */
184 } 184 }
185 smtc_im_ack_irq(irq); 185 smtc_im_ack_irq(irq);
186 spin_unlock_irqrestore(&i8259A_lock, flags); 186 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
187 return; 187 return;
188 188
189spurious_8259A_irq: 189spurious_8259A_irq:
@@ -264,7 +264,7 @@ static void init_8259A(int auto_eoi)
264 264
265 i8259A_auto_eoi = auto_eoi; 265 i8259A_auto_eoi = auto_eoi;
266 266
267 spin_lock_irqsave(&i8259A_lock, flags); 267 raw_spin_lock_irqsave(&i8259A_lock, flags);
268 268
269 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ 269 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
270 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */ 270 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
@@ -298,7 +298,7 @@ static void init_8259A(int auto_eoi)
298 outb(cached_master_mask, PIC_MASTER_IMR); /* restore master IRQ mask */ 298 outb(cached_master_mask, PIC_MASTER_IMR); /* restore master IRQ mask */
299 outb(cached_slave_mask, PIC_SLAVE_IMR); /* restore slave IRQ mask */ 299 outb(cached_slave_mask, PIC_SLAVE_IMR); /* restore slave IRQ mask */
300 300
301 spin_unlock_irqrestore(&i8259A_lock, flags); 301 raw_spin_unlock_irqrestore(&i8259A_lock, flags);
302} 302}
303 303
304/* 304/*
diff --git a/arch/mips/kernel/irq-gt641xx.c b/arch/mips/kernel/irq-gt641xx.c
index ebcc5f7ad9c2..42ef81461bfc 100644
--- a/arch/mips/kernel/irq-gt641xx.c
+++ b/arch/mips/kernel/irq-gt641xx.c
@@ -27,18 +27,18 @@
27 27
28#define GT641XX_IRQ_TO_BIT(irq) (1U << (irq - GT641XX_IRQ_BASE)) 28#define GT641XX_IRQ_TO_BIT(irq) (1U << (irq - GT641XX_IRQ_BASE))
29 29
30static DEFINE_SPINLOCK(gt641xx_irq_lock); 30static DEFINE_RAW_SPINLOCK(gt641xx_irq_lock);
31 31
32static void ack_gt641xx_irq(unsigned int irq) 32static void ack_gt641xx_irq(unsigned int irq)
33{ 33{
34 unsigned long flags; 34 unsigned long flags;
35 u32 cause; 35 u32 cause;
36 36
37 spin_lock_irqsave(&gt641xx_irq_lock, flags); 37 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
38 cause = GT_READ(GT_INTRCAUSE_OFS); 38 cause = GT_READ(GT_INTRCAUSE_OFS);
39 cause &= ~GT641XX_IRQ_TO_BIT(irq); 39 cause &= ~GT641XX_IRQ_TO_BIT(irq);
40 GT_WRITE(GT_INTRCAUSE_OFS, cause); 40 GT_WRITE(GT_INTRCAUSE_OFS, cause);
41 spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 41 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
42} 42}
43 43
44static void mask_gt641xx_irq(unsigned int irq) 44static void mask_gt641xx_irq(unsigned int irq)
@@ -46,11 +46,11 @@ static void mask_gt641xx_irq(unsigned int irq)
46 unsigned long flags; 46 unsigned long flags;
47 u32 mask; 47 u32 mask;
48 48
49 spin_lock_irqsave(&gt641xx_irq_lock, flags); 49 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
50 mask = GT_READ(GT_INTRMASK_OFS); 50 mask = GT_READ(GT_INTRMASK_OFS);
51 mask &= ~GT641XX_IRQ_TO_BIT(irq); 51 mask &= ~GT641XX_IRQ_TO_BIT(irq);
52 GT_WRITE(GT_INTRMASK_OFS, mask); 52 GT_WRITE(GT_INTRMASK_OFS, mask);
53 spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 53 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
54} 54}
55 55
56static void mask_ack_gt641xx_irq(unsigned int irq) 56static void mask_ack_gt641xx_irq(unsigned int irq)
@@ -58,7 +58,7 @@ static void mask_ack_gt641xx_irq(unsigned int irq)
58 unsigned long flags; 58 unsigned long flags;
59 u32 cause, mask; 59 u32 cause, mask;
60 60
61 spin_lock_irqsave(&gt641xx_irq_lock, flags); 61 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
62 mask = GT_READ(GT_INTRMASK_OFS); 62 mask = GT_READ(GT_INTRMASK_OFS);
63 mask &= ~GT641XX_IRQ_TO_BIT(irq); 63 mask &= ~GT641XX_IRQ_TO_BIT(irq);
64 GT_WRITE(GT_INTRMASK_OFS, mask); 64 GT_WRITE(GT_INTRMASK_OFS, mask);
@@ -66,7 +66,7 @@ static void mask_ack_gt641xx_irq(unsigned int irq)
66 cause = GT_READ(GT_INTRCAUSE_OFS); 66 cause = GT_READ(GT_INTRCAUSE_OFS);
67 cause &= ~GT641XX_IRQ_TO_BIT(irq); 67 cause &= ~GT641XX_IRQ_TO_BIT(irq);
68 GT_WRITE(GT_INTRCAUSE_OFS, cause); 68 GT_WRITE(GT_INTRCAUSE_OFS, cause);
69 spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 69 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
70} 70}
71 71
72static void unmask_gt641xx_irq(unsigned int irq) 72static void unmask_gt641xx_irq(unsigned int irq)
@@ -74,11 +74,11 @@ static void unmask_gt641xx_irq(unsigned int irq)
74 unsigned long flags; 74 unsigned long flags;
75 u32 mask; 75 u32 mask;
76 76
77 spin_lock_irqsave(&gt641xx_irq_lock, flags); 77 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags);
78 mask = GT_READ(GT_INTRMASK_OFS); 78 mask = GT_READ(GT_INTRMASK_OFS);
79 mask |= GT641XX_IRQ_TO_BIT(irq); 79 mask |= GT641XX_IRQ_TO_BIT(irq);
80 GT_WRITE(GT_INTRMASK_OFS, mask); 80 GT_WRITE(GT_INTRMASK_OFS, mask);
81 spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 81 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags);
82} 82}
83 83
84static struct irq_chip gt641xx_irq_chip = { 84static struct irq_chip gt641xx_irq_chip = {
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index f042563c924f..bde79ef602e6 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -9,7 +9,6 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/file.h> 11#include <linux/file.h>
12#include <linux/smp_lock.h>
13#include <linux/highuid.h> 12#include <linux/highuid.h>
14#include <linux/resource.h> 13#include <linux/resource.h>
15#include <linux/highmem.h> 14#include <linux/highmem.h>
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 0a9cfdb271dd..6851fc97a511 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -6,7 +6,7 @@
6 * more details. 6 * more details.
7 * 7 *
8 * Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University, China 8 * Copyright (C) 2009 Lemote Inc. & DSLab, Lanzhou University, China
9 * Author: Wu Zhangjin <wuzj@lemote.com> 9 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
10 */ 10 */
11 11
12#include <asm/regdef.h> 12#include <asm/regdef.h>
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index 3952b8323efa..dd18b26a358a 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -500,4 +500,3 @@ done_restore:
500 nop 500 nop
501 END(octeon_mult_restore) 501 END(octeon_mult_restore)
502 .set pop 502 .set pop
503
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 364f066cb497..dcaed1bbbfe5 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -28,7 +28,6 @@
28#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
29#include <linux/elf.h> 29#include <linux/elf.h>
30#include <linux/seq_file.h> 30#include <linux/seq_file.h>
31#include <linux/smp_lock.h>
32#include <linux/syscalls.h> 31#include <linux/syscalls.h>
33#include <linux/moduleloader.h> 32#include <linux/moduleloader.h>
34#include <linux/interrupt.h> 33#include <linux/interrupt.h>
diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c
new file mode 100644
index 000000000000..da61134dfc53
--- /dev/null
+++ b/arch/mips/kernel/spinlock_test.c
@@ -0,0 +1,141 @@
1#include <linux/init.h>
2#include <linux/kthread.h>
3#include <linux/hrtimer.h>
4#include <linux/fs.h>
5#include <linux/debugfs.h>
6#include <linux/module.h>
7#include <linux/spinlock.h>
8
9
10static int ss_get(void *data, u64 *val)
11{
12 ktime_t start, finish;
13 int loops;
14 int cont;
15 DEFINE_RAW_SPINLOCK(ss_spin);
16
17 loops = 1000000;
18 cont = 1;
19
20 start = ktime_get();
21
22 while (cont) {
23 raw_spin_lock(&ss_spin);
24 loops--;
25 if (loops == 0)
26 cont = 0;
27 raw_spin_unlock(&ss_spin);
28 }
29
30 finish = ktime_get();
31
32 *val = ktime_us_delta(finish, start);
33
34 return 0;
35}
36
37DEFINE_SIMPLE_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n");
38
39
40
41struct spin_multi_state {
42 raw_spinlock_t lock;
43 atomic_t start_wait;
44 atomic_t enter_wait;
45 atomic_t exit_wait;
46 int loops;
47};
48
49struct spin_multi_per_thread {
50 struct spin_multi_state *state;
51 ktime_t start;
52};
53
54static int multi_other(void *data)
55{
56 int loops;
57 int cont;
58 struct spin_multi_per_thread *pt = data;
59 struct spin_multi_state *s = pt->state;
60
61 loops = s->loops;
62 cont = 1;
63
64 atomic_dec(&s->enter_wait);
65
66 while (atomic_read(&s->enter_wait))
67 ; /* spin */
68
69 pt->start = ktime_get();
70
71 atomic_dec(&s->start_wait);
72
73 while (atomic_read(&s->start_wait))
74 ; /* spin */
75
76 while (cont) {
77 raw_spin_lock(&s->lock);
78 loops--;
79 if (loops == 0)
80 cont = 0;
81 raw_spin_unlock(&s->lock);
82 }
83
84 atomic_dec(&s->exit_wait);
85 while (atomic_read(&s->exit_wait))
86 ; /* spin */
87 return 0;
88}
89
90static int multi_get(void *data, u64 *val)
91{
92 ktime_t finish;
93 struct spin_multi_state ms;
94 struct spin_multi_per_thread t1, t2;
95
96 ms.lock = __RAW_SPIN_LOCK_UNLOCKED("multi_get");
97 ms.loops = 1000000;
98
99 atomic_set(&ms.start_wait, 2);
100 atomic_set(&ms.enter_wait, 2);
101 atomic_set(&ms.exit_wait, 2);
102 t1.state = &ms;
103 t2.state = &ms;
104
105 kthread_run(multi_other, &t2, "multi_get");
106
107 multi_other(&t1);
108
109 finish = ktime_get();
110
111 *val = ktime_us_delta(finish, t1.start);
112
113 return 0;
114}
115
116DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n");
117
118
119extern struct dentry *mips_debugfs_dir;
120static int __init spinlock_test(void)
121{
122 struct dentry *d;
123
124 if (!mips_debugfs_dir)
125 return -ENODEV;
126
127 d = debugfs_create_file("spin_single", S_IRUGO,
128 mips_debugfs_dir, NULL,
129 &fops_ss);
130 if (!d)
131 return -ENOMEM;
132
133 d = debugfs_create_file("spin_multi", S_IRUGO,
134 mips_debugfs_dir, NULL,
135 &fops_multi);
136 if (!d)
137 return -ENOMEM;
138
139 return 0;
140}
141device_initcall(spinlock_test);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 31b204b26ba0..4e00f9bc23ee 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -50,6 +50,7 @@
50#include <asm/types.h> 50#include <asm/types.h>
51#include <asm/stacktrace.h> 51#include <asm/stacktrace.h>
52#include <asm/irq.h> 52#include <asm/irq.h>
53#include <asm/uasm.h>
53 54
54extern void check_wait(void); 55extern void check_wait(void);
55extern asmlinkage void r4k_wait(void); 56extern asmlinkage void r4k_wait(void);
@@ -1271,21 +1272,25 @@ unsigned long ebase;
1271unsigned long exception_handlers[32]; 1272unsigned long exception_handlers[32];
1272unsigned long vi_handlers[64]; 1273unsigned long vi_handlers[64];
1273 1274
1274/* 1275void __init *set_except_vector(int n, void *addr)
1275 * As a side effect of the way this is implemented we're limited
1276 * to interrupt handlers in the address range from
1277 * KSEG0 <= x < KSEG0 + 256mb on the Nevada. Oh well ...
1278 */
1279void *set_except_vector(int n, void *addr)
1280{ 1276{
1281 unsigned long handler = (unsigned long) addr; 1277 unsigned long handler = (unsigned long) addr;
1282 unsigned long old_handler = exception_handlers[n]; 1278 unsigned long old_handler = exception_handlers[n];
1283 1279
1284 exception_handlers[n] = handler; 1280 exception_handlers[n] = handler;
1285 if (n == 0 && cpu_has_divec) { 1281 if (n == 0 && cpu_has_divec) {
1286 *(u32 *)(ebase + 0x200) = 0x08000000 | 1282 unsigned long jump_mask = ~((1 << 28) - 1);
1287 (0x03ffffff & (handler >> 2)); 1283 u32 *buf = (u32 *)(ebase + 0x200);
1288 local_flush_icache_range(ebase + 0x200, ebase + 0x204); 1284 unsigned int k0 = 26;
1285 if ((handler & jump_mask) == ((ebase + 0x200) & jump_mask)) {
1286 uasm_i_j(&buf, handler & ~jump_mask);
1287 uasm_i_nop(&buf);
1288 } else {
1289 UASM_i_LA(&buf, k0, handler);
1290 uasm_i_jr(&buf, k0);
1291 uasm_i_nop(&buf);
1292 }
1293 local_flush_icache_range(ebase + 0x200, (unsigned long)buf);
1289 } 1294 }
1290 return (void *)old_handler; 1295 return (void *)old_handler;
1291} 1296}
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 60477529362e..2bd2151c586a 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -38,7 +38,6 @@
38#include <linux/vmalloc.h> 38#include <linux/vmalloc.h>
39#include <linux/elf.h> 39#include <linux/elf.h>
40#include <linux/seq_file.h> 40#include <linux/seq_file.h>
41#include <linux/smp_lock.h>
42#include <linux/syscalls.h> 41#include <linux/syscalls.h>
43#include <linux/moduleloader.h> 42#include <linux/moduleloader.h>
44#include <linux/interrupt.h> 43#include <linux/interrupt.h>