Skip to content

Commit 07e6a6d

Browse files
SiarheiVolkautsbogend
authored andcommitted
MIPS: Take in account load hazards for HI/LO restoring
MIPS CPUs usually have 1 to 4 cycles load hazards, thus doing load and right after move to HI/LO will usually stall the pipeline for significant amount of time. Let's take it into account and separate loads and mthi/lo in instruction sequence. The patch uses t6 and t7 registers as temporaries in addition to t8. The patch tries to deal with SmartMIPS, but I know little about and haven't tested it. Changes in v2: - clear separation of actions for SmartMIPS and pre-MIPSR6. Signed-off-by: Siarhei Volkau <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent bfe4ab9 commit 07e6a6d

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

arch/mips/include/asm/stackframe.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,17 +308,12 @@
308308
jal octeon_mult_restore
309309
#endif
310310
#ifdef CONFIG_CPU_HAS_SMARTMIPS
311-
LONG_L $24, PT_ACX(sp)
312-
mtlhx $24
313-
LONG_L $24, PT_HI(sp)
314-
mtlhx $24
311+
LONG_L $14, PT_ACX(sp)
315312
LONG_L $24, PT_LO(sp)
316-
mtlhx $24
313+
LONG_L $15, PT_HI(sp)
317314
#elif !defined(CONFIG_CPU_MIPSR6)
318315
LONG_L $24, PT_LO(sp)
319-
mtlo $24
320-
LONG_L $24, PT_HI(sp)
321-
mthi $24
316+
LONG_L $15, PT_HI(sp)
322317
#endif
323318
#ifdef CONFIG_32BIT
324319
cfi_ld $8, PT_R8, \docfi
@@ -327,6 +322,14 @@
327322
cfi_ld $10, PT_R10, \docfi
328323
cfi_ld $11, PT_R11, \docfi
329324
cfi_ld $12, PT_R12, \docfi
325+
#ifdef CONFIG_CPU_HAS_SMARTMIPS
326+
mtlhx $14
327+
mtlhx $15
328+
mtlhx $24
329+
#elif !defined(CONFIG_CPU_MIPSR6)
330+
mtlo $24
331+
mthi $15
332+
#endif
330333
cfi_ld $13, PT_R13, \docfi
331334
cfi_ld $14, PT_R14, \docfi
332335
cfi_ld $15, PT_R15, \docfi

0 commit comments

Comments
 (0)