aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-12 16:55:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-12 16:55:24 -0400
commit7fbb58a06517443ff68f36f4f1867ba978eac5dd (patch)
treea4c156f376bddb71ab016f963be38cb6eb94f1f7
parent1daa1cfb7ab3b9f9b4c7e7a3f136e4e0066b123c (diff)
parent51d53674c3fff11e9231e66ca8616c65deadfb6c (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: "A fair number of 4.2 fixes also because Markos opened the flood gates. - Patch up the math used calculate the location for the page bitmap. - The FDC (Not what you think, FDC stands for Fast Debug Channel) IRQ around was causing issues on non-Malta platforms, so move the code to a Malta specific location. - A spelling fix replicated through several files. - Fix to the emulation of an R2 instruction for R6 cores. - Fix the JR emulation for R6. - Further patching of mindless 64 bit issues. - Ensure the kernel won't crash on CPUs with L2 caches with >= 8 ways. - Use compat_sys_getsockopt for O32 ABI on 64 bit kernels. - Fix cache flushing for multithreaded cores. - A build fix" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: O32: Use compat_sys_getsockopt. MIPS: c-r4k: Extend way_string array MIPS: Pistachio: Support CDMM & Fast Debug Channel MIPS: Malta: Make GIC FDC IRQ workaround Malta specific MIPS: c-r4k: Fix cache flushing for MT cores Revert "MIPS: Kconfig: Disable SMP/CPS for 64-bit" MIPS: cps-vec: Use macros for various arithmetics and memory operations MIPS: kernel: cps-vec: Replace KSEG0 with CKSEG0 MIPS: kernel: cps-vec: Use ta0-ta3 pseudo-registers for 64-bit MIPS: kernel: cps-vec: Replace mips32r2 ISA level with mips64r2 MIPS: kernel: cps-vec: Replace 'la' macro with PTR_LA MIPS: kernel: smp-cps: Fix 64-bit compatibility errors due to pointer casting MIPS: Fix erroneous JR emulation for MIPS R6 MIPS: Fix branch emulation for BLTC and BGEC instructions MIPS: kernel: traps: Fix broken indentation MIPS: bootmem: Don't use memory holes for page bitmap MIPS: O32: Do not handle require 32 bytes from the stack to be readable. MIPS, CPUFREQ: Fix spelling of Institute. MIPS: Lemote 2F: Fix build caused by recent mass rename.
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/include/asm/mach-loongson64/mmzone.h2
-rw-r--r--arch/mips/include/asm/smp.h1
-rw-r--r--arch/mips/kernel/branch.c4
-rw-r--r--arch/mips/kernel/cps-vec.S96
-rw-r--r--arch/mips/kernel/scall32-o32.S37
-rw-r--r--arch/mips/kernel/scall64-o32.S35
-rw-r--r--arch/mips/kernel/setup.c13
-rw-r--r--arch/mips/kernel/smp-cps.c6
-rw-r--r--arch/mips/kernel/smp.c44
-rw-r--r--arch/mips/kernel/traps.c8
-rw-r--r--arch/mips/loongson64/common/bonito-irq.c2
-rw-r--r--arch/mips/loongson64/common/cmdline.c2
-rw-r--r--arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c2
-rw-r--r--arch/mips/loongson64/common/env.c2
-rw-r--r--arch/mips/loongson64/common/irq.c2
-rw-r--r--arch/mips/loongson64/common/setup.c2
-rw-r--r--arch/mips/loongson64/fuloong-2e/irq.c2
-rw-r--r--arch/mips/loongson64/lemote-2f/clock.c4
-rw-r--r--arch/mips/loongson64/loongson-3/numa.c2
-rw-r--r--arch/mips/math-emu/cp1emu.c6
-rw-r--r--arch/mips/mm/c-r4k.c18
-rw-r--r--arch/mips/mti-malta/malta-time.c20
-rw-r--r--arch/mips/pistachio/init.c8
-rw-r--r--arch/mips/pistachio/time.c5
-rw-r--r--drivers/cpufreq/loongson2_cpufreq.c2
-rw-r--r--drivers/irqchip/irq-mips-gic.c10
27 files changed, 214 insertions, 123 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2a14585c90d2..aab7e46cadd5 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -2231,7 +2231,7 @@ config MIPS_CMP
2231 2231
2232config MIPS_CPS 2232config MIPS_CPS
2233 bool "MIPS Coherent Processing System support" 2233 bool "MIPS Coherent Processing System support"
2234 depends on SYS_SUPPORTS_MIPS_CPS && !64BIT 2234 depends on SYS_SUPPORTS_MIPS_CPS
2235 select MIPS_CM 2235 select MIPS_CM
2236 select MIPS_CPC 2236 select MIPS_CPC
2237 select MIPS_CPS_PM if HOTPLUG_CPU 2237 select MIPS_CPS_PM if HOTPLUG_CPU
diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h
index 37c08a27b4f0..c9f7e231e66b 100644
--- a/arch/mips/include/asm/mach-loongson64/mmzone.h
+++ b/arch/mips/include/asm/mach-loongson64/mmzone.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2010 Loongson Inc. & Lemote Inc. & 2 * Copyright (C) 2010 Loongson Inc. & Lemote Inc. &
3 * Insititute of Computing Technology 3 * Institute of Computing Technology
4 * Author: Xiang Gao, gaoxiang@ict.ac.cn 4 * Author: Xiang Gao, gaoxiang@ict.ac.cn
5 * Huacai Chen, chenhc@lemote.com 5 * Huacai Chen, chenhc@lemote.com
6 * Xiaofu Meng, Shuangshuang Zhang 6 * Xiaofu Meng, Shuangshuang Zhang
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h
index 2b25d1ba1ea0..16f1ea9ab191 100644
--- a/arch/mips/include/asm/smp.h
+++ b/arch/mips/include/asm/smp.h
@@ -23,6 +23,7 @@
23extern int smp_num_siblings; 23extern int smp_num_siblings;
24extern cpumask_t cpu_sibling_map[]; 24extern cpumask_t cpu_sibling_map[];
25extern cpumask_t cpu_core_map[]; 25extern cpumask_t cpu_core_map[];
26extern cpumask_t cpu_foreign_map;
26 27
27#define raw_smp_processor_id() (current_thread_info()->cpu) 28#define raw_smp_processor_id() (current_thread_info()->cpu)
28 29
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index c0c5e5972256..d8f9b357b222 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -600,7 +600,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
600 break; 600 break;
601 601
602 case blezl_op: /* not really i_format */ 602 case blezl_op: /* not really i_format */
603 if (NO_R6EMU) 603 if (!insn.i_format.rt && NO_R6EMU)
604 goto sigill_r6; 604 goto sigill_r6;
605 case blez_op: 605 case blez_op:
606 /* 606 /*
@@ -635,7 +635,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs,
635 break; 635 break;
636 636
637 case bgtzl_op: 637 case bgtzl_op:
638 if (NO_R6EMU) 638 if (!insn.i_format.rt && NO_R6EMU)
639 goto sigill_r6; 639 goto sigill_r6;
640 case bgtz_op: 640 case bgtz_op:
641 /* 641 /*
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
index 55b759a0019e..1b6ca634e646 100644
--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -60,7 +60,7 @@ LEAF(mips_cps_core_entry)
60 nop 60 nop
61 61
62 /* This is an NMI */ 62 /* This is an NMI */
63 la k0, nmi_handler 63 PTR_LA k0, nmi_handler
64 jr k0 64 jr k0
65 nop 65 nop
66 66
@@ -107,10 +107,10 @@ not_nmi:
107 mul t1, t1, t0 107 mul t1, t1, t0
108 mul t1, t1, t2 108 mul t1, t1, t2
109 109
110 li a0, KSEG0 110 li a0, CKSEG0
111 add a1, a0, t1 111 PTR_ADD a1, a0, t1
1121: cache Index_Store_Tag_I, 0(a0) 1121: cache Index_Store_Tag_I, 0(a0)
113 add a0, a0, t0 113 PTR_ADD a0, a0, t0
114 bne a0, a1, 1b 114 bne a0, a1, 1b
115 nop 115 nop
116icache_done: 116icache_done:
@@ -134,12 +134,12 @@ icache_done:
134 mul t1, t1, t0 134 mul t1, t1, t0
135 mul t1, t1, t2 135 mul t1, t1, t2
136 136
137 li a0, KSEG0 137 li a0, CKSEG0
138 addu a1, a0, t1 138 PTR_ADDU a1, a0, t1
139 subu a1, a1, t0 139 PTR_SUBU a1, a1, t0
1401: cache Index_Store_Tag_D, 0(a0) 1401: cache Index_Store_Tag_D, 0(a0)
141 bne a0, a1, 1b 141 bne a0, a1, 1b
142 add a0, a0, t0 142 PTR_ADD a0, a0, t0
143dcache_done: 143dcache_done:
144 144
145 /* Set Kseg0 CCA to that in s0 */ 145 /* Set Kseg0 CCA to that in s0 */
@@ -152,11 +152,11 @@ dcache_done:
152 152
153 /* Enter the coherent domain */ 153 /* Enter the coherent domain */
154 li t0, 0xff 154 li t0, 0xff
155 sw t0, GCR_CL_COHERENCE_OFS(v1) 155 PTR_S t0, GCR_CL_COHERENCE_OFS(v1)
156 ehb 156 ehb
157 157
158 /* Jump to kseg0 */ 158 /* Jump to kseg0 */
159 la t0, 1f 159 PTR_LA t0, 1f
160 jr t0 160 jr t0
161 nop 161 nop
162 162
@@ -178,9 +178,9 @@ dcache_done:
178 nop 178 nop
179 179
180 /* Off we go! */ 180 /* Off we go! */
181 lw t1, VPEBOOTCFG_PC(v0) 181 PTR_L t1, VPEBOOTCFG_PC(v0)
182 lw gp, VPEBOOTCFG_GP(v0) 182 PTR_L gp, VPEBOOTCFG_GP(v0)
183 lw sp, VPEBOOTCFG_SP(v0) 183 PTR_L sp, VPEBOOTCFG_SP(v0)
184 jr t1 184 jr t1
185 nop 185 nop
186 END(mips_cps_core_entry) 186 END(mips_cps_core_entry)
@@ -217,7 +217,7 @@ LEAF(excep_intex)
217 217
218.org 0x480 218.org 0x480
219LEAF(excep_ejtag) 219LEAF(excep_ejtag)
220 la k0, ejtag_debug_handler 220 PTR_LA k0, ejtag_debug_handler
221 jr k0 221 jr k0
222 nop 222 nop
223 END(excep_ejtag) 223 END(excep_ejtag)
@@ -229,7 +229,7 @@ LEAF(mips_cps_core_init)
229 nop 229 nop
230 230
231 .set push 231 .set push
232 .set mips32r2 232 .set mips64r2
233 .set mt 233 .set mt
234 234
235 /* Only allow 1 TC per VPE to execute... */ 235 /* Only allow 1 TC per VPE to execute... */
@@ -237,7 +237,7 @@ LEAF(mips_cps_core_init)
237 237
238 /* ...and for the moment only 1 VPE */ 238 /* ...and for the moment only 1 VPE */
239 dvpe 239 dvpe
240 la t1, 1f 240 PTR_LA t1, 1f
241 jr.hb t1 241 jr.hb t1
242 nop 242 nop
243 243
@@ -250,25 +250,25 @@ LEAF(mips_cps_core_init)
250 mfc0 t0, CP0_MVPCONF0 250 mfc0 t0, CP0_MVPCONF0
251 srl t0, t0, MVPCONF0_PVPE_SHIFT 251 srl t0, t0, MVPCONF0_PVPE_SHIFT
252 andi t0, t0, (MVPCONF0_PVPE >> MVPCONF0_PVPE_SHIFT) 252 andi t0, t0, (MVPCONF0_PVPE >> MVPCONF0_PVPE_SHIFT)
253 addiu t7, t0, 1 253 addiu ta3, t0, 1
254 254
255 /* If there's only 1, we're done */ 255 /* If there's only 1, we're done */
256 beqz t0, 2f 256 beqz t0, 2f
257 nop 257 nop
258 258
259 /* Loop through each VPE within this core */ 259 /* Loop through each VPE within this core */
260 li t5, 1 260 li ta1, 1
261 261
2621: /* Operate on the appropriate TC */ 2621: /* Operate on the appropriate TC */
263 mtc0 t5, CP0_VPECONTROL 263 mtc0 ta1, CP0_VPECONTROL
264 ehb 264 ehb
265 265
266 /* Bind TC to VPE (1:1 TC:VPE mapping) */ 266 /* Bind TC to VPE (1:1 TC:VPE mapping) */
267 mttc0 t5, CP0_TCBIND 267 mttc0 ta1, CP0_TCBIND
268 268
269 /* Set exclusive TC, non-active, master */ 269 /* Set exclusive TC, non-active, master */
270 li t0, VPECONF0_MVP 270 li t0, VPECONF0_MVP
271 sll t1, t5, VPECONF0_XTC_SHIFT 271 sll t1, ta1, VPECONF0_XTC_SHIFT
272 or t0, t0, t1 272 or t0, t0, t1
273 mttc0 t0, CP0_VPECONF0 273 mttc0 t0, CP0_VPECONF0
274 274
@@ -280,8 +280,8 @@ LEAF(mips_cps_core_init)
280 mttc0 t0, CP0_TCHALT 280 mttc0 t0, CP0_TCHALT
281 281
282 /* Next VPE */ 282 /* Next VPE */
283 addiu t5, t5, 1 283 addiu ta1, ta1, 1
284 slt t0, t5, t7 284 slt t0, ta1, ta3
285 bnez t0, 1b 285 bnez t0, 1b
286 nop 286 nop
287 287
@@ -298,19 +298,19 @@ LEAF(mips_cps_core_init)
298 298
299LEAF(mips_cps_boot_vpes) 299LEAF(mips_cps_boot_vpes)
300 /* Retrieve CM base address */ 300 /* Retrieve CM base address */
301 la t0, mips_cm_base 301 PTR_LA t0, mips_cm_base
302 lw t0, 0(t0) 302 PTR_L t0, 0(t0)
303 303
304 /* Calculate a pointer to this cores struct core_boot_config */ 304 /* Calculate a pointer to this cores struct core_boot_config */
305 lw t0, GCR_CL_ID_OFS(t0) 305 PTR_L t0, GCR_CL_ID_OFS(t0)
306 li t1, COREBOOTCFG_SIZE 306 li t1, COREBOOTCFG_SIZE
307 mul t0, t0, t1 307 mul t0, t0, t1
308 la t1, mips_cps_core_bootcfg 308 PTR_LA t1, mips_cps_core_bootcfg
309 lw t1, 0(t1) 309 PTR_L t1, 0(t1)
310 addu t0, t0, t1 310 PTR_ADDU t0, t0, t1
311 311
312 /* Calculate this VPEs ID. If the core doesn't support MT use 0 */ 312 /* Calculate this VPEs ID. If the core doesn't support MT use 0 */
313 has_mt t6, 1f 313 has_mt ta2, 1f
314 li t9, 0 314 li t9, 0
315 315
316 /* Find the number of VPEs present in the core */ 316 /* Find the number of VPEs present in the core */
@@ -334,24 +334,24 @@ LEAF(mips_cps_boot_vpes)
3341: /* Calculate a pointer to this VPEs struct vpe_boot_config */ 3341: /* Calculate a pointer to this VPEs struct vpe_boot_config */
335 li t1, VPEBOOTCFG_SIZE 335 li t1, VPEBOOTCFG_SIZE
336 mul v0, t9, t1 336 mul v0, t9, t1
337 lw t7, COREBOOTCFG_VPECONFIG(t0) 337 PTR_L ta3, COREBOOTCFG_VPECONFIG(t0)
338 addu v0, v0, t7 338 PTR_ADDU v0, v0, ta3
339 339
340#ifdef CONFIG_MIPS_MT 340#ifdef CONFIG_MIPS_MT
341 341
342 /* If the core doesn't support MT then return */ 342 /* If the core doesn't support MT then return */
343 bnez t6, 1f 343 bnez ta2, 1f
344 nop 344 nop
345 jr ra 345 jr ra
346 nop 346 nop
347 347
348 .set push 348 .set push
349 .set mips32r2 349 .set mips64r2
350 .set mt 350 .set mt
351 351
3521: /* Enter VPE configuration state */ 3521: /* Enter VPE configuration state */
353 dvpe 353 dvpe
354 la t1, 1f 354 PTR_LA t1, 1f
355 jr.hb t1 355 jr.hb t1
356 nop 356 nop
3571: mfc0 t1, CP0_MVPCONTROL 3571: mfc0 t1, CP0_MVPCONTROL
@@ -360,12 +360,12 @@ LEAF(mips_cps_boot_vpes)
360 ehb 360 ehb
361 361
362 /* Loop through each VPE */ 362 /* Loop through each VPE */
363 lw t6, COREBOOTCFG_VPEMASK(t0) 363 PTR_L ta2, COREBOOTCFG_VPEMASK(t0)
364 move t8, t6 364 move t8, ta2
365 li t5, 0 365 li ta1, 0
366 366
367 /* Check whether the VPE should be running. If not, skip it */ 367 /* Check whether the VPE should be running. If not, skip it */
3681: andi t0, t6, 1 3681: andi t0, ta2, 1
369 beqz t0, 2f 369 beqz t0, 2f
370 nop 370 nop
371 371
@@ -373,7 +373,7 @@ LEAF(mips_cps_boot_vpes)
373 mfc0 t0, CP0_VPECONTROL 373 mfc0 t0, CP0_VPECONTROL
374 ori t0, t0, VPECONTROL_TARGTC 374 ori t0, t0, VPECONTROL_TARGTC
375 xori t0, t0, VPECONTROL_TARGTC 375 xori t0, t0, VPECONTROL_TARGTC
376 or t0, t0, t5 376 or t0, t0, ta1
377 mtc0 t0, CP0_VPECONTROL 377 mtc0 t0, CP0_VPECONTROL
378 ehb 378 ehb
379 379
@@ -384,8 +384,8 @@ LEAF(mips_cps_boot_vpes)
384 384
385 /* Calculate a pointer to the VPEs struct vpe_boot_config */ 385 /* Calculate a pointer to the VPEs struct vpe_boot_config */
386 li t0, VPEBOOTCFG_SIZE 386 li t0, VPEBOOTCFG_SIZE
387 mul t0, t0, t5 387 mul t0, t0, ta1
388 addu t0, t0, t7 388 addu t0, t0, ta3
389 389
390 /* Set the TC restart PC */ 390 /* Set the TC restart PC */
391 lw t1, VPEBOOTCFG_PC(t0) 391 lw t1, VPEBOOTCFG_PC(t0)
@@ -423,9 +423,9 @@ LEAF(mips_cps_boot_vpes)
423 mttc0 t0, CP0_VPECONF0 423 mttc0 t0, CP0_VPECONF0
424 424
425 /* Next VPE */ 425 /* Next VPE */
4262: srl t6, t6, 1 4262: srl ta2, ta2, 1
427 addiu t5, t5, 1 427 addiu ta1, ta1, 1
428 bnez t6, 1b 428 bnez ta2, 1b
429 nop 429 nop
430 430
431 /* Leave VPE configuration state */ 431 /* Leave VPE configuration state */
@@ -445,7 +445,7 @@ LEAF(mips_cps_boot_vpes)
445 /* This VPE should be offline, halt the TC */ 445 /* This VPE should be offline, halt the TC */
446 li t0, TCHALT_H 446 li t0, TCHALT_H
447 mtc0 t0, CP0_TCHALT 447 mtc0 t0, CP0_TCHALT
448 la t0, 1f 448 PTR_LA t0, 1f
4491: jr.hb t0 4491: jr.hb t0
450 nop 450 nop
451 451
@@ -466,10 +466,10 @@ LEAF(mips_cps_boot_vpes)
466 .set noat 466 .set noat
467 lw $1, TI_CPU(gp) 467 lw $1, TI_CPU(gp)
468 sll $1, $1, LONGLOG 468 sll $1, $1, LONGLOG
469 la \dest, __per_cpu_offset 469 PTR_LA \dest, __per_cpu_offset
470 addu $1, $1, \dest 470 addu $1, $1, \dest
471 lw $1, 0($1) 471 lw $1, 0($1)
472 la \dest, cps_cpu_state 472 PTR_LA \dest, cps_cpu_state
473 addu \dest, \dest, $1 473 addu \dest, \dest, $1
474 .set pop 474 .set pop
475 .endm 475 .endm
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 6e8de80bb446..4cc13508d967 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -73,10 +73,11 @@ NESTED(handle_sys, PT_SIZE, sp)
73 .set noreorder 73 .set noreorder
74 .set nomacro 74 .set nomacro
75 75
761: user_lw(t5, 16(t0)) # argument #5 from usp 76load_a4: user_lw(t5, 16(t0)) # argument #5 from usp
774: user_lw(t6, 20(t0)) # argument #6 from usp 77load_a5: user_lw(t6, 20(t0)) # argument #6 from usp
783: user_lw(t7, 24(t0)) # argument #7 from usp 78load_a6: user_lw(t7, 24(t0)) # argument #7 from usp
792: user_lw(t8, 28(t0)) # argument #8 from usp 79load_a7: user_lw(t8, 28(t0)) # argument #8 from usp
80loads_done:
80 81
81 sw t5, 16(sp) # argument #5 to ksp 82 sw t5, 16(sp) # argument #5 to ksp
82 sw t6, 20(sp) # argument #6 to ksp 83 sw t6, 20(sp) # argument #6 to ksp
@@ -85,10 +86,10 @@ NESTED(handle_sys, PT_SIZE, sp)
85 .set pop 86 .set pop
86 87
87 .section __ex_table,"a" 88 .section __ex_table,"a"
88 PTR 1b,bad_stack 89 PTR load_a4, bad_stack_a4
89 PTR 2b,bad_stack 90 PTR load_a5, bad_stack_a5
90 PTR 3b,bad_stack 91 PTR load_a6, bad_stack_a6
91 PTR 4b,bad_stack 92 PTR load_a7, bad_stack_a7
92 .previous 93 .previous
93 94
94 lw t0, TI_FLAGS($28) # syscall tracing enabled? 95 lw t0, TI_FLAGS($28) # syscall tracing enabled?
@@ -153,8 +154,8 @@ syscall_trace_entry:
153/* ------------------------------------------------------------------------ */ 154/* ------------------------------------------------------------------------ */
154 155
155 /* 156 /*
156 * The stackpointer for a call with more than 4 arguments is bad. 157 * Our open-coded access area sanity test for the stack pointer
157 * We probably should handle this case a bit more drastic. 158 * failed. We probably should handle this case a bit more drastic.
158 */ 159 */
159bad_stack: 160bad_stack:
160 li v0, EFAULT 161 li v0, EFAULT
@@ -163,6 +164,22 @@ bad_stack:
163 sw t0, PT_R7(sp) 164 sw t0, PT_R7(sp)
164 j o32_syscall_exit 165 j o32_syscall_exit
165 166
167bad_stack_a4:
168 li t5, 0
169 b load_a5
170
171bad_stack_a5:
172 li t6, 0
173 b load_a6
174
175bad_stack_a6:
176 li t7, 0
177 b load_a7
178
179bad_stack_a7:
180 li t8, 0
181 b loads_done
182
166 /* 183 /*
167 * The system call does not exist in this kernel 184 * The system call does not exist in this kernel
168 */ 185 */
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index d07b210fbeff..f543ff4feef9 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -69,16 +69,17 @@ NESTED(handle_sys, PT_SIZE, sp)
69 daddu t1, t0, 32 69 daddu t1, t0, 32
70 bltz t1, bad_stack 70 bltz t1, bad_stack
71 71
721: lw a4, 16(t0) # argument #5 from usp 72load_a4: lw a4, 16(t0) # argument #5 from usp
732: lw a5, 20(t0) # argument #6 from usp 73load_a5: lw a5, 20(t0) # argument #6 from usp
743: lw a6, 24(t0) # argument #7 from usp 74load_a6: lw a6, 24(t0) # argument #7 from usp
754: lw a7, 28(t0) # argument #8 from usp (for indirect syscalls) 75load_a7: lw a7, 28(t0) # argument #8 from usp
76loads_done:
76 77
77 .section __ex_table,"a" 78 .section __ex_table,"a"
78 PTR 1b, bad_stack 79 PTR load_a4, bad_stack_a4
79 PTR 2b, bad_stack 80 PTR load_a5, bad_stack_a5
80 PTR 3b, bad_stack 81 PTR load_a6, bad_stack_a6
81 PTR 4b, bad_stack 82 PTR load_a7, bad_stack_a7
82 .previous 83 .previous
83 84
84 li t1, _TIF_WORK_SYSCALL_ENTRY 85 li t1, _TIF_WORK_SYSCALL_ENTRY
@@ -167,6 +168,22 @@ bad_stack:
167 sd t0, PT_R7(sp) 168 sd t0, PT_R7(sp)
168 j o32_syscall_exit 169 j o32_syscall_exit
169 170
171bad_stack_a4:
172 li a4, 0
173 b load_a5
174
175bad_stack_a5:
176 li a5, 0
177 b load_a6
178
179bad_stack_a6:
180 li a6, 0
181 b load_a7
182
183bad_stack_a7:
184 li a7, 0
185 b loads_done
186
170not_o32_scall: 187not_o32_scall:
171 /* 188 /*
172 * This is not an o32 compatibility syscall, pass it on 189 * This is not an o32 compatibility syscall, pass it on
@@ -383,7 +400,7 @@ EXPORT(sys32_call_table)
383 PTR sys_connect /* 4170 */ 400 PTR sys_connect /* 4170 */
384 PTR sys_getpeername 401 PTR sys_getpeername
385 PTR sys_getsockname 402 PTR sys_getsockname
386 PTR sys_getsockopt 403 PTR compat_sys_getsockopt
387 PTR sys_listen 404 PTR sys_listen
388 PTR compat_sys_recv /* 4175 */ 405 PTR compat_sys_recv /* 4175 */
389 PTR compat_sys_recvfrom 406 PTR compat_sys_recvfrom
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index be73c491182b..008b3378653a 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -337,6 +337,11 @@ static void __init bootmem_init(void)
337 min_low_pfn = start; 337 min_low_pfn = start;
338 if (end <= reserved_end) 338 if (end <= reserved_end)
339 continue; 339 continue;
340#ifdef CONFIG_BLK_DEV_INITRD
341 /* mapstart should be after initrd_end */
342 if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end)))
343 continue;
344#endif
340 if (start >= mapstart) 345 if (start >= mapstart)
341 continue; 346 continue;
342 mapstart = max(reserved_end, start); 347 mapstart = max(reserved_end, start);
@@ -366,14 +371,6 @@ static void __init bootmem_init(void)
366 max_low_pfn = PFN_DOWN(HIGHMEM_START); 371 max_low_pfn = PFN_DOWN(HIGHMEM_START);
367 } 372 }
368 373
369#ifdef CONFIG_BLK_DEV_INITRD
370 /*
371 * mapstart should be after initrd_end
372 */
373 if (initrd_end)
374 mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end)));
375#endif
376
377 /* 374 /*
378 * Initialize the boot-time allocator with low memory only. 375 * Initialize the boot-time allocator with low memory only.
379 */ 376 */
diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
index 4251d390b5b6..c88937745b4e 100644
--- a/arch/mips/kernel/smp-cps.c
+++ b/arch/mips/kernel/smp-cps.c
@@ -133,7 +133,7 @@ static void __init cps_prepare_cpus(unsigned int max_cpus)
133 /* 133 /*
134 * Patch the start of mips_cps_core_entry to provide: 134 * Patch the start of mips_cps_core_entry to provide:
135 * 135 *
136 * v0 = CM base address 136 * v1 = CM base address
137 * s0 = kseg0 CCA 137 * s0 = kseg0 CCA
138 */ 138 */
139 entry_code = (u32 *)&mips_cps_core_entry; 139 entry_code = (u32 *)&mips_cps_core_entry;
@@ -369,7 +369,7 @@ void play_dead(void)
369 369
370static void wait_for_sibling_halt(void *ptr_cpu) 370static void wait_for_sibling_halt(void *ptr_cpu)
371{ 371{
372 unsigned cpu = (unsigned)ptr_cpu; 372 unsigned cpu = (unsigned long)ptr_cpu;
373 unsigned vpe_id = cpu_vpe_id(&cpu_data[cpu]); 373 unsigned vpe_id = cpu_vpe_id(&cpu_data[cpu]);
374 unsigned halted; 374 unsigned halted;
375 unsigned long flags; 375 unsigned long flags;
@@ -430,7 +430,7 @@ static void cps_cpu_die(unsigned int cpu)
430 */ 430 */
431 err = smp_call_function_single(cpu_death_sibling, 431 err = smp_call_function_single(cpu_death_sibling,
432 wait_for_sibling_halt, 432 wait_for_sibling_halt,
433 (void *)cpu, 1); 433 (void *)(unsigned long)cpu, 1);
434 if (err) 434 if (err)
435 panic("Failed to call remote sibling CPU\n"); 435 panic("Failed to call remote sibling CPU\n");
436 } 436 }
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index faa46ebd9dda..d0744cc77ea7 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -63,6 +63,13 @@ EXPORT_SYMBOL(cpu_sibling_map);
63cpumask_t cpu_core_map[NR_CPUS] __read_mostly; 63cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
64EXPORT_SYMBOL(cpu_core_map); 64EXPORT_SYMBOL(cpu_core_map);
65 65
66/*
67 * A logcal cpu mask containing only one VPE per core to
68 * reduce the number of IPIs on large MT systems.
69 */
70cpumask_t cpu_foreign_map __read_mostly;
71EXPORT_SYMBOL(cpu_foreign_map);
72
66/* representing cpus for which sibling maps can be computed */ 73/* representing cpus for which sibling maps can be computed */
67static cpumask_t cpu_sibling_setup_map; 74static cpumask_t cpu_sibling_setup_map;
68 75
@@ -103,6 +110,29 @@ static inline void set_cpu_core_map(int cpu)
103 } 110 }
104} 111}
105 112
113/*
114 * Calculate a new cpu_foreign_map mask whenever a
115 * new cpu appears or disappears.
116 */
117static inline void calculate_cpu_foreign_map(void)
118{
119 int i, k, core_present;
120 cpumask_t temp_foreign_map;
121
122 /* Re-calculate the mask */
123 for_each_online_cpu(i) {
124 core_present = 0;
125 for_each_cpu(k, &temp_foreign_map)
126 if (cpu_data[i].package == cpu_data[k].package &&
127 cpu_data[i].core == cpu_data[k].core)
128 core_present = 1;
129 if (!core_present)
130 cpumask_set_cpu(i, &temp_foreign_map);
131 }
132
133 cpumask_copy(&cpu_foreign_map, &temp_foreign_map);
134}
135
106struct plat_smp_ops *mp_ops; 136struct plat_smp_ops *mp_ops;
107EXPORT_SYMBOL(mp_ops); 137EXPORT_SYMBOL(mp_ops);
108 138
@@ -146,6 +176,8 @@ asmlinkage void start_secondary(void)
146 set_cpu_sibling_map(cpu); 176 set_cpu_sibling_map(cpu);
147 set_cpu_core_map(cpu); 177 set_cpu_core_map(cpu);
148 178
179 calculate_cpu_foreign_map();
180
149 cpumask_set_cpu(cpu, &cpu_callin_map); 181 cpumask_set_cpu(cpu, &cpu_callin_map);
150 182
151 synchronise_count_slave(cpu); 183 synchronise_count_slave(cpu);
@@ -173,9 +205,18 @@ void __irq_entry smp_call_function_interrupt(void)
173static void stop_this_cpu(void *dummy) 205static void stop_this_cpu(void *dummy)
174{ 206{
175 /* 207 /*
176 * Remove this CPU: 208 * Remove this CPU. Be a bit slow here and
209 * set the bits for every online CPU so we don't miss
210 * any IPI whilst taking this VPE down.
177 */ 211 */
212
213 cpumask_copy(&cpu_foreign_map, cpu_online_mask);
214
215 /* Make it visible to every other CPU */
216 smp_mb();
217
178 set_cpu_online(smp_processor_id(), false); 218 set_cpu_online(smp_processor_id(), false);
219 calculate_cpu_foreign_map();
179 local_irq_disable(); 220 local_irq_disable();
180 while (1); 221 while (1);
181} 222}
@@ -197,6 +238,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
197 mp_ops->prepare_cpus(max_cpus); 238 mp_ops->prepare_cpus(max_cpus);
198 set_cpu_sibling_map(0); 239 set_cpu_sibling_map(0);
199 set_cpu_core_map(0); 240 set_cpu_core_map(0);
241 calculate_cpu_foreign_map();
200#ifndef CONFIG_HOTPLUG_CPU 242#ifndef CONFIG_HOTPLUG_CPU
201 init_cpu_present(cpu_possible_mask); 243 init_cpu_present(cpu_possible_mask);
202#endif 244#endif
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 2a7b38ed23f0..e207a43b5f8f 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -2130,10 +2130,10 @@ void per_cpu_trap_init(bool is_boot_cpu)
2130 BUG_ON(current->mm); 2130 BUG_ON(current->mm);
2131 enter_lazy_tlb(&init_mm, current); 2131 enter_lazy_tlb(&init_mm, current);
2132 2132
2133 /* Boot CPU's cache setup in setup_arch(). */ 2133 /* Boot CPU's cache setup in setup_arch(). */
2134 if (!is_boot_cpu) 2134 if (!is_boot_cpu)
2135 cpu_cache_init(); 2135 cpu_cache_init();
2136 tlb_init(); 2136 tlb_init();
2137 TLBMISS_HANDLER_SETUP(); 2137 TLBMISS_HANDLER_SETUP();
2138} 2138}
2139 2139
diff --git a/arch/mips/loongson64/common/bonito-irq.c b/arch/mips/loongson64/common/bonito-irq.c
index cc0e4fd548e6..4e116d23bab3 100644
--- a/arch/mips/loongson64/common/bonito-irq.c
+++ b/arch/mips/loongson64/common/bonito-irq.c
@@ -3,7 +3,7 @@
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org) 4 * Copyright (C) 2000, 2001 Ralf Baechle (ralf@gnu.org)
5 * 5 *
6 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 6 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
7 * Author: Fuxin Zhang, zhangfx@lemote.com 7 * Author: Fuxin Zhang, zhangfx@lemote.com
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
diff --git a/arch/mips/loongson64/common/cmdline.c b/arch/mips/loongson64/common/cmdline.c
index 72fed003a536..01fbed137028 100644
--- a/arch/mips/loongson64/common/cmdline.c
+++ b/arch/mips/loongson64/common/cmdline.c
@@ -6,7 +6,7 @@
6 * Copyright 2003 ICT CAS 6 * Copyright 2003 ICT CAS
7 * Author: Michael Guo <guoyi@ict.ac.cn> 7 * Author: Michael Guo <guoyi@ict.ac.cn>
8 * 8 *
9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 9 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
10 * Author: Fuxin Zhang, zhangfx@lemote.com 10 * Author: Fuxin Zhang, zhangfx@lemote.com
11 * 11 *
12 * Copyright (C) 2009 Lemote Inc. 12 * Copyright (C) 2009 Lemote Inc.
diff --git a/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
index 12c75db23420..875037063a80 100644
--- a/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
+++ b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * CS5536 General timer functions 2 * CS5536 General timer functions
3 * 3 *
4 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 4 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
5 * Author: Yanhua, yanh@lemote.com 5 * Author: Yanhua, yanh@lemote.com
6 * 6 *
7 * Copyright (C) 2009 Lemote Inc. 7 * Copyright (C) 2009 Lemote Inc.
diff --git a/arch/mips/loongson64/common/env.c b/arch/mips/loongson64/common/env.c
index 22f04ca2ff3e..f6c44dd332e2 100644
--- a/arch/mips/loongson64/common/env.c
+++ b/arch/mips/loongson64/common/env.c
@@ -6,7 +6,7 @@
6 * Copyright 2003 ICT CAS 6 * Copyright 2003 ICT CAS
7 * Author: Michael Guo <guoyi@ict.ac.cn> 7 * Author: Michael Guo <guoyi@ict.ac.cn>
8 * 8 *
9 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 9 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
10 * Author: Fuxin Zhang, zhangfx@lemote.com 10 * Author: Fuxin Zhang, zhangfx@lemote.com
11 * 11 *
12 * Copyright (C) 2009 Lemote Inc. 12 * Copyright (C) 2009 Lemote Inc.
diff --git a/arch/mips/loongson64/common/irq.c b/arch/mips/loongson64/common/irq.c
index 687003b19b45..d36d969a4a87 100644
--- a/arch/mips/loongson64/common/irq.c
+++ b/arch/mips/loongson64/common/irq.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 2 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com 3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
diff --git a/arch/mips/loongson64/common/setup.c b/arch/mips/loongson64/common/setup.c
index d477dd6bb326..2dc5122f0e09 100644
--- a/arch/mips/loongson64/common/setup.c
+++ b/arch/mips/loongson64/common/setup.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 2 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com 3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
diff --git a/arch/mips/loongson64/fuloong-2e/irq.c b/arch/mips/loongson64/fuloong-2e/irq.c
index ef5ec8f3de5f..892963f860b7 100644
--- a/arch/mips/loongson64/fuloong-2e/irq.c
+++ b/arch/mips/loongson64/fuloong-2e/irq.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology 2 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
3 * Author: Fuxin Zhang, zhangfx@lemote.com 3 * Author: Fuxin Zhang, zhangfx@lemote.com
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
diff --git a/arch/mips/loongson64/lemote-2f/clock.c b/arch/mips/loongson64/lemote-2f/clock.c
index 462e34d46b4a..a78fb657068c 100644
--- a/arch/mips/loongson64/lemote-2f/clock.c
+++ b/arch/mips/loongson64/lemote-2f/clock.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology 2 * Copyright (C) 2006 - 2008 Lemote Inc. & Institute of Computing Technology
3 * Author: Yanhua, yanh@lemote.com 3 * Author: Yanhua, yanh@lemote.com
4 * 4 *
5 * This file is subject to the terms and conditions of the GNU General Public 5 * This file is subject to the terms and conditions of the GNU General Public
@@ -15,7 +15,7 @@
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16 16
17#include <asm/clock.h> 17#include <asm/clock.h>
18#include <asm/mach-loongson/loongson.h> 18#include <asm/mach-loongson64/loongson.h>
19 19
20static LIST_HEAD(clock_list); 20static LIST_HEAD(clock_list);
21static DEFINE_SPINLOCK(clock_lock); 21static DEFINE_SPINLOCK(clock_lock);
diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c
index 12d14ed48778..6f9e010cec4d 100644
--- a/arch/mips/loongson64/loongson-3/numa.c
+++ b/arch/mips/loongson64/loongson-3/numa.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2010 Loongson Inc. & Lemote Inc. & 2 * Copyright (C) 2010 Loongson Inc. & Lemote Inc. &
3 * Insititute of Computing Technology 3 * Institute of Computing Technology
4 * Author: Xiang Gao, gaoxiang@ict.ac.cn 4 * Author: Xiang Gao, gaoxiang@ict.ac.cn
5 * Huacai Chen, chenhc@lemote.com 5 * Huacai Chen, chenhc@lemote.com
6 * Xiaofu Meng, Shuangshuang Zhang 6 * Xiaofu Meng, Shuangshuang Zhang
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 22b9b2cb9219..712f17a2ecf2 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -451,7 +451,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
451 /* Fall through */ 451 /* Fall through */
452 case jr_op: 452 case jr_op:
453 /* For R6, JR already emulated in jalr_op */ 453 /* For R6, JR already emulated in jalr_op */
454 if (NO_R6EMU && insn.r_format.opcode == jr_op) 454 if (NO_R6EMU && insn.r_format.func == jr_op)
455 break; 455 break;
456 *contpc = regs->regs[insn.r_format.rs]; 456 *contpc = regs->regs[insn.r_format.rs];
457 return 1; 457 return 1;
@@ -551,7 +551,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
551 dec_insn.next_pc_inc; 551 dec_insn.next_pc_inc;
552 return 1; 552 return 1;
553 case blezl_op: 553 case blezl_op:
554 if (NO_R6EMU) 554 if (!insn.i_format.rt && NO_R6EMU)
555 break; 555 break;
556 case blez_op: 556 case blez_op:
557 557
@@ -588,7 +588,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
588 dec_insn.next_pc_inc; 588 dec_insn.next_pc_inc;
589 return 1; 589 return 1;
590 case bgtzl_op: 590 case bgtzl_op:
591 if (NO_R6EMU) 591 if (!insn.i_format.rt && NO_R6EMU)
592 break; 592 break;
593 case bgtz_op: 593 case bgtz_op:
594 /* 594 /*
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 7f660dc67596..fbea4432f3f2 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -37,6 +37,7 @@
37#include <asm/cacheflush.h> /* for run_uncached() */ 37#include <asm/cacheflush.h> /* for run_uncached() */
38#include <asm/traps.h> 38#include <asm/traps.h>
39#include <asm/dma-coherence.h> 39#include <asm/dma-coherence.h>
40#include <asm/mips-cm.h>
40 41
41/* 42/*
42 * Special Variant of smp_call_function for use by cache functions: 43 * Special Variant of smp_call_function for use by cache functions:
@@ -51,9 +52,16 @@ static inline void r4k_on_each_cpu(void (*func) (void *info), void *info)
51{ 52{
52 preempt_disable(); 53 preempt_disable();
53 54
54#ifndef CONFIG_MIPS_MT_SMP 55 /*
55 smp_call_function(func, info, 1); 56 * The Coherent Manager propagates address-based cache ops to other
56#endif 57 * cores but not index-based ops. However, r4k_on_each_cpu is used
58 * in both cases so there is no easy way to tell what kind of op is
59 * executed to the other cores. The best we can probably do is
60 * to restrict that call when a CM is not present because both
61 * CM-based SMP protocols (CMP & CPS) restrict index-based cache ops.
62 */
63 if (!mips_cm_present())
64 smp_call_function_many(&cpu_foreign_map, func, info, 1);
57 func(info); 65 func(info);
58 preempt_enable(); 66 preempt_enable();
59} 67}
@@ -937,7 +945,9 @@ static void b5k_instruction_hazard(void)
937} 945}
938 946
939static char *way_string[] = { NULL, "direct mapped", "2-way", 947static char *way_string[] = { NULL, "direct mapped", "2-way",
940 "3-way", "4-way", "5-way", "6-way", "7-way", "8-way" 948 "3-way", "4-way", "5-way", "6-way", "7-way", "8-way",
949 "9-way", "10-way", "11-way", "12-way",
950 "13-way", "14-way", "15-way", "16-way",
941}; 951};
942 952
943static void probe_pcache(void) 953static void probe_pcache(void)
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c
index 185e68261f45..5625b190edc0 100644
--- a/arch/mips/mti-malta/malta-time.c
+++ b/arch/mips/mti-malta/malta-time.c
@@ -119,18 +119,24 @@ void read_persistent_clock(struct timespec *ts)
119 119
120int get_c0_fdc_int(void) 120int get_c0_fdc_int(void)
121{ 121{
122 int mips_cpu_fdc_irq; 122 /*
123 * Some cores claim the FDC is routable through the GIC, but it doesn't
124 * actually seem to be connected for those Malta bitstreams.
125 */
126 switch (current_cpu_type()) {
127 case CPU_INTERAPTIV:
128 case CPU_PROAPTIV:
129 return -1;
130 };
123 131
124 if (cpu_has_veic) 132 if (cpu_has_veic)
125 mips_cpu_fdc_irq = -1; 133 return -1;
126 else if (gic_present) 134 else if (gic_present)
127 mips_cpu_fdc_irq = gic_get_c0_fdc_int(); 135 return gic_get_c0_fdc_int();
128 else if (cp0_fdc_irq >= 0) 136 else if (cp0_fdc_irq >= 0)
129 mips_cpu_fdc_irq = MIPS_CPU_IRQ_BASE + cp0_fdc_irq; 137 return MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
130 else 138 else
131 mips_cpu_fdc_irq = -1; 139 return -1;
132
133 return mips_cpu_fdc_irq;
134} 140}
135 141
136int get_c0_perfcount_int(void) 142int get_c0_perfcount_int(void)
diff --git a/arch/mips/pistachio/init.c b/arch/mips/pistachio/init.c
index d2dc836523a3..8bd8ebb20a72 100644
--- a/arch/mips/pistachio/init.c
+++ b/arch/mips/pistachio/init.c
@@ -63,13 +63,19 @@ void __init plat_mem_setup(void)
63 plat_setup_iocoherency(); 63 plat_setup_iocoherency();
64} 64}
65 65
66#define DEFAULT_CPC_BASE_ADDR 0x1bde0000 66#define DEFAULT_CPC_BASE_ADDR 0x1bde0000
67#define DEFAULT_CDMM_BASE_ADDR 0x1bdd0000
67 68
68phys_addr_t mips_cpc_default_phys_base(void) 69phys_addr_t mips_cpc_default_phys_base(void)
69{ 70{
70 return DEFAULT_CPC_BASE_ADDR; 71 return DEFAULT_CPC_BASE_ADDR;
71} 72}
72 73
74phys_addr_t mips_cdmm_phys_base(void)
75{
76 return DEFAULT_CDMM_BASE_ADDR;
77}
78
73static void __init mips_nmi_setup(void) 79static void __init mips_nmi_setup(void)
74{ 80{
75 void *base; 81 void *base;
diff --git a/arch/mips/pistachio/time.c b/arch/mips/pistachio/time.c
index 67889fcea8aa..7c73fcb92a10 100644
--- a/arch/mips/pistachio/time.c
+++ b/arch/mips/pistachio/time.c
@@ -27,6 +27,11 @@ int get_c0_perfcount_int(void)
27 return gic_get_c0_perfcount_int(); 27 return gic_get_c0_perfcount_int();
28} 28}
29 29
30int get_c0_fdc_int(void)
31{
32 return gic_get_c0_fdc_int();
33}
34
30void __init plat_time_init(void) 35void __init plat_time_init(void)
31{ 36{
32 struct device_node *np; 37 struct device_node *np;
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c
index fc897babab55..e362860c2b50 100644
--- a/drivers/cpufreq/loongson2_cpufreq.c
+++ b/drivers/cpufreq/loongson2_cpufreq.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * The 2E revision of loongson processor not support this feature. 4 * The 2E revision of loongson processor not support this feature.
5 * 5 *
6 * Copyright (C) 2006 - 2008 Lemote Inc. & Insititute of Computing Technology 6 * Copyright (C) 2006 - 2008 Lemote Inc. & Institute of Computing Technology
7 * Author: Yanhua, yanh@lemote.com 7 * Author: Yanhua, yanh@lemote.com
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index 4400edd1a6c7..b7d54d428b5e 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -257,16 +257,6 @@ int gic_get_c0_fdc_int(void)
257 return MIPS_CPU_IRQ_BASE + cp0_fdc_irq; 257 return MIPS_CPU_IRQ_BASE + cp0_fdc_irq;
258 } 258 }
259 259
260 /*
261 * Some cores claim the FDC is routable but it doesn't actually seem to
262 * be connected.
263 */
264 switch (current_cpu_type()) {
265 case CPU_INTERAPTIV:
266 case CPU_PROAPTIV:
267 return -1;
268 }
269
270 return irq_create_mapping(gic_irq_domain, 260 return irq_create_mapping(gic_irq_domain,
271 GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC)); 261 GIC_LOCAL_TO_HWIRQ(GIC_LOCAL_INT_FDC));
272} 262}