diff options
author | Steven J. Hill <Steven.Hill@imgtec.com> | 2013-03-25 13:01:00 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-05-08 06:30:10 -0400 |
commit | f6b06d9361a008afb93b97fb3683a6e92d69d0f4 (patch) | |
tree | d20d41b15208c104dda388be9822886c0499d414 /arch/mips/mm/tlbex.c | |
parent | d532f3d26716a39dfd4b88d687bd344fbe77e390 (diff) |
MIPS: microMIPS: Support dynamic ASID sizing.
Changes for pure microMIPS cores to dynamically determine the ASID
size at boot time.
Includes bug fix https://patchwork.linux-mips.org/patch/5230/
Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Diffstat (limited to 'arch/mips/mm/tlbex.c')
-rw-r--r-- | arch/mips/mm/tlbex.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index e2a9e3687c45..fb4ca9984ed1 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -309,13 +309,32 @@ static int check_for_high_segbits __cpuinitdata; | |||
309 | static void __cpuinit insn_fixup(unsigned int **start, unsigned int **stop, | 309 | static void __cpuinit insn_fixup(unsigned int **start, unsigned int **stop, |
310 | unsigned int i_const) | 310 | unsigned int i_const) |
311 | { | 311 | { |
312 | unsigned int **p, *ip; | 312 | unsigned int **p; |
313 | 313 | ||
314 | for (p = start; p < stop; p++) { | 314 | for (p = start; p < stop; p++) { |
315 | #ifndef CONFIG_CPU_MICROMIPS | ||
316 | unsigned int *ip; | ||
317 | |||
315 | ip = *p; | 318 | ip = *p; |
316 | *ip = (*ip & 0xffff0000) | i_const; | 319 | *ip = (*ip & 0xffff0000) | i_const; |
320 | #else | ||
321 | unsigned short *ip; | ||
322 | |||
323 | ip = ((unsigned short *)((unsigned int)*p - 1)); | ||
324 | if ((*ip & 0xf000) == 0x4000) { | ||
325 | *ip &= 0xfff1; | ||
326 | *ip |= (i_const << 1); | ||
327 | } else if ((*ip & 0xf000) == 0x6000) { | ||
328 | *ip &= 0xfff1; | ||
329 | *ip |= ((i_const >> 2) << 1); | ||
330 | } else { | ||
331 | ip++; | ||
332 | *ip = i_const; | ||
333 | } | ||
334 | #endif | ||
335 | local_flush_icache_range((unsigned long)ip, | ||
336 | (unsigned long)ip + sizeof(*ip)); | ||
317 | } | 337 | } |
318 | local_flush_icache_range((unsigned long)*p, (unsigned long)((*p) + 1)); | ||
319 | } | 338 | } |
320 | 339 | ||
321 | #define asid_insn_fixup(section, const) \ | 340 | #define asid_insn_fixup(section, const) \ |
@@ -335,6 +354,14 @@ static void __cpuinit setup_asid(unsigned int inc, unsigned int mask, | |||
335 | extern asmlinkage void handle_ri_rdhwr_vivt(void); | 354 | extern asmlinkage void handle_ri_rdhwr_vivt(void); |
336 | unsigned long *vivt_exc; | 355 | unsigned long *vivt_exc; |
337 | 356 | ||
357 | #ifdef CONFIG_CPU_MICROMIPS | ||
358 | /* | ||
359 | * Worst case optimised microMIPS addiu instructions support | ||
360 | * only a 3-bit immediate value. | ||
361 | */ | ||
362 | if(inc > 7) | ||
363 | panic("Invalid ASID increment value!"); | ||
364 | #endif | ||
338 | asid_insn_fixup(__asid_inc, inc); | 365 | asid_insn_fixup(__asid_inc, inc); |
339 | asid_insn_fixup(__asid_mask, mask); | 366 | asid_insn_fixup(__asid_mask, mask); |
340 | asid_insn_fixup(__asid_version_mask, version_mask); | 367 | asid_insn_fixup(__asid_version_mask, version_mask); |
@@ -342,6 +369,9 @@ static void __cpuinit setup_asid(unsigned int inc, unsigned int mask, | |||
342 | 369 | ||
343 | /* Patch up the 'handle_ri_rdhwr_vivt' handler. */ | 370 | /* Patch up the 'handle_ri_rdhwr_vivt' handler. */ |
344 | vivt_exc = (unsigned long *) &handle_ri_rdhwr_vivt; | 371 | vivt_exc = (unsigned long *) &handle_ri_rdhwr_vivt; |
372 | #ifdef CONFIG_CPU_MICROMIPS | ||
373 | vivt_exc = (unsigned long *)((unsigned long) vivt_exc - 1); | ||
374 | #endif | ||
345 | vivt_exc++; | 375 | vivt_exc++; |
346 | *vivt_exc = (*vivt_exc & ~mask) | mask; | 376 | *vivt_exc = (*vivt_exc & ~mask) | mask; |
347 | 377 | ||