From 403184f58c4b3b5dc6f0cfa34da48157c0fadd5a Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Thu, 12 Nov 2026 18:26:52 -0800 Subject: [PATCH 1/2] openvmm: pin the RTC's zero-extended wide reads OpenVMM's emulated CMOS RTC stored only the first byte of a read of its ports, 0x70 and 0x71, although its comment says that a wider read returns the register's byte zero-extended to the size of the access. The other bytes kept what the backend's buffer held. On MSHV and WHP, OpenVMM passes the guest's EAX as that buffer, so a 16- or 32-bit IN from either port kept the guest's upper bytes of AX or EAX, as an 8-bit IN does (#1151). KVM zeroes its PIO data before it exits to the VMM for an IN, which hid the defect there. Pin 60e160369b1f1f10543e0699d4ae1e95810a1e62, the head of microsoft/openvmm#5072, one commit on 6f57a6d61, the head of feature/microvm/dev: - 60e160369 chipset: zero-extend wide reads of the RTC's ports Rtc::io_read now reads the register, then zeroes the whole buffer and stores the register's byte in its first byte. A one-byte read returns the same byte as before, and a read of another port still fails without touching the buffer. Evidence: in NVX's Alpine microVM, a guest program selected status D, 0x80, and read each port with 16- and 32-bit INs that start with EAX = 0xdeadbeef, three times per boot. With OpenVMM 6f57a6d61, from the release v0.1.0-dev.8e9e9eb74cf2, every read returned 0xdeadbe0d from port 0x70 and 0xdeadbe80 from port 0x71 on nvx-mshv-test and nvx-whp-test. On nvx-kvm-test, the reads returned the zero-extended values, 0xdead000d and 0x0000000d, and 0xdead0080 and 0x00000080, since a 16-bit IN keeps EAX[31:16]. With OpenVMM built from the pin, all three hosts returned the zero-extended values. The revision's new chipset test fails at 6f57a6d61, where a 2-byte read of port 0x70 returns [0x40, 0xa5], and passes at the pin with the crate's other 112 tests, on Windows and on Linux. Tests: with OpenVMM built from the pin, the microVM scenarios guest-boot, lifecycle, which reads the RTC's status B one byte at a time, interrupt-map, snapshot-core, restore-processors, smp-snapshot, restore-downtime, time-abi-conformance, and time-host-correction pass with 1 and 2 processors on nvx-kvm-test, nvx-mshv-test, and nvx-whp-test. NVX needs no coordinated change: the control-session vectors, the source excerpts, the contract versions, the activation bound, and the CPU profiles that nvx-rs copies from OpenVMM match the revision's. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- openvmm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvmm b/openvmm index 6f57a6d61..60e160369 160000 --- a/openvmm +++ b/openvmm @@ -1 +1 @@ -Subproject commit 6f57a6d61160486a662530d528ca184430a76c7b +Subproject commit 60e160369b1f1f10543e0699d4ae1e95810a1e62 From 0e159a5808ec72a8a7154b6c1074e878123281b9 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Thu, 12 Nov 2026 18:29:58 -0800 Subject: [PATCH 2/2] doc: map the RTC's zero-extended wide reads in the OpenVMM roadmap The NVX pin moves to 60e160369, position 267, 136 commits past the mapped tip. Position 267, which microsoft/openvmm#5072 proposes for feature/microvm/dev on its head, 6f57a6d61, is unassigned. The Scope also says that microsoft/openvmm#5067 merged positions 265 and 266. Position 267 makes the RTC's io_read zero-extend a read of port 0x70 or 0x71 that is wider than a byte, in code that upstream main has, and adds a test, in a file that PR10's position 020, PR15's position 057, and position 200 also change, none of them in the code that it changes. It changes nothing that a mapped PR adds. Replaying it on upstream main applies without conflicts, and chipset type-checks there and its 64 tests pass, so it can go upstream on its own. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- doc/openvmm-upstream-roadmap.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/openvmm-upstream-roadmap.md b/doc/openvmm-upstream-roadmap.md index f20fa274c..afae98e7d 100644 --- a/doc/openvmm-upstream-roadmap.md +++ b/doc/openvmm-upstream-roadmap.md @@ -10,9 +10,10 @@ summary, and commit mapping below cover positions 001-131, the PR09 fixups at positions 241-243, the PR13 fixup at position 247, the PR18 fixup at position 248, the PR20 fixup at position 249, and the PR19 fixup at position 250. -- NVX's pinned OpenVMM revision: `6f57a6d61160486a662530d528ca184430a76c7b`, position 266, the - head of microsoft/openvmm#5067, whose two commits follow position 264, `8eede133c`, the head of - `feature/microvm/dev`, which microsoft/openvmm#5065 merged after position 263, `5d656d854`, +- NVX's pinned OpenVMM revision: `60e160369b1f1f10543e0699d4ae1e95810a1e62`, position 267, the + head of microsoft/openvmm#5072, whose commit follows position 266, `6f57a6d61`, the head of + `feature/microvm/dev`, which microsoft/openvmm#5067 merged with position 265 after position 264, + `8eede133c`, which microsoft/openvmm#5065 merged after position 263, `5d656d854`, which microsoft/openvmm#5061 merged after position 262, `c2c21ddb2`, which microsoft/openvmm#5056 merged after position 261, `c72fc56a3`, which microsoft/openvmm#5055 merged with positions 259 and 260 after @@ -50,8 +51,8 @@ position 221 into positions 035 and 036, and combined v5.1 positions 222 and 223, the two commits of microsoft/openvmm#4984, into position 220. Positions 001-147 keep their positions, v5.1 positions 149-220 are positions 148-219, and the tree of position 220 is the tree of - `3f2ab4c2f`; see [The v6.0 reorganization](#the-v60-reorganization). The pin is 135 commits past - the mapped tip on the same first-parent chain. Positions 132-240, 244-246, and 251-266 are not + `3f2ab4c2f`; see [The v6.0 reorganization](#the-v60-reorganization). The pin is 136 commits past + the mapped tip on the same first-parent chain. Positions 132-240, 244-246, and 251-267 are not yet assigned to PRs, positions 241-243 are PR09 fixups, position 247 is a PR13 fixup, position 248 is a PR18 fixup, position 249 is a PR20 fixup, and position 250 is a PR19 fixup; see [Commits after the mapped tip](#commits-after-the-mapped-tip). @@ -1039,7 +1040,8 @@ ba105dd7f -> PIT low/high counts without a control word [263] -> PIT time below 100 ns counted once [264] -> PIT restore rejecting a control word with RW = 0 [265-266] - -> 6f57a6d61 (NVX pin) + -> RTC port reads wider than a byte zero-extended [267] + -> 60e160369 (NVX pin) ``` For upstream review, PR01-PR06 and PR14 can be rebased independently onto current upstream main, @@ -1076,7 +1078,7 @@ helper that the case uses. ## Commits after the mapped tip -The NVX pin extends the chain past position 131 without merges. Of the 135 later commits, +The NVX pin extends the chain past position 131 without merges. Of the 136 later commits, positions 241-243 are PR09 fixups, position 247 is a PR13 fixup, position 248 is a PR18 fixup, position 249 is a PR20 fixup, position 250 is a PR19 fixup, and the others are not yet classified or assigned to PRs. @@ -1084,7 +1086,7 @@ Each of positions 132-186 combines the v2.4 commits that the table lists, as v3. and 162-200 did, which developed one concept; "(part)" marks a v2.4 fixup that split across commits. Positions 187-191 followed the v3.0 reorganization, positions 192-205 are the ABI restart of the v4.0 reorganization, positions 206-211 followed it, positions 212-218 followed the v5.0 -reorganization, positions 219 and 220 followed the v5.1 rebase, and positions 221-266 followed the +reorganization, positions 219 and 220 followed the v5.1 rebase, and positions 221-267 followed the v6.0 reorganization, so they combine none, apart from position 220, which combines v5.1 positions 222 and 223. Each commit has the position that it had in v5.1 through position 147, and one less from v5.1 position 149 on; see @@ -1228,6 +1230,7 @@ at `e1ca353eb`, whose first 210 commits are those of `feature/microvm/release/v4 | 264 | `8eede133c` | - | - | - | - | chipset: keep the sub-100 ns part of the PIT's last tick time (microsoft/openvmm#5065) | | 265 | `607407fa9` | - | - | - | - | chipset: reject a saved PIT control word with RW = 0 (microsoft/openvmm#5067) | | 266 | `6f57a6d61` | - | - | - | - | chipset: keep the PIT restore tests within Linux's open file limit (microsoft/openvmm#5067); fold into 265 | +| 267 | `60e160369` | - | - | - | - | chipset: zero-extend wide reads of the RTC's ports (microsoft/openvmm#5072) | The remarks that say whether commits apply to upstream main record what the v3.0 reorganization found on its base, `b2676222b`, at the positions that the commits have now. @@ -1918,6 +1921,13 @@ check applies there. It follows position 264 upstream. Position 266 changes only tests, which created PITs for each case and so exhausted Linux's default limit of open files, so it folds into position 265. +Position 267 makes the RTC's `io_read` zero-extend a read of port `0x70` or `0x71` that is wider +than a byte, whose upper bytes kept what the backend's buffer held, in code that upstream main +has, and adds a test, in a file that PR10's position 020, PR15's position 057, and position 200 +also change, none of them in the code that it changes. It changes nothing that a mapped PR adds. +Replaying it on upstream main applies without conflicts, and `chipset` type-checks there with its +tests, which pass, so it can go upstream on its own. + ## PR summary Each count is of v6.0 commits, which include the fixups that the v3.0, v4.0, v5.0, and v6.0