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

Add new MTRR Test Point test #314

Open
wants to merge 8 commits into
base: dev/202405
Choose a base branch
from
Open

Conversation

kenlautner
Copy link
Contributor

@kenlautner kenlautner commented Dec 31, 2024

Description

Add a new MTRR Test Point test that runs at Ready to Boot. This test checks the systems MTRRs at Ready to Boot versus the expected MTRR settings the platform publishes.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?
  • Backport to release branch?

How This Was Tested

Tested on Intel physical platforms. MTRRs were correctly read and validated at Ready to Boot.

Integration Instructions

Enable bit 6 in byte 4 of the gMinPlatformPkgTokenSpaceGuid.PcdTestPointIbvPlatformFeature PCD to actually run the test. Additionally, a platform will need to create their version of the function GetPlatformMtrrCacheData. This returns the expected MTRR cache settings will be at ready to boot which will be used for verification.

@github-actions github-actions bot added impact:non-functional Does not have a functional impact impact:testing Affects testing type:backport Backport changes in a dev branch PR to its release branch. labels Dec 31, 2024
Comment on lines 4 to 7
An interface for platforms to define the expected MTRR cache types for specific
regions by Ready To Boot. Create an array of VARIABLE_MTRR_INFO structures for every
MTRR range that you want to validate. If any of the checked regions don't have the
matching caching type the test will report an error for the failing range and return.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the library interface should be tied to "Ready to Boot" as a whole.

Copy link
Member

Choose a reason for hiding this comment

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

I recommend leaving this generic and let individual functions handle the boot point details.

**/
UINTN
GetPlatformMtrrCacheData (
Copy link
Member

Choose a reason for hiding this comment

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

It seems that this interface should be scoped to the point the MTRR settings are valid. Either a boot point parameter or separate function for each boot point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the function to take an enum variable specifying the boot point.

@param[out] CheckedMtrrs Pointer to the head of an array of VARIABLE_MTRR_INFO structures.
The caller shall not free this array.
Copy link
Member

Choose a reason for hiding this comment

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

Please add the Boot parameter here now that it's added to the function.

Copy link
Member

Choose a reason for hiding this comment

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

This file has a lot of overlap with MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheckMtrr.c. Have you looked at moving common functionality to a shared .c file with PeiTestPointCheckLib and DxeTestPointCheckLib?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. I separated the common functions into TestPointCheckMtrr.c and TestPointCheckMtrr.h.

Copy link
Member

Choose a reason for hiding this comment

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

In general, the changes should be marked as Mu changes unless they're being cherry-picked from edk2-platforms. I think if the MTRR test point code is consolidated where possible between PEI and DXE, it would be a nice contribution to edk2-platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added MU_CHANGE to the previously existing files but not to the new files.

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 impact:testing Affects testing type:backport Backport changes in a dev branch PR to its release branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants