Skip to content

[CHERRY-PICK][Rebase & FF] Cherry-pick non-present page fix from edk2 - #1997

Merged
kuqin12 merged 3 commits into
microsoft:release/202608from
kuqin12:cp_pr_pages
Oct 26, 2026
Merged

kuqin12 merged 3 commits into
microsoft:release/202608from
kuqin12:cp_pr_pages

Conversation

@kuqin12

@kuqin12 kuqin12 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Description

This change picks up the upstreamed fix of non-present page handling from edk2 in favor of mu specific changes.

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

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

This was verified on QEMU Q35 and booted to OS desktop.

Integration Instructions

N/A

@mu-automation

mu-automation Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

✅ QEMU Validation Passed

Source Dependencies

Repository Commit
mu_basecore 337f579
mu_tiano_platforms 9a5b7f8

Results

Platform Target Build Boot Overall Boot Time Build Logs Boot Logs
Q35 DEBUG ✅ success ✅ success 0m 19s Build Logs Boot Logs
ArmVirt DEBUG ✅ success ✅ success 0m 13s Build Logs Boot Logs

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

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

kuqin12 and others added 3 commits October 26, 2026 14:03
…r non-present pages

Current page table logic skips the content population when the attribute
is RP. This is problematic when a smaller page is marked present from a
big non-present page. The remainder of the non-present pages will drop
their address and attribute bits.

Page table consumers treat such zero entries as unmapped. For example,
GetMemoryAttributes of `EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL` in
PiSmmCpuDxeSmm returns `EFI_UNSUPPORTED` for those ranges instead of
reporting EFI_MEMORY_RP.

This change adds logic to populate the address and propagate attribute
bits for the non-present pages.

This was tested on QEMU Q35 platform and booted to OS.

Co-authored-by: Kun Qin <kun.qin@microsoft.com>
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
(cherry picked from commit 0d6d87f99485a1a3cfa7e27c74941f0f13beee66)
…on-present table

This change adds a unit test for mapping a small page from a large non-
present page.

The expected operation is that the test should trigger the large page
table entry to split and marking the newly mapped entry properly while
the rest of the smaller entries remain unmapped.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
(cherry picked from commit 71e8a50308b8d7bde0d103a955d877b0e6e447a8)
@codecov-commenter

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/202608@7d204c6). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release/202608   #1997   +/-   ##
================================================
  Coverage                  ?   4.70%           
================================================
  Files                     ?     148           
  Lines                     ?   27592           
  Branches                  ?     527           
================================================
  Hits                      ?    1297           
  Misses                    ?   26271           
  Partials                  ?      24           
Flag Coverage Δ
UefiCpuPkg 4.70% <100.00%> (?)

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.

@kuqin12
kuqin12 marked this pull request as ready for review October 26, 2026 21:32
@apop5
Aaron (apop5) self-requested a review October 26, 2026 22:00
@kuqin12
kuqin12 merged commit fcb67fe into microsoft:release/202608 Oct 26, 2026
57 checks passed
@kuqin12
kuqin12 deleted the cp_pr_pages branch October 26, 2026 22:10
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