summaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorJiaxun Yang <jiaxun.yang@flygoat.com>2023-02-27 19:46:14 +0100
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2023-02-27 23:45:17 +0100
commit5ae7e037de566c3106c0fa951bbf35fd6370fdf6 (patch)
tree11887ebe9492bdd26b7d3acc49d32a97f61a6039 /arch/mips
parentMIPS: smp-cps: Don't rely on CP0_CMGCRBASE (diff)
downloadlinux-5ae7e037de566c3106c0fa951bbf35fd6370fdf6.tar.xz
linux-5ae7e037de566c3106c0fa951bbf35fd6370fdf6.zip
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 <jiaxun.yang@flygoat.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/cevt-r4k.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 32ec67c9ab67..368e8475870f 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -200,7 +200,7 @@ int c0_compare_int_usable(void)
*/
if (c0_compare_int_pending()) {
cnt = read_c0_count();
- write_c0_compare(cnt);
+ write_c0_compare(cnt - 1);
back_to_back_c0_hazard();
while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS))
if (!c0_compare_int_pending())
@@ -228,7 +228,7 @@ int c0_compare_int_usable(void)
if (!c0_compare_int_pending())
return 0;
cnt = read_c0_count();
- write_c0_compare(cnt);
+ write_c0_compare(cnt - 1);
back_to_back_c0_hazard();
while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS))
if (!c0_compare_int_pending())