diff options
Diffstat (limited to 'drivers/pci/intel-iommu.h')
-rw-r--r-- | drivers/pci/intel-iommu.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h index eb167e39b464..3a650e8cba33 100644 --- a/drivers/pci/intel-iommu.h +++ b/drivers/pci/intel-iommu.h | |||
@@ -177,6 +177,21 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
177 | #define dma_frcd_source_id(c) (c & 0xffff) | 177 | #define dma_frcd_source_id(c) (c & 0xffff) |
178 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */ | 178 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */ |
179 | 179 | ||
180 | #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) /* 10sec */ | ||
181 | |||
182 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ | ||
183 | {\ | ||
184 | cycles_t start_time = get_cycles();\ | ||
185 | while (1) {\ | ||
186 | sts = op (iommu->reg + offset);\ | ||
187 | if (cond)\ | ||
188 | break;\ | ||
189 | if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\ | ||
190 | panic("DMAR hardware is malfunctioning\n");\ | ||
191 | cpu_relax();\ | ||
192 | }\ | ||
193 | } | ||
194 | |||
180 | struct intel_iommu { | 195 | struct intel_iommu { |
181 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ | 196 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ |
182 | u64 cap; | 197 | u64 cap; |