Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84620
b: refs/heads/master
c: f8bab73
h: refs/heads/master
v: v3
  • Loading branch information
mark gross authored and Linus Torvalds committed Feb 8, 2008
1 parent 693a594 commit ef39c9d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2d3a4e3666325a9709cc8ea2e88151394e8f20fc
refs/heads/master: f8bab73515ca5b392680bb033dceeb37b8463e95
21 changes: 20 additions & 1 deletion trunk/drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,23 @@ static int iommu_flush_iotlb_psi(struct intel_iommu *iommu, u16 did,
DMA_TLB_PSI_FLUSH, non_present_entry_flush);
}

static void iommu_disable_protect_mem_regions(struct intel_iommu *iommu)
{
u32 pmen;
unsigned long flags;

spin_lock_irqsave(&iommu->register_lock, flags);
pmen = readl(iommu->reg + DMAR_PMEN_REG);
pmen &= ~DMA_PMEN_EPM;
writel(pmen, iommu->reg + DMAR_PMEN_REG);

/* wait for the protected region status bit to clear */
IOMMU_WAIT_OP(iommu, DMAR_PMEN_REG,
readl, !(pmen & DMA_PMEN_PRS), pmen);

spin_unlock_irqrestore(&iommu->register_lock, flags);
}

static int iommu_enable_translation(struct intel_iommu *iommu)
{
u32 sts;
Expand Down Expand Up @@ -745,7 +762,7 @@ static char *fault_reason_strings[] =
"non-zero reserved fields in PTE",
"Unknown"
};
#define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) - 1
#define MAX_FAULT_REASON_IDX (ARRAY_SIZE(fault_reason_strings) - 1)

char *dmar_get_fault_reason(u8 fault_reason)
{
Expand Down Expand Up @@ -1730,6 +1747,8 @@ int __init init_dmars(void)
iommu_flush_context_global(iommu, 0);
iommu_flush_iotlb_global(iommu, 0);

iommu_disable_protect_mem_regions(iommu);

ret = iommu_enable_translation(iommu);
if (ret)
goto error;
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/pci/intel-iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
#define DMA_TLB_IH_NONLEAF (((u64)1) << 6)
#define DMA_TLB_MAX_SIZE (0x3f)

/* PMEN_REG */
#define DMA_PMEN_EPM (((u32)1)<<31)
#define DMA_PMEN_PRS (((u32)1)<<0)

/* GCMD_REG */
#define DMA_GCMD_TE (((u32)1) << 31)
#define DMA_GCMD_SRTP (((u32)1) << 30)
Expand Down

0 comments on commit ef39c9d

Please sign in to comment.