MIPS: asm: pgtable: Add c0 hazards on HTW start/stop sequences
authorMarkos Chandras <markos.chandras@imgtec.com>
Mon, 26 Jan 2015 09:40:34 +0000 (09:40 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 16 Feb 2015 09:55:26 +0000 (10:55 +0100)
When we use htw_{start,stop}() outside of htw_reset(), we need
to ensure that c0 changes have been propagated properly before
we attempt to continue with subsequence memory operations.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: <stable@vger.kernel.org> # 3.17+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9114/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/pgtable.h

index 62a6ba383d4fdfb4167c55a3d782f38d8f727dd8..45d7fd5e1466f74875c98b15a72c64123379c1c0 100644 (file)
@@ -99,16 +99,20 @@ extern void paging_init(void);
 
 #define htw_stop()                                                     \
 do {                                                                   \
-       if (cpu_has_htw)                                                \
+       if (cpu_has_htw) {                                              \
                write_c0_pwctl(read_c0_pwctl() &                        \
                               ~(1 << MIPS_PWCTL_PWEN_SHIFT));          \
+               back_to_back_c0_hazard();                               \
+       }                                                               \
 } while(0)
 
 #define htw_start()                                                    \
 do {                                                                   \
-       if (cpu_has_htw)                                                \
+       if (cpu_has_htw) {                                              \
                write_c0_pwctl(read_c0_pwctl() |                        \
                               (1 << MIPS_PWCTL_PWEN_SHIFT));           \
+               back_to_back_c0_hazard();                               \
+       }                                                               \
 } while(0)
 
 
@@ -116,9 +120,7 @@ do {                                                                        \
 do {                                                                   \
        if (cpu_has_htw) {                                              \
                htw_stop();                                             \
-               back_to_back_c0_hazard();                               \
                htw_start();                                            \
-               back_to_back_c0_hazard();                               \
        }                                                               \
 } while(0)