Skip to content

Commit

Permalink
timer/i8254: Fix one shot PIT mode
Browse files Browse the repository at this point in the history
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>

Message-Id: <20230226015755.52624-1-damien@zamaudio.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
zamaudio authored and mstsirkin committed Oct 18, 2023
1 parent 88638e8 commit 83def49
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions hw/timer/i8254_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
case 1:
out = (d < s->count);
out = (d >= s->count);
break;
case 2:
if ((d % s->count) == 0 && d != 0) {
Expand Down

0 comments on commit 83def49

Please sign in to comment.