aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-25 18:28:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-25 18:28:57 -0400
commit497c01dda9a6abc969573ba999a86ed04a835e76 (patch)
tree6eeb184184f3190bb19f96544125fdf5576a3840 /arch
parent01e9982ab39a1279adcb5d8741fd912870dc3d4b (diff)
parent608308682addfdc7b8e2aee88f0e028331d88e4d (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle: "Pretty much all across the field so with this we should be in reasonable shape for the upcoming -rc2" * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: MIPS: OCTEON: make get_system_type() thread-safe MIPS: CPS: Initialize EVA before bringing up VPEs from secondary cores MIPS: Malta: EVA: Rename 'eva_entry' to 'platform_eva_init' MIPS: EVA: Add new EVA header MIPS: scall64-o32: Fix indirect syscall detection MIPS: syscall: Fix AUDIT value for O32 processes on MIPS64 MIPS: Loongson: Fix COP2 usage for preemptible kernel MIPS: NL: Fix nlm_xlp_defconfig build error MIPS: Remove race window in page fault handling MIPS: Malta: Improve system memory detection for '{e, }memsize' >= 2G MIPS: Alchemy: Fix db1200 PSC clock enablement MIPS: BCM47XX: Fix reboot problem on BCM4705/BCM4785 MIPS: Remove duplicated include from numa.c MIPS: Add common plat_irq_dispatch declaration MIPS: MSP71xx: remove unused plat_irq_dispatch() argument MIPS: GIC: Remove useless parens from GICBIS(). MIPS: perf: Mark pmu interupt IRQF_NO_THREAD
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/alchemy/devboards/db1200.c6
-rw-r--r--arch/mips/bcm47xx/setup.c13
-rw-r--r--arch/mips/cavium-octeon/setup.c19
-rw-r--r--arch/mips/include/asm/eva.h43
-rw-r--r--arch/mips/include/asm/gic.h2
-rw-r--r--arch/mips/include/asm/irq.h2
-rw-r--r--arch/mips/include/asm/mach-malta/kernel-entry-init.h22
-rw-r--r--arch/mips/include/asm/mach-netlogic/topology.h7
-rw-r--r--arch/mips/include/asm/pgtable.h8
-rw-r--r--arch/mips/include/asm/syscall.h8
-rw-r--r--arch/mips/kernel/cps-vec.S4
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c2
-rw-r--r--arch/mips/kernel/scall64-o32.S12
-rw-r--r--arch/mips/loongson/loongson-3/cop2-ex.c8
-rw-r--r--arch/mips/loongson/loongson-3/numa.c2
-rw-r--r--arch/mips/mm/cache.c27
-rw-r--r--arch/mips/mti-malta/malta-memory.c14
-rw-r--r--arch/mips/pmcs-msp71xx/msp_irq.c2
18 files changed, 142 insertions, 59 deletions
diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c
index 776188908dfc..8c13675a12e7 100644
--- a/arch/mips/alchemy/devboards/db1200.c
+++ b/arch/mips/alchemy/devboards/db1200.c
@@ -847,6 +847,7 @@ int __init db1200_dev_setup(void)
847 pr_warn("DB1200: cant get I2C close to 50MHz\n"); 847 pr_warn("DB1200: cant get I2C close to 50MHz\n");
848 else 848 else
849 clk_set_rate(c, pfc); 849 clk_set_rate(c, pfc);
850 clk_prepare_enable(c);
850 clk_put(c); 851 clk_put(c);
851 } 852 }
852 853
@@ -922,11 +923,6 @@ int __init db1200_dev_setup(void)
922 } 923 }
923 924
924 /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */ 925 /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
925 c = clk_get(NULL, "psc1_intclk");
926 if (!IS_ERR(c)) {
927 clk_prepare_enable(c);
928 clk_put(c);
929 }
930 __raw_writel(PSC_SEL_CLK_SERCLK, 926 __raw_writel(PSC_SEL_CLK_SERCLK,
931 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); 927 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
932 wmb(); 928 wmb();
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 2b63e7e7d3d3..ad439c273003 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -59,12 +59,21 @@ static void bcm47xx_machine_restart(char *command)
59 switch (bcm47xx_bus_type) { 59 switch (bcm47xx_bus_type) {
60#ifdef CONFIG_BCM47XX_SSB 60#ifdef CONFIG_BCM47XX_SSB
61 case BCM47XX_BUS_TYPE_SSB: 61 case BCM47XX_BUS_TYPE_SSB:
62 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 3); 62 if (bcm47xx_bus.ssb.chip_id == 0x4785)
63 write_c0_diag4(1 << 22);
64 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
65 if (bcm47xx_bus.ssb.chip_id == 0x4785) {
66 __asm__ __volatile__(
67 ".set\tmips3\n\t"
68 "sync\n\t"
69 "wait\n\t"
70 ".set\tmips0");
71 }
63 break; 72 break;
64#endif 73#endif
65#ifdef CONFIG_BCM47XX_BCMA 74#ifdef CONFIG_BCM47XX_BCMA
66 case BCM47XX_BUS_TYPE_BCMA: 75 case BCM47XX_BUS_TYPE_BCMA:
67 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 3); 76 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1);
68 break; 77 break;
69#endif 78#endif
70 } 79 }
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 008e9c8b8eac..38f4c32e2816 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -263,7 +263,6 @@ static uint64_t crashk_size, crashk_base;
263static int octeon_uart; 263static int octeon_uart;
264 264
265extern asmlinkage void handle_int(void); 265extern asmlinkage void handle_int(void);
266extern asmlinkage void plat_irq_dispatch(void);
267 266
268/** 267/**
269 * Return non zero if we are currently running in the Octeon simulator 268 * Return non zero if we are currently running in the Octeon simulator
@@ -458,6 +457,18 @@ static void octeon_halt(void)
458 octeon_kill_core(NULL); 457 octeon_kill_core(NULL);
459} 458}
460 459
460static char __read_mostly octeon_system_type[80];
461
462static int __init init_octeon_system_type(void)
463{
464 snprintf(octeon_system_type, sizeof(octeon_system_type), "%s (%s)",
465 cvmx_board_type_to_string(octeon_bootinfo->board_type),
466 octeon_model_get_string(read_c0_prid()));
467
468 return 0;
469}
470early_initcall(init_octeon_system_type);
471
461/** 472/**
462 * Return a string representing the system type 473 * Return a string representing the system type
463 * 474 *
@@ -465,11 +476,7 @@ static void octeon_halt(void)
465 */ 476 */
466const char *octeon_board_type_string(void) 477const char *octeon_board_type_string(void)
467{ 478{
468 static char name[80]; 479 return octeon_system_type;
469 sprintf(name, "%s (%s)",
470 cvmx_board_type_to_string(octeon_bootinfo->board_type),
471 octeon_model_get_string(read_c0_prid()));
472 return name;
473} 480}
474 481
475const char *get_system_type(void) 482const char *get_system_type(void)
diff --git a/arch/mips/include/asm/eva.h b/arch/mips/include/asm/eva.h
new file mode 100644
index 000000000000..a3d1807f227c
--- /dev/null
+++ b/arch/mips/include/asm/eva.h
@@ -0,0 +1,43 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2014, Imagination Technologies Ltd.
7 *
8 * EVA functions for generic code
9 */
10
11#ifndef _ASM_EVA_H
12#define _ASM_EVA_H
13
14#include <kernel-entry-init.h>
15
16#ifdef __ASSEMBLY__
17
18#ifdef CONFIG_EVA
19
20/*
21 * EVA early init code
22 *
23 * Platforms must define their own 'platform_eva_init' macro in
24 * their kernel-entry-init.h header. This macro usually does the
25 * platform specific configuration of the segmentation registers,
26 * and it is normally called from assembly code.
27 *
28 */
29
30.macro eva_init
31platform_eva_init
32.endm
33
34#else
35
36.macro eva_init
37.endm
38
39#endif /* CONFIG_EVA */
40
41#endif /* __ASSEMBLY__ */
42
43#endif
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 3f20b2111d56..d7699cf7e135 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -49,7 +49,7 @@
49#endif 49#endif
50#define GICBIS(reg, mask, bits) \ 50#define GICBIS(reg, mask, bits) \
51 do { u32 data; \ 51 do { u32 data; \
52 GICREAD((reg), data); \ 52 GICREAD(reg, data); \
53 data &= ~(mask); \ 53 data &= ~(mask); \
54 data |= ((bits) & (mask)); \ 54 data |= ((bits) & (mask)); \
55 GICWRITE((reg), data); \ 55 GICWRITE((reg), data); \
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h
index ae1f7b24dd1a..39f07aec640c 100644
--- a/arch/mips/include/asm/irq.h
+++ b/arch/mips/include/asm/irq.h
@@ -26,6 +26,8 @@ static inline int irq_canonicalize(int irq)
26#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */ 26#define irq_canonicalize(irq) (irq) /* Sane hardware, sane code ... */
27#endif 27#endif
28 28
29asmlinkage void plat_irq_dispatch(void);
30
29extern void do_IRQ(unsigned int irq); 31extern void do_IRQ(unsigned int irq);
30 32
31extern void arch_init_irq(void); 33extern void arch_init_irq(void);
diff --git a/arch/mips/include/asm/mach-malta/kernel-entry-init.h b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
index 77eeda77e73c..0cf8622db27f 100644
--- a/arch/mips/include/asm/mach-malta/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-malta/kernel-entry-init.h
@@ -10,14 +10,15 @@
10#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H 10#ifndef __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
11#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H 11#define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H
12 12
13#include <asm/regdef.h>
14#include <asm/mipsregs.h>
15
13 /* 16 /*
14 * Prepare segments for EVA boot: 17 * Prepare segments for EVA boot:
15 * 18 *
16 * This is in case the processor boots in legacy configuration 19 * This is in case the processor boots in legacy configuration
17 * (SI_EVAReset is de-asserted and CONFIG5.K == 0) 20 * (SI_EVAReset is de-asserted and CONFIG5.K == 0)
18 * 21 *
19 * On entry, t1 is loaded with CP0_CONFIG
20 *
21 * ========================= Mappings ============================= 22 * ========================= Mappings =============================
22 * Virtual memory Physical memory Mapping 23 * Virtual memory Physical memory Mapping
23 * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg) 24 * 0x00000000 - 0x7fffffff 0x80000000 - 0xfffffffff MUSUK (kuseg)
@@ -30,12 +31,20 @@
30 * 31 *
31 * 32 *
32 * Lowmem is expanded to 2GB 33 * Lowmem is expanded to 2GB
34 *
35 * The following code uses the t0, t1, t2 and ra registers without
36 * previously preserving them.
37 *
33 */ 38 */
34 .macro eva_entry 39 .macro platform_eva_init
40
41 .set push
42 .set reorder
35 /* 43 /*
36 * Get Config.K0 value and use it to program 44 * Get Config.K0 value and use it to program
37 * the segmentation registers 45 * the segmentation registers
38 */ 46 */
47 mfc0 t1, CP0_CONFIG
39 andi t1, 0x7 /* CCA */ 48 andi t1, 0x7 /* CCA */
40 move t2, t1 49 move t2, t1
41 ins t2, t1, 16, 3 50 ins t2, t1, 16, 3
@@ -77,6 +86,8 @@
77 mtc0 t0, $16, 5 86 mtc0 t0, $16, 5
78 sync 87 sync
79 jal mips_ihb 88 jal mips_ihb
89
90 .set pop
80 .endm 91 .endm
81 92
82 .macro kernel_entry_setup 93 .macro kernel_entry_setup
@@ -95,7 +106,7 @@
95 sll t0, t0, 6 /* SC bit */ 106 sll t0, t0, 6 /* SC bit */
96 bgez t0, 9f 107 bgez t0, 9f
97 108
98 eva_entry 109 platform_eva_init
99 b 0f 110 b 0f
1009: 1119:
101 /* Assume we came from YAMON... */ 112 /* Assume we came from YAMON... */
@@ -127,8 +138,7 @@ nonsc_processor:
127#ifdef CONFIG_EVA 138#ifdef CONFIG_EVA
128 sync 139 sync
129 ehb 140 ehb
130 mfc0 t1, CP0_CONFIG 141 platform_eva_init
131 eva_entry
132#endif 142#endif
133 .endm 143 .endm
134 144
diff --git a/arch/mips/include/asm/mach-netlogic/topology.h b/arch/mips/include/asm/mach-netlogic/topology.h
index ceeb1f5e7129..0eb43c832b25 100644
--- a/arch/mips/include/asm/mach-netlogic/topology.h
+++ b/arch/mips/include/asm/mach-netlogic/topology.h
@@ -10,13 +10,6 @@
10 10
11#include <asm/mach-netlogic/multi-node.h> 11#include <asm/mach-netlogic/multi-node.h>
12 12
13#ifdef CONFIG_SMP
14#define topology_physical_package_id(cpu) cpu_to_node(cpu)
15#define topology_core_id(cpu) (cpu_logical_map(cpu) / NLM_THREADS_PER_CORE)
16#define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu])
17#define topology_core_cpumask(cpu) cpumask_of_node(cpu_to_node(cpu))
18#endif
19
20#include <asm-generic/topology.h> 13#include <asm-generic/topology.h>
21 14
22#endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */ 15#endif /* _ASM_MACH_NETLOGIC_TOPOLOGY_H */
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 027c74db13f9..df49a308085c 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -122,6 +122,9 @@ do { \
122 } \ 122 } \
123} while(0) 123} while(0)
124 124
125extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
126 pte_t pteval);
127
125#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) 128#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
126 129
127#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL)) 130#define pte_none(pte) (!(((pte).pte_low | (pte).pte_high) & ~_PAGE_GLOBAL))
@@ -145,7 +148,6 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
145 } 148 }
146 } 149 }
147} 150}
148#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
149 151
150static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 152static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
151{ 153{
@@ -183,7 +185,6 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
183 } 185 }
184#endif 186#endif
185} 187}
186#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
187 188
188static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 189static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
189{ 190{
@@ -390,15 +391,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
390 391
391extern void __update_tlb(struct vm_area_struct *vma, unsigned long address, 392extern void __update_tlb(struct vm_area_struct *vma, unsigned long address,
392 pte_t pte); 393 pte_t pte);
393extern void __update_cache(struct vm_area_struct *vma, unsigned long address,
394 pte_t pte);
395 394
396static inline void update_mmu_cache(struct vm_area_struct *vma, 395static inline void update_mmu_cache(struct vm_area_struct *vma,
397 unsigned long address, pte_t *ptep) 396 unsigned long address, pte_t *ptep)
398{ 397{
399 pte_t pte = *ptep; 398 pte_t pte = *ptep;
400 __update_tlb(vma, address, pte); 399 __update_tlb(vma, address, pte);
401 __update_cache(vma, address, pte);
402} 400}
403 401
404static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, 402static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index 17960fe7a8ce..cdf68b33bd65 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -131,10 +131,12 @@ static inline int syscall_get_arch(void)
131{ 131{
132 int arch = EM_MIPS; 132 int arch = EM_MIPS;
133#ifdef CONFIG_64BIT 133#ifdef CONFIG_64BIT
134 if (!test_thread_flag(TIF_32BIT_REGS)) 134 if (!test_thread_flag(TIF_32BIT_REGS)) {
135 arch |= __AUDIT_ARCH_64BIT; 135 arch |= __AUDIT_ARCH_64BIT;
136 if (test_thread_flag(TIF_32BIT_ADDR)) 136 /* N32 sets only TIF_32BIT_ADDR */
137 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32; 137 if (test_thread_flag(TIF_32BIT_ADDR))
138 arch |= __AUDIT_ARCH_CONVENTION_MIPS64_N32;
139 }
138#endif 140#endif
139#if defined(__LITTLE_ENDIAN) 141#if defined(__LITTLE_ENDIAN)
140 arch |= __AUDIT_ARCH_LE; 142 arch |= __AUDIT_ARCH_LE;
diff --git a/arch/mips/kernel/cps-vec.S b/arch/mips/kernel/cps-vec.S
index 6f4f739dad96..e6e97d2a5c9e 100644
--- a/arch/mips/kernel/cps-vec.S
+++ b/arch/mips/kernel/cps-vec.S
@@ -13,6 +13,7 @@
13#include <asm/asm-offsets.h> 13#include <asm/asm-offsets.h>
14#include <asm/asmmacro.h> 14#include <asm/asmmacro.h>
15#include <asm/cacheops.h> 15#include <asm/cacheops.h>
16#include <asm/eva.h>
16#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
17#include <asm/mipsmtregs.h> 18#include <asm/mipsmtregs.h>
18#include <asm/pm.h> 19#include <asm/pm.h>
@@ -166,6 +167,9 @@ dcache_done:
1661: jal mips_cps_core_init 1671: jal mips_cps_core_init
167 nop 168 nop
168 169
170 /* Do any EVA initialization if necessary */
171 eva_init
172
169 /* 173 /*
170 * Boot any other VPEs within this core that should be online, and 174 * Boot any other VPEs within this core that should be online, and
171 * deactivate this VPE if it should be offline. 175 * deactivate this VPE if it should be offline.
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index 14bf74b0f51c..b63f2482f288 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -558,7 +558,7 @@ static int mipspmu_get_irq(void)
558 if (mipspmu.irq >= 0) { 558 if (mipspmu.irq >= 0) {
559 /* Request my own irq handler. */ 559 /* Request my own irq handler. */
560 err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq, 560 err = request_irq(mipspmu.irq, mipsxx_pmu_handle_irq,
561 IRQF_PERCPU | IRQF_NOBALANCING, 561 IRQF_PERCPU | IRQF_NOBALANCING | IRQF_NO_THREAD,
562 "mips_perf_pmu", NULL); 562 "mips_perf_pmu", NULL);
563 if (err) { 563 if (err) {
564 pr_warning("Unable to request IRQ%d for MIPS " 564 pr_warning("Unable to request IRQ%d for MIPS "
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 13b964fddc4a..25bb8400156d 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -113,15 +113,19 @@ trace_a_syscall:
113 move s0, t2 # Save syscall pointer 113 move s0, t2 # Save syscall pointer
114 move a0, sp 114 move a0, sp
115 /* 115 /*
116 * syscall number is in v0 unless we called syscall(__NR_###) 116 * absolute syscall number is in v0 unless we called syscall(__NR_###)
117 * where the real syscall number is in a0 117 * where the real syscall number is in a0
118 * note: NR_syscall is the first O32 syscall but the macro is 118 * note: NR_syscall is the first O32 syscall but the macro is
119 * only defined when compiling with -mabi=32 (CONFIG_32BIT) 119 * only defined when compiling with -mabi=32 (CONFIG_32BIT)
120 * therefore __NR_O32_Linux is used (4000) 120 * therefore __NR_O32_Linux is used (4000)
121 */ 121 */
122 addiu a1, v0, __NR_O32_Linux 122 .set push
123 bnez v0, 1f /* __NR_syscall at offset 0 */ 123 .set reorder
124 lw a1, PT_R4(sp) 124 subu t1, v0, __NR_O32_Linux
125 move a1, v0
126 bnez t1, 1f /* __NR_syscall at offset 0 */
127 lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */
128 .set pop
125 129
1261: jal syscall_trace_enter 1301: jal syscall_trace_enter
127 131
diff --git a/arch/mips/loongson/loongson-3/cop2-ex.c b/arch/mips/loongson/loongson-3/cop2-ex.c
index 9182e8d2967c..b03e37d2071a 100644
--- a/arch/mips/loongson/loongson-3/cop2-ex.c
+++ b/arch/mips/loongson/loongson-3/cop2-ex.c
@@ -22,13 +22,13 @@
22static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action, 22static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
23 void *data) 23 void *data)
24{ 24{
25 int fpu_enabled; 25 int fpu_owned;
26 int fr = !test_thread_flag(TIF_32BIT_FPREGS); 26 int fr = !test_thread_flag(TIF_32BIT_FPREGS);
27 27
28 switch (action) { 28 switch (action) {
29 case CU2_EXCEPTION: 29 case CU2_EXCEPTION:
30 preempt_disable(); 30 preempt_disable();
31 fpu_enabled = read_c0_status() & ST0_CU1; 31 fpu_owned = __is_fpu_owner();
32 if (!fr) 32 if (!fr)
33 set_c0_status(ST0_CU1 | ST0_CU2); 33 set_c0_status(ST0_CU1 | ST0_CU2);
34 else 34 else
@@ -39,8 +39,8 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
39 KSTK_STATUS(current) |= ST0_FR; 39 KSTK_STATUS(current) |= ST0_FR;
40 else 40 else
41 KSTK_STATUS(current) &= ~ST0_FR; 41 KSTK_STATUS(current) &= ~ST0_FR;
42 /* If FPU is enabled, we needn't init or restore fp */ 42 /* If FPU is owned, we needn't init or restore fp */
43 if(!fpu_enabled) { 43 if (!fpu_owned) {
44 set_thread_flag(TIF_USEDFPU); 44 set_thread_flag(TIF_USEDFPU);
45 if (!used_math()) { 45 if (!used_math()) {
46 _init_fpu(); 46 _init_fpu();
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c
index ca025a6ba559..37ed184398c6 100644
--- a/arch/mips/loongson/loongson-3/numa.c
+++ b/arch/mips/loongson/loongson-3/numa.c
@@ -24,8 +24,6 @@
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/pgalloc.h> 25#include <asm/pgalloc.h>
26#include <asm/sections.h> 26#include <asm/sections.h>
27#include <linux/bootmem.h>
28#include <linux/init.h>
29#include <linux/irq.h> 27#include <linux/irq.h>
30#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
31#include <asm/mc146818-time.h> 29#include <asm/mc146818-time.h>
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index f7b91d3a371d..7e3ea7766822 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -119,25 +119,36 @@ void __flush_anon_page(struct page *page, unsigned long vmaddr)
119 119
120EXPORT_SYMBOL(__flush_anon_page); 120EXPORT_SYMBOL(__flush_anon_page);
121 121
122void __update_cache(struct vm_area_struct *vma, unsigned long address, 122static void mips_flush_dcache_from_pte(pte_t pteval, unsigned long address)
123 pte_t pte)
124{ 123{
125 struct page *page; 124 struct page *page;
126 unsigned long pfn, addr; 125 unsigned long pfn = pte_pfn(pteval);
127 int exec = (vma->vm_flags & VM_EXEC) && !cpu_has_ic_fills_f_dc;
128 126
129 pfn = pte_pfn(pte);
130 if (unlikely(!pfn_valid(pfn))) 127 if (unlikely(!pfn_valid(pfn)))
131 return; 128 return;
129
132 page = pfn_to_page(pfn); 130 page = pfn_to_page(pfn);
133 if (page_mapping(page) && Page_dcache_dirty(page)) { 131 if (page_mapping(page) && Page_dcache_dirty(page)) {
134 addr = (unsigned long) page_address(page); 132 unsigned long page_addr = (unsigned long) page_address(page);
135 if (exec || pages_do_alias(addr, address & PAGE_MASK)) 133
136 flush_data_cache_page(addr); 134 if (!cpu_has_ic_fills_f_dc ||
135 pages_do_alias(page_addr, address & PAGE_MASK))
136 flush_data_cache_page(page_addr);
137 ClearPageDcacheDirty(page); 137 ClearPageDcacheDirty(page);
138 } 138 }
139} 139}
140 140
141void set_pte_at(struct mm_struct *mm, unsigned long addr,
142 pte_t *ptep, pte_t pteval)
143{
144 if (cpu_has_dc_aliases || !cpu_has_ic_fills_f_dc) {
145 if (pte_present(pteval))
146 mips_flush_dcache_from_pte(pteval, addr);
147 }
148
149 set_pte(ptep, pteval);
150}
151
141unsigned long _page_cachable_default; 152unsigned long _page_cachable_default;
142EXPORT_SYMBOL(_page_cachable_default); 153EXPORT_SYMBOL(_page_cachable_default);
143 154
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 0c35dee0a215..8fddd2cdbff7 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -35,13 +35,19 @@ fw_memblock_t * __init fw_getmdesc(int eva)
35 /* otherwise look in the environment */ 35 /* otherwise look in the environment */
36 36
37 memsize_str = fw_getenv("memsize"); 37 memsize_str = fw_getenv("memsize");
38 if (memsize_str) 38 if (memsize_str) {
39 tmp = kstrtol(memsize_str, 0, &memsize); 39 tmp = kstrtoul(memsize_str, 0, &memsize);
40 if (tmp)
41 pr_warn("Failed to read the 'memsize' env variable.\n");
42 }
40 if (eva) { 43 if (eva) {
41 /* Look for ememsize for EVA */ 44 /* Look for ememsize for EVA */
42 ememsize_str = fw_getenv("ememsize"); 45 ememsize_str = fw_getenv("ememsize");
43 if (ememsize_str) 46 if (ememsize_str) {
44 tmp = kstrtol(ememsize_str, 0, &ememsize); 47 tmp = kstrtoul(ememsize_str, 0, &ememsize);
48 if (tmp)
49 pr_warn("Failed to read the 'ememsize' env variable.\n");
50 }
45 } 51 }
46 if (!memsize && !ememsize) { 52 if (!memsize && !ememsize) {
47 pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); 53 pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
diff --git a/arch/mips/pmcs-msp71xx/msp_irq.c b/arch/mips/pmcs-msp71xx/msp_irq.c
index 941744aabb51..f914c753de21 100644
--- a/arch/mips/pmcs-msp71xx/msp_irq.c
+++ b/arch/mips/pmcs-msp71xx/msp_irq.c
@@ -51,7 +51,7 @@ static inline void sec_int_dispatch(void) { do_IRQ(MSP_INT_SEC); }
51 * the range 40-71. 51 * the range 40-71.
52 */ 52 */
53 53
54asmlinkage void plat_irq_dispatch(struct pt_regs *regs) 54asmlinkage void plat_irq_dispatch(void)
55{ 55{
56 u32 pending; 56 u32 pending;
57 57