Some BIOSes protect memory region they reside in by using DMAR to prevent devices from doing any DMA transactions to that part of RAM.
AMI refers to this as "DMA Control Guarantee".
Disable that protection right after address translation is enabled.
I stumbled upon this while investigation a failing coredump on a device which has this feature enabled.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sys/x86/iommu/intel_utils.c | ||
---|---|---|
507 | if ((unit->hw_cap & (DMAR_CAP_PLMR | DMAR_CAP_PHMR)) == 0) | |
532 | I think this should be done before enabling TE, at least for compatibility with older hardware that enables protected regions when translation is enabled. Also I suggest to add explicit call to dmar_disable_protected_regions() into place that does dmar_enable_translation(), leaving this utility function single-purpose. |
Call dmar_disable_protected_regions from outside of dmar_enable_translation.
I've also changed the behaviour so that if the former function fails we still continue after printing a warning.
There is at least one quirk that removes the PMR capabilities - nb_5400_no_low_high_prot_mem and I guess that even if we fail to disable those IOMMU should still be able to operate just fine.