Skip to content

patina-v0.1.1

Choose a tag to compare

@github-actions github-actions released this 23 May 20:38
· 959 commits to refs/heads/main since this release
d8816c5

What's Changed

  • Makefile: Move `cargo doc --open` to `cargo make doc-open` @makubacki (#452)
    Change Details
      ## Description

    Closes #451

    Allows cargo make all to use cargo make doc which doesn't open the Web browser with documentation when running the command.

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

    How This Was Tested

    • cargo make doc
    • cargo make doc-open
    • cargo make all

    Integration Instructions

    Review the readme to understand what command to use for your use case.




  • Move GCD interaction from FixedSizeBlockAllocator to SpinLockedFixedSizeBlockAllocator @kouchekiniad (#435)
    Change Details
      ## Description

    To avoid interacting with the GCD in the FSB's locked regions (which can potentially cause an FSB lock re-entrancy if the GCD allocates memory), this change moves all interaction with the GCD outside of the locked regions of the FSB and into the spin-locked FSB. As such, new memory allocations from the GCD are now either requested by the FSB then allocated from the spin-locked FSB (in the case of alloc/dealloc) or made by the spin-locked FSB, which then informs the FSB of the change.

    Main changes include:

    • Rather than expanding by allocating memory from the GCD directly, the FSB's expand is now passed-in a region of memory to expand itself with which is allocated from the GCD by the spin-locked FSB

      • Attempted allocations in the FSB will return FixedSizeBlockAllocatorError::OutOfMemory(additional_mem_requested) if the FSB is unable to fit the allocation, prompting the spin-locked FSB to allocate additional memory with the GCD and call expand on the FSB
      • Note: This has the side effect that the FSB's pool_allocation_calls stat would be incremented twice in the case that additional memory needs to be allocated by the spin-locked FSB
    • As there is no longer a direct analogue for the alloc/dealloc functions of GlobalAlloc and the allocate/deallocate functions of Allocator, the FSB now defines only one alloc and dealloc which are shared by both trait implementations

    • The bulk of the allocation logic for allocate_pages and free_pages have been moved into the spin-locked FSB, which then notifies the FSB of any page allocations made/freed with notify_page_allocation and notify_pages_freed

    • preferred_range has been renamed to reserved_range as the FSB itself makes no preference for putting new allocations into the preferred_range, and any preference the GCD would show for allocating memory in that region would be solely predicated by the "preferred_range" being allocated earlier in the boot process

    • GCD interaction as part of reserve_memory_region has been moved to the spin-locked FSB, with the reserved memory region being registered in the FSB with set_reserved_range(range). Rather than calling into allocate_pages then free_pages to reserve the memory region, reserve_memory_region now reserves memory in the GCD by directly calling gcd.allocate_memory_space then gcd.free_memory_space_preserving_ownership to avoid having to undo the stats side-effects of the allocate_pages and free_pages functions.

      • Note: This has the effect of not iterating page_allocation_calls and page_free_calls when calling reserve_memory_pages
    • To keep things consistent, raw pointers and raw pointers + usize lengths have been largely replaced with NonNull<u8> and NonNull<[u8]> respectively.

    • Impacts functionality?

    • Impacts security?

    • Breaking change?

    • Includes tests?

    • Includes documentation?

    How This Was Tested

    Booted to Windows on x64 physical platform.

    Integration Instructions

    N/A

      </blockquote>
      <hr>
    </details>
    
  • EventDb: Allow re-entrance to tpl\_restore from event notify functions. @joschock (#446)
    Change Details
      ## Description

    The present implementation of restore_tpl uses an atomic flag EVENT_NOTIFIES_IN_PROGRESS to handle the issue where locking the EVENT DB triggers a restore_tpl that would result in an endless loop. The implementation currently holds that flag while invoking the event notification function which has the effect of preventing notification callbacks during the execution of event notifies.

    Generally this is not an issue, but there are some corner cases where this can violate expectations of code that expects to manipulate the TPL within the event callback to trigger other event notifies. An example of where this is in the UsbBusDxe driver here: https://github.com/microsoft/mu_basecore/blob/3fd74e217a1e6c72f90efb1517f7da610c42d074/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c#L1009

    This while loop will hang unless timer events fire while it is looping - and the EVENT_NOTIFIES_IN_PROGRESS implementation presently prevents that.

    This PR reworks the restore_tpl implementation such that the EVENT_NOTIFIES_IN_PROGRESS flag is released before executing the notification functions - this allows re-entrancy to restore_tpl from the notification functions while still addressing the infinite regress issue from the event db lock.

    In addition, this PR removes the EventNotificationIterator object as it is no longer required given the rework of the code. An equivalent iterator can be generated with the core::iter::from_fn function (as is demo'd in the updated test code).

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

    How This Was Tested

    Basic functional testing to ensure that pathological case from UsbBusDxe above is addressed functionally, updated unit tests

    Integration Instructions

    N/A - no public APIs changed.




  • Support for Hoblist with dxe core in allocation hob @HappyCoding-2025 (#402)
    Change Details
      Fixes https://github.com//issues/323 This is already reviewed code and was asked to move this code as part of another PR as per Michael. Hence raising another PR for this.

    Also - this addresses the comments given from #326.

    The current hoblist in testsupport crate is not sufficient and does not contain the dxe-core HOB with dxe core efi filled in expected by our initiatlisation. When existing hoblist is used, it panics.
    Hence there was a need to create another hoblist with dxe-core and fill in with dxe EFI.
    Based on comments from #326.
    The comment mentioned on taking only the hoblist part and push to main.
    Hence creating this issue for tracking.

      </blockquote>
      <hr>
    </details>
    
  • RFC: Consolidate SDK Crates into `patina_sdk` and `patina_sdk_macro` as Modules @vineelko (#437)
    Change Details
      ## Description

    This RFC proposes consolidating the existing crates inside the Patina sdk
    directory into the patina_sdk and patina_sdk_macro crates, organized by
    modules. No functional changes to the modules are intended.

    Tracks: #418

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

    How This Was Tested

    NA

    Integration Instructions

    NA




  • Minor doc url updates @vineelko (#438)
    Change Details
      ## Description

    Update references to patina-paging and patina-mtrr repositories in the documentation

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

    How This Was Tested

    NA

    Integration Instructions

    NA




  • mm\_communicator: Remove comm buffer trace message @makubacki (#439)
    Change Details
      ## Description

    Some platforms always have tracing on and this is noisy. Can be viewed in debugger if needed.

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

    How This Was Tested

    • cargo make all

    Integration Instructions

    • Comm buffer dump no longer present in trace level by default


  • chore: Release v0.1.0 @makubacki (#440)
    Change Details
      ## Description

    Some crates such as patina_dxe_core were missing in patina-fw until the publishing changes were included (in this release).




📖 Documentation Updates

  • [REBASE\&FF] uefi\_sdk: support Service const instantiation @Javagedes (#433)
    Change Details
      ## Description

    Adds support for const instantiation of a service (in an uninitialized state) to support using services in const contexts without the need of wrapping it in some type of container object.

    This is done by using a OnceCell, which does come with a performance cost, which was mitigated (to almost exactly the same performance) by updating the Deref implementation to hint to the compiler that one path is unreachable (which it is, per the safety notes).

    This also comes with a commit to add service benchmarks to benchmark performance of calling a services function, and the performance impact of using a dyn object service vs a concrete service. For anyone curious, these were the performance numbers:

    description dyn concrete
    Prior Art ~3.7ns ~2.5ns
    With const ~3.6ns ~2.4ns
    • Impacts functionality?
    • Impacts security?
    • Breaking change?
    • Includes tests?
    • Includes documentation?

    How This Was Tested

    Multiple Tests and new benchmarks

    Integration Instructions

    N/A

      </blockquote>
      <hr>
    </details>
    

Full Changelog: patina-v0.1.0...v0.1.1