Skip to content

acpi_spec: add IORT RMR (Reserved Memory Range) node types#3973

Merged
jstarks merged 2 commits into
microsoft:mainfrom
jstarks:pr2-acpi-iort-rmr
Jul 20, 2026
Merged

acpi_spec: add IORT RMR (Reserved Memory Range) node types#3973
jstarks merged 2 commits into
microsoft:mainfrom
jstarks:pr2-acpi-iort-rmr

Conversation

@jstarks

@jstarks jstarks commented Jul 19, 2026

Copy link
Copy Markdown
Member

Adds the IORT Reserved Memory Range (RMR) node types (IortRmr, IortRmrDescriptor) and associated constants from the IORT spec (DEN0049E §E.5), with const_assert_eq! size checks matching the on-wire layout.

RMR nodes let firmware describe IOVA ranges the guest must identity-map in its stage-1 page tables (e.g. the host IOMMU's MSI window), which the accelerated SMMU path needs so MSIs are delivered through nested translation. This PR only adds the spec types; the code that emits RMR nodes into the IORT lands in a later PR.

Nested SMMU translation needs to tell the guest to identity-map certain
IOVA windows (notably the host IOMMU's MSI region) in its stage-1 page
tables. On ACPI systems that is expressed with an IORT RMR node.

Add the RMR node header (IortRmr), its memory-range descriptor
(IortRmrDescriptor), and the associated flags and revision constants,
following IORT spec DEN0049E E.5, with const_assert_eq! size checks
matching the other IORT node types. These are pure type definitions with
no emitter yet; the ACPI builder consumes them in a later change.
Copilot AI review requested due to automatic review settings July 19, 2026 15:33

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

Adds Arm IORT (DEN0049E §E.5) Reserved Memory Range (RMR) node definitions to acpi_spec, including constants, on-wire packed structs, constructors, and compile-time size assertions. This extends the existing IORT type set so later PRs can emit RMR nodes into generated ACPI tables.

Changes:

  • Added IORT_NODE_TYPE_RMR and RMR-related revision/flag constants.
  • Introduced IortRmr and IortRmrDescriptor packed on-wire structs with zerocopy derives.
  • Added const_assert_eq! checks for RMR struct sizes to match the spec layout.

Comment thread vm/acpi_spec/src/iort.rs Outdated
Accumulate the RMR node's total length in usize and convert to the on-wire
u16 length field via try_from, rather than casting each term to u16 and
multiplying in u16 (which could silently wrap to a too-small length for
large mapping/descriptor counts). Realistic counts are tiny, but this makes
an oversized node fail loudly instead of emitting a malformed table.
Copilot AI review requested due to automatic review settings July 20, 2026 06:25

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

vm/acpi_spec/src/iort.rs:343

  • IortRmr's doc comment says the node is laid out as IortRmrDescriptor[] followed by IortIdMapping[], but new() currently sets mapping_offset to immediately follow the fixed header and sets rmr_offset to follow the ID mappings. If callers append descriptors first (per the doc), the offsets will be wrong. Consider switching the offsets so rmr_offset points right after the fixed header and mapping_offset points after the descriptor array (and adjust the total-size comment accordingly).
        // Total node size: fixed header + ID mappings + RMR descriptors.
        // Accumulate in `usize` and convert to the on-wire `u16` `length`
        // field via `try_into`, so an oversized node fails loudly instead of
        // silently wrapping to a too-small length.
        let total = size_of::<Self>()

@jstarks
jstarks marked this pull request as ready for review July 20, 2026 08:35
@jstarks
jstarks requested a review from a team as a code owner July 20, 2026 08:35
@github-actions

Copy link
Copy Markdown

@jstarks
jstarks merged commit 328cc5a into microsoft:main Jul 20, 2026
133 of 134 checks passed
@jstarks
jstarks deleted the pr2-acpi-iort-rmr branch July 20, 2026 16:15
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.

3 participants