intel_iommu: disable all VT-d PMRs when TXT launched
authorJoseph Cihula <joseph.cihula@intel.com>
Mon, 21 Mar 2011 18:04:24 +0000 (11:04 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 21 Apr 2011 12:51:40 +0000 (13:51 +0100)
commit51a63e67da6056c13b5b597dcc9e1b3bd7ceaa55
tree88258f313963c0b67de3ba2f1ad57d4365b86496
parent2fe9723df8e45fd247782adea244a5e653c30bf4
intel_iommu: disable all VT-d PMRs when TXT launched

Intel VT-d Protected Memory Regions (PMRs) are supposed to be disabled,
on each VT-d engine, after DMA remapping is enabled on the engines.
This is because the behavior of having both enabled is not deterministic
and because, if TXT has been used to launch the kernel, the PMRs may be
programmed to cover memory regions that will be used for DMA.

Under some circumstances (certain quirks detected, lack of multiple
devices, etc.), the current code does not set up DMA remapping on some
VT-d engines.  In such cases it also skips disabling the PMRs.  This
causes failures when the kernel is launched with TXT (most often this
occurs on the graphics engine and results in colored vertical bars on
the display).

This patch detects when the kernel has been launched with TXT and then
disables the PMRs on all VT-d engines.  In some cases where the reason
that remapping is not being enabled is due to possible ACPI DMAR table
errors, the VT-d engine addresses may not be correct and thus not able
to be safely programmed even to disable PMRs.  Because part of the TXT
launch process is the verification of these addresses, it will always be
safe to disable PMRs if the TXT launch has succeeded and hence only
doing this in such cases.

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/pci/intel-iommu.c