Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHERRY-PICK] [REBASE & FF] Revert Mu Commits in Favor of edk2 Commits #1128

Merged
merged 16 commits into from
Oct 1, 2024

Conversation

os-d
Copy link
Contributor

@os-d os-d commented Aug 31, 2024

Description

This is the set of mu_basecore commits that I have upstreamed up to this point to edk2. Some of the commits were taken directly to edk2.

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

How This Was Tested

N/A.

Integration Instructions

N/A.

@github-actions github-actions bot added the impact:non-functional Does not have a functional impact label Aug 31, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2024

Codecov Report

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

Project coverage is 1.19%. Comparing base (c564cd6) to head (ed2c6d4).

Files with missing lines Patch % Lines
MdeModulePkg/Core/Dxe/Gcd/Gcd.c 0.00% 14 Missing ⚠️
MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c 0.00% 4 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           dev/202405    #1128      +/-   ##
==============================================
- Coverage        1.59%    1.19%   -0.40%     
==============================================
  Files            1448     1448              
  Lines          362501   360689    -1812     
  Branches         5632     5632              
==============================================
- Hits             5776     4307    -1469     
+ Misses         356618   355604    -1014     
- Partials          107      778     +671     
Flag Coverage Δ
MdeModulePkg 0.68% <0.00%> (ø)
MdePkg 3.29% <ø> (-2.13%) ⬇️
NetworkPkg 0.55% <ø> (ø)
PolicyServicePkg 30.41% <ø> (ø)
UefiCpuPkg 2.86% <ø> (-1.87%) ⬇️

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.

@os-d os-d changed the base branch from release/202405 to dev/202405 October 1, 2024 21:29
os-d and others added 16 commits October 1, 2024 14:34
This reverts commit b75dfbc
as it has been upstreamed to edk2 as commit
9df400f.
Add Report status code events to Nvme to trigger when timeouts occur.
This improves traceability when critical errors happen.

Signed-off-by: Oliver Smith-Denny <[email protected]>
This reverts commit dde58de as it has
been upstreamed to edk2 as 4142604.
This reverts commit ac4d0c9, as it
has been upstreamed to edk2 as c82ca2b.
This reverts commit 3aadd23 as it has
been upstreamed to edk2 as ffc09b5.
…E Enum

Per TCBZ2372, clang on Linux emits a warning if an enum-typed variable
is compared with a constant outside of the range of the enum. Such
comparisons are performed in multiple locations in DXE core on
variables of type EFI_MEMORY_TYPE. This patch moves the OEM and OS
reserved types into the EFI_MEMORY_TYPE enum itself to resolve this
issue and improve readability. This commit does this for the BaseTools
copy of this enum.

Signed-off-by: Oliver Smith-Denny <[email protected]>
Per TCBZ2372, clang on Linux emits a warning if an enum-typed variable
is compared with a constant outside of the range of the enum. Such
comparisons are performed in multiple locations in DXE core on
variables of type EFI_MEMORY_TYPE. This patch moves the OEM and OS
reserved types into the EFI_MEMORY_TYPE enum itself to resolve this
issue and improve readability. This commit does this for the MdePkg
copy of this enum.

Signed-off-by: Oliver Smith-Denny <[email protected]>
Now that all of the EFI_MEMORY_* defines live in the
EFI_MEMORY_TYPE enum, remove the old defines.

Signed-off-by: Oliver Smith-Denny <[email protected]>
This reverts commit 856992a as it has
been upstreamed to edk2 as d7e36cc.
Fire an event if a long delay occurs when starting an NVMe device.
This can be used by platforms to draw pictures on the screen or
take other actions to notify a user or move boot forward.

Signed-off-by: Oliver Smith-Denny <[email protected]>
… Correct GCD Type

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.

Signed-off-by: Oliver Smith-Denny <[email protected]>
…side of Loaded Image Memory (microsoft#822)"

This reverts commit a860f71 as it
has been upstreamed to edk2 as two commits:
254641f and
bb248a9.
…ce] Attrs

Per UEFI spec 2.10 section 4.6.3 EFI_MEMORY_ATTRIBUTES_TABLE,

"The Memory Attributes Table is currently used to describe memory
protections that may be applied to the EFI Runtime code and data
by an operating system or hypervisor. Consumers of this table must
currently ignore entries containing any values for Type except for
EfiRuntimeServicesData and EfiRuntimeServicesCode to ensure
compatibility with future uses of this table."

However, the current MAT code also enforces attributes for
EfiMemoryMappedIo and EfiMemoryMappedIoPortSpace, which it should
not be. Per
https://edk2.groups.io/g/devel/topic/patch_v1_mdemodulepkg/105570114?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,105570114,
it was suggested to remove these types from the MAT logic.

This patch removes EfiMemoryMappedIo and EfiMemoryMappedIoPortSpace
from the MAT logic in accordance with the UEFI spec.

Signed-off-by: Oliver Smith-Denny <[email protected]>
…de Image Memory

The Memory Attributes Table is generated by fetching the EFI memory map
and splitting entries which contain loaded images so DATA and CODE
sections have separate descriptors. The splitting is done via a call to
SplitTable() which
marks image DATA sections with the EFI_MEMORY_XP attribute and CODE
sections with the EFI_MEMORY_RO attribute when
splitting. After this process, there may still be EfiRuntimeServicesCode
regions which did not have their attributes set because they are not
part of loaded images.

This patch updates the MAT EnforceMemoryMapAttribute logic to set the
access attributes of runtime memory regions which are not part of loaded
images (have not had their access attributes set). The attributes of the
code regions will be read-only and no-execute because the UEFI spec
dictates that runtime code regions should only contain loaded EFI
modules.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4832

Refs:
1.
https://edk2.groups.io/g/devel/topic/patch_v1_mdemodulepkg/105570114?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,105570114
2.
https://edk2.groups.io/g/devel/topic/mdemodulepkg_fix_mat/105477564?p=,,,20,0,0,0::recentpostdate/sticky,,,20,2,0,105477564

Signed-off-by: Oliver Smith-Denny <[email protected]>
This reverts commit f481172 as it has
been upstreamed to edk2 as b2a4318.
…t Suite

Commit 2f499c3 commented out the
RandomTestCase tests in CpuPageTableLibTestHost, but it left the
test suite being registered without any tests. This causes a failure
for tools that check to ensure tests are being registered with test
suites.

This patch comments out the test suite in addition to the tests
being added to it.

Signed-off-by: Oliver Smith-Denny <[email protected]>
@os-d os-d enabled auto-merge (rebase) October 1, 2024 21:36
@os-d os-d merged commit ac91cfd into microsoft:dev/202405 Oct 1, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:non-functional Does not have a functional impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants