Skip to content

Add RMEM DXE ACPI FW-Reserved/Carveout reporting - #1893

Merged
Eeshan Londhe (eeshanl) merged 27 commits into
microsoft:release/202608from
chapsiru:feature/rmem-acpi-discussion
Sep 30, 2026
Merged

Eeshan Londhe (eeshanl) merged 27 commits into
microsoft:release/202608from
chapsiru:feature/rmem-acpi-discussion

Conversation

@chapsiru

@chapsiru Youngjun Lee (chapsiru) commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds the Reserved Memory Reporting (RMEM) Revision 1 interface toMdeModulePkg.

RMEM is the Microsoft-recommended firmware interface for silicon partners and OEMs building Windows devices to describe reserved physical-memory regions and their intended purpose.

Firmware may reserve physical memory for security services, firmware runtime use, shared-memory buffers, graphics, AI accelerators, crash handling, and other platform functions. Operating systems generally expose only the aggregate hardware-reserved amount or EFI memory descriptors, making it difficult to identify the purpose of individual reservations.

This change introduces:

  • A Revision 1 RMEM ACPI table containing the base address, size, category, flags, and diagnostic label for each reserved-memory range.
  • A versioned GUID HOB for reservations discovered before DXE.
  • A DXE registration protocol for dynamic or late-discovered reservations.
  • A common DXE publisher that:
    • Imports RMEM HOB records.
    • Accepts protocol registrations until ReadyToBoot.
    • Validates ranges, categories, labels, and overlaps.
    • Constructs and checksums one RMEM ACPI table.
    • Installs the table through EFI_ACPI_TABLE_PROTOCOL.
  • Package declarations for the RMEM HOB and registration protocol GUIDs.

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • [X ] Includes tests?
  • Includes documentation?

This change adds a new opt-in interface and does not modify an existing interface.

RMEM has security and privacy implications because the table can expose physical addresses, sizes, categories, and diagnostic labels to operating-system consumers. Producers must not place secrets, product codenames, unique device information, or memory contents in labels.

The ADDRESS_HIDDEN flag allows a producer to redact an address from the serialized table. The producer must still provide the actual address to firmware so overflow and overlap validation remain deterministic.

The RMEM table is diagnostic metadata only. It does not grant access to a reported range and must not be used as the sole source for access-control or memory-ownership decisions.

Public interface and data-format documentation is included in the headers and the RMEM driver README.

How This Was Tested

  • GUID uniqueness
  • Package dependency validation
  • DSC completeness
  • License validation
  • Character encoding and line-ending checks
  • Uncrustify and other static formatting checks
  • Editor diagnostics
  • Patch whitespace validation
  • POC with ARM64/x64 devices

The checks were run with:

stuart_ci_build.exe -c .pytool\CISettings.py
-p MdeModulePkg -a X64
-t NOOPT CompilerPlugin=skip
HostUnitTestCompilerPlugin=skip

@mu-automation

mu-automation Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ QEMU Validation Passed

Source Dependencies

Repository Commit
mu_basecore 3c68f1e
mu_tiano_platforms 82a93e0

Results

Platform Target Build Boot Overall Boot Time Build Logs Boot Logs
Q35 DEBUG ✅ success ✅ success 0m 20s Build Logs Boot Logs
ArmVirt DEBUG ✅ success ✅ success 0m 15s Build Logs Boot Logs

Workflow run: https://github.com/microsoft/mu_basecore/actions/runs/36770975752

This comment was automatically generated by the Mu QEMU PR Validation workflow.

@chapsiru Youngjun Lee (chapsiru) changed the title Feature/rmem acpi discussion [Draft] MdeModulePkg: Add RMEM ACPI reporting proposal Aug 26, 2026
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Aug 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.72527% with 46 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/202608@5a5c869). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c 74.72% 42 Missing and 4 partials ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/202608    #1893   +/-   ##
=================================================
  Coverage                  ?    1.47%           
=================================================
  Files                     ?     1185           
  Lines                     ?   378965           
  Branches                  ?     3460           
=================================================
  Hits                      ?     5587           
  Misses                    ?   373304           
  Partials                  ?       74           
Flag Coverage Δ
FmpDevicePkg 9.63% <ø> (?)
MdeModulePkg 1.00% <74.72%> (?)
NetworkPkg 0.56% <ø> (?)
PolicyServicePkg 30.42% <ø> (?)
SecurityPkg 1.54% <ø> (?)
StandaloneMmPkg 0.50% <ø> (?)
UefiCpuPkg 4.71% <ø> (?)
UnitTestFrameworkPkg 11.72% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chapsiru Youngjun Lee (chapsiru) changed the title [Draft] MdeModulePkg: Add RMEM ACPI reporting proposal [Draft] Add RMEM ACPI reporting proposal Aug 27, 2026

