x86, dmar: start with sane state while enabling dma and interrupt-remapping
Impact: cleanup/sanitization Start from a sane state while enabling dma and interrupt-remapping, by clearing the previous recorded faults and disabling previously enabled queued invalidation and interrupt-remapping. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:

committed by
H. Peter Anvin

parent
eba67e5da6
commit
1531a6a6b8
@@ -1855,11 +1855,40 @@ static int __init init_dmars(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Start from the sane iommu hardware state.
|
||||
*/
|
||||
for_each_drhd_unit(drhd) {
|
||||
if (drhd->ignored)
|
||||
continue;
|
||||
|
||||
iommu = drhd->iommu;
|
||||
|
||||
/*
|
||||
* If the queued invalidation is already initialized by us
|
||||
* (for example, while enabling interrupt-remapping) then
|
||||
* we got the things already rolling from a sane state.
|
||||
*/
|
||||
if (iommu->qi)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Clear any previous faults.
|
||||
*/
|
||||
dmar_fault(-1, iommu);
|
||||
/*
|
||||
* Disable queued invalidation if supported and already enabled
|
||||
* before OS handover.
|
||||
*/
|
||||
dmar_disable_qi(iommu);
|
||||
}
|
||||
|
||||
for_each_drhd_unit(drhd) {
|
||||
if (drhd->ignored)
|
||||
continue;
|
||||
|
||||
iommu = drhd->iommu;
|
||||
|
||||
if (dmar_enable_qi(iommu)) {
|
||||
/*
|
||||
* Queued Invalidate not enabled, use Register Based
|
||||
|
Reference in New Issue
Block a user