git: fc44154841fc - main - vmm: Re-arm the PIT callout for square wave mode

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 21 Sep 2026 16:41:26 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=fc44154841fc2ebb1530a10cad719edb58559a88

commit fc44154841fc2ebb1530a10cad719edb58559a88
Author:     Hayzam Sherif <hayzam@gmail.com>
AuthorDate: 2026-09-21 16:34:37 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-09-21 16:36:11 +0000

    vmm: Re-arm the PIT callout for square wave mode
    
    The 8254's square wave mode (mode 3) is periodic, with the same
    interrupt rate as the rate generator mode (mode 2), but
    vatpit_callout_handler() only re-arms the channel 0 callout for
    TIMER_RATEGEN.  A guest that programs mode 3 therefore receives a
    single IRQ0 and no further timer interrupts.
    
    Re-arm the callout for TIMER_SQWAVE as well, matching illumos
    change 13301.
    
    Reviewed by:    markj
    Obtained from:  illumos 93d78aba5b32996fc2ae893a6237a0d3972f86b2
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59816
---
 sys/amd64/vmm/io/vatpit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/amd64/vmm/io/vatpit.c b/sys/amd64/vmm/io/vatpit.c
index 595c2e070c7a..bdc93d2b8e27 100644
--- a/sys/amd64/vmm/io/vatpit.c
+++ b/sys/amd64/vmm/io/vatpit.c
@@ -165,7 +165,7 @@ vatpit_callout_handler(void *a)
 
 	callout_deactivate(callout);
 
-	if (c->mode == TIMER_RATEGEN) {
+	if (c->mode == TIMER_RATEGEN || c->mode == TIMER_SQWAVE) {
 		pit_timer_start_cntr0(vatpit);
 	}