feat(qemu-acpi): generate ACPI tables from scratch - #1053
Merged
Conversation
kvinwang
force-pushed
the
feat/qemu-acpi-generate-dsdt
branch
from
August 13, 2026 13:50
0f80764 to
9455d59
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the prior “fixture-template + byte patching” ACPI table production path in qemu-acpi with a from-scratch generator that emits QEMU-compatible Q35 ACPI tables (DSDT AML plus fixed tables), while retaining the captured QEMU blobs as test-only regression oracles to ensure byte-for-byte compatibility across supported QEMU versions and machine topologies.
Changes:
- Swap the runtime build path from
tables.rs(fixture patching) togenerated_tables.rs(structured generation). - Add from-scratch DSDT generation split into verified-by-region submodules, plus fixed-layout table emitters (FACS/FADT/MADT/MCFG/WAET/RSDT).
- Refactor AML helpers (
aml_patch→aml_encode), move golden matrix tests into a dedicated module, and update tooling/docs/deps accordingly.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| dstack/crates/qemu-acpi/src/tables.rs | Removed legacy fixture-template/byte-patching implementation. |
| dstack/crates/qemu-acpi/src/lib.rs | Wire build() to generated_tables::build; add new module structure. |
| dstack/crates/qemu-acpi/src/golden_tests.rs | New golden/regression tests that assert byte-for-byte compatibility across matrices. |
| dstack/crates/qemu-acpi/src/generated_tables.rs | New top-level ACPI blob assembly from generated tables only. |
| dstack/crates/qemu-acpi/src/fixed_tables.rs | New fixed-layout table emitters (FACS/FADT/MADT/MCFG/WAET/RSDT). |
| dstack/crates/qemu-acpi/src/dsdt/mod.rs | New DSDT generator orchestrating per-region modules and version/topology toggles. |
| dstack/crates/qemu-acpi/src/dsdt/ops.rs | New AML helper terms and serialization helpers for gaps in acpi_tables. |
| dstack/crates/qemu-acpi/src/dsdt/dbg.rs | Emit root-scope debug port + DBUG implementation matching QEMU bytes. |
| dstack/crates/qemu-acpi/src/dsdt/pci0.rs | Emit PCI0 host bridge + _OSC + EDSM, plus DRAC MMCONFIG reservation. |
| dstack/crates/qemu-acpi/src/dsdt/pcihp.rs | Emit PCI hotplug registers/methods including _DSM body logic. |
| dstack/crates/qemu-acpi/src/dsdt/pic.rs | Emit PICF + _PIC selection plumbing used by routing logic. |
| dstack/crates/qemu-acpi/src/dsdt/prt.rs | Emit PIC/APIC routing tables (PRTP/PRTA) and _PRT method. |
| dstack/crates/qemu-acpi/src/dsdt/links.rs | Emit routable/fixed interrupt link devices and shared helpers (IQST/IQCR). |
| dstack/crates/qemu-acpi/src/dsdt/gpe.rs | Emit _GPE device ID plus _E02/_E01 event handlers. |
| dstack/crates/qemu-acpi/src/dsdt/cpus.rs | Emit CPU hotplug resource device + CPUS container and control methods. |
| dstack/crates/qemu-acpi/src/dsdt/crs.rs | Emit PCI0 _CRS resource windows + GPE0/PHPR reservation containers. |
| dstack/crates/qemu-acpi/src/dsdt/sstate.rs | Emit _S3/_S4/_S5 sleep state packages under root scope. |
| dstack/crates/qemu-acpi/src/dsdt/fwcf.rs | Emit fw_cfg device declaration under \_SB.PCI0. |
| dstack/crates/qemu-acpi/src/dsdt/notify.rs | Emit per-devfn device descriptors and ICH9 LPC scaffolding AML. |
| dstack/crates/qemu-acpi/src/dsdt/pxb.rs | Emit PXB host bridge device and its routing/resources for GPU PXB mode. |
| dstack/crates/qemu-acpi/src/cpu.rs | Update to use aml_encode; remove notify_case helper (no longer patch-based). |
| dstack/crates/qemu-acpi/src/aml_patch.rs | Removed patch-time AML length/insert helpers (no longer used at runtime). |
| dstack/crates/qemu-acpi/src/aml_encode.rs | New minimal AML encoding helpers used by remaining byte-emitting code. |
| dstack/crates/qemu-acpi/fixtures/README.md | Update fixture documentation to reflect new “oracle only” role. |
| dstack/crates/qemu-acpi/examples/dump.rs | Extend dump example to accept num_verity_volumes and PIC flag. |
| dstack/crates/qemu-acpi/Cargo.toml | Add acpi_tables dependency for AML/table construction. |
| dstack/Cargo.toml | Add acpi_tables to workspace dependencies. |
| dstack/Cargo.lock | Lockfile updates for acpi_tables and transitive deps. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
cargo fmt --all -- --checkcargo clippy -p qemu-acpi --all-targets -- -D warningscargo test -p qemu-acpi(35 passed)cargo test -p dstack-mr(27 passed, 1 ignored integration fixture)/usr/local/bin/dstack-acpi-tablesacross QEMU 8.0/9.1/9.2, CPU counts through 256, memory boundaries, NIC/volume counts, root-verity, PCI hotplug, SMM/PIC, NUMA, and NUMA/PXB configurationsAll compared
etc/acpi/tables, loader, and RSDP outputs remain byte-for-byte identical to the existing golden matrix.