Skip to content

[CHERRY-PICK] MdeModulePkg: PciBusDxe: Degrade MEM64 to PMEM64 when bridge lacks MEM64#1690

Merged
kuqin12 merged 1 commit intomicrosoft:release/202511from
kuqin12:pcie_demote
Mar 10, 2026
Merged

[CHERRY-PICK] MdeModulePkg: PciBusDxe: Degrade MEM64 to PMEM64 when bridge lacks MEM64#1690
kuqin12 merged 1 commit intomicrosoft:release/202511from
kuqin12:pcie_demote

Conversation

@kuqin12
Copy link
Contributor

@kuqin12 kuqin12 commented Mar 10, 2026

Description

P2P bridge Memory Base/Limit registers (0x20-0x22) only support 32-bit addresses. Previously, MEM64 resources behind such bridges were always degraded to MEM32, forcing allocation below 4GB. This can lead to resource constraints when using massive storage (such as MPF drives) as MEM32 space is limited on most platforms.

Based on PCIe Base Specification 6.3+, assigning 64-bit resources irrespective of the prefetchable/non-prefetchable BAR bit is allowed.

In DegradeResource(), if an upstream bridge supports PMEM64, MEM64 resources are now degraded to PMEM64 first. This enables 64-bit BAR allocation for devices like NVMe controllers that declare non- prefetchable 64-bit BARs.

We still fall back to MEM32 degradation if the bridge lacks PMEM64 support as well.

Ref: PCI-SIG ECN "Removing Prefetchable Terminology" (2024-04-05)
Ref: PCIe Base Specification 6.3+

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

How This Was Tested

This was tested on propreitary physical platform and verified that the PCIe devices behind P2P bridge can properly request 64bit resources without downgrading.

Integration Instructions

N/A

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 0% with 39 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (release/202511@4de4631). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...deModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c 0.00% 39 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/202511    #1690   +/-   ##
=================================================
  Coverage                  ?    1.58%           
=================================================
  Files                     ?      634           
  Lines                     ?   232239           
  Branches                  ?      420           
=================================================
  Hits                      ?     3672           
  Misses                    ?   228552           
  Partials                  ?       15           
Flag Coverage Δ
MdeModulePkg 1.58% <0.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 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.

…ridge lacks MEM64

P2P bridge Memory Base/Limit registers (0x20-0x22) only support 32-bit
addresses. Previously, MEM64 resources behind such bridges were always
degraded to MEM32, forcing allocation below 4GB. This can lead to
resource constraints when using massive storage (such as MPF drives)
as MEM32 space is limited on most platforms.

Based on PCIe Base Specification 6.3+, assigning 64-bit resources
irrespective of the prefetchable/non-prefetchable BAR bit is allowed.

In DegradeResource(), if an upstream bridge supports PMEM64, MEM64
resources are now degraded to PMEM64 first. This enables 64-bit BAR
allocation for devices like NVMe controllers that declare non-
prefetchable 64-bit BARs.

We still fall back to MEM32 degradation if the bridge lacks PMEM64
support as well.

Ref: PCI-SIG ECN "Removing Prefetchable Terminology" (2024-04-05)
Ref: PCIe Base Specification 6.3+

Signed-off-by: Kun Qin <kuqin12@gmail.com>
(cherry picked from commit f6489621b8ae1164c5e4930902988ba7c86847ba)
@kuqin12 kuqin12 enabled auto-merge (rebase) March 10, 2026 23:20
@kuqin12 kuqin12 merged commit fcc4a33 into microsoft:release/202511 Mar 10, 2026
51 checks passed
@kuqin12 kuqin12 deleted the pcie_demote branch March 11, 2026 17:33
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.

5 participants