Skip to content

Initial implementation of supervisor#1385

Draft
kuqin12 wants to merge 6 commits into
OpenDevicePartnership:feature/supvfrom
kuqin12:supv_init
Draft

Initial implementation of supervisor#1385
kuqin12 wants to merge 6 commits into
OpenDevicePartnership:feature/supvfrom
kuqin12:supv_init

Conversation

@kuqin12

@kuqin12 kuqin12 commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Description

This is the initial implementation of MM supervisor and user core in Rust.

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

How This Was Tested

This was tested on QEMU Q35 platform and booted to OS desktop as well as passed supervisor test app.

Integration Instructions

The integration guide is listed in: https://github.com/kuqin12/mu_feature_mm_supv/blob/personal/kuqin/supv_init/SeaPkg/Docs/PlatformIntegration/PlatformIntegrationSteps.md#integraion-guide-for-rust-based-supervisor. Because it provides the implementation of MM supervisor init module.

@patina-automation

patina-automation Bot commented Mar 11, 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/28404973648

⚠️ Build Failure Detected

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

  • Run Patina QEMU Validation / Validate QEMU - ArmVirt (Linux)
  • Run Patina QEMU Validation / Validate QEMU Q35 (Windows)
  • 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 - ArmVirt (Linux)
Run Patina QEMU Validation / Validate QEMU Q35 (Windows)
Run Patina QEMU Validation / Validate QEMU - Q35 (Linux)
Run Patina QEMU Validation / Emit PR Metadata

Error Details

qemu-validation-logs-Linux-ArmVirt/armvirt-linux.log (8 error/warning sections)
warning: patch `patina_mm_supervisor v22.0.1 (/__w/patina/patina/patina_mm_supervisor)` was not used in the crate graph

warning: patch `patina_mm_user_core v22.0.1 (/__w/patina/patina/patina_mm_user_core)` was not used in the crate graph
help: Check that the patched package version and available features are compatible

warning: patch `patina_mm_supervisor v22.0.1 (/__w/patina/patina/patina_mm_supervisor)` was not used in the crate graph

warning: patch `patina_mm_user_core v22.0.1 (/__w/patina/patina/patina_mm_user_core)` was not used in the crate graph
help: Check that the patched package version and available features are compatible

error[E0308]: mismatched types
   --> src/q35/component/service/smbios_test.rs:45:49
    |
 45 |         boot_services.locate_protocol_unchecked(&SMBIOS_PROTOCOL_GUID, core::ptr::null_mut()).map_err(|e| {
    |                       ------------------------- ^^^^^^^^^^^^^^^^^^^^^ expected `r_efi::base::Guid`, found `r_efi::efi::Guid`
    |                       |
    |                       arguments to this method are incorrect
    |
note: there are multiple different versions of crate `r_efi` in the dependency graph
   --> /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/r-efi-6.0.0/src/base.rs:392:1
    |
392 | pub struct Guid {
    | ^^^^^^^^^^^^^^^ this is the expected type
    |
   ::: /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/r-efi-7.0.0/src/base.rs:392:1
    |
392 | pub struct Guid {
    | --------------- this is the found type
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> /__w/patina/patina/sdk/patina/src/boot_services.rs:826:15
    |
826 |     unsafe fn locate_protocol_unchecked(
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.

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

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-Windows-Q35/q35-windows.log (8 error/warning sections)
warning: patch `patina_mm_supervisor v22.0.1 (D:\a\patina\patina\patina_mm_supervisor)` was not used in the crate graph

warning: patch `patina_mm_user_core v22.0.1 (D:\a\patina\patina\patina_mm_user_core)` was not used in the crate graph
help: Check that the patched package version and available features are compatible

warning: patch `patina_mm_supervisor v22.0.1 (D:\a\patina\patina\patina_mm_supervisor)` was not used in the crate graph

warning: patch `patina_mm_user_core v22.0.1 (D:\a\patina\patina\patina_mm_user_core)` was not used in the crate graph
help: Check that the patched package version and available features are compatible

error[E0308]: mismatched types
   --> src\q35\component\service\smbios_test.rs:45:49
    |
 45 |         boot_services.locate_protocol_unchecked(&SMBIOS_PROTOCOL_GUID, core::ptr::null_mut()).map_err(|e| {
    |                       ------------------------- ^^^^^^^^^^^^^^^^^^^^^ expected `r_efi::base::Guid`, found `r_efi::efi::Guid`
    |                       |
    |                       arguments to this method are incorrect
    |
note: there are multiple different versions of crate `r_efi` in the dependency graph
   --> C:\Users\runneradmin\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\r-efi-6.0.0\src\base.rs:392:1
    |
392 | pub struct Guid {
    | ^^^^^^^^^^^^^^^ this is the expected type
    |
   ::: C:\Users\runneradmin\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\r-efi-7.0.0\src\base.rs:392:1
    |
392 | pub struct Guid {
    | --------------- this is the found type
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> D:\a\patina\patina\sdk\patina\src\boot_services.rs:826:15
    |
826 |     unsafe fn locate_protocol_unchecked(
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.

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

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 (8 error/warning sections)
warning: patch `patina_mm_supervisor v22.0.1 (/__w/patina/patina/patina_mm_supervisor)` was not used in the crate graph

warning: patch `patina_mm_user_core v22.0.1 (/__w/patina/patina/patina_mm_user_core)` was not used in the crate graph
help: Check that the patched package version and available features are compatible

warning: patch `patina_mm_supervisor v22.0.1 (/__w/patina/patina/patina_mm_supervisor)` was not used in the crate graph

warning: patch `patina_mm_user_core v22.0.1 (/__w/patina/patina/patina_mm_user_core)` was not used in the crate graph
help: Check that the patched package version and available features are compatible

error[E0308]: mismatched types
   --> src/q35/component/service/smbios_test.rs:45:49
    |
 45 |         boot_services.locate_protocol_unchecked(&SMBIOS_PROTOCOL_GUID, core::ptr::null_mut()).map_err(|e| {
    |                       ------------------------- ^^^^^^^^^^^^^^^^^^^^^ expected `r_efi::base::Guid`, found `r_efi::efi::Guid`
    |                       |
    |                       arguments to this method are incorrect
    |
note: there are multiple different versions of crate `r_efi` in the dependency graph
   --> /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/r-efi-6.0.0/src/base.rs:392:1
    |
392 | pub struct Guid {
    | ^^^^^^^^^^^^^^^ this is the expected type
    |
   ::: /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/r-efi-7.0.0/src/base.rs:392:1
    |
392 | pub struct Guid {
    | --------------- this is the found type
    = help: you can use `cargo tree` to explore your dependency tree
note: method defined here
   --> /__w/patina/patina/sdk/patina/src/boot_services.rs:826:15
    |
826 |     unsafe fn locate_protocol_unchecked(
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.

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

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 d3a06ea
patina-dxe-core-qemu fb2e07f
patina-fw-patcher 5b82a50
patina-qemu firmware v4.0.1
patina-qemu build script cf7af08

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

@github-actions github-actions Bot added the impact:security Has a security impact label Mar 11, 2026
@kuqin12 kuqin12 marked this pull request as draft March 11, 2026 00:33
@kuqin12 kuqin12 changed the base branch from main to feature/supv March 11, 2026 01:15
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread core/patina_internal_mm_common/src/lib.rs Outdated
Comment thread core/patina_internal_mm_alloc/src/lib.rs Outdated

@Javagedes Javagedes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm very concerned about the number of global statics in your implementation. I understand it may actually be necessary to be able to perform our SEA validation on the supervisor.

We need to consolidate the statics if possible. If we cannot (due to SEA validation requirements), then we need to make trait abstractions around each of the different statics so that at runtime they all link up, but for testing you can use mockall to mock the different statics. e.g. something like:

static MY_STATIC: SomeStatic = SomeStatic::new();

trait MyTrait {
    fn interface_fn1();
    fn interface_fn2();
}

impl MyTrait for SomeStatic {
    fn interface_fn1() { MY_STATIC.interface_fn1() }
    fn interface_fn2() { MY_STATIC.interface_fn2() }
}

This will allow us to use mockall with the trait to do proper mocking.

Comment thread components/patina_mm/src/protocol/mm_supervisor_request.rs Outdated
Comment thread patina_mm_user_core/src/pool_allocator.rs Outdated
Comment thread patina_mm_user_core/src/pool_allocator.rs Outdated
Comment thread core/patina_internal_mm_alloc/src/lib.rs Outdated
Comment thread patina_mm_user_core/src/pool_allocator.rs Outdated
Comment thread patina_mm_user_core/src/protocol_db.rs Outdated
Comment thread patina_mm_user_core/src/mm_dispatcher.rs Outdated
Comment thread core/patina_internal_cpu/src/save_state.rs
Comment thread core/patina_internal_cpu/src/save_state/mod.rs Outdated
Comment thread sdk/patina/src/timer/mod.rs Outdated
@kuqin12 kuqin12 force-pushed the supv_init branch 2 times, most recently from 8a5c38f to c0baea8 Compare March 16, 2026 21:52
Comment thread patina_mm_supervisor_core/src/lib.rs Outdated
Comment thread patina_mm_supervisor_core/src/lib.rs Outdated
Comment thread patina_mm_supervisor_core/src/lib.rs Outdated
Comment thread patina_mm_supervisor_core/src/lib.rs Outdated
Comment thread patina_mm_supervisor_core/src/mailbox.rs Outdated
Comment thread patina_mm_supervisor_core/src/supervisor_handlers.rs Outdated
Comment thread patina_mm_user_core/src/lib.rs Outdated
Comment thread patina_mm_user_core/src/lib.rs Outdated
Comment thread patina_mm_user_core/src/protocol_db.rs Outdated
Comment thread sdk/patina/src/timer/mod.rs Outdated
Comment thread components/patina_mm_policy/Cargo.toml Outdated
Comment thread core/patina_internal_mm_common/README.md Outdated
Comment thread patina_mm_supervisor/src/privilege_mgmt/call_gate.rs
Comment thread patina_mm_supervisor_core/src/privilege_mgmt/mod.rs Outdated
Comment thread patina_mm_supervisor/src/privilege_mgmt/syscall_setup.rs Outdated
Comment thread patina_mm_supervisor_core/src/lib.rs Outdated
Comment thread patina_mm_user_core/src/lib.rs Outdated
Comment thread patina_mm_supervisor/src/mm_mem.rs Outdated
Comment thread patina_mm_supervisor_core/src/supervisor_handlers.rs Outdated
Comment thread patina_mm_user_core/src/lib.rs Outdated
@kuqin12 kuqin12 force-pushed the supv_init branch 6 times, most recently from 027814b to 221a7a5 Compare April 15, 2026 09:21
@kuqin12

kuqin12 commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

Binary level PR: OpenDevicePartnership/patina-dxe-core-qemu#162

@kuqin12 kuqin12 force-pushed the supv_init branch 6 times, most recently from a36196f to 4531212 Compare June 23, 2026 21:58
@kuqin12 kuqin12 self-assigned this Jun 23, 2026
@kuqin12 kuqin12 force-pushed the supv_init branch 2 times, most recently from 8623257 to 593d694 Compare June 23, 2026 22:31
@kuqin12 kuqin12 force-pushed the supv_init branch 4 times, most recently from 85c905c to 910a2e5 Compare June 24, 2026 09:26
@kuqin12 kuqin12 force-pushed the supv_init branch 4 times, most recently from 2586dc6 to fb64c5b Compare June 29, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:security Has a security impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants