diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/intel-iommu.c | 21 | ||||
-rw-r--r-- | drivers/pci/intel-iommu.h | 4 |
2 files changed, 24 insertions, 1 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 31fa6c92aa5e..585e188c1746 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -692,6 +692,23 @@ static int iommu_flush_iotlb_psi(struct intel_iommu *iommu, u16 did, | |||
692 | DMA_TLB_PSI_FLUSH, non_present_entry_flush); | 692 | DMA_TLB_PSI_FLUSH, non_present_entry_flush); |
693 | } | 693 | } |
694 | 694 | ||
695 | static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu) | ||
696 | { | ||
697 | u32 pmen; | ||
698 | unsigned long flags; | ||
699 | |||
700 | spin_lock_irqsave(&iommu->register_lock, flags); | ||
701 | pmen = readl(iommu->reg + DMAR_PMEN_REG); | ||
702 | pmen &= ~DMA_PMEN_EPM; | ||
703 | writel(pmen, iommu->reg + DMAR_PMEN_REG); | ||
704 | |||
705 | /* wait for the protected region status bit to clear */ | ||
706 | IOMMU_WAIT_OP(iommu, DMAR_PMEN_REG, | ||
707 | readl, !(pmen & DMA_PMEN_PRS), pmen); | ||
708 | |||
709 | spin_unlock_irqrestore(&iommu->register_lock, flags); | ||
710 | } | ||
711 | |||
695 | static int iommu_enable_translation(struct intel_iommu *iommu) | 712 | static int iommu_enable_translation(struct intel_iommu *iommu) |
696 | { | 713 | { |
697 | u32 sts; | 714 | u32 sts; |
@@ -745,7 +762,7 @@ static char *fault_reason_strings[] = | |||
745 | "non-zero reserved fields in PTE", | 762 | "non-zero reserved fields in PTE", |
746 | "Unknown" | 763 | "Unknown" |
747 | }; | 764 | }; |
748 | #define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) - 1 | 765 | #define MAX_FAULT_REASON_IDX (ARRAY_SIZE(fault_reason_strings) - 1) |
749 | 766 | ||
750 | char *dmar_get_fault_reason(u8 fault_reason) | 767 | char *dmar_get_fault_reason(u8 fault_reason) |
751 | { | 768 | { |
@@ -1730,6 +1747,8 @@ int __init init_dmars(void) | |||
1730 | iommu_flush_context_global(iommu, 0); | 1747 | iommu_flush_context_global(iommu, 0); |
1731 | iommu_flush_iotlb_global(iommu, 0); | 1748 | iommu_flush_iotlb_global(iommu, 0); |
1732 | 1749 | ||
1750 | iommu_disable_protect_mem_regions(iommu); | ||
1751 | |||
1733 | ret = iommu_enable_translation(iommu); | 1752 | ret = iommu_enable_translation(iommu); |
1734 | if (ret) | 1753 | if (ret) |
1735 | goto error; | 1754 | goto error; |
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h index 0e4862675ad2..07f5f6353bda 100644 --- a/drivers/pci/intel-iommu.h +++ b/drivers/pci/intel-iommu.h | |||
@@ -140,6 +140,10 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
140 | #define DMA_TLB_IH_NONLEAF (((u64)1) << 6) | 140 | #define DMA_TLB_IH_NONLEAF (((u64)1) << 6) |
141 | #define DMA_TLB_MAX_SIZE (0x3f) | 141 | #define DMA_TLB_MAX_SIZE (0x3f) |
142 | 142 | ||
143 | /* PMEN_REG */ | ||
144 | #define DMA_PMEN_EPM (((u32)1)<<31) | ||
145 | #define DMA_PMEN_PRS (((u32)1)<<0) | ||
146 | |||
143 | /* GCMD_REG */ | 147 | /* GCMD_REG */ |
144 | #define DMA_GCMD_TE (((u32)1) << 31) | 148 | #define DMA_GCMD_TE (((u32)1) << 31) |
145 | #define DMA_GCMD_SRTP (((u32)1) << 30) | 149 | #define DMA_GCMD_SRTP (((u32)1) << 30) |