Skip to content

UefiTestingPkg: SmmuV3 DMA Protection Audit Tests - #811

Open
eeshanl wants to merge 5 commits into
microsoft:release/202511from
eeshanl:smmu_audit_test
Open

UefiTestingPkg: SmmuV3 DMA Protection Audit Tests#811
eeshanl wants to merge 5 commits into
microsoft:release/202511from
eeshanl:smmu_audit_test

Conversation

@eeshanl

@eeshanl eeshanl commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Description

Add SmmuV3 DMA Protection Audit Tests

Extends the DMA Protection Audit suite (previously VT-d and IVRS only) with an AArch64 DMASmmuProtectionUnitTestApp that plugs SMMUv3-specific implementations into the existing shared test entry point. The app parses the IORT (EFI_ACPI_6_0_IO_REMAPPING_TABLE_SIGNATURE) to enumerate SMMUv3 nodes and their Reserved Memory Range (RMR) associations, then registers three test cases:

  1. CheckIOMMUEnabled - IOMMU.StatusRegister
    For each SMMUv3 unit discovered in the IORT, verifies the unit is in a DMA-safe state.
    If translation is on (CR0.SMMUEN == 1), the test additionally confirms:
    CR0.CMDQEN == 1 (command queue enabled)
    CR0.EVTQEN == 1 (event queue enabled)
    STRTAB_BASE != 0 (stream table configured)
    GERROR == 0 (no global errors)

  2. CheckExcludedRegions - IOMMU.ExcludedRangeTest
    SMMU equivalent of the VT-d / IVRS "excluded regions" check. Walks every RMR node in the IORT and, for each one, verifies:
    An EFI memory map descriptor fully encompasses the RMR's [BaseAddress, BaseAddress + Length) range, and
    That descriptor's memory type is EfiReservedMemoryType or EfiRuntimeServicesData.
    An RMR that is missing from the memory map, or is present but marked with a non-reserved type, fails the test. Platforms with no RMRs in the IORT pass trivially.

  3. CheckBMETeardown - IOMMU.BMETeardown (shared)
    Unchanged behavior - the existing "bus mastering disabled at ExitBootServices" test is reused as-is. Test registration order was adjusted so this reboot-triggering test runs last, and a PASSED log line was added on the success path.

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?

How This Was Tested

Tested on physical ARM device

Integration Instructions

N/A

@eeshanl eeshanl self-assigned this Jan 8, 2026
@mu-automation mu-automation Bot added the impact:non-functional Does not have a functional impact label Jan 8, 2026
@eeshanl
eeshanl force-pushed the smmu_audit_test branch 9 times, most recently from 5e58e84 to d0d4513 Compare January 9, 2026 05:13
@mu-automation

mu-automation Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has not had activity in 60 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@mu-automation mu-automation Bot added the state:stale Has not been updated in a long time label Mar 10, 2026
@mu-automation

mu-automation Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically been closed because it did not have any activity in 60 days and no follow up within 7 days after being marked stale. Thank you for your contributions.

@mu-automation mu-automation Bot closed this Mar 17, 2026
@eeshanl eeshanl reopened this Apr 8, 2026
@mu-automation

mu-automation Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

✅ QEMU Validation Passed

Source Dependencies

Repository Commit
mu_plus 772975a
mu_tiano_platforms 956378b

Results

Platform Target Build Boot Overall Boot Time Build Logs Boot Logs
Q35 DEBUG ✅ success ✅ success 0m 20s Build Logs Boot Logs
ArmVirt DEBUG ✅ success ✅ success 0m 14s Build Logs Boot Logs

Workflow run: https://github.com/microsoft/mu_plus/actions/runs/30587467575

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

@mu-automation mu-automation Bot removed the state:stale Has not been updated in a long time label Apr 8, 2026
@mu-automation

mu-automation Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has not had activity in 60 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@mu-automation mu-automation Bot added the state:stale Has not been updated in a long time label Jun 7, 2026
@eeshanl eeshanl removed the state:stale Has not been updated in a long time label Jun 13, 2026
@mu-automation mu-automation Bot added the language:python Pull requests that update Python code label Jun 16, 2026
@eeshanl
eeshanl changed the base branch from release/202502 to release/202511 June 16, 2026 04:39
@mu-automation mu-automation Bot removed the language:python Pull requests that update Python code label Jun 16, 2026
@eeshanl
eeshanl force-pushed the smmu_audit_test branch 2 times, most recently from 172a9be to 17f60ec Compare June 16, 2026 05:22
@mu-automation mu-automation Bot added the impact:testing Affects testing label Jul 30, 2026
@eeshanl eeshanl changed the title SmmuV3 DMA Protection Audit Tests UefiTestingPkg: SmmuV3 DMA Protection Audit Tests Jul 30, 2026
@eeshanl
eeshanl marked this pull request as ready for review July 30, 2026 20:35
@eeshanl
eeshanl force-pushed the smmu_audit_test branch 2 times, most recently from 5614ecb to f288cf7 Compare July 30, 2026 21:32
if (CmdQEnBit == 0) {
UT_LOG_ERROR ("CMDQEN bit is disabled for SMMUv3 at base address 0x%lX\n", SmmuBaseAddresses[Iterator]);
DEBUG ((DEBUG_ERROR, "%a: CMDQEN bit is disabled for SMMUv3 at base address 0x%lX\n", __func__, SmmuBaseAddresses[Iterator]));
TestStatus = UNIT_TEST_ERROR_TEST_FAILED;

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.

Do you want to continue here instead of moving on to the next step in this loop?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

would prefer to continue execution, so that every case is tested, and then a final pass/fail verdict is made. That way for debugging, you can tell what specifically failed through the logs instead of just exiting early on first error.

Comment on lines +52 to +53
UINT64 Length;
struct _RMRListNode *Next;

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.

nit: This is very leetcode style :)

Check out LIST_ENTRY and LinkedList.c from BaseLib.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, using LIST_ENTRY instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:non-functional Does not have a functional impact impact:testing Affects testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants