diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-18 14:49:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-18 14:49:39 -0400 |
commit | d63e210ef1546c2e0a725ba804cae5bc38731ad7 (patch) | |
tree | 5c2328e0561e5a3043b9c5bcfd49d12ae1e61c93 /arch/mips | |
parent | a0a6a39ecb11cefe0d7e6e07997306fb5ab2b07e (diff) | |
parent | 0cc40dac8605b3b6b099b47cdde9500d592e6583 (diff) |
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS fixes from Ralf Baechle:
"Random small fixes across the MIPS code."
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
MIPS: CMP: Fix physical core number calculation logic
MIPS: JZ4740: Forward declare struct uart_port in header.
MIPS: JZ4740: Fix '#include guard' in serial.h
MIPS: hugetlbfs: Fix hazard between tlb write and pagemask restoration.
MIPS: Restore pagemask after dumping the TLB.
MIPS: Hugetlbfs: Handle huge pages correctly in pmd_bad()
MIPS: R5000: Fix TLB hazard handling.
MIPS: tlbex: Deal with re-definition of label
MIPS: Make __{,n,u}delay declarations match definitions and generic delay.h
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/include/asm/delay.h | 6 | ||||
-rw-r--r-- | arch/mips/include/asm/pgtable-64.h | 15 | ||||
-rw-r--r-- | arch/mips/jz4740/serial.h | 3 | ||||
-rw-r--r-- | arch/mips/kernel/smp-cmp.c | 2 | ||||
-rw-r--r-- | arch/mips/lib/delay.c | 6 | ||||
-rw-r--r-- | arch/mips/lib/dump_tlb.c | 4 | ||||
-rw-r--r-- | arch/mips/mm/tlb-r4k.c | 1 | ||||
-rw-r--r-- | arch/mips/mm/tlbex.c | 56 |
8 files changed, 68 insertions, 25 deletions
diff --git a/arch/mips/include/asm/delay.h b/arch/mips/include/asm/delay.h index e7cd78277c23..dc0a5f77a35c 100644 --- a/arch/mips/include/asm/delay.h +++ b/arch/mips/include/asm/delay.h | |||
@@ -13,9 +13,9 @@ | |||
13 | 13 | ||
14 | #include <linux/param.h> | 14 | #include <linux/param.h> |
15 | 15 | ||
16 | extern void __delay(unsigned int loops); | 16 | extern void __delay(unsigned long loops); |
17 | extern void __ndelay(unsigned int ns); | 17 | extern void __ndelay(unsigned long ns); |
18 | extern void __udelay(unsigned int us); | 18 | extern void __udelay(unsigned long us); |
19 | 19 | ||
20 | #define ndelay(ns) __ndelay(ns) | 20 | #define ndelay(ns) __ndelay(ns) |
21 | #define udelay(us) __udelay(us) | 21 | #define udelay(us) __udelay(us) |
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h index c26e18250079..f5b521d5a67d 100644 --- a/arch/mips/include/asm/pgtable-64.h +++ b/arch/mips/include/asm/pgtable-64.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #ifndef _ASM_PGTABLE_64_H | 9 | #ifndef _ASM_PGTABLE_64_H |
10 | #define _ASM_PGTABLE_64_H | 10 | #define _ASM_PGTABLE_64_H |
11 | 11 | ||
12 | #include <linux/compiler.h> | ||
12 | #include <linux/linkage.h> | 13 | #include <linux/linkage.h> |
13 | 14 | ||
14 | #include <asm/addrspace.h> | 15 | #include <asm/addrspace.h> |
@@ -172,7 +173,19 @@ static inline int pmd_none(pmd_t pmd) | |||
172 | return pmd_val(pmd) == (unsigned long) invalid_pte_table; | 173 | return pmd_val(pmd) == (unsigned long) invalid_pte_table; |
173 | } | 174 | } |
174 | 175 | ||
175 | #define pmd_bad(pmd) (pmd_val(pmd) & ~PAGE_MASK) | 176 | static inline int pmd_bad(pmd_t pmd) |
177 | { | ||
178 | #ifdef CONFIG_HUGETLB_PAGE | ||
179 | /* pmd_huge(pmd) but inline */ | ||
180 | if (unlikely(pmd_val(pmd) & _PAGE_HUGE)) | ||
181 | return 0; | ||
182 | #endif | ||
183 | |||
184 | if (unlikely(pmd_val(pmd) & ~PAGE_MASK)) | ||
185 | return 1; | ||
186 | |||
187 | return 0; | ||
188 | } | ||
176 | 189 | ||
177 | static inline int pmd_present(pmd_t pmd) | 190 | static inline int pmd_present(pmd_t pmd) |
178 | { | 191 | { |
diff --git a/arch/mips/jz4740/serial.h b/arch/mips/jz4740/serial.h index b9fe3ade0289..8eb715bb1ea8 100644 --- a/arch/mips/jz4740/serial.h +++ b/arch/mips/jz4740/serial.h | |||
@@ -14,6 +14,9 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef __MIPS_JZ4740_SERIAL_H__ | 16 | #ifndef __MIPS_JZ4740_SERIAL_H__ |
17 | #define __MIPS_JZ4740_SERIAL_H__ | ||
18 | |||
19 | struct uart_port; | ||
17 | 20 | ||
18 | void jz4740_serial_out(struct uart_port *p, int offset, int value); | 21 | void jz4740_serial_out(struct uart_port *p, int offset, int value); |
19 | 22 | ||
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c index afc379ca3753..06cd0c610f44 100644 --- a/arch/mips/kernel/smp-cmp.c +++ b/arch/mips/kernel/smp-cmp.c | |||
@@ -97,7 +97,7 @@ static void cmp_init_secondary(void) | |||
97 | 97 | ||
98 | /* Enable per-cpu interrupts: platform specific */ | 98 | /* Enable per-cpu interrupts: platform specific */ |
99 | 99 | ||
100 | c->core = (read_c0_ebase() >> 1) & 0xff; | 100 | c->core = (read_c0_ebase() >> 1) & 0x1ff; |
101 | #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) | 101 | #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) |
102 | c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE; | 102 | c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE; |
103 | #endif | 103 | #endif |
diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c index 5995969e8c42..dc81ca8dc0dd 100644 --- a/arch/mips/lib/delay.c +++ b/arch/mips/lib/delay.c | |||
@@ -15,13 +15,17 @@ | |||
15 | #include <asm/compiler.h> | 15 | #include <asm/compiler.h> |
16 | #include <asm/war.h> | 16 | #include <asm/war.h> |
17 | 17 | ||
18 | inline void __delay(unsigned int loops) | 18 | void __delay(unsigned long loops) |
19 | { | 19 | { |
20 | __asm__ __volatile__ ( | 20 | __asm__ __volatile__ ( |
21 | " .set noreorder \n" | 21 | " .set noreorder \n" |
22 | " .align 3 \n" | 22 | " .align 3 \n" |
23 | "1: bnez %0, 1b \n" | 23 | "1: bnez %0, 1b \n" |
24 | #if __SIZEOF_LONG__ == 4 | ||
24 | " subu %0, 1 \n" | 25 | " subu %0, 1 \n" |
26 | #else | ||
27 | " dsubu %0, 1 \n" | ||
28 | #endif | ||
25 | " .set reorder \n" | 29 | " .set reorder \n" |
26 | : "=r" (loops) | 30 | : "=r" (loops) |
27 | : "0" (loops)); | 31 | : "0" (loops)); |
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c index 3f69725556af..a99c1d3fc567 100644 --- a/arch/mips/lib/dump_tlb.c +++ b/arch/mips/lib/dump_tlb.c | |||
@@ -50,8 +50,9 @@ static void dump_tlb(int first, int last) | |||
50 | { | 50 | { |
51 | unsigned long s_entryhi, entryhi, asid; | 51 | unsigned long s_entryhi, entryhi, asid; |
52 | unsigned long long entrylo0, entrylo1; | 52 | unsigned long long entrylo0, entrylo1; |
53 | unsigned int s_index, pagemask, c0, c1, i; | 53 | unsigned int s_index, s_pagemask, pagemask, c0, c1, i; |
54 | 54 | ||
55 | s_pagemask = read_c0_pagemask(); | ||
55 | s_entryhi = read_c0_entryhi(); | 56 | s_entryhi = read_c0_entryhi(); |
56 | s_index = read_c0_index(); | 57 | s_index = read_c0_index(); |
57 | asid = s_entryhi & 0xff; | 58 | asid = s_entryhi & 0xff; |
@@ -103,6 +104,7 @@ static void dump_tlb(int first, int last) | |||
103 | 104 | ||
104 | write_c0_entryhi(s_entryhi); | 105 | write_c0_entryhi(s_entryhi); |
105 | write_c0_index(s_index); | 106 | write_c0_index(s_index); |
107 | write_c0_pagemask(s_pagemask); | ||
106 | } | 108 | } |
107 | 109 | ||
108 | void dump_tlb_all(void) | 110 | void dump_tlb_all(void) |
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index 87b9cfcc30ff..4b9b935a070e 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -320,6 +320,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte) | |||
320 | tlb_write_random(); | 320 | tlb_write_random(); |
321 | else | 321 | else |
322 | tlb_write_indexed(); | 322 | tlb_write_indexed(); |
323 | tlbw_use_hazard(); | ||
323 | write_c0_pagemask(PM_DEFAULT_MASK); | 324 | write_c0_pagemask(PM_DEFAULT_MASK); |
324 | } else | 325 | } else |
325 | #endif | 326 | #endif |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 658a520364ce..2833dcb67b5a 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -148,8 +148,8 @@ enum label_id { | |||
148 | label_leave, | 148 | label_leave, |
149 | label_vmalloc, | 149 | label_vmalloc, |
150 | label_vmalloc_done, | 150 | label_vmalloc_done, |
151 | label_tlbw_hazard, | 151 | label_tlbw_hazard_0, |
152 | label_split, | 152 | label_split = label_tlbw_hazard_0 + 8, |
153 | label_tlbl_goaround1, | 153 | label_tlbl_goaround1, |
154 | label_tlbl_goaround2, | 154 | label_tlbl_goaround2, |
155 | label_nopage_tlbl, | 155 | label_nopage_tlbl, |
@@ -167,7 +167,7 @@ UASM_L_LA(_second_part) | |||
167 | UASM_L_LA(_leave) | 167 | UASM_L_LA(_leave) |
168 | UASM_L_LA(_vmalloc) | 168 | UASM_L_LA(_vmalloc) |
169 | UASM_L_LA(_vmalloc_done) | 169 | UASM_L_LA(_vmalloc_done) |
170 | UASM_L_LA(_tlbw_hazard) | 170 | /* _tlbw_hazard_x is handled differently. */ |
171 | UASM_L_LA(_split) | 171 | UASM_L_LA(_split) |
172 | UASM_L_LA(_tlbl_goaround1) | 172 | UASM_L_LA(_tlbl_goaround1) |
173 | UASM_L_LA(_tlbl_goaround2) | 173 | UASM_L_LA(_tlbl_goaround2) |
@@ -181,6 +181,30 @@ UASM_L_LA(_large_segbits_fault) | |||
181 | UASM_L_LA(_tlb_huge_update) | 181 | UASM_L_LA(_tlb_huge_update) |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | static int __cpuinitdata hazard_instance; | ||
185 | |||
186 | static void uasm_bgezl_hazard(u32 **p, struct uasm_reloc **r, int instance) | ||
187 | { | ||
188 | switch (instance) { | ||
189 | case 0 ... 7: | ||
190 | uasm_il_bgezl(p, r, 0, label_tlbw_hazard_0 + instance); | ||
191 | return; | ||
192 | default: | ||
193 | BUG(); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | static void uasm_bgezl_label(struct uasm_label **l, u32 **p, int instance) | ||
198 | { | ||
199 | switch (instance) { | ||
200 | case 0 ... 7: | ||
201 | uasm_build_label(l, *p, label_tlbw_hazard_0 + instance); | ||
202 | break; | ||
203 | default: | ||
204 | BUG(); | ||
205 | } | ||
206 | } | ||
207 | |||
184 | /* | 208 | /* |
185 | * For debug purposes. | 209 | * For debug purposes. |
186 | */ | 210 | */ |
@@ -478,21 +502,28 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l, | |||
478 | * This branch uses up a mtc0 hazard nop slot and saves | 502 | * This branch uses up a mtc0 hazard nop slot and saves |
479 | * two nops after the tlbw instruction. | 503 | * two nops after the tlbw instruction. |
480 | */ | 504 | */ |
481 | uasm_il_bgezl(p, r, 0, label_tlbw_hazard); | 505 | uasm_bgezl_hazard(p, r, hazard_instance); |
482 | tlbw(p); | 506 | tlbw(p); |
483 | uasm_l_tlbw_hazard(l, *p); | 507 | uasm_bgezl_label(l, p, hazard_instance); |
508 | hazard_instance++; | ||
484 | uasm_i_nop(p); | 509 | uasm_i_nop(p); |
485 | break; | 510 | break; |
486 | 511 | ||
487 | case CPU_R4600: | 512 | case CPU_R4600: |
488 | case CPU_R4700: | 513 | case CPU_R4700: |
489 | case CPU_R5000: | ||
490 | case CPU_R5000A: | ||
491 | uasm_i_nop(p); | 514 | uasm_i_nop(p); |
492 | tlbw(p); | 515 | tlbw(p); |
493 | uasm_i_nop(p); | 516 | uasm_i_nop(p); |
494 | break; | 517 | break; |
495 | 518 | ||
519 | case CPU_R5000: | ||
520 | case CPU_R5000A: | ||
521 | case CPU_NEVADA: | ||
522 | uasm_i_nop(p); /* QED specifies 2 nops hazard */ | ||
523 | uasm_i_nop(p); /* QED specifies 2 nops hazard */ | ||
524 | tlbw(p); | ||
525 | break; | ||
526 | |||
496 | case CPU_R4300: | 527 | case CPU_R4300: |
497 | case CPU_5KC: | 528 | case CPU_5KC: |
498 | case CPU_TX49XX: | 529 | case CPU_TX49XX: |
@@ -526,17 +557,6 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l, | |||
526 | tlbw(p); | 557 | tlbw(p); |
527 | break; | 558 | break; |
528 | 559 | ||
529 | case CPU_NEVADA: | ||
530 | uasm_i_nop(p); /* QED specifies 2 nops hazard */ | ||
531 | /* | ||
532 | * This branch uses up a mtc0 hazard nop slot and saves | ||
533 | * a nop after the tlbw instruction. | ||
534 | */ | ||
535 | uasm_il_bgezl(p, r, 0, label_tlbw_hazard); | ||
536 | tlbw(p); | ||
537 | uasm_l_tlbw_hazard(l, *p); | ||
538 | break; | ||
539 | |||
540 | case CPU_RM7000: | 560 | case CPU_RM7000: |
541 | uasm_i_nop(p); | 561 | uasm_i_nop(p); |
542 | uasm_i_nop(p); | 562 | uasm_i_nop(p); |