From: "Michael S. Tsirkin" <mst@redhat.com>
To: Damien Zammit <damien@zamaudio.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH qemu] timer/i8254: Fix one shot PIT mode
Date: Sun, 26 Feb 2023 03:51:00 -0500 [thread overview]
Message-ID: <20230226035018-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20230226015755.52624-1-damien@zamaudio.com>
On Sun, Feb 26, 2023 at 01:58:10AM +0000, Damien Zammit wrote:
> Currently, the one-shot (mode 1) PIT expires far too quickly,
> due to the output being set under the wrong logic.
> This change fixes the one-shot PIT mode to behave similarly to mode 0.
>
> TESTED: using the one-shot PIT mode to calibrate a local apic timer.
>
> Signed-off-by: Damien Zammit <damien@zamaudio.com>
>
> ---
> hw/timer/i8254_common.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
> index 050875b497..9164576ca9 100644
> --- a/hw/timer/i8254_common.c
> +++ b/hw/timer/i8254_common.c
> @@ -52,10 +52,8 @@ int pit_get_out(PITChannelState *s, int64_t current_time)
> switch (s->mode) {
> default:
> case 0:
> - out = (d >= s->count);
> - break;
I think you need something like
/* FALLTHRU */
here otherwise some gcc versions will warn.
> case 1:
> - out = (d < s->count);
> + out = (d >= s->count);
> break;
> case 2:
> if ((d % s->count) == 0 && d != 0) {
> --
> 2.39.0
>
next prev parent reply other threads:[~2023-02-26 8:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-26 1:58 [PATCH qemu] timer/i8254: Fix one shot PIT mode Damien Zammit
2023-02-26 8:51 ` Michael S. Tsirkin [this message]
2023-02-26 9:17 ` Damien Zammit
2023-02-26 9:45 ` Max Filippov
2023-02-26 12:11 ` BALATON Zoltan
2023-02-26 13:03 ` Michael S. Tsirkin
2023-05-15 16:15 ` Michael Tokarev
-- strict thread matches above, loose matches on Subject: below --
2023-10-06 2:36 Damien Zammit
2023-10-06 5:19 ` Michael S. Tsirkin
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=20230226035018-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=damien@zamaudio.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).