Skip to content

[REBASE & FF] MdeModulePkg: Create IoMmuLib and add support to - PciBusDxe, PciHostBridgeDxe, NonDiscoverablePciDeviceDxe #1364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev/202502
Choose a base branch
from

Conversation

eeshanl
Copy link

@eeshanl eeshanl commented May 19, 2025

Description

Reverts PcdRequireIommu change, removes PcdRequireIommu.
Create IoMmuLib
Create IoMmuLibNull
Wrapper library for IoMmu Protocol functions.

Add IoMmuLib support to NonDiscoverablePciDeviceDxe
Modify IoMmu protocol usage and add IoMmuLib support to PciBusDxe and PciHostBridgeDxe

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?
  • Backport to release branch?

How This Was Tested

Tested on QEMU SBSA and physical arm device

Integration Instructions

Platform Integration

The library automatically adapts to platform capabilities. On platforms without IOMMU support, use IoMmuLibNull.
On platforms with IOMMU support, use IoMmuLib.

For integrating with a platform, in the top level DSC, you can do the following for example:

  # Enable IoMmu/Smmu support
  DEFINE REQUIRE_IOMMU             = TRUE

!if $(REQUIRE_IOMMU) == TRUE
  IoMmuLib|MdeModulePkg/Library/IoMmuLib/IoMmuLib.inf
!else
  IoMmuLib|MdeModulePkg/Library/IoMmuLibNull/IoMmuLibNull.inf
!endif

@github-actions github-actions bot added the impact:non-functional Does not have a functional impact label May 19, 2025
@eeshanl eeshanl self-assigned this May 19, 2025
@eeshanl eeshanl changed the title Create IoMmuLib MdeModulePkg: Create IoMmuLib May 19, 2025
@eeshanl eeshanl changed the title MdeModulePkg: Create IoMmuLib MdeModulePkg: Create IoMmuLib and add IoMmu support to NonDiscoverablePciDeviceDxe May 19, 2025
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2025

Codecov Report

Attention: Patch coverage is 0% with 245 lines in your changes missing coverage. Please review.

Please upload report for BASE (dev/202502@61b2225). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...coverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c 0.00% 123 Missing ⚠️
MdeModulePkg/Library/IoMmuLib/IoMmuLib.c 0.00% 78 Missing ⚠️
...ModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c 0.00% 39 Missing ⚠️
MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c 0.00% 3 Missing ⚠️
MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c 0.00% 1 Missing ⚠️
...dulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev/202502    #1364   +/-   ##
=============================================
  Coverage              ?    1.06%           
=============================================
  Files                 ?      932           
  Lines                 ?   322663           
  Branches              ?     2830           
=============================================
  Hits                  ?     3435           
  Misses                ?   319174           
  Partials              ?       54           
Flag Coverage Δ
MdeModulePkg 0.64% <0.00%> (?)
NetworkPkg 0.55% <ø> (?)
PolicyServicePkg 30.42% <ø> (?)
UefiCpuPkg 4.86% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eeshanl eeshanl force-pushed the iommu_lib branch 3 times, most recently from 4ef4ea3 to 2daf9b7 Compare May 19, 2025 06:46
@github-actions github-actions bot added the impact:security Has a security impact label May 19, 2025
@eeshanl eeshanl removed the impact:non-functional Does not have a functional impact label May 19, 2025
@eeshanl
Copy link
Author

eeshanl commented May 20, 2025

Will add IoMmuLib support for PciIo and PciRootBridgeIo in a separate PR.

@eeshanl eeshanl force-pushed the iommu_lib branch 2 times, most recently from bad520e to ecfbde7 Compare May 20, 2025 01:30
@eeshanl eeshanl marked this pull request as ready for review May 20, 2025 02:01
@eeshanl eeshanl force-pushed the iommu_lib branch 5 times, most recently from 3b792b1 to e4fe9fc Compare June 4, 2025 10:29
@eeshanl eeshanl force-pushed the iommu_lib branch 5 times, most recently from 05443db to 052301b Compare June 5, 2025 08:26
@eeshanl eeshanl requested a review from os-d June 5, 2025 18:40
@eeshanl eeshanl force-pushed the iommu_lib branch 6 times, most recently from 3bdb7fa to 8ace323 Compare June 6, 2025 12:35
@eeshanl eeshanl requested a review from cfernald June 6, 2025 17:16
@eeshanl
Copy link
Author

eeshanl commented Jun 6, 2025

Will merge after @kenlautner gives green light on x64 platform test.

@eeshanl eeshanl force-pushed the iommu_lib branch 3 times, most recently from 6e861f9 to 07c28d8 Compare June 10, 2025 06:06
@eeshanl eeshanl changed the title MdeModulePkg: Create IoMmuLib and add support to - PciBusDxe, PciHostBridgeDxe, NonDiscoverablePciDeviceDxe [REBASE & FF] MdeModulePkg: Create IoMmuLib and add support to - PciBusDxe, PciHostBridgeDxe, NonDiscoverablePciDeviceDxe Jun 10, 2025
@eeshanl eeshanl force-pushed the iommu_lib branch 2 times, most recently from 0c1bd53 to 2252d70 Compare June 13, 2025 08:16
eeshanl added 4 commits June 13, 2025 01:16
Wrapper library for IoMmu Protocol functions.
Uses IoMmuLib to do IoMmu protocol mappings.
- Removes usage of PCD and callbacks to locate IoMmu protocol
- Library wraps all this logic
@os-d os-d added the impact:breaking-change Requires integration attention label Jun 13, 2025

// MU_CHANGE [BEGIN] - Use IoMmuLib
Status = IoMmuSetAttribute (
PciIoDevice->Handle,
Copy link
Author

Choose a reason for hiding this comment

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

change to PciIoDevice

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:security Has a security impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants