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] Cherry Pick Final 2311 Commits to 2405 #1112

Merged
merged 21 commits into from
Aug 24, 2024

Conversation

os-d
Copy link
Contributor

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

Description

Project Mu is moving to release/202405 as the main branch and as such this PR cherry-picks all of the 2311 commits that have come in since the 2405 process has started.

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

How This Was Tested

From 2311.

Integration Instructions

N/A.

v-bhavanisu and others added 16 commits August 23, 2024 10:06
# Preface

Please ensure you have read the [contribution
docs](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md) prior
to submitting the pull request. In particular,
[pull request
guidelines](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md#pull-request-best-practices).

## Description

Added MockPciIoProtocol and MockLocalApicLib to be used in GoogleTests

For each item, place an "x" in between `[` and `]` if true. Example:
`[x]`.
_(you can also check items in the GitHub UI)_

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

Integrated these in internal repo for a GoogleTest and ensured no build
errors

## Integration Instructions
N/A
## Description

When supplying DxeCore with a resource descriptor HOB, a platform can
choose which memory type to specify. For EFI_MEMORY_SP resource
descriptor HOBs, instead of blindly setting GcdReserved as the memory
type, respect what the resource descriptor HOB specified. Closes microsoft#884.

- [x] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

Tested on virtual platforms with CXL memory attached.

## Integration Instructions

N/A.
…asedUnitTest.py (microsoft#899)

## Description

Fix invalid escape sequence in
BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py.
These warnings are exposed by Python 3.12.

For each item, place an "x" in between `[` and `]` if true. Example:
`[x]`.
_(you can also check items in the GitHub UI)_

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

Validated no functional changes to HostBasedUnitTestRunner.

## Integration Instructions

N/A
## Description

Updates the host-based unit test runner to fail if a unit test
executable returns successfully, but has no test results, or if a test
suite generated from a unit test executable does not contain any tests.

The issues above indicate configuration errors in the unit test source
code itself and indicates to the developer that changes to the unit test
need to be made.

Updates the README.md file for the UnitTestFrameworkPkg to correct
inaccurate information regarding code coverage and provide information
on how to consolidate and generate unit test html reports.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [x] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [x] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

N/A

## Integration Instructions

If any host based unit tests were written incorrectly, and there exists
a test with no test suites, or a test suite with no tests, The host
based unit test runner will now fail. These tests will need to be
corrected.

---------

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
Added mock functions on UefiLib

Signed-off-by: TsunFeng <v-tshuang@microsoft.com>
…rvicesTableLib

This is squashed with the 2311 commit d9c18c3.
…soft#1034)

## Description

The BaseCryptLibUnitTestApp tests the linked BaseCryptLib instance's
crypto to make sure all functions are performing as expected. With the
move to the Crypto binary and the BaseCryptLibOnProtocol instances we
disable certain crypto functionality on purpose which causes the test to
fail (and also the BaseCryptLibOnProtocol lib to assert). The changes
made here use the already existing crypto PCDs to check if the tested
cryptography is enabled with the current Crypto binary and if not to
skip the test. This will allow the test to show if the enabled crypto is
working correctly instead of failing for crypto we don't care about.

- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [x] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested

Tested on Qemu and intel physical platforms with various crypto binary
layouts. The relevant tests pass and disabled crypto skips their tests.
Furthermore when the PCDs are configured to run tests for crypto we
don't support with the selected crypto binary, the test fails as
expected.

## Integration Instructions

N/A. Using the crypto binaries should automatically configure the
correct PCDs and BaseCryptLib library for the test to work correctly.
…ft#742)

Added deprecation warning support to the existing Override validation
plugin/tool.

- [ ] Impacts functionality?
- **Functionality** - All libraries/drivers that are no longer used
should add a Deprecation warning
- [ ] Impacts security?
  - **Security** - N/A
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior? No
- [ ] Includes tests? No
- [ ] Includes documentation? Added documentation for how to use the
Deprecation warnings module

Added the Deprecation warnings to the INFs and a warning was thrown when
a deprecated module was part of the DSC

N/A
…vicesTableLib, MockUefiLib and MockUefiDevicePathLib

Signed-off-by: TsunFeng <v-tshuang@microsoft.com>
Signed-off-by: TsunFeng <v-tshuang@microsoft.com>
… UsbIo and NvmExpressPassthru protocol

Signed-off-by: TsunFeng <v-tshuang@microsoft.com>
Create the Google Test mocks for SmmBase2 Protocol.
…1096)

## Description
Cherry-Picking PCD definition from edk2. This does not change the
basecore functionality to consume this pcd.

Provide the capability for platform to specifies the 2nd timeout value
in microseconds for the BSP/AP in SMM to wait for one another to enter
SMM.

The added interface can enhance the flexibility of timeout
configuration. In some cases, certain processors may not be able to
enter SMI, and prolonged waiting could lead to kernel soft/hard lockup.
We have now defined two timeouts. The first timeout can be set to a
smaller value to reduce the waiting period. Processors that are unable
to enter SMI will be woken up through SMIIPL to enter SMI, followed by a
second waiting period. The second timeout can be set to a larger value
to prevent delays in processors entering SMI case due to the long
instruction execution.


Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>


- [ ] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

## How This Was Tested
Local CI

## Integration Instructions
N/A

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Co-authored-by: Jiaxin Wu <jiaxin.wu@intel.com>
@os-d os-d requested review from makubacki and apop5 August 23, 2024 17:28
@github-actions github-actions bot added the language:python Pull requests that update Python code label Aug 23, 2024
@apop5
Copy link
Contributor

apop5 commented Aug 23, 2024

@os-d
UefiCpuPkg: Refine the PCD usage comment
68468f0
@shuishouqiaozhi
@os-d
UefiCpuPkg/PiSmmCpuDxeSmm: Consume PcdCpuSmmApSyncTimeout2

Would it be possible to fix the commit messages to have [Cherry-Pick] in them? I missed that the first time around.

jiaxinwu and others added 3 commits August 23, 2024 10:40
PcdCpuSmmApSyncTimeout is not only used by BSP to wait AP,
but also for AP to wait BSP (APHandler).

This patch is only to refine the PCD comment. No function
impact.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
This patch is to consume the PcdCpuSmmApSyncTimeout2 to
enhance the flexibility of timeout configuration.
In some cases, certain processors may not be able to enter
SMI, and prolonged waiting could lead to kernel soft/hard
lockup. We have now defined two timeouts. The first timeout
can be set to a smaller value to reduce the waiting period.
Processors that are unable to enter SMI will be woken up
through SMIIPL to enter SMI, followed by a second waiting
period. The second timeout can be set to a larger value to
prevent delays in processors entering SMI case due to the
long instruction execution.

This patch adjust the location of PcdCpuSmmApSyncTimeout2
to avoid conflict.

Signed-off-by: Yanbo Huang <yanbo.huang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Create mocks for PlatformHookLib and PciLib

- [ ] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [x] Includes tests?
- [ ] Includes documentation?

Unit tests component can call PlatformHookLib and PciLib mock functions
success

N/A
@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2024

Codecov Report

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

Project coverage is 1.59%. Comparing base (973a5aa) to head (76bf8d3).

Files Patch % Lines
UefiCpuPkg/PiSmmCpuDxeSmm/SyncTimer.c 0.00% 8 Missing ⚠️
UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 0.00% 4 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##           release/202405    #1112      +/-   ##
==================================================
- Coverage            1.59%    1.59%   -0.01%     
==================================================
  Files                1448     1448              
  Lines              362482   362487       +5     
  Branches             5632     5632              
==================================================
  Hits                 5776     5776              
- Misses             356599   356604       +5     
  Partials              107      107              
Flag Coverage Δ
MdeModulePkg 0.68% <ø> (ø)
MdePkg 5.42% <ø> (ø)
NetworkPkg 0.55% <ø> (ø)
PolicyServicePkg 30.41% <ø> (ø)
UefiCpuPkg 4.73% <0.00%> (-0.01%) ⬇️

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 and others added 2 commits August 23, 2024 14:39
RandomeTestCase in CpuPageTableLib has had all of its tests
commented out, but the suite itself is still present, so it
creates errors in tools that look for empty test suites being
registered.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
@os-d os-d merged commit f481172 into microsoft:release/202405 Aug 24, 2024
37 checks passed
@os-d os-d deleted the 2405_cps branch August 24, 2024 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language:python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.