@spbrogan Sean Brogan (spbrogan) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this looks great.
I added a few comments

Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingHob.h Outdated
Comment thread MdeModulePkg/Include/Protocol/ReservedMemoryReporting.h
Comment thread MdeModulePkg/Include/Protocol/ReservedMemoryReporting.h Outdated
Comment thread MdePkg/MdePkg.dec

@eeshanl Eeshan Londhe (eeshanl) 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.

overall looks good, mainly just need to consolidate everything into one Pkg + some small nits.

Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/ReadMe.md
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
@eeshanl

Copy link
Copy Markdown
Contributor

Please also change the target merge branch to release/202608

@eeshanl

Copy link
Copy Markdown
Contributor

Also, since we plan to upstream this to edk2, please add #MU_CHANGE start/end tags to any changes in existing files.

Youngjun Lee and others added 14 commits September 23, 2026 17:59
Move the proposed RMEM interfaces into MdeModulePkg, mark changes to existing files for upstream tracking, and document range conflict handling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use SharedMemory for category value 2 to cover reserved memory shared across firmware execution environments without limiting its meaning to communication buffers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chapsiru
Youngjun Lee (chapsiru) changed the base branch from release/202511 to release/202608 September 24, 2026 01:11
Document that RMEM_LABEL_MAX_LEN includes the null terminator and that registration accepts at most 31 label characters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chapsiru

Copy link
Copy Markdown
Contributor Author

Rebased the target branch to release/202608

RMEM related source code is moved to MdeModulePkg

Add MU_CHANGE for the upstream

Youngjun Lee and others added 4 commits September 24, 2026 11:24
Present RMEM Revision 1 as Microsoft's recommended reserved-memory reporting interface for silicon partners and OEMs building Windows devices while retaining its EDK II/Mu ownership distinction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename category value 5 from NpuReserved to AiAcceleratorReserved so the interface covers silicon-partner terminology beyond NPUs without changing the wire value.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep RMEM entries at 52 bytes while reducing category and label fields, reserving seven bytes for future revisions, and validating that reserved fields remain zero.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expand the RMEM table header and entries to 64 bytes, reserve the additional space for future revisions, and update validation, tests, and the PowerShell decoder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@spbrogan Sean Brogan (spbrogan) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Added a few more suggestions but overall looks great.

Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingHob.h Outdated
Youngjun Lee and others added 2 commits September 25, 2026 09:24
Define an RMEM entry flag that lets producers redact physical base addresses from the published ACPI table while retaining actual addresses for validation and overlap detection. Reject undefined flags and document consumer behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Validate page alignment and platform physical-address limits, reject duplicate ranges, and diagnose invalid registrations. Skip malformed HOB records in release builds so valid records remain publishable, while asserting producer errors in debug builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@chapsiru Youngjun Lee (chapsiru) changed the title [Draft] Add RMEM ACPI reporting proposal Add RMEM DXE ACPI FW-Reserved/Carveout reporting Sep 25, 2026
@chapsiru
Youngjun Lee (chapsiru) marked this pull request as ready for review September 25, 2026 17:24
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.inf Outdated
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Youngjun Lee and others added 2 commits September 28, 2026 13:19
Require a valid CPU HOB before publishing RMEM, return and check initialization and import statuses, and avoid exposing hidden base addresses in diagnostics. Preserve best-effort import of malformed individual RMEM records.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Extend the RMEM PowerShell example to validate and total reported ranges, compare them with Windows' estimated hardware-reserved memory, reject visible overlap, and summarize entries by category.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingTable.h
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingTable.h
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingHob.h Outdated
Comment thread MdeModulePkg/Include/Protocol/ReservedMemoryReporting.h Outdated
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c Outdated
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingHob.h
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingTable.h
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingTable.h Outdated
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingTable.h Outdated
Comment thread MdeModulePkg/Include/Guid/ReservedMemoryReportingTable.h
Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/RmemAcpiDxe.c
Youngjun Lee and others added 2 commits September 30, 2026 10:59
Use EntryOffset in the table header and matching 48-byte ACPI and HOB records with 16-bit category and flag fields. Remove HOB-local revision and reserved fields, and document the category semantics in the authoritative header.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use 16-bit entry count and offset fields so the Revision 1 header is 40 bytes and the 48-byte entry array begins at an 8-byte-aligned offset.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@eeshanl Eeshan Londhe (eeshanl) 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.

LGTM, when merging please do the Squash and merge.

Comment thread MdeModulePkg/Universal/Acpi/RmemAcpiDxe/ReadMe.md Outdated
Youngjun Lee and others added 2 commits September 30, 2026 12:41
Describe Windows hardware-reserved memory as the difference between the API-reported installed and OS-available physical memory values, rather than calling that calculation an estimate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@eeshanl
Eeshan Londhe (eeshanl) merged commit 587366f into microsoft:release/202608 Sep 30, 2026
93 checks passed
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.

4 participants