Skip to content

Integrate major branch changes into main [REBASE & FF] - #1671

Merged
makubacki merged 15 commits into
OpenDevicePartnership:mainfrom
cfernald:major_main
Jul 31, 2026
Merged

Integrate major branch changes into main [REBASE & FF]#1671
makubacki merged 15 commits into
OpenDevicePartnership:mainfrom
cfernald:major_main

Conversation

@cfernald

@cfernald cfernald commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

Merged the following changes from the major branch

PR #1628 — [major] Refactor performance into core service

Description

This PR addresses multiple issues with the current performance structure:

  1. Performance data is not available until the component is dispatched. This can cause significant
    misrepresentation of the DXE execution time and cause events from images to be lost if not
    dispatched in the first loop.
  2. Performance implementations in the SDK require SDK statics, which is generally an SDK antipattern.

This PR does the following:

  1. Moves the core performance implementation into the core, into a new struct named CorePerformance,
    following the pattern established by the timer and memory management.
  2. Creates a new service trait PerformanceMeasurement that exposes this core support.
  3. Updates the component to now use this core service to produce the protocol & publish tables.
  4. Change initialization and configuration of performance measurements to be done by the core.
  5. Updates all documentation according to these changes.
  6. Some smaller rework and restructuring.

Resolves: #1483

Reviewing this PR

This PR is intended to be merged as a single commit. The individual commits do attempt to follow a
basic progression of the code rework but may be incomplete at the partial steps. Recommended review flow:

  1. Start with the new theory of operation md (performance_measurement.md) to understand the intended structure.
  2. Review the new service interface (PerformanceMeasurement).
  3. Review the new core implementation.
  4. Review the changes to the component to consume the new service.

PR #1630 — [major] Remove SerialIO interior mutability and cleanup serial implementations [REBASE & FF]

Description

Change SerialIO trait to be mutable

The current SerialIO implementation takes &self instead of &mut self for its methods, forcing
all serial implementations to implement interior mutability. However, because of the nature of the
serial port use cases, the typical locking mechanisms that avoid deadlocks, such as the TplMutex,
are not readily accessible. Because of this, internal implementations have one-off, and at times
questionable, interior mutability implementations.

This commit removes the expectation on the serial port to ensure this, and instead provides a
re-usable SharedSerial wrapper that implements interior mutability in a suitable way for serial
port use cases.

patina: Simplify serial implementations

This commit takes advantage of the new mutable references to cleanup the serial port implementations.
Namely by dropping re-initialization of interior references used as a workaround for the lack of
mutability in the SerialIO trait.

patina: split uart module submodules

This commit splits the null, 16550, and pl011 UART implementations into their own submodules under
the uart module. This better aligns to general code organization practices. This additionally
removes some unnecessary conditional complication.


PR #1643 — [major] patina_debugger: remove deprecated without_transport_init function

Description

This PR removes the deprecated without_transport_init function for the next major release. This
function is now a no-op and the inverse function with_transport_init is now the control for this behavior.


PR #1646 — [major] Refactor Patina SDK for stronger code organization [REBASE & FF]

Description

This PR organizes the SDK into well-defined modules, and moves code and modules into their appropriate location.

The main goals of this refactor are to:

  1. Introduce better hierarchy for modules for definitions based on their use.
  2. Normalize paths between modules for consistency.
  3. Standardize naming conventions.
  4. Document these decisions for future consistency.

Reviewing this PR

The commits have been organized into a basic pattern for the sake of review. All the Patina SDK
changes are kept in their own commits and all the mass-edits for consumers are kept in separate
squash: ... commits. This is to keep the core changes clear and reviewable; these are squashed
into their respective change before merging.

There are three significant steps in this PR:

  1. Republish r_efi
  2. Move files to individual modules
  3. Refactor code and names in modules for consistency

Top level modules

Module Description
arch Abstractions for architecture specific functionality (e.g. caching) and architecture specific functions.
component Component and service definitions for the dependency-injected component model.
debug Macros and definitions for logging and diagnostics.
management_mode Definitions for Management Mode (MM/SMM) interactions.
mmio Re-export of the safe-mmio crate for memory-mapped I/O access.
performance Performance measurement types, records, and related GUIDs.
peripheral Abstractions and implementations for core device operations.
pi Platform Initialization (PI) specification definitions and wrappers.
uefi UEFI specification definitions and wrappers.

A detailed before/after view of the "New Patina Structure" is included in the original PR, showing the
reorganization of files (e.g. serial.rsstandard.rs, uefi_protocolprotocol,
protocolsprotocol, new peripheral and debug modules, r_efi re-export via standard, etc.).


PR #1660 — [major] Remove unnecessary protocol definitions from SDK

Description

Moves several protocol definitions from the uefi module in the SDK to their appropriate location:

  • DecompressProtocol: A duplicate definition with r_efi that carried implementation details that were not needed in the SDK.
    • Switched to use the r_efi version directly.
    • Moved implementation to dxe_core.
  • EdkiiPerformanceMeasurementProtocol: An EDKII protocol, that should only be produced and not consumed by Patina code.
    • Moved the definition to patina_performance that produces the protocol.
  • StatusCodeRuntimeProtocol: A wrapper around the PI definition providing a convenience function.
    • Moved the convenience function directly onto the pi module definition.

PR #1666 — [major] SDK Refactor: Republish base, update consumers, and cleanup [REBASE & FF]

Description

Second phase of large Patina SDK refactor, including:

Add CorePerformance to services

The performance refactor left out declaring the CorePerformance service in the derive service macro
for CorePerformance. This commit simply adds the missing service declaration.

SDK Refactor: Consume r_efi republish from patina crate

This commit changes all uses of r_efi in the patina repo to instead use the r_efi republished from
the patina crate, and removes r_efi from individual cargo dependencies.

SDK Refactor: Publish all of base from Patina root

This commit republishes all of Patina::base::* from the Patina root. This flattens callers' imports
and makes accessing common base types easier.

patina: Scope allow(static_mut_refs) only to necessary tests

Moves the global #![allow(static_mut_refs)] attributes to the test modules that require it, rather
than having it at the crate level. This change improves code safety and clarity by limiting the scope
of this allowance to only where it's needed.


PR #1669 — [major] Breaking changes for Patina SDK UEFI Strings [Rebase & FF]

Description

Breaking changes to use the new UEFI string
types that have been deferred until this PR to the major branch.

sdk: Use Patina SDK UEFI string types in public APIs

This is a breaking change to public APIs in the SDK to use the new UEFI string types where appropriate.

patina_dxe_core: Use Char16Str in filesystems::SimpleFile::open

This is a breaking change to use &Char16Str as the filename. Some other minor integrating changes in
patina_dxe_core for the new Patina SDK UEFI string types are included.

components: Integrate Patina SDK UEFI string changes

Updates the code to use the new string types modified in public APIs used by components that were made
as breaking changes.


PR #1674 — [major] Update the MSRV to 1.90.0

Description

Closes #1673

Updates the Minimum Supported Rust Version (MSRV) to 1.90.0. This update is being made at this time to
allow dependencies with an MSRV of 1.90.0 that have security advisories to be updated.


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

How This Was Tested

  • Unit tests
  • Patina tests on Q35
  • Patina tests on ArmVirt
  • Boot to OS on Q35
  • Boot to OS on ArmVirt

Integration Instructions

Performance Refactor

Platforms must change use of with_measurements from the patina_performance to instead override PlatformInfo::default_performance_config()

SerialIO Trait Changes

  1. All custom SerialIO implementations should drop any interior mutalability and adopt the &mut self references.
  2. Users of Uart16550 must swap to the new new_io and new_mmio instantiations.

Debugger Changes

Callers should remove use of without_transport_init which is already deprecated

Patina SDK Refactor

This change consists of major refactoring to the SDK. Consumers should ensure the following

Consume standard::efi instead of using r_efi to ensure consistent compilation.

  1. Update all references to modules moved to their new location. See the "New Patina Structure" above for reference.
  2. Update all renamed structures to conform to their new convention-based name

