patina-v15.0.0
What's Changed
⚠️ Breaking Changes
-
Refactor Patina Perf MM Code and Use the MM Comm Service [Rebase \& FF] @makubacki (#746)
Change Details
## Description
Closes #444
Refactors performance code interacting with MM to be more ergonomic and use the MM Communication service (instead of the MM Communication protocol). Use zerocopy in some places to reduce overhead from scroll. General other improvements for error handling and adding more testing.
perf: Update dependencies for MM communication support
Add patina_mm dependency to workspace and performance component to
enable MM communication. Replace scroll with zerocopy for improved
serialization performance and reduced dependency weight.- Add patina_mm dependency to workspace Cargo.toml
- Add patina_mm and zerocopy dependencies to performance component
- Remove scroll dependency in favor of zerocopy for serialization
- Add zerocopy with derive features to SDK
This establishes the foundation for modernizing MM communication in the
performance component by replacing HOB-based communication with a
service-based approach.
patina_performance: Add MM module
Add a dedicated MM communication module for performance related
MM definitions and functionality such as record fetching.- SmmCommHeader is zerocopy wire format compatible
- Adds GetRecordSize for querying total performance record size
- Adds GetRecordDataByOffset for chunked record retrieval wit
configurable buffer sizes
patina_sdk/performance: Improve perf record serialization infra
- Adds the PerformanceRecordHeader struct to represent and manage
performance record headers. - Replaces scroll::Error with Error::Serialization so scroll errror
types are not leaking into performance code. - Implement direct little-endian serialization helpers for certain
primitives - Favors zerocopy instead of scroll in relevant places.
- Adds improved bounds checking for serialization operations.
patina_performance: Update configuration with explicit defaults
Enhance
PerfConfigwith explicit default values and improved
documentation to provide clearer configuration semantics.- Add explicit
DEFAULT_ENABLE_COMPONENTand
DEFAULT_ENABLED_MEASUREMENTSconstants - Implement custom
Defaulttrait instead of derive to better
control defaults - Improve documentation
- Improve
PerfConfigusage ergonomics
patina_performance: Use the MM Communication service
Drop HOB-based MM comm buffers and the Communicate protocol being
used in the performance component to instead use the Communicate
service.Implements more robust error handling, general code cleanup, and
additional tests.-
Uses the
MmCommunicationservice -
Adds better error handling using the
MmPerformanceErrorenum -
Implements chunked MM record fetching with configurable buffer
sizes -
Adds
PerformanceRecordIteratorfor more memory-efficient perf
record processing -
Adds unit tests covering different scenarios such as zero records,
single record, and multi-chunk scenarios -
Mocks the
MmCommunicationservice implementations to better
isolate testing
patina_sdk: Refactor perf measurement module to drop MM comm protocol
Remove protocol-based MM communication in the patina_sdk perf code
and clean up theevent_callbacknamespace.- Remove Vec import as it's no longer needed for temporary buffers
- Remove fetch_and_add_mm_performance_records from event_callback
module - Clean up unused imports and simplify module dependencies
patina_sdk/performance: Remove temp SMM module
Remove the temporary _smm module that provided scroll-based MM
communication.The new MM communication approach in the mm.rs module provides
the same functionality with improved error handling, better
resource management, and integration with the Patina service
architecture.
patina_performance: Add records module
Adds structures that represent performance records so they can
be parsed and printed in debug messages.
patina_mm: Add MM communication buffer update protocol
Implements the MM communication buffer update protocol to support`
dynamic updates to MM communication buffers during boot. This is
an option that can be enabled in the MM Comm buffer config. The
protocol is currently published the Mu MM Supervisor Standalone MM
implementation.High-level changes:
- Add support for the MmCommBufferUpdate protocol
- Update the patina_mm component to support MM Comm buffer updates
- Update patina_mm config to support MM Comm buffer updates
- Integration with SW MMI manager for buffer update handling
- Component integration tests for buffer update functionality
An example of a pending MM Communication buffer being applied when
the perf component triggers a SW MMI:DEBUG - Starting MM communication: buffer_id=1, data_size=40, recipient=C095791A-3001-47B2-80C9-EAC7319F2FA4 INFO - Pending buffer update detected, applying now INFO - Adding new comm buffer 1: addr=0x7ddd9000, size=0x10000 INFO - Successfully applied pending comm buffer 1 update TRACE - patina_mm\src\component\communicator.rs:466: Buffer validation: buffer_len=65536, required_len=64 TRACE - patina_mm\src\component\communicator.rs:473: Resetting the comm buffer and internal tracking state TRACE - patina_mm\src\component\communicator.rs:476: Setting up communication buffer for MM request TRACE - patina_mm\src\config.rs:569: Setting message info for buffer 1: recipient=C095791A-3001-47B2-80C9-EAC7319F2FA4 TRACE - patina_mm\src\config.rs:540: Validating capacity for buffer 1: buffer_size=65536, message_size=0 TRACE - patina_mm\src\config.rs:558: Buffer 1 capacity validation passed TRACE - patina_mm\src\config.rs:527: Buffer 1 state consistency was verified successfully TRACE - patina_mm\src\config.rs:586: Message info set successfully for buffer 1 TRACE - patina_mm\src\config.rs:598: Setting message for buffer 1: message_size=40 TRACE - patina_mm\src\config.rs:540: Validating capacity for buffer 1: buffer_size=65536, message_size=40 TRACE - patina_mm\src\config.rs:558: Buffer 1 capacity validation passed TRACE - patina_mm\src\config.rs:610: Buffer 1: writing header and message data TRACE - patina_mm\src\config.rs:527: Buffer 1 state consistency was verified successfully DEBUG - Buffer 1 message set successfully: header_size=24, message_size=40 DEBUG - Outgoing MM communication request: buffer_id=1, data_size=40, recipient=C095791A-3001-47B2-80C9-EAC7319F2FA4 DEBUG - Request Data (hex): [01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00] TRACE - patina_mm\src\component\communicator.rs:488: Comm buffer before request: CommunicateBuffer(id: 0x1. len: 0x10000) . . .
Add additional MM Communicator unit tests
Coverage for:
- Debug output
- Default trait implementation
- Using an MM executor
Improve MM perf record debuggability
Prints additional information about MM performance records retrieved,
including record-specific information. That allows better visibility
into the records themselves and MM communication between the Patina
Performance component the MM performance code.An example of two MM performance records received from the MM UEFI
variable driver:DEBUG - MM communication response received: size=156 INFO - Performance: Processing 116 bytes of MM performance data DEBUG - Performance: MM record #1 - type: 0x1011 (Dynamic String Event), length: 58, revision: 1, data_len: 54 DEBUG - Record #1: progress_id: 0x0030, apic_id: 0, timestamp: 4105960673, guid: 7EE2C0C1-C21A-4113-A53A-66824A95696F DEBUG - String: "MmVariableServiceInitia" DEBUG - Performance: MM record #2 - type: 0x1011 (Dynamic String Event), length: 58, revision: 1, data_len: 54 DEBUG - Record #2: progress_id: 0x0031, apic_id: 0, timestamp: 4157443753, guid: 7EE2C0C1-C21A-4113-A53A-66824A95696F DEBUG - String: "MmVariableServiceInitia" INFO - Performance: MM record summary - total: 2, added: 2, failed: 0
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make all- Boot on QEMU Q35 with default Q35 build and run settings
- Boot on QEMU Q35 with
PERF_TRACE_ENABLE - Add two MM perf records for testing and verify they are found using MM communication
- Verify the MM communicate buffer can be updated successfully when the MM Communication Buffer update protocol is published and the following performance configuration is used:
enable_comm_buffer_updates: true, updatable_buffer_id: Some(1),Integration Instructions
Update performance configuration to include the following fields:
enable_comm_buffer_updates: false, updatable_buffer_id: None,If the MM Communication Buffer Update protocol is installed on the platform (protocol with GUID
2a22e38f-9d1c-49d0-bdce-7ddac16da45d), then use the following configration:enable_comm_buffer_updates: true, updatable_buffer_id: Some(1),Where
updatable_buffer_idis the ID of the comm buffer that should be updated with the information in the protocol.
🚀 Features & ✨ Enhancements
-
Refactor TplMutex @joschock (#1056)
Change Details
## Description
Renames the tpl_lock.rs module to tpl_mutex and refactors the logic. Key improvements:
- Remove the dependency on BootServices for TPL manipulation. TplMutex now directly calls the raise_tpl/restore_tpl APIs directly rather than through the BootServices table. This greatly simplifies the usage model and testing of TplMutex.
Also updates Synchronization chapter of the docbook.
This change pursuant to RFC 0021 #1036
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
Boot testing on hardware platform.
Integration Instructions
N/A
</blockquote> <hr> </details>
-
Always enable GICv4 support. @joschock (#1074)
Change Details
## Description
This PR always enables GICv4 support in the arm-gic crate. GicV4 support is backwards compatible with GicV3, and is necessary for properly calculating the GIC Redistributor register offsets.
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
Booted on hardware with GicV4, observed that GIC redistributor accesses are no longer incorrect.
Integration Instructions
N/A - changes are backward compat with GicV3, though the expectation is that most systems are GicV4.
</blockquote> <hr> </details>
📖 Documentation Updates
-
Refactor TplMutex @joschock (#1056)
Change Details
## Description
Renames the tpl_lock.rs module to tpl_mutex and refactors the logic. Key improvements:
- Remove the dependency on BootServices for TPL manipulation. TplMutex now directly calls the raise_tpl/restore_tpl APIs directly rather than through the BootServices table. This greatly simplifies the usage model and testing of TplMutex.
Also updates Synchronization chapter of the docbook.
This change pursuant to RFC 0021 #1036
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
Boot testing on hardware platform.
Integration Instructions
N/A
</blockquote> <hr> </details>
-
Refactor Patina Perf MM Code and Use the MM Comm Service [Rebase \& FF] @makubacki (#746)
Change Details
## Description
Closes #444
Refactors performance code interacting with MM to be more ergonomic and use the MM Communication service (instead of the MM Communication protocol). Use zerocopy in some places to reduce overhead from scroll. General other improvements for error handling and adding more testing.
perf: Update dependencies for MM communication support
Add patina_mm dependency to workspace and performance component to
enable MM communication. Replace scroll with zerocopy for improved
serialization performance and reduced dependency weight.- Add patina_mm dependency to workspace Cargo.toml
- Add patina_mm and zerocopy dependencies to performance component
- Remove scroll dependency in favor of zerocopy for serialization
- Add zerocopy with derive features to SDK
This establishes the foundation for modernizing MM communication in the
performance component by replacing HOB-based communication with a
service-based approach.
patina_performance: Add MM module
Add a dedicated MM communication module for performance related
MM definitions and functionality such as record fetching.- SmmCommHeader is zerocopy wire format compatible
- Adds GetRecordSize for querying total performance record size
- Adds GetRecordDataByOffset for chunked record retrieval wit
configurable buffer sizes
patina_sdk/performance: Improve perf record serialization infra
- Adds the PerformanceRecordHeader struct to represent and manage
performance record headers. - Replaces scroll::Error with Error::Serialization so scroll errror
types are not leaking into performance code. - Implement direct little-endian serialization helpers for certain
primitives - Favors zerocopy instead of scroll in relevant places.
- Adds improved bounds checking for serialization operations.
patina_performance: Update configuration with explicit defaults
Enhance
PerfConfigwith explicit default values and improved
documentation to provide clearer configuration semantics.- Add explicit
DEFAULT_ENABLE_COMPONENTand
DEFAULT_ENABLED_MEASUREMENTSconstants - Implement custom
Defaulttrait instead of derive to better
control defaults - Improve documentation
- Improve
PerfConfigusage ergonomics
patina_performance: Use the MM Communication service
Drop HOB-based MM comm buffers and the Communicate protocol being
used in the performance component to instead use the Communicate
service.Implements more robust error handling, general code cleanup, and
additional tests.-
Uses the
MmCommunicationservice -
Adds better error handling using the
MmPerformanceErrorenum -
Implements chunked MM record fetching with configurable buffer
sizes -
Adds
PerformanceRecordIteratorfor more memory-efficient perf
record processing -
Adds unit tests covering different scenarios such as zero records,
single record, and multi-chunk scenarios -
Mocks the
MmCommunicationservice implementations to better
isolate testing
patina_sdk: Refactor perf measurement module to drop MM comm protocol
Remove protocol-based MM communication in the patina_sdk perf code
and clean up theevent_callbacknamespace.- Remove Vec import as it's no longer needed for temporary buffers
- Remove fetch_and_add_mm_performance_records from event_callback
module - Clean up unused imports and simplify module dependencies
patina_sdk/performance: Remove temp SMM module
Remove the temporary _smm module that provided scroll-based MM
communication.The new MM communication approach in the mm.rs module provides
the same functionality with improved error handling, better
resource management, and integration with the Patina service
architecture.
patina_performance: Add records module
Adds structures that represent performance records so they can
be parsed and printed in debug messages.
patina_mm: Add MM communication buffer update protocol
Implements the MM communication buffer update protocol to support`
dynamic updates to MM communication buffers during boot. This is
an option that can be enabled in the MM Comm buffer config. The
protocol is currently published the Mu MM Supervisor Standalone MM
implementation.High-level changes:
- Add support for the MmCommBufferUpdate protocol
- Update the patina_mm component to support MM Comm buffer updates
- Update patina_mm config to support MM Comm buffer updates
- Integration with SW MMI manager for buffer update handling
- Component integration tests for buffer update functionality
An example of a pending MM Communication buffer being applied when
the perf component triggers a SW MMI:DEBUG - Starting MM communication: buffer_id=1, data_size=40, recipient=C095791A-3001-47B2-80C9-EAC7319F2FA4 INFO - Pending buffer update detected, applying now INFO - Adding new comm buffer 1: addr=0x7ddd9000, size=0x10000 INFO - Successfully applied pending comm buffer 1 update TRACE - patina_mm\src\component\communicator.rs:466: Buffer validation: buffer_len=65536, required_len=64 TRACE - patina_mm\src\component\communicator.rs:473: Resetting the comm buffer and internal tracking state TRACE - patina_mm\src\component\communicator.rs:476: Setting up communication buffer for MM request TRACE - patina_mm\src\config.rs:569: Setting message info for buffer 1: recipient=C095791A-3001-47B2-80C9-EAC7319F2FA4 TRACE - patina_mm\src\config.rs:540: Validating capacity for buffer 1: buffer_size=65536, message_size=0 TRACE - patina_mm\src\config.rs:558: Buffer 1 capacity validation passed TRACE - patina_mm\src\config.rs:527: Buffer 1 state consistency was verified successfully TRACE - patina_mm\src\config.rs:586: Message info set successfully for buffer 1 TRACE - patina_mm\src\config.rs:598: Setting message for buffer 1: message_size=40 TRACE - patina_mm\src\config.rs:540: Validating capacity for buffer 1: buffer_size=65536, message_size=40 TRACE - patina_mm\src\config.rs:558: Buffer 1 capacity validation passed TRACE - patina_mm\src\config.rs:610: Buffer 1: writing header and message data TRACE - patina_mm\src\config.rs:527: Buffer 1 state consistency was verified successfully DEBUG - Buffer 1 message set successfully: header_size=24, message_size=40 DEBUG - Outgoing MM communication request: buffer_id=1, data_size=40, recipient=C095791A-3001-47B2-80C9-EAC7319F2FA4 DEBUG - Request Data (hex): [01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00] TRACE - patina_mm\src\component\communicator.rs:488: Comm buffer before request: CommunicateBuffer(id: 0x1. len: 0x10000) . . .
Add additional MM Communicator unit tests
Coverage for:
- Debug output
- Default trait implementation
- Using an MM executor
Improve MM perf record debuggability
Prints additional information about MM performance records retrieved,
including record-specific information. That allows better visibility
into the records themselves and MM communication between the Patina
Performance component the MM performance code.An example of two MM performance records received from the MM UEFI
variable driver:DEBUG - MM communication response received: size=156 INFO - Performance: Processing 116 bytes of MM performance data DEBUG - Performance: MM record #1 - type: 0x1011 (Dynamic String Event), length: 58, revision: 1, data_len: 54 DEBUG - Record #1: progress_id: 0x0030, apic_id: 0, timestamp: 4105960673, guid: 7EE2C0C1-C21A-4113-A53A-66824A95696F DEBUG - String: "MmVariableServiceInitia" DEBUG - Performance: MM record #2 - type: 0x1011 (Dynamic String Event), length: 58, revision: 1, data_len: 54 DEBUG - Record #2: progress_id: 0x0031, apic_id: 0, timestamp: 4157443753, guid: 7EE2C0C1-C21A-4113-A53A-66824A95696F DEBUG - String: "MmVariableServiceInitia" INFO - Performance: MM record summary - total: 2, added: 2, failed: 0
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make all- Boot on QEMU Q35 with default Q35 build and run settings
- Boot on QEMU Q35 with
PERF_TRACE_ENABLE - Add two MM perf records for testing and verify they are found using MM communication
- Verify the MM communicate buffer can be updated successfully when the MM Communication Buffer update protocol is published and the following performance configuration is used:
enable_comm_buffer_updates: true, updatable_buffer_id: Some(1),Integration Instructions
Update performance configuration to include the following fields:
enable_comm_buffer_updates: false, updatable_buffer_id: None,If the MM Communication Buffer Update protocol is installed on the platform (protocol with GUID
2a22e38f-9d1c-49d0-bdce-7ddac16da45d), then use the following configration:enable_comm_buffer_updates: true, updatable_buffer_id: Some(1),Where
updatable_buffer_idis the ID of the comm buffer that should be updated with the information in the protocol.
Full Changelog: patina-v14.5.0...v15.0.0