From: Damien Zammit Date: Sun, 26 Feb 2023 01:58:10 +0000 (+0000) Subject: timer/i8254: Fix one shot PIT mode X-Git-Tag: v8.2.0-rc0~53^2~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74d7ea50627a60257a92e77402780897075654fd;p=thirdparty%2Fqemu.git timer/i8254: Fix one shot PIT mode 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 Message-Id: <20230226015755.52624-1-damien@zamaudio.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c index e4093e29040..b25da448c86 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; case 1: - out = (d < s->count); + out = (d >= s->count); break; case 2: if ((d % s->count) == 0 && d != 0) {