Skip to content

feat(qemu-acpi): generate ACPI tables from scratch - #1053

Merged
kvinwang merged 10 commits into
nextfrom
feat/qemu-acpi-generate-dsdt
Aug 14, 2026
Merged

feat(qemu-acpi): generate ACPI tables from scratch#1053
kvinwang merged 10 commits into
nextfrom
feat/qemu-acpi-generate-dsdt

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Summary

  • replace the fixture-template and byte-patching production path with structured ACPI generation
  • generate the Q35 DSDT AML, FACS, FADT, MADT, MCFG, WAET, RSDT, SRAT, RSDP, and table-loader records from field values
  • preserve QEMU 8.x through 11.1 compatibility differences and dynamic CPU, memory, PCI, NUMA/PXB, hotplug, SMM, and PIC behavior
  • retain captured QEMU blobs only as test-time byte-for-byte regression oracles

Validation

  • cargo fmt --all -- --check
  • cargo clippy -p qemu-acpi --all-targets -- -D warnings
  • cargo test -p qemu-acpi (35 passed)
  • cargo test -p dstack-mr (27 passed, 1 ignored integration fixture)
  • direct byte-for-byte comparisons against /usr/local/bin/dstack-acpi-tables across 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 configurations

All compared etc/acpi/tables, loader, and RSDP outputs remain byte-for-byte identical to the existing golden matrix.

Copilot AI lite review requested due to automatic review settings August 13, 2026 13:48
@kvinwang
kvinwang force-pushed the feat/qemu-acpi-generate-dsdt branch from 0f80764 to 9455d59 Compare August 13, 2026 13:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) to generated_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_patchaml_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.

Comment thread dstack/crates/qemu-acpi/src/dsdt/notify.rs Outdated
@kvinwang
kvinwang merged commit df61170 into next Aug 14, 2026
16 checks passed
@kvinwang
kvinwang deleted the feat/qemu-acpi-generate-dsdt branch August 14, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants