aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-20 15:02:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-20 15:02:02 -0400
commitd75e2c9ad97c40f6d2cdaf2e16381b2034d19a6f (patch)
treeac57cedfc4defbd82a65f9fe0e722397d898bc74 /arch/mips
parent935173744abe86278074ad8f131c1932276b1ac1 (diff)
parent85a053fa5f2d67ae5b2968305b16e8d2fe4cdf4d (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull late MIPS fixes from Ralf Baechle: "This fixes a number of lose ends in the MIPS code and various bug fixes. Aside of dropping some patch that should not be in this pull request everything has sat in -next for quite a while and there are no known issues. The biggest patch in this patch set moves the allocation of an array that is aliased to a function (for runtime generated code) to assembler code. This avoids an issue with certain toolchains when building for microMIPS." * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (35 commits) MIPS: PCI: Move fixups from __init to __devinit. MIPS: Fix bug.h MIPS build regression MIPS: sync-r4k: remove redundant irq operation MIPS: smp: Warn on too early irq enable MIPS: call set_cpu_online() on cpu being brought up with irq disabled MIPS: call ->smp_finish() a little late MIPS: Yosemite: delay irq enable to ->smp_finish() MIPS: SMTC: delay irq enable to ->smp_finish() MIPS: BMIPS: delay irq enable to ->smp_finish() MIPS: Octeon: delay enable irq to ->smp_finish() MIPS: Oprofile: Fix build as a module. MIPS: BCM63XX: Fix BCM6368 IPSec clock bit MIPS: perf: Fix build error caused by unused counters_per_cpu_to_total() MIPS: Fix Magic SysRq L kernel crash. MIPS: BMIPS: Fix duplicate header inclusion. mips: mark const init data with __initconst instead of __initdata MIPS: cmpxchg.h: Add missing include MIPS: Malta may also be equipped with MIPS64 R2 processors. MIPS: Fix typo multipy -> multiply MIPS: Cavium: Fix duplicate ARCH_SPARSEMEM_ENABLE in kconfig. ...
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/bcm47xx/Kconfig1
-rw-r--r--arch/mips/bcm63xx/dev-pcmcia.c4
-rw-r--r--arch/mips/cavium-octeon/Kconfig4
-rw-r--r--arch/mips/cavium-octeon/smp.c2
-rw-r--r--arch/mips/include/asm/cmpxchg.h1
-rw-r--r--arch/mips/include/asm/cpu.h7
-rw-r--r--arch/mips/include/asm/gic.h15
-rw-r--r--arch/mips/include/asm/inst.h4
-rw-r--r--arch/mips/include/asm/irq.h1
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h2
-rw-r--r--arch/mips/include/asm/mips-boards/maltaint.h10
-rw-r--r--arch/mips/include/asm/mipsmtregs.h2
-rw-r--r--arch/mips/include/asm/switch_to.h6
-rw-r--r--arch/mips/include/asm/thread_info.h4
-rw-r--r--arch/mips/kernel/cpu-probe.c11
-rw-r--r--arch/mips/kernel/mips_ksyms.c8
-rw-r--r--arch/mips/kernel/octeon_switch.S2
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c5
-rw-r--r--arch/mips/kernel/r2300_switch.S15
-rw-r--r--arch/mips/kernel/r4k_switch.S12
-rw-r--r--arch/mips/kernel/smp-bmips.c15
-rw-r--r--arch/mips/kernel/smp.c12
-rw-r--r--arch/mips/kernel/smtc.c13
-rw-r--r--arch/mips/kernel/sync-r4k.c5
-rw-r--r--arch/mips/kernel/traps.c7
-rw-r--r--arch/mips/kernel/vmlinux.lds.S3
-rw-r--r--arch/mips/mm/Makefile4
-rw-r--r--arch/mips/mm/c-r4k.c5
-rw-r--r--arch/mips/mm/page-funcs.S50
-rw-r--r--arch/mips/mm/page.c67
-rw-r--r--arch/mips/mm/tlbex.c2
-rw-r--r--arch/mips/mti-malta/malta-pci.c7
-rw-r--r--arch/mips/mti-malta/malta-setup.c2
-rw-r--r--arch/mips/netlogic/xlp/setup.c8
-rw-r--r--arch/mips/oprofile/common.c1
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c4
-rw-r--r--arch/mips/pci/fixup-fuloong2e.c12
-rw-r--r--arch/mips/pci/fixup-lemote2f.c12
-rw-r--r--arch/mips/pci/fixup-malta.c6
-rw-r--r--arch/mips/pci/fixup-mpc30x.c4
-rw-r--r--arch/mips/pci/fixup-sb1250.c6
-rw-r--r--arch/mips/pci/ops-tx4927.c2
-rw-r--r--arch/mips/pci/pci-ip27.c2
-rw-r--r--arch/mips/pci/pci-xlr.c61
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c2
-rw-r--r--arch/mips/powertv/asic/asic-calliope.c2
-rw-r--r--arch/mips/powertv/asic/asic-cronus.c2
-rw-r--r--arch/mips/powertv/asic/asic-gaia.c2
-rw-r--r--arch/mips/powertv/asic/asic-zeus.c2
-rw-r--r--arch/mips/txx9/generic/pci.c2
51 files changed, 272 insertions, 168 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 09ab87ee6fef..b3e10fdd3898 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -288,6 +288,7 @@ config MIPS_MALTA
288 select SYS_HAS_CPU_MIPS32_R1 288 select SYS_HAS_CPU_MIPS32_R1
289 select SYS_HAS_CPU_MIPS32_R2 289 select SYS_HAS_CPU_MIPS32_R2
290 select SYS_HAS_CPU_MIPS64_R1 290 select SYS_HAS_CPU_MIPS64_R1
291 select SYS_HAS_CPU_MIPS64_R2
291 select SYS_HAS_CPU_NEVADA 292 select SYS_HAS_CPU_NEVADA
292 select SYS_HAS_CPU_RM7000 293 select SYS_HAS_CPU_RM7000
293 select SYS_HAS_EARLY_PRINTK 294 select SYS_HAS_EARLY_PRINTK
@@ -1423,6 +1424,7 @@ config CPU_SB1
1423config CPU_CAVIUM_OCTEON 1424config CPU_CAVIUM_OCTEON
1424 bool "Cavium Octeon processor" 1425 bool "Cavium Octeon processor"
1425 depends on SYS_HAS_CPU_CAVIUM_OCTEON 1426 depends on SYS_HAS_CPU_CAVIUM_OCTEON
1427 select ARCH_SPARSEMEM_ENABLE
1426 select CPU_HAS_PREFETCH 1428 select CPU_HAS_PREFETCH
1427 select CPU_SUPPORTS_64BIT_KERNEL 1429 select CPU_SUPPORTS_64BIT_KERNEL
1428 select SYS_SUPPORTS_SMP 1430 select SYS_SUPPORTS_SMP
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
index 6210b8d84109..b311be45a720 100644
--- a/arch/mips/bcm47xx/Kconfig
+++ b/arch/mips/bcm47xx/Kconfig
@@ -21,6 +21,7 @@ config BCM47XX_BCMA
21 select BCMA 21 select BCMA
22 select BCMA_HOST_SOC 22 select BCMA_HOST_SOC
23 select BCMA_DRIVER_MIPS 23 select BCMA_DRIVER_MIPS
24 select BCMA_HOST_PCI if PCI
24 select BCMA_DRIVER_PCI_HOSTMODE if PCI 25 select BCMA_DRIVER_PCI_HOSTMODE if PCI
25 default y 26 default y
26 help 27 help
diff --git a/arch/mips/bcm63xx/dev-pcmcia.c b/arch/mips/bcm63xx/dev-pcmcia.c
index de4d917fd54d..a551bab5ecb9 100644
--- a/arch/mips/bcm63xx/dev-pcmcia.c
+++ b/arch/mips/bcm63xx/dev-pcmcia.c
@@ -79,11 +79,11 @@ static int __init config_pcmcia_cs(unsigned int cs,
79 return ret; 79 return ret;
80} 80}
81 81
82static const __initdata struct { 82static const struct {
83 unsigned int cs; 83 unsigned int cs;
84 unsigned int base; 84 unsigned int base;
85 unsigned int size; 85 unsigned int size;
86} pcmcia_cs[3] = { 86} pcmcia_cs[3] __initconst = {
87 { 87 {
88 .cs = MPI_CS_PCMCIA_COMMON, 88 .cs = MPI_CS_PCMCIA_COMMON,
89 .base = BCM_PCMCIA_COMMON_BASE_PA, 89 .base = BCM_PCMCIA_COMMON_BASE_PA,
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index f9e275a50d98..2f4f6d5e05b6 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -82,10 +82,6 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
82 help 82 help
83 Lock the kernel's implementation of memcpy() into L2. 83 Lock the kernel's implementation of memcpy() into L2.
84 84
85config ARCH_SPARSEMEM_ENABLE
86 def_bool y
87 select SPARSEMEM_STATIC
88
89config IOMMU_HELPER 85config IOMMU_HELPER
90 bool 86 bool
91 87
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 4b93048044eb..ee1fb9f7f517 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -185,7 +185,6 @@ static void __cpuinit octeon_init_secondary(void)
185 octeon_init_cvmcount(); 185 octeon_init_cvmcount();
186 186
187 octeon_irq_setup_secondary(); 187 octeon_irq_setup_secondary();
188 raw_local_irq_enable();
189} 188}
190 189
191/** 190/**
@@ -233,6 +232,7 @@ static void octeon_smp_finish(void)
233 232
234 /* to generate the first CPU timer interrupt */ 233 /* to generate the first CPU timer interrupt */
235 write_c0_compare(read_c0_count() + mips_hpt_frequency / HZ); 234 write_c0_compare(read_c0_count() + mips_hpt_frequency / HZ);
235 local_irq_enable();
236} 236}
237 237
238/** 238/**
diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
index 285a41fa0b18..eee10dc07ac1 100644
--- a/arch/mips/include/asm/cmpxchg.h
+++ b/arch/mips/include/asm/cmpxchg.h
@@ -8,6 +8,7 @@
8#ifndef __ASM_CMPXCHG_H 8#ifndef __ASM_CMPXCHG_H
9#define __ASM_CMPXCHG_H 9#define __ASM_CMPXCHG_H
10 10
11#include <linux/bug.h>
11#include <linux/irqflags.h> 12#include <linux/irqflags.h>
12#include <asm/war.h> 13#include <asm/war.h>
13 14
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index f9fa2a479dd0..95e40c1e8ed1 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -94,6 +94,7 @@
94#define PRID_IMP_24KE 0x9600 94#define PRID_IMP_24KE 0x9600
95#define PRID_IMP_74K 0x9700 95#define PRID_IMP_74K 0x9700
96#define PRID_IMP_1004K 0x9900 96#define PRID_IMP_1004K 0x9900
97#define PRID_IMP_M14KC 0x9c00
97 98
98/* 99/*
99 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE 100 * These are the PRID's for when 23:16 == PRID_COMP_SIBYTE
@@ -260,12 +261,12 @@ enum cpu_type_enum {
260 */ 261 */
261 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, 262 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
262 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350, 263 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350,
263 CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, 264 CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC, CPU_M14KC,
264 265
265 /* 266 /*
266 * MIPS64 class processors 267 * MIPS64 class processors
267 */ 268 */
268 CPU_5KC, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2, 269 CPU_5KC, CPU_5KE, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2,
269 CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS, CPU_CAVIUM_OCTEON2, 270 CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS, CPU_CAVIUM_OCTEON2,
270 CPU_XLR, CPU_XLP, 271 CPU_XLR, CPU_XLP,
271 272
@@ -288,7 +289,7 @@ enum cpu_type_enum {
288#define MIPS_CPU_ISA_M64R2 0x00000100 289#define MIPS_CPU_ISA_M64R2 0x00000100
289 290
290#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | \ 291#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | \
291 MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 ) 292 MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2)
292#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \ 293#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \
293 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2) 294 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)
294 295
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 86548da650e7..991b659e2548 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -206,7 +206,7 @@
206 206
207#define GIC_VPE_EIC_SHADOW_SET_BASE 0x0100 207#define GIC_VPE_EIC_SHADOW_SET_BASE 0x0100
208#define GIC_VPE_EIC_SS(intr) \ 208#define GIC_VPE_EIC_SS(intr) \
209 (GIC_EIC_SHADOW_SET_BASE + (4 * intr)) 209 (GIC_VPE_EIC_SHADOW_SET_BASE + (4 * intr))
210 210
211#define GIC_VPE_EIC_VEC_BASE 0x0800 211#define GIC_VPE_EIC_VEC_BASE 0x0800
212#define GIC_VPE_EIC_VEC(intr) \ 212#define GIC_VPE_EIC_VEC(intr) \
@@ -330,6 +330,17 @@ struct gic_intr_map {
330#define GIC_FLAG_TRANSPARENT 0x02 330#define GIC_FLAG_TRANSPARENT 0x02
331}; 331};
332 332
333/*
334 * This is only used in EIC mode. This helps to figure out which
335 * shared interrupts we need to process when we get a vector interrupt.
336 */
337#define GIC_MAX_SHARED_INTR 0x5
338struct gic_shared_intr_map {
339 unsigned int num_shared_intr;
340 unsigned int intr_list[GIC_MAX_SHARED_INTR];
341 unsigned int local_intr_mask;
342};
343
333extern void gic_init(unsigned long gic_base_addr, 344extern void gic_init(unsigned long gic_base_addr,
334 unsigned long gic_addrspace_size, struct gic_intr_map *intrmap, 345 unsigned long gic_addrspace_size, struct gic_intr_map *intrmap,
335 unsigned int intrmap_size, unsigned int irqbase); 346 unsigned int intrmap_size, unsigned int irqbase);
@@ -338,5 +349,7 @@ extern unsigned int gic_get_int(void);
338extern void gic_send_ipi(unsigned int intr); 349extern void gic_send_ipi(unsigned int intr);
339extern unsigned int plat_ipi_call_int_xlate(unsigned int); 350extern unsigned int plat_ipi_call_int_xlate(unsigned int);
340extern unsigned int plat_ipi_resched_int_xlate(unsigned int); 351extern unsigned int plat_ipi_resched_int_xlate(unsigned int);
352extern void gic_bind_eic_interrupt(int irq, int set);
353extern unsigned int gic_get_timer_pending(void);
341 354
342#endif /* _ASM_GICREGS_H */ 355#endif /* _ASM_GICREGS_H */
diff --git a/arch/mips/include/asm/inst.h b/arch/mips/include/asm/inst.h
index 7ebfc392e58d..ab84064283db 100644
--- a/arch/mips/include/asm/inst.h
+++ b/arch/mips/include/asm/inst.h
@@ -251,7 +251,7 @@ struct f_format { /* FPU register format */
251 unsigned int func : 6; 251 unsigned int func : 6;
252}; 252};
253 253
254struct ma_format { /* FPU multipy and add format (MIPS IV) */ 254struct ma_format { /* FPU multiply and add format (MIPS IV) */
255 unsigned int opcode : 6; 255 unsigned int opcode : 6;
256 unsigned int fr : 5; 256 unsigned int fr : 5;
257 unsigned int ft : 5; 257 unsigned int ft : 5;
@@ -324,7 +324,7 @@ struct f_format { /* FPU register format */
324 unsigned int opcode : 6; 324 unsigned int opcode : 6;
325}; 325};
326 326
327struct ma_format { /* FPU multipy and add format (MIPS IV) */ 327struct ma_format { /* FPU multiply and add format (MIPS IV) */
328 unsigned int fmt : 2; 328 unsigned int fmt : 2;
329 unsigned int func : 4; 329 unsigned int func : 4;
330 unsigned int fd : 5; 330 unsigned int fd : 5;
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
index fb698dc09bc9..78dbb8a86da2 100644
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -136,6 +136,7 @@ extern void free_irqno(unsigned int irq);
136 * IE7. Since R2 their number has to be read from the c0_intctl register. 136 * IE7. Since R2 their number has to be read from the c0_intctl register.
137 */ 137 */
138#define CP0_LEGACY_COMPARE_IRQ 7 138#define CP0_LEGACY_COMPARE_IRQ 7
139#define CP0_LEGACY_PERFCNT_IRQ 7
139 140
140extern int cp0_compare_irq; 141extern int cp0_compare_irq;
141extern int cp0_compare_irq_shift; 142extern int cp0_compare_irq_shift;
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index 94d4faad29a1..fdcd78ca1b03 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -99,7 +99,7 @@
99#define CKCTL_6368_USBH_CLK_EN (1 << 15) 99#define CKCTL_6368_USBH_CLK_EN (1 << 15)
100#define CKCTL_6368_DISABLE_GLESS_EN (1 << 16) 100#define CKCTL_6368_DISABLE_GLESS_EN (1 << 16)
101#define CKCTL_6368_NAND_CLK_EN (1 << 17) 101#define CKCTL_6368_NAND_CLK_EN (1 << 17)
102#define CKCTL_6368_IPSEC_CLK_EN (1 << 17) 102#define CKCTL_6368_IPSEC_CLK_EN (1 << 18)
103 103
104#define CKCTL_6368_ALL_SAFE_EN (CKCTL_6368_SWPKT_USB_EN | \ 104#define CKCTL_6368_ALL_SAFE_EN (CKCTL_6368_SWPKT_USB_EN | \
105 CKCTL_6368_SWPKT_SAR_EN | \ 105 CKCTL_6368_SWPKT_SAR_EN | \
diff --git a/arch/mips/include/asm/mips-boards/maltaint.h b/arch/mips/include/asm/mips-boards/maltaint.h
index d11aa02a956a..5447d9fc4219 100644
--- a/arch/mips/include/asm/mips-boards/maltaint.h
+++ b/arch/mips/include/asm/mips-boards/maltaint.h
@@ -86,6 +86,16 @@
86#define GIC_CPU_INT4 4 /* . */ 86#define GIC_CPU_INT4 4 /* . */
87#define GIC_CPU_INT5 5 /* Core Interrupt 5 */ 87#define GIC_CPU_INT5 5 /* Core Interrupt 5 */
88 88
89/* MALTA GIC local interrupts */
90#define GIC_INT_TMR (GIC_CPU_INT5)
91#define GIC_INT_PERFCTR (GIC_CPU_INT5)
92
93/* GIC constants */
94/* Add 2 to convert non-eic hw int # to eic vector # */
95#define GIC_CPU_TO_VEC_OFFSET (2)
96/* If we map an intr to pin X, GIC will actually generate vector X+1 */
97#define GIC_PIN_TO_VEC_OFFSET (1)
98
89#define GIC_EXT_INTR(x) x 99#define GIC_EXT_INTR(x) x
90 100
91/* External Interrupts used for IPI */ 101/* External Interrupts used for IPI */
diff --git a/arch/mips/include/asm/mipsmtregs.h b/arch/mips/include/asm/mipsmtregs.h
index c9420aa97e32..e71ff4c317f2 100644
--- a/arch/mips/include/asm/mipsmtregs.h
+++ b/arch/mips/include/asm/mipsmtregs.h
@@ -48,7 +48,7 @@
48#define CP0_VPECONF0 $1, 2 48#define CP0_VPECONF0 $1, 2
49#define CP0_VPECONF1 $1, 3 49#define CP0_VPECONF1 $1, 3
50#define CP0_YQMASK $1, 4 50#define CP0_YQMASK $1, 4
51#define CP0_VPESCHEDULE $1, 5 51#define CP0_VPESCHEDULE $1, 5
52#define CP0_VPESCHEFBK $1, 6 52#define CP0_VPESCHEFBK $1, 6
53#define CP0_TCSTATUS $2, 1 53#define CP0_TCSTATUS $2, 1
54#define CP0_TCBIND $2, 2 54#define CP0_TCBIND $2, 2
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
index 5d33621b5658..4f8ddba8c360 100644
--- a/arch/mips/include/asm/switch_to.h
+++ b/arch/mips/include/asm/switch_to.h
@@ -22,7 +22,7 @@ struct task_struct;
22 * switch_to(n) should switch tasks to task nr n, first 22 * switch_to(n) should switch tasks to task nr n, first
23 * checking that n isn't the current task, in which case it does nothing. 23 * checking that n isn't the current task, in which case it does nothing.
24 */ 24 */
25extern asmlinkage void *resume(void *last, void *next, void *next_ti); 25extern asmlinkage void *resume(void *last, void *next, void *next_ti, u32 __usedfpu);
26 26
27extern unsigned int ll_bit; 27extern unsigned int ll_bit;
28extern struct task_struct *ll_task; 28extern struct task_struct *ll_task;
@@ -66,11 +66,13 @@ do { \
66 66
67#define switch_to(prev, next, last) \ 67#define switch_to(prev, next, last) \
68do { \ 68do { \
69 u32 __usedfpu; \
69 __mips_mt_fpaff_switch_to(prev); \ 70 __mips_mt_fpaff_switch_to(prev); \
70 if (cpu_has_dsp) \ 71 if (cpu_has_dsp) \
71 __save_dsp(prev); \ 72 __save_dsp(prev); \
72 __clear_software_ll_bit(); \ 73 __clear_software_ll_bit(); \
73 (last) = resume(prev, next, task_thread_info(next)); \ 74 __usedfpu = test_and_clear_tsk_thread_flag(prev, TIF_USEDFPU); \
75 (last) = resume(prev, next, task_thread_info(next), __usedfpu); \
74} while (0) 76} while (0)
75 77
76#define finish_arch_switch(prev) \ 78#define finish_arch_switch(prev) \
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index e2eca7d10598..ca97e0ecb64b 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -60,6 +60,8 @@ struct thread_info {
60register struct thread_info *__current_thread_info __asm__("$28"); 60register struct thread_info *__current_thread_info __asm__("$28");
61#define current_thread_info() __current_thread_info 61#define current_thread_info() __current_thread_info
62 62
63#endif /* !__ASSEMBLY__ */
64
63/* thread information allocation */ 65/* thread information allocation */
64#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_32BIT) 66#if defined(CONFIG_PAGE_SIZE_4KB) && defined(CONFIG_32BIT)
65#define THREAD_SIZE_ORDER (1) 67#define THREAD_SIZE_ORDER (1)
@@ -85,8 +87,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
85 87
86#define STACK_WARN (THREAD_SIZE / 8) 88#define STACK_WARN (THREAD_SIZE / 8)
87 89
88#endif /* !__ASSEMBLY__ */
89
90#define PREEMPT_ACTIVE 0x10000000 90#define PREEMPT_ACTIVE 0x10000000
91 91
92/* 92/*
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 6ae7ce4ac63e..f4630e1082ab 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -4,7 +4,7 @@
4 * Copyright (C) xxxx the Anonymous 4 * Copyright (C) xxxx the Anonymous
5 * Copyright (C) 1994 - 2006 Ralf Baechle 5 * Copyright (C) 1994 - 2006 Ralf Baechle
6 * Copyright (C) 2003, 2004 Maciej W. Rozycki 6 * Copyright (C) 2003, 2004 Maciej W. Rozycki
7 * Copyright (C) 2001, 2004 MIPS Inc. 7 * Copyright (C) 2001, 2004, 2011, 2012 MIPS Technologies, Inc.
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
@@ -199,6 +199,7 @@ void __init check_wait(void)
199 cpu_wait = rm7k_wait_irqoff; 199 cpu_wait = rm7k_wait_irqoff;
200 break; 200 break;
201 201
202 case CPU_M14KC:
202 case CPU_24K: 203 case CPU_24K:
203 case CPU_34K: 204 case CPU_34K:
204 case CPU_1004K: 205 case CPU_1004K:
@@ -810,6 +811,10 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
810 c->cputype = CPU_5KC; 811 c->cputype = CPU_5KC;
811 __cpu_name[cpu] = "MIPS 5Kc"; 812 __cpu_name[cpu] = "MIPS 5Kc";
812 break; 813 break;
814 case PRID_IMP_5KE:
815 c->cputype = CPU_5KE;
816 __cpu_name[cpu] = "MIPS 5KE";
817 break;
813 case PRID_IMP_20KC: 818 case PRID_IMP_20KC:
814 c->cputype = CPU_20KC; 819 c->cputype = CPU_20KC;
815 __cpu_name[cpu] = "MIPS 20Kc"; 820 __cpu_name[cpu] = "MIPS 20Kc";
@@ -831,6 +836,10 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
831 c->cputype = CPU_74K; 836 c->cputype = CPU_74K;
832 __cpu_name[cpu] = "MIPS 74Kc"; 837 __cpu_name[cpu] = "MIPS 74Kc";
833 break; 838 break;
839 case PRID_IMP_M14KC:
840 c->cputype = CPU_M14KC;
841 __cpu_name[cpu] = "MIPS M14Kc";
842 break;
834 case PRID_IMP_1004K: 843 case PRID_IMP_1004K:
835 c->cputype = CPU_1004K; 844 c->cputype = CPU_1004K;
836 __cpu_name[cpu] = "MIPS 1004Kc"; 845 __cpu_name[cpu] = "MIPS 1004Kc";
diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c
index 57ba13edb03a..3fc1691110dc 100644
--- a/arch/mips/kernel/mips_ksyms.c
+++ b/arch/mips/kernel/mips_ksyms.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05 by Ralf Baechle 8 * Copyright (C) 1996, 97, 98, 99, 2000, 01, 03, 04, 05, 12 by Ralf Baechle
9 * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc. 9 * Copyright (C) 1999, 2000, 01 Silicon Graphics, Inc.
10 */ 10 */
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
@@ -35,6 +35,12 @@ EXPORT_SYMBOL(memmove);
35EXPORT_SYMBOL(kernel_thread); 35EXPORT_SYMBOL(kernel_thread);
36 36
37/* 37/*
38 * Functions that operate on entire pages. Mostly used by memory management.
39 */
40EXPORT_SYMBOL(clear_page);
41EXPORT_SYMBOL(copy_page);
42
43/*
38 * Userspace access stuff. 44 * Userspace access stuff.
39 */ 45 */
40EXPORT_SYMBOL(__copy_user); 46EXPORT_SYMBOL(__copy_user);
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index ce89c8061708..0441f54b2a6a 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -31,7 +31,7 @@
31 31
32/* 32/*
33 * task_struct *resume(task_struct *prev, task_struct *next, 33 * task_struct *resume(task_struct *prev, task_struct *next,
34 * struct thread_info *next_ti) 34 * struct thread_info *next_ti, int usedfpu)
35 */ 35 */
36 .align 7 36 .align 7
37 LEAF(resume) 37 LEAF(resume)
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index f29099b104c4..eb5e394a4650 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -162,11 +162,6 @@ static unsigned int counters_total_to_per_cpu(unsigned int counters)
162 return counters >> vpe_shift(); 162 return counters >> vpe_shift();
163} 163}
164 164
165static unsigned int counters_per_cpu_to_total(unsigned int counters)
166{
167 return counters << vpe_shift();
168}
169
170#else /* !CONFIG_MIPS_MT_SMP */ 165#else /* !CONFIG_MIPS_MT_SMP */
171#define vpe_id() 0 166#define vpe_id() 0
172 167
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 293898391e67..9c51be5a163a 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -43,7 +43,7 @@
43 43
44/* 44/*
45 * task_struct *resume(task_struct *prev, task_struct *next, 45 * task_struct *resume(task_struct *prev, task_struct *next,
46 * struct thread_info *next_ti) ) 46 * struct thread_info *next_ti, int usedfpu)
47 */ 47 */
48LEAF(resume) 48LEAF(resume)
49 mfc0 t1, CP0_STATUS 49 mfc0 t1, CP0_STATUS
@@ -51,18 +51,9 @@ LEAF(resume)
51 cpu_save_nonscratch a0 51 cpu_save_nonscratch a0
52 sw ra, THREAD_REG31(a0) 52 sw ra, THREAD_REG31(a0)
53 53
54 /* 54 beqz a3, 1f
55 * check if we need to save FPU registers
56 */
57 lw t3, TASK_THREAD_INFO(a0)
58 lw t0, TI_FLAGS(t3)
59 li t1, _TIF_USEDFPU
60 and t2, t0, t1
61 beqz t2, 1f
62 nor t1, zero, t1
63 55
64 and t0, t0, t1 56 PTR_L t3, TASK_THREAD_INFO(a0)
65 sw t0, TI_FLAGS(t3)
66 57
67 /* 58 /*
68 * clear saved user stack CU1 bit 59 * clear saved user stack CU1 bit
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 9414f9354469..42d2a3938420 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -41,7 +41,7 @@
41 41
42/* 42/*
43 * task_struct *resume(task_struct *prev, task_struct *next, 43 * task_struct *resume(task_struct *prev, task_struct *next,
44 * struct thread_info *next_ti) 44 * struct thread_info *next_ti, int usedfpu)
45 */ 45 */
46 .align 5 46 .align 5
47 LEAF(resume) 47 LEAF(resume)
@@ -53,16 +53,10 @@
53 /* 53 /*
54 * check if we need to save FPU registers 54 * check if we need to save FPU registers
55 */ 55 */
56 PTR_L t3, TASK_THREAD_INFO(a0)
57 LONG_L t0, TI_FLAGS(t3)
58 li t1, _TIF_USEDFPU
59 and t2, t0, t1
60 beqz t2, 1f
61 nor t1, zero, t1
62 56
63 and t0, t0, t1 57 beqz a3, 1f
64 LONG_S t0, TI_FLAGS(t3)
65 58
59 PTR_L t3, TASK_THREAD_INFO(a0)
66 /* 60 /*
67 * clear saved user stack CU1 bit 61 * clear saved user stack CU1 bit
68 */ 62 */
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 3046e2986006..8e393b8443f7 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -15,7 +15,6 @@
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/init.h>
19#include <linux/cpu.h> 18#include <linux/cpu.h>
20#include <linux/cpumask.h> 19#include <linux/cpumask.h>
21#include <linux/reboot.h> 20#include <linux/reboot.h>
@@ -197,13 +196,6 @@ static void bmips_init_secondary(void)
197 196
198 write_c0_brcm_action(ACTION_CLR_IPI(smp_processor_id(), 0)); 197 write_c0_brcm_action(ACTION_CLR_IPI(smp_processor_id(), 0));
199#endif 198#endif
200
201 /* make sure there won't be a timer interrupt for a little while */
202 write_c0_compare(read_c0_count() + mips_hpt_frequency / HZ);
203
204 irq_enable_hazard();
205 set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ1 | IE_IRQ5 | ST0_IE);
206 irq_enable_hazard();
207} 199}
208 200
209/* 201/*
@@ -212,6 +204,13 @@ static void bmips_init_secondary(void)
212static void bmips_smp_finish(void) 204static void bmips_smp_finish(void)
213{ 205{
214 pr_info("SMP: CPU%d is running\n", smp_processor_id()); 206 pr_info("SMP: CPU%d is running\n", smp_processor_id());
207
208 /* make sure there won't be a timer interrupt for a little while */
209 write_c0_compare(read_c0_count() + mips_hpt_frequency / HZ);
210
211 irq_enable_hazard();
212 set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ1 | IE_IRQ5 | ST0_IE);
213 irq_enable_hazard();
215} 214}
216 215
217/* 216/*
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 48650c818040..1268392f1d27 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -122,13 +122,21 @@ asmlinkage __cpuinit void start_secondary(void)
122 122
123 notify_cpu_starting(cpu); 123 notify_cpu_starting(cpu);
124 124
125 mp_ops->smp_finish(); 125 set_cpu_online(cpu, true);
126
126 set_cpu_sibling_map(cpu); 127 set_cpu_sibling_map(cpu);
127 128
128 cpu_set(cpu, cpu_callin_map); 129 cpu_set(cpu, cpu_callin_map);
129 130
130 synchronise_count_slave(); 131 synchronise_count_slave();
131 132
133 /*
134 * irq will be enabled in ->smp_finish(), enabling it too early
135 * is dangerous.
136 */
137 WARN_ON_ONCE(!irqs_disabled());
138 mp_ops->smp_finish();
139
132 cpu_idle(); 140 cpu_idle();
133} 141}
134 142
@@ -196,8 +204,6 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
196 while (!cpu_isset(cpu, cpu_callin_map)) 204 while (!cpu_isset(cpu, cpu_callin_map))
197 udelay(100); 205 udelay(100);
198 206
199 set_cpu_online(cpu, true);
200
201 return 0; 207 return 0;
202} 208}
203 209
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index f5dd38f1d015..15b5f3cfd20c 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -322,7 +322,7 @@ int __init smtc_build_cpu_map(int start_cpu_slot)
322 322
323/* 323/*
324 * Common setup before any secondaries are started 324 * Common setup before any secondaries are started
325 * Make sure all CPU's are in a sensible state before we boot any of the 325 * Make sure all CPUs are in a sensible state before we boot any of the
326 * secondaries. 326 * secondaries.
327 * 327 *
328 * For MIPS MT "SMTC" operation, we set up all TCs, spread as evenly 328 * For MIPS MT "SMTC" operation, we set up all TCs, spread as evenly
@@ -340,12 +340,12 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
340 /* 340 /*
341 * TCContext gets an offset from the base of the IPIQ array 341 * TCContext gets an offset from the base of the IPIQ array
342 * to be used in low-level code to detect the presence of 342 * to be used in low-level code to detect the presence of
343 * an active IPI queue 343 * an active IPI queue.
344 */ 344 */
345 write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16); 345 write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16);
346 /* Bind tc to vpe */ 346 /* Bind tc to vpe */
347 write_tc_c0_tcbind(vpe); 347 write_tc_c0_tcbind(vpe);
348 /* In general, all TCs should have the same cpu_data indications */ 348 /* In general, all TCs should have the same cpu_data indications. */
349 memcpy(&cpu_data[cpu], &cpu_data[0], sizeof(struct cpuinfo_mips)); 349 memcpy(&cpu_data[cpu], &cpu_data[0], sizeof(struct cpuinfo_mips));
350 /* For 34Kf, start with TC/CPU 0 as sole owner of single FPU context */ 350 /* For 34Kf, start with TC/CPU 0 as sole owner of single FPU context */
351 if (cpu_data[0].cputype == CPU_34K || 351 if (cpu_data[0].cputype == CPU_34K ||
@@ -358,8 +358,8 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
358} 358}
359 359
360/* 360/*
361 * Tweak to get Count registes in as close a sync as possible. 361 * Tweak to get Count registes in as close a sync as possible. The
362 * Value seems good for 34K-class cores. 362 * value seems good for 34K-class cores.
363 */ 363 */
364 364
365#define CP0_SKEW 8 365#define CP0_SKEW 8
@@ -615,7 +615,6 @@ void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
615 615
616void smtc_init_secondary(void) 616void smtc_init_secondary(void)
617{ 617{
618 local_irq_enable();
619} 618}
620 619
621void smtc_smp_finish(void) 620void smtc_smp_finish(void)
@@ -631,6 +630,8 @@ void smtc_smp_finish(void)
631 if (cpu > 0 && (cpu_data[cpu].vpe_id != cpu_data[cpu - 1].vpe_id)) 630 if (cpu > 0 && (cpu_data[cpu].vpe_id != cpu_data[cpu - 1].vpe_id))
632 write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ); 631 write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
633 632
633 local_irq_enable();
634
634 printk("TC %d going on-line as CPU %d\n", 635 printk("TC %d going on-line as CPU %d\n",
635 cpu_data[smp_processor_id()].tc_id, smp_processor_id()); 636 cpu_data[smp_processor_id()].tc_id, smp_processor_id());
636} 637}
diff --git a/arch/mips/kernel/sync-r4k.c b/arch/mips/kernel/sync-r4k.c
index 99f913c8d7a6..842d55e411fd 100644
--- a/arch/mips/kernel/sync-r4k.c
+++ b/arch/mips/kernel/sync-r4k.c
@@ -111,7 +111,6 @@ void __cpuinit synchronise_count_master(void)
111void __cpuinit synchronise_count_slave(void) 111void __cpuinit synchronise_count_slave(void)
112{ 112{
113 int i; 113 int i;
114 unsigned long flags;
115 unsigned int initcount; 114 unsigned int initcount;
116 int ncpus; 115 int ncpus;
117 116
@@ -123,8 +122,6 @@ void __cpuinit synchronise_count_slave(void)
123 return; 122 return;
124#endif 123#endif
125 124
126 local_irq_save(flags);
127
128 /* 125 /*
129 * Not every cpu is online at the time this gets called, 126 * Not every cpu is online at the time this gets called,
130 * so we first wait for the master to say everyone is ready 127 * so we first wait for the master to say everyone is ready
@@ -154,7 +151,5 @@ void __cpuinit synchronise_count_slave(void)
154 } 151 }
155 /* Arrange for an interrupt in a short while */ 152 /* Arrange for an interrupt in a short while */
156 write_c0_compare(read_c0_count() + COUNTON); 153 write_c0_compare(read_c0_count() + COUNTON);
157
158 local_irq_restore(flags);
159} 154}
160#undef NR_LOOPS 155#undef NR_LOOPS
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 2d0c2a277f52..c3c293543703 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -132,6 +132,9 @@ static void show_backtrace(struct task_struct *task, const struct pt_regs *regs)
132 unsigned long ra = regs->regs[31]; 132 unsigned long ra = regs->regs[31];
133 unsigned long pc = regs->cp0_epc; 133 unsigned long pc = regs->cp0_epc;
134 134
135 if (!task)
136 task = current;
137
135 if (raw_show_trace || !__kernel_text_address(pc)) { 138 if (raw_show_trace || !__kernel_text_address(pc)) {
136 show_raw_backtrace(sp); 139 show_raw_backtrace(sp);
137 return; 140 return;
@@ -1249,6 +1252,7 @@ static inline void parity_protection_init(void)
1249 break; 1252 break;
1250 1253
1251 case CPU_5KC: 1254 case CPU_5KC:
1255 case CPU_5KE:
1252 write_c0_ecc(0x80000000); 1256 write_c0_ecc(0x80000000);
1253 back_to_back_c0_hazard(); 1257 back_to_back_c0_hazard();
1254 /* Set the PE bit (bit 31) in the c0_errctl register. */ 1258 /* Set the PE bit (bit 31) in the c0_errctl register. */
@@ -1498,6 +1502,7 @@ extern void flush_tlb_handlers(void);
1498 * Timer interrupt 1502 * Timer interrupt
1499 */ 1503 */
1500int cp0_compare_irq; 1504int cp0_compare_irq;
1505EXPORT_SYMBOL_GPL(cp0_compare_irq);
1501int cp0_compare_irq_shift; 1506int cp0_compare_irq_shift;
1502 1507
1503/* 1508/*
@@ -1597,7 +1602,7 @@ void __cpuinit per_cpu_trap_init(bool is_boot_cpu)
1597 cp0_perfcount_irq = -1; 1602 cp0_perfcount_irq = -1;
1598 } else { 1603 } else {
1599 cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ; 1604 cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
1600 cp0_compare_irq_shift = cp0_compare_irq; 1605 cp0_compare_irq_shift = CP0_LEGACY_PERFCNT_IRQ;
1601 cp0_perfcount_irq = -1; 1606 cp0_perfcount_irq = -1;
1602 } 1607 }
1603 1608
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 924da5eb7031..df243a64f430 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -1,5 +1,6 @@
1#include <asm/asm-offsets.h> 1#include <asm/asm-offsets.h>
2#include <asm/page.h> 2#include <asm/page.h>
3#include <asm/thread_info.h>
3#include <asm-generic/vmlinux.lds.h> 4#include <asm-generic/vmlinux.lds.h>
4 5
5#undef mips 6#undef mips
@@ -72,7 +73,7 @@ SECTIONS
72 .data : { /* Data */ 73 .data : { /* Data */
73 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */ 74 . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */
74 75
75 INIT_TASK_DATA(PAGE_SIZE) 76 INIT_TASK_DATA(THREAD_SIZE)
76 NOSAVE_DATA 77 NOSAVE_DATA
77 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 78 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
78 READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) 79 READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index 4aa20280613e..fd6203f14f1f 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -3,8 +3,8 @@
3# 3#
4 4
5obj-y += cache.o dma-default.o extable.o fault.o \ 5obj-y += cache.o dma-default.o extable.o fault.o \
6 gup.o init.o mmap.o page.o tlbex.o \ 6 gup.o init.o mmap.o page.o page-funcs.o \
7 tlbex-fault.o uasm.o 7 tlbex.o tlbex-fault.o uasm.o
8 8
9obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o 9obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o
10obj-$(CONFIG_64BIT) += pgtable-64.o 10obj-$(CONFIG_64BIT) += pgtable-64.o
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 5109be96d98d..f092c265dc63 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -977,7 +977,7 @@ static void __cpuinit probe_pcache(void)
977 c->icache.linesz = 2 << lsize; 977 c->icache.linesz = 2 << lsize;
978 else 978 else
979 c->icache.linesz = lsize; 979 c->icache.linesz = lsize;
980 c->icache.sets = 64 << ((config1 >> 22) & 7); 980 c->icache.sets = 32 << (((config1 >> 22) + 1) & 7);
981 c->icache.ways = 1 + ((config1 >> 16) & 7); 981 c->icache.ways = 1 + ((config1 >> 16) & 7);
982 982
983 icache_size = c->icache.sets * 983 icache_size = c->icache.sets *
@@ -997,7 +997,7 @@ static void __cpuinit probe_pcache(void)
997 c->dcache.linesz = 2 << lsize; 997 c->dcache.linesz = 2 << lsize;
998 else 998 else
999 c->dcache.linesz= lsize; 999 c->dcache.linesz= lsize;
1000 c->dcache.sets = 64 << ((config1 >> 13) & 7); 1000 c->dcache.sets = 32 << (((config1 >> 13) + 1) & 7);
1001 c->dcache.ways = 1 + ((config1 >> 7) & 7); 1001 c->dcache.ways = 1 + ((config1 >> 7) & 7);
1002 1002
1003 dcache_size = c->dcache.sets * 1003 dcache_size = c->dcache.sets *
@@ -1051,6 +1051,7 @@ static void __cpuinit probe_pcache(void)
1051 case CPU_R14000: 1051 case CPU_R14000:
1052 break; 1052 break;
1053 1053
1054 case CPU_M14KC:
1054 case CPU_24K: 1055 case CPU_24K:
1055 case CPU_34K: 1056 case CPU_34K:
1056 case CPU_74K: 1057 case CPU_74K:
diff --git a/arch/mips/mm/page-funcs.S b/arch/mips/mm/page-funcs.S
new file mode 100644
index 000000000000..48a6b38ff13e
--- /dev/null
+++ b/arch/mips/mm/page-funcs.S
@@ -0,0 +1,50 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Micro-assembler generated clear_page/copy_page functions.
7 *
8 * Copyright (C) 2012 MIPS Technologies, Inc.
9 * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
10 */
11#include <asm/asm.h>
12#include <asm/regdef.h>
13
14#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
15#define cpu_clear_page_function_name clear_page_cpu
16#define cpu_copy_page_function_name copy_page_cpu
17#else
18#define cpu_clear_page_function_name clear_page
19#define cpu_copy_page_function_name copy_page
20#endif
21
22/*
23 * Maximum sizes:
24 *
25 * R4000 128 bytes S-cache: 0x058 bytes
26 * R4600 v1.7: 0x05c bytes
27 * R4600 v2.0: 0x060 bytes
28 * With prefetching, 16 word strides 0x120 bytes
29 */
30EXPORT(__clear_page_start)
31LEAF(cpu_clear_page_function_name)
321: j 1b /* Dummy, will be replaced. */
33 .space 288
34END(cpu_clear_page_function_name)
35EXPORT(__clear_page_end)
36
37/*
38 * Maximum sizes:
39 *
40 * R4000 128 bytes S-cache: 0x11c bytes
41 * R4600 v1.7: 0x080 bytes
42 * R4600 v2.0: 0x07c bytes
43 * With prefetching, 16 word strides 0x540 bytes
44 */
45EXPORT(__copy_page_start)
46LEAF(cpu_copy_page_function_name)
471: j 1b /* Dummy, will be replaced. */
48 .space 1344
49END(cpu_copy_page_function_name)
50EXPORT(__copy_page_end)
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index cc0b626858b3..98f530e18216 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -6,6 +6,7 @@
6 * Copyright (C) 2003, 04, 05 Ralf Baechle (ralf@linux-mips.org) 6 * Copyright (C) 2003, 04, 05 Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2007 Maciej W. Rozycki 7 * Copyright (C) 2007 Maciej W. Rozycki
8 * Copyright (C) 2008 Thiemo Seufer 8 * Copyright (C) 2008 Thiemo Seufer
9 * Copyright (C) 2012 MIPS Technologies, Inc.
9 */ 10 */
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
@@ -71,45 +72,6 @@ static struct uasm_reloc __cpuinitdata relocs[5];
71#define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010) 72#define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010)
72#define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020) 73#define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020)
73 74
74/*
75 * Maximum sizes:
76 *
77 * R4000 128 bytes S-cache: 0x058 bytes
78 * R4600 v1.7: 0x05c bytes
79 * R4600 v2.0: 0x060 bytes
80 * With prefetching, 16 word strides 0x120 bytes
81 */
82
83static u32 clear_page_array[0x120 / 4];
84
85#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
86void clear_page_cpu(void *page) __attribute__((alias("clear_page_array")));
87#else
88void clear_page(void *page) __attribute__((alias("clear_page_array")));
89#endif
90
91EXPORT_SYMBOL(clear_page);
92
93/*
94 * Maximum sizes:
95 *
96 * R4000 128 bytes S-cache: 0x11c bytes
97 * R4600 v1.7: 0x080 bytes
98 * R4600 v2.0: 0x07c bytes
99 * With prefetching, 16 word strides 0x540 bytes
100 */
101static u32 copy_page_array[0x540 / 4];
102
103#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
104void
105copy_page_cpu(void *to, void *from) __attribute__((alias("copy_page_array")));
106#else
107void copy_page(void *to, void *from) __attribute__((alias("copy_page_array")));
108#endif
109
110EXPORT_SYMBOL(copy_page);
111
112
113static int pref_bias_clear_store __cpuinitdata; 75static int pref_bias_clear_store __cpuinitdata;
114static int pref_bias_copy_load __cpuinitdata; 76static int pref_bias_copy_load __cpuinitdata;
115static int pref_bias_copy_store __cpuinitdata; 77static int pref_bias_copy_store __cpuinitdata;
@@ -282,10 +244,15 @@ static inline void __cpuinit build_clear_pref(u32 **buf, int off)
282 } 244 }
283} 245}
284 246
247extern u32 __clear_page_start;
248extern u32 __clear_page_end;
249extern u32 __copy_page_start;
250extern u32 __copy_page_end;
251
285void __cpuinit build_clear_page(void) 252void __cpuinit build_clear_page(void)
286{ 253{
287 int off; 254 int off;
288 u32 *buf = (u32 *)&clear_page_array; 255 u32 *buf = &__clear_page_start;
289 struct uasm_label *l = labels; 256 struct uasm_label *l = labels;
290 struct uasm_reloc *r = relocs; 257 struct uasm_reloc *r = relocs;
291 int i; 258 int i;
@@ -356,17 +323,17 @@ void __cpuinit build_clear_page(void)
356 uasm_i_jr(&buf, RA); 323 uasm_i_jr(&buf, RA);
357 uasm_i_nop(&buf); 324 uasm_i_nop(&buf);
358 325
359 BUG_ON(buf > clear_page_array + ARRAY_SIZE(clear_page_array)); 326 BUG_ON(buf > &__clear_page_end);
360 327
361 uasm_resolve_relocs(relocs, labels); 328 uasm_resolve_relocs(relocs, labels);
362 329
363 pr_debug("Synthesized clear page handler (%u instructions).\n", 330 pr_debug("Synthesized clear page handler (%u instructions).\n",
364 (u32)(buf - clear_page_array)); 331 (u32)(buf - &__clear_page_start));
365 332
366 pr_debug("\t.set push\n"); 333 pr_debug("\t.set push\n");
367 pr_debug("\t.set noreorder\n"); 334 pr_debug("\t.set noreorder\n");
368 for (i = 0; i < (buf - clear_page_array); i++) 335 for (i = 0; i < (buf - &__clear_page_start); i++)
369 pr_debug("\t.word 0x%08x\n", clear_page_array[i]); 336 pr_debug("\t.word 0x%08x\n", (&__clear_page_start)[i]);
370 pr_debug("\t.set pop\n"); 337 pr_debug("\t.set pop\n");
371} 338}
372 339
@@ -427,7 +394,7 @@ static inline void build_copy_store_pref(u32 **buf, int off)
427void __cpuinit build_copy_page(void) 394void __cpuinit build_copy_page(void)
428{ 395{
429 int off; 396 int off;
430 u32 *buf = (u32 *)&copy_page_array; 397 u32 *buf = &__copy_page_start;
431 struct uasm_label *l = labels; 398 struct uasm_label *l = labels;
432 struct uasm_reloc *r = relocs; 399 struct uasm_reloc *r = relocs;
433 int i; 400 int i;
@@ -595,21 +562,23 @@ void __cpuinit build_copy_page(void)
595 uasm_i_jr(&buf, RA); 562 uasm_i_jr(&buf, RA);
596 uasm_i_nop(&buf); 563 uasm_i_nop(&buf);
597 564
598 BUG_ON(buf > copy_page_array + ARRAY_SIZE(copy_page_array)); 565 BUG_ON(buf > &__copy_page_end);
599 566
600 uasm_resolve_relocs(relocs, labels); 567 uasm_resolve_relocs(relocs, labels);
601 568
602 pr_debug("Synthesized copy page handler (%u instructions).\n", 569 pr_debug("Synthesized copy page handler (%u instructions).\n",
603 (u32)(buf - copy_page_array)); 570 (u32)(buf - &__copy_page_start));
604 571
605 pr_debug("\t.set push\n"); 572 pr_debug("\t.set push\n");
606 pr_debug("\t.set noreorder\n"); 573 pr_debug("\t.set noreorder\n");
607 for (i = 0; i < (buf - copy_page_array); i++) 574 for (i = 0; i < (buf - &__copy_page_start); i++)
608 pr_debug("\t.word 0x%08x\n", copy_page_array[i]); 575 pr_debug("\t.word 0x%08x\n", (&__copy_page_start)[i]);
609 pr_debug("\t.set pop\n"); 576 pr_debug("\t.set pop\n");
610} 577}
611 578
612#ifdef CONFIG_SIBYTE_DMA_PAGEOPS 579#ifdef CONFIG_SIBYTE_DMA_PAGEOPS
580extern void clear_page_cpu(void *page);
581extern void copy_page_cpu(void *to, void *from);
613 582
614/* 583/*
615 * Pad descriptors to cacheline, since each is exclusively owned by a 584 * Pad descriptors to cacheline, since each is exclusively owned by a
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 0bc485b3cd60..03eb0ef91580 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -9,6 +9,7 @@
9 * Copyright (C) 2005, 2007, 2008, 2009 Maciej W. Rozycki 9 * Copyright (C) 2005, 2007, 2008, 2009 Maciej W. Rozycki
10 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) 10 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
11 * Copyright (C) 2008, 2009 Cavium Networks, Inc. 11 * Copyright (C) 2008, 2009 Cavium Networks, Inc.
12 * Copyright (C) 2011 MIPS Technologies, Inc.
12 * 13 *
13 * ... and the days got worse and worse and now you see 14 * ... and the days got worse and worse and now you see
14 * I've gone completly out of my mind. 15 * I've gone completly out of my mind.
@@ -494,6 +495,7 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
494 case CPU_R14000: 495 case CPU_R14000:
495 case CPU_4KC: 496 case CPU_4KC:
496 case CPU_4KEC: 497 case CPU_4KEC:
498 case CPU_M14KC:
497 case CPU_SB1: 499 case CPU_SB1:
498 case CPU_SB1A: 500 case CPU_SB1A:
499 case CPU_4KSC: 501 case CPU_4KSC:
diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c
index bf80921f2f56..284dea54faf5 100644
--- a/arch/mips/mti-malta/malta-pci.c
+++ b/arch/mips/mti-malta/malta-pci.c
@@ -241,8 +241,9 @@ void __init mips_pcibios_init(void)
241 return; 241 return;
242 } 242 }
243 243
244 if (controller->io_resource->start < 0x00001000UL) /* FIXME */ 244 /* Change start address to avoid conflicts with ACPI and SMB devices */
245 controller->io_resource->start = 0x00001000UL; 245 if (controller->io_resource->start < 0x00002000UL)
246 controller->io_resource->start = 0x00002000UL;
246 247
247 iomem_resource.end &= 0xfffffffffULL; /* 64 GB */ 248 iomem_resource.end &= 0xfffffffffULL; /* 64 GB */
248 ioport_resource.end = controller->io_resource->end; 249 ioport_resource.end = controller->io_resource->end;
@@ -253,7 +254,7 @@ void __init mips_pcibios_init(void)
253} 254}
254 255
255/* Enable PCI 2.1 compatibility in PIIX4 */ 256/* Enable PCI 2.1 compatibility in PIIX4 */
256static void __init quirk_dlcsetup(struct pci_dev *dev) 257static void __devinit quirk_dlcsetup(struct pci_dev *dev)
257{ 258{
258 u8 odlc, ndlc; 259 u8 odlc, ndlc;
259 (void) pci_read_config_byte(dev, 0x82, &odlc); 260 (void) pci_read_config_byte(dev, 0x82, &odlc);
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index b7f37d4982fa..2e28f653f66d 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -111,7 +111,7 @@ static void __init pci_clock_check(void)
111 unsigned int __iomem *jmpr_p = 111 unsigned int __iomem *jmpr_p =
112 (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int)); 112 (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
113 int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07; 113 int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
114 static const int pciclocks[] __initdata = { 114 static const int pciclocks[] __initconst = {
115 33, 20, 25, 30, 12, 16, 37, 10 115 33, 20, 25, 30, 12, 16, 37, 10
116 }; 116 };
117 int pciclock = pciclocks[jmpr]; 117 int pciclock = pciclocks[jmpr];
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index acb677a1227c..b3df7c2aad1e 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -82,8 +82,10 @@ void __init prom_free_prom_memory(void)
82 82
83void xlp_mmu_init(void) 83void xlp_mmu_init(void)
84{ 84{
85 /* enable extended TLB and Large Fixed TLB */
85 write_c0_config6(read_c0_config6() | 0x24); 86 write_c0_config6(read_c0_config6() | 0x24);
86 current_cpu_data.tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1; 87
88 /* set page mask of Fixed TLB in config7 */
87 write_c0_config7(PM_DEFAULT_MASK >> 89 write_c0_config7(PM_DEFAULT_MASK >>
88 (13 + (ffz(PM_DEFAULT_MASK >> 13) / 2))); 90 (13 + (ffz(PM_DEFAULT_MASK >> 13) / 2)));
89} 91}
@@ -100,6 +102,10 @@ void __init prom_init(void)
100 nlm_common_ebase = read_c0_ebase() & (~((1 << 12) - 1)); 102 nlm_common_ebase = read_c0_ebase() & (~((1 << 12) - 1));
101#ifdef CONFIG_SMP 103#ifdef CONFIG_SMP
102 nlm_wakeup_secondary_cpus(0xffffffff); 104 nlm_wakeup_secondary_cpus(0xffffffff);
105
106 /* update TLB size after waking up threads */
107 current_cpu_data.tlbsize = ((read_c0_config6() >> 16) & 0xffff) + 1;
108
103 register_smp_ops(&nlm_smp_ops); 109 register_smp_ops(&nlm_smp_ops);
104#endif 110#endif
105} 111}
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index d1f2d4c52d42..b6e378211a2c 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -78,6 +78,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
78 78
79 switch (current_cpu_type()) { 79 switch (current_cpu_type()) {
80 case CPU_5KC: 80 case CPU_5KC:
81 case CPU_M14KC:
81 case CPU_20KC: 82 case CPU_20KC:
82 case CPU_24K: 83 case CPU_24K:
83 case CPU_25KF: 84 case CPU_25KF:
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index baba3bcaa3c2..4d80a856048d 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -322,6 +322,10 @@ static int __init mipsxx_init(void)
322 322
323 op_model_mipsxx_ops.num_counters = counters; 323 op_model_mipsxx_ops.num_counters = counters;
324 switch (current_cpu_type()) { 324 switch (current_cpu_type()) {
325 case CPU_M14KC:
326 op_model_mipsxx_ops.cpu_type = "mips/M14Kc";
327 break;
328
325 case CPU_20KC: 329 case CPU_20KC:
326 op_model_mipsxx_ops.cpu_type = "mips/20K"; 330 op_model_mipsxx_ops.cpu_type = "mips/20K";
327 break; 331 break;
diff --git a/arch/mips/pci/fixup-fuloong2e.c b/arch/mips/pci/fixup-fuloong2e.c
index d5d4c018fb04..0857ab8c3919 100644
--- a/arch/mips/pci/fixup-fuloong2e.c
+++ b/arch/mips/pci/fixup-fuloong2e.c
@@ -48,7 +48,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
48 return 0; 48 return 0;
49} 49}
50 50
51static void __init loongson2e_nec_fixup(struct pci_dev *pdev) 51static void __devinit loongson2e_nec_fixup(struct pci_dev *pdev)
52{ 52{
53 unsigned int val; 53 unsigned int val;
54 54
@@ -60,7 +60,7 @@ static void __init loongson2e_nec_fixup(struct pci_dev *pdev)
60 pci_write_config_dword(pdev, 0xe4, 1 << 5); 60 pci_write_config_dword(pdev, 0xe4, 1 << 5);
61} 61}
62 62
63static void __init loongson2e_686b_func0_fixup(struct pci_dev *pdev) 63static void __devinit loongson2e_686b_func0_fixup(struct pci_dev *pdev)
64{ 64{
65 unsigned char c; 65 unsigned char c;
66 66
@@ -135,7 +135,7 @@ static void __init loongson2e_686b_func0_fixup(struct pci_dev *pdev)
135 printk(KERN_INFO"via686b fix: ISA bridge done\n"); 135 printk(KERN_INFO"via686b fix: ISA bridge done\n");
136} 136}
137 137
138static void __init loongson2e_686b_func1_fixup(struct pci_dev *pdev) 138static void __devinit loongson2e_686b_func1_fixup(struct pci_dev *pdev)
139{ 139{
140 printk(KERN_INFO"via686b fix: IDE\n"); 140 printk(KERN_INFO"via686b fix: IDE\n");
141 141
@@ -168,19 +168,19 @@ static void __init loongson2e_686b_func1_fixup(struct pci_dev *pdev)
168 printk(KERN_INFO"via686b fix: IDE done\n"); 168 printk(KERN_INFO"via686b fix: IDE done\n");
169} 169}
170 170
171static void __init loongson2e_686b_func2_fixup(struct pci_dev *pdev) 171static void __devinit loongson2e_686b_func2_fixup(struct pci_dev *pdev)
172{ 172{
173 /* irq routing */ 173 /* irq routing */
174 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 10); 174 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 10);
175} 175}
176 176
177static void __init loongson2e_686b_func3_fixup(struct pci_dev *pdev) 177static void __devinit loongson2e_686b_func3_fixup(struct pci_dev *pdev)
178{ 178{
179 /* irq routing */ 179 /* irq routing */
180 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 11); 180 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 11);
181} 181}
182 182
183static void __init loongson2e_686b_func5_fixup(struct pci_dev *pdev) 183static void __devinit loongson2e_686b_func5_fixup(struct pci_dev *pdev)
184{ 184{
185 unsigned int val; 185 unsigned int val;
186 unsigned char c; 186 unsigned char c;
diff --git a/arch/mips/pci/fixup-lemote2f.c b/arch/mips/pci/fixup-lemote2f.c
index 4b9768d5d729..a7b917dcf604 100644
--- a/arch/mips/pci/fixup-lemote2f.c
+++ b/arch/mips/pci/fixup-lemote2f.c
@@ -96,21 +96,21 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
96} 96}
97 97
98/* CS5536 SPEC. fixup */ 98/* CS5536 SPEC. fixup */
99static void __init loongson_cs5536_isa_fixup(struct pci_dev *pdev) 99static void __devinit loongson_cs5536_isa_fixup(struct pci_dev *pdev)
100{ 100{
101 /* the uart1 and uart2 interrupt in PIC is enabled as default */ 101 /* the uart1 and uart2 interrupt in PIC is enabled as default */
102 pci_write_config_dword(pdev, PCI_UART1_INT_REG, 1); 102 pci_write_config_dword(pdev, PCI_UART1_INT_REG, 1);
103 pci_write_config_dword(pdev, PCI_UART2_INT_REG, 1); 103 pci_write_config_dword(pdev, PCI_UART2_INT_REG, 1);
104} 104}
105 105
106static void __init loongson_cs5536_ide_fixup(struct pci_dev *pdev) 106static void __devinit loongson_cs5536_ide_fixup(struct pci_dev *pdev)
107{ 107{
108 /* setting the mutex pin as IDE function */ 108 /* setting the mutex pin as IDE function */
109 pci_write_config_dword(pdev, PCI_IDE_CFG_REG, 109 pci_write_config_dword(pdev, PCI_IDE_CFG_REG,
110 CS5536_IDE_FLASH_SIGNATURE); 110 CS5536_IDE_FLASH_SIGNATURE);
111} 111}
112 112
113static void __init loongson_cs5536_acc_fixup(struct pci_dev *pdev) 113static void __devinit loongson_cs5536_acc_fixup(struct pci_dev *pdev)
114{ 114{
115 /* enable the AUDIO interrupt in PIC */ 115 /* enable the AUDIO interrupt in PIC */
116 pci_write_config_dword(pdev, PCI_ACC_INT_REG, 1); 116 pci_write_config_dword(pdev, PCI_ACC_INT_REG, 1);
@@ -118,14 +118,14 @@ static void __init loongson_cs5536_acc_fixup(struct pci_dev *pdev)
118 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xc0); 118 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xc0);
119} 119}
120 120
121static void __init loongson_cs5536_ohci_fixup(struct pci_dev *pdev) 121static void __devinit loongson_cs5536_ohci_fixup(struct pci_dev *pdev)
122{ 122{
123 /* enable the OHCI interrupt in PIC */ 123 /* enable the OHCI interrupt in PIC */
124 /* THE OHCI, EHCI, UDC, OTG are shared with interrupt in PIC */ 124 /* THE OHCI, EHCI, UDC, OTG are shared with interrupt in PIC */
125 pci_write_config_dword(pdev, PCI_OHCI_INT_REG, 1); 125 pci_write_config_dword(pdev, PCI_OHCI_INT_REG, 1);
126} 126}
127 127
128static void __init loongson_cs5536_ehci_fixup(struct pci_dev *pdev) 128static void __devinit loongson_cs5536_ehci_fixup(struct pci_dev *pdev)
129{ 129{
130 u32 hi, lo; 130 u32 hi, lo;
131 131
@@ -137,7 +137,7 @@ static void __init loongson_cs5536_ehci_fixup(struct pci_dev *pdev)
137 pci_write_config_dword(pdev, PCI_EHCI_FLADJ_REG, 0x2000); 137 pci_write_config_dword(pdev, PCI_EHCI_FLADJ_REG, 0x2000);
138} 138}
139 139
140static void __init loongson_nec_fixup(struct pci_dev *pdev) 140static void __devinit loongson_nec_fixup(struct pci_dev *pdev)
141{ 141{
142 unsigned int val; 142 unsigned int val;
143 143
diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c
index 0f48498bc231..70073c98ed32 100644
--- a/arch/mips/pci/fixup-malta.c
+++ b/arch/mips/pci/fixup-malta.c
@@ -49,10 +49,10 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
49 return 0; 49 return 0;
50} 50}
51 51
52static void __init malta_piix_func0_fixup(struct pci_dev *pdev) 52static void __devinit malta_piix_func0_fixup(struct pci_dev *pdev)
53{ 53{
54 unsigned char reg_val; 54 unsigned char reg_val;
55 static int piixirqmap[16] __initdata = { /* PIIX PIRQC[A:D] irq mappings */ 55 static int piixirqmap[16] __devinitdata = { /* PIIX PIRQC[A:D] irq mappings */
56 0, 0, 0, 3, 56 0, 0, 0, 3,
57 4, 5, 6, 7, 57 4, 5, 6, 7,
58 0, 9, 10, 11, 58 0, 9, 10, 11,
@@ -83,7 +83,7 @@ static void __init malta_piix_func0_fixup(struct pci_dev *pdev)
83DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, 83DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
84 malta_piix_func0_fixup); 84 malta_piix_func0_fixup);
85 85
86static void __init malta_piix_func1_fixup(struct pci_dev *pdev) 86static void __devinit malta_piix_func1_fixup(struct pci_dev *pdev)
87{ 87{
88 unsigned char reg_val; 88 unsigned char reg_val;
89 89
diff --git a/arch/mips/pci/fixup-mpc30x.c b/arch/mips/pci/fixup-mpc30x.c
index e08f49cb6875..8e4f8288eca2 100644
--- a/arch/mips/pci/fixup-mpc30x.c
+++ b/arch/mips/pci/fixup-mpc30x.c
@@ -22,13 +22,13 @@
22 22
23#include <asm/vr41xx/mpc30x.h> 23#include <asm/vr41xx/mpc30x.h>
24 24
25static const int internal_func_irqs[] __initdata = { 25static const int internal_func_irqs[] __initconst = {
26 VRC4173_CASCADE_IRQ, 26 VRC4173_CASCADE_IRQ,
27 VRC4173_AC97_IRQ, 27 VRC4173_AC97_IRQ,
28 VRC4173_USB_IRQ, 28 VRC4173_USB_IRQ,
29}; 29};
30 30
31static const int irq_tab_mpc30x[] __initdata = { 31static const int irq_tab_mpc30x[] __initconst = {
32 [12] = VRC4173_PCMCIA1_IRQ, 32 [12] = VRC4173_PCMCIA1_IRQ,
33 [13] = VRC4173_PCMCIA2_IRQ, 33 [13] = VRC4173_PCMCIA2_IRQ,
34 [29] = MQ200_IRQ, 34 [29] = MQ200_IRQ,
diff --git a/arch/mips/pci/fixup-sb1250.c b/arch/mips/pci/fixup-sb1250.c
index f0bb9146e6c0..d02900a72916 100644
--- a/arch/mips/pci/fixup-sb1250.c
+++ b/arch/mips/pci/fixup-sb1250.c
@@ -15,7 +15,7 @@
15 * Set the BCM1250, etc. PCI host bridge's TRDY timeout 15 * Set the BCM1250, etc. PCI host bridge's TRDY timeout
16 * to the finite max. 16 * to the finite max.
17 */ 17 */
18static void __init quirk_sb1250_pci(struct pci_dev *dev) 18static void __devinit quirk_sb1250_pci(struct pci_dev *dev)
19{ 19{
20 pci_write_config_byte(dev, 0x40, 0xff); 20 pci_write_config_byte(dev, 0x40, 0xff);
21} 21}
@@ -25,7 +25,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_PCI,
25/* 25/*
26 * The BCM1250, etc. PCI/HT bridge reports as a host bridge. 26 * The BCM1250, etc. PCI/HT bridge reports as a host bridge.
27 */ 27 */
28static void __init quirk_sb1250_ht(struct pci_dev *dev) 28static void __devinit quirk_sb1250_ht(struct pci_dev *dev)
29{ 29{
30 dev->class = PCI_CLASS_BRIDGE_PCI << 8; 30 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
31} 31}
@@ -35,7 +35,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_HT,
35/* 35/*
36 * Set the SP1011 HT/PCI bridge's TRDY timeout to the finite max. 36 * Set the SP1011 HT/PCI bridge's TRDY timeout to the finite max.
37 */ 37 */
38static void __init quirk_sp1011(struct pci_dev *dev) 38static void __devinit quirk_sp1011(struct pci_dev *dev)
39{ 39{
40 pci_write_config_byte(dev, 0x64, 0xff); 40 pci_write_config_byte(dev, 0x64, 0xff);
41} 41}
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c
index a1e7e6d80c8c..bc13e29d2bb3 100644
--- a/arch/mips/pci/ops-tx4927.c
+++ b/arch/mips/pci/ops-tx4927.c
@@ -495,7 +495,7 @@ irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id)
495} 495}
496 496
497#ifdef CONFIG_TOSHIBA_FPCIB0 497#ifdef CONFIG_TOSHIBA_FPCIB0
498static void __init tx4927_quirk_slc90e66_bridge(struct pci_dev *dev) 498static void __devinit tx4927_quirk_slc90e66_bridge(struct pci_dev *dev)
499{ 499{
500 struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus); 500 struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus);
501 501
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index 0fbe4c0c170a..fdc24440294c 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -212,7 +212,7 @@ static inline void pci_enable_swapping(struct pci_dev *dev)
212 bridge->b_widget.w_tflush; /* Flush */ 212 bridge->b_widget.w_tflush; /* Flush */
213} 213}
214 214
215static void __init pci_fixup_ioc3(struct pci_dev *d) 215static void __devinit pci_fixup_ioc3(struct pci_dev *d)
216{ 216{
217 pci_disable_swapping(d); 217 pci_disable_swapping(d);
218} 218}
diff --git a/arch/mips/pci/pci-xlr.c b/arch/mips/pci/pci-xlr.c
index 1644805a6730..172af1cd5867 100644
--- a/arch/mips/pci/pci-xlr.c
+++ b/arch/mips/pci/pci-xlr.c
@@ -41,6 +41,7 @@
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <linux/irqdesc.h> 42#include <linux/irqdesc.h>
43#include <linux/console.h> 43#include <linux/console.h>
44#include <linux/pci_regs.h>
44 45
45#include <asm/io.h> 46#include <asm/io.h>
46 47
@@ -156,35 +157,55 @@ struct pci_controller nlm_pci_controller = {
156 .io_offset = 0x00000000UL, 157 .io_offset = 0x00000000UL,
157}; 158};
158 159
160/*
161 * The top level PCIe links on the XLS PCIe controller appear as
162 * bridges. Given a device, this function finds which link it is
163 * on.
164 */
165static struct pci_dev *xls_get_pcie_link(const struct pci_dev *dev)
166{
167 struct pci_bus *bus, *p;
168
169 /* Find the bridge on bus 0 */
170 bus = dev->bus;
171 for (p = bus->parent; p && p->number != 0; p = p->parent)
172 bus = p;
173
174 return p ? bus->self : NULL;
175}
176
159static int get_irq_vector(const struct pci_dev *dev) 177static int get_irq_vector(const struct pci_dev *dev)
160{ 178{
179 struct pci_dev *lnk;
180
161 if (!nlm_chip_is_xls()) 181 if (!nlm_chip_is_xls())
162 return PIC_PCIX_IRQ; /* for XLR just one IRQ*/ 182 return PIC_PCIX_IRQ; /* for XLR just one IRQ */
163 183
164 /* 184 /*
165 * For XLS PCIe, there is an IRQ per Link, find out which 185 * For XLS PCIe, there is an IRQ per Link, find out which
166 * link the device is on to assign interrupts 186 * link the device is on to assign interrupts
167 */ 187 */
168 if (dev->bus->self == NULL) 188 lnk = xls_get_pcie_link(dev);
189 if (lnk == NULL)
169 return 0; 190 return 0;
170 191
171 switch (dev->bus->self->devfn) { 192 switch (PCI_SLOT(lnk->devfn)) {
172 case 0x0: 193 case 0:
173 return PIC_PCIE_LINK0_IRQ; 194 return PIC_PCIE_LINK0_IRQ;
174 case 0x8: 195 case 1:
175 return PIC_PCIE_LINK1_IRQ; 196 return PIC_PCIE_LINK1_IRQ;
176 case 0x10: 197 case 2:
177 if (nlm_chip_is_xls_b()) 198 if (nlm_chip_is_xls_b())
178 return PIC_PCIE_XLSB0_LINK2_IRQ; 199 return PIC_PCIE_XLSB0_LINK2_IRQ;
179 else 200 else
180 return PIC_PCIE_LINK2_IRQ; 201 return PIC_PCIE_LINK2_IRQ;
181 case 0x18: 202 case 3:
182 if (nlm_chip_is_xls_b()) 203 if (nlm_chip_is_xls_b())
183 return PIC_PCIE_XLSB0_LINK3_IRQ; 204 return PIC_PCIE_XLSB0_LINK3_IRQ;
184 else 205 else
185 return PIC_PCIE_LINK3_IRQ; 206 return PIC_PCIE_LINK3_IRQ;
186 } 207 }
187 WARN(1, "Unexpected devfn %d\n", dev->bus->self->devfn); 208 WARN(1, "Unexpected devfn %d\n", lnk->devfn);
188 return 0; 209 return 0;
189} 210}
190 211
@@ -202,7 +223,27 @@ void arch_teardown_msi_irq(unsigned int irq)
202int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) 223int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
203{ 224{
204 struct msi_msg msg; 225 struct msi_msg msg;
226 struct pci_dev *lnk;
205 int irq, ret; 227 int irq, ret;
228 u16 val;
229
230 /* MSI not supported on XLR */
231 if (!nlm_chip_is_xls())
232 return 1;
233
234 /*
235 * Enable MSI on the XLS PCIe controller bridge which was disabled
236 * at enumeration, the bridge MSI capability is at 0x50
237 */
238 lnk = xls_get_pcie_link(dev);
239 if (lnk == NULL)
240 return 1;
241
242 pci_read_config_word(lnk, 0x50 + PCI_MSI_FLAGS, &val);
243 if ((val & PCI_MSI_FLAGS_ENABLE) == 0) {
244 val |= PCI_MSI_FLAGS_ENABLE;
245 pci_write_config_word(lnk, 0x50 + PCI_MSI_FLAGS, val);
246 }
206 247
207 irq = get_irq_vector(dev); 248 irq = get_irq_vector(dev);
208 if (irq <= 0) 249 if (irq <= 0)
@@ -327,7 +368,7 @@ static int __init pcibios_init(void)
327 } 368 }
328 } else { 369 } else {
329 /* XLR PCI controller ACK */ 370 /* XLR PCI controller ACK */
330 irq_set_handler_data(PIC_PCIE_XLSB0_LINK3_IRQ, xlr_pci_ack); 371 irq_set_handler_data(PIC_PCIX_IRQ, xlr_pci_ack);
331 } 372 }
332 373
333 return 0; 374 return 0;
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
index b71fae231049..5edab2bc6fc0 100644
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -115,11 +115,11 @@ static void yos_send_ipi_mask(const struct cpumask *mask, unsigned int action)
115 */ 115 */
116static void __cpuinit yos_init_secondary(void) 116static void __cpuinit yos_init_secondary(void)
117{ 117{
118 set_c0_status(ST0_CO | ST0_IE | ST0_IM);
119} 118}
120 119
121static void __cpuinit yos_smp_finish(void) 120static void __cpuinit yos_smp_finish(void)
122{ 121{
122 set_c0_status(ST0_CO | ST0_IM | ST0_IE);
123} 123}
124 124
125/* Hook for after all CPUs are online */ 125/* Hook for after all CPUs are online */
diff --git a/arch/mips/powertv/asic/asic-calliope.c b/arch/mips/powertv/asic/asic-calliope.c
index 0a170e0ffeaa..7773f3d956b0 100644
--- a/arch/mips/powertv/asic/asic-calliope.c
+++ b/arch/mips/powertv/asic/asic-calliope.c
@@ -28,7 +28,7 @@
28 28
29#define CALLIOPE_ADDR(x) (CALLIOPE_IO_BASE + (x)) 29#define CALLIOPE_ADDR(x) (CALLIOPE_IO_BASE + (x))
30 30
31const struct register_map calliope_register_map __initdata = { 31const struct register_map calliope_register_map __initconst = {
32 .eic_slow0_strt_add = {.phys = CALLIOPE_ADDR(0x800000)}, 32 .eic_slow0_strt_add = {.phys = CALLIOPE_ADDR(0x800000)},
33 .eic_cfg_bits = {.phys = CALLIOPE_ADDR(0x800038)}, 33 .eic_cfg_bits = {.phys = CALLIOPE_ADDR(0x800038)},
34 .eic_ready_status = {.phys = CALLIOPE_ADDR(0x80004c)}, 34 .eic_ready_status = {.phys = CALLIOPE_ADDR(0x80004c)},
diff --git a/arch/mips/powertv/asic/asic-cronus.c b/arch/mips/powertv/asic/asic-cronus.c
index bbc0c122be5e..da076db7b7ed 100644
--- a/arch/mips/powertv/asic/asic-cronus.c
+++ b/arch/mips/powertv/asic/asic-cronus.c
@@ -28,7 +28,7 @@
28 28
29#define CRONUS_ADDR(x) (CRONUS_IO_BASE + (x)) 29#define CRONUS_ADDR(x) (CRONUS_IO_BASE + (x))
30 30
31const struct register_map cronus_register_map __initdata = { 31const struct register_map cronus_register_map __initconst = {
32 .eic_slow0_strt_add = {.phys = CRONUS_ADDR(0x000000)}, 32 .eic_slow0_strt_add = {.phys = CRONUS_ADDR(0x000000)},
33 .eic_cfg_bits = {.phys = CRONUS_ADDR(0x000038)}, 33 .eic_cfg_bits = {.phys = CRONUS_ADDR(0x000038)},
34 .eic_ready_status = {.phys = CRONUS_ADDR(0x00004C)}, 34 .eic_ready_status = {.phys = CRONUS_ADDR(0x00004C)},
diff --git a/arch/mips/powertv/asic/asic-gaia.c b/arch/mips/powertv/asic/asic-gaia.c
index 91dda682752c..47683b370e74 100644
--- a/arch/mips/powertv/asic/asic-gaia.c
+++ b/arch/mips/powertv/asic/asic-gaia.c
@@ -23,7 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <asm/mach-powertv/asic.h> 24#include <asm/mach-powertv/asic.h>
25 25
26const struct register_map gaia_register_map __initdata = { 26const struct register_map gaia_register_map __initconst = {
27 .eic_slow0_strt_add = {.phys = GAIA_IO_BASE + 0x000000}, 27 .eic_slow0_strt_add = {.phys = GAIA_IO_BASE + 0x000000},
28 .eic_cfg_bits = {.phys = GAIA_IO_BASE + 0x000038}, 28 .eic_cfg_bits = {.phys = GAIA_IO_BASE + 0x000038},
29 .eic_ready_status = {.phys = GAIA_IO_BASE + 0x00004C}, 29 .eic_ready_status = {.phys = GAIA_IO_BASE + 0x00004C},
diff --git a/arch/mips/powertv/asic/asic-zeus.c b/arch/mips/powertv/asic/asic-zeus.c
index 4a05bb096476..6ff4b10f09da 100644
--- a/arch/mips/powertv/asic/asic-zeus.c
+++ b/arch/mips/powertv/asic/asic-zeus.c
@@ -28,7 +28,7 @@
28 28
29#define ZEUS_ADDR(x) (ZEUS_IO_BASE + (x)) 29#define ZEUS_ADDR(x) (ZEUS_IO_BASE + (x))
30 30
31const struct register_map zeus_register_map __initdata = { 31const struct register_map zeus_register_map __initconst = {
32 .eic_slow0_strt_add = {.phys = ZEUS_ADDR(0x000000)}, 32 .eic_slow0_strt_add = {.phys = ZEUS_ADDR(0x000000)},
33 .eic_cfg_bits = {.phys = ZEUS_ADDR(0x000038)}, 33 .eic_cfg_bits = {.phys = ZEUS_ADDR(0x000038)},
34 .eic_ready_status = {.phys = ZEUS_ADDR(0x00004c)}, 34 .eic_ready_status = {.phys = ZEUS_ADDR(0x00004c)},
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 682efb0c108d..64eb71b15280 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -269,7 +269,7 @@ txx9_i8259_irq_setup(int irq)
269 return err; 269 return err;
270} 270}
271 271
272static void __init quirk_slc90e66_bridge(struct pci_dev *dev) 272static void __devinit quirk_slc90e66_bridge(struct pci_dev *dev)
273{ 273{
274 int irq; /* PCI/ISA Bridge interrupt */ 274 int irq; /* PCI/ISA Bridge interrupt */
275 u8 reg_64; 275 u8 reg_64;