It is not practical to enumerate all possible changes here, but if there is any ambiguity, reach out to the core Patina team.

String Based Interface Changes

Review the public API changes and adjust consuming code accordingly. Any callers in the patina repo are updated in this PR.

Rust Version

MSRV Updated to 1.9. Consumers must update as well.

@patina-automation

patina-automation Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

QEMU Validation Failed

QEMU validation did not complete successfully or did not shutdown as expected.

Workflow run: https://github.com/OpenDevicePartnership/patina/actions/runs/30662770960

⚠️ Build Failure Detected

The Setup and Build patina-dxe-core-qemu step failed in the following job(s):

  • Run Patina QEMU Validation / Validate QEMU Q35 (Windows)
  • Run Patina QEMU Validation / Validate QEMU - ArmVirt (Linux)
  • Run Patina QEMU Validation / Validate QEMU - Q35 (Linux)

Build logs are available in the workflow run artifacts:

Download the log artifacts from the workflow run to review the build output and
determine whether the error is expected.

Is this expected? If the PR introduces breaking changes to patina that
require a corresponding update to patina-dxe-core-qemu,
the build failure is expected.

Contact a repo admin or PR reviewer to override the Patina QEMU PR Validation status check.

Job Results

Job Result
Gather Incoming PR Metadata
Run Patina QEMU Validation / Post In-Progress Notification
Run Patina QEMU Validation / Preflight Checks
Run Patina QEMU Validation / Get Constants / Get Repository Constants
Run Patina QEMU Validation / Validate QEMU Q35 (Windows)
Run Patina QEMU Validation / Validate QEMU - ArmVirt (Linux)
Run Patina QEMU Validation / Validate QEMU - Q35 (Linux)
Run Patina QEMU Validation / Emit PR Metadata

Error Details

qemu-validation-logs-Windows-Q35/q35-windows.log (5 error/warning sections)
error[E0432]: unresolved import `patina::boot_services`
  --> src\q35\component\service\smbios_test.rs:17:13
   |
17 | use patina::boot_services::{BootServices, StandardBootServices};
   |             ^^^^^^^^^^^^^ could not find `boot_services` in `patina`


error[E0603]: module `base` is private
  --> src\q35\component\service\mm_config_provider.rs:96:50
   |
96 |                     hob.pages as usize * patina::base::UEFI_PAGE_SIZE,
   |                                                  ^^^^ private module
   |
note: the module `base` is defined here
  --> D:\a\patina\patina\sdk\patina\src\lib.rs:21:1
   |
21 | mod base;
   | ^^^^^^^^
help: consider importing this constant instead
   |
96 -                     hob.pages as usize * patina::base::UEFI_PAGE_SIZE,
96 +                     hob.pages as usize * patina::UEFI_PAGE_SIZE,
   |


error: could not compile `qemu_dxe_core` (lib) due to 2 previous errors

warning: build failed, waiting for other jobs to finish...

