aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 17:27:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 17:27:45 -0500
commitcebfa85eb86d92bf85d3b041c6b044184517a988 (patch)
treebe0a374556fe335ce96dfdb296c89537750d5868 /arch/mips/mm
parentd42b3a2906a10b732ea7d7f849d49be79d242ef0 (diff)
parent241738bd51cb0efe58e6c570223153e970afe3ae (diff)
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle: "The MIPS bits for 3.8. This also includes a bunch fixes that were sitting in the linux-mips.org git tree for a long time. This pull request contains updates to several OCTEON drivers and the board support code for BCM47XX, BCM63XX, XLP, XLR, XLS, lantiq, Loongson1B, updates to the SSB bus support, MIPS kexec code and adds support for kdump. When pulling this, there are two expected merge conflicts in include/linux/bcma/bcma_driver_chipcommon.h which are trivial to resolve, just remove the conflict markers and keep both alternatives." * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (90 commits) MIPS: PMC-Sierra Yosemite: Remove support. VIDEO: Newport Fix console crashes MIPS: wrppmc: Fix build of PCI code. MIPS: IP22/IP28: Fix build of EISA code. MIPS: RB532: Fix build of prom code. MIPS: PowerTV: Fix build. MIPS: IP27: Correct fucked grammar in ops-bridge.c MIPS: Highmem: Fix build error if CONFIG_DEBUG_HIGHMEM is disabled MIPS: Fix potencial corruption MIPS: Fix for warning from FPU emulation code MIPS: Handle COP3 Unusable exception as COP1X for FP emulation MIPS: Fix poweroff failure when HOTPLUG_CPU configured. MIPS: MT: Fix build with CONFIG_UIDGID_STRICT_TYPE_CHECKS=y MIPS: Remove unused smvp.h MIPS/EDAC: Improve OCTEON EDAC support. MIPS: OCTEON: Add definitions for OCTEON memory contoller registers. MIPS: OCTEON: Add OCTEON family definitions to octeon-model.h ata: pata_octeon_cf: Use correct byte order for DMA in when built little-endian. MIPS/OCTEON/ata: Convert pata_octeon_cf.c to use device tree. MIPS: Remove usage of CEVT_R4K_LIB config option. ...
Diffstat (limited to 'arch/mips/mm')
-rw-r--r--arch/mips/mm/c-octeon.c67
-rw-r--r--arch/mips/mm/c-r4k.c23
-rw-r--r--arch/mips/mm/highmem.c3
-rw-r--r--arch/mips/mm/page.c9
-rw-r--r--arch/mips/mm/pgtable-64.c31
-rw-r--r--arch/mips/mm/tlb-r4k.c22
-rw-r--r--arch/mips/mm/tlbex.c123
7 files changed, 178 insertions, 100 deletions
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index 44e69e7a4519..6ec04daf4231 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (C) 2005-2007 Cavium Networks 6 * Copyright (C) 2005-2007 Cavium Networks
7 */ 7 */
8#include <linux/export.h>
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/kernel.h> 10#include <linux/kernel.h>
10#include <linux/sched.h> 11#include <linux/sched.h>
@@ -28,6 +29,7 @@
28#include <asm/octeon/octeon.h> 29#include <asm/octeon/octeon.h>
29 30
30unsigned long long cache_err_dcache[NR_CPUS]; 31unsigned long long cache_err_dcache[NR_CPUS];
32EXPORT_SYMBOL_GPL(cache_err_dcache);
31 33
32/** 34/**
33 * Octeon automatically flushes the dcache on tlb changes, so 35 * Octeon automatically flushes the dcache on tlb changes, so
@@ -284,39 +286,59 @@ void __cpuinit octeon_cache_init(void)
284 board_cache_error_setup = octeon_cache_error_setup; 286 board_cache_error_setup = octeon_cache_error_setup;
285} 287}
286 288
287/** 289/*
288 * Handle a cache error exception 290 * Handle a cache error exception
289 */ 291 */
292static RAW_NOTIFIER_HEAD(co_cache_error_chain);
290 293
291static void cache_parity_error_octeon(int non_recoverable) 294int register_co_cache_error_notifier(struct notifier_block *nb)
292{ 295{
293 unsigned long coreid = cvmx_get_core_num(); 296 return raw_notifier_chain_register(&co_cache_error_chain, nb);
294 uint64_t icache_err = read_octeon_c0_icacheerr(); 297}
295 298EXPORT_SYMBOL_GPL(register_co_cache_error_notifier);
296 pr_err("Cache error exception:\n"); 299
297 pr_err("cp0_errorepc == %lx\n", read_c0_errorepc()); 300int unregister_co_cache_error_notifier(struct notifier_block *nb)
298 if (icache_err & 1) { 301{
299 pr_err("CacheErr (Icache) == %llx\n", 302 return raw_notifier_chain_unregister(&co_cache_error_chain, nb);
300 (unsigned long long)icache_err); 303}
301 write_octeon_c0_icacheerr(0); 304EXPORT_SYMBOL_GPL(unregister_co_cache_error_notifier);
302 }
303 if (cache_err_dcache[coreid] & 1) {
304 pr_err("CacheErr (Dcache) == %llx\n",
305 (unsigned long long)cache_err_dcache[coreid]);
306 cache_err_dcache[coreid] = 0;
307 }
308 305
309 if (non_recoverable) 306static void co_cache_error_call_notifiers(unsigned long val)
310 panic("Can't handle cache error: nested exception"); 307{
308 int rv = raw_notifier_call_chain(&co_cache_error_chain, val, NULL);
309 if ((rv & ~NOTIFY_STOP_MASK) != NOTIFY_OK) {
310 u64 dcache_err;
311 unsigned long coreid = cvmx_get_core_num();
312 u64 icache_err = read_octeon_c0_icacheerr();
313
314 if (val) {
315 dcache_err = cache_err_dcache[coreid];
316 cache_err_dcache[coreid] = 0;
317 } else {
318 dcache_err = read_octeon_c0_dcacheerr();
319 }
320
321 pr_err("Core%lu: Cache error exception:\n", coreid);
322 pr_err("cp0_errorepc == %lx\n", read_c0_errorepc());
323 if (icache_err & 1) {
324 pr_err("CacheErr (Icache) == %llx\n",
325 (unsigned long long)icache_err);
326 write_octeon_c0_icacheerr(0);
327 }
328 if (dcache_err & 1) {
329 pr_err("CacheErr (Dcache) == %llx\n",
330 (unsigned long long)dcache_err);
331 }
332 }
311} 333}
312 334
313/** 335/*
314 * Called when the the exception is recoverable 336 * Called when the the exception is recoverable
315 */ 337 */
316 338
317asmlinkage void cache_parity_error_octeon_recoverable(void) 339asmlinkage void cache_parity_error_octeon_recoverable(void)
318{ 340{
319 cache_parity_error_octeon(0); 341 co_cache_error_call_notifiers(0);
320} 342}
321 343
322/** 344/**
@@ -325,5 +347,6 @@ asmlinkage void cache_parity_error_octeon_recoverable(void)
325 347
326asmlinkage void cache_parity_error_octeon_non_recoverable(void) 348asmlinkage void cache_parity_error_octeon_non_recoverable(void)
327{ 349{
328 cache_parity_error_octeon(1); 350 co_cache_error_call_notifiers(1);
351 panic("Can't handle cache error: nested exception");
329} 352}
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 4c32ede464b5..0f7d788e8810 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -632,9 +632,6 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
632 if (size >= scache_size) 632 if (size >= scache_size)
633 r4k_blast_scache(); 633 r4k_blast_scache();
634 else { 634 else {
635 unsigned long lsize = cpu_scache_line_size();
636 unsigned long almask = ~(lsize - 1);
637
638 /* 635 /*
639 * There is no clearly documented alignment requirement 636 * There is no clearly documented alignment requirement
640 * for the cache instruction on MIPS processors and 637 * for the cache instruction on MIPS processors and
@@ -643,9 +640,6 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
643 * hit ops with insufficient alignment. Solved by 640 * hit ops with insufficient alignment. Solved by
644 * aligning the address to cache line size. 641 * aligning the address to cache line size.
645 */ 642 */
646 cache_op(Hit_Writeback_Inv_SD, addr & almask);
647 cache_op(Hit_Writeback_Inv_SD,
648 (addr + size - 1) & almask);
649 blast_inv_scache_range(addr, addr + size); 643 blast_inv_scache_range(addr, addr + size);
650 } 644 }
651 __sync(); 645 __sync();
@@ -655,12 +649,7 @@ static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
655 if (cpu_has_safe_index_cacheops && size >= dcache_size) { 649 if (cpu_has_safe_index_cacheops && size >= dcache_size) {
656 r4k_blast_dcache(); 650 r4k_blast_dcache();
657 } else { 651 } else {
658 unsigned long lsize = cpu_dcache_line_size();
659 unsigned long almask = ~(lsize - 1);
660
661 R4600_HIT_CACHEOP_WAR_IMPL; 652 R4600_HIT_CACHEOP_WAR_IMPL;
662 cache_op(Hit_Writeback_Inv_D, addr & almask);
663 cache_op(Hit_Writeback_Inv_D, (addr + size - 1) & almask);
664 blast_inv_dcache_range(addr, addr + size); 653 blast_inv_dcache_range(addr, addr + size);
665 } 654 }
666 655
@@ -947,7 +936,6 @@ static void __cpuinit probe_pcache(void)
947 case CPU_RM7000: 936 case CPU_RM7000:
948 rm7k_erratum31(); 937 rm7k_erratum31();
949 938
950 case CPU_RM9000:
951 icache_size = 1 << (12 + ((config & CONF_IC) >> 9)); 939 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
952 c->icache.linesz = 16 << ((config & CONF_IB) >> 5); 940 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
953 c->icache.ways = 4; 941 c->icache.ways = 4;
@@ -958,9 +946,7 @@ static void __cpuinit probe_pcache(void)
958 c->dcache.ways = 4; 946 c->dcache.ways = 4;
959 c->dcache.waybit = __ffs(dcache_size / c->dcache.ways); 947 c->dcache.waybit = __ffs(dcache_size / c->dcache.ways);
960 948
961#if !defined(CONFIG_SMP) || !defined(RM9000_CDEX_SMP_WAR)
962 c->options |= MIPS_CPU_CACHE_CDEX_P; 949 c->options |= MIPS_CPU_CACHE_CDEX_P;
963#endif
964 c->options |= MIPS_CPU_PREFETCH; 950 c->options |= MIPS_CPU_PREFETCH;
965 break; 951 break;
966 952
@@ -1245,7 +1231,6 @@ static void __cpuinit setup_scache(void)
1245 return; 1231 return;
1246 1232
1247 case CPU_RM7000: 1233 case CPU_RM7000:
1248 case CPU_RM9000:
1249#ifdef CONFIG_RM7000_CPU_SCACHE 1234#ifdef CONFIG_RM7000_CPU_SCACHE
1250 rm7k_sc_init(); 1235 rm7k_sc_init();
1251#endif 1236#endif
@@ -1348,10 +1333,10 @@ static int __init cca_setup(char *str)
1348{ 1333{
1349 get_option(&str, &cca); 1334 get_option(&str, &cca);
1350 1335
1351 return 1; 1336 return 0;
1352} 1337}
1353 1338
1354__setup("cca=", cca_setup); 1339early_param("cca", cca_setup);
1355 1340
1356static void __cpuinit coherency_setup(void) 1341static void __cpuinit coherency_setup(void)
1357{ 1342{
@@ -1401,10 +1386,10 @@ static int __init setcoherentio(char *str)
1401{ 1386{
1402 coherentio = 1; 1387 coherentio = 1;
1403 1388
1404 return 1; 1389 return 0;
1405} 1390}
1406 1391
1407__setup("coherentio", setcoherentio); 1392early_param("coherentio", setcoherentio);
1408#endif 1393#endif
1409 1394
1410static void __cpuinit r4k_cache_error_setup(void) 1395static void __cpuinit r4k_cache_error_setup(void)
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index aff57057a949..da815d295239 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -1,3 +1,4 @@
1#include <linux/compiler.h>
1#include <linux/module.h> 2#include <linux/module.h>
2#include <linux/highmem.h> 3#include <linux/highmem.h>
3#include <linux/sched.h> 4#include <linux/sched.h>
@@ -67,7 +68,7 @@ EXPORT_SYMBOL(kmap_atomic);
67void __kunmap_atomic(void *kvaddr) 68void __kunmap_atomic(void *kvaddr)
68{ 69{
69 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 70 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
70 int type; 71 int type __maybe_unused;
71 72
72 if (vaddr < FIXADDR_START) { // FIXME 73 if (vaddr < FIXADDR_START) { // FIXME
73 pagefault_enable(); 74 pagefault_enable();
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 98f530e18216..8e666c55f4d4 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -140,15 +140,6 @@ static void __cpuinit set_prefetch_parameters(void)
140 pref_bias_copy_load = 256; 140 pref_bias_copy_load = 256;
141 break; 141 break;
142 142
143 case CPU_RM9000:
144 /*
145 * As a workaround for erratum G105 which make the
146 * PrepareForStore hint unusable we fall back to
147 * StoreRetained on the RM9000. Once it is known which
148 * versions of the RM9000 we'll be able to condition-
149 * alize this.
150 */
151
152 case CPU_R10000: 143 case CPU_R10000:
153 case CPU_R12000: 144 case CPU_R12000:
154 case CPU_R14000: 145 case CPU_R14000:
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index 25407794edb4..ee331bbd8f8a 100644
--- a/arch/mips/mm/pgtable-64.c
+++ b/arch/mips/mm/pgtable-64.c
@@ -11,6 +11,7 @@
11#include <asm/fixmap.h> 11#include <asm/fixmap.h>
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13#include <asm/pgalloc.h> 13#include <asm/pgalloc.h>
14#include <asm/tlbflush.h>
14 15
15void pgd_init(unsigned long page) 16void pgd_init(unsigned long page)
16{ 17{
@@ -61,6 +62,36 @@ void pmd_init(unsigned long addr, unsigned long pagetable)
61} 62}
62#endif 63#endif
63 64
65#ifdef CONFIG_TRANSPARENT_HUGEPAGE
66
67void pmdp_splitting_flush(struct vm_area_struct *vma,
68 unsigned long address,
69 pmd_t *pmdp)
70{
71 if (!pmd_trans_splitting(*pmdp)) {
72 pmd_t pmd = pmd_mksplitting(*pmdp);
73 set_pmd_at(vma->vm_mm, address, pmdp, pmd);
74 }
75}
76
77#endif
78
79pmd_t mk_pmd(struct page *page, pgprot_t prot)
80{
81 pmd_t pmd;
82
83 pmd_val(pmd) = (page_to_pfn(page) << _PFN_SHIFT) | pgprot_val(prot);
84
85 return pmd;
86}
87
88void set_pmd_at(struct mm_struct *mm, unsigned long addr,
89 pmd_t *pmdp, pmd_t pmd)
90{
91 *pmdp = pmd;
92 flush_tlb_all();
93}
94
64void __init pagetable_init(void) 95void __init pagetable_init(void)
65{ 96{
66 unsigned long vaddr; 97 unsigned long vaddr;
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 88e79ad6f811..2a7c9725b2a3 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -295,7 +295,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
295 pudp = pud_offset(pgdp, address); 295 pudp = pud_offset(pgdp, address);
296 pmdp = pmd_offset(pudp, address); 296 pmdp = pmd_offset(pudp, address);
297 idx = read_c0_index(); 297 idx = read_c0_index();
298#ifdef CONFIG_HUGETLB_PAGE 298#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
299 /* this could be a huge page */ 299 /* this could be a huge page */
300 if (pmd_huge(*pmdp)) { 300 if (pmd_huge(*pmdp)) {
301 unsigned long lo; 301 unsigned long lo;
@@ -367,6 +367,26 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
367 EXIT_CRITICAL(flags); 367 EXIT_CRITICAL(flags);
368} 368}
369 369
370#ifdef CONFIG_TRANSPARENT_HUGEPAGE
371
372int __init has_transparent_hugepage(void)
373{
374 unsigned int mask;
375 unsigned long flags;
376
377 ENTER_CRITICAL(flags);
378 write_c0_pagemask(PM_HUGE_MASK);
379 back_to_back_c0_hazard();
380 mask = read_c0_pagemask();
381 write_c0_pagemask(PM_DEFAULT_MASK);
382
383 EXIT_CRITICAL(flags);
384
385 return mask == PM_HUGE_MASK;
386}
387
388#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
389
370static int __cpuinitdata ntlb; 390static int __cpuinitdata ntlb;
371static int __init set_ntlb(char *str) 391static int __init set_ntlb(char *str)
372{ 392{
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 2833dcb67b5a..05613355627b 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -158,7 +158,7 @@ enum label_id {
158 label_smp_pgtable_change, 158 label_smp_pgtable_change,
159 label_r3000_write_probe_fail, 159 label_r3000_write_probe_fail,
160 label_large_segbits_fault, 160 label_large_segbits_fault,
161#ifdef CONFIG_HUGETLB_PAGE 161#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
162 label_tlb_huge_update, 162 label_tlb_huge_update,
163#endif 163#endif
164}; 164};
@@ -177,13 +177,15 @@ UASM_L_LA(_nopage_tlbm)
177UASM_L_LA(_smp_pgtable_change) 177UASM_L_LA(_smp_pgtable_change)
178UASM_L_LA(_r3000_write_probe_fail) 178UASM_L_LA(_r3000_write_probe_fail)
179UASM_L_LA(_large_segbits_fault) 179UASM_L_LA(_large_segbits_fault)
180#ifdef CONFIG_HUGETLB_PAGE 180#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
181UASM_L_LA(_tlb_huge_update) 181UASM_L_LA(_tlb_huge_update)
182#endif 182#endif
183 183
184static int __cpuinitdata hazard_instance; 184static int __cpuinitdata hazard_instance;
185 185
186static void uasm_bgezl_hazard(u32 **p, struct uasm_reloc **r, int instance) 186static void __cpuinit uasm_bgezl_hazard(u32 **p,
187 struct uasm_reloc **r,
188 int instance)
187{ 189{
188 switch (instance) { 190 switch (instance) {
189 case 0 ... 7: 191 case 0 ... 7:
@@ -194,7 +196,9 @@ static void uasm_bgezl_hazard(u32 **p, struct uasm_reloc **r, int instance)
194 } 196 }
195} 197}
196 198
197static void uasm_bgezl_label(struct uasm_label **l, u32 **p, int instance) 199static void __cpuinit uasm_bgezl_label(struct uasm_label **l,
200 u32 **p,
201 int instance)
198{ 202{
199 switch (instance) { 203 switch (instance) {
200 case 0 ... 7: 204 case 0 ... 7:
@@ -206,19 +210,59 @@ static void uasm_bgezl_label(struct uasm_label **l, u32 **p, int instance)
206} 210}
207 211
208/* 212/*
209 * For debug purposes. 213 * pgtable bits are assigned dynamically depending on processor feature
214 * and statically based on kernel configuration. This spits out the actual
215 * values the kernel is using. Required to make sense from disassembled
216 * TLB exception handlers.
210 */ 217 */
211static inline void dump_handler(const u32 *handler, int count) 218static void output_pgtable_bits_defines(void)
219{
220#define pr_define(fmt, ...) \
221 pr_debug("#define " fmt, ##__VA_ARGS__)
222
223 pr_debug("#include <asm/asm.h>\n");
224 pr_debug("#include <asm/regdef.h>\n");
225 pr_debug("\n");
226
227 pr_define("_PAGE_PRESENT_SHIFT %d\n", _PAGE_PRESENT_SHIFT);
228 pr_define("_PAGE_READ_SHIFT %d\n", _PAGE_READ_SHIFT);
229 pr_define("_PAGE_WRITE_SHIFT %d\n", _PAGE_WRITE_SHIFT);
230 pr_define("_PAGE_ACCESSED_SHIFT %d\n", _PAGE_ACCESSED_SHIFT);
231 pr_define("_PAGE_MODIFIED_SHIFT %d\n", _PAGE_MODIFIED_SHIFT);
232#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
233 pr_define("_PAGE_HUGE_SHIFT %d\n", _PAGE_HUGE_SHIFT);
234 pr_define("_PAGE_SPLITTING_SHIFT %d\n", _PAGE_SPLITTING_SHIFT);
235#endif
236 if (cpu_has_rixi) {
237#ifdef _PAGE_NO_EXEC_SHIFT
238 pr_define("_PAGE_NO_EXEC_SHIFT %d\n", _PAGE_NO_EXEC_SHIFT);
239#endif
240#ifdef _PAGE_NO_READ_SHIFT
241 pr_define("_PAGE_NO_READ_SHIFT %d\n", _PAGE_NO_READ_SHIFT);
242#endif
243 }
244 pr_define("_PAGE_GLOBAL_SHIFT %d\n", _PAGE_GLOBAL_SHIFT);
245 pr_define("_PAGE_VALID_SHIFT %d\n", _PAGE_VALID_SHIFT);
246 pr_define("_PAGE_DIRTY_SHIFT %d\n", _PAGE_DIRTY_SHIFT);
247 pr_define("_PFN_SHIFT %d\n", _PFN_SHIFT);
248 pr_debug("\n");
249}
250
251static inline void dump_handler(const char *symbol, const u32 *handler, int count)
212{ 252{
213 int i; 253 int i;
214 254
255 pr_debug("LEAF(%s)\n", symbol);
256
215 pr_debug("\t.set push\n"); 257 pr_debug("\t.set push\n");
216 pr_debug("\t.set noreorder\n"); 258 pr_debug("\t.set noreorder\n");
217 259
218 for (i = 0; i < count; i++) 260 for (i = 0; i < count; i++)
219 pr_debug("\t%p\t.word 0x%08x\n", &handler[i], handler[i]); 261 pr_debug("\t.word\t0x%08x\t\t# %p\n", handler[i], &handler[i]);
262
263 pr_debug("\t.set\tpop\n");
220 264
221 pr_debug("\t.set pop\n"); 265 pr_debug("\tEND(%s)\n", symbol);
222} 266}
223 267
224/* The only general purpose registers allowed in TLB handlers. */ 268/* The only general purpose registers allowed in TLB handlers. */
@@ -401,7 +445,7 @@ static void __cpuinit build_r3000_tlb_refill_handler(void)
401 445
402 memcpy((void *)ebase, tlb_handler, 0x80); 446 memcpy((void *)ebase, tlb_handler, 0x80);
403 447
404 dump_handler((u32 *)ebase, 32); 448 dump_handler("r3000_tlb_refill", (u32 *)ebase, 32);
405} 449}
406#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */ 450#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */
407 451
@@ -443,7 +487,6 @@ static void __cpuinit __maybe_unused build_tlb_probe_entry(u32 **p)
443 case CPU_R4600: 487 case CPU_R4600:
444 case CPU_R4700: 488 case CPU_R4700:
445 case CPU_R5000: 489 case CPU_R5000:
446 case CPU_R5000A:
447 case CPU_NEVADA: 490 case CPU_NEVADA:
448 uasm_i_nop(p); 491 uasm_i_nop(p);
449 uasm_i_tlbp(p); 492 uasm_i_tlbp(p);
@@ -517,7 +560,6 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
517 break; 560 break;
518 561
519 case CPU_R5000: 562 case CPU_R5000:
520 case CPU_R5000A:
521 case CPU_NEVADA: 563 case CPU_NEVADA:
522 uasm_i_nop(p); /* QED specifies 2 nops hazard */ 564 uasm_i_nop(p); /* QED specifies 2 nops hazard */
523 uasm_i_nop(p); /* QED specifies 2 nops hazard */ 565 uasm_i_nop(p); /* QED specifies 2 nops hazard */
@@ -565,24 +607,6 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
565 tlbw(p); 607 tlbw(p);
566 break; 608 break;
567 609
568 case CPU_RM9000:
569 /*
570 * When the JTLB is updated by tlbwi or tlbwr, a subsequent
571 * use of the JTLB for instructions should not occur for 4
572 * cpu cycles and use for data translations should not occur
573 * for 3 cpu cycles.
574 */
575 uasm_i_ssnop(p);
576 uasm_i_ssnop(p);
577 uasm_i_ssnop(p);
578 uasm_i_ssnop(p);
579 tlbw(p);
580 uasm_i_ssnop(p);
581 uasm_i_ssnop(p);
582 uasm_i_ssnop(p);
583 uasm_i_ssnop(p);
584 break;
585
586 case CPU_VR4111: 610 case CPU_VR4111:
587 case CPU_VR4121: 611 case CPU_VR4121:
588 case CPU_VR4122: 612 case CPU_VR4122:
@@ -629,7 +653,7 @@ static __cpuinit __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
629 } 653 }
630} 654}
631 655
632#ifdef CONFIG_HUGETLB_PAGE 656#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
633 657
634static __cpuinit void build_restore_pagemask(u32 **p, 658static __cpuinit void build_restore_pagemask(u32 **p,
635 struct uasm_reloc **r, 659 struct uasm_reloc **r,
@@ -755,7 +779,7 @@ static __cpuinit void build_huge_handler_tail(u32 **p,
755 build_huge_update_entries(p, pte, ptr); 779 build_huge_update_entries(p, pte, ptr);
756 build_huge_tlb_write_entry(p, l, r, pte, tlb_indexed, 0); 780 build_huge_tlb_write_entry(p, l, r, pte, tlb_indexed, 0);
757} 781}
758#endif /* CONFIG_HUGETLB_PAGE */ 782#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
759 783
760#ifdef CONFIG_64BIT 784#ifdef CONFIG_64BIT
761/* 785/*
@@ -1200,7 +1224,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1200 /* Adjust the context during the load latency. */ 1224 /* Adjust the context during the load latency. */
1201 build_adjust_context(p, tmp); 1225 build_adjust_context(p, tmp);
1202 1226
1203#ifdef CONFIG_HUGETLB_PAGE 1227#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1204 uasm_il_bbit1(p, r, scratch, ilog2(_PAGE_HUGE), label_tlb_huge_update); 1228 uasm_il_bbit1(p, r, scratch, ilog2(_PAGE_HUGE), label_tlb_huge_update);
1205 /* 1229 /*
1206 * The in the LWX case we don't want to do the load in the 1230 * The in the LWX case we don't want to do the load in the
@@ -1209,7 +1233,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1209 */ 1233 */
1210 if (use_lwx_insns()) 1234 if (use_lwx_insns())
1211 uasm_i_nop(p); 1235 uasm_i_nop(p);
1212#endif /* CONFIG_HUGETLB_PAGE */ 1236#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
1213 1237
1214 1238
1215 /* build_update_entries */ 1239 /* build_update_entries */
@@ -1312,7 +1336,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1312 build_get_pgde32(&p, K0, K1); /* get pgd in K1 */ 1336 build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
1313#endif 1337#endif
1314 1338
1315#ifdef CONFIG_HUGETLB_PAGE 1339#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1316 build_is_huge_pte(&p, &r, K0, K1, label_tlb_huge_update); 1340 build_is_huge_pte(&p, &r, K0, K1, label_tlb_huge_update);
1317#endif 1341#endif
1318 1342
@@ -1322,7 +1346,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1322 uasm_l_leave(&l, p); 1346 uasm_l_leave(&l, p);
1323 uasm_i_eret(&p); /* return from trap */ 1347 uasm_i_eret(&p); /* return from trap */
1324 } 1348 }
1325#ifdef CONFIG_HUGETLB_PAGE 1349#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1326 uasm_l_tlb_huge_update(&l, p); 1350 uasm_l_tlb_huge_update(&l, p);
1327 build_huge_update_entries(&p, htlb_info.huge_pte, K1); 1351 build_huge_update_entries(&p, htlb_info.huge_pte, K1);
1328 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random, 1352 build_huge_tlb_write_entry(&p, &l, &r, K0, tlb_random,
@@ -1367,7 +1391,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1367 uasm_copy_handler(relocs, labels, tlb_handler, p, f); 1391 uasm_copy_handler(relocs, labels, tlb_handler, p, f);
1368 final_len = p - tlb_handler; 1392 final_len = p - tlb_handler;
1369 } else { 1393 } else {
1370#if defined(CONFIG_HUGETLB_PAGE) 1394#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1371 const enum label_id ls = label_tlb_huge_update; 1395 const enum label_id ls = label_tlb_huge_update;
1372#else 1396#else
1373 const enum label_id ls = label_vmalloc; 1397 const enum label_id ls = label_vmalloc;
@@ -1436,7 +1460,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1436 1460
1437 memcpy((void *)ebase, final_handler, 0x100); 1461 memcpy((void *)ebase, final_handler, 0x100);
1438 1462
1439 dump_handler((u32 *)ebase, 64); 1463 dump_handler("r4000_tlb_refill", (u32 *)ebase, 64);
1440} 1464}
1441 1465
1442/* 1466/*
@@ -1493,7 +1517,8 @@ static void __cpuinit build_r4000_setup_pgd(void)
1493 pr_debug("Wrote tlbmiss_handler_setup_pgd (%u instructions).\n", 1517 pr_debug("Wrote tlbmiss_handler_setup_pgd (%u instructions).\n",
1494 (unsigned int)(p - tlbmiss_handler_setup_pgd)); 1518 (unsigned int)(p - tlbmiss_handler_setup_pgd));
1495 1519
1496 dump_handler(tlbmiss_handler_setup_pgd, 1520 dump_handler("tlbmiss_handler",
1521 tlbmiss_handler_setup_pgd,
1497 ARRAY_SIZE(tlbmiss_handler_setup_pgd)); 1522 ARRAY_SIZE(tlbmiss_handler_setup_pgd));
1498} 1523}
1499#endif 1524#endif
@@ -1763,7 +1788,7 @@ static void __cpuinit build_r3000_tlb_load_handler(void)
1763 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n", 1788 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n",
1764 (unsigned int)(p - handle_tlbl)); 1789 (unsigned int)(p - handle_tlbl));
1765 1790
1766 dump_handler(handle_tlbl, ARRAY_SIZE(handle_tlbl)); 1791 dump_handler("r3000_tlb_load", handle_tlbl, ARRAY_SIZE(handle_tlbl));
1767} 1792}
1768 1793
1769static void __cpuinit build_r3000_tlb_store_handler(void) 1794static void __cpuinit build_r3000_tlb_store_handler(void)
@@ -1793,7 +1818,7 @@ static void __cpuinit build_r3000_tlb_store_handler(void)
1793 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n", 1818 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n",
1794 (unsigned int)(p - handle_tlbs)); 1819 (unsigned int)(p - handle_tlbs));
1795 1820
1796 dump_handler(handle_tlbs, ARRAY_SIZE(handle_tlbs)); 1821 dump_handler("r3000_tlb_store", handle_tlbs, ARRAY_SIZE(handle_tlbs));
1797} 1822}
1798 1823
1799static void __cpuinit build_r3000_tlb_modify_handler(void) 1824static void __cpuinit build_r3000_tlb_modify_handler(void)
@@ -1823,7 +1848,7 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
1823 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n", 1848 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n",
1824 (unsigned int)(p - handle_tlbm)); 1849 (unsigned int)(p - handle_tlbm));
1825 1850
1826 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm)); 1851 dump_handler("r3000_tlb_modify", handle_tlbm, ARRAY_SIZE(handle_tlbm));
1827} 1852}
1828#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */ 1853#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */
1829 1854
@@ -1842,7 +1867,7 @@ build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l,
1842 build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */ 1867 build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
1843#endif 1868#endif
1844 1869
1845#ifdef CONFIG_HUGETLB_PAGE 1870#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1846 /* 1871 /*
1847 * For huge tlb entries, pmd doesn't contain an address but 1872 * For huge tlb entries, pmd doesn't contain an address but
1848 * instead contains the tlb pte. Check the PAGE_HUGE bit and 1873 * instead contains the tlb pte. Check the PAGE_HUGE bit and
@@ -1958,7 +1983,7 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1958 build_make_valid(&p, &r, wr.r1, wr.r2); 1983 build_make_valid(&p, &r, wr.r1, wr.r2);
1959 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); 1984 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
1960 1985
1961#ifdef CONFIG_HUGETLB_PAGE 1986#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
1962 /* 1987 /*
1963 * This is the entry point when build_r4000_tlbchange_handler_head 1988 * This is the entry point when build_r4000_tlbchange_handler_head
1964 * spots a huge page. 1989 * spots a huge page.
@@ -2030,7 +2055,7 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
2030 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n", 2055 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n",
2031 (unsigned int)(p - handle_tlbl)); 2056 (unsigned int)(p - handle_tlbl));
2032 2057
2033 dump_handler(handle_tlbl, ARRAY_SIZE(handle_tlbl)); 2058 dump_handler("r4000_tlb_load", handle_tlbl, ARRAY_SIZE(handle_tlbl));
2034} 2059}
2035 2060
2036static void __cpuinit build_r4000_tlb_store_handler(void) 2061static void __cpuinit build_r4000_tlb_store_handler(void)
@@ -2051,7 +2076,7 @@ static void __cpuinit build_r4000_tlb_store_handler(void)
2051 build_make_write(&p, &r, wr.r1, wr.r2); 2076 build_make_write(&p, &r, wr.r1, wr.r2);
2052 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); 2077 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
2053 2078
2054#ifdef CONFIG_HUGETLB_PAGE 2079#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
2055 /* 2080 /*
2056 * This is the entry point when 2081 * This is the entry point when
2057 * build_r4000_tlbchange_handler_head spots a huge page. 2082 * build_r4000_tlbchange_handler_head spots a huge page.
@@ -2077,7 +2102,7 @@ static void __cpuinit build_r4000_tlb_store_handler(void)
2077 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n", 2102 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n",
2078 (unsigned int)(p - handle_tlbs)); 2103 (unsigned int)(p - handle_tlbs));
2079 2104
2080 dump_handler(handle_tlbs, ARRAY_SIZE(handle_tlbs)); 2105 dump_handler("r4000_tlb_store", handle_tlbs, ARRAY_SIZE(handle_tlbs));
2081} 2106}
2082 2107
2083static void __cpuinit build_r4000_tlb_modify_handler(void) 2108static void __cpuinit build_r4000_tlb_modify_handler(void)
@@ -2099,7 +2124,7 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
2099 build_make_write(&p, &r, wr.r1, wr.r2); 2124 build_make_write(&p, &r, wr.r1, wr.r2);
2100 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2); 2125 build_r4000_tlbchange_handler_tail(&p, &l, &r, wr.r1, wr.r2);
2101 2126
2102#ifdef CONFIG_HUGETLB_PAGE 2127#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
2103 /* 2128 /*
2104 * This is the entry point when 2129 * This is the entry point when
2105 * build_r4000_tlbchange_handler_head spots a huge page. 2130 * build_r4000_tlbchange_handler_head spots a huge page.
@@ -2125,7 +2150,7 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
2125 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n", 2150 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n",
2126 (unsigned int)(p - handle_tlbm)); 2151 (unsigned int)(p - handle_tlbm));
2127 2152
2128 dump_handler(handle_tlbm, ARRAY_SIZE(handle_tlbm)); 2153 dump_handler("r4000_tlb_modify", handle_tlbm, ARRAY_SIZE(handle_tlbm));
2129} 2154}
2130 2155
2131void __cpuinit build_tlb_refill_handler(void) 2156void __cpuinit build_tlb_refill_handler(void)
@@ -2137,6 +2162,8 @@ void __cpuinit build_tlb_refill_handler(void)
2137 */ 2162 */
2138 static int run_once = 0; 2163 static int run_once = 0;
2139 2164
2165 output_pgtable_bits_defines();
2166
2140#ifdef CONFIG_64BIT 2167#ifdef CONFIG_64BIT
2141 check_for_high_segbits = current_cpu_data.vmbits > (PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3); 2168 check_for_high_segbits = current_cpu_data.vmbits > (PGDIR_SHIFT + PGD_ORDER + PAGE_SHIFT - 3);
2142#endif 2169#endif