aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHayzam Sherif <hayzam@gmail.com>2026-09-21 16:33:36 +0000
committerMark Johnston <markj@FreeBSD.org>2026-09-21 16:35:58 +0000
commit3330226fd33ae6b747c9edc97315244360ad5e54 (patch)
tree470a51a8b67e9c249d25819058ff1630a7758984
parent51234535ddd6ec0afe9dd4e3f34a31b92d5cdd78 (diff)
vmm: Normalize a zero PIT count before starting channel 0
pit_timer_start_cntr0() does not schedule a callout when the initial count is zero. The counter write handler normalizes a programmed zero count only after calling it, leaving an initially unarmed channel 0 without a scheduled timer event. Move the existing normalization before the timer-start call. Retain the historical 0xffff representation of a zero count. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59749
-rw-r--r--sys/amd64/vmm/io/vatpit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/amd64/vmm/io/vatpit.c b/sys/amd64/vmm/io/vatpit.c
index 31b6c2ad0f89..595c2e070c7a 100644
--- a/sys/amd64/vmm/io/vatpit.c
+++ b/sys/amd64/vmm/io/vatpit.c
@@ -401,14 +401,14 @@ vatpit_handler(struct vm *vm, bool in, int port, int bytes, uint32_t *eax)
c->frbyte = 0;
c->crbyte = 0;
c->initial = c->cr[0] | (uint16_t)c->cr[1] << 8;
+ if (c->initial == 0)
+ c->initial = 0xffff;
binuptime(&c->now_bt);
/* Start an interval timer for channel 0 */
if (port == TIMER_CNTR0) {
c->callout_bt = c->now_bt;
pit_timer_start_cntr0(vatpit);
}
- if (c->initial == 0)
- c->initial = 0xffff;
}
}
VATPIT_UNLOCK(vatpit);