[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 113 - Error while executing command, exit code: 101
qemu-validation-logs-Linux-ArmVirt/armvirt-linux.log (5 error/warning sections)
error[E0432]: unresolved import `patina::boot_services`
  --> src/q35/component/service/smbios_test.rs:17:13
   |
17 | use patina::boot_services::{BootServices, StandardBootServices};
   |             ^^^^^^^^^^^^^ could not find `boot_services` in `patina`


error[E0603]: module `base` is private
  --> src/q35/component/service/mm_config_provider.rs:96:50
   |
96 |                     hob.pages as usize * patina::base::UEFI_PAGE_SIZE,
   |                                                  ^^^^ private module
   |
note: the module `base` is defined here
  --> /__w/patina/patina/sdk/patina/src/lib.rs:21:1
   |
21 | mod base;
   | ^^^^^^^^
help: consider importing this constant instead
   |
96 -                     hob.pages as usize * patina::base::UEFI_PAGE_SIZE,
96 +                     hob.pages as usize * patina::UEFI_PAGE_SIZE,
   |


error: could not compile `qemu_dxe_core` (lib) due to 2 previous errors

warning: build failed, waiting for other jobs to finish...

[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 113 - Error while executing command, exit code: 101
qemu-validation-logs-Linux-Q35/q35-linux.log (5 error/warning sections)
error[E0432]: unresolved import `patina::boot_services`
  --> src/q35/component/service/smbios_test.rs:17:13
   |
17 | use patina::boot_services::{BootServices, StandardBootServices};
   |             ^^^^^^^^^^^^^ could not find `boot_services` in `patina`


error[E0603]: module `base` is private
  --> src/q35/component/service/mm_config_provider.rs:96:50
   |
96 |                     hob.pages as usize * patina::base::UEFI_PAGE_SIZE,
   |                                                  ^^^^ private module
   |
note: the module `base` is defined here
  --> /__w/patina/patina/sdk/patina/src/lib.rs:21:1
   |
21 | mod base;
   | ^^^^^^^^
help: consider importing this constant instead
   |
96 -                     hob.pages as usize * patina::base::UEFI_PAGE_SIZE,
96 +                     hob.pages as usize * patina::UEFI_PAGE_SIZE,
   |


error: could not compile `qemu_dxe_core` (lib) due to 2 previous errors

warning: build failed, waiting for other jobs to finish...

[cargo-make] ERROR - Error while running duckscript: Source: Unknown Line: 113 - Error while executing command, exit code: 101

Dependencies

Repository Ref
patina 1e631a0
patina-dxe-core-qemu f11ec63
patina-fw-patcher d06ba7e
patina-qemu firmware v4.0.5
patina-qemu build script d629f65

This comment was automatically generated by the Patina QEMU PR Validation Post workflow.

@github-actions github-actions Bot added impact:breaking-change Requires integration attention impact:testing Affects testing type:documentation Improvements or additions to documentation labels Jul 30, 2026
@cfernald
cfernald marked this pull request as draft July 30, 2026 19:51
@cfernald
cfernald marked this pull request as ready for review July 30, 2026 22:16
@cfernald cfernald changed the title Integrate major branch changes into main Integrate major branch changes into main [REBASE & FF} Jul 30, 2026
@cfernald cfernald changed the title Integrate major branch changes into main [REBASE & FF} Integrate major branch changes into main [REBASE & FF] Jul 30, 2026
@makubacki

Copy link
Copy Markdown
Collaborator

Since we've already reviewed the content changes, I was mostly looking at commit organization and high-level changes.

  1. patina_debugger: remove deprecated without_transport_init function

    • Wording in the commit message could be clearer: "This function removes the deprecated without_transport_init function"
  2. patina: Simplify serial implementations

    • Typo in commit message: "This commit takes advantage of the new mutabl references"
  3. patina: minor corrections to UEFI spec definitions

    • This one could just be titled "patina: Change IncompatibleError to IncompatibleVersion" since that's all it does.
  4. Could SDK Refactor: Consume r_efi republish from patina crate be squashed into Patina: republish r_efi from SDK? There is a squash note in the commit message.

  5. It also seems like squashing SDK Refactor: Publish all of base from Patina root into SDK Refactor: Organize and normalize definitions between modules would clean up history overall as many of the lines changed were just set to use base in the former commit.

@cfernald

Copy link
Copy Markdown
Contributor Author

@makubacki, I've implemented your suggestions.

cfernald added 11 commits July 31, 2026 13:08
The current `SerialIO` implementation takes `&self` instead of `&mut self`
for its method, forcing all serial implementations to implement
interior mutability. However, because of the nature of the serial port
use cases, the typical locking mechanisms that avoid deadlocks, such as
the `TplMutex` is not readily accessible. Because of this, internal
implementations have one-off, and at times questionable, interior mutability
implementations.

This commit removes the expectation on the serial port to ensure this,
and instead provides a re-usable `SharedSerial` wrapper that implements
interior mutability in a suitable way for serial port use cases.
This commit takes advantage of the new mutable references to cleanup
the serial port implementations. Namely by dropping re-initialization of
interior references used as a workaround for the lack of mutability
in the `SerialIO` trait.
This commit splits the null, 16550, and pl011 UART implementations into
their own submodules under the `uart` module. This better aligns to
general code organization practices. This additionally removes some
unnecessary conditional complication.

This commit also adds some basic tests for the uart implementations.
…penDevicePartnership#1643)

This commit removes the deprecated `without_transport_init` function.
This function is now a no-op and the inverse function `with_transport_init`
is now the control for this behavior.
This commit addresses multiple issues with the current performance structure

1. Performance data is not available until the component is dispatched.
This can cause significant misrepresentation of the DXE execution time
and cause events from images to be lost if not dispatched in the first
loop.
2. Performance implementations in the SDK require SDK statics, which is
generally an SDK antipattern.

This is address by the following:

1. Moves the core performance implementation into the core, into a new
struct names `CorePerformance`, following the pattern established by the
timer and memory management.
2. Creates a new service trait `PerformanceMeasurement` that exposes
this core support.
3. Updates the component to now use this core service to produce the
protocol & publish tables.
4. Change initialization and configuration of performance measurements
to be done by the core.
5. Updates all documentation according to these changes
6. Some smaller rework and restructuring
This commit introduces a new `standard` module in the Patina SDK, which
re-exports the `r_efi` crate. This is in it's own module to be able to
communicate the fact that this is contains standard without Patina-specific
extension.

This commit also updates all uses of r_efi in the patina repro to instead
use the r_efi republished from the patina crate, and removing r_efi from
individual cargo dependencies.
…lity

This commit creates well-defined top-level modules, documents them,
and moves existing modules and implementations into their new appropriate
locations.

This commit additionally clarifies comments in various modules for this
refactor.
This updates the name of the error type from `IncompatibleError` to
`IncompatibleVersion` to match the specification name.
This commit re-organizes the SDK to better align definitions to their
respective modules, and normalized the naming and paths of definitions.

All of the `Patina::base::*` is republished from the Patina root.
This flattens callers' imports and makes accessing common base types
easier.
…ip#1660)

Moves several protocol definitions from the `uefi` module in the SDK and
move to their appropriate location:

- `DecompressProtocol`: A duplicate definition with `r_efi` that carried
implementation details that were not needed in the SDK.
    - Switched to use the `r_efi` version directly
    - moved implementation to dxe_core
- `EdkiiPerformanceMeasurementProtocol`: An EDKII protocol, that should
only be produced and not consumed by Patina code
- Moved the definition to `patina_performance` that produces the protocol.
- `StatusCodeRuntimeProtocol`: A wrapper around the PI definition
providing a convenience function
- Moved the convenience function directly onto the `pi` module definition
Moves the global `#![allow(static_mut_refs)]` attributes to the test
modules that require it, rather than having it at the crate level.
This change improves code safety and clarity by limiting the scope of
this allowance to only where it's needed.
This is a breaking change to public APIs in the SDK to use the new
UEFI string types where appropriate.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This is a breaking change to use `&Char16Str` as the filename.

Some other minor integrating changes in patina_dxe_core for the new
Patina SDK UEFI string types are included.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Updates the code to use the new string types modified in public APIs
used by components that were made as breaking changes.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
## Description

Closes OpenDevicePartnership#1673

Updates the Minimum Supported Rust Version (MSRV) to 1.90.0. This update
is being made at this time to allow dependencies with an MSRV of 1.90.0
that have security advisories to be updated.

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

## How This Was Tested

- `cargo make all`

## Integration Instructions

- N/A

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki

Copy link
Copy Markdown
Collaborator

Overriding Patina QEMU PR Validation since build failure in patina-dxe-core-qemu is expected as this is merging breaking changes in the major branch into main.

@makubacki
makubacki merged commit d325bcb into OpenDevicePartnership:main Jul 31, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:breaking-change Requires integration attention impact:testing Affects testing type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Patina MSRV to 1.90.0 [Bug]: Performance tracking has a blackout as DXE entry

3 participants