diff options
author | Lu Baolu <baolu.lu@linux.intel.com> | 2019-03-19 21:58:33 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2019-03-22 07:02:26 -0400 |
commit | 5bb71fc790a88d063507dc5d445ab8b14e845591 (patch) | |
tree | c21370e76c78b268cc3d3b00d9ccf3559d723d65 | |
parent | 80ef4464d5e27408685e609d389663aad46644b9 (diff) |
iommu/vt-d: Check capability before disabling protected memory
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>
-rw-r--r-- | drivers/iommu/intel-iommu.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 87274b54febd..f002d47d2f27 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1538,6 +1538,9 @@ static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu) | |||
1538 | u32 pmen; | 1538 | u32 pmen; |
1539 | unsigned long flags; | 1539 | unsigned long flags; |
1540 | 1540 | ||
1541 | if (!cap_plmr(iommu->cap) && !cap_phmr(iommu->cap)) | ||
1542 | return; | ||
1543 | |||
1541 | raw_spin_lock_irqsave(&iommu->register_lock, flags); | 1544 | raw_spin_lock_irqsave(&iommu->register_lock, flags); |
1542 | pmen = readl(iommu->reg + DMAR_PMEN_REG); | 1545 | pmen = readl(iommu->reg + DMAR_PMEN_REG); |
1543 | pmen &= ~DMA_PMEN_EPM; | 1546 | pmen &= ~DMA_PMEN_EPM; |