UefiTestingPkg: SmmuV3 DMA Protection Audit Tests - #811
Conversation
1f55ab9 to
917c251
Compare
5e58e84 to
d0d4513
Compare
|
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. |
|
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. |
✅ QEMU Validation PassedSource Dependencies
Results
Workflow run: https://github.com/microsoft/mu_plus/actions/runs/30587467575 This comment was automatically generated by the Mu QEMU PR Validation workflow. |
|
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. |
172a9be to
17f60ec
Compare
5614ecb to
f288cf7
Compare
| 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; |
There was a problem hiding this comment.
Do you want to continue here instead of moving on to the next step in this loop?
There was a problem hiding this comment.
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.
| UINT64 Length; | ||
| struct _RMRListNode *Next; |
There was a problem hiding this comment.
nit: This is very leetcode style :)
Check out LIST_ENTRY and LinkedList.c from BaseLib.
There was a problem hiding this comment.
done, using LIST_ENTRY instead.
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:
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)
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.
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.
How This Was Tested
Tested on physical ARM device
Integration Instructions
N/A