Skip to content

patina-v22.2.2

Choose a tag to compare

@github-actions github-actions released this 21 Jul 22:58
90fb37f

What's Changed

  • [REBASE \& FF] Reorganize cpu mod and Enable Interrupts Before Sleeping @os-d (#1644)
    Change Details
      ## Description

    EfiCpu: Move Relevant Functions to SDK

    The EfiCpu trait existed before the arch mod in the SDK.

    This commit moves functions that are simply wrappers over basic architectural functionality to the SDK.

    EfiCpu: Move Remainder of Trait to DXE Core

    The final remaining function in the EfiCpu trait is DXE specific logic for initializing the FPU and GDT on X64 systems.

    This commit moves that logic to the DXE core and drops the cpu module in patina_internal_cpu.

    SDK: Allow Exprs in write_sysreg Macro

    This allows an expr instead of just a literal in the write_sysreg macro. This allows defining consts to use in the macro instead of just literal values.

    This commit then uses that to make DAIF_WR_IRQ_BIT a const instead of a literal. It also updates x64 comments to be clear on why preserves_flags is used.

    SDK/DXE: Update sleep to enable_interrupts_and_sleep

    In no case should FW ever sleep with interrupts off. The only place we sleep is gated by TPL_APPLICATION, so this is not strictly required, but make the API safer by enabling interrupts and then sleeping. This also allows for more performant sleeping in the case of device interrupts, because interrupts are only enabled (for x64) after the next instruction, so there is not a window where the interrupt can be missed.

    Move Timer Operations to SDK

    The SDK timer operations were stubbed out and real functionality existed in the DXE Core.

    This moves the DXE Core arch timer operations to the SDK and removes the stub impls there.

    How This Was Tested

    Booting Q35 and ArmVirt.

    Integration Instructions

    N/A. The changes here are for an internal only crate.




  • Switch from coverage\_nightly to coverage @makubacki (#1648)
    Change Details
      ## Description

    Since the repo is currently using the stable toolchain, switch from gating coverage_attribute on coverage_nightly to coverage per https://github.com/taiki-e/cargo-llvm-cov.

    This is set automatically by cargo-llvm-cov.

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

    How This Was Tested

    • cargo make coverage

    Checked the environment configured by cargo-llvm-cov in my local workspace:

    cargo llvm-cov show-env
    
    info: cargo-llvm-cov currently setting cfg(coverage); you can opt-out it by passing --no-cfg-coverage
    RUSTFLAGS="-Z allow-features=c_variadic,allocator_api -C instrument-coverage --cfg=coverage --cfg=trybuild_no_target"
    LLVM_PROFILE_FILE=patina\target\patina-%p-%16m.profraw
    CARGO_LLVM_COV=1
    CARGO_LLVM_COV_SHOW_ENV=1
    CARGO_LLVM_COV_TARGET_DIR=patina\target
    

    Checked codecov reports before and after. Before is on the left and after on the right in the image below.

    image

    Integration Instructions

    • N/A

    • patina-devops synced files will be updated in a single PR in that repo.


  • Update child handle validation in core\_disconnect\_controller() [Rebase \& FF] @makubacki (#1045)
    Change Details
      ## Description

    The first commit is the actual change and the second consolidates and cleans up related test code.


    Update child handle validation in core_disconnect_controller()

    Previously, when a specific child handle was requested but was not a
    child created by a driver managing the controller, that driver was not
    skipped. When the driver had no children its Stop() was still
    invoked, and the function reported success even though nothing was
    disconnected.

    This change:

    1. Skips a driver when a specific child handle is requested but is not
      present in that driver's child list (checked via child_handles
      being empty after filtering). When no managing driver owns the
      child, the call returns NotFound.

    2. Uses total_children == child_handles.len() to detect that the
      requested child was the driver's only child, in which case the
      driver itself is disconnected (Stop() with zero children). This
      matches the UEFI spec's "if ChildHandle is the only child ... the
      driver will be disconnected" behavior.

    Three unit tests are added:

    • test_disconnect_specific_child_not_managed_by_driver(): Checks
      that a specific child not owned by the single managing driver
      returns NotFound and Stop() is never called.

    • test_disconnect_specific_child_among_multiple_children(): Checks
      that a specific child among several is destroyed (Stop() called
      with that one child) while the driver-level Stop() is not called,
      so the driver stays connected.

    • test_disconnect_specific_child_not_owned_by_either_driver(): Checks
      that when two drivers are managing the controller and a child owned
      by neither is requested, that both drivers are skipped and NotFound
      is returned.

    Note: EFI_NOT_FOUND is not listed as a return value in for
    DisconnectController() in the UEFI 2.11 spec (section 7.3.13), but
    returning it when the requested child is unmanaged matches EDK II
    behavior.


    patina_dxe_core: Consolidate disconnect controller test setup logic

    The child-specific core_disconnect_controller() tests each repeated
    a lot of related logic to install a driver binding, mark the driver as
    managing the controller, and register its children.

    This commit adds two test helpers, new_test_handle() and
    setup_driver_managing_controller() to reduce the overall size of
    test functions.


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

    How This Was Tested

    • Run all unit tests
    • Check that test_disconnect_specific_child_not_managed_by_driver() fails without the change and passes with it
    • QEMU boot to EFI shell

    Integration Instructions

    • N/A


📖 Documentation Updates

  • Fix incorrect RFC number for shared core library @cfernald (#1642)
    Change Details
      ## Description

    This commit fixes an incorrect RFC number for the shared core library RFC, changing it from 0000 to 0031.

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

    How This Was Tested

    N/A

    Integration Instructions

    N/A




  • patina\_dxe\_core: Consistently apply test guards [Rebase \& FF] @makubacki (#1640)
    Change Details
      ## Description

    Resolves #1637

    Currently, tests use test_support::with_global_lock() to often wrap the test and its setup/teardown logic inside the global test lock. This ensures everything happens exclusively while holding the lock.

    Over time, test cleanup because more intricate and an issue so a "test guard" (test_support::StateGuard) was added that accepts a generic cleanup closure where the guard ensures that the cleanup code is run even if the test panics (as it is at the same scope as the test invocation).

    This all works well enough but:

    1. Some module tests are missing a guard.
    2. Common globals (GCD, protocol database, and allocator state) should really always be reset before each test.
    3. Guard creation often occurrred after test initialization logic which meant it was not in place to clean if the initialization logic itself panicked.

    This change adds a generic test_support::reset_global_state() function that can conveniently be used in guards, adds a guard to missing patina_dxe_core test modules, and moves guard creation to the top of test wrappers.


    Specifically, in this most recent case of flakiness, it appears that tests in runtime.rs were leaving dirty state in the globals getting picked up by init code in allocator.rs that was occasionally failing because of it. Those runtime.rs tests now exit in clean state due to the guard added.

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

    How This Was Tested

    • cargo make all
    • cargo make test about 10 times

    Integration Instructions

    • N/A


  • docs: Embed UEFI Forum BrightTALK video @makubacki (#1639)
    Change Details
      ## Description

    Embeds the YouTube video from the June 2026 UEFI Forum BrightTALK - "The State of Rust in UEFI and Q&A" into the introduction.md page so it is more easily discoverable for those viewing introductory documentation.

    Additional talk info:

    How This Was Tested

    • cargo make serve-mdbook
    • cargo make all

    Integration Instructions

    • N/A


Full Changelog: patina-v22.2.1...v22.2.2