aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-08-08 22:59:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-08-08 22:59:21 -0400
commit3fbdc379567aef1c43b4be110179b541d68afdf6 (patch)
tree9b5b964487bc6a2afd20da2c3b442a3cd82fe917
parentaf0b3152bbfebd3f8291fd61988c12ece4f60f57 (diff)
parent46011e6ea39235e4aca656673c500eac81a07a17 (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: "Another round of MIPS fixes for 4.2. No area does particularly stand out but we have a two unpleasant ones: - Kernel ptes are marked with a global bit which allows the kernel to share kernel TLB entries between all processes. For this to work both entries of an adjacent even/odd pte pair need to have the global bit set. There has been a subtle race in setting the other entry's global bit since ~ 2000 but it take particularly pathological workloads that essentially do mostly vmalloc/vfree to trigger this. This pull request fixes the 64-bit case but leaves the case of 32 bit CPUs with 64 bit ptes unsolved for now. The unfixed cases affect hardware that is not available in the field yet. - Instruction emulation requires loading instructions from user space but the current fast but simplistic approach will fail on pages that are PROT_EXEC but !PROT_READ. For this reason we temporarily do not permit this permission and will map pages with PROT_EXEC | PROT_READ. The remainder of this pull request is more or less across the field and the short log explains them well" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: Make set_pte() SMP safe. MIPS: Replace add and sub instructions in relocate_kernel.S with addiu MIPS: Flush RPS on kernel entry with EVA Revert "MIPS: BCM63xx: Provide a plat_post_dma_flush hook" MIPS: BMIPS: Delete unused Kconfig symbol MIPS: Export get_c0_perfcount_int() MIPS: show_stack: Fix stack trace with EVA MIPS: do_mcheck: Fix kernel code dump with EVA MIPS: SMP: Don't increment irq_count multiple times for call function IPIs MIPS: Partially disable RIXI support. MIPS: Handle page faults of executable but unreadable pages correctly. MIPS: Malta: Don't reinitialise RTC MIPS: unaligned: Fix build error on big endian R6 kernels MIPS: Fix sched_getaffinity with MT FPAFF enabled MIPS: Fix build with CONFIG_OF=y for non OF-enabled targets CPUFREQ: Loongson2: Fix broken build due to incorrect include.
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/mips/ath79/setup.c1
-rw-r--r--arch/mips/cavium-octeon/smp.c2
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/dma-coherence.h10
-rw-r--r--arch/mips/include/asm/pgtable.h31
-rw-r--r--arch/mips/include/asm/smp.h2
-rw-r--r--arch/mips/include/asm/stackframe.h25
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c5
-rw-r--r--arch/mips/kernel/prom.c2
-rw-r--r--arch/mips/kernel/relocate_kernel.S8
-rw-r--r--arch/mips/kernel/smp-bmips.c4
-rw-r--r--arch/mips/kernel/smp.c10
-rw-r--r--arch/mips/kernel/traps.c13
-rw-r--r--arch/mips/kernel/unaligned.c2
-rw-r--r--arch/mips/lantiq/irq.c3
-rw-r--r--arch/mips/loongson64/loongson-3/smp.c7
-rw-r--r--arch/mips/mm/cache.c8
-rw-r--r--arch/mips/mm/fault.c3
-rw-r--r--arch/mips/mti-malta/malta-int.c2
-rw-r--r--arch/mips/mti-malta/malta-time.c16
-rw-r--r--arch/mips/mti-sead3/sead3-time.c1
-rw-r--r--arch/mips/netlogic/common/smp.c2
-rw-r--r--arch/mips/paravirt/paravirt-smp.c2
-rw-r--r--arch/mips/pistachio/time.c1
-rw-r--r--arch/mips/pmcs-msp71xx/msp_smp.c2
-rw-r--r--arch/mips/ralink/irq.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c8
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c9
-rw-r--r--arch/mips/sibyte/sb1250/smp.c7
-rw-r--r--drivers/cpufreq/loongson2_cpufreq.c2
-rw-r--r--drivers/irqchip/irq-mips-gic.c2
31 files changed, 130 insertions, 62 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index cee5f93e5712..199a8357838c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -151,7 +151,6 @@ config BMIPS_GENERIC
151 select BCM7120_L2_IRQ 151 select BCM7120_L2_IRQ
152 select BRCMSTB_L2_IRQ 152 select BRCMSTB_L2_IRQ
153 select IRQ_MIPS_CPU 153 select IRQ_MIPS_CPU
154 select RAW_IRQ_ACCESSORS
155 select DMA_NONCOHERENT 154 select DMA_NONCOHERENT
156 select SYS_SUPPORTS_32BIT_KERNEL 155 select SYS_SUPPORTS_32BIT_KERNEL
157 select SYS_SUPPORTS_LITTLE_ENDIAN 156 select SYS_SUPPORTS_LITTLE_ENDIAN
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
index 01a644f174dd..1ba21204ebe0 100644
--- a/arch/mips/ath79/setup.c
+++ b/arch/mips/ath79/setup.c
@@ -190,6 +190,7 @@ int get_c0_perfcount_int(void)
190{ 190{
191 return ATH79_MISC_IRQ(5); 191 return ATH79_MISC_IRQ(5);
192} 192}
193EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
193 194
194unsigned int get_c0_compare_int(void) 195unsigned int get_c0_compare_int(void)
195{ 196{
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 56f5d080ef9d..b7fa9ae28c36 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -42,7 +42,7 @@ static irqreturn_t mailbox_interrupt(int irq, void *dev_id)
42 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action); 42 cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action);
43 43
44 if (action & SMP_CALL_FUNCTION) 44 if (action & SMP_CALL_FUNCTION)
45 smp_call_function_interrupt(); 45 generic_smp_call_function_interrupt();
46 if (action & SMP_RESCHEDULE_YOURSELF) 46 if (action & SMP_RESCHEDULE_YOURSELF)
47 scheduler_ipi(); 47 scheduler_ipi();
48 48
diff --git a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h b/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
deleted file mode 100644
index 11d3b572b1b3..000000000000
--- a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __ASM_MACH_BCM63XX_DMA_COHERENCE_H
2#define __ASM_MACH_BCM63XX_DMA_COHERENCE_H
3
4#include <asm/bmips.h>
5
6#define plat_post_dma_flush bmips_post_dma_flush
7
8#include <asm/mach-generic/dma-coherence.h>
9
10#endif /* __ASM_MACH_BCM63XX_DMA_COHERENCE_H */
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 9d8106758142..ae8569475264 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -182,8 +182,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
182 * Make sure the buddy is global too (if it's !none, 182 * Make sure the buddy is global too (if it's !none,
183 * it better already be global) 183 * it better already be global)
184 */ 184 */
185#ifdef CONFIG_SMP
186 /*
187 * For SMP, multiple CPUs can race, so we need to do
188 * this atomically.
189 */
190#ifdef CONFIG_64BIT
191#define LL_INSN "lld"
192#define SC_INSN "scd"
193#else /* CONFIG_32BIT */
194#define LL_INSN "ll"
195#define SC_INSN "sc"
196#endif
197 unsigned long page_global = _PAGE_GLOBAL;
198 unsigned long tmp;
199
200 __asm__ __volatile__ (
201 " .set push\n"
202 " .set noreorder\n"
203 "1: " LL_INSN " %[tmp], %[buddy]\n"
204 " bnez %[tmp], 2f\n"
205 " or %[tmp], %[tmp], %[global]\n"
206 " " SC_INSN " %[tmp], %[buddy]\n"
207 " beqz %[tmp], 1b\n"
208 " nop\n"
209 "2:\n"
210 " .set pop"
211 : [buddy] "+m" (buddy->pte),
212 [tmp] "=&r" (tmp)
213 : [global] "r" (page_global));
214#else /* !CONFIG_SMP */
185 if (pte_none(*buddy)) 215 if (pte_none(*buddy))
186 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; 216 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL;
217#endif /* CONFIG_SMP */
187 } 218 }
188#endif 219#endif
189} 220}
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 16f1ea9ab191..03722d4326a1 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -83,8 +83,6 @@ static inline void __cpu_die(unsigned int cpu)
83extern void play_dead(void); 83extern void play_dead(void);
84#endif 84#endif
85 85
86extern asmlinkage void smp_call_function_interrupt(void);
87
88static inline void arch_send_call_function_single_ipi(int cpu) 86static inline void arch_send_call_function_single_ipi(int cpu)
89{ 87{
90 extern struct plat_smp_ops *mp_ops; /* private */ 88 extern struct plat_smp_ops *mp_ops; /* private */
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
index 28d6d9364bd1..a71da576883c 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -152,6 +152,31 @@
152 .set noreorder 152 .set noreorder
153 bltz k0, 8f 153 bltz k0, 8f
154 move k1, sp 154 move k1, sp
155#ifdef CONFIG_EVA
156 /*
157 * Flush interAptiv's Return Prediction Stack (RPS) by writing
158 * EntryHi. Toggling Config7.RPS is slower and less portable.
159 *
160 * The RPS isn't automatically flushed when exceptions are
161 * taken, which can result in kernel mode speculative accesses
162 * to user addresses if the RPS mispredicts. That's harmless
163 * when user and kernel share the same address space, but with
164 * EVA the same user segments may be unmapped to kernel mode,
165 * even containing sensitive MMIO regions or invalid memory.
166 *
167 * This can happen when the kernel sets the return address to
168 * ret_from_* and jr's to the exception handler, which looks
169 * more like a tail call than a function call. If nested calls
170 * don't evict the last user address in the RPS, it will
171 * mispredict the return and fetch from a user controlled
172 * address into the icache.
173 *
174 * More recent EVA-capable cores with MAAR to restrict
175 * speculative accesses aren't affected.
176 */
177 MFC0 k0, CP0_ENTRYHI
178 MTC0 k0, CP0_ENTRYHI
179#endif
155 .set reorder 180 .set reorder
156 /* Called from user mode, new stack. */ 181 /* Called from user mode, new stack. */
157 get_saved_sp 182 get_saved_sp
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index 3e4491aa6d6b..789d7bf4fef3 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -154,7 +154,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
154 unsigned long __user *user_mask_ptr) 154 unsigned long __user *user_mask_ptr)
155{ 155{
156 unsigned int real_len; 156 unsigned int real_len;
157 cpumask_t mask; 157 cpumask_t allowed, mask;
158 int retval; 158 int retval;
159 struct task_struct *p; 159 struct task_struct *p;
160 160
@@ -173,7 +173,8 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
173 if (retval) 173 if (retval)
174 goto out_unlock; 174 goto out_unlock;
175 175
176 cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask); 176 cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed);
177 cpumask_and(&mask, &allowed, cpu_active_mask);
177 178
178out_unlock: 179out_unlock:
179 read_unlock(&tasklist_lock); 180 read_unlock(&tasklist_lock);
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index b130033838ba..5fcec3032f38 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -38,7 +38,7 @@ char *mips_get_machine_name(void)
38 return mips_machine_name; 38 return mips_machine_name;
39} 39}
40 40
41#ifdef CONFIG_OF 41#ifdef CONFIG_USE_OF
42void __init early_init_dt_add_memory_arch(u64 base, u64 size) 42void __init early_init_dt_add_memory_arch(u64 base, u64 size)
43{ 43{
44 return add_memory_region(base, size, BOOT_MEM_RAM); 44 return add_memory_region(base, size, BOOT_MEM_RAM);
diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate_kernel.S
index 74bab9ddd0e1..c6bbf2165051 100644
--- a/arch/mips/kernel/relocate_kernel.S
+++ b/arch/mips/kernel/relocate_kernel.S
@@ -24,7 +24,7 @@ LEAF(relocate_new_kernel)
24 24
25process_entry: 25process_entry:
26 PTR_L s2, (s0) 26 PTR_L s2, (s0)
27 PTR_ADD s0, s0, SZREG 27 PTR_ADDIU s0, s0, SZREG
28 28
29 /* 29 /*
30 * In case of a kdump/crash kernel, the indirection page is not 30 * In case of a kdump/crash kernel, the indirection page is not
@@ -61,9 +61,9 @@ copy_word:
61 /* copy page word by word */ 61 /* copy page word by word */
62 REG_L s5, (s2) 62 REG_L s5, (s2)
63 REG_S s5, (s4) 63 REG_S s5, (s4)
64 PTR_ADD s4, s4, SZREG 64 PTR_ADDIU s4, s4, SZREG
65 PTR_ADD s2, s2, SZREG 65 PTR_ADDIU s2, s2, SZREG
66 LONG_SUB s6, s6, 1 66 LONG_ADDIU s6, s6, -1
67 beq s6, zero, process_entry 67 beq s6, zero, process_entry
68 b copy_word 68 b copy_word
69 b process_entry 69 b process_entry
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 336708ae5c5b..78cf8c2f1de0 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -284,7 +284,7 @@ static irqreturn_t bmips5000_ipi_interrupt(int irq, void *dev_id)
284 if (action == 0) 284 if (action == 0)
285 scheduler_ipi(); 285 scheduler_ipi();
286 else 286 else
287 smp_call_function_interrupt(); 287 generic_smp_call_function_interrupt();
288 288
289 return IRQ_HANDLED; 289 return IRQ_HANDLED;
290} 290}
@@ -336,7 +336,7 @@ static irqreturn_t bmips43xx_ipi_interrupt(int irq, void *dev_id)
336 if (action & SMP_RESCHEDULE_YOURSELF) 336 if (action & SMP_RESCHEDULE_YOURSELF)
337 scheduler_ipi(); 337 scheduler_ipi();
338 if (action & SMP_CALL_FUNCTION) 338 if (action & SMP_CALL_FUNCTION)
339 smp_call_function_interrupt(); 339 generic_smp_call_function_interrupt();
340 340
341 return IRQ_HANDLED; 341 return IRQ_HANDLED;
342} 342}
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index d0744cc77ea7..a31896c33716 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -192,16 +192,6 @@ asmlinkage void start_secondary(void)
192 cpu_startup_entry(CPUHP_ONLINE); 192 cpu_startup_entry(CPUHP_ONLINE);
193} 193}
194 194
195/*
196 * Call into both interrupt handlers, as we share the IPI for them
197 */
198void __irq_entry smp_call_function_interrupt(void)
199{
200 irq_enter();
201 generic_smp_call_function_interrupt();
202 irq_exit();
203}
204
205static void stop_this_cpu(void *dummy) 195static void stop_this_cpu(void *dummy)
206{ 196{
207 /* 197 /*
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index e207a43b5f8f..8ea28e6ab37d 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -192,6 +192,7 @@ static void show_stacktrace(struct task_struct *task,
192void show_stack(struct task_struct *task, unsigned long *sp) 192void show_stack(struct task_struct *task, unsigned long *sp)
193{ 193{
194 struct pt_regs regs; 194 struct pt_regs regs;
195 mm_segment_t old_fs = get_fs();
195 if (sp) { 196 if (sp) {
196 regs.regs[29] = (unsigned long)sp; 197 regs.regs[29] = (unsigned long)sp;
197 regs.regs[31] = 0; 198 regs.regs[31] = 0;
@@ -210,7 +211,13 @@ void show_stack(struct task_struct *task, unsigned long *sp)
210 prepare_frametrace(&regs); 211 prepare_frametrace(&regs);
211 } 212 }
212 } 213 }
214 /*
215 * show_stack() deals exclusively with kernel mode, so be sure to access
216 * the stack in the kernel (not user) address space.
217 */
218 set_fs(KERNEL_DS);
213 show_stacktrace(task, &regs); 219 show_stacktrace(task, &regs);
220 set_fs(old_fs);
214} 221}
215 222
216static void show_code(unsigned int __user *pc) 223static void show_code(unsigned int __user *pc)
@@ -1519,6 +1526,7 @@ asmlinkage void do_mcheck(struct pt_regs *regs)
1519 const int field = 2 * sizeof(unsigned long); 1526 const int field = 2 * sizeof(unsigned long);
1520 int multi_match = regs->cp0_status & ST0_TS; 1527 int multi_match = regs->cp0_status & ST0_TS;
1521 enum ctx_state prev_state; 1528 enum ctx_state prev_state;
1529 mm_segment_t old_fs = get_fs();
1522 1530
1523 prev_state = exception_enter(); 1531 prev_state = exception_enter();
1524 show_regs(regs); 1532 show_regs(regs);
@@ -1540,8 +1548,13 @@ asmlinkage void do_mcheck(struct pt_regs *regs)
1540 dump_tlb_all(); 1548 dump_tlb_all();
1541 } 1549 }
1542 1550
1551 if (!user_mode(regs))
1552 set_fs(KERNEL_DS);
1553
1543 show_code((unsigned int __user *) regs->cp0_epc); 1554 show_code((unsigned int __user *) regs->cp0_epc);
1544 1555
1556 set_fs(old_fs);
1557
1545 /* 1558 /*
1546 * Some chips may have other causes of machine check (e.g. SB1 1559 * Some chips may have other causes of machine check (e.g. SB1
1547 * graduation timer) 1560 * graduation timer)
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index af84bef0c90d..eb3efd137fd1 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -438,7 +438,7 @@ do { \
438 : "memory"); \ 438 : "memory"); \
439} while(0) 439} while(0)
440 440
441#define StoreDW(addr, value, res) \ 441#define _StoreDW(addr, value, res) \
442do { \ 442do { \
443 __asm__ __volatile__ ( \ 443 __asm__ __volatile__ ( \
444 ".set\tpush\n\t" \ 444 ".set\tpush\n\t" \
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index 6ab10573490d..2c218c3bbca5 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -293,7 +293,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
293 293
294static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 294static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
295{ 295{
296 smp_call_function_interrupt(); 296 generic_smp_call_function_interrupt();
297 return IRQ_HANDLED; 297 return IRQ_HANDLED;
298} 298}
299 299
@@ -466,6 +466,7 @@ int get_c0_perfcount_int(void)
466{ 466{
467 return ltq_perfcount_irq; 467 return ltq_perfcount_irq;
468} 468}
469EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
469 470
470unsigned int get_c0_compare_int(void) 471unsigned int get_c0_compare_int(void)
471{ 472{
diff --git a/arch/mips/loongson64/loongson-3/smp.c b/arch/mips/loongson64/loongson-3/smp.c
index 509877c6e9d9..1a4738a8f2d3 100644
--- a/arch/mips/loongson64/loongson-3/smp.c
+++ b/arch/mips/loongson64/loongson-3/smp.c
@@ -266,8 +266,11 @@ void loongson3_ipi_interrupt(struct pt_regs *regs)
266 if (action & SMP_RESCHEDULE_YOURSELF) 266 if (action & SMP_RESCHEDULE_YOURSELF)
267 scheduler_ipi(); 267 scheduler_ipi();
268 268
269 if (action & SMP_CALL_FUNCTION) 269 if (action & SMP_CALL_FUNCTION) {
270 smp_call_function_interrupt(); 270 irq_enter();
271 generic_smp_call_function_interrupt();
272 irq_exit();
273 }
271 274
272 if (action & SMP_ASK_C0COUNT) { 275 if (action & SMP_ASK_C0COUNT) {
273 BUG_ON(cpu != 0); 276 BUG_ON(cpu != 0);
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 77d96db8253c..aab218c36e0d 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -160,18 +160,18 @@ static inline void setup_protection_map(void)
160 protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); 160 protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
161 protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); 161 protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
162 protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); 162 protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
163 protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); 163 protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
164 protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 164 protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
165 protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); 165 protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
166 protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 166 protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
167 167
168 protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); 168 protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
169 protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); 169 protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
170 protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ); 170 protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
171 protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); 171 protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
172 protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); 172 protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
173 protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT); 173 protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
174 protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE | _PAGE_NO_READ); 174 protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
175 protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE); 175 protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
176 176
177 } else { 177 } else {
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 36c0f26fac6b..852a41c6da45 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -133,7 +133,8 @@ good_area:
133#endif 133#endif
134 goto bad_area; 134 goto bad_area;
135 } 135 }
136 if (!(vma->vm_flags & VM_READ)) { 136 if (!(vma->vm_flags & VM_READ) &&
137 exception_epc(regs) != address) {
137#if 0 138#if 0
138 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n", 139 pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n",
139 raw_smp_processor_id(), 140 raw_smp_processor_id(),
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index d1392f8f5811..fa8f591f3713 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -222,7 +222,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
222 222
223static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 223static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
224{ 224{
225 smp_call_function_interrupt(); 225 generic_smp_call_function_interrupt();
226 226
227 return IRQ_HANDLED; 227 return IRQ_HANDLED;
228} 228}
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c
index 5625b190edc0..b7bf721eabf5 100644
--- a/arch/mips/mti-malta/malta-time.c
+++ b/arch/mips/mti-malta/malta-time.c
@@ -154,6 +154,7 @@ int get_c0_perfcount_int(void)
154 154
155 return mips_cpu_perf_irq; 155 return mips_cpu_perf_irq;
156} 156}
157EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
157 158
158unsigned int get_c0_compare_int(void) 159unsigned int get_c0_compare_int(void)
159{ 160{
@@ -171,14 +172,17 @@ unsigned int get_c0_compare_int(void)
171 172
172static void __init init_rtc(void) 173static void __init init_rtc(void)
173{ 174{
174 /* stop the clock whilst setting it up */ 175 unsigned char freq, ctrl;
175 CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL);
176 176
177 /* 32KHz time base */ 177 /* Set 32KHz time base if not already set */
178 CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); 178 freq = CMOS_READ(RTC_FREQ_SELECT);
179 if ((freq & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ)
180 CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);
179 181
180 /* start the clock */ 182 /* Ensure SET bit is clear so RTC can run */
181 CMOS_WRITE(RTC_24H, RTC_CONTROL); 183 ctrl = CMOS_READ(RTC_CONTROL);
184 if (ctrl & RTC_SET)
185 CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL);
182} 186}
183 187
184void __init plat_time_init(void) 188void __init plat_time_init(void)
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c
index e1d69895fb1d..a120b7a5a8fe 100644
--- a/arch/mips/mti-sead3/sead3-time.c
+++ b/arch/mips/mti-sead3/sead3-time.c
@@ -77,6 +77,7 @@ int get_c0_perfcount_int(void)
77 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; 77 return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
78 return -1; 78 return -1;
79} 79}
80EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
80 81
81unsigned int get_c0_compare_int(void) 82unsigned int get_c0_compare_int(void)
82{ 83{
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index dc3e327fbbac..f5fff228b347 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -86,7 +86,7 @@ void nlm_smp_function_ipi_handler(unsigned int irq, struct irq_desc *desc)
86{ 86{
87 clear_c0_eimr(irq); 87 clear_c0_eimr(irq);
88 ack_c0_eirr(irq); 88 ack_c0_eirr(irq);
89 smp_call_function_interrupt(); 89 generic_smp_call_function_interrupt();
90 set_c0_eimr(irq); 90 set_c0_eimr(irq);
91} 91}
92 92
diff --git a/arch/mips/paravirt/paravirt-smp.c b/arch/mips/paravirt/paravirt-smp.c
index 42181c7105df..f8d3e081b2eb 100644
--- a/arch/mips/paravirt/paravirt-smp.c
+++ b/arch/mips/paravirt/paravirt-smp.c
@@ -114,7 +114,7 @@ static irqreturn_t paravirt_reched_interrupt(int irq, void *dev_id)
114 114
115static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id) 115static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id)
116{ 116{
117 smp_call_function_interrupt(); 117 generic_smp_call_function_interrupt();
118 return IRQ_HANDLED; 118 return IRQ_HANDLED;
119} 119}
120 120
diff --git a/arch/mips/pistachio/time.c b/arch/mips/pistachio/time.c
index 7c73fcb92a10..8a377346f0ca 100644
--- a/arch/mips/pistachio/time.c
+++ b/arch/mips/pistachio/time.c
@@ -26,6 +26,7 @@ int get_c0_perfcount_int(void)
26{ 26{
27 return gic_get_c0_perfcount_int(); 27 return gic_get_c0_perfcount_int();
28} 28}
29EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
29 30
30int get_c0_fdc_int(void) 31int get_c0_fdc_int(void)
31{ 32{
diff --git a/arch/mips/pmcs-msp71xx/msp_smp.c b/arch/mips/pmcs-msp71xx/msp_smp.c
index 10170580a2de..ffa0f7101a97 100644
--- a/arch/mips/pmcs-msp71xx/msp_smp.c
+++ b/arch/mips/pmcs-msp71xx/msp_smp.c
@@ -44,7 +44,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
44 44
45static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 45static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
46{ 46{
47 smp_call_function_interrupt(); 47 generic_smp_call_function_interrupt();
48 48
49 return IRQ_HANDLED; 49 return IRQ_HANDLED;
50} 50}
diff --git a/arch/mips/ralink/irq.c b/arch/mips/ralink/irq.c
index 53707aacc0f8..8c624a8b9ea2 100644
--- a/arch/mips/ralink/irq.c
+++ b/arch/mips/ralink/irq.c
@@ -89,6 +89,7 @@ int get_c0_perfcount_int(void)
89{ 89{
90 return rt_perfcount_irq; 90 return rt_perfcount_irq;
91} 91}
92EXPORT_SYMBOL_GPL(get_c0_perfcount_int);
92 93
93unsigned int get_c0_compare_int(void) 94unsigned int get_c0_compare_int(void)
94{ 95{
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 3fbaef97a1b8..16ec4e12daa3 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -107,10 +107,14 @@ static void ip27_do_irq_mask0(void)
107 scheduler_ipi(); 107 scheduler_ipi();
108 } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) { 108 } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) {
109 LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ); 109 LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ);
110 smp_call_function_interrupt(); 110 irq_enter();
111 generic_smp_call_function_interrupt();
112 irq_exit();
111 } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) { 113 } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) {
112 LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ); 114 LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ);
113 smp_call_function_interrupt(); 115 irq_enter();
116 generic_smp_call_function_interrupt();
117 irq_exit();
114 } else 118 } else
115#endif 119#endif
116 { 120 {
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index af7d44edd9a8..4c71aea25663 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -29,8 +29,6 @@
29#include <asm/sibyte/bcm1480_regs.h> 29#include <asm/sibyte/bcm1480_regs.h>
30#include <asm/sibyte/bcm1480_int.h> 30#include <asm/sibyte/bcm1480_int.h>
31 31
32extern void smp_call_function_interrupt(void);
33
34/* 32/*
35 * These are routines for dealing with the bcm1480 smp capabilities 33 * These are routines for dealing with the bcm1480 smp capabilities
36 * independent of board/firmware 34 * independent of board/firmware
@@ -184,6 +182,9 @@ void bcm1480_mailbox_interrupt(void)
184 if (action & SMP_RESCHEDULE_YOURSELF) 182 if (action & SMP_RESCHEDULE_YOURSELF)
185 scheduler_ipi(); 183 scheduler_ipi();
186 184
187 if (action & SMP_CALL_FUNCTION) 185 if (action & SMP_CALL_FUNCTION) {
188 smp_call_function_interrupt(); 186 irq_enter();
187 generic_smp_call_function_interrupt();
188 irq_exit();
189 }
189} 190}
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index c0c4b3f88a08..1cf66f5ff23d 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -172,6 +172,9 @@ void sb1250_mailbox_interrupt(void)
172 if (action & SMP_RESCHEDULE_YOURSELF) 172 if (action & SMP_RESCHEDULE_YOURSELF)
173 scheduler_ipi(); 173 scheduler_ipi();
174 174
175 if (action & SMP_CALL_FUNCTION) 175 if (action & SMP_CALL_FUNCTION) {
176 smp_call_function_interrupt(); 176 irq_enter();
177 generic_smp_call_function_interrupt();
178 irq_exit();
179 }
177} 180}
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index e362860c2b50..cd593c1f66dc 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -20,7 +20,7 @@
20#include <asm/clock.h> 20#include <asm/clock.h>
21#include <asm/idle.h> 21#include <asm/idle.h>
22 22
23#include <asm/mach-loongson/loongson.h> 23#include <asm/mach-loongson64/loongson.h>
24 24
25static uint nowait; 25static uint nowait;
26 26
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index b7d54d428b5e..ff4be0515a0d 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -538,7 +538,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
538 538
539static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 539static irqreturn_t ipi_call_interrupt(int irq, void *dev_id)
540{ 540{
541 smp_call_function_interrupt(); 541 generic_smp_call_function_interrupt();
542 542
543 return IRQ_HANDLED; 543 return IRQ_HANDLED;
544} 544}