From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>, linux-mips@vger.kernel.org
Cc: tsbogend@alpha.franken.de
Subject: Re: [PATCH 2/2] MIPS: cevt-r4k: Offset counter value for clearing compare interrupt
Date: Sun, 26 Feb 2023 23:04:42 +0100 [thread overview]
Message-ID: <a2560752-f8b2-4b3f-7395-cc33cab7cfe0@linaro.org> (raw)
In-Reply-To: <20230225221008.8520-3-jiaxun.yang@flygoat.com>
On 25/2/23 23:10, Jiaxun Yang wrote:
> 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 execuated significantly
Typo "executed",
> faster then counter.
>
> Offset the counter value a litlle bit to prevent that happen.
"little".
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> arch/mips/kernel/cevt-r4k.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
> index 32ec67c9ab67..bbc422376e97 100644
> --- a/arch/mips/kernel/cevt-r4k.c
> +++ b/arch/mips/kernel/cevt-r4k.c
> @@ -200,6 +200,8 @@ int c0_compare_int_usable(void)
> */
> if (c0_compare_int_pending()) {
> cnt = read_c0_count();
> + // Drawdown a little bit in case counter haven't progressed
> + cnt -= COMPARE_INT_SEEN_TICKS;
> write_c0_compare(cnt);
> back_to_back_c0_hazard();
> while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS))
> @@ -228,6 +230,7 @@ int c0_compare_int_usable(void)
> if (!c0_compare_int_pending())
> return 0;
> cnt = read_c0_count();
> + cnt -= COMPARE_INT_SEEN_TICKS;
> write_c0_compare(cnt);
> back_to_back_c0_hazard();
> while (read_c0_count() < (cnt + COMPARE_INT_SEEN_TICKS))
next prev parent reply other threads:[~2023-02-26 22:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-25 22:10 [PATCH 0/2] MIPS Booting fixes Jiaxun Yang
2023-02-25 22:10 ` [PATCH 1/2] MIPS: smp-cps: Don't rely on CP0_CMGCRBASE Jiaxun Yang
2023-02-27 11:59 ` Thomas Bogendoerfer
2023-02-25 22:10 ` [PATCH 2/2] MIPS: cevt-r4k: Offset counter value for clearing compare interrupt Jiaxun Yang
2023-02-26 22:04 ` Philippe Mathieu-Daudé [this message]
2023-02-26 23:23 ` Thomas Bogendoerfer
2023-02-27 1:22 ` Jiaxun Yang
2023-02-27 9:31 ` Thomas Bogendoerfer
2023-02-27 11:44 ` Jiaxun Yang
2023-02-27 16:48 ` Thomas Bogendoerfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2560752-f8b2-4b3f-7395-cc33cab7cfe0@linaro.org \
--to=philmd@linaro.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).