Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Add minimal support for OCTEON3 to c-r4k.c

These are needed to boot a generic mips64r2 kernel on OCTEONIII.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7003/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

David Daney and committed by
Ralf Baechle
18a8cd63 35d04706

+46 -4
+2
arch/mips/include/asm/r4kcache.h
··· 523 523 __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, ) 524 524 __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, ) 525 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, ) 526 528 __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, ) 527 529 528 530 __BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, )
+44 -4
arch/mips/mm/c-r4k.c
··· 109 109 blast_dcache64_page(addr); 110 110 } 111 111 112 + static inline void r4k_blast_dcache_page_dc128(unsigned long addr) 113 + { 114 + blast_dcache128_page(addr); 115 + } 116 + 112 117 static void r4k_blast_dcache_page_setup(void) 113 118 { 114 119 unsigned long dc_lsize = cpu_dcache_line_size(); 115 120 116 - if (dc_lsize == 0) 121 + switch (dc_lsize) { 122 + case 0: 117 123 r4k_blast_dcache_page = (void *)cache_noop; 118 - else if (dc_lsize == 16) 124 + break; 125 + case 16: 119 126 r4k_blast_dcache_page = blast_dcache16_page; 120 - else if (dc_lsize == 32) 127 + break; 128 + case 32: 121 129 r4k_blast_dcache_page = r4k_blast_dcache_page_dc32; 122 - else if (dc_lsize == 64) 130 + break; 131 + case 64: 123 132 r4k_blast_dcache_page = r4k_blast_dcache_page_dc64; 133 + break; 134 + case 128: 135 + r4k_blast_dcache_page = r4k_blast_dcache_page_dc128; 136 + break; 137 + default: 138 + break; 139 + } 124 140 } 125 141 126 142 #ifndef CONFIG_EVA ··· 175 159 r4k_blast_dcache_page_indexed = blast_dcache32_page_indexed; 176 160 else if (dc_lsize == 64) 177 161 r4k_blast_dcache_page_indexed = blast_dcache64_page_indexed; 162 + else if (dc_lsize == 128) 163 + r4k_blast_dcache_page_indexed = blast_dcache128_page_indexed; 178 164 } 179 165 180 166 void (* r4k_blast_dcache)(void); ··· 194 176 r4k_blast_dcache = blast_dcache32; 195 177 else if (dc_lsize == 64) 196 178 r4k_blast_dcache = blast_dcache64; 179 + else if (dc_lsize == 128) 180 + r4k_blast_dcache = blast_dcache128; 197 181 } 198 182 199 183 /* force code alignment (used for TX49XX_ICACHE_INDEX_INV_WAR) */ ··· 285 265 r4k_blast_icache_page = blast_icache32_page; 286 266 else if (ic_lsize == 64) 287 267 r4k_blast_icache_page = blast_icache64_page; 268 + else if (ic_lsize == 128) 269 + r4k_blast_icache_page = blast_icache128_page; 288 270 } 289 271 290 272 #ifndef CONFIG_EVA ··· 360 338 r4k_blast_icache = blast_icache32; 361 339 } else if (ic_lsize == 64) 362 340 r4k_blast_icache = blast_icache64; 341 + else if (ic_lsize == 128) 342 + r4k_blast_icache = blast_icache128; 363 343 } 364 344 365 345 static void (* r4k_blast_scache_page)(unsigned long addr); ··· 1118 1094 c->dcache.waybit = 0; 1119 1095 break; 1120 1096 1097 + case CPU_CAVIUM_OCTEON3: 1098 + /* For now lie about the number of ways. */ 1099 + c->icache.linesz = 128; 1100 + c->icache.sets = 16; 1101 + c->icache.ways = 8; 1102 + c->icache.flags |= MIPS_CACHE_VTAG; 1103 + icache_size = c->icache.sets * c->icache.ways * c->icache.linesz; 1104 + 1105 + c->dcache.linesz = 128; 1106 + c->dcache.ways = 8; 1107 + c->dcache.sets = 8; 1108 + dcache_size = c->dcache.sets * c->dcache.ways * c->dcache.linesz; 1109 + c->options |= MIPS_CPU_PREFETCH; 1110 + break; 1111 + 1121 1112 default: 1122 1113 if (!(config & MIPS_CONF_M)) 1123 1114 panic("Don't know how to probe P-caches on this cpu."); ··· 1453 1414 loongson3_sc_init(); 1454 1415 return; 1455 1416 1417 + case CPU_CAVIUM_OCTEON3: 1456 1418 case CPU_XLP: 1457 1419 /* don't need to worry about L2, fully coherent */ 1458 1420 return;