Skip to content

Commit 5ae7e03

Browse files
FlyGoattsbogend
authored andcommitted
MIPS: cevt-r4k: Offset the value used to clear compare interrupt
In c0_compare_int_usable we clear compare interrupt by write value just read out from counter to compare register. However sometimes if those all instructions are graduated together then it's possible that at the time compare register is written, the counter haven't progressed, thus the interrupt is triggered again. It also applies to QEMU that instructions is executed significantly faster then counter. Offset the value used to clear interrupt by one to prevent that happen. Signed-off-by: Jiaxun Yang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent fea8826 commit 5ae7e03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/mips/kernel/cevt-r4k.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ int c0_compare_int_usable(void)
200200
*/
201201
if (c0_compare_int_pending()) {
202202
cnt = read_c0_count();
203-
write_c0_compare(cnt);
203+
write_c0_compare(cnt - 1);
204204
back_to_back_c0_hazard();
205205
while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS))
206206
if (!c0_compare_int_pending())
@@ -228,7 +228,7 @@ int c0_compare_int_usable(void)
228228
if (!c0_compare_int_pending())
229229
return 0;
230230
cnt = read_c0_count();
231-
write_c0_compare(cnt);
231+
write_c0_compare(cnt - 1);
232232
back_to_back_c0_hazard();
233233
while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS))
234234
if (!c0_compare_int_pending())

0 commit comments

Comments
 (0)