Repository navigation
Commit 4661306
authored
virt_support_apic: add local APIC behavior unit tests (#5246)
`virt_support_apic` emulates the local APIC for OpenHCL on SNP/TDX and
for
OpenVMM's WHP software APIC, but most of its guest-facing behavior had
no unit
tests. This PR adds 20 tests in `lib.rs` that drive the APIC the way a
guest and
VMM do: register access over MMIO and MSRs, MSIs, LINT pulses, and the
delivery, offload, save, and restore APIs. The test client now records
wakes,
IO-APIC EOIs, and APIC base updates, and has a settable clock for timer
tests.
**Coverage areas**
- Interrupt priority, EOI, and level-triggered EOI forwarding to the
IO-APIC.
- Software disable, LVT masking, and reserved vectors.
- xAPIC and x2APIC IPI routing: physical, flat and cluster logical,
broadcast,
shorthands, lowest priority.
- INIT, SIPI, NMI, EXTINT, and LINT delivery.
- APIC base MSR transitions and MMIO/x2APIC MSR access rules.
- Timer one-shot, periodic, divide, and masking.
- Save/restore round trip.
- Hyper-V APIC MSRs.
- APIC offload, lazy EOI, the local fast path, and `scan()`.
Two tests are marked `%23[ignore]` for bugs found while writing them:
- `dfr_write_with_unknown_model_does_not_panic`: a reserved DFR model
panics.
Fixed separately in "virt_support_apic: ignore DFR writes with a
reserved
model"; this test can be dropped once that merges.
- `tpr_write_ignores_reserved_bits`: TPR writes pass bits above 7 to
CR8.
Adds `pal_async` as a dev-dependency for the async `scan()` test.
Coverage of production lines goes from 40% to 98%. Tests only; no
production
code changes.1 parent 8fc4346 commit 4661306
3 files changed
Lines changed: 1369 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10331 | 10331 | | |
10332 | 10332 | | |
10333 | 10333 | | |
| 10334 | + | |
10334 | 10335 | | |
10335 | 10336 | | |
10336 | 10337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
0 commit comments