git: c47d9aa11337 - stable/15 - vmm: Re-arm the PIT callout for square wave mode

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 22 Oct 2026 17:31:55 UTC
The branch stable/15 has been updated by markj:

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

commit c47d9aa113375219284a480955deb221f39436f2
Author:     Hayzam Sherif <hayzam@gmail.com>
AuthorDate: 2026-09-21 16:34:37 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-10-22 15:45:40 +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
    
    (cherry picked from commit fc44154841fc2ebb1530a10cad719edb58559a88)
---
 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);
 	}