MIPS: Flush TLB handlers directly after writing them
authorJonas Gorski <jogo@openwrt.org>
Fri, 21 Jun 2013 17:48:48 +0000 (17:48 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 25 Jun 2013 15:48:06 +0000 (17:48 +0200)
commita3d9086bb121a6459c9ed0452e3c58891a504785
tree99f9d81a1781e4a563dd4a20277ec4a99a49668f
parent6a72015d3c3602dd969e79510486807c481a0e1b
MIPS: Flush TLB handlers directly after writing them

When having enabled MIPS_PGD_C0_CONTEXT, trap_init() might call the
generated tlbmiss_handler_setup_pgd before it was committed to memory,
causing boot failures:

  trap_init()
   |- per_cpu_trap_init()
   |   |- TLBMISS_HANDLER_SETUP()
   |       |- tlbmiss_handler_setup_pgd()
   |- flush_tlb_handlers()

To avoid this, move flush_tlb_handlers() into build_tlb_refill_handler()
right after they were generated. We can do this as the cache handling is
initialized just before creating the tlb handlers.

This issue was introduced in 3d8bfdd0307223de678962f1c1907a7cec549136
("MIPS: Use C0_KScratch (if present) to hold PGD pointer.").

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Jayachandran C <jchandra@broadcom.com>
Cc: David Daney <david.daney@cavium.com>
Patchwork: https://patchwork.linux-mips.org/patch/5539/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/traps.c
arch/mips/mm/tlbex.c