git: 3330226fd33a - main - vmm: Normalize a zero PIT count before starting channel 0
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Sep 2026 16:41:23 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=3330226fd33ae6b747c9edc97315244360ad5e54
commit 3330226fd33ae6b747c9edc97315244360ad5e54
Author: Hayzam Sherif <hayzam@gmail.com>
AuthorDate: 2026-09-21 16:33:36 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-09-21 16:35:58 +0000
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
---
sys/amd64/vmm/io/vatpit.c | 4 ++--
1 file 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);