summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLu Baolu <baolu.lu@linux.intel.com>2019-03-20 09:58:33 +0800
committerBen Hutchings <ben@decadent.org.uk>2019-08-13 12:38:51 +0100
commitb17048c53c903a698609a71bb19cb535eab49894 (patch)
treeebcf9d6bd9d48f513dc4cf0ca9b0abcd27286ce9 /drivers
parent09e3abfd0c817264b82f85c5ca9d8634d3c19d18 (diff)
iommu/vt-d: Check capability before disabling protected memory
commit 5bb71fc790a88d063507dc5d445ab8b14e845591 upstream. The spec states in 10.4.16 that the Protected Memory Enable Register should be treated as read-only for implementations not supporting protected memory regions (PLMR and PHMR fields reported as Clear in the Capability register). Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: mark gross <mgross@intel.com> Suggested-by: Ashok Raj <ashok.raj@intel.com> Fixes: f8bab73515ca5 ("intel-iommu: PMEN support") Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/intel-iommu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index b60eb1cca150..c2a44d2ca5b6 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1394,6 +1394,9 @@ static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu)
u32 pmen;
unsigned long flags;
+ if (!cap_plmr(iommu->cap) && !cap_phmr(iommu->cap))
+ return;
+
raw_spin_lock_irqsave(&iommu->register_lock, flags);
pmen = readl(iommu->reg + DMAR_PMEN_REG);
pmen &= ~DMA_PMEN_EPM;