diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-09 21:10:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-09 21:10:34 -0400 |
commit | 82abb273d838318424644d8f02825db0fbbd400a (patch) | |
tree | e1ea8a92db4ba68f347249986ffe3a25ffbf8219 /arch/mips/include | |
parent | 9b651cc2277b5e4883012ebab0fea2bcda4cbafa (diff) | |
parent | f8647b506d7116a1a3accd8d618184096e85f50b (diff) |
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle:
- three fixes for 3.15 that didn't make it in time
- limited Octeon 3 support.
- paravirtualization support
- improvment to platform support for Netlogix SOCs.
- add support for powering down the Malta eval board in software
- add many instructions to the in-kernel microassembler.
- add support for the BPF JIT.
- minor cleanups of the BCM47xx code.
- large cleanup of math emu code resulting in significant code size
reduction, better readability of the code and more accurate
emulation.
- improvments to the MIPS CPS code.
- support C3 power status for the R4k count/compare clock device.
- improvments to the GIO support for older SGI workstations.
- increase number of supported CPUs to 256; this can be reached on
certain embedded multithreaded ccNUMA configurations.
- various small cleanups, updates and fixes
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (173 commits)
MIPS: IP22/IP28: Improve GIO support
MIPS: Octeon: Add twsi interrupt initialization for OCTEON 3XXX, 5XXX, 63XX
DEC: Document the R4k MB ASIC mini interrupt controller
DEC: Add self as the maintainer
MIPS: Add microMIPS MSA support.
MIPS: Replace calls to obsolete strict_strto call with kstrto* equivalents.
MIPS: Replace obsolete strict_strto call with kstrto
MIPS: BFP: Simplify code slightly.
MIPS: Call find_vma with the mmap_sem held
MIPS: Fix 'write_msa_##' inline macro.
MIPS: Fix MSA toolchain support detection.
mips: Update the email address of Geert Uytterhoeven
MIPS: Add minimal defconfig for mips_paravirt
MIPS: Enable build for new system 'paravirt'
MIPS: paravirt: Add pci controller for virtio
MIPS: Add code for new system 'paravirt'
MIPS: Add functions for hypervisor call
MIPS: OCTEON: Add OCTEON3 to __get_cpu_type
MIPS: Add function get_ebase_cpunum
MIPS: Add minimal support for OCTEON3 to c-r4k.c
...
Diffstat (limited to 'arch/mips/include')
69 files changed, 992 insertions, 1021 deletions
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h index b464b8b1147a..935543f14538 100644 --- a/arch/mips/include/asm/asmmacro.h +++ b/arch/mips/include/asm/asmmacro.h | |||
@@ -17,26 +17,8 @@ | |||
17 | #ifdef CONFIG_64BIT | 17 | #ifdef CONFIG_64BIT |
18 | #include <asm/asmmacro-64.h> | 18 | #include <asm/asmmacro-64.h> |
19 | #endif | 19 | #endif |
20 | #ifdef CONFIG_MIPS_MT_SMTC | ||
21 | #include <asm/mipsmtregs.h> | ||
22 | #endif | ||
23 | |||
24 | #ifdef CONFIG_MIPS_MT_SMTC | ||
25 | .macro local_irq_enable reg=t0 | ||
26 | mfc0 \reg, CP0_TCSTATUS | ||
27 | ori \reg, \reg, TCSTATUS_IXMT | ||
28 | xori \reg, \reg, TCSTATUS_IXMT | ||
29 | mtc0 \reg, CP0_TCSTATUS | ||
30 | _ehb | ||
31 | .endm | ||
32 | 20 | ||
33 | .macro local_irq_disable reg=t0 | 21 | #ifdef CONFIG_CPU_MIPSR2 |
34 | mfc0 \reg, CP0_TCSTATUS | ||
35 | ori \reg, \reg, TCSTATUS_IXMT | ||
36 | mtc0 \reg, CP0_TCSTATUS | ||
37 | _ehb | ||
38 | .endm | ||
39 | #elif defined(CONFIG_CPU_MIPSR2) | ||
40 | .macro local_irq_enable reg=t0 | 22 | .macro local_irq_enable reg=t0 |
41 | ei | 23 | ei |
42 | irq_enable_hazard | 24 | irq_enable_hazard |
@@ -71,7 +53,7 @@ | |||
71 | sw \reg, TI_PRE_COUNT($28) | 53 | sw \reg, TI_PRE_COUNT($28) |
72 | #endif | 54 | #endif |
73 | .endm | 55 | .endm |
74 | #endif /* CONFIG_MIPS_MT_SMTC */ | 56 | #endif /* CONFIG_CPU_MIPSR2 */ |
75 | 57 | ||
76 | .macro fpu_save_16even thread tmp=t0 | 58 | .macro fpu_save_16even thread tmp=t0 |
77 | cfc1 \tmp, fcr31 | 59 | cfc1 \tmp, fcr31 |
@@ -267,13 +249,35 @@ | |||
267 | .set pop | 249 | .set pop |
268 | .endm | 250 | .endm |
269 | #else | 251 | #else |
252 | |||
253 | #ifdef CONFIG_CPU_MICROMIPS | ||
254 | #define CFC_MSA_INSN 0x587e0056 | ||
255 | #define CTC_MSA_INSN 0x583e0816 | ||
256 | #define LDD_MSA_INSN 0x58000837 | ||
257 | #define STD_MSA_INSN 0x5800083f | ||
258 | #define COPY_UW_MSA_INSN 0x58f00056 | ||
259 | #define COPY_UD_MSA_INSN 0x58f80056 | ||
260 | #define INSERT_W_MSA_INSN 0x59300816 | ||
261 | #define INSERT_D_MSA_INSN 0x59380816 | ||
262 | #else | ||
263 | #define CFC_MSA_INSN 0x787e0059 | ||
264 | #define CTC_MSA_INSN 0x783e0819 | ||
265 | #define LDD_MSA_INSN 0x78000823 | ||
266 | #define STD_MSA_INSN 0x78000827 | ||
267 | #define COPY_UW_MSA_INSN 0x78f00059 | ||
268 | #define COPY_UD_MSA_INSN 0x78f80059 | ||
269 | #define INSERT_W_MSA_INSN 0x79300819 | ||
270 | #define INSERT_D_MSA_INSN 0x79380819 | ||
271 | #endif | ||
272 | |||
270 | /* | 273 | /* |
271 | * Temporary until all toolchains in use include MSA support. | 274 | * Temporary until all toolchains in use include MSA support. |
272 | */ | 275 | */ |
273 | .macro cfcmsa rd, cs | 276 | .macro cfcmsa rd, cs |
274 | .set push | 277 | .set push |
275 | .set noat | 278 | .set noat |
276 | .word 0x787e0059 | (\cs << 11) | 279 | .insn |
280 | .word CFC_MSA_INSN | (\cs << 11) | ||
277 | move \rd, $1 | 281 | move \rd, $1 |
278 | .set pop | 282 | .set pop |
279 | .endm | 283 | .endm |
@@ -282,7 +286,7 @@ | |||
282 | .set push | 286 | .set push |
283 | .set noat | 287 | .set noat |
284 | move $1, \rs | 288 | move $1, \rs |
285 | .word 0x783e0819 | (\cd << 6) | 289 | .word CTC_MSA_INSN | (\cd << 6) |
286 | .set pop | 290 | .set pop |
287 | .endm | 291 | .endm |
288 | 292 | ||
@@ -290,7 +294,7 @@ | |||
290 | .set push | 294 | .set push |
291 | .set noat | 295 | .set noat |
292 | add $1, \base, \off | 296 | add $1, \base, \off |
293 | .word 0x78000823 | (\wd << 6) | 297 | .word LDD_MSA_INSN | (\wd << 6) |
294 | .set pop | 298 | .set pop |
295 | .endm | 299 | .endm |
296 | 300 | ||
@@ -298,14 +302,15 @@ | |||
298 | .set push | 302 | .set push |
299 | .set noat | 303 | .set noat |
300 | add $1, \base, \off | 304 | add $1, \base, \off |
301 | .word 0x78000827 | (\wd << 6) | 305 | .word STD_MSA_INSN | (\wd << 6) |
302 | .set pop | 306 | .set pop |
303 | .endm | 307 | .endm |
304 | 308 | ||
305 | .macro copy_u_w rd, ws, n | 309 | .macro copy_u_w rd, ws, n |
306 | .set push | 310 | .set push |
307 | .set noat | 311 | .set noat |
308 | .word 0x78f00059 | (\n << 16) | (\ws << 11) | 312 | .insn |
313 | .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) | ||
309 | /* move triggers an assembler bug... */ | 314 | /* move triggers an assembler bug... */ |
310 | or \rd, $1, zero | 315 | or \rd, $1, zero |
311 | .set pop | 316 | .set pop |
@@ -314,7 +319,8 @@ | |||
314 | .macro copy_u_d rd, ws, n | 319 | .macro copy_u_d rd, ws, n |
315 | .set push | 320 | .set push |
316 | .set noat | 321 | .set noat |
317 | .word 0x78f80059 | (\n << 16) | (\ws << 11) | 322 | .insn |
323 | .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) | ||
318 | /* move triggers an assembler bug... */ | 324 | /* move triggers an assembler bug... */ |
319 | or \rd, $1, zero | 325 | or \rd, $1, zero |
320 | .set pop | 326 | .set pop |
@@ -325,7 +331,7 @@ | |||
325 | .set noat | 331 | .set noat |
326 | /* move triggers an assembler bug... */ | 332 | /* move triggers an assembler bug... */ |
327 | or $1, \rs, zero | 333 | or $1, \rs, zero |
328 | .word 0x79300819 | (\n << 16) | (\wd << 6) | 334 | .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6) |
329 | .set pop | 335 | .set pop |
330 | .endm | 336 | .endm |
331 | 337 | ||
@@ -334,7 +340,7 @@ | |||
334 | .set noat | 340 | .set noat |
335 | /* move triggers an assembler bug... */ | 341 | /* move triggers an assembler bug... */ |
336 | or $1, \rs, zero | 342 | or $1, \rs, zero |
337 | .word 0x79380819 | (\n << 16) | (\wd << 6) | 343 | .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6) |
338 | .set pop | 344 | .set pop |
339 | .endm | 345 | .endm |
340 | #endif | 346 | #endif |
diff --git a/arch/mips/include/asm/branch.h b/arch/mips/include/asm/branch.h index e28a3e0eb3cb..de781cf54bc7 100644 --- a/arch/mips/include/asm/branch.h +++ b/arch/mips/include/asm/branch.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #ifndef _ASM_BRANCH_H | 8 | #ifndef _ASM_BRANCH_H |
9 | #define _ASM_BRANCH_H | 9 | #define _ASM_BRANCH_H |
10 | 10 | ||
11 | #include <asm/cpu-features.h> | ||
12 | #include <asm/mipsregs.h> | ||
11 | #include <asm/ptrace.h> | 13 | #include <asm/ptrace.h> |
12 | #include <asm/inst.h> | 14 | #include <asm/inst.h> |
13 | 15 | ||
@@ -18,12 +20,40 @@ extern int __compute_return_epc_for_insn(struct pt_regs *regs, | |||
18 | extern int __microMIPS_compute_return_epc(struct pt_regs *regs); | 20 | extern int __microMIPS_compute_return_epc(struct pt_regs *regs); |
19 | extern int __MIPS16e_compute_return_epc(struct pt_regs *regs); | 21 | extern int __MIPS16e_compute_return_epc(struct pt_regs *regs); |
20 | 22 | ||
23 | /* | ||
24 | * microMIPS bitfields | ||
25 | */ | ||
26 | #define MM_POOL32A_MINOR_MASK 0x3f | ||
27 | #define MM_POOL32A_MINOR_SHIFT 0x6 | ||
28 | #define MM_MIPS32_COND_FC 0x30 | ||
29 | |||
30 | extern int __mm_isBranchInstr(struct pt_regs *regs, | ||
31 | struct mm_decoded_insn dec_insn, unsigned long *contpc); | ||
32 | |||
33 | static inline int mm_isBranchInstr(struct pt_regs *regs, | ||
34 | struct mm_decoded_insn dec_insn, unsigned long *contpc) | ||
35 | { | ||
36 | if (!cpu_has_mmips) | ||
37 | return 0; | ||
38 | |||
39 | return __mm_isBranchInstr(regs, dec_insn, contpc); | ||
40 | } | ||
21 | 41 | ||
22 | static inline int delay_slot(struct pt_regs *regs) | 42 | static inline int delay_slot(struct pt_regs *regs) |
23 | { | 43 | { |
24 | return regs->cp0_cause & CAUSEF_BD; | 44 | return regs->cp0_cause & CAUSEF_BD; |
25 | } | 45 | } |
26 | 46 | ||
47 | static inline void clear_delay_slot(struct pt_regs *regs) | ||
48 | { | ||
49 | regs->cp0_cause &= ~CAUSEF_BD; | ||
50 | } | ||
51 | |||
52 | static inline void set_delay_slot(struct pt_regs *regs) | ||
53 | { | ||
54 | regs->cp0_cause |= CAUSEF_BD; | ||
55 | } | ||
56 | |||
27 | static inline unsigned long exception_epc(struct pt_regs *regs) | 57 | static inline unsigned long exception_epc(struct pt_regs *regs) |
28 | { | 58 | { |
29 | if (likely(!delay_slot(regs))) | 59 | if (likely(!delay_slot(regs))) |
diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h index 69468ded2828..e08381a37f8b 100644 --- a/arch/mips/include/asm/cacheflush.h +++ b/arch/mips/include/asm/cacheflush.h | |||
@@ -113,6 +113,12 @@ unsigned long run_uncached(void *func); | |||
113 | 113 | ||
114 | extern void *kmap_coherent(struct page *page, unsigned long addr); | 114 | extern void *kmap_coherent(struct page *page, unsigned long addr); |
115 | extern void kunmap_coherent(void); | 115 | extern void kunmap_coherent(void); |
116 | extern void *kmap_noncoherent(struct page *page, unsigned long addr); | ||
117 | |||
118 | static inline void kunmap_noncoherent(void) | ||
119 | { | ||
120 | kunmap_coherent(); | ||
121 | } | ||
116 | 122 | ||
117 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE | 123 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE |
118 | static inline void flush_kernel_dcache_page(struct page *page) | 124 | static inline void flush_kernel_dcache_page(struct page *page) |
diff --git a/arch/mips/include/asm/cmp.h b/arch/mips/include/asm/cmp.h index 89a73fb93ae6..033d97303c85 100644 --- a/arch/mips/include/asm/cmp.h +++ b/arch/mips/include/asm/cmp.h | |||
@@ -10,7 +10,6 @@ extern void cmp_smp_setup(void); | |||
10 | extern void cmp_smp_finish(void); | 10 | extern void cmp_smp_finish(void); |
11 | extern void cmp_boot_secondary(int cpu, struct task_struct *t); | 11 | extern void cmp_boot_secondary(int cpu, struct task_struct *t); |
12 | extern void cmp_init_secondary(void); | 12 | extern void cmp_init_secondary(void); |
13 | extern void cmp_cpus_done(void); | ||
14 | extern void cmp_prepare_cpus(unsigned int max_cpus); | 13 | extern void cmp_prepare_cpus(unsigned int max_cpus); |
15 | 14 | ||
16 | /* This is platform specific */ | 15 | /* This is platform specific */ |
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h index f56cc975b92f..c7d8c997d93e 100644 --- a/arch/mips/include/asm/cpu-features.h +++ b/arch/mips/include/asm/cpu-features.h | |||
@@ -110,9 +110,15 @@ | |||
110 | #ifndef cpu_has_smartmips | 110 | #ifndef cpu_has_smartmips |
111 | #define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS) | 111 | #define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS) |
112 | #endif | 112 | #endif |
113 | |||
113 | #ifndef cpu_has_rixi | 114 | #ifndef cpu_has_rixi |
114 | #define cpu_has_rixi (cpu_data[0].options & MIPS_CPU_RIXI) | 115 | # ifdef CONFIG_64BIT |
116 | # define cpu_has_rixi (cpu_data[0].options & MIPS_CPU_RIXI) | ||
117 | # else /* CONFIG_32BIT */ | ||
118 | # define cpu_has_rixi ((cpu_data[0].options & MIPS_CPU_RIXI) && !cpu_has_64bits) | ||
119 | # endif | ||
115 | #endif | 120 | #endif |
121 | |||
116 | #ifndef cpu_has_mmips | 122 | #ifndef cpu_has_mmips |
117 | # ifdef CONFIG_SYS_SUPPORTS_MICROMIPS | 123 | # ifdef CONFIG_SYS_SUPPORTS_MICROMIPS |
118 | # define cpu_has_mmips (cpu_data[0].options & MIPS_CPU_MICROMIPS) | 124 | # define cpu_has_mmips (cpu_data[0].options & MIPS_CPU_MICROMIPS) |
@@ -120,6 +126,7 @@ | |||
120 | # define cpu_has_mmips 0 | 126 | # define cpu_has_mmips 0 |
121 | # endif | 127 | # endif |
122 | #endif | 128 | #endif |
129 | |||
123 | #ifndef cpu_has_vtag_icache | 130 | #ifndef cpu_has_vtag_icache |
124 | #define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG) | 131 | #define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG) |
125 | #endif | 132 | #endif |
@@ -183,6 +190,17 @@ | |||
183 | /* | 190 | /* |
184 | * Shortcuts ... | 191 | * Shortcuts ... |
185 | */ | 192 | */ |
193 | #define cpu_has_mips_2_3_4_5 (cpu_has_mips_2 | cpu_has_mips_3_4_5) | ||
194 | #define cpu_has_mips_3_4_5 (cpu_has_mips_3 | cpu_has_mips_4_5) | ||
195 | #define cpu_has_mips_4_5 (cpu_has_mips_4 | cpu_has_mips_5) | ||
196 | |||
197 | #define cpu_has_mips_2_3_4_5_r (cpu_has_mips_2 | cpu_has_mips_3_4_5_r) | ||
198 | #define cpu_has_mips_3_4_5_r (cpu_has_mips_3 | cpu_has_mips_4_5_r) | ||
199 | #define cpu_has_mips_4_5_r (cpu_has_mips_4 | cpu_has_mips_5_r) | ||
200 | #define cpu_has_mips_5_r (cpu_has_mips_5 | cpu_has_mips_r) | ||
201 | |||
202 | #define cpu_has_mips_4_5_r2 (cpu_has_mips_4_5 | cpu_has_mips_r2) | ||
203 | |||
186 | #define cpu_has_mips32 (cpu_has_mips32r1 | cpu_has_mips32r2) | 204 | #define cpu_has_mips32 (cpu_has_mips32r1 | cpu_has_mips32r2) |
187 | #define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2) | 205 | #define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2) |
188 | #define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1) | 206 | #define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1) |
diff --git a/arch/mips/include/asm/cpu-info.h b/arch/mips/include/asm/cpu-info.h index ff2707ab3295..47d5967ce7ef 100644 --- a/arch/mips/include/asm/cpu-info.h +++ b/arch/mips/include/asm/cpu-info.h | |||
@@ -65,18 +65,13 @@ struct cpuinfo_mips { | |||
65 | #ifdef CONFIG_64BIT | 65 | #ifdef CONFIG_64BIT |
66 | int vmbits; /* Virtual memory size in bits */ | 66 | int vmbits; /* Virtual memory size in bits */ |
67 | #endif | 67 | #endif |
68 | #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) | 68 | #ifdef CONFIG_MIPS_MT_SMP |
69 | /* | 69 | /* |
70 | * In the MIPS MT "SMTC" model, each TC is considered | 70 | * There is not necessarily a 1:1 mapping of VPE num to CPU number |
71 | * to be a "CPU" for the purposes of scheduling, but | 71 | * in particular on multi-core systems. |
72 | * exception resources, ASID spaces, etc, are common | ||
73 | * to all TCs within the same VPE. | ||
74 | */ | 72 | */ |
75 | int vpe_id; /* Virtual Processor number */ | 73 | int vpe_id; /* Virtual Processor number */ |
76 | #endif | 74 | #endif |
77 | #ifdef CONFIG_MIPS_MT_SMTC | ||
78 | int tc_id; /* Thread Context number */ | ||
79 | #endif | ||
80 | void *data; /* Additional data */ | 75 | void *data; /* Additional data */ |
81 | unsigned int watch_reg_count; /* Number that exist */ | 76 | unsigned int watch_reg_count; /* Number that exist */ |
82 | unsigned int watch_reg_use_cnt; /* Usable by ptrace */ | 77 | unsigned int watch_reg_use_cnt; /* Usable by ptrace */ |
@@ -117,7 +112,7 @@ struct proc_cpuinfo_notifier_args { | |||
117 | unsigned long n; | 112 | unsigned long n; |
118 | }; | 113 | }; |
119 | 114 | ||
120 | #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) | 115 | #ifdef CONFIG_MIPS_MT_SMP |
121 | # define cpu_vpe_id(cpuinfo) ((cpuinfo)->vpe_id) | 116 | # define cpu_vpe_id(cpuinfo) ((cpuinfo)->vpe_id) |
122 | #else | 117 | #else |
123 | # define cpu_vpe_id(cpuinfo) 0 | 118 | # define cpu_vpe_id(cpuinfo) 0 |
diff --git a/arch/mips/include/asm/cpu-type.h b/arch/mips/include/asm/cpu-type.h index 721906130a57..b4e2bd87df50 100644 --- a/arch/mips/include/asm/cpu-type.h +++ b/arch/mips/include/asm/cpu-type.h | |||
@@ -155,9 +155,6 @@ static inline int __pure __get_cpu_type(const int cpu_type) | |||
155 | case CPU_RM7000: | 155 | case CPU_RM7000: |
156 | case CPU_SR71000: | 156 | case CPU_SR71000: |
157 | #endif | 157 | #endif |
158 | #ifdef CONFIG_SYS_HAS_CPU_RM9000 | ||
159 | case CPU_RM9000: | ||
160 | #endif | ||
161 | #ifdef CONFIG_SYS_HAS_CPU_SB1 | 158 | #ifdef CONFIG_SYS_HAS_CPU_SB1 |
162 | case CPU_SB1: | 159 | case CPU_SB1: |
163 | case CPU_SB1A: | 160 | case CPU_SB1A: |
@@ -166,6 +163,7 @@ static inline int __pure __get_cpu_type(const int cpu_type) | |||
166 | case CPU_CAVIUM_OCTEON: | 163 | case CPU_CAVIUM_OCTEON: |
167 | case CPU_CAVIUM_OCTEON_PLUS: | 164 | case CPU_CAVIUM_OCTEON_PLUS: |
168 | case CPU_CAVIUM_OCTEON2: | 165 | case CPU_CAVIUM_OCTEON2: |
166 | case CPU_CAVIUM_OCTEON3: | ||
169 | #endif | 167 | #endif |
170 | 168 | ||
171 | #if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \ | 169 | #if defined(CONFIG_SYS_HAS_CPU_BMIPS32_3300) || \ |
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index 530eb8b3a68e..129d08701e91 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h | |||
@@ -201,6 +201,7 @@ | |||
201 | #define PRID_IMP_NETLOGIC_XLP3XX 0x1100 | 201 | #define PRID_IMP_NETLOGIC_XLP3XX 0x1100 |
202 | #define PRID_IMP_NETLOGIC_XLP2XX 0x1200 | 202 | #define PRID_IMP_NETLOGIC_XLP2XX 0x1200 |
203 | #define PRID_IMP_NETLOGIC_XLP9XX 0x1500 | 203 | #define PRID_IMP_NETLOGIC_XLP9XX 0x1500 |
204 | #define PRID_IMP_NETLOGIC_XLP5XX 0x1300 | ||
204 | 205 | ||
205 | /* | 206 | /* |
206 | * Particular Revision values for bits 7:0 of the PRId register. | 207 | * Particular Revision values for bits 7:0 of the PRId register. |
@@ -281,7 +282,7 @@ enum cpu_type_enum { | |||
281 | CPU_R4700, CPU_R5000, CPU_R5500, CPU_NEVADA, CPU_R5432, CPU_R10000, | 282 | CPU_R4700, CPU_R5000, CPU_R5500, CPU_NEVADA, CPU_R5432, CPU_R10000, |
282 | CPU_R12000, CPU_R14000, CPU_VR41XX, CPU_VR4111, CPU_VR4121, CPU_VR4122, | 283 | CPU_R12000, CPU_R14000, CPU_VR41XX, CPU_VR4111, CPU_VR4121, CPU_VR4122, |
283 | CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000, | 284 | CPU_VR4131, CPU_VR4133, CPU_VR4181, CPU_VR4181A, CPU_RM7000, |
284 | CPU_SR71000, CPU_RM9000, CPU_TX49XX, | 285 | CPU_SR71000, CPU_TX49XX, |
285 | 286 | ||
286 | /* | 287 | /* |
287 | * R8000 class processors | 288 | * R8000 class processors |
diff --git a/arch/mips/include/asm/dec/kn05.h b/arch/mips/include/asm/dec/kn05.h index 56d22dc8803a..8e14f677e5ef 100644 --- a/arch/mips/include/asm/dec/kn05.h +++ b/arch/mips/include/asm/dec/kn05.h | |||
@@ -49,12 +49,20 @@ | |||
49 | #define KN4K_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */ | 49 | #define KN4K_RES_15 (15*IOASIC_SLOT_SIZE) /* unused? */ |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * MB ASIC interrupt bits. | ||
53 | */ | ||
54 | #define KN4K_MB_INR_MB 4 /* ??? */ | ||
55 | #define KN4K_MB_INR_MT 3 /* memory, I/O bus read/write errors */ | ||
56 | #define KN4K_MB_INR_RES_2 2 /* unused */ | ||
57 | #define KN4K_MB_INR_RTC 1 /* RTC */ | ||
58 | #define KN4K_MB_INR_TC 0 /* I/O ASIC cascade */ | ||
59 | |||
60 | /* | ||
52 | * Bits for the MB interrupt register. | 61 | * Bits for the MB interrupt register. |
53 | * The register appears read-only. | 62 | * The register appears read-only. |
54 | */ | 63 | */ |
55 | #define KN4K_MB_INT_TC (1<<0) /* TURBOchannel? */ | 64 | #define KN4K_MB_INT_IRQ (0x1f<<0) /* CPU Int[4:0] status. */ |
56 | #define KN4K_MB_INT_RTC (1<<1) /* RTC? */ | 65 | #define KN4K_MB_INT_IRQ_N(n) (1<<(n)) /* Individual status bits. */ |
57 | #define KN4K_MB_INT_MT (1<<3) /* I/O ASIC cascade */ | ||
58 | 66 | ||
59 | /* | 67 | /* |
60 | * Bits for the MB control & status register. | 68 | * Bits for the MB control & status register. |
@@ -70,6 +78,7 @@ | |||
70 | #define KN4K_MB_CSR_NC (1<<14) /* ??? */ | 78 | #define KN4K_MB_CSR_NC (1<<14) /* ??? */ |
71 | #define KN4K_MB_CSR_EE (1<<15) /* (bus) Exception Enable? */ | 79 | #define KN4K_MB_CSR_EE (1<<15) /* (bus) Exception Enable? */ |
72 | #define KN4K_MB_CSR_MSK (0x1f<<16) /* CPU Int[4:0] mask */ | 80 | #define KN4K_MB_CSR_MSK (0x1f<<16) /* CPU Int[4:0] mask */ |
81 | #define KN4K_MB_CSR_MSK_N(n) (1<<((n)+16)) /* Individual mask bits. */ | ||
73 | #define KN4K_MB_CSR_FW (1<<21) /* ??? */ | 82 | #define KN4K_MB_CSR_FW (1<<21) /* ??? */ |
74 | #define KN4K_MB_CSR_W (1<<31) /* ??? */ | 83 | #define KN4K_MB_CSR_W (1<<31) /* ??? */ |
75 | 84 | ||
diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h index 8c012af2f451..6842ffafd1e7 100644 --- a/arch/mips/include/asm/fixmap.h +++ b/arch/mips/include/asm/fixmap.h | |||
@@ -48,11 +48,7 @@ | |||
48 | enum fixed_addresses { | 48 | enum fixed_addresses { |
49 | #define FIX_N_COLOURS 8 | 49 | #define FIX_N_COLOURS 8 |
50 | FIX_CMAP_BEGIN, | 50 | FIX_CMAP_BEGIN, |
51 | #ifdef CONFIG_MIPS_MT_SMTC | ||
52 | FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * NR_CPUS * 2), | ||
53 | #else | ||
54 | FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * 2), | 51 | FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * 2), |
55 | #endif | ||
56 | #ifdef CONFIG_HIGHMEM | 52 | #ifdef CONFIG_HIGHMEM |
57 | /* reserved pte's for temporary kernel mappings */ | 53 | /* reserved pte's for temporary kernel mappings */ |
58 | FIX_KMAP_BEGIN = FIX_CMAP_END + 1, | 54 | FIX_KMAP_BEGIN = FIX_CMAP_END + 1, |
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index 4d86b72750c7..a939574f8293 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/mipsregs.h> | 17 | #include <asm/mipsregs.h> |
18 | #include <asm/cpu.h> | 18 | #include <asm/cpu.h> |
19 | #include <asm/cpu-features.h> | 19 | #include <asm/cpu-features.h> |
20 | #include <asm/fpu_emulator.h> | ||
20 | #include <asm/hazards.h> | 21 | #include <asm/hazards.h> |
21 | #include <asm/processor.h> | 22 | #include <asm/processor.h> |
22 | #include <asm/current.h> | 23 | #include <asm/current.h> |
@@ -28,7 +29,6 @@ | |||
28 | struct sigcontext; | 29 | struct sigcontext; |
29 | struct sigcontext32; | 30 | struct sigcontext32; |
30 | 31 | ||
31 | extern void fpu_emulator_init_fpu(void); | ||
32 | extern void _init_fpu(void); | 32 | extern void _init_fpu(void); |
33 | extern void _save_fp(struct task_struct *); | 33 | extern void _save_fp(struct task_struct *); |
34 | extern void _restore_fp(struct task_struct *); | 34 | extern void _restore_fp(struct task_struct *); |
@@ -156,15 +156,16 @@ static inline int init_fpu(void) | |||
156 | int ret = 0; | 156 | int ret = 0; |
157 | 157 | ||
158 | preempt_disable(); | 158 | preempt_disable(); |
159 | |||
159 | if (cpu_has_fpu) { | 160 | if (cpu_has_fpu) { |
160 | ret = __own_fpu(); | 161 | ret = __own_fpu(); |
161 | if (!ret) | 162 | if (!ret) |
162 | _init_fpu(); | 163 | _init_fpu(); |
163 | } else { | 164 | } else |
164 | fpu_emulator_init_fpu(); | 165 | fpu_emulator_init_fpu(); |
165 | } | ||
166 | 166 | ||
167 | preempt_enable(); | 167 | preempt_enable(); |
168 | |||
168 | return ret; | 169 | return ret; |
169 | } | 170 | } |
170 | 171 | ||
diff --git a/arch/mips/include/asm/fpu_emulator.h b/arch/mips/include/asm/fpu_emulator.h index 2abb587d5ab4..0195745b4b1b 100644 --- a/arch/mips/include/asm/fpu_emulator.h +++ b/arch/mips/include/asm/fpu_emulator.h | |||
@@ -23,9 +23,12 @@ | |||
23 | #ifndef _ASM_FPU_EMULATOR_H | 23 | #ifndef _ASM_FPU_EMULATOR_H |
24 | #define _ASM_FPU_EMULATOR_H | 24 | #define _ASM_FPU_EMULATOR_H |
25 | 25 | ||
26 | #include <linux/sched.h> | ||
26 | #include <asm/break.h> | 27 | #include <asm/break.h> |
28 | #include <asm/thread_info.h> | ||
27 | #include <asm/inst.h> | 29 | #include <asm/inst.h> |
28 | #include <asm/local.h> | 30 | #include <asm/local.h> |
31 | #include <asm/processor.h> | ||
29 | 32 | ||
30 | #ifdef CONFIG_DEBUG_FS | 33 | #ifdef CONFIG_DEBUG_FS |
31 | 34 | ||
@@ -36,6 +39,11 @@ struct mips_fpu_emulator_stats { | |||
36 | local_t cp1ops; | 39 | local_t cp1ops; |
37 | local_t cp1xops; | 40 | local_t cp1xops; |
38 | local_t errors; | 41 | local_t errors; |
42 | local_t ieee754_inexact; | ||
43 | local_t ieee754_underflow; | ||
44 | local_t ieee754_overflow; | ||
45 | local_t ieee754_zerodiv; | ||
46 | local_t ieee754_invalidop; | ||
39 | }; | 47 | }; |
40 | 48 | ||
41 | DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats); | 49 | DECLARE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats); |
@@ -71,4 +79,17 @@ int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
71 | */ | 79 | */ |
72 | #define BREAK_MATH (0x0000000d | (BRK_MEMU << 16)) | 80 | #define BREAK_MATH (0x0000000d | (BRK_MEMU << 16)) |
73 | 81 | ||
82 | #define SIGNALLING_NAN 0x7ff800007ff80000LL | ||
83 | |||
84 | static inline void fpu_emulator_init_fpu(void) | ||
85 | { | ||
86 | struct task_struct *t = current; | ||
87 | int i; | ||
88 | |||
89 | t->thread.fpu.fcr31 = 0; | ||
90 | |||
91 | for (i = 0; i < 32; i++) | ||
92 | set_fpr64(&t->thread.fpu.fpr[i], 0, SIGNALLING_NAN); | ||
93 | } | ||
94 | |||
74 | #endif /* _ASM_FPU_EMULATOR_H */ | 95 | #endif /* _ASM_FPU_EMULATOR_H */ |
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h index 082716690589..10f6a99f92c2 100644 --- a/arch/mips/include/asm/gic.h +++ b/arch/mips/include/asm/gic.h | |||
@@ -380,6 +380,7 @@ extern unsigned int gic_compare_int (void); | |||
380 | extern cycle_t gic_read_count(void); | 380 | extern cycle_t gic_read_count(void); |
381 | extern cycle_t gic_read_compare(void); | 381 | extern cycle_t gic_read_compare(void); |
382 | extern void gic_write_compare(cycle_t cnt); | 382 | extern void gic_write_compare(cycle_t cnt); |
383 | extern void gic_write_cpu_compare(cycle_t cnt, int cpu); | ||
383 | extern void gic_send_ipi(unsigned int intr); | 384 | extern void gic_send_ipi(unsigned int intr); |
384 | extern unsigned int plat_ipi_call_int_xlate(unsigned int); | 385 | extern unsigned int plat_ipi_call_int_xlate(unsigned int); |
385 | extern unsigned int plat_ipi_resched_int_xlate(unsigned int); | 386 | extern unsigned int plat_ipi_resched_int_xlate(unsigned int); |
diff --git a/arch/mips/include/asm/gio_device.h b/arch/mips/include/asm/gio_device.h index 0878701712f8..4be1a57cdbb0 100644 --- a/arch/mips/include/asm/gio_device.h +++ b/arch/mips/include/asm/gio_device.h | |||
@@ -50,7 +50,7 @@ static inline void gio_device_free(struct gio_device *dev) | |||
50 | extern int gio_register_driver(struct gio_driver *); | 50 | extern int gio_register_driver(struct gio_driver *); |
51 | extern void gio_unregister_driver(struct gio_driver *); | 51 | extern void gio_unregister_driver(struct gio_driver *); |
52 | 52 | ||
53 | #define gio_get_drvdata(_dev) drv_get_drvdata(&(_dev)->dev) | 53 | #define gio_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) |
54 | #define gio_set_drvdata(_dev, data) drv_set_drvdata(&(_dev)->dev, (data)) | 54 | #define gio_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data)) |
55 | 55 | ||
56 | extern void gio_set_master(struct gio_device *); | 56 | extern void gio_set_master(struct gio_device *); |
diff --git a/arch/mips/include/asm/idle.h b/arch/mips/include/asm/idle.h index d192158886b1..d9f932de80e9 100644 --- a/arch/mips/include/asm/idle.h +++ b/arch/mips/include/asm/idle.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __ASM_IDLE_H | 1 | #ifndef __ASM_IDLE_H |
2 | #define __ASM_IDLE_H | 2 | #define __ASM_IDLE_H |
3 | 3 | ||
4 | #include <linux/cpuidle.h> | ||
4 | #include <linux/linkage.h> | 5 | #include <linux/linkage.h> |
5 | 6 | ||
6 | extern void (*cpu_wait)(void); | 7 | extern void (*cpu_wait)(void); |
@@ -20,4 +21,17 @@ static inline int address_is_in_r4k_wait_irqoff(unsigned long addr) | |||
20 | addr < (unsigned long)__pastwait; | 21 | addr < (unsigned long)__pastwait; |
21 | } | 22 | } |
22 | 23 | ||
24 | extern int mips_cpuidle_wait_enter(struct cpuidle_device *dev, | ||
25 | struct cpuidle_driver *drv, int index); | ||
26 | |||
27 | #define MIPS_CPUIDLE_WAIT_STATE {\ | ||
28 | .enter = mips_cpuidle_wait_enter,\ | ||
29 | .exit_latency = 1,\ | ||
30 | .target_residency = 1,\ | ||
31 | .power_usage = UINT_MAX,\ | ||
32 | .flags = CPUIDLE_FLAG_TIME_VALID,\ | ||
33 | .name = "wait",\ | ||
34 | .desc = "MIPS wait",\ | ||
35 | } | ||
36 | |||
23 | #endif /* __ASM_IDLE_H */ | 37 | #endif /* __ASM_IDLE_H */ |
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index 7bc2cdb35057..ae1f7b24dd1a 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h | |||
@@ -26,104 +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 | ||
29 | #ifdef CONFIG_MIPS_MT_SMTC | ||
30 | |||
31 | struct irqaction; | ||
32 | |||
33 | extern unsigned long irq_hwmask[]; | ||
34 | extern int setup_irq_smtc(unsigned int irq, struct irqaction * new, | ||
35 | unsigned long hwmask); | ||
36 | |||
37 | static inline void smtc_im_ack_irq(unsigned int irq) | ||
38 | { | ||
39 | if (irq_hwmask[irq] & ST0_IM) | ||
40 | set_c0_status(irq_hwmask[irq] & ST0_IM); | ||
41 | } | ||
42 | |||
43 | #else | ||
44 | |||
45 | static inline void smtc_im_ack_irq(unsigned int irq) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
50 | |||
51 | #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF | ||
52 | #include <linux/cpumask.h> | ||
53 | |||
54 | extern int plat_set_irq_affinity(struct irq_data *d, | ||
55 | const struct cpumask *affinity, bool force); | ||
56 | extern void smtc_forward_irq(struct irq_data *d); | ||
57 | |||
58 | /* | ||
59 | * IRQ affinity hook invoked at the beginning of interrupt dispatch | ||
60 | * if option is enabled. | ||
61 | * | ||
62 | * Up through Linux 2.6.22 (at least) cpumask operations are very | ||
63 | * inefficient on MIPS. Initial prototypes of SMTC IRQ affinity | ||
64 | * used a "fast path" per-IRQ-descriptor cache of affinity information | ||
65 | * to reduce latency. As there is a project afoot to optimize the | ||
66 | * cpumask implementations, this version is optimistically assuming | ||
67 | * that cpumask.h macro overhead is reasonable during interrupt dispatch. | ||
68 | */ | ||
69 | static inline int handle_on_other_cpu(unsigned int irq) | ||
70 | { | ||
71 | struct irq_data *d = irq_get_irq_data(irq); | ||
72 | |||
73 | if (cpumask_test_cpu(smp_processor_id(), d->affinity)) | ||
74 | return 0; | ||
75 | smtc_forward_irq(d); | ||
76 | return 1; | ||
77 | } | ||
78 | |||
79 | #else /* Not doing SMTC affinity */ | ||
80 | |||
81 | static inline int handle_on_other_cpu(unsigned int irq) { return 0; } | ||
82 | |||
83 | #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */ | ||
84 | |||
85 | #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP | ||
86 | |||
87 | static inline void smtc_im_backstop(unsigned int irq) | ||
88 | { | ||
89 | if (irq_hwmask[irq] & 0x0000ff00) | ||
90 | write_c0_tccontext(read_c0_tccontext() & | ||
91 | ~(irq_hwmask[irq] & 0x0000ff00)); | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * Clear interrupt mask handling "backstop" if irq_hwmask | ||
96 | * entry so indicates. This implies that the ack() or end() | ||
97 | * functions will take over re-enabling the low-level mask. | ||
98 | * Otherwise it will be done on return from exception. | ||
99 | */ | ||
100 | static inline int smtc_handle_on_other_cpu(unsigned int irq) | ||
101 | { | ||
102 | int ret = handle_on_other_cpu(irq); | ||
103 | |||
104 | if (!ret) | ||
105 | smtc_im_backstop(irq); | ||
106 | return ret; | ||
107 | } | ||
108 | |||
109 | #else | ||
110 | |||
111 | static inline void smtc_im_backstop(unsigned int irq) { } | ||
112 | static inline int smtc_handle_on_other_cpu(unsigned int irq) | ||
113 | { | ||
114 | return handle_on_other_cpu(irq); | ||
115 | } | ||
116 | |||
117 | #endif | ||
118 | |||
119 | extern void do_IRQ(unsigned int irq); | 29 | extern void do_IRQ(unsigned int irq); |
120 | 30 | ||
121 | #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF | ||
122 | |||
123 | extern void do_IRQ_no_affinity(unsigned int irq); | ||
124 | |||
125 | #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */ | ||
126 | |||
127 | extern void arch_init_irq(void); | 31 | extern void arch_init_irq(void); |
128 | extern void spurious_interrupt(void); | 32 | extern void spurious_interrupt(void); |
129 | 33 | ||
diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h index 45c00951888b..0fa5fdcd1f01 100644 --- a/arch/mips/include/asm/irqflags.h +++ b/arch/mips/include/asm/irqflags.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/stringify.h> | 17 | #include <linux/stringify.h> |
18 | #include <asm/hazards.h> | 18 | #include <asm/hazards.h> |
19 | 19 | ||
20 | #if defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_MIPS_MT_SMTC) | 20 | #ifdef CONFIG_CPU_MIPSR2 |
21 | 21 | ||
22 | static inline void arch_local_irq_disable(void) | 22 | static inline void arch_local_irq_disable(void) |
23 | { | 23 | { |
@@ -118,30 +118,15 @@ void arch_local_irq_disable(void); | |||
118 | unsigned long arch_local_irq_save(void); | 118 | unsigned long arch_local_irq_save(void); |
119 | void arch_local_irq_restore(unsigned long flags); | 119 | void arch_local_irq_restore(unsigned long flags); |
120 | void __arch_local_irq_restore(unsigned long flags); | 120 | void __arch_local_irq_restore(unsigned long flags); |
121 | #endif /* if defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_MIPS_MT_SMTC) */ | 121 | #endif /* CONFIG_CPU_MIPSR2 */ |
122 | |||
123 | |||
124 | extern void smtc_ipi_replay(void); | ||
125 | 122 | ||
126 | static inline void arch_local_irq_enable(void) | 123 | static inline void arch_local_irq_enable(void) |
127 | { | 124 | { |
128 | #ifdef CONFIG_MIPS_MT_SMTC | ||
129 | /* | ||
130 | * SMTC kernel needs to do a software replay of queued | ||
131 | * IPIs, at the cost of call overhead on each local_irq_enable() | ||
132 | */ | ||
133 | smtc_ipi_replay(); | ||
134 | #endif | ||
135 | __asm__ __volatile__( | 125 | __asm__ __volatile__( |
136 | " .set push \n" | 126 | " .set push \n" |
137 | " .set reorder \n" | 127 | " .set reorder \n" |
138 | " .set noat \n" | 128 | " .set noat \n" |
139 | #ifdef CONFIG_MIPS_MT_SMTC | 129 | #if defined(CONFIG_CPU_MIPSR2) |
140 | " mfc0 $1, $2, 1 # SMTC - clear TCStatus.IXMT \n" | ||
141 | " ori $1, 0x400 \n" | ||
142 | " xori $1, 0x400 \n" | ||
143 | " mtc0 $1, $2, 1 \n" | ||
144 | #elif defined(CONFIG_CPU_MIPSR2) | ||
145 | " ei \n" | 130 | " ei \n" |
146 | #else | 131 | #else |
147 | " mfc0 $1,$12 \n" | 132 | " mfc0 $1,$12 \n" |
@@ -163,11 +148,7 @@ static inline unsigned long arch_local_save_flags(void) | |||
163 | asm __volatile__( | 148 | asm __volatile__( |
164 | " .set push \n" | 149 | " .set push \n" |
165 | " .set reorder \n" | 150 | " .set reorder \n" |
166 | #ifdef CONFIG_MIPS_MT_SMTC | ||
167 | " mfc0 %[flags], $2, 1 \n" | ||
168 | #else | ||
169 | " mfc0 %[flags], $12 \n" | 151 | " mfc0 %[flags], $12 \n" |
170 | #endif | ||
171 | " .set pop \n" | 152 | " .set pop \n" |
172 | : [flags] "=r" (flags)); | 153 | : [flags] "=r" (flags)); |
173 | 154 | ||
@@ -177,14 +158,7 @@ static inline unsigned long arch_local_save_flags(void) | |||
177 | 158 | ||
178 | static inline int arch_irqs_disabled_flags(unsigned long flags) | 159 | static inline int arch_irqs_disabled_flags(unsigned long flags) |
179 | { | 160 | { |
180 | #ifdef CONFIG_MIPS_MT_SMTC | ||
181 | /* | ||
182 | * SMTC model uses TCStatus.IXMT to disable interrupts for a thread/CPU | ||
183 | */ | ||
184 | return flags & 0x400; | ||
185 | #else | ||
186 | return !(flags & 1); | 161 | return !(flags & 1); |
187 | #endif | ||
188 | } | 162 | } |
189 | 163 | ||
190 | #endif /* #ifndef __ASSEMBLY__ */ | 164 | #endif /* #ifndef __ASSEMBLY__ */ |
diff --git a/arch/mips/include/asm/kvm_para.h b/arch/mips/include/asm/kvm_para.h new file mode 100644 index 000000000000..5a9aa918abe6 --- /dev/null +++ b/arch/mips/include/asm/kvm_para.h | |||
@@ -0,0 +1,109 @@ | |||
1 | #ifndef _ASM_MIPS_KVM_PARA_H | ||
2 | #define _ASM_MIPS_KVM_PARA_H | ||
3 | |||
4 | #include <uapi/asm/kvm_para.h> | ||
5 | |||
6 | #define KVM_HYPERCALL ".word 0x42000028" | ||
7 | |||
8 | /* | ||
9 | * Hypercalls for KVM. | ||
10 | * | ||
11 | * Hypercall number is passed in v0. | ||
12 | * Return value will be placed in v0. | ||
13 | * Up to 3 arguments are passed in a0, a1, and a2. | ||
14 | */ | ||
15 | static inline unsigned long kvm_hypercall0(unsigned long num) | ||
16 | { | ||
17 | register unsigned long n asm("v0"); | ||
18 | register unsigned long r asm("v0"); | ||
19 | |||
20 | n = num; | ||
21 | __asm__ __volatile__( | ||
22 | KVM_HYPERCALL | ||
23 | : "=r" (r) : "r" (n) : "memory" | ||
24 | ); | ||
25 | |||
26 | return r; | ||
27 | } | ||
28 | |||
29 | static inline unsigned long kvm_hypercall1(unsigned long num, | ||
30 | unsigned long arg0) | ||
31 | { | ||
32 | register unsigned long n asm("v0"); | ||
33 | register unsigned long r asm("v0"); | ||
34 | register unsigned long a0 asm("a0"); | ||
35 | |||
36 | n = num; | ||
37 | a0 = arg0; | ||
38 | __asm__ __volatile__( | ||
39 | KVM_HYPERCALL | ||
40 | : "=r" (r) : "r" (n), "r" (a0) : "memory" | ||
41 | ); | ||
42 | |||
43 | return r; | ||
44 | } | ||
45 | |||
46 | static inline unsigned long kvm_hypercall2(unsigned long num, | ||
47 | unsigned long arg0, unsigned long arg1) | ||
48 | { | ||
49 | register unsigned long n asm("v0"); | ||
50 | register unsigned long r asm("v0"); | ||
51 | register unsigned long a0 asm("a0"); | ||
52 | register unsigned long a1 asm("a1"); | ||
53 | |||
54 | n = num; | ||
55 | a0 = arg0; | ||
56 | a1 = arg1; | ||
57 | __asm__ __volatile__( | ||
58 | KVM_HYPERCALL | ||
59 | : "=r" (r) : "r" (n), "r" (a0), "r" (a1) : "memory" | ||
60 | ); | ||
61 | |||
62 | return r; | ||
63 | } | ||
64 | |||
65 | static inline unsigned long kvm_hypercall3(unsigned long num, | ||
66 | unsigned long arg0, unsigned long arg1, unsigned long arg2) | ||
67 | { | ||
68 | register unsigned long n asm("v0"); | ||
69 | register unsigned long r asm("v0"); | ||
70 | register unsigned long a0 asm("a0"); | ||
71 | register unsigned long a1 asm("a1"); | ||
72 | register unsigned long a2 asm("a2"); | ||
73 | |||
74 | n = num; | ||
75 | a0 = arg0; | ||
76 | a1 = arg1; | ||
77 | a2 = arg2; | ||
78 | __asm__ __volatile__( | ||
79 | KVM_HYPERCALL | ||
80 | : "=r" (r) : "r" (n), "r" (a0), "r" (a1), "r" (a2) : "memory" | ||
81 | ); | ||
82 | |||
83 | return r; | ||
84 | } | ||
85 | |||
86 | static inline bool kvm_check_and_clear_guest_paused(void) | ||
87 | { | ||
88 | return false; | ||
89 | } | ||
90 | |||
91 | static inline unsigned int kvm_arch_para_features(void) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | #ifdef CONFIG_MIPS_PARAVIRT | ||
97 | static inline bool kvm_para_available(void) | ||
98 | { | ||
99 | return true; | ||
100 | } | ||
101 | #else | ||
102 | static inline bool kvm_para_available(void) | ||
103 | { | ||
104 | return false; | ||
105 | } | ||
106 | #endif | ||
107 | |||
108 | |||
109 | #endif /* _ASM_MIPS_KVM_PARA_H */ | ||
diff --git a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h index 94ed063eec92..cf8022872892 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #define cpu_has_3k_cache 0 | 22 | #define cpu_has_3k_cache 0 |
23 | #define cpu_has_4k_cache 0 | 23 | #define cpu_has_4k_cache 0 |
24 | #define cpu_has_tx39_cache 0 | 24 | #define cpu_has_tx39_cache 0 |
25 | #define cpu_has_fpu 0 | ||
26 | #define cpu_has_counter 1 | 25 | #define cpu_has_counter 1 |
27 | #define cpu_has_watch 1 | 26 | #define cpu_has_watch 1 |
28 | #define cpu_has_divec 1 | 27 | #define cpu_has_divec 1 |
diff --git a/arch/mips/include/asm/mach-cavium-octeon/irq.h b/arch/mips/include/asm/mach-cavium-octeon/irq.h index 60fc4c347c44..cceae32a0732 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/irq.h +++ b/arch/mips/include/asm/mach-cavium-octeon/irq.h | |||
@@ -35,6 +35,8 @@ enum octeon_irq { | |||
35 | OCTEON_IRQ_PCI_MSI2, | 35 | OCTEON_IRQ_PCI_MSI2, |
36 | OCTEON_IRQ_PCI_MSI3, | 36 | OCTEON_IRQ_PCI_MSI3, |
37 | 37 | ||
38 | OCTEON_IRQ_TWSI, | ||
39 | OCTEON_IRQ_TWSI2, | ||
38 | OCTEON_IRQ_RML, | 40 | OCTEON_IRQ_RML, |
39 | OCTEON_IRQ_TIMER0, | 41 | OCTEON_IRQ_TIMER0, |
40 | OCTEON_IRQ_TIMER1, | 42 | OCTEON_IRQ_TIMER1, |
diff --git a/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h b/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h index 1bcb6421205e..1dfe47453ea4 100644 --- a/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h +++ b/arch/mips/include/asm/mach-ip22/cpu-feature-overrides.h | |||
@@ -39,6 +39,10 @@ | |||
39 | #define cpu_has_nofpuex 0 | 39 | #define cpu_has_nofpuex 0 |
40 | #define cpu_has_64bits 1 | 40 | #define cpu_has_64bits 1 |
41 | 41 | ||
42 | #define cpu_has_mips_2 1 | ||
43 | #define cpu_has_mips_3 1 | ||
44 | #define cpu_has_mips_5 0 | ||
45 | |||
42 | #define cpu_has_mips32r1 0 | 46 | #define cpu_has_mips32r1 0 |
43 | #define cpu_has_mips32r2 0 | 47 | #define cpu_has_mips32r2 0 |
44 | #define cpu_has_mips64r1 0 | 48 | #define cpu_has_mips64r1 0 |
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 7c5e17a17849..77eeda77e73c 100644 --- a/arch/mips/include/asm/mach-malta/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-malta/kernel-entry-init.h | |||
@@ -80,36 +80,6 @@ | |||
80 | .endm | 80 | .endm |
81 | 81 | ||
82 | .macro kernel_entry_setup | 82 | .macro kernel_entry_setup |
83 | #ifdef CONFIG_MIPS_MT_SMTC | ||
84 | mfc0 t0, CP0_CONFIG | ||
85 | bgez t0, 9f | ||
86 | mfc0 t0, CP0_CONFIG, 1 | ||
87 | bgez t0, 9f | ||
88 | mfc0 t0, CP0_CONFIG, 2 | ||
89 | bgez t0, 9f | ||
90 | mfc0 t0, CP0_CONFIG, 3 | ||
91 | and t0, 1<<2 | ||
92 | bnez t0, 0f | ||
93 | 9: | ||
94 | /* Assume we came from YAMON... */ | ||
95 | PTR_LA v0, 0x9fc00534 /* YAMON print */ | ||
96 | lw v0, (v0) | ||
97 | move a0, zero | ||
98 | PTR_LA a1, nonmt_processor | ||
99 | jal v0 | ||
100 | |||
101 | PTR_LA v0, 0x9fc00520 /* YAMON exit */ | ||
102 | lw v0, (v0) | ||
103 | li a0, 1 | ||
104 | jal v0 | ||
105 | |||
106 | 1: b 1b | ||
107 | |||
108 | __INITDATA | ||
109 | nonmt_processor: | ||
110 | .asciz "SMTC kernel requires the MT ASE to run\n" | ||
111 | __FINIT | ||
112 | #endif | ||
113 | 83 | ||
114 | #ifdef CONFIG_EVA | 84 | #ifdef CONFIG_EVA |
115 | sync | 85 | sync |
diff --git a/arch/mips/include/asm/mach-malta/malta-pm.h b/arch/mips/include/asm/mach-malta/malta-pm.h new file mode 100644 index 000000000000..c2c2e201013d --- /dev/null +++ b/arch/mips/include/asm/mach-malta/malta-pm.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Imagination Technologies | ||
3 | * Author: Paul Burton <paul.burton@imgtec.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_MIPS_MACH_MALTA_PM_H__ | ||
12 | #define __ASM_MIPS_MACH_MALTA_PM_H__ | ||
13 | |||
14 | #include <asm/mips-boards/piix4.h> | ||
15 | |||
16 | #ifdef CONFIG_MIPS_MALTA_PM | ||
17 | |||
18 | /** | ||
19 | * mips_pm_suspend - enter a suspend state | ||
20 | * @state: the state to enter, one of PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_* | ||
21 | * | ||
22 | * Enters a suspend state via the Malta's PIIX4. If the state to be entered | ||
23 | * is one which loses context (eg. SOFF) then this function will never | ||
24 | * return. | ||
25 | */ | ||
26 | extern int mips_pm_suspend(unsigned state); | ||
27 | |||
28 | #else /* !CONFIG_MIPS_MALTA_PM */ | ||
29 | |||
30 | static inline int mips_pm_suspend(unsigned state) | ||
31 | { | ||
32 | return -EINVAL; | ||
33 | } | ||
34 | |||
35 | #endif /* !CONFIG_MIPS_MALTA_PM */ | ||
36 | |||
37 | #endif /* __ASM_MIPS_MACH_MALTA_PM_H__ */ | ||
diff --git a/arch/mips/include/asm/mach-netlogic/topology.h b/arch/mips/include/asm/mach-netlogic/topology.h index 0da99fa11c38..ceeb1f5e7129 100644 --- a/arch/mips/include/asm/mach-netlogic/topology.h +++ b/arch/mips/include/asm/mach-netlogic/topology.h | |||
@@ -10,10 +10,12 @@ | |||
10 | 10 | ||
11 | #include <asm/mach-netlogic/multi-node.h> | 11 | #include <asm/mach-netlogic/multi-node.h> |
12 | 12 | ||
13 | #ifdef CONFIG_SMP | ||
13 | #define topology_physical_package_id(cpu) cpu_to_node(cpu) | 14 | #define topology_physical_package_id(cpu) cpu_to_node(cpu) |
14 | #define topology_core_id(cpu) (cpu_logical_map(cpu) / NLM_THREADS_PER_CORE) | 15 | #define topology_core_id(cpu) (cpu_logical_map(cpu) / NLM_THREADS_PER_CORE) |
15 | #define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) | 16 | #define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) |
16 | #define topology_core_cpumask(cpu) cpumask_of_node(cpu_to_node(cpu)) | 17 | #define topology_core_cpumask(cpu) cpumask_of_node(cpu_to_node(cpu)) |
18 | #endif | ||
17 | 19 | ||
18 | #include <asm-generic/topology.h> | 20 | #include <asm-generic/topology.h> |
19 | 21 | ||
diff --git a/arch/mips/include/asm/mach-paravirt/cpu-feature-overrides.h b/arch/mips/include/asm/mach-paravirt/cpu-feature-overrides.h new file mode 100644 index 000000000000..725e1ed83f6a --- /dev/null +++ b/arch/mips/include/asm/mach-paravirt/cpu-feature-overrides.h | |||
@@ -0,0 +1,36 @@ | |||
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) 2013 Cavium, Inc. | ||
7 | */ | ||
8 | #ifndef __ASM_MACH_PARAVIRT_CPU_FEATURE_OVERRIDES_H | ||
9 | #define __ASM_MACH_PARAVIRT_CPU_FEATURE_OVERRIDES_H | ||
10 | |||
11 | #define cpu_has_4kex 1 | ||
12 | #define cpu_has_3k_cache 0 | ||
13 | #define cpu_has_tx39_cache 0 | ||
14 | #define cpu_has_counter 1 | ||
15 | #define cpu_has_llsc 1 | ||
16 | /* | ||
17 | * We Disable LL/SC on non SMP systems as it is faster to disable | ||
18 | * interrupts for atomic access than a LL/SC. | ||
19 | */ | ||
20 | #ifdef CONFIG_SMP | ||
21 | # define kernel_uses_llsc 1 | ||
22 | #else | ||
23 | # define kernel_uses_llsc 0 | ||
24 | #endif | ||
25 | |||
26 | #ifdef CONFIG_CPU_CAVIUM_OCTEON | ||
27 | #define cpu_dcache_line_size() 128 | ||
28 | #define cpu_icache_line_size() 128 | ||
29 | #define cpu_has_octeon_cache 1 | ||
30 | #define cpu_has_4k_cache 0 | ||
31 | #else | ||
32 | #define cpu_has_octeon_cache 0 | ||
33 | #define cpu_has_4k_cache 1 | ||
34 | #endif | ||
35 | |||
36 | #endif /* __ASM_MACH_PARAVIRT_CPU_FEATURE_OVERRIDES_H */ | ||
diff --git a/arch/mips/include/asm/mach-paravirt/irq.h b/arch/mips/include/asm/mach-paravirt/irq.h new file mode 100644 index 000000000000..9b4d35eca977 --- /dev/null +++ b/arch/mips/include/asm/mach-paravirt/irq.h | |||
@@ -0,0 +1,19 @@ | |||
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) 2013 Cavium, Inc. | ||
7 | */ | ||
8 | #ifndef __ASM_MACH_PARAVIRT_IRQ_H__ | ||
9 | #define __ASM_MACH_PARAVIRT_IRQ_H__ | ||
10 | |||
11 | #define NR_IRQS 64 | ||
12 | #define MIPS_CPU_IRQ_BASE 1 | ||
13 | |||
14 | #define MIPS_IRQ_PCIA (MIPS_CPU_IRQ_BASE + 8) | ||
15 | |||
16 | #define MIPS_IRQ_MBOX0 (MIPS_CPU_IRQ_BASE + 32) | ||
17 | #define MIPS_IRQ_MBOX1 (MIPS_CPU_IRQ_BASE + 33) | ||
18 | |||
19 | #endif /* __ASM_MACH_PARAVIRT_IRQ_H__ */ | ||
diff --git a/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h new file mode 100644 index 000000000000..2f82bfa3a773 --- /dev/null +++ b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h | |||
@@ -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 | * Copyright (C) 2013 Cavium, Inc | ||
7 | */ | ||
8 | #ifndef __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H | ||
9 | #define __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H | ||
10 | |||
11 | #define CP0_EBASE $15, 1 | ||
12 | |||
13 | .macro kernel_entry_setup | ||
14 | mfc0 t0, CP0_EBASE | ||
15 | andi t0, t0, 0x3ff # CPUNum | ||
16 | beqz t0, 1f | ||
17 | # CPUs other than zero goto smp_bootstrap | ||
18 | j smp_bootstrap | ||
19 | |||
20 | 1: | ||
21 | .endm | ||
22 | |||
23 | /* | ||
24 | * Do SMP slave processor setup necessary before we can safely execute | ||
25 | * C code. | ||
26 | */ | ||
27 | .macro smp_slave_setup | ||
28 | mfc0 t0, CP0_EBASE | ||
29 | andi t0, t0, 0x3ff # CPUNum | ||
30 | slti t1, t0, NR_CPUS | ||
31 | bnez t1, 1f | ||
32 | 2: | ||
33 | di | ||
34 | wait | ||
35 | b 2b # Unknown CPU, loop forever. | ||
36 | 1: | ||
37 | PTR_LA t1, paravirt_smp_sp | ||
38 | PTR_SLL t0, PTR_SCALESHIFT | ||
39 | PTR_ADDU t1, t1, t0 | ||
40 | 3: | ||
41 | PTR_L sp, 0(t1) | ||
42 | beqz sp, 3b # Spin until told to proceed. | ||
43 | |||
44 | PTR_LA t1, paravirt_smp_gp | ||
45 | PTR_ADDU t1, t1, t0 | ||
46 | sync | ||
47 | PTR_L gp, 0(t1) | ||
48 | .endm | ||
49 | |||
50 | #endif /* __ASM_MACH_PARAVIRT_KERNEL_ENTRY_H */ | ||
diff --git a/arch/mips/include/asm/mach-paravirt/war.h b/arch/mips/include/asm/mach-paravirt/war.h new file mode 100644 index 000000000000..36d3afb98451 --- /dev/null +++ b/arch/mips/include/asm/mach-paravirt/war.h | |||
@@ -0,0 +1,25 @@ | |||
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) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org> | ||
7 | * Copyright (C) 2013 Cavium Networks <support@caviumnetworks.com> | ||
8 | */ | ||
9 | #ifndef __ASM_MIPS_MACH_PARAVIRT_WAR_H | ||
10 | #define __ASM_MIPS_MACH_PARAVIRT_WAR_H | ||
11 | |||
12 | #define R4600_V1_INDEX_ICACHEOP_WAR 0 | ||
13 | #define R4600_V1_HIT_CACHEOP_WAR 0 | ||
14 | #define R4600_V2_HIT_CACHEOP_WAR 0 | ||
15 | #define R5432_CP0_INTERRUPT_WAR 0 | ||
16 | #define BCM1250_M3_WAR 0 | ||
17 | #define SIBYTE_1956_WAR 0 | ||
18 | #define MIPS4K_ICACHE_REFILL_WAR 0 | ||
19 | #define MIPS_CACHE_SYNC_WAR 0 | ||
20 | #define TX49XX_ICACHE_INDEX_INV_WAR 0 | ||
21 | #define ICACHE_REFILLS_WORKAROUND_WAR 0 | ||
22 | #define R10000_LLSC_WAR 0 | ||
23 | #define MIPS34K_MISSED_ITLB_WAR 0 | ||
24 | |||
25 | #endif /* __ASM_MIPS_MACH_PARAVIRT_WAR_H */ | ||
diff --git a/arch/mips/include/asm/mach-pmcs-msp71xx/msp_usb.h b/arch/mips/include/asm/mach-pmcs-msp71xx/msp_usb.h index aa45e6a07126..fe1566f2913e 100644 --- a/arch/mips/include/asm/mach-pmcs-msp71xx/msp_usb.h +++ b/arch/mips/include/asm/mach-pmcs-msp71xx/msp_usb.h | |||
@@ -25,11 +25,7 @@ | |||
25 | #ifndef MSP_USB_H_ | 25 | #ifndef MSP_USB_H_ |
26 | #define MSP_USB_H_ | 26 | #define MSP_USB_H_ |
27 | 27 | ||
28 | #ifdef CONFIG_MSP_HAS_DUAL_USB | ||
29 | #define NUM_USB_DEVS 2 | ||
30 | #else | ||
31 | #define NUM_USB_DEVS 1 | 28 | #define NUM_USB_DEVS 1 |
32 | #endif | ||
33 | 29 | ||
34 | /* Register spaces for USB host 0 */ | 30 | /* Register spaces for USB host 0 */ |
35 | #define MSP_USB0_MAB_START (MSP_USB0_BASE + 0x0) | 31 | #define MSP_USB0_MAB_START (MSP_USB0_BASE + 0x0) |
diff --git a/arch/mips/include/asm/mach-ralink/war.h b/arch/mips/include/asm/mach-ralink/war.h index a7b712cf2d28..c074b5dc1f82 100644 --- a/arch/mips/include/asm/mach-ralink/war.h +++ b/arch/mips/include/asm/mach-ralink/war.h | |||
@@ -17,7 +17,6 @@ | |||
17 | #define MIPS4K_ICACHE_REFILL_WAR 0 | 17 | #define MIPS4K_ICACHE_REFILL_WAR 0 |
18 | #define MIPS_CACHE_SYNC_WAR 0 | 18 | #define MIPS_CACHE_SYNC_WAR 0 |
19 | #define TX49XX_ICACHE_INDEX_INV_WAR 0 | 19 | #define TX49XX_ICACHE_INDEX_INV_WAR 0 |
20 | #define RM9000_CDEX_SMP_WAR 0 | ||
21 | #define ICACHE_REFILLS_WORKAROUND_WAR 0 | 20 | #define ICACHE_REFILLS_WORKAROUND_WAR 0 |
22 | #define R10000_LLSC_WAR 0 | 21 | #define R10000_LLSC_WAR 0 |
23 | #define MIPS34K_MISSED_ITLB_WAR 0 | 22 | #define MIPS34K_MISSED_ITLB_WAR 0 |
diff --git a/arch/mips/include/asm/mach-sead3/kernel-entry-init.h b/arch/mips/include/asm/mach-sead3/kernel-entry-init.h index 3dfbd8e7947f..6cccd4d558d7 100644 --- a/arch/mips/include/asm/mach-sead3/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-sead3/kernel-entry-init.h | |||
@@ -10,37 +10,6 @@ | |||
10 | #define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H | 10 | #define __ASM_MACH_MIPS_KERNEL_ENTRY_INIT_H |
11 | 11 | ||
12 | .macro kernel_entry_setup | 12 | .macro kernel_entry_setup |
13 | #ifdef CONFIG_MIPS_MT_SMTC | ||
14 | mfc0 t0, CP0_CONFIG | ||
15 | bgez t0, 9f | ||
16 | mfc0 t0, CP0_CONFIG, 1 | ||
17 | bgez t0, 9f | ||
18 | mfc0 t0, CP0_CONFIG, 2 | ||
19 | bgez t0, 9f | ||
20 | mfc0 t0, CP0_CONFIG, 3 | ||
21 | and t0, 1<<2 | ||
22 | bnez t0, 0f | ||
23 | 9 : | ||
24 | /* Assume we came from YAMON... */ | ||
25 | PTR_LA v0, 0x9fc00534 /* YAMON print */ | ||
26 | lw v0, (v0) | ||
27 | move a0, zero | ||
28 | PTR_LA a1, nonmt_processor | ||
29 | jal v0 | ||
30 | |||
31 | PTR_LA v0, 0x9fc00520 /* YAMON exit */ | ||
32 | lw v0, (v0) | ||
33 | li a0, 1 | ||
34 | jal v0 | ||
35 | |||
36 | 1 : b 1b | ||
37 | |||
38 | __INITDATA | ||
39 | nonmt_processor : | ||
40 | .asciz "SMTC kernel requires the MT ASE to run\n" | ||
41 | __FINIT | ||
42 | 0 : | ||
43 | #endif | ||
44 | .endm | 13 | .endm |
45 | 14 | ||
46 | /* | 15 | /* |
diff --git a/arch/mips/include/asm/mips-boards/piix4.h b/arch/mips/include/asm/mips-boards/piix4.h index 9cf54041d416..9e340be52a50 100644 --- a/arch/mips/include/asm/mips-boards/piix4.h +++ b/arch/mips/include/asm/mips-boards/piix4.h | |||
@@ -55,4 +55,16 @@ | |||
55 | #define PIIX4_FUNC3_PMREGMISC 0x80 | 55 | #define PIIX4_FUNC3_PMREGMISC 0x80 |
56 | #define PIIX4_FUNC3_PMREGMISC_EN (1 << 0) | 56 | #define PIIX4_FUNC3_PMREGMISC_EN (1 << 0) |
57 | 57 | ||
58 | /* Power Management IO Space */ | ||
59 | #define PIIX4_FUNC3IO_PMSTS 0x00 | ||
60 | #define PIIX4_FUNC3IO_PMSTS_PWRBTN_STS (1 << 8) | ||
61 | #define PIIX4_FUNC3IO_PMCNTRL 0x04 | ||
62 | #define PIIX4_FUNC3IO_PMCNTRL_SUS_EN (1 << 13) | ||
63 | #define PIIX4_FUNC3IO_PMCNTRL_SUS_TYP (0x7 << 10) | ||
64 | #define PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_SOFF (0x0 << 10) | ||
65 | #define PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_STR (0x1 << 10) | ||
66 | |||
67 | /* Data for magic special PCI cycle */ | ||
68 | #define PIIX4_SUSPEND_MAGIC 0x00120002 | ||
69 | |||
58 | #endif /* __ASM_MIPS_BOARDS_PIIX4_H */ | 70 | #endif /* __ASM_MIPS_BOARDS_PIIX4_H */ |
diff --git a/arch/mips/include/asm/mips-cpc.h b/arch/mips/include/asm/mips-cpc.h index 988507e46d42..e139a534e0fd 100644 --- a/arch/mips/include/asm/mips-cpc.h +++ b/arch/mips/include/asm/mips-cpc.h | |||
@@ -72,7 +72,12 @@ static inline bool mips_cpc_present(void) | |||
72 | #define MIPS_CPC_COCB_OFS 0x4000 | 72 | #define MIPS_CPC_COCB_OFS 0x4000 |
73 | 73 | ||
74 | /* Macros to ease the creation of register access functions */ | 74 | /* Macros to ease the creation of register access functions */ |
75 | #define BUILD_CPC_R_(name, off) \ | 75 | #define BUILD_CPC_R_(name, off) \ |
76 | static inline u32 *addr_cpc_##name(void) \ | ||
77 | { \ | ||
78 | return (u32 *)(mips_cpc_base + (off)); \ | ||
79 | } \ | ||
80 | \ | ||
76 | static inline u32 read_cpc_##name(void) \ | 81 | static inline u32 read_cpc_##name(void) \ |
77 | { \ | 82 | { \ |
78 | return __raw_readl(mips_cpc_base + (off)); \ | 83 | return __raw_readl(mips_cpc_base + (off)); \ |
@@ -147,4 +152,31 @@ BUILD_CPC_Cx_RW(other, 0x10) | |||
147 | #define CPC_Cx_OTHER_CORENUM_SHF 16 | 152 | #define CPC_Cx_OTHER_CORENUM_SHF 16 |
148 | #define CPC_Cx_OTHER_CORENUM_MSK (_ULCAST_(0xff) << 16) | 153 | #define CPC_Cx_OTHER_CORENUM_MSK (_ULCAST_(0xff) << 16) |
149 | 154 | ||
155 | #ifdef CONFIG_MIPS_CPC | ||
156 | |||
157 | /** | ||
158 | * mips_cpc_lock_other - lock access to another core | ||
159 | * core: the other core to be accessed | ||
160 | * | ||
161 | * Call before operating upon a core via the 'other' register region in | ||
162 | * order to prevent the region being moved during access. Must be followed | ||
163 | * by a call to mips_cpc_unlock_other. | ||
164 | */ | ||
165 | extern void mips_cpc_lock_other(unsigned int core); | ||
166 | |||
167 | /** | ||
168 | * mips_cpc_unlock_other - unlock access to another core | ||
169 | * | ||
170 | * Call after operating upon another core via the 'other' register region. | ||
171 | * Must be called after mips_cpc_lock_other. | ||
172 | */ | ||
173 | extern void mips_cpc_unlock_other(void); | ||
174 | |||
175 | #else /* !CONFIG_MIPS_CPC */ | ||
176 | |||
177 | static inline void mips_cpc_lock_other(unsigned int core) { } | ||
178 | static inline void mips_cpc_unlock_other(void) { } | ||
179 | |||
180 | #endif /* !CONFIG_MIPS_CPC */ | ||
181 | |||
150 | #endif /* __MIPS_ASM_MIPS_CPC_H__ */ | 182 | #endif /* __MIPS_ASM_MIPS_CPC_H__ */ |
diff --git a/arch/mips/include/asm/mips_mt.h b/arch/mips/include/asm/mips_mt.h index a3df0c3faa0e..f6ba004a7711 100644 --- a/arch/mips/include/asm/mips_mt.h +++ b/arch/mips/include/asm/mips_mt.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Definitions and decalrations for MIPS MT support | 2 | * Definitions and decalrations for MIPS MT support that are common between |
3 | * that are common between SMTC, VSMP, and/or AP/SP | 3 | * the VSMP, and AP/SP kernel models. |
4 | * kernel models. | ||
5 | */ | 4 | */ |
6 | #ifndef __ASM_MIPS_MT_H | 5 | #ifndef __ASM_MIPS_MT_H |
7 | #define __ASM_MIPS_MT_H | 6 | #define __ASM_MIPS_MT_H |
diff --git a/arch/mips/include/asm/mipsmtregs.h b/arch/mips/include/asm/mipsmtregs.h index 6efa79a27b6a..5f8052ce43bf 100644 --- a/arch/mips/include/asm/mipsmtregs.h +++ b/arch/mips/include/asm/mipsmtregs.h | |||
@@ -36,6 +36,8 @@ | |||
36 | 36 | ||
37 | #define read_c0_tcbind() __read_32bit_c0_register($2, 2) | 37 | #define read_c0_tcbind() __read_32bit_c0_register($2, 2) |
38 | 38 | ||
39 | #define write_c0_tchalt(val) __write_32bit_c0_register($2, 4, val) | ||
40 | |||
39 | #define read_c0_tccontext() __read_32bit_c0_register($2, 5) | 41 | #define read_c0_tccontext() __read_32bit_c0_register($2, 5) |
40 | #define write_c0_tccontext(val) __write_32bit_c0_register($2, 5, val) | 42 | #define write_c0_tccontext(val) __write_32bit_c0_register($2, 5, val) |
41 | 43 | ||
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 3e025b5311db..98e9754a4b6b 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -709,11 +709,18 @@ | |||
709 | #ifndef __ASSEMBLY__ | 709 | #ifndef __ASSEMBLY__ |
710 | 710 | ||
711 | /* | 711 | /* |
712 | * Macros for handling the ISA mode bit for microMIPS. | 712 | * Macros for handling the ISA mode bit for MIPS16 and microMIPS. |
713 | */ | 713 | */ |
714 | #if defined(CONFIG_SYS_SUPPORTS_MIPS16) || \ | ||
715 | defined(CONFIG_SYS_SUPPORTS_MICROMIPS) | ||
714 | #define get_isa16_mode(x) ((x) & 0x1) | 716 | #define get_isa16_mode(x) ((x) & 0x1) |
715 | #define msk_isa16_mode(x) ((x) & ~0x1) | 717 | #define msk_isa16_mode(x) ((x) & ~0x1) |
716 | #define set_isa16_mode(x) do { (x) |= 0x1; } while(0) | 718 | #define set_isa16_mode(x) do { (x) |= 0x1; } while(0) |
719 | #else | ||
720 | #define get_isa16_mode(x) 0 | ||
721 | #define msk_isa16_mode(x) (x) | ||
722 | #define set_isa16_mode(x) do { } while(0) | ||
723 | #endif | ||
717 | 724 | ||
718 | /* | 725 | /* |
719 | * microMIPS instructions can be 16-bit or 32-bit in length. This | 726 | * microMIPS instructions can be 16-bit or 32-bit in length. This |
@@ -1007,19 +1014,8 @@ do { \ | |||
1007 | #define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val) | 1014 | #define write_c0_compare3(val) __write_32bit_c0_register($11, 7, val) |
1008 | 1015 | ||
1009 | #define read_c0_status() __read_32bit_c0_register($12, 0) | 1016 | #define read_c0_status() __read_32bit_c0_register($12, 0) |
1010 | #ifdef CONFIG_MIPS_MT_SMTC | 1017 | |
1011 | #define write_c0_status(val) \ | ||
1012 | do { \ | ||
1013 | __write_32bit_c0_register($12, 0, val); \ | ||
1014 | __ehb(); \ | ||
1015 | } while (0) | ||
1016 | #else | ||
1017 | /* | ||
1018 | * Legacy non-SMTC code, which may be hazardous | ||
1019 | * but which might not support EHB | ||
1020 | */ | ||
1021 | #define write_c0_status(val) __write_32bit_c0_register($12, 0, val) | 1018 | #define write_c0_status(val) __write_32bit_c0_register($12, 0, val) |
1022 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
1023 | 1019 | ||
1024 | #define read_c0_cause() __read_32bit_c0_register($13, 0) | 1020 | #define read_c0_cause() __read_32bit_c0_register($13, 0) |
1025 | #define write_c0_cause(val) __write_32bit_c0_register($13, 0, val) | 1021 | #define write_c0_cause(val) __write_32bit_c0_register($13, 0, val) |
@@ -1743,11 +1739,6 @@ static inline void tlb_write_random(void) | |||
1743 | /* | 1739 | /* |
1744 | * Manipulate bits in a c0 register. | 1740 | * Manipulate bits in a c0 register. |
1745 | */ | 1741 | */ |
1746 | #ifndef CONFIG_MIPS_MT_SMTC | ||
1747 | /* | ||
1748 | * SMTC Linux requires shutting-down microthread scheduling | ||
1749 | * during CP0 register read-modify-write sequences. | ||
1750 | */ | ||
1751 | #define __BUILD_SET_C0(name) \ | 1742 | #define __BUILD_SET_C0(name) \ |
1752 | static inline unsigned int \ | 1743 | static inline unsigned int \ |
1753 | set_c0_##name(unsigned int set) \ | 1744 | set_c0_##name(unsigned int set) \ |
@@ -1786,121 +1777,6 @@ change_c0_##name(unsigned int change, unsigned int val) \ | |||
1786 | return res; \ | 1777 | return res; \ |
1787 | } | 1778 | } |
1788 | 1779 | ||
1789 | #else /* SMTC versions that manage MT scheduling */ | ||
1790 | |||
1791 | #include <linux/irqflags.h> | ||
1792 | |||
1793 | /* | ||
1794 | * This is a duplicate of dmt() in mipsmtregs.h to avoid problems with | ||
1795 | * header file recursion. | ||
1796 | */ | ||
1797 | static inline unsigned int __dmt(void) | ||
1798 | { | ||
1799 | int res; | ||
1800 | |||
1801 | __asm__ __volatile__( | ||
1802 | " .set push \n" | ||
1803 | " .set mips32r2 \n" | ||
1804 | " .set noat \n" | ||
1805 | " .word 0x41610BC1 # dmt $1 \n" | ||
1806 | " ehb \n" | ||
1807 | " move %0, $1 \n" | ||
1808 | " .set pop \n" | ||
1809 | : "=r" (res)); | ||
1810 | |||
1811 | instruction_hazard(); | ||
1812 | |||
1813 | return res; | ||
1814 | } | ||
1815 | |||
1816 | #define __VPECONTROL_TE_SHIFT 15 | ||
1817 | #define __VPECONTROL_TE (1UL << __VPECONTROL_TE_SHIFT) | ||
1818 | |||
1819 | #define __EMT_ENABLE __VPECONTROL_TE | ||
1820 | |||
1821 | static inline void __emt(unsigned int previous) | ||
1822 | { | ||
1823 | if ((previous & __EMT_ENABLE)) | ||
1824 | __asm__ __volatile__( | ||
1825 | " .set mips32r2 \n" | ||
1826 | " .word 0x41600be1 # emt \n" | ||
1827 | " ehb \n" | ||
1828 | " .set mips0 \n"); | ||
1829 | } | ||
1830 | |||
1831 | static inline void __ehb(void) | ||
1832 | { | ||
1833 | __asm__ __volatile__( | ||
1834 | " .set mips32r2 \n" | ||
1835 | " ehb \n" " .set mips0 \n"); | ||
1836 | } | ||
1837 | |||
1838 | /* | ||
1839 | * Note that local_irq_save/restore affect TC-specific IXMT state, | ||
1840 | * not Status.IE as in non-SMTC kernel. | ||
1841 | */ | ||
1842 | |||
1843 | #define __BUILD_SET_C0(name) \ | ||
1844 | static inline unsigned int \ | ||
1845 | set_c0_##name(unsigned int set) \ | ||
1846 | { \ | ||
1847 | unsigned int res; \ | ||
1848 | unsigned int new; \ | ||
1849 | unsigned int omt; \ | ||
1850 | unsigned long flags; \ | ||
1851 | \ | ||
1852 | local_irq_save(flags); \ | ||
1853 | omt = __dmt(); \ | ||
1854 | res = read_c0_##name(); \ | ||
1855 | new = res | set; \ | ||
1856 | write_c0_##name(new); \ | ||
1857 | __emt(omt); \ | ||
1858 | local_irq_restore(flags); \ | ||
1859 | \ | ||
1860 | return res; \ | ||
1861 | } \ | ||
1862 | \ | ||
1863 | static inline unsigned int \ | ||
1864 | clear_c0_##name(unsigned int clear) \ | ||
1865 | { \ | ||
1866 | unsigned int res; \ | ||
1867 | unsigned int new; \ | ||
1868 | unsigned int omt; \ | ||
1869 | unsigned long flags; \ | ||
1870 | \ | ||
1871 | local_irq_save(flags); \ | ||
1872 | omt = __dmt(); \ | ||
1873 | res = read_c0_##name(); \ | ||
1874 | new = res & ~clear; \ | ||
1875 | write_c0_##name(new); \ | ||
1876 | __emt(omt); \ | ||
1877 | local_irq_restore(flags); \ | ||
1878 | \ | ||
1879 | return res; \ | ||
1880 | } \ | ||
1881 | \ | ||
1882 | static inline unsigned int \ | ||
1883 | change_c0_##name(unsigned int change, unsigned int newbits) \ | ||
1884 | { \ | ||
1885 | unsigned int res; \ | ||
1886 | unsigned int new; \ | ||
1887 | unsigned int omt; \ | ||
1888 | unsigned long flags; \ | ||
1889 | \ | ||
1890 | local_irq_save(flags); \ | ||
1891 | \ | ||
1892 | omt = __dmt(); \ | ||
1893 | res = read_c0_##name(); \ | ||
1894 | new = res & ~change; \ | ||
1895 | new |= (newbits & change); \ | ||
1896 | write_c0_##name(new); \ | ||
1897 | __emt(omt); \ | ||
1898 | local_irq_restore(flags); \ | ||
1899 | \ | ||
1900 | return res; \ | ||
1901 | } | ||
1902 | #endif | ||
1903 | |||
1904 | __BUILD_SET_C0(status) | 1780 | __BUILD_SET_C0(status) |
1905 | __BUILD_SET_C0(cause) | 1781 | __BUILD_SET_C0(cause) |
1906 | __BUILD_SET_C0(config) | 1782 | __BUILD_SET_C0(config) |
@@ -1916,6 +1792,15 @@ __BUILD_SET_C0(brcm_cmt_ctrl) | |||
1916 | __BUILD_SET_C0(brcm_config) | 1792 | __BUILD_SET_C0(brcm_config) |
1917 | __BUILD_SET_C0(brcm_mode) | 1793 | __BUILD_SET_C0(brcm_mode) |
1918 | 1794 | ||
1795 | /* | ||
1796 | * Return low 10 bits of ebase. | ||
1797 | * Note that under KVM (MIPSVZ) this returns vcpu id. | ||
1798 | */ | ||
1799 | static inline unsigned int get_ebase_cpunum(void) | ||
1800 | { | ||
1801 | return read_c0_ebase() & 0x3ff; | ||
1802 | } | ||
1803 | |||
1919 | #endif /* !__ASSEMBLY__ */ | 1804 | #endif /* !__ASSEMBLY__ */ |
1920 | 1805 | ||
1921 | #endif /* _ASM_MIPSREGS_H */ | 1806 | #endif /* _ASM_MIPSREGS_H */ |
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h index e277bbad2871..2e373da5f8e9 100644 --- a/arch/mips/include/asm/mmu_context.h +++ b/arch/mips/include/asm/mmu_context.h | |||
@@ -18,10 +18,6 @@ | |||
18 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
19 | #include <asm/hazards.h> | 19 | #include <asm/hazards.h> |
20 | #include <asm/tlbflush.h> | 20 | #include <asm/tlbflush.h> |
21 | #ifdef CONFIG_MIPS_MT_SMTC | ||
22 | #include <asm/mipsmtregs.h> | ||
23 | #include <asm/smtc.h> | ||
24 | #endif /* SMTC */ | ||
25 | #include <asm-generic/mm_hooks.h> | 21 | #include <asm-generic/mm_hooks.h> |
26 | 22 | ||
27 | #define TLBMISS_HANDLER_SETUP_PGD(pgd) \ | 23 | #define TLBMISS_HANDLER_SETUP_PGD(pgd) \ |
@@ -31,11 +27,15 @@ do { \ | |||
31 | } while (0) | 27 | } while (0) |
32 | 28 | ||
33 | #ifdef CONFIG_MIPS_PGD_C0_CONTEXT | 29 | #ifdef CONFIG_MIPS_PGD_C0_CONTEXT |
30 | |||
31 | #define TLBMISS_HANDLER_RESTORE() \ | ||
32 | write_c0_xcontext((unsigned long) smp_processor_id() << \ | ||
33 | SMP_CPUID_REGSHIFT) | ||
34 | |||
34 | #define TLBMISS_HANDLER_SETUP() \ | 35 | #define TLBMISS_HANDLER_SETUP() \ |
35 | do { \ | 36 | do { \ |
36 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \ | 37 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \ |
37 | write_c0_xcontext((unsigned long) smp_processor_id() << \ | 38 | TLBMISS_HANDLER_RESTORE(); \ |
38 | SMP_CPUID_REGSHIFT); \ | ||
39 | } while (0) | 39 | } while (0) |
40 | 40 | ||
41 | #else /* !CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ | 41 | #else /* !CONFIG_MIPS_PGD_C0_CONTEXT: using pgd_current*/ |
@@ -47,9 +47,12 @@ do { \ | |||
47 | */ | 47 | */ |
48 | extern unsigned long pgd_current[]; | 48 | extern unsigned long pgd_current[]; |
49 | 49 | ||
50 | #define TLBMISS_HANDLER_SETUP() \ | 50 | #define TLBMISS_HANDLER_RESTORE() \ |
51 | write_c0_context((unsigned long) smp_processor_id() << \ | 51 | write_c0_context((unsigned long) smp_processor_id() << \ |
52 | SMP_CPUID_REGSHIFT); \ | 52 | SMP_CPUID_REGSHIFT) |
53 | |||
54 | #define TLBMISS_HANDLER_SETUP() \ | ||
55 | TLBMISS_HANDLER_RESTORE(); \ | ||
53 | back_to_back_c0_hazard(); \ | 56 | back_to_back_c0_hazard(); \ |
54 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) | 57 | TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir) |
55 | #endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/ | 58 | #endif /* CONFIG_MIPS_PGD_C0_CONTEXT*/ |
@@ -63,13 +66,6 @@ extern unsigned long pgd_current[]; | |||
63 | #define ASID_INC 0x10 | 66 | #define ASID_INC 0x10 |
64 | #define ASID_MASK 0xff0 | 67 | #define ASID_MASK 0xff0 |
65 | 68 | ||
66 | #elif defined(CONFIG_MIPS_MT_SMTC) | ||
67 | |||
68 | #define ASID_INC 0x1 | ||
69 | extern unsigned long smtc_asid_mask; | ||
70 | #define ASID_MASK (smtc_asid_mask) | ||
71 | #define HW_ASID_MASK 0xff | ||
72 | /* End SMTC/34K debug hack */ | ||
73 | #else /* FIXME: not correct for R6000 */ | 69 | #else /* FIXME: not correct for R6000 */ |
74 | 70 | ||
75 | #define ASID_INC 0x1 | 71 | #define ASID_INC 0x1 |
@@ -92,7 +88,6 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | |||
92 | #define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1))) | 88 | #define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1))) |
93 | #define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1) | 89 | #define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1) |
94 | 90 | ||
95 | #ifndef CONFIG_MIPS_MT_SMTC | ||
96 | /* Normal, classic MIPS get_new_mmu_context */ | 91 | /* Normal, classic MIPS get_new_mmu_context */ |
97 | static inline void | 92 | static inline void |
98 | get_new_mmu_context(struct mm_struct *mm, unsigned long cpu) | 93 | get_new_mmu_context(struct mm_struct *mm, unsigned long cpu) |
@@ -115,12 +110,6 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long cpu) | |||
115 | cpu_context(cpu, mm) = asid_cache(cpu) = asid; | 110 | cpu_context(cpu, mm) = asid_cache(cpu) = asid; |
116 | } | 111 | } |
117 | 112 | ||
118 | #else /* CONFIG_MIPS_MT_SMTC */ | ||
119 | |||
120 | #define get_new_mmu_context(mm, cpu) smtc_get_new_mmu_context((mm), (cpu)) | ||
121 | |||
122 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
123 | |||
124 | /* | 113 | /* |
125 | * Initialize the context related info for a new mm_struct | 114 | * Initialize the context related info for a new mm_struct |
126 | * instance. | 115 | * instance. |
@@ -141,46 +130,12 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
141 | { | 130 | { |
142 | unsigned int cpu = smp_processor_id(); | 131 | unsigned int cpu = smp_processor_id(); |
143 | unsigned long flags; | 132 | unsigned long flags; |
144 | #ifdef CONFIG_MIPS_MT_SMTC | ||
145 | unsigned long oldasid; | ||
146 | unsigned long mtflags; | ||
147 | int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id; | ||
148 | local_irq_save(flags); | 133 | local_irq_save(flags); |
149 | mtflags = dvpe(); | ||
150 | #else /* Not SMTC */ | ||
151 | local_irq_save(flags); | ||
152 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
153 | 134 | ||
154 | /* Check if our ASID is of an older version and thus invalid */ | 135 | /* Check if our ASID is of an older version and thus invalid */ |
155 | if ((cpu_context(cpu, next) ^ asid_cache(cpu)) & ASID_VERSION_MASK) | 136 | if ((cpu_context(cpu, next) ^ asid_cache(cpu)) & ASID_VERSION_MASK) |
156 | get_new_mmu_context(next, cpu); | 137 | get_new_mmu_context(next, cpu); |
157 | #ifdef CONFIG_MIPS_MT_SMTC | ||
158 | /* | ||
159 | * If the EntryHi ASID being replaced happens to be | ||
160 | * the value flagged at ASID recycling time as having | ||
161 | * an extended life, clear the bit showing it being | ||
162 | * in use by this "CPU", and if that's the last bit, | ||
163 | * free up the ASID value for use and flush any old | ||
164 | * instances of it from the TLB. | ||
165 | */ | ||
166 | oldasid = (read_c0_entryhi() & ASID_MASK); | ||
167 | if(smtc_live_asid[mytlb][oldasid]) { | ||
168 | smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu); | ||
169 | if(smtc_live_asid[mytlb][oldasid] == 0) | ||
170 | smtc_flush_tlb_asid(oldasid); | ||
171 | } | ||
172 | /* | ||
173 | * Tread softly on EntryHi, and so long as we support | ||
174 | * having ASID_MASK smaller than the hardware maximum, | ||
175 | * make sure no "soft" bits become "hard"... | ||
176 | */ | ||
177 | write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) | | ||
178 | cpu_asid(cpu, next)); | ||
179 | ehb(); /* Make sure it propagates to TCStatus */ | ||
180 | evpe(mtflags); | ||
181 | #else | ||
182 | write_c0_entryhi(cpu_asid(cpu, next)); | 138 | write_c0_entryhi(cpu_asid(cpu, next)); |
183 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
184 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); | 139 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); |
185 | 140 | ||
186 | /* | 141 | /* |
@@ -213,34 +168,12 @@ activate_mm(struct mm_struct *prev, struct mm_struct *next) | |||
213 | unsigned long flags; | 168 | unsigned long flags; |
214 | unsigned int cpu = smp_processor_id(); | 169 | unsigned int cpu = smp_processor_id(); |
215 | 170 | ||
216 | #ifdef CONFIG_MIPS_MT_SMTC | ||
217 | unsigned long oldasid; | ||
218 | unsigned long mtflags; | ||
219 | int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id; | ||
220 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
221 | |||
222 | local_irq_save(flags); | 171 | local_irq_save(flags); |
223 | 172 | ||
224 | /* Unconditionally get a new ASID. */ | 173 | /* Unconditionally get a new ASID. */ |
225 | get_new_mmu_context(next, cpu); | 174 | get_new_mmu_context(next, cpu); |
226 | 175 | ||
227 | #ifdef CONFIG_MIPS_MT_SMTC | ||
228 | /* See comments for similar code above */ | ||
229 | mtflags = dvpe(); | ||
230 | oldasid = read_c0_entryhi() & ASID_MASK; | ||
231 | if(smtc_live_asid[mytlb][oldasid]) { | ||
232 | smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu); | ||
233 | if(smtc_live_asid[mytlb][oldasid] == 0) | ||
234 | smtc_flush_tlb_asid(oldasid); | ||
235 | } | ||
236 | /* See comments for similar code above */ | ||
237 | write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) | | ||
238 | cpu_asid(cpu, next)); | ||
239 | ehb(); /* Make sure it propagates to TCStatus */ | ||
240 | evpe(mtflags); | ||
241 | #else | ||
242 | write_c0_entryhi(cpu_asid(cpu, next)); | 176 | write_c0_entryhi(cpu_asid(cpu, next)); |
243 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
244 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); | 177 | TLBMISS_HANDLER_SETUP_PGD(next->pgd); |
245 | 178 | ||
246 | /* mark mmu ownership change */ | 179 | /* mark mmu ownership change */ |
@@ -258,48 +191,15 @@ static inline void | |||
258 | drop_mmu_context(struct mm_struct *mm, unsigned cpu) | 191 | drop_mmu_context(struct mm_struct *mm, unsigned cpu) |
259 | { | 192 | { |
260 | unsigned long flags; | 193 | unsigned long flags; |
261 | #ifdef CONFIG_MIPS_MT_SMTC | ||
262 | unsigned long oldasid; | ||
263 | /* Can't use spinlock because called from TLB flush within DVPE */ | ||
264 | unsigned int prevvpe; | ||
265 | int mytlb = (smtc_status & SMTC_TLB_SHARED) ? 0 : cpu_data[cpu].vpe_id; | ||
266 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
267 | 194 | ||
268 | local_irq_save(flags); | 195 | local_irq_save(flags); |
269 | 196 | ||
270 | if (cpumask_test_cpu(cpu, mm_cpumask(mm))) { | 197 | if (cpumask_test_cpu(cpu, mm_cpumask(mm))) { |
271 | get_new_mmu_context(mm, cpu); | 198 | get_new_mmu_context(mm, cpu); |
272 | #ifdef CONFIG_MIPS_MT_SMTC | ||
273 | /* See comments for similar code above */ | ||
274 | prevvpe = dvpe(); | ||
275 | oldasid = (read_c0_entryhi() & ASID_MASK); | ||
276 | if (smtc_live_asid[mytlb][oldasid]) { | ||
277 | smtc_live_asid[mytlb][oldasid] &= ~(0x1 << cpu); | ||
278 | if(smtc_live_asid[mytlb][oldasid] == 0) | ||
279 | smtc_flush_tlb_asid(oldasid); | ||
280 | } | ||
281 | /* See comments for similar code above */ | ||
282 | write_c0_entryhi((read_c0_entryhi() & ~HW_ASID_MASK) | ||
283 | | cpu_asid(cpu, mm)); | ||
284 | ehb(); /* Make sure it propagates to TCStatus */ | ||
285 | evpe(prevvpe); | ||
286 | #else /* not CONFIG_MIPS_MT_SMTC */ | ||
287 | write_c0_entryhi(cpu_asid(cpu, mm)); | 199 | write_c0_entryhi(cpu_asid(cpu, mm)); |
288 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
289 | } else { | 200 | } else { |
290 | /* will get a new context next time */ | 201 | /* will get a new context next time */ |
291 | #ifndef CONFIG_MIPS_MT_SMTC | ||
292 | cpu_context(cpu, mm) = 0; | 202 | cpu_context(cpu, mm) = 0; |
293 | #else /* SMTC */ | ||
294 | int i; | ||
295 | |||
296 | /* SMTC shares the TLB (and ASIDs) across VPEs */ | ||
297 | for_each_online_cpu(i) { | ||
298 | if((smtc_status & SMTC_TLB_SHARED) | ||
299 | || (cpu_data[i].vpe_id == cpu_data[cpu].vpe_id)) | ||
300 | cpu_context(i, mm) = 0; | ||
301 | } | ||
302 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
303 | } | 203 | } |
304 | local_irq_restore(flags); | 204 | local_irq_restore(flags); |
305 | } | 205 | } |
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h index c2edae382d5d..800fe578dc99 100644 --- a/arch/mips/include/asm/module.h +++ b/arch/mips/include/asm/module.h | |||
@@ -144,13 +144,7 @@ search_module_dbetables(unsigned long addr) | |||
144 | #define MODULE_KERNEL_TYPE "64BIT " | 144 | #define MODULE_KERNEL_TYPE "64BIT " |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | #ifdef CONFIG_MIPS_MT_SMTC | ||
148 | #define MODULE_KERNEL_SMTC "MT_SMTC " | ||
149 | #else | ||
150 | #define MODULE_KERNEL_SMTC "" | ||
151 | #endif | ||
152 | |||
153 | #define MODULE_ARCH_VERMAGIC \ | 147 | #define MODULE_ARCH_VERMAGIC \ |
154 | MODULE_PROC_FAMILY MODULE_KERNEL_TYPE MODULE_KERNEL_SMTC | 148 | MODULE_PROC_FAMILY MODULE_KERNEL_TYPE |
155 | 149 | ||
156 | #endif /* _ASM_MODULE_H */ | 150 | #endif /* _ASM_MODULE_H */ |
diff --git a/arch/mips/include/asm/msa.h b/arch/mips/include/asm/msa.h index a2aba6c3ec05..538f6d482db8 100644 --- a/arch/mips/include/asm/msa.h +++ b/arch/mips/include/asm/msa.h | |||
@@ -84,7 +84,7 @@ static inline void write_msa_##name(unsigned int val) \ | |||
84 | __asm__ __volatile__( \ | 84 | __asm__ __volatile__( \ |
85 | " .set push\n" \ | 85 | " .set push\n" \ |
86 | " .set msa\n" \ | 86 | " .set msa\n" \ |
87 | " cfcmsa $" #cs ", %0\n" \ | 87 | " ctcmsa $" #cs ", %0\n" \ |
88 | " .set pop\n" \ | 88 | " .set pop\n" \ |
89 | : : "r"(val)); \ | 89 | : : "r"(val)); \ |
90 | } | 90 | } |
@@ -96,6 +96,13 @@ static inline void write_msa_##name(unsigned int val) \ | |||
96 | * allow compilation with toolchains that do not support MSA. Once all | 96 | * allow compilation with toolchains that do not support MSA. Once all |
97 | * toolchains in use support MSA these can be removed. | 97 | * toolchains in use support MSA these can be removed. |
98 | */ | 98 | */ |
99 | #ifdef CONFIG_CPU_MICROMIPS | ||
100 | #define CFC_MSA_INSN 0x587e0056 | ||
101 | #define CTC_MSA_INSN 0x583e0816 | ||
102 | #else | ||
103 | #define CFC_MSA_INSN 0x787e0059 | ||
104 | #define CTC_MSA_INSN 0x783e0819 | ||
105 | #endif | ||
99 | 106 | ||
100 | #define __BUILD_MSA_CTL_REG(name, cs) \ | 107 | #define __BUILD_MSA_CTL_REG(name, cs) \ |
101 | static inline unsigned int read_msa_##name(void) \ | 108 | static inline unsigned int read_msa_##name(void) \ |
@@ -104,7 +111,8 @@ static inline unsigned int read_msa_##name(void) \ | |||
104 | __asm__ __volatile__( \ | 111 | __asm__ __volatile__( \ |
105 | " .set push\n" \ | 112 | " .set push\n" \ |
106 | " .set noat\n" \ | 113 | " .set noat\n" \ |
107 | " .word 0x787e0059 | (" #cs " << 11)\n" \ | 114 | " .insn\n" \ |
115 | " .word #CFC_MSA_INSN | (" #cs " << 11)\n" \ | ||
108 | " move %0, $1\n" \ | 116 | " move %0, $1\n" \ |
109 | " .set pop\n" \ | 117 | " .set pop\n" \ |
110 | : "=r"(reg)); \ | 118 | : "=r"(reg)); \ |
@@ -117,7 +125,8 @@ static inline void write_msa_##name(unsigned int val) \ | |||
117 | " .set push\n" \ | 125 | " .set push\n" \ |
118 | " .set noat\n" \ | 126 | " .set noat\n" \ |
119 | " move $1, %0\n" \ | 127 | " move $1, %0\n" \ |
120 | " .word 0x783e0819 | (" #cs " << 6)\n" \ | 128 | " .insn\n" \ |
129 | " .word #CTC_MSA_INSN | (" #cs " << 6)\n" \ | ||
121 | " .set pop\n" \ | 130 | " .set pop\n" \ |
122 | : : "r"(val)); \ | 131 | : : "r"(val)); \ |
123 | } | 132 | } |
diff --git a/arch/mips/include/asm/netlogic/mips-extns.h b/arch/mips/include/asm/netlogic/mips-extns.h index de9aada6f4c1..06f1f75bfa9b 100644 --- a/arch/mips/include/asm/netlogic/mips-extns.h +++ b/arch/mips/include/asm/netlogic/mips-extns.h | |||
@@ -146,9 +146,10 @@ static inline int hard_smp_processor_id(void) | |||
146 | 146 | ||
147 | static inline int nlm_nodeid(void) | 147 | static inline int nlm_nodeid(void) |
148 | { | 148 | { |
149 | uint32_t prid = read_c0_prid(); | 149 | uint32_t prid = read_c0_prid() & PRID_IMP_MASK; |
150 | 150 | ||
151 | if ((prid & 0xff00) == PRID_IMP_NETLOGIC_XLP9XX) | 151 | if ((prid == PRID_IMP_NETLOGIC_XLP9XX) || |
152 | (prid == PRID_IMP_NETLOGIC_XLP5XX)) | ||
152 | return (__read_32bit_c0_register($15, 1) >> 7) & 0x7; | 153 | return (__read_32bit_c0_register($15, 1) >> 7) & 0x7; |
153 | else | 154 | else |
154 | return (__read_32bit_c0_register($15, 1) >> 5) & 0x3; | 155 | return (__read_32bit_c0_register($15, 1) >> 5) & 0x3; |
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h index 1f23dfaa7167..805bfd21f33e 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/iomap.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/iomap.h | |||
@@ -74,6 +74,8 @@ | |||
74 | #define XLP_IO_USB_OHCI2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 4) | 74 | #define XLP_IO_USB_OHCI2_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 4) |
75 | #define XLP_IO_USB_OHCI3_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 5) | 75 | #define XLP_IO_USB_OHCI3_OFFSET(node) XLP_HDR_OFFSET(node, 0, 2, 5) |
76 | 76 | ||
77 | #define XLP_IO_SATA_OFFSET(node) XLP_HDR_OFFSET(node, 0, 3, 2) | ||
78 | |||
77 | /* XLP2xx has an updated USB block */ | 79 | /* XLP2xx has an updated USB block */ |
78 | #define XLP2XX_IO_USB_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 4, i) | 80 | #define XLP2XX_IO_USB_OFFSET(node, i) XLP_HDR_OFFSET(node, 0, 4, i) |
79 | #define XLP2XX_IO_USB_XHCI0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 1) | 81 | #define XLP2XX_IO_USB_XHCI0_OFFSET(node) XLP_HDR_OFFSET(node, 0, 4, 1) |
@@ -103,13 +105,11 @@ | |||
103 | #define XLP_IO_SYS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 5) | 105 | #define XLP_IO_SYS_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 5) |
104 | #define XLP_IO_JTAG_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 6) | 106 | #define XLP_IO_JTAG_OFFSET(node) XLP_HDR_OFFSET(node, 0, 6, 6) |
105 | 107 | ||
108 | /* Flash */ | ||
106 | #define XLP_IO_NOR_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 0) | 109 | #define XLP_IO_NOR_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 0) |
107 | #define XLP_IO_NAND_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 1) | 110 | #define XLP_IO_NAND_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 1) |
108 | #define XLP_IO_SPI_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 2) | 111 | #define XLP_IO_SPI_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 2) |
109 | /* SD flash */ | 112 | #define XLP_IO_MMC_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 3) |
110 | #define XLP_IO_SD_OFFSET(node) XLP_HDR_OFFSET(node, 0, 7, 3) | ||
111 | #define XLP_IO_MMC_OFFSET(node, slot) \ | ||
112 | ((XLP_IO_SD_OFFSET(node))+(slot*0x100)+XLP_IO_PCI_HDRSZ) | ||
113 | 113 | ||
114 | /* Things have changed drastically in XLP 9XX */ | 114 | /* Things have changed drastically in XLP 9XX */ |
115 | #define XLP9XX_HDR_OFFSET(n, d, f) \ | 115 | #define XLP9XX_HDR_OFFSET(n, d, f) \ |
@@ -120,6 +120,8 @@ | |||
120 | #define XLP9XX_IO_UART_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 2) | 120 | #define XLP9XX_IO_UART_OFFSET(node) XLP9XX_HDR_OFFSET(node, 2, 2) |
121 | #define XLP9XX_IO_SYS_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 0) | 121 | #define XLP9XX_IO_SYS_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 0) |
122 | #define XLP9XX_IO_FUSE_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 1) | 122 | #define XLP9XX_IO_FUSE_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 1) |
123 | #define XLP9XX_IO_CLOCK_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 2) | ||
124 | #define XLP9XX_IO_POWER_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 3) | ||
123 | #define XLP9XX_IO_JTAG_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 4) | 125 | #define XLP9XX_IO_JTAG_OFFSET(node) XLP9XX_HDR_OFFSET(node, 6, 4) |
124 | 126 | ||
125 | #define XLP9XX_IO_PCIE_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 1, i) | 127 | #define XLP9XX_IO_PCIE_OFFSET(node, i) XLP9XX_HDR_OFFSET(node, 1, i) |
@@ -135,11 +137,11 @@ | |||
135 | /* XLP9XX on-chip SATA controller */ | 137 | /* XLP9XX on-chip SATA controller */ |
136 | #define XLP9XX_IO_SATA_OFFSET(node) XLP9XX_HDR_OFFSET(node, 3, 2) | 138 | #define XLP9XX_IO_SATA_OFFSET(node) XLP9XX_HDR_OFFSET(node, 3, 2) |
137 | 139 | ||
140 | /* Flash */ | ||
138 | #define XLP9XX_IO_NOR_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 0) | 141 | #define XLP9XX_IO_NOR_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 0) |
139 | #define XLP9XX_IO_NAND_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 1) | 142 | #define XLP9XX_IO_NAND_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 1) |
140 | #define XLP9XX_IO_SPI_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 2) | 143 | #define XLP9XX_IO_SPI_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 2) |
141 | /* SD flash */ | 144 | #define XLP9XX_IO_MMC_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 3) |
142 | #define XLP9XX_IO_MMCSD_OFFSET(node) XLP9XX_HDR_OFFSET(node, 7, 3) | ||
143 | 145 | ||
144 | /* PCI config header register id's */ | 146 | /* PCI config header register id's */ |
145 | #define XLP_PCI_CFGREG0 0x00 | 147 | #define XLP_PCI_CFGREG0 0x00 |
@@ -186,8 +188,10 @@ | |||
186 | #define PCI_DEVICE_ID_NLM_NOR 0x1015 | 188 | #define PCI_DEVICE_ID_NLM_NOR 0x1015 |
187 | #define PCI_DEVICE_ID_NLM_NAND 0x1016 | 189 | #define PCI_DEVICE_ID_NLM_NAND 0x1016 |
188 | #define PCI_DEVICE_ID_NLM_MMC 0x1018 | 190 | #define PCI_DEVICE_ID_NLM_MMC 0x1018 |
189 | #define PCI_DEVICE_ID_NLM_XHCI 0x101d | 191 | #define PCI_DEVICE_ID_NLM_SATA 0x101A |
192 | #define PCI_DEVICE_ID_NLM_XHCI 0x101D | ||
190 | 193 | ||
194 | #define PCI_DEVICE_ID_XLP9XX_MMC 0x9018 | ||
191 | #define PCI_DEVICE_ID_XLP9XX_SATA 0x901A | 195 | #define PCI_DEVICE_ID_XLP9XX_SATA 0x901A |
192 | #define PCI_DEVICE_ID_XLP9XX_XHCI 0x901D | 196 | #define PCI_DEVICE_ID_XLP9XX_XHCI 0x901D |
193 | 197 | ||
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h index d4deb87ad069..91540f41e1e4 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/pcibus.h | |||
@@ -69,6 +69,20 @@ | |||
69 | #define PCIE_9XX_BYTE_SWAP_IO_BASE 0x25e | 69 | #define PCIE_9XX_BYTE_SWAP_IO_BASE 0x25e |
70 | #define PCIE_9XX_BYTE_SWAP_IO_LIM 0x25f | 70 | #define PCIE_9XX_BYTE_SWAP_IO_LIM 0x25f |
71 | 71 | ||
72 | #define PCIE_9XX_BRIDGE_MSIX_ADDR_BASE 0x264 | ||
73 | #define PCIE_9XX_BRIDGE_MSIX_ADDR_LIMIT 0x265 | ||
74 | #define PCIE_9XX_MSI_STATUS 0x283 | ||
75 | #define PCIE_9XX_MSI_EN 0x284 | ||
76 | /* 128 MSIX vectors available in 9xx */ | ||
77 | #define PCIE_9XX_MSIX_STATUS0 0x286 | ||
78 | #define PCIE_9XX_MSIX_STATUSX(n) (n + 0x286) | ||
79 | #define PCIE_9XX_MSIX_VEC 0x296 | ||
80 | #define PCIE_9XX_MSIX_VECX(n) (n + 0x296) | ||
81 | #define PCIE_9XX_INT_STATUS0 0x397 | ||
82 | #define PCIE_9XX_INT_STATUS1 0x398 | ||
83 | #define PCIE_9XX_INT_EN0 0x399 | ||
84 | #define PCIE_9XX_INT_EN1 0x39a | ||
85 | |||
72 | /* other */ | 86 | /* other */ |
73 | #define PCIE_NLINKS 4 | 87 | #define PCIE_NLINKS 4 |
74 | 88 | ||
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pic.h b/arch/mips/include/asm/netlogic/xlp-hal/pic.h index f10bf3bba58f..41cefe94f0c9 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/pic.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/pic.h | |||
@@ -199,6 +199,10 @@ | |||
199 | #define PIC_IRT_PCIE_LINK_3_INDEX 81 | 199 | #define PIC_IRT_PCIE_LINK_3_INDEX 81 |
200 | #define PIC_IRT_PCIE_LINK_INDEX(num) ((num) + PIC_IRT_PCIE_LINK_0_INDEX) | 200 | #define PIC_IRT_PCIE_LINK_INDEX(num) ((num) + PIC_IRT_PCIE_LINK_0_INDEX) |
201 | 201 | ||
202 | #define PIC_9XX_IRT_PCIE_LINK_0_INDEX 191 | ||
203 | #define PIC_9XX_IRT_PCIE_LINK_INDEX(num) \ | ||
204 | ((num) + PIC_9XX_IRT_PCIE_LINK_0_INDEX) | ||
205 | |||
202 | #define PIC_CLOCK_TIMER 7 | 206 | #define PIC_CLOCK_TIMER 7 |
203 | 207 | ||
204 | #if !defined(LOCORE) && !defined(__ASSEMBLY__) | 208 | #if !defined(LOCORE) && !defined(__ASSEMBLY__) |
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/sys.h b/arch/mips/include/asm/netlogic/xlp-hal/sys.h index d9b107ffca93..bc7bddf25be9 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/sys.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/sys.h | |||
@@ -118,6 +118,10 @@ | |||
118 | #define SYS_SCRTCH3 0x4c | 118 | #define SYS_SCRTCH3 0x4c |
119 | 119 | ||
120 | /* PLL registers XLP2XX */ | 120 | /* PLL registers XLP2XX */ |
121 | #define SYS_CPU_PLL_CTRL0(core) (0x1c0 + (core * 4)) | ||
122 | #define SYS_CPU_PLL_CTRL1(core) (0x1c1 + (core * 4)) | ||
123 | #define SYS_CPU_PLL_CTRL2(core) (0x1c2 + (core * 4)) | ||
124 | #define SYS_CPU_PLL_CTRL3(core) (0x1c3 + (core * 4)) | ||
121 | #define SYS_PLL_CTRL0 0x240 | 125 | #define SYS_PLL_CTRL0 0x240 |
122 | #define SYS_PLL_CTRL1 0x241 | 126 | #define SYS_PLL_CTRL1 0x241 |
123 | #define SYS_PLL_CTRL2 0x242 | 127 | #define SYS_PLL_CTRL2 0x242 |
@@ -147,6 +151,32 @@ | |||
147 | #define SYS_SYS_PLL_MEM_REQ 0x2a3 | 151 | #define SYS_SYS_PLL_MEM_REQ 0x2a3 |
148 | #define SYS_PLL_MEM_STAT 0x2a4 | 152 | #define SYS_PLL_MEM_STAT 0x2a4 |
149 | 153 | ||
154 | /* PLL registers XLP9XX */ | ||
155 | #define SYS_9XX_CPU_PLL_CTRL0(core) (0xc0 + (core * 4)) | ||
156 | #define SYS_9XX_CPU_PLL_CTRL1(core) (0xc1 + (core * 4)) | ||
157 | #define SYS_9XX_CPU_PLL_CTRL2(core) (0xc2 + (core * 4)) | ||
158 | #define SYS_9XX_CPU_PLL_CTRL3(core) (0xc3 + (core * 4)) | ||
159 | #define SYS_9XX_DMC_PLL_CTRL0 0x140 | ||
160 | #define SYS_9XX_DMC_PLL_CTRL1 0x141 | ||
161 | #define SYS_9XX_DMC_PLL_CTRL2 0x142 | ||
162 | #define SYS_9XX_DMC_PLL_CTRL3 0x143 | ||
163 | #define SYS_9XX_PLL_CTRL0 0x144 | ||
164 | #define SYS_9XX_PLL_CTRL1 0x145 | ||
165 | #define SYS_9XX_PLL_CTRL2 0x146 | ||
166 | #define SYS_9XX_PLL_CTRL3 0x147 | ||
167 | |||
168 | #define SYS_9XX_PLL_CTRL0_DEVX(x) (0x148 + (x) * 4) | ||
169 | #define SYS_9XX_PLL_CTRL1_DEVX(x) (0x149 + (x) * 4) | ||
170 | #define SYS_9XX_PLL_CTRL2_DEVX(x) (0x14a + (x) * 4) | ||
171 | #define SYS_9XX_PLL_CTRL3_DEVX(x) (0x14b + (x) * 4) | ||
172 | |||
173 | #define SYS_9XX_CPU_PLL_CHG_CTRL 0x188 | ||
174 | #define SYS_9XX_PLL_CHG_CTRL 0x189 | ||
175 | #define SYS_9XX_CLK_DEV_DIS 0x18a | ||
176 | #define SYS_9XX_CLK_DEV_SEL 0x18b | ||
177 | #define SYS_9XX_CLK_DEV_DIV 0x18d | ||
178 | #define SYS_9XX_CLK_DEV_CHG 0x18f | ||
179 | |||
150 | /* Registers changed on 9XX */ | 180 | /* Registers changed on 9XX */ |
151 | #define SYS_9XX_POWER_ON_RESET_CFG 0x00 | 181 | #define SYS_9XX_POWER_ON_RESET_CFG 0x00 |
152 | #define SYS_9XX_CHIP_RESET 0x01 | 182 | #define SYS_9XX_CHIP_RESET 0x01 |
@@ -170,6 +200,11 @@ | |||
170 | #define nlm_get_fuse_regbase(node) \ | 200 | #define nlm_get_fuse_regbase(node) \ |
171 | (nlm_get_fuse_pcibase(node) + XLP_IO_PCI_HDRSZ) | 201 | (nlm_get_fuse_pcibase(node) + XLP_IO_PCI_HDRSZ) |
172 | 202 | ||
203 | #define nlm_get_clock_pcibase(node) \ | ||
204 | nlm_pcicfg_base(XLP9XX_IO_CLOCK_OFFSET(node)) | ||
205 | #define nlm_get_clock_regbase(node) \ | ||
206 | (nlm_get_clock_pcibase(node) + XLP_IO_PCI_HDRSZ) | ||
207 | |||
173 | unsigned int nlm_get_pic_frequency(int node); | 208 | unsigned int nlm_get_pic_frequency(int node); |
174 | #endif | 209 | #endif |
175 | #endif | 210 | #endif |
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h index 2b0c9599ebe5..a862b93223cc 100644 --- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h +++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h | |||
@@ -58,6 +58,10 @@ | |||
58 | #define PIC_I2C_1_IRQ 31 | 58 | #define PIC_I2C_1_IRQ 31 |
59 | #define PIC_I2C_2_IRQ 32 | 59 | #define PIC_I2C_2_IRQ 32 |
60 | #define PIC_I2C_3_IRQ 33 | 60 | #define PIC_I2C_3_IRQ 33 |
61 | #define PIC_SPI_IRQ 34 | ||
62 | #define PIC_NAND_IRQ 37 | ||
63 | #define PIC_SATA_IRQ 38 | ||
64 | #define PIC_GPIO_IRQ 39 | ||
61 | 65 | ||
62 | #define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */ | 66 | #define PIC_PCIE_LINK_MSI_IRQ_BASE 44 /* 44 - 47 MSI IRQ */ |
63 | #define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i)) | 67 | #define PIC_PCIE_LINK_MSI_IRQ(i) (44 + (i)) |
@@ -66,8 +70,9 @@ | |||
66 | #define PIC_PCIE_MSIX_IRQ_BASE 48 /* 48 - 51 MSI-X IRQ */ | 70 | #define PIC_PCIE_MSIX_IRQ_BASE 48 /* 48 - 51 MSI-X IRQ */ |
67 | #define PIC_PCIE_MSIX_IRQ(i) (48 + (i)) | 71 | #define PIC_PCIE_MSIX_IRQ(i) (48 + (i)) |
68 | 72 | ||
69 | #define NLM_MSIX_VEC_BASE 96 /* 96 - 127 - MSIX mapped */ | 73 | /* XLP9xx and XLP8xx has 128 and 32 MSIX vectors respectively */ |
70 | #define NLM_MSI_VEC_BASE 128 /* 128 -255 - MSI mapped */ | 74 | #define NLM_MSIX_VEC_BASE 96 /* 96 - 223 - MSIX mapped */ |
75 | #define NLM_MSI_VEC_BASE 224 /* 224 -351 - MSI mapped */ | ||
71 | 76 | ||
72 | #define NLM_PIC_INDIRECT_VEC_BASE 512 | 77 | #define NLM_PIC_INDIRECT_VEC_BASE 512 |
73 | #define NLM_GPIO_VEC_BASE 768 | 78 | #define NLM_GPIO_VEC_BASE 768 |
@@ -95,17 +100,19 @@ void *xlp_dt_init(void *fdtp); | |||
95 | 100 | ||
96 | static inline int cpu_is_xlpii(void) | 101 | static inline int cpu_is_xlpii(void) |
97 | { | 102 | { |
98 | int chip = read_c0_prid() & 0xff00; | 103 | int chip = read_c0_prid() & PRID_IMP_MASK; |
99 | 104 | ||
100 | return chip == PRID_IMP_NETLOGIC_XLP2XX || | 105 | return chip == PRID_IMP_NETLOGIC_XLP2XX || |
101 | chip == PRID_IMP_NETLOGIC_XLP9XX; | 106 | chip == PRID_IMP_NETLOGIC_XLP9XX || |
107 | chip == PRID_IMP_NETLOGIC_XLP5XX; | ||
102 | } | 108 | } |
103 | 109 | ||
104 | static inline int cpu_is_xlp9xx(void) | 110 | static inline int cpu_is_xlp9xx(void) |
105 | { | 111 | { |
106 | int chip = read_c0_prid() & 0xff00; | 112 | int chip = read_c0_prid() & PRID_IMP_MASK; |
107 | 113 | ||
108 | return chip == PRID_IMP_NETLOGIC_XLP9XX; | 114 | return chip == PRID_IMP_NETLOGIC_XLP9XX || |
115 | chip == PRID_IMP_NETLOGIC_XLP5XX; | ||
109 | } | 116 | } |
110 | #endif /* !__ASSEMBLY__ */ | 117 | #endif /* !__ASSEMBLY__ */ |
111 | #endif /* _ASM_NLM_XLP_H */ | 118 | #endif /* _ASM_NLM_XLP_H */ |
diff --git a/arch/mips/include/asm/nile4.h b/arch/mips/include/asm/nile4.h index 2e2436d0e94e..99e97f8bfbca 100644 --- a/arch/mips/include/asm/nile4.h +++ b/arch/mips/include/asm/nile4.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * asm-mips/nile4.h -- NEC Vrc-5074 Nile 4 definitions | 2 | * asm-mips/nile4.h -- NEC Vrc-5074 Nile 4 definitions |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com> | 4 | * Copyright (C) 2000 Geert Uytterhoeven <geert@linux-m68k.org> |
5 | * Sony Software Development Center Europe (SDCE), Brussels | 5 | * Sony Software Development Center Europe (SDCE), Brussels |
6 | * | 6 | * |
7 | * This file is based on the following documentation: | 7 | * This file is based on the following documentation: |
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h index f5d77b91537f..d781f9e66884 100644 --- a/arch/mips/include/asm/octeon/octeon.h +++ b/arch/mips/include/asm/octeon/octeon.h | |||
@@ -211,7 +211,6 @@ union octeon_cvmemctl { | |||
211 | 211 | ||
212 | extern void octeon_write_lcd(const char *s); | 212 | extern void octeon_write_lcd(const char *s); |
213 | extern void octeon_check_cpu_bist(void); | 213 | extern void octeon_check_cpu_bist(void); |
214 | extern int octeon_get_boot_debug_flag(void); | ||
215 | extern int octeon_get_boot_uart(void); | 214 | extern int octeon_get_boot_uart(void); |
216 | 215 | ||
217 | struct uart_port; | 216 | struct uart_port; |
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 008324d1c261..539ddd148bbb 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
@@ -32,6 +32,8 @@ struct vm_area_struct; | |||
32 | _page_cachable_default) | 32 | _page_cachable_default) |
33 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ | 33 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ |
34 | _PAGE_GLOBAL | _page_cachable_default) | 34 | _PAGE_GLOBAL | _page_cachable_default) |
35 | #define PAGE_KERNEL_NC __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ | ||
36 | _PAGE_GLOBAL | _CACHE_CACHABLE_NONCOHERENT) | ||
35 | #define PAGE_USERIO __pgprot(_PAGE_PRESENT | (cpu_has_rixi ? 0 : _PAGE_READ) | _PAGE_WRITE | \ | 37 | #define PAGE_USERIO __pgprot(_PAGE_PRESENT | (cpu_has_rixi ? 0 : _PAGE_READ) | _PAGE_WRITE | \ |
36 | _page_cachable_default) | 38 | _page_cachable_default) |
37 | #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \ | 39 | #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \ |
diff --git a/arch/mips/include/asm/pm-cps.h b/arch/mips/include/asm/pm-cps.h new file mode 100644 index 000000000000..625eda53d571 --- /dev/null +++ b/arch/mips/include/asm/pm-cps.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Imagination Technologies | ||
3 | * Author: Paul Burton <paul.burton@imgtec.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | */ | ||
10 | |||
11 | #ifndef __MIPS_ASM_PM_CPS_H__ | ||
12 | #define __MIPS_ASM_PM_CPS_H__ | ||
13 | |||
14 | /* | ||
15 | * The CM & CPC can only handle coherence & power control on a per-core basis, | ||
16 | * thus in an MT system the VPEs within each core are coupled and can only | ||
17 | * enter or exit states requiring CM or CPC assistance in unison. | ||
18 | */ | ||
19 | #ifdef CONFIG_MIPS_MT | ||
20 | # define coupled_coherence cpu_has_mipsmt | ||
21 | #else | ||
22 | # define coupled_coherence 0 | ||
23 | #endif | ||
24 | |||
25 | /* Enumeration of possible PM states */ | ||
26 | enum cps_pm_state { | ||
27 | CPS_PM_NC_WAIT, /* MIPS wait instruction, non-coherent */ | ||
28 | CPS_PM_CLOCK_GATED, /* Core clock gated */ | ||
29 | CPS_PM_POWER_GATED, /* Core power gated */ | ||
30 | CPS_PM_STATE_COUNT, | ||
31 | }; | ||
32 | |||
33 | /** | ||
34 | * cps_pm_support_state - determine whether the system supports a PM state | ||
35 | * @state: the state to test for support | ||
36 | * | ||
37 | * Returns true if the system supports the given state, otherwise false. | ||
38 | */ | ||
39 | extern bool cps_pm_support_state(enum cps_pm_state state); | ||
40 | |||
41 | /** | ||
42 | * cps_pm_enter_state - enter a PM state | ||
43 | * @state: the state to enter | ||
44 | * | ||
45 | * Enter the given PM state. If coupled_coherence is non-zero then it is | ||
46 | * expected that this function be called at approximately the same time on | ||
47 | * each coupled CPU. Returns 0 on successful entry & exit, otherwise -errno. | ||
48 | */ | ||
49 | extern int cps_pm_enter_state(enum cps_pm_state state); | ||
50 | |||
51 | #endif /* __MIPS_ASM_PM_CPS_H__ */ | ||
diff --git a/arch/mips/include/asm/pm.h b/arch/mips/include/asm/pm.h new file mode 100644 index 000000000000..7c03469e043f --- /dev/null +++ b/arch/mips/include/asm/pm.h | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014 Imagination Technologies Ltd | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * PM helper macros for CPU power off (e.g. Suspend-to-RAM). | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_PM_H | ||
13 | #define __ASM_PM_H | ||
14 | |||
15 | #ifdef __ASSEMBLY__ | ||
16 | |||
17 | #include <asm/asm-offsets.h> | ||
18 | #include <asm/asm.h> | ||
19 | #include <asm/mipsregs.h> | ||
20 | #include <asm/regdef.h> | ||
21 | |||
22 | /* Save CPU state to stack for suspend to RAM */ | ||
23 | .macro SUSPEND_SAVE_REGS | ||
24 | subu sp, PT_SIZE | ||
25 | /* Call preserved GPRs */ | ||
26 | LONG_S $16, PT_R16(sp) | ||
27 | LONG_S $17, PT_R17(sp) | ||
28 | LONG_S $18, PT_R18(sp) | ||
29 | LONG_S $19, PT_R19(sp) | ||
30 | LONG_S $20, PT_R20(sp) | ||
31 | LONG_S $21, PT_R21(sp) | ||
32 | LONG_S $22, PT_R22(sp) | ||
33 | LONG_S $23, PT_R23(sp) | ||
34 | LONG_S $28, PT_R28(sp) | ||
35 | LONG_S $30, PT_R30(sp) | ||
36 | LONG_S $31, PT_R31(sp) | ||
37 | /* A couple of CP0 registers with space in pt_regs */ | ||
38 | mfc0 k0, CP0_STATUS | ||
39 | LONG_S k0, PT_STATUS(sp) | ||
40 | .endm | ||
41 | |||
42 | /* Restore CPU state from stack after resume from RAM */ | ||
43 | .macro RESUME_RESTORE_REGS_RETURN | ||
44 | .set push | ||
45 | .set noreorder | ||
46 | /* A couple of CP0 registers with space in pt_regs */ | ||
47 | LONG_L k0, PT_STATUS(sp) | ||
48 | mtc0 k0, CP0_STATUS | ||
49 | /* Call preserved GPRs */ | ||
50 | LONG_L $16, PT_R16(sp) | ||
51 | LONG_L $17, PT_R17(sp) | ||
52 | LONG_L $18, PT_R18(sp) | ||
53 | LONG_L $19, PT_R19(sp) | ||
54 | LONG_L $20, PT_R20(sp) | ||
55 | LONG_L $21, PT_R21(sp) | ||
56 | LONG_L $22, PT_R22(sp) | ||
57 | LONG_L $23, PT_R23(sp) | ||
58 | LONG_L $28, PT_R28(sp) | ||
59 | LONG_L $30, PT_R30(sp) | ||
60 | LONG_L $31, PT_R31(sp) | ||
61 | /* Pop and return */ | ||
62 | jr ra | ||
63 | addiu sp, PT_SIZE | ||
64 | .set pop | ||
65 | .endm | ||
66 | |||
67 | /* Get address of static suspend state into t1 */ | ||
68 | .macro LA_STATIC_SUSPEND | ||
69 | la t1, mips_static_suspend_state | ||
70 | .endm | ||
71 | |||
72 | /* Save important CPU state for early restoration to global data */ | ||
73 | .macro SUSPEND_SAVE_STATIC | ||
74 | #ifdef CONFIG_EVA | ||
75 | /* | ||
76 | * Segment configuration is saved in global data where it can be easily | ||
77 | * reloaded without depending on the segment configuration. | ||
78 | */ | ||
79 | mfc0 k0, CP0_PAGEMASK, 2 /* SegCtl0 */ | ||
80 | LONG_S k0, SSS_SEGCTL0(t1) | ||
81 | mfc0 k0, CP0_PAGEMASK, 3 /* SegCtl1 */ | ||
82 | LONG_S k0, SSS_SEGCTL1(t1) | ||
83 | mfc0 k0, CP0_PAGEMASK, 4 /* SegCtl2 */ | ||
84 | LONG_S k0, SSS_SEGCTL2(t1) | ||
85 | #endif | ||
86 | /* save stack pointer (pointing to GPRs) */ | ||
87 | LONG_S sp, SSS_SP(t1) | ||
88 | .endm | ||
89 | |||
90 | /* Restore important CPU state early from global data */ | ||
91 | .macro RESUME_RESTORE_STATIC | ||
92 | #ifdef CONFIG_EVA | ||
93 | /* | ||
94 | * Segment configuration must be restored prior to any access to | ||
95 | * allocated memory, as it may reside outside of the legacy kernel | ||
96 | * segments. | ||
97 | */ | ||
98 | LONG_L k0, SSS_SEGCTL0(t1) | ||
99 | mtc0 k0, CP0_PAGEMASK, 2 /* SegCtl0 */ | ||
100 | LONG_L k0, SSS_SEGCTL1(t1) | ||
101 | mtc0 k0, CP0_PAGEMASK, 3 /* SegCtl1 */ | ||
102 | LONG_L k0, SSS_SEGCTL2(t1) | ||
103 | mtc0 k0, CP0_PAGEMASK, 4 /* SegCtl2 */ | ||
104 | tlbw_use_hazard | ||
105 | #endif | ||
106 | /* restore stack pointer (pointing to GPRs) */ | ||
107 | LONG_L sp, SSS_SP(t1) | ||
108 | .endm | ||
109 | |||
110 | /* flush caches to make sure context has reached memory */ | ||
111 | .macro SUSPEND_CACHE_FLUSH | ||
112 | .extern __wback_cache_all | ||
113 | .set push | ||
114 | .set noreorder | ||
115 | la t1, __wback_cache_all | ||
116 | LONG_L t0, 0(t1) | ||
117 | jalr t0 | ||
118 | nop | ||
119 | .set pop | ||
120 | .endm | ||
121 | |||
122 | /* Save suspend state and flush data caches to RAM */ | ||
123 | .macro SUSPEND_SAVE | ||
124 | SUSPEND_SAVE_REGS | ||
125 | LA_STATIC_SUSPEND | ||
126 | SUSPEND_SAVE_STATIC | ||
127 | SUSPEND_CACHE_FLUSH | ||
128 | .endm | ||
129 | |||
130 | /* Restore saved state after resume from RAM and return */ | ||
131 | .macro RESUME_RESTORE_RETURN | ||
132 | LA_STATIC_SUSPEND | ||
133 | RESUME_RESTORE_STATIC | ||
134 | RESUME_RESTORE_REGS_RETURN | ||
135 | .endm | ||
136 | |||
137 | #else /* __ASSEMBLY__ */ | ||
138 | |||
139 | /** | ||
140 | * struct mips_static_suspend_state - Core saved CPU state across S2R. | ||
141 | * @segctl: CP0 Segment control registers. | ||
142 | * @sp: Stack frame where GP register context is saved. | ||
143 | * | ||
144 | * This structure contains minimal CPU state that must be saved in static kernel | ||
145 | * data in order to be able to restore the rest of the state. This includes | ||
146 | * segmentation configuration in the case of EVA being enabled, as they must be | ||
147 | * restored prior to any kmalloc'd memory being referenced (even the stack | ||
148 | * pointer). | ||
149 | */ | ||
150 | struct mips_static_suspend_state { | ||
151 | #ifdef CONFIG_EVA | ||
152 | unsigned long segctl[3]; | ||
153 | #endif | ||
154 | unsigned long sp; | ||
155 | }; | ||
156 | |||
157 | #endif /* !__ASSEMBLY__ */ | ||
158 | |||
159 | #endif /* __ASM_PM_HELPERS_H */ | ||
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h index bf1ac8d35783..7e6e682aece3 100644 --- a/arch/mips/include/asm/ptrace.h +++ b/arch/mips/include/asm/ptrace.h | |||
@@ -39,9 +39,6 @@ struct pt_regs { | |||
39 | unsigned long cp0_badvaddr; | 39 | unsigned long cp0_badvaddr; |
40 | unsigned long cp0_cause; | 40 | unsigned long cp0_cause; |
41 | unsigned long cp0_epc; | 41 | unsigned long cp0_epc; |
42 | #ifdef CONFIG_MIPS_MT_SMTC | ||
43 | unsigned long cp0_tcstatus; | ||
44 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
45 | #ifdef CONFIG_CPU_CAVIUM_OCTEON | 42 | #ifdef CONFIG_CPU_CAVIUM_OCTEON |
46 | unsigned long long mpl[3]; /* MTM{0,1,2} */ | 43 | unsigned long long mpl[3]; /* MTM{0,1,2} */ |
47 | unsigned long long mtp[3]; /* MTP{0,1,2} */ | 44 | unsigned long long mtp[3]; /* MTP{0,1,2} */ |
diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kcache.h index ca64cbe44493..0b8bd28a0df1 100644 --- a/arch/mips/include/asm/r4kcache.h +++ b/arch/mips/include/asm/r4kcache.h | |||
@@ -43,11 +43,10 @@ | |||
43 | : "i" (op), "R" (*(unsigned char *)(addr))) | 43 | : "i" (op), "R" (*(unsigned char *)(addr))) |
44 | 44 | ||
45 | #ifdef CONFIG_MIPS_MT | 45 | #ifdef CONFIG_MIPS_MT |
46 | |||
46 | /* | 47 | /* |
47 | * Temporary hacks for SMTC debug. Optionally force single-threaded | 48 | * Optionally force single-threaded execution during I-cache flushes. |
48 | * execution during I-cache flushes. | ||
49 | */ | 49 | */ |
50 | |||
51 | #define PROTECT_CACHE_FLUSHES 1 | 50 | #define PROTECT_CACHE_FLUSHES 1 |
52 | 51 | ||
53 | #ifdef PROTECT_CACHE_FLUSHES | 52 | #ifdef PROTECT_CACHE_FLUSHES |
@@ -524,6 +523,8 @@ __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32, | |||
524 | __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, ) | 523 | __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, ) |
525 | __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, ) | 524 | __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, ) |
526 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64, ) | 525 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64, ) |
526 | __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 128, ) | ||
527 | __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 128, ) | ||
527 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, ) | 528 | __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, ) |
528 | 529 | ||
529 | __BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, ) | 530 | __BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, ) |
diff --git a/arch/mips/include/asm/sgi/ip22.h b/arch/mips/include/asm/sgi/ip22.h index 8db1a3588cf2..87ec9eaa04e3 100644 --- a/arch/mips/include/asm/sgi/ip22.h +++ b/arch/mips/include/asm/sgi/ip22.h | |||
@@ -69,6 +69,8 @@ | |||
69 | #define SGI_EISA_IRQ SGINT_LOCAL2 + 3 /* EISA interrupts */ | 69 | #define SGI_EISA_IRQ SGINT_LOCAL2 + 3 /* EISA interrupts */ |
70 | #define SGI_KEYBD_IRQ SGINT_LOCAL2 + 4 /* keyboard */ | 70 | #define SGI_KEYBD_IRQ SGINT_LOCAL2 + 4 /* keyboard */ |
71 | #define SGI_SERIAL_IRQ SGINT_LOCAL2 + 5 /* onboard serial */ | 71 | #define SGI_SERIAL_IRQ SGINT_LOCAL2 + 5 /* onboard serial */ |
72 | #define SGI_GIOEXP0_IRQ (SGINT_LOCAL2 + 6) /* Indy GIO EXP0 */ | ||
73 | #define SGI_GIOEXP1_IRQ (SGINT_LOCAL2 + 7) /* Indy GIO EXP1 */ | ||
72 | 74 | ||
73 | #define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE) | 75 | #define ip22_is_fullhouse() (sgioc->sysid & SGIOC_SYSID_FULLHOUSE) |
74 | 76 | ||
diff --git a/arch/mips/include/asm/smp-cps.h b/arch/mips/include/asm/smp-cps.h index d60d1a2180d1..a06a08a9afc6 100644 --- a/arch/mips/include/asm/smp-cps.h +++ b/arch/mips/include/asm/smp-cps.h | |||
@@ -13,17 +13,28 @@ | |||
13 | 13 | ||
14 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
15 | 15 | ||
16 | struct boot_config { | 16 | struct vpe_boot_config { |
17 | unsigned int core; | ||
18 | unsigned int vpe; | ||
19 | unsigned long pc; | 17 | unsigned long pc; |
20 | unsigned long sp; | 18 | unsigned long sp; |
21 | unsigned long gp; | 19 | unsigned long gp; |
22 | }; | 20 | }; |
23 | 21 | ||
24 | extern struct boot_config mips_cps_bootcfg; | 22 | struct core_boot_config { |
23 | atomic_t vpe_mask; | ||
24 | struct vpe_boot_config *vpe_config; | ||
25 | }; | ||
26 | |||
27 | extern struct core_boot_config *mips_cps_core_bootcfg; | ||
25 | 28 | ||
26 | extern void mips_cps_core_entry(void); | 29 | extern void mips_cps_core_entry(void); |
30 | extern void mips_cps_core_init(void); | ||
31 | |||
32 | extern struct vpe_boot_config *mips_cps_boot_vpes(void); | ||
33 | |||
34 | extern bool mips_cps_smp_in_use(void); | ||
35 | |||
36 | extern void mips_cps_pm_save(void); | ||
37 | extern void mips_cps_pm_restore(void); | ||
27 | 38 | ||
28 | #else /* __ASSEMBLY__ */ | 39 | #else /* __ASSEMBLY__ */ |
29 | 40 | ||
diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h index 73d35b18fb64..6ba1fb8b11e2 100644 --- a/arch/mips/include/asm/smp-ops.h +++ b/arch/mips/include/asm/smp-ops.h | |||
@@ -26,7 +26,6 @@ struct plat_smp_ops { | |||
26 | void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action); | 26 | void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action); |
27 | void (*init_secondary)(void); | 27 | void (*init_secondary)(void); |
28 | void (*smp_finish)(void); | 28 | void (*smp_finish)(void); |
29 | void (*cpus_done)(void); | ||
30 | void (*boot_secondary)(int cpu, struct task_struct *idle); | 29 | void (*boot_secondary)(int cpu, struct task_struct *idle); |
31 | void (*smp_setup)(void); | 30 | void (*smp_setup)(void); |
32 | void (*prepare_cpus)(unsigned int max_cpus); | 31 | void (*prepare_cpus)(unsigned int max_cpus); |
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index efa02acd3dd5..b037334fca22 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
@@ -46,6 +46,9 @@ extern int __cpu_logical_map[NR_CPUS]; | |||
46 | 46 | ||
47 | extern volatile cpumask_t cpu_callin_map; | 47 | extern volatile cpumask_t cpu_callin_map; |
48 | 48 | ||
49 | /* Mask of CPUs which are currently definitely operating coherently */ | ||
50 | extern cpumask_t cpu_coherent_mask; | ||
51 | |||
49 | extern void asmlinkage smp_bootstrap(void); | 52 | extern void asmlinkage smp_bootstrap(void); |
50 | 53 | ||
51 | /* | 54 | /* |
diff --git a/arch/mips/include/asm/smtc.h b/arch/mips/include/asm/smtc.h deleted file mode 100644 index e56b439b7871..000000000000 --- a/arch/mips/include/asm/smtc.h +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | #ifndef _ASM_SMTC_MT_H | ||
2 | #define _ASM_SMTC_MT_H | ||
3 | |||
4 | /* | ||
5 | * Definitions for SMTC multitasking on MIPS MT cores | ||
6 | */ | ||
7 | |||
8 | #include <asm/mips_mt.h> | ||
9 | #include <asm/smtc_ipi.h> | ||
10 | |||
11 | /* | ||
12 | * System-wide SMTC status information | ||
13 | */ | ||
14 | |||
15 | extern unsigned int smtc_status; | ||
16 | |||
17 | #define SMTC_TLB_SHARED 0x00000001 | ||
18 | #define SMTC_MTC_ACTIVE 0x00000002 | ||
19 | |||
20 | /* | ||
21 | * TLB/ASID Management information | ||
22 | */ | ||
23 | |||
24 | #define MAX_SMTC_TLBS 2 | ||
25 | #define MAX_SMTC_ASIDS 256 | ||
26 | #if NR_CPUS <= 8 | ||
27 | typedef char asiduse; | ||
28 | #else | ||
29 | #if NR_CPUS <= 16 | ||
30 | typedef short asiduse; | ||
31 | #else | ||
32 | typedef long asiduse; | ||
33 | #endif | ||
34 | #endif | ||
35 | |||
36 | /* | ||
37 | * VPE Management information | ||
38 | */ | ||
39 | |||
40 | #define MAX_SMTC_VPES MAX_SMTC_TLBS /* FIXME: May not always be true. */ | ||
41 | |||
42 | extern asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; | ||
43 | |||
44 | struct mm_struct; | ||
45 | struct task_struct; | ||
46 | |||
47 | void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu); | ||
48 | void self_ipi(struct smtc_ipi *); | ||
49 | void smtc_flush_tlb_asid(unsigned long asid); | ||
50 | extern int smtc_build_cpu_map(int startslot); | ||
51 | extern void smtc_prepare_cpus(int cpus); | ||
52 | extern void smtc_smp_finish(void); | ||
53 | extern void smtc_boot_secondary(int cpu, struct task_struct *t); | ||
54 | extern void smtc_cpus_done(void); | ||
55 | extern void smtc_init_secondary(void); | ||
56 | |||
57 | |||
58 | /* | ||
59 | * Sharing the TLB between multiple VPEs means that the | ||
60 | * "random" index selection function is not allowed to | ||
61 | * select the current value of the Index register. To | ||
62 | * avoid additional TLB pressure, the Index registers | ||
63 | * are "parked" with an non-Valid value. | ||
64 | */ | ||
65 | |||
66 | #define PARKED_INDEX ((unsigned int)0x80000000) | ||
67 | |||
68 | /* | ||
69 | * Define low-level interrupt mask for IPIs, if necessary. | ||
70 | * By default, use SW interrupt 1, which requires no external | ||
71 | * hardware support, but which works only for single-core | ||
72 | * MIPS MT systems. | ||
73 | */ | ||
74 | #ifndef MIPS_CPU_IPI_IRQ | ||
75 | #define MIPS_CPU_IPI_IRQ 1 | ||
76 | #endif | ||
77 | |||
78 | #endif /* _ASM_SMTC_MT_H */ | ||
diff --git a/arch/mips/include/asm/smtc_ipi.h b/arch/mips/include/asm/smtc_ipi.h deleted file mode 100644 index 15278dbd7e79..000000000000 --- a/arch/mips/include/asm/smtc_ipi.h +++ /dev/null | |||
@@ -1,129 +0,0 @@ | |||
1 | /* | ||
2 | * Definitions used in MIPS MT SMTC "Interprocessor Interrupt" code. | ||
3 | */ | ||
4 | #ifndef __ASM_SMTC_IPI_H | ||
5 | #define __ASM_SMTC_IPI_H | ||
6 | |||
7 | #include <linux/spinlock.h> | ||
8 | |||
9 | //#define SMTC_IPI_DEBUG | ||
10 | |||
11 | #ifdef SMTC_IPI_DEBUG | ||
12 | #include <asm/mipsregs.h> | ||
13 | #include <asm/mipsmtregs.h> | ||
14 | #endif /* SMTC_IPI_DEBUG */ | ||
15 | |||
16 | /* | ||
17 | * An IPI "message" | ||
18 | */ | ||
19 | |||
20 | struct smtc_ipi { | ||
21 | struct smtc_ipi *flink; | ||
22 | int type; | ||
23 | void *arg; | ||
24 | int dest; | ||
25 | #ifdef SMTC_IPI_DEBUG | ||
26 | int sender; | ||
27 | long stamp; | ||
28 | #endif /* SMTC_IPI_DEBUG */ | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * Defined IPI Types | ||
33 | */ | ||
34 | |||
35 | #define LINUX_SMP_IPI 1 | ||
36 | #define SMTC_CLOCK_TICK 2 | ||
37 | #define IRQ_AFFINITY_IPI 3 | ||
38 | |||
39 | /* | ||
40 | * A queue of IPI messages | ||
41 | */ | ||
42 | |||
43 | struct smtc_ipi_q { | ||
44 | struct smtc_ipi *head; | ||
45 | spinlock_t lock; | ||
46 | struct smtc_ipi *tail; | ||
47 | int depth; | ||
48 | int resched_flag; /* reschedule already queued */ | ||
49 | }; | ||
50 | |||
51 | static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p) | ||
52 | { | ||
53 | unsigned long flags; | ||
54 | |||
55 | spin_lock_irqsave(&q->lock, flags); | ||
56 | if (q->head == NULL) | ||
57 | q->head = q->tail = p; | ||
58 | else | ||
59 | q->tail->flink = p; | ||
60 | p->flink = NULL; | ||
61 | q->tail = p; | ||
62 | q->depth++; | ||
63 | #ifdef SMTC_IPI_DEBUG | ||
64 | p->sender = read_c0_tcbind(); | ||
65 | p->stamp = read_c0_count(); | ||
66 | #endif /* SMTC_IPI_DEBUG */ | ||
67 | spin_unlock_irqrestore(&q->lock, flags); | ||
68 | } | ||
69 | |||
70 | static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q) | ||
71 | { | ||
72 | struct smtc_ipi *p; | ||
73 | |||
74 | if (q->head == NULL) | ||
75 | p = NULL; | ||
76 | else { | ||
77 | p = q->head; | ||
78 | q->head = q->head->flink; | ||
79 | q->depth--; | ||
80 | /* Arguably unnecessary, but leaves queue cleaner */ | ||
81 | if (q->head == NULL) | ||
82 | q->tail = NULL; | ||
83 | } | ||
84 | |||
85 | return p; | ||
86 | } | ||
87 | |||
88 | static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q) | ||
89 | { | ||
90 | unsigned long flags; | ||
91 | struct smtc_ipi *p; | ||
92 | |||
93 | spin_lock_irqsave(&q->lock, flags); | ||
94 | p = __smtc_ipi_dq(q); | ||
95 | spin_unlock_irqrestore(&q->lock, flags); | ||
96 | |||
97 | return p; | ||
98 | } | ||
99 | |||
100 | static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p) | ||
101 | { | ||
102 | unsigned long flags; | ||
103 | |||
104 | spin_lock_irqsave(&q->lock, flags); | ||
105 | if (q->head == NULL) { | ||
106 | q->head = q->tail = p; | ||
107 | p->flink = NULL; | ||
108 | } else { | ||
109 | p->flink = q->head; | ||
110 | q->head = p; | ||
111 | } | ||
112 | q->depth++; | ||
113 | spin_unlock_irqrestore(&q->lock, flags); | ||
114 | } | ||
115 | |||
116 | static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q) | ||
117 | { | ||
118 | unsigned long flags; | ||
119 | int retval; | ||
120 | |||
121 | spin_lock_irqsave(&q->lock, flags); | ||
122 | retval = q->depth; | ||
123 | spin_unlock_irqrestore(&q->lock, flags); | ||
124 | return retval; | ||
125 | } | ||
126 | |||
127 | extern void smtc_send_ipi(int cpu, int type, unsigned int action); | ||
128 | |||
129 | #endif /* __ASM_SMTC_IPI_H */ | ||
diff --git a/arch/mips/include/asm/smtc_proc.h b/arch/mips/include/asm/smtc_proc.h deleted file mode 100644 index 25da651f1f5f..000000000000 --- a/arch/mips/include/asm/smtc_proc.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* | ||
2 | * Definitions for SMTC /proc entries | ||
3 | * Copyright(C) 2005 MIPS Technologies Inc. | ||
4 | */ | ||
5 | #ifndef __ASM_SMTC_PROC_H | ||
6 | #define __ASM_SMTC_PROC_H | ||
7 | |||
8 | /* | ||
9 | * per-"CPU" statistics | ||
10 | */ | ||
11 | |||
12 | struct smtc_cpu_proc { | ||
13 | unsigned long timerints; | ||
14 | unsigned long selfipis; | ||
15 | }; | ||
16 | |||
17 | extern struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS]; | ||
18 | |||
19 | /* Count of number of recoveries of "stolen" FPU access rights on 34K */ | ||
20 | |||
21 | extern atomic_t smtc_fpu_recoveries; | ||
22 | |||
23 | #endif /* __ASM_SMTC_PROC_H */ | ||
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h index d301e108d5b8..b188c797565c 100644 --- a/arch/mips/include/asm/stackframe.h +++ b/arch/mips/include/asm/stackframe.h | |||
@@ -19,22 +19,12 @@ | |||
19 | #include <asm/asm-offsets.h> | 19 | #include <asm/asm-offsets.h> |
20 | #include <asm/thread_info.h> | 20 | #include <asm/thread_info.h> |
21 | 21 | ||
22 | /* | 22 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) |
23 | * For SMTC kernel, global IE should be left set, and interrupts | ||
24 | * controlled exclusively via IXMT. | ||
25 | */ | ||
26 | #ifdef CONFIG_MIPS_MT_SMTC | ||
27 | #define STATMASK 0x1e | ||
28 | #elif defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | ||
29 | #define STATMASK 0x3f | 23 | #define STATMASK 0x3f |
30 | #else | 24 | #else |
31 | #define STATMASK 0x1f | 25 | #define STATMASK 0x1f |
32 | #endif | 26 | #endif |
33 | 27 | ||
34 | #ifdef CONFIG_MIPS_MT_SMTC | ||
35 | #include <asm/mipsmtregs.h> | ||
36 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
37 | |||
38 | .macro SAVE_AT | 28 | .macro SAVE_AT |
39 | .set push | 29 | .set push |
40 | .set noat | 30 | .set noat |
@@ -186,16 +176,6 @@ | |||
186 | mfc0 v1, CP0_STATUS | 176 | mfc0 v1, CP0_STATUS |
187 | LONG_S $2, PT_R2(sp) | 177 | LONG_S $2, PT_R2(sp) |
188 | LONG_S v1, PT_STATUS(sp) | 178 | LONG_S v1, PT_STATUS(sp) |
189 | #ifdef CONFIG_MIPS_MT_SMTC | ||
190 | /* | ||
191 | * Ideally, these instructions would be shuffled in | ||
192 | * to cover the pipeline delay. | ||
193 | */ | ||
194 | .set mips32 | ||
195 | mfc0 k0, CP0_TCSTATUS | ||
196 | .set mips0 | ||
197 | LONG_S k0, PT_TCSTATUS(sp) | ||
198 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
199 | LONG_S $4, PT_R4(sp) | 179 | LONG_S $4, PT_R4(sp) |
200 | mfc0 v1, CP0_CAUSE | 180 | mfc0 v1, CP0_CAUSE |
201 | LONG_S $5, PT_R5(sp) | 181 | LONG_S $5, PT_R5(sp) |
@@ -321,36 +301,6 @@ | |||
321 | .set push | 301 | .set push |
322 | .set reorder | 302 | .set reorder |
323 | .set noat | 303 | .set noat |
324 | #ifdef CONFIG_MIPS_MT_SMTC | ||
325 | .set mips32r2 | ||
326 | /* | ||
327 | * We need to make sure the read-modify-write | ||
328 | * of Status below isn't perturbed by an interrupt | ||
329 | * or cross-TC access, so we need to do at least a DMT, | ||
330 | * protected by an interrupt-inhibit. But setting IXMT | ||
331 | * also creates a few-cycle window where an IPI could | ||
332 | * be queued and not be detected before potentially | ||
333 | * returning to a WAIT or user-mode loop. It must be | ||
334 | * replayed. | ||
335 | * | ||
336 | * We're in the middle of a context switch, and | ||
337 | * we can't dispatch it directly without trashing | ||
338 | * some registers, so we'll try to detect this unlikely | ||
339 | * case and program a software interrupt in the VPE, | ||
340 | * as would be done for a cross-VPE IPI. To accommodate | ||
341 | * the handling of that case, we're doing a DVPE instead | ||
342 | * of just a DMT here to protect against other threads. | ||
343 | * This is a lot of cruft to cover a tiny window. | ||
344 | * If you can find a better design, implement it! | ||
345 | * | ||
346 | */ | ||
347 | mfc0 v0, CP0_TCSTATUS | ||
348 | ori v0, TCSTATUS_IXMT | ||
349 | mtc0 v0, CP0_TCSTATUS | ||
350 | _ehb | ||
351 | DVPE 5 # dvpe a1 | ||
352 | jal mips_ihb | ||
353 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
354 | mfc0 a0, CP0_STATUS | 304 | mfc0 a0, CP0_STATUS |
355 | ori a0, STATMASK | 305 | ori a0, STATMASK |
356 | xori a0, STATMASK | 306 | xori a0, STATMASK |
@@ -362,59 +312,6 @@ | |||
362 | and v0, v1 | 312 | and v0, v1 |
363 | or v0, a0 | 313 | or v0, a0 |
364 | mtc0 v0, CP0_STATUS | 314 | mtc0 v0, CP0_STATUS |
365 | #ifdef CONFIG_MIPS_MT_SMTC | ||
366 | /* | ||
367 | * Only after EXL/ERL have been restored to status can we | ||
368 | * restore TCStatus.IXMT. | ||
369 | */ | ||
370 | LONG_L v1, PT_TCSTATUS(sp) | ||
371 | _ehb | ||
372 | mfc0 a0, CP0_TCSTATUS | ||
373 | andi v1, TCSTATUS_IXMT | ||
374 | bnez v1, 0f | ||
375 | |||
376 | /* | ||
377 | * We'd like to detect any IPIs queued in the tiny window | ||
378 | * above and request an software interrupt to service them | ||
379 | * when we ERET. | ||
380 | * | ||
381 | * Computing the offset into the IPIQ array of the executing | ||
382 | * TC's IPI queue in-line would be tedious. We use part of | ||
383 | * the TCContext register to hold 16 bits of offset that we | ||
384 | * can add in-line to find the queue head. | ||
385 | */ | ||
386 | mfc0 v0, CP0_TCCONTEXT | ||
387 | la a2, IPIQ | ||
388 | srl v0, v0, 16 | ||
389 | addu a2, a2, v0 | ||
390 | LONG_L v0, 0(a2) | ||
391 | beqz v0, 0f | ||
392 | /* | ||
393 | * If we have a queue, provoke dispatch within the VPE by setting C_SW1 | ||
394 | */ | ||
395 | mfc0 v0, CP0_CAUSE | ||
396 | ori v0, v0, C_SW1 | ||
397 | mtc0 v0, CP0_CAUSE | ||
398 | 0: | ||
399 | /* | ||
400 | * This test should really never branch but | ||
401 | * let's be prudent here. Having atomized | ||
402 | * the shared register modifications, we can | ||
403 | * now EVPE, and must do so before interrupts | ||
404 | * are potentially re-enabled. | ||
405 | */ | ||
406 | andi a1, a1, MVPCONTROL_EVP | ||
407 | beqz a1, 1f | ||
408 | evpe | ||
409 | 1: | ||
410 | /* We know that TCStatua.IXMT should be set from above */ | ||
411 | xori a0, a0, TCSTATUS_IXMT | ||
412 | or a0, a0, v1 | ||
413 | mtc0 a0, CP0_TCSTATUS | ||
414 | _ehb | ||
415 | |||
416 | .set mips0 | ||
417 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
418 | LONG_L v1, PT_EPC(sp) | 315 | LONG_L v1, PT_EPC(sp) |
419 | MTC0 v1, CP0_EPC | 316 | MTC0 v1, CP0_EPC |
420 | LONG_L $31, PT_R31(sp) | 317 | LONG_L $31, PT_R31(sp) |
@@ -467,33 +364,11 @@ | |||
467 | * Set cp0 enable bit as sign that we're running on the kernel stack | 364 | * Set cp0 enable bit as sign that we're running on the kernel stack |
468 | */ | 365 | */ |
469 | .macro CLI | 366 | .macro CLI |
470 | #if !defined(CONFIG_MIPS_MT_SMTC) | ||
471 | mfc0 t0, CP0_STATUS | 367 | mfc0 t0, CP0_STATUS |
472 | li t1, ST0_CU0 | STATMASK | 368 | li t1, ST0_CU0 | STATMASK |
473 | or t0, t1 | 369 | or t0, t1 |
474 | xori t0, STATMASK | 370 | xori t0, STATMASK |
475 | mtc0 t0, CP0_STATUS | 371 | mtc0 t0, CP0_STATUS |
476 | #else /* CONFIG_MIPS_MT_SMTC */ | ||
477 | /* | ||
478 | * For SMTC, we need to set privilege | ||
479 | * and disable interrupts only for the | ||
480 | * current TC, using the TCStatus register. | ||
481 | */ | ||
482 | mfc0 t0, CP0_TCSTATUS | ||
483 | /* Fortunately CU 0 is in the same place in both registers */ | ||
484 | /* Set TCU0, TMX, TKSU (for later inversion) and IXMT */ | ||
485 | li t1, ST0_CU0 | 0x08001c00 | ||
486 | or t0, t1 | ||
487 | /* Clear TKSU, leave IXMT */ | ||
488 | xori t0, 0x00001800 | ||
489 | mtc0 t0, CP0_TCSTATUS | ||
490 | _ehb | ||
491 | /* We need to leave the global IE bit set, but clear EXL...*/ | ||
492 | mfc0 t0, CP0_STATUS | ||
493 | ori t0, ST0_EXL | ST0_ERL | ||
494 | xori t0, ST0_EXL | ST0_ERL | ||
495 | mtc0 t0, CP0_STATUS | ||
496 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
497 | irq_disable_hazard | 372 | irq_disable_hazard |
498 | .endm | 373 | .endm |
499 | 374 | ||
@@ -502,35 +377,11 @@ | |||
502 | * Set cp0 enable bit as sign that we're running on the kernel stack | 377 | * Set cp0 enable bit as sign that we're running on the kernel stack |
503 | */ | 378 | */ |
504 | .macro STI | 379 | .macro STI |
505 | #if !defined(CONFIG_MIPS_MT_SMTC) | ||
506 | mfc0 t0, CP0_STATUS | 380 | mfc0 t0, CP0_STATUS |
507 | li t1, ST0_CU0 | STATMASK | 381 | li t1, ST0_CU0 | STATMASK |
508 | or t0, t1 | 382 | or t0, t1 |
509 | xori t0, STATMASK & ~1 | 383 | xori t0, STATMASK & ~1 |
510 | mtc0 t0, CP0_STATUS | 384 | mtc0 t0, CP0_STATUS |
511 | #else /* CONFIG_MIPS_MT_SMTC */ | ||
512 | /* | ||
513 | * For SMTC, we need to set privilege | ||
514 | * and enable interrupts only for the | ||
515 | * current TC, using the TCStatus register. | ||
516 | */ | ||
517 | _ehb | ||
518 | mfc0 t0, CP0_TCSTATUS | ||
519 | /* Fortunately CU 0 is in the same place in both registers */ | ||
520 | /* Set TCU0, TKSU (for later inversion) and IXMT */ | ||
521 | li t1, ST0_CU0 | 0x08001c00 | ||
522 | or t0, t1 | ||
523 | /* Clear TKSU *and* IXMT */ | ||
524 | xori t0, 0x00001c00 | ||
525 | mtc0 t0, CP0_TCSTATUS | ||
526 | _ehb | ||
527 | /* We need to leave the global IE bit set, but clear EXL...*/ | ||
528 | mfc0 t0, CP0_STATUS | ||
529 | ori t0, ST0_EXL | ||
530 | xori t0, ST0_EXL | ||
531 | mtc0 t0, CP0_STATUS | ||
532 | /* irq_enable_hazard below should expand to EHB for 24K/34K cpus */ | ||
533 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
534 | irq_enable_hazard | 385 | irq_enable_hazard |
535 | .endm | 386 | .endm |
536 | 387 | ||
@@ -540,32 +391,6 @@ | |||
540 | * Set cp0 enable bit as sign that we're running on the kernel stack | 391 | * Set cp0 enable bit as sign that we're running on the kernel stack |
541 | */ | 392 | */ |
542 | .macro KMODE | 393 | .macro KMODE |
543 | #ifdef CONFIG_MIPS_MT_SMTC | ||
544 | /* | ||
545 | * This gets baroque in SMTC. We want to | ||
546 | * protect the non-atomic clearing of EXL | ||
547 | * with DMT/EMT, but we don't want to take | ||
548 | * an interrupt while DMT is still in effect. | ||
549 | */ | ||
550 | |||
551 | /* KMODE gets invoked from both reorder and noreorder code */ | ||
552 | .set push | ||
553 | .set mips32r2 | ||
554 | .set noreorder | ||
555 | mfc0 v0, CP0_TCSTATUS | ||
556 | andi v1, v0, TCSTATUS_IXMT | ||
557 | ori v0, TCSTATUS_IXMT | ||
558 | mtc0 v0, CP0_TCSTATUS | ||
559 | _ehb | ||
560 | DMT 2 # dmt v0 | ||
561 | /* | ||
562 | * We don't know a priori if ra is "live" | ||
563 | */ | ||
564 | move t0, ra | ||
565 | jal mips_ihb | ||
566 | nop /* delay slot */ | ||
567 | move ra, t0 | ||
568 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
569 | mfc0 t0, CP0_STATUS | 394 | mfc0 t0, CP0_STATUS |
570 | li t1, ST0_CU0 | (STATMASK & ~1) | 395 | li t1, ST0_CU0 | (STATMASK & ~1) |
571 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | 396 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) |
@@ -576,25 +401,6 @@ | |||
576 | or t0, t1 | 401 | or t0, t1 |
577 | xori t0, STATMASK & ~1 | 402 | xori t0, STATMASK & ~1 |
578 | mtc0 t0, CP0_STATUS | 403 | mtc0 t0, CP0_STATUS |
579 | #ifdef CONFIG_MIPS_MT_SMTC | ||
580 | _ehb | ||
581 | andi v0, v0, VPECONTROL_TE | ||
582 | beqz v0, 2f | ||
583 | nop /* delay slot */ | ||
584 | emt | ||
585 | 2: | ||
586 | mfc0 v0, CP0_TCSTATUS | ||
587 | /* Clear IXMT, then OR in previous value */ | ||
588 | ori v0, TCSTATUS_IXMT | ||
589 | xori v0, TCSTATUS_IXMT | ||
590 | or v0, v1, v0 | ||
591 | mtc0 v0, CP0_TCSTATUS | ||
592 | /* | ||
593 | * irq_disable_hazard below should expand to EHB | ||
594 | * on 24K/34K CPUS | ||
595 | */ | ||
596 | .set pop | ||
597 | #endif /* CONFIG_MIPS_MT_SMTC */ | ||
598 | irq_disable_hazard | 404 | irq_disable_hazard |
599 | .endm | 405 | .endm |
600 | 406 | ||
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index d2d961d6cb86..7de865805deb 100644 --- a/arch/mips/include/asm/thread_info.h +++ b/arch/mips/include/asm/thread_info.h | |||
@@ -159,11 +159,7 @@ static inline struct thread_info *current_thread_info(void) | |||
159 | * We stash processor id into a COP0 register to retrieve it fast | 159 | * We stash processor id into a COP0 register to retrieve it fast |
160 | * at kernel exception entry. | 160 | * at kernel exception entry. |
161 | */ | 161 | */ |
162 | #if defined(CONFIG_MIPS_MT_SMTC) | 162 | #if defined(CONFIG_MIPS_PGD_C0_CONTEXT) |
163 | #define SMP_CPUID_REG 2, 2 /* TCBIND */ | ||
164 | #define ASM_SMP_CPUID_REG $2, 2 | ||
165 | #define SMP_CPUID_PTRSHIFT 19 | ||
166 | #elif defined(CONFIG_MIPS_PGD_C0_CONTEXT) | ||
167 | #define SMP_CPUID_REG 20, 0 /* XCONTEXT */ | 163 | #define SMP_CPUID_REG 20, 0 /* XCONTEXT */ |
168 | #define ASM_SMP_CPUID_REG $20 | 164 | #define ASM_SMP_CPUID_REG $20 |
169 | #define SMP_CPUID_PTRSHIFT 48 | 165 | #define SMP_CPUID_PTRSHIFT 48 |
@@ -179,13 +175,8 @@ static inline struct thread_info *current_thread_info(void) | |||
179 | #define SMP_CPUID_REGSHIFT (SMP_CPUID_PTRSHIFT + 2) | 175 | #define SMP_CPUID_REGSHIFT (SMP_CPUID_PTRSHIFT + 2) |
180 | #endif | 176 | #endif |
181 | 177 | ||
182 | #ifdef CONFIG_MIPS_MT_SMTC | ||
183 | #define ASM_CPUID_MFC0 mfc0 | ||
184 | #define UASM_i_CPUID_MFC0 uasm_i_mfc0 | ||
185 | #else | ||
186 | #define ASM_CPUID_MFC0 MFC0 | 178 | #define ASM_CPUID_MFC0 MFC0 |
187 | #define UASM_i_CPUID_MFC0 UASM_i_MFC0 | 179 | #define UASM_i_CPUID_MFC0 UASM_i_MFC0 |
188 | #endif | ||
189 | 180 | ||
190 | #endif /* __KERNEL__ */ | 181 | #endif /* __KERNEL__ */ |
191 | #endif /* _ASM_THREAD_INFO_H */ | 182 | #endif /* _ASM_THREAD_INFO_H */ |
diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h index 24f534a7fbc3..8f3047d611ee 100644 --- a/arch/mips/include/asm/time.h +++ b/arch/mips/include/asm/time.h | |||
@@ -52,14 +52,11 @@ extern int (*perf_irq)(void); | |||
52 | */ | 52 | */ |
53 | extern unsigned int __weak get_c0_compare_int(void); | 53 | extern unsigned int __weak get_c0_compare_int(void); |
54 | extern int r4k_clockevent_init(void); | 54 | extern int r4k_clockevent_init(void); |
55 | extern int smtc_clockevent_init(void); | ||
56 | extern int gic_clockevent_init(void); | 55 | extern int gic_clockevent_init(void); |
57 | 56 | ||
58 | static inline int mips_clockevent_init(void) | 57 | static inline int mips_clockevent_init(void) |
59 | { | 58 | { |
60 | #ifdef CONFIG_MIPS_MT_SMTC | 59 | #if defined(CONFIG_CEVT_GIC) |
61 | return smtc_clockevent_init(); | ||
62 | #elif defined(CONFIG_CEVT_GIC) | ||
63 | return (gic_clockevent_init() | r4k_clockevent_init()); | 60 | return (gic_clockevent_init() | r4k_clockevent_init()); |
64 | #elif defined(CONFIG_CEVT_R4K) | 61 | #elif defined(CONFIG_CEVT_R4K) |
65 | return r4k_clockevent_init(); | 62 | return r4k_clockevent_init(); |
diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h index c5424757da65..b05bb70a2e46 100644 --- a/arch/mips/include/asm/timex.h +++ b/arch/mips/include/asm/timex.h | |||
@@ -4,12 +4,16 @@ | |||
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 1998, 1999, 2003 by Ralf Baechle | 6 | * Copyright (C) 1998, 1999, 2003 by Ralf Baechle |
7 | * Copyright (C) 2014 by Maciej W. Rozycki | ||
7 | */ | 8 | */ |
8 | #ifndef _ASM_TIMEX_H | 9 | #ifndef _ASM_TIMEX_H |
9 | #define _ASM_TIMEX_H | 10 | #define _ASM_TIMEX_H |
10 | 11 | ||
11 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
12 | 13 | ||
14 | #include <linux/compiler.h> | ||
15 | |||
16 | #include <asm/cpu.h> | ||
13 | #include <asm/cpu-features.h> | 17 | #include <asm/cpu-features.h> |
14 | #include <asm/mipsregs.h> | 18 | #include <asm/mipsregs.h> |
15 | #include <asm/cpu-type.h> | 19 | #include <asm/cpu-type.h> |
@@ -45,29 +49,54 @@ typedef unsigned int cycles_t; | |||
45 | * However for now the implementaton of this function doesn't get these | 49 | * However for now the implementaton of this function doesn't get these |
46 | * fine details right. | 50 | * fine details right. |
47 | */ | 51 | */ |
48 | static inline cycles_t get_cycles(void) | 52 | static inline int can_use_mips_counter(unsigned int prid) |
49 | { | 53 | { |
50 | switch (boot_cpu_type()) { | 54 | int comp = (prid & PRID_COMP_MASK) != PRID_COMP_LEGACY; |
51 | case CPU_R4400PC: | ||
52 | case CPU_R4400SC: | ||
53 | case CPU_R4400MC: | ||
54 | if ((read_c0_prid() & 0xff) >= 0x0050) | ||
55 | return read_c0_count(); | ||
56 | break; | ||
57 | 55 | ||
58 | case CPU_R4000PC: | 56 | if (__builtin_constant_p(cpu_has_counter) && !cpu_has_counter) |
59 | case CPU_R4000SC: | 57 | return 0; |
60 | case CPU_R4000MC: | 58 | else if (__builtin_constant_p(cpu_has_mips_r) && cpu_has_mips_r) |
61 | break; | 59 | return 1; |
60 | else if (likely(!__builtin_constant_p(cpu_has_mips_r) && comp)) | ||
61 | return 1; | ||
62 | /* Make sure we don't peek at cpu_data[0].options in the fast path! */ | ||
63 | if (!__builtin_constant_p(cpu_has_counter)) | ||
64 | asm volatile("" : "=m" (cpu_data[0].options)); | ||
65 | if (likely(cpu_has_counter && | ||
66 | prid >= (PRID_IMP_R4000 | PRID_REV_ENCODE_44(5, 0)))) | ||
67 | return 1; | ||
68 | else | ||
69 | return 0; | ||
70 | } | ||
62 | 71 | ||
63 | default: | 72 | static inline cycles_t get_cycles(void) |
64 | if (cpu_has_counter) | 73 | { |
65 | return read_c0_count(); | 74 | if (can_use_mips_counter(read_c0_prid())) |
66 | break; | 75 | return read_c0_count(); |
67 | } | 76 | else |
77 | return 0; /* no usable counter */ | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * Like get_cycles - but where c0_count is not available we desperately | ||
82 | * use c0_random in an attempt to get at least a little bit of entropy. | ||
83 | * | ||
84 | * R6000 and R6000A neither have a count register nor a random register. | ||
85 | * That leaves no entropy source in the CPU itself. | ||
86 | */ | ||
87 | static inline unsigned long random_get_entropy(void) | ||
88 | { | ||
89 | unsigned int prid = read_c0_prid(); | ||
90 | unsigned int imp = prid & PRID_IMP_MASK; | ||
68 | 91 | ||
69 | return 0; /* no usable counter */ | 92 | if (can_use_mips_counter(prid)) |
93 | return read_c0_count(); | ||
94 | else if (likely(imp != PRID_IMP_R6000 && imp != PRID_IMP_R6000A)) | ||
95 | return read_c0_random(); | ||
96 | else | ||
97 | return 0; /* no usable register */ | ||
70 | } | 98 | } |
99 | #define random_get_entropy random_get_entropy | ||
71 | 100 | ||
72 | #endif /* __KERNEL__ */ | 101 | #endif /* __KERNEL__ */ |
73 | 102 | ||
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index c33a9564fb41..f8d63b3b40b4 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
@@ -55,6 +55,9 @@ void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | |||
55 | #define Ip_u2u1u3(op) \ | 55 | #define Ip_u2u1u3(op) \ |
56 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 56 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
57 | 57 | ||
58 | #define Ip_u3u2u1(op) \ | ||
59 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | ||
60 | |||
58 | #define Ip_u3u1u2(op) \ | 61 | #define Ip_u3u1u2(op) \ |
59 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 62 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
60 | 63 | ||
@@ -74,6 +77,9 @@ void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ | |||
74 | #define Ip_u1u2(op) \ | 77 | #define Ip_u1u2(op) \ |
75 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b) | 78 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b) |
76 | 79 | ||
80 | #define Ip_u2u1(op) \ | ||
81 | void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b) | ||
82 | |||
77 | #define Ip_u1s2(op) \ | 83 | #define Ip_u1s2(op) \ |
78 | void ISAOPC(op)(u32 **buf, unsigned int a, signed int b) | 84 | void ISAOPC(op)(u32 **buf, unsigned int a, signed int b) |
79 | 85 | ||
@@ -99,6 +105,7 @@ Ip_u2u1s3(_daddiu); | |||
99 | Ip_u3u1u2(_daddu); | 105 | Ip_u3u1u2(_daddu); |
100 | Ip_u2u1msbu3(_dins); | 106 | Ip_u2u1msbu3(_dins); |
101 | Ip_u2u1msbu3(_dinsm); | 107 | Ip_u2u1msbu3(_dinsm); |
108 | Ip_u1u2(_divu); | ||
102 | Ip_u1u2u3(_dmfc0); | 109 | Ip_u1u2u3(_dmfc0); |
103 | Ip_u1u2u3(_dmtc0); | 110 | Ip_u1u2u3(_dmtc0); |
104 | Ip_u2u1u3(_drotr); | 111 | Ip_u2u1u3(_drotr); |
@@ -114,16 +121,22 @@ Ip_u2u1msbu3(_ext); | |||
114 | Ip_u2u1msbu3(_ins); | 121 | Ip_u2u1msbu3(_ins); |
115 | Ip_u1(_j); | 122 | Ip_u1(_j); |
116 | Ip_u1(_jal); | 123 | Ip_u1(_jal); |
124 | Ip_u2u1(_jalr); | ||
117 | Ip_u1(_jr); | 125 | Ip_u1(_jr); |
126 | Ip_u2s3u1(_lb); | ||
118 | Ip_u2s3u1(_ld); | 127 | Ip_u2s3u1(_ld); |
119 | Ip_u3u1u2(_ldx); | 128 | Ip_u3u1u2(_ldx); |
129 | Ip_u2s3u1(_lh); | ||
120 | Ip_u2s3u1(_ll); | 130 | Ip_u2s3u1(_ll); |
121 | Ip_u2s3u1(_lld); | 131 | Ip_u2s3u1(_lld); |
122 | Ip_u1s2(_lui); | 132 | Ip_u1s2(_lui); |
123 | Ip_u2s3u1(_lw); | 133 | Ip_u2s3u1(_lw); |
124 | Ip_u3u1u2(_lwx); | 134 | Ip_u3u1u2(_lwx); |
125 | Ip_u1u2u3(_mfc0); | 135 | Ip_u1u2u3(_mfc0); |
136 | Ip_u1(_mfhi); | ||
137 | Ip_u1(_mflo); | ||
126 | Ip_u1u2u3(_mtc0); | 138 | Ip_u1u2u3(_mtc0); |
139 | Ip_u3u1u2(_mul); | ||
127 | Ip_u3u1u2(_or); | 140 | Ip_u3u1u2(_or); |
128 | Ip_u2u1u3(_ori); | 141 | Ip_u2u1u3(_ori); |
129 | Ip_u2s3u1(_pref); | 142 | Ip_u2s3u1(_pref); |
@@ -133,17 +146,25 @@ Ip_u2s3u1(_sc); | |||
133 | Ip_u2s3u1(_scd); | 146 | Ip_u2s3u1(_scd); |
134 | Ip_u2s3u1(_sd); | 147 | Ip_u2s3u1(_sd); |
135 | Ip_u2u1u3(_sll); | 148 | Ip_u2u1u3(_sll); |
149 | Ip_u3u2u1(_sllv); | ||
150 | Ip_u2u1s3(_sltiu); | ||
151 | Ip_u3u1u2(_sltu); | ||
136 | Ip_u2u1u3(_sra); | 152 | Ip_u2u1u3(_sra); |
137 | Ip_u2u1u3(_srl); | 153 | Ip_u2u1u3(_srl); |
154 | Ip_u3u2u1(_srlv); | ||
138 | Ip_u3u1u2(_subu); | 155 | Ip_u3u1u2(_subu); |
139 | Ip_u2s3u1(_sw); | 156 | Ip_u2s3u1(_sw); |
157 | Ip_u1(_sync); | ||
140 | Ip_u1(_syscall); | 158 | Ip_u1(_syscall); |
141 | Ip_0(_tlbp); | 159 | Ip_0(_tlbp); |
142 | Ip_0(_tlbr); | 160 | Ip_0(_tlbr); |
143 | Ip_0(_tlbwi); | 161 | Ip_0(_tlbwi); |
144 | Ip_0(_tlbwr); | 162 | Ip_0(_tlbwr); |
163 | Ip_u1(_wait); | ||
164 | Ip_u2u1(_wsbh); | ||
145 | Ip_u3u1u2(_xor); | 165 | Ip_u3u1u2(_xor); |
146 | Ip_u2u1u3(_xori); | 166 | Ip_u2u1u3(_xori); |
167 | Ip_u2u1(_yield); | ||
147 | 168 | ||
148 | 169 | ||
149 | /* Handle labels. */ | 170 | /* Handle labels. */ |
@@ -264,6 +285,8 @@ void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, | |||
264 | unsigned int bit, int lid); | 285 | unsigned int bit, int lid); |
265 | void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, | 286 | void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, |
266 | unsigned int bit, int lid); | 287 | unsigned int bit, int lid); |
288 | void uasm_il_beq(u32 **p, struct uasm_reloc **r, unsigned int r1, | ||
289 | unsigned int r2, int lid); | ||
267 | void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | 290 | void uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); |
268 | void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | 291 | void uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); |
269 | void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); | 292 | void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); |
diff --git a/arch/mips/include/uapi/asm/Kbuild b/arch/mips/include/uapi/asm/Kbuild index be7196eacb88..96fe7395ed8d 100644 --- a/arch/mips/include/uapi/asm/Kbuild +++ b/arch/mips/include/uapi/asm/Kbuild | |||
@@ -4,6 +4,7 @@ include include/uapi/asm-generic/Kbuild.asm | |||
4 | generic-y += auxvec.h | 4 | generic-y += auxvec.h |
5 | generic-y += ipcbuf.h | 5 | generic-y += ipcbuf.h |
6 | 6 | ||
7 | header-y += bitfield.h | ||
7 | header-y += bitsperlong.h | 8 | header-y += bitsperlong.h |
8 | header-y += break.h | 9 | header-y += break.h |
9 | header-y += byteorder.h | 10 | header-y += byteorder.h |
diff --git a/arch/mips/include/uapi/asm/bitfield.h b/arch/mips/include/uapi/asm/bitfield.h new file mode 100644 index 000000000000..ad9861359cea --- /dev/null +++ b/arch/mips/include/uapi/asm/bitfield.h | |||
@@ -0,0 +1,29 @@ | |||
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 by Ralf Baechle <ralf@linux-mips.org> | ||
7 | */ | ||
8 | #ifndef __UAPI_ASM_BITFIELD_H | ||
9 | #define __UAPI_ASM_BITFIELD_H | ||
10 | |||
11 | /* | ||
12 | * * Damn ... bitfields depend from byteorder :-( | ||
13 | * */ | ||
14 | #ifdef __MIPSEB__ | ||
15 | #define __BITFIELD_FIELD(field, more) \ | ||
16 | field; \ | ||
17 | more | ||
18 | |||
19 | #elif defined(__MIPSEL__) | ||
20 | |||
21 | #define __BITFIELD_FIELD(field, more) \ | ||
22 | more \ | ||
23 | field; | ||
24 | |||
25 | #else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */ | ||
26 | #error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" | ||
27 | #endif | ||
28 | |||
29 | #endif /* __UAPI_ASM_BITFIELD_H */ | ||
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index 3125797f2a88..4b7160259292 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #ifndef _UAPI_ASM_INST_H | 13 | #ifndef _UAPI_ASM_INST_H |
14 | #define _UAPI_ASM_INST_H | 14 | #define _UAPI_ASM_INST_H |
15 | 15 | ||
16 | #include <asm/bitfield.h> | ||
17 | |||
16 | /* | 18 | /* |
17 | * Major opcodes; before MIPS IV cop1x was called cop3. | 19 | * Major opcodes; before MIPS IV cop1x was called cop3. |
18 | */ | 20 | */ |
@@ -74,16 +76,17 @@ enum spec2_op { | |||
74 | enum spec3_op { | 76 | enum spec3_op { |
75 | ext_op, dextm_op, dextu_op, dext_op, | 77 | ext_op, dextm_op, dextu_op, dext_op, |
76 | ins_op, dinsm_op, dinsu_op, dins_op, | 78 | ins_op, dinsm_op, dinsu_op, dins_op, |
77 | lx_op = 0x0a, lwle_op = 0x19, | 79 | yield_op = 0x09, lx_op = 0x0a, |
78 | lwre_op = 0x1a, cachee_op = 0x1b, | 80 | lwle_op = 0x19, lwre_op = 0x1a, |
79 | sbe_op = 0x1c, she_op = 0x1d, | 81 | cachee_op = 0x1b, sbe_op = 0x1c, |
80 | sce_op = 0x1e, swe_op = 0x1f, | 82 | she_op = 0x1d, sce_op = 0x1e, |
81 | bshfl_op = 0x20, swle_op = 0x21, | 83 | swe_op = 0x1f, bshfl_op = 0x20, |
82 | swre_op = 0x22, prefe_op = 0x23, | 84 | swle_op = 0x21, swre_op = 0x22, |
83 | dbshfl_op = 0x24, lbue_op = 0x28, | 85 | prefe_op = 0x23, dbshfl_op = 0x24, |
84 | lhue_op = 0x29, lbe_op = 0x2c, | 86 | lbue_op = 0x28, lhue_op = 0x29, |
85 | lhe_op = 0x2d, lle_op = 0x2e, | 87 | lbe_op = 0x2c, lhe_op = 0x2d, |
86 | lwe_op = 0x2f, rdhwr_op = 0x3b | 88 | lle_op = 0x2e, lwe_op = 0x2f, |
89 | rdhwr_op = 0x3b | ||
87 | }; | 90 | }; |
88 | 91 | ||
89 | /* | 92 | /* |
@@ -125,7 +128,8 @@ enum bcop_op { | |||
125 | enum cop0_coi_func { | 128 | enum cop0_coi_func { |
126 | tlbr_op = 0x01, tlbwi_op = 0x02, | 129 | tlbr_op = 0x01, tlbwi_op = 0x02, |
127 | tlbwr_op = 0x06, tlbp_op = 0x08, | 130 | tlbwr_op = 0x06, tlbp_op = 0x08, |
128 | rfe_op = 0x10, eret_op = 0x18 | 131 | rfe_op = 0x10, eret_op = 0x18, |
132 | wait_op = 0x20, | ||
129 | }; | 133 | }; |
130 | 134 | ||
131 | /* | 135 | /* |
@@ -202,6 +206,16 @@ enum lx_func { | |||
202 | }; | 206 | }; |
203 | 207 | ||
204 | /* | 208 | /* |
209 | * BSHFL opcodes | ||
210 | */ | ||
211 | enum bshfl_func { | ||
212 | wsbh_op = 0x2, | ||
213 | dshd_op = 0x5, | ||
214 | seb_op = 0x10, | ||
215 | seh_op = 0x18, | ||
216 | }; | ||
217 | |||
218 | /* | ||
205 | * (microMIPS) Major opcodes. | 219 | * (microMIPS) Major opcodes. |
206 | */ | 220 | */ |
207 | enum mm_major_op { | 221 | enum mm_major_op { |
@@ -244,17 +258,22 @@ enum mm_32i_minor_op { | |||
244 | enum mm_32a_minor_op { | 258 | enum mm_32a_minor_op { |
245 | mm_sll32_op = 0x000, | 259 | mm_sll32_op = 0x000, |
246 | mm_ins_op = 0x00c, | 260 | mm_ins_op = 0x00c, |
261 | mm_sllv32_op = 0x010, | ||
247 | mm_ext_op = 0x02c, | 262 | mm_ext_op = 0x02c, |
248 | mm_pool32axf_op = 0x03c, | 263 | mm_pool32axf_op = 0x03c, |
249 | mm_srl32_op = 0x040, | 264 | mm_srl32_op = 0x040, |
250 | mm_sra_op = 0x080, | 265 | mm_sra_op = 0x080, |
266 | mm_srlv32_op = 0x090, | ||
251 | mm_rotr_op = 0x0c0, | 267 | mm_rotr_op = 0x0c0, |
252 | mm_lwxs_op = 0x118, | 268 | mm_lwxs_op = 0x118, |
253 | mm_addu32_op = 0x150, | 269 | mm_addu32_op = 0x150, |
254 | mm_subu32_op = 0x1d0, | 270 | mm_subu32_op = 0x1d0, |
271 | mm_wsbh_op = 0x1ec, | ||
272 | mm_mul_op = 0x210, | ||
255 | mm_and_op = 0x250, | 273 | mm_and_op = 0x250, |
256 | mm_or32_op = 0x290, | 274 | mm_or32_op = 0x290, |
257 | mm_xor32_op = 0x310, | 275 | mm_xor32_op = 0x310, |
276 | mm_sltu_op = 0x390, | ||
258 | }; | 277 | }; |
259 | 278 | ||
260 | /* | 279 | /* |
@@ -294,15 +313,20 @@ enum mm_32axf_minor_op { | |||
294 | mm_mfc0_op = 0x003, | 313 | mm_mfc0_op = 0x003, |
295 | mm_mtc0_op = 0x00b, | 314 | mm_mtc0_op = 0x00b, |
296 | mm_tlbp_op = 0x00d, | 315 | mm_tlbp_op = 0x00d, |
316 | mm_mfhi32_op = 0x035, | ||
297 | mm_jalr_op = 0x03c, | 317 | mm_jalr_op = 0x03c, |
298 | mm_tlbr_op = 0x04d, | 318 | mm_tlbr_op = 0x04d, |
319 | mm_mflo32_op = 0x075, | ||
299 | mm_jalrhb_op = 0x07c, | 320 | mm_jalrhb_op = 0x07c, |
300 | mm_tlbwi_op = 0x08d, | 321 | mm_tlbwi_op = 0x08d, |
301 | mm_tlbwr_op = 0x0cd, | 322 | mm_tlbwr_op = 0x0cd, |
302 | mm_jalrs_op = 0x13c, | 323 | mm_jalrs_op = 0x13c, |
303 | mm_jalrshb_op = 0x17c, | 324 | mm_jalrshb_op = 0x17c, |
325 | mm_sync_op = 0x1ad, | ||
304 | mm_syscall_op = 0x22d, | 326 | mm_syscall_op = 0x22d, |
327 | mm_wait_op = 0x24d, | ||
305 | mm_eret_op = 0x3cd, | 328 | mm_eret_op = 0x3cd, |
329 | mm_divu_op = 0x5dc, | ||
306 | }; | 330 | }; |
307 | 331 | ||
308 | /* | 332 | /* |
@@ -480,24 +504,6 @@ enum MIPS6e_i8_func { | |||
480 | */ | 504 | */ |
481 | #define MM_NOP16 0x0c00 | 505 | #define MM_NOP16 0x0c00 |
482 | 506 | ||
483 | /* | ||
484 | * Damn ... bitfields depend from byteorder :-( | ||
485 | */ | ||
486 | #ifdef __MIPSEB__ | ||
487 | #define __BITFIELD_FIELD(field, more) \ | ||
488 | field; \ | ||
489 | more | ||
490 | |||
491 | #elif defined(__MIPSEL__) | ||
492 | |||
493 | #define __BITFIELD_FIELD(field, more) \ | ||
494 | more \ | ||
495 | field; | ||
496 | |||
497 | #else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */ | ||
498 | #error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" | ||
499 | #endif | ||
500 | |||
501 | struct j_format { | 507 | struct j_format { |
502 | __BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */ | 508 | __BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */ |
503 | __BITFIELD_FIELD(unsigned int target : 26, | 509 | __BITFIELD_FIELD(unsigned int target : 26, |
diff --git a/arch/mips/include/uapi/asm/kvm_para.h b/arch/mips/include/uapi/asm/kvm_para.h index 14fab8f0b957..7e16d7c42e65 100644 --- a/arch/mips/include/uapi/asm/kvm_para.h +++ b/arch/mips/include/uapi/asm/kvm_para.h | |||
@@ -1 +1,5 @@ | |||
1 | #include <asm-generic/kvm_para.h> | 1 | #ifndef _UAPI_ASM_MIPS_KVM_PARA_H |
2 | #define _UAPI_ASM_MIPS_KVM_PARA_H | ||
3 | |||
4 | |||
5 | #endif /* _UAPI_ASM_MIPS_KVM_PARA_H */ | ||
diff --git a/arch/mips/include/uapi/asm/types.h b/arch/mips/include/uapi/asm/types.h index 7ac9d0baad84..f3dd9ff0cc0c 100644 --- a/arch/mips/include/uapi/asm/types.h +++ b/arch/mips/include/uapi/asm/types.h | |||
@@ -14,9 +14,12 @@ | |||
14 | /* | 14 | /* |
15 | * We don't use int-l64.h for the kernel anymore but still use it for | 15 | * We don't use int-l64.h for the kernel anymore but still use it for |
16 | * userspace to avoid code changes. | 16 | * userspace to avoid code changes. |
17 | * | ||
18 | * However, some user programs (e.g. perf) may not want this. They can | ||
19 | * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here. | ||
17 | */ | 20 | */ |
18 | #ifndef __KERNEL__ | 21 | #ifndef __KERNEL__ |
19 | # if _MIPS_SZLONG == 64 | 22 | # if _MIPS_SZLONG == 64 && !defined(__SANE_USERSPACE_TYPES__) |
20 | # include <asm-generic/int-l64.h> | 23 | # include <asm-generic/int-l64.h> |
21 | # else | 24 | # else |
22 | # include <asm-generic/int-ll64.h> | 25 | # include <asm-generic/int-ll64.h> |