diff options
Diffstat (limited to 'arch/mips/mm')
| -rw-r--r-- | arch/mips/mm/Makefile | 4 | ||||
| -rw-r--r-- | arch/mips/mm/c-r4k.c | 5 | ||||
| -rw-r--r-- | arch/mips/mm/page-funcs.S | 50 | ||||
| -rw-r--r-- | arch/mips/mm/page.c | 67 | ||||
| -rw-r--r-- | arch/mips/mm/tlbex.c | 2 |
5 files changed, 75 insertions, 53 deletions
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile index 4aa20280613e..fd6203f14f1f 100644 --- a/arch/mips/mm/Makefile +++ b/arch/mips/mm/Makefile | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-y += cache.o dma-default.o extable.o fault.o \ | 5 | obj-y += cache.o dma-default.o extable.o fault.o \ |
| 6 | gup.o init.o mmap.o page.o tlbex.o \ | 6 | gup.o init.o mmap.o page.o page-funcs.o \ |
| 7 | tlbex-fault.o uasm.o | 7 | tlbex.o tlbex-fault.o uasm.o |
| 8 | 8 | ||
| 9 | obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o | 9 | obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o |
| 10 | obj-$(CONFIG_64BIT) += pgtable-64.o | 10 | obj-$(CONFIG_64BIT) += pgtable-64.o |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 5109be96d98d..f092c265dc63 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
| @@ -977,7 +977,7 @@ static void __cpuinit probe_pcache(void) | |||
| 977 | c->icache.linesz = 2 << lsize; | 977 | c->icache.linesz = 2 << lsize; |
| 978 | else | 978 | else |
| 979 | c->icache.linesz = lsize; | 979 | c->icache.linesz = lsize; |
| 980 | c->icache.sets = 64 << ((config1 >> 22) & 7); | 980 | c->icache.sets = 32 << (((config1 >> 22) + 1) & 7); |
| 981 | c->icache.ways = 1 + ((config1 >> 16) & 7); | 981 | c->icache.ways = 1 + ((config1 >> 16) & 7); |
| 982 | 982 | ||
| 983 | icache_size = c->icache.sets * | 983 | icache_size = c->icache.sets * |
| @@ -997,7 +997,7 @@ static void __cpuinit probe_pcache(void) | |||
| 997 | c->dcache.linesz = 2 << lsize; | 997 | c->dcache.linesz = 2 << lsize; |
| 998 | else | 998 | else |
| 999 | c->dcache.linesz= lsize; | 999 | c->dcache.linesz= lsize; |
| 1000 | c->dcache.sets = 64 << ((config1 >> 13) & 7); | 1000 | c->dcache.sets = 32 << (((config1 >> 13) + 1) & 7); |
| 1001 | c->dcache.ways = 1 + ((config1 >> 7) & 7); | 1001 | c->dcache.ways = 1 + ((config1 >> 7) & 7); |
| 1002 | 1002 | ||
| 1003 | dcache_size = c->dcache.sets * | 1003 | dcache_size = c->dcache.sets * |
| @@ -1051,6 +1051,7 @@ static void __cpuinit probe_pcache(void) | |||
| 1051 | case CPU_R14000: | 1051 | case CPU_R14000: |
| 1052 | break; | 1052 | break; |
| 1053 | 1053 | ||
| 1054 | case CPU_M14KC: | ||
| 1054 | case CPU_24K: | 1055 | case CPU_24K: |
| 1055 | case CPU_34K: | 1056 | case CPU_34K: |
| 1056 | case CPU_74K: | 1057 | case CPU_74K: |
diff --git a/arch/mips/mm/page-funcs.S b/arch/mips/mm/page-funcs.S new file mode 100644 index 000000000000..48a6b38ff13e --- /dev/null +++ b/arch/mips/mm/page-funcs.S | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | /* | ||
| 2 | * This file is subject to the terms and conditions of the GNU General Public | ||
| 3 | * License. See the file "COPYING" in the main directory of this archive | ||
| 4 | * for more details. | ||
| 5 | * | ||
| 6 | * Micro-assembler generated clear_page/copy_page functions. | ||
| 7 | * | ||
| 8 | * Copyright (C) 2012 MIPS Technologies, Inc. | ||
| 9 | * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org> | ||
| 10 | */ | ||
| 11 | #include <asm/asm.h> | ||
| 12 | #include <asm/regdef.h> | ||
| 13 | |||
| 14 | #ifdef CONFIG_SIBYTE_DMA_PAGEOPS | ||
| 15 | #define cpu_clear_page_function_name clear_page_cpu | ||
| 16 | #define cpu_copy_page_function_name copy_page_cpu | ||
| 17 | #else | ||
| 18 | #define cpu_clear_page_function_name clear_page | ||
| 19 | #define cpu_copy_page_function_name copy_page | ||
| 20 | #endif | ||
| 21 | |||
| 22 | /* | ||
| 23 | * Maximum sizes: | ||
| 24 | * | ||
| 25 | * R4000 128 bytes S-cache: 0x058 bytes | ||
| 26 | * R4600 v1.7: 0x05c bytes | ||
| 27 | * R4600 v2.0: 0x060 bytes | ||
| 28 | * With prefetching, 16 word strides 0x120 bytes | ||
| 29 | */ | ||
| 30 | EXPORT(__clear_page_start) | ||
| 31 | LEAF(cpu_clear_page_function_name) | ||
| 32 | 1: j 1b /* Dummy, will be replaced. */ | ||
| 33 | .space 288 | ||
| 34 | END(cpu_clear_page_function_name) | ||
| 35 | EXPORT(__clear_page_end) | ||
| 36 | |||
| 37 | /* | ||
| 38 | * Maximum sizes: | ||
| 39 | * | ||
| 40 | * R4000 128 bytes S-cache: 0x11c bytes | ||
| 41 | * R4600 v1.7: 0x080 bytes | ||
| 42 | * R4600 v2.0: 0x07c bytes | ||
| 43 | * With prefetching, 16 word strides 0x540 bytes | ||
| 44 | */ | ||
| 45 | EXPORT(__copy_page_start) | ||
| 46 | LEAF(cpu_copy_page_function_name) | ||
| 47 | 1: j 1b /* Dummy, will be replaced. */ | ||
| 48 | .space 1344 | ||
| 49 | END(cpu_copy_page_function_name) | ||
| 50 | EXPORT(__copy_page_end) | ||
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c index cc0b626858b3..98f530e18216 100644 --- a/arch/mips/mm/page.c +++ b/arch/mips/mm/page.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * Copyright (C) 2003, 04, 05 Ralf Baechle (ralf@linux-mips.org) | 6 | * Copyright (C) 2003, 04, 05 Ralf Baechle (ralf@linux-mips.org) |
| 7 | * Copyright (C) 2007 Maciej W. Rozycki | 7 | * Copyright (C) 2007 Maciej W. Rozycki |
| 8 | * Copyright (C) 2008 Thiemo Seufer | 8 | * Copyright (C) 2008 Thiemo Seufer |
| 9 | * Copyright (C) 2012 MIPS Technologies, Inc. | ||
| 9 | */ | 10 | */ |
| 10 | #include <linux/init.h> | 11 | #include <linux/init.h> |
| 11 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
| @@ -71,45 +72,6 @@ static struct uasm_reloc __cpuinitdata relocs[5]; | |||
| 71 | #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010) | 72 | #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010) |
| 72 | #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020) | 73 | #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020) |
| 73 | 74 | ||
| 74 | /* | ||
| 75 | * Maximum sizes: | ||
| 76 | * | ||
| 77 | * R4000 128 bytes S-cache: 0x058 bytes | ||
| 78 | * R4600 v1.7: 0x05c bytes | ||
| 79 | * R4600 v2.0: 0x060 bytes | ||
| 80 | * With prefetching, 16 word strides 0x120 bytes | ||
| 81 | */ | ||
| 82 | |||
| 83 | static u32 clear_page_array[0x120 / 4]; | ||
| 84 | |||
| 85 | #ifdef CONFIG_SIBYTE_DMA_PAGEOPS | ||
| 86 | void clear_page_cpu(void *page) __attribute__((alias("clear_page_array"))); | ||
| 87 | #else | ||
| 88 | void clear_page(void *page) __attribute__((alias("clear_page_array"))); | ||
| 89 | #endif | ||
| 90 | |||
| 91 | EXPORT_SYMBOL(clear_page); | ||
| 92 | |||
| 93 | /* | ||
| 94 | * Maximum sizes: | ||
| 95 | * | ||
| 96 | * R4000 128 bytes S-cache: 0x11c bytes | ||
| 97 | * R4600 v1.7: 0x080 bytes | ||
| 98 | * R4600 v2.0: 0x07c bytes | ||
| 99 | * With prefetching, 16 word strides 0x540 bytes | ||
| 100 | */ | ||
| 101 | static u32 copy_page_array[0x540 / 4]; | ||
| 102 | |||
| 103 | #ifdef CONFIG_SIBYTE_DMA_PAGEOPS | ||
| 104 | void | ||
| 105 | copy_page_cpu(void *to, void *from) __attribute__((alias("copy_page_array"))); | ||
| 106 | #else | ||
| 107 | void copy_page(void *to, void *from) __attribute__((alias("copy_page_array"))); | ||
| 108 | #endif | ||
| 109 | |||
| 110 | EXPORT_SYMBOL(copy_page); | ||
| 111 | |||
| 112 | |||
| 113 | static int pref_bias_clear_store __cpuinitdata; | 75 | static int pref_bias_clear_store __cpuinitdata; |
| 114 | static int pref_bias_copy_load __cpuinitdata; | 76 | static int pref_bias_copy_load __cpuinitdata; |
| 115 | static int pref_bias_copy_store __cpuinitdata; | 77 | static int pref_bias_copy_store __cpuinitdata; |
| @@ -282,10 +244,15 @@ static inline void __cpuinit build_clear_pref(u32 **buf, int off) | |||
| 282 | } | 244 | } |
| 283 | } | 245 | } |
| 284 | 246 | ||
| 247 | extern u32 __clear_page_start; | ||
| 248 | extern u32 __clear_page_end; | ||
| 249 | extern u32 __copy_page_start; | ||
| 250 | extern u32 __copy_page_end; | ||
| 251 | |||
| 285 | void __cpuinit build_clear_page(void) | 252 | void __cpuinit build_clear_page(void) |
| 286 | { | 253 | { |
| 287 | int off; | 254 | int off; |
| 288 | u32 *buf = (u32 *)&clear_page_array; | 255 | u32 *buf = &__clear_page_start; |
| 289 | struct uasm_label *l = labels; | 256 | struct uasm_label *l = labels; |
| 290 | struct uasm_reloc *r = relocs; | 257 | struct uasm_reloc *r = relocs; |
| 291 | int i; | 258 | int i; |
| @@ -356,17 +323,17 @@ void __cpuinit build_clear_page(void) | |||
| 356 | uasm_i_jr(&buf, RA); | 323 | uasm_i_jr(&buf, RA); |
| 357 | uasm_i_nop(&buf); | 324 | uasm_i_nop(&buf); |
| 358 | 325 | ||
| 359 | BUG_ON(buf > clear_page_array + ARRAY_SIZE(clear_page_array)); | 326 | BUG_ON(buf > &__clear_page_end); |
| 360 | 327 | ||
| 361 | uasm_resolve_relocs(relocs, labels); | 328 | uasm_resolve_relocs(relocs, labels); |
| 362 | 329 | ||
| 363 | pr_debug("Synthesized clear page handler (%u instructions).\n", | 330 | pr_debug("Synthesized clear page handler (%u instructions).\n", |
| 364 | (u32)(buf - clear_page_array)); | 331 | (u32)(buf - &__clear_page_start)); |
| 365 | 332 | ||
| 366 | pr_debug("\t.set push\n"); | 333 | pr_debug("\t.set push\n"); |
| 367 | pr_debug("\t.set noreorder\n"); | 334 | pr_debug("\t.set noreorder\n"); |
| 368 | for (i = 0; i < (buf - clear_page_array); i++) | 335 | for (i = 0; i < (buf - &__clear_page_start); i++) |
| 369 | pr_debug("\t.word 0x%08x\n", clear_page_array[i]); | 336 | pr_debug("\t.word 0x%08x\n", (&__clear_page_start)[i]); |
| 370 | pr_debug("\t.set pop\n"); | 337 | pr_debug("\t.set pop\n"); |
| 371 | } | 338 | } |
| 372 | 339 | ||
| @@ -427,7 +394,7 @@ static inline void build_copy_store_pref(u32 **buf, int off) | |||
| 427 | void __cpuinit build_copy_page(void) | 394 | void __cpuinit build_copy_page(void) |
| 428 | { | 395 | { |
| 429 | int off; | 396 | int off; |
| 430 | u32 *buf = (u32 *)©_page_array; | 397 | u32 *buf = &__copy_page_start; |
| 431 | struct uasm_label *l = labels; | 398 | struct uasm_label *l = labels; |
| 432 | struct uasm_reloc *r = relocs; | 399 | struct uasm_reloc *r = relocs; |
| 433 | int i; | 400 | int i; |
| @@ -595,21 +562,23 @@ void __cpuinit build_copy_page(void) | |||
| 595 | uasm_i_jr(&buf, RA); | 562 | uasm_i_jr(&buf, RA); |
| 596 | uasm_i_nop(&buf); | 563 | uasm_i_nop(&buf); |
| 597 | 564 | ||
| 598 | BUG_ON(buf > copy_page_array + ARRAY_SIZE(copy_page_array)); | 565 | BUG_ON(buf > &__copy_page_end); |
| 599 | 566 | ||
| 600 | uasm_resolve_relocs(relocs, labels); | 567 | uasm_resolve_relocs(relocs, labels); |
| 601 | 568 | ||
| 602 | pr_debug("Synthesized copy page handler (%u instructions).\n", | 569 | pr_debug("Synthesized copy page handler (%u instructions).\n", |
| 603 | (u32)(buf - copy_page_array)); | 570 | (u32)(buf - &__copy_page_start)); |
| 604 | 571 | ||
| 605 | pr_debug("\t.set push\n"); | 572 | pr_debug("\t.set push\n"); |
| 606 | pr_debug("\t.set noreorder\n"); | 573 | pr_debug("\t.set noreorder\n"); |
| 607 | for (i = 0; i < (buf - copy_page_array); i++) | 574 | for (i = 0; i < (buf - &__copy_page_start); i++) |
| 608 | pr_debug("\t.word 0x%08x\n", copy_page_array[i]); | 575 | pr_debug("\t.word 0x%08x\n", (&__copy_page_start)[i]); |
| 609 | pr_debug("\t.set pop\n"); | 576 | pr_debug("\t.set pop\n"); |
| 610 | } | 577 | } |
| 611 | 578 | ||
| 612 | #ifdef CONFIG_SIBYTE_DMA_PAGEOPS | 579 | #ifdef CONFIG_SIBYTE_DMA_PAGEOPS |
| 580 | extern void clear_page_cpu(void *page); | ||
| 581 | extern void copy_page_cpu(void *to, void *from); | ||
| 613 | 582 | ||
| 614 | /* | 583 | /* |
| 615 | * Pad descriptors to cacheline, since each is exclusively owned by a | 584 | * Pad descriptors to cacheline, since each is exclusively owned by a |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 0bc485b3cd60..03eb0ef91580 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | * Copyright (C) 2005, 2007, 2008, 2009 Maciej W. Rozycki | 9 | * Copyright (C) 2005, 2007, 2008, 2009 Maciej W. Rozycki |
| 10 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) | 10 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) |
| 11 | * Copyright (C) 2008, 2009 Cavium Networks, Inc. | 11 | * Copyright (C) 2008, 2009 Cavium Networks, Inc. |
| 12 | * Copyright (C) 2011 MIPS Technologies, Inc. | ||
| 12 | * | 13 | * |
| 13 | * ... and the days got worse and worse and now you see | 14 | * ... and the days got worse and worse and now you see |
| 14 | * I've gone completly out of my mind. | 15 | * I've gone completly out of my mind. |
| @@ -494,6 +495,7 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l, | |||
| 494 | case CPU_R14000: | 495 | case CPU_R14000: |
| 495 | case CPU_4KC: | 496 | case CPU_4KC: |
| 496 | case CPU_4KEC: | 497 | case CPU_4KEC: |
| 498 | case CPU_M14KC: | ||
| 497 | case CPU_SB1: | 499 | case CPU_SB1: |
| 498 | case CPU_SB1A: | 500 | case CPU_SB1A: |
| 499 | case CPU_4KSC: | 501 | case CPU_4KSC: |
