microsoft / mu_basecore

Project Mu BaseCore
https://microsoft.github.io/mu/
Other
242 stars 124 forks source link

[CHERRY-PICK] MdeModulePkg: Gcd: Only Update gMemoryMap Attributes if Correct GCD Type #1175

Closed os-d closed 2 weeks ago

os-d commented 2 weeks ago

Description

Currently whenever gDS->SetMemorySpaceCapabilities() is called, it attempts to set the corresponding attributes in the gMemoryMap descriptor. However, gMemoryMap only contains entries from GCD types EfiGcdMemoryTypeSystemMemory and EfiGcdMemoryTypeMoreReliable, so for all other types a failure is reported in the code. This is a failure that is expected, so it does not provide value and can lead to real failures being ignored.

This patch updates the gDS->SetMemorySpaceCapabilities() code to only call into updating gMemoryMap if the GCD type is SystemMemory or MoreReliable, to avoid spurious errors being reported. This also avoids the expensive operation of searching through gMemoryMap for entries we know we will fail to find.

Cherry-picked from edk2 via dev/202405.

How This Was Tested

N/A.

Integration Instructions

N/A.

codecov-commenter commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 1.59%. Comparing base (683dd8e) to head (0081eae).

Files with missing lines Patch % Lines
MdeModulePkg/Core/Dxe/Gcd/Gcd.c 0.00% 14 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## release/202405 #1175 +/- ## ================================================== - Coverage 1.59% 1.59% -0.01% ================================================== Files 1448 1448 Lines 362500 362502 +2 Branches 5632 5632 ================================================== Hits 5776 5776 - Misses 356617 356619 +2 Partials 107 107 ``` | [Flag](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1175/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | Coverage Δ | | |---|---|---| | [MdeModulePkg](https://app.codecov.io/gh/microsoft/mu_basecore/pull/1175/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `0.68% <0.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.