aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/intel-iommu.h
diff options
context:
space:
mode:
authorFenghua Yu <fenghua.yu@intel.com>2008-10-16 21:02:32 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-10-18 09:29:15 -0400
commit5b6985ce8ec7127b4d60ad450b64ca8b82748a3b (patch)
treef1d5a27601df04a3481690a1a2f90fc688034aff /include/linux/intel-iommu.h
parentcacd4213d8ffed83676f38d5d8e93c673e0f1af7 (diff)
intel-iommu: IA64 support
The current Intel IOMMU code assumes that both host page size and Intel IOMMU page size are 4KiB. The first patch supports variable page size. This provides support for IA64 which has multiple page sizes. This patch also adds some other code hooks for IA64 platform including DMAR_OPERATION_TIMEOUT definition. [dwmw2: some cleanup] Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/intel-iommu.h')
-rw-r--r--include/linux/intel-iommu.h39
1 files changed, 23 insertions, 16 deletions
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index afb0d2a5b7c..3d017cfd245 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -29,6 +29,7 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/dma_remapping.h> 30#include <linux/dma_remapping.h>
31#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
32#include <asm/iommu.h>
32 33
33/* 34/*
34 * Intel IOMMU register specification per version 1.0 public spec. 35 * Intel IOMMU register specification per version 1.0 public spec.
@@ -202,22 +203,21 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
202#define dma_frcd_type(d) ((d >> 30) & 1) 203#define dma_frcd_type(d) ((d >> 30) & 1)
203#define dma_frcd_fault_reason(c) (c & 0xff) 204#define dma_frcd_fault_reason(c) (c & 0xff)
204#define dma_frcd_source_id(c) (c & 0xffff) 205#define dma_frcd_source_id(c) (c & 0xffff)
205#define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */ 206/* low 64 bit */
206 207#define dma_frcd_page_addr(d) (d & (((u64)-1) << PAGE_SHIFT))
207#define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) /* 10sec */ 208
208 209#define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \
209#define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ 210do { \
210{\ 211 cycles_t start_time = get_cycles(); \
211 cycles_t start_time = get_cycles();\ 212 while (1) { \
212 while (1) {\ 213 sts = op(iommu->reg + offset); \
213 sts = op (iommu->reg + offset);\ 214 if (cond) \
214 if (cond)\ 215 break; \
215 break;\
216 if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\ 216 if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\
217 panic("DMAR hardware is malfunctioning\n");\ 217 panic("DMAR hardware is malfunctioning\n"); \
218 cpu_relax();\ 218 cpu_relax(); \
219 }\ 219 } \
220} 220} while (0)
221 221
222#define QI_LENGTH 256 /* queue length */ 222#define QI_LENGTH 256 /* queue length */
223 223
@@ -244,7 +244,7 @@ enum {
244#define QI_IOTLB_DR(dr) (((u64)dr) << 7) 244#define QI_IOTLB_DR(dr) (((u64)dr) << 7)
245#define QI_IOTLB_DW(dw) (((u64)dw) << 6) 245#define QI_IOTLB_DW(dw) (((u64)dw) << 6)
246#define QI_IOTLB_GRAN(gran) (((u64)gran) >> (DMA_TLB_FLUSH_GRANU_OFFSET-4)) 246#define QI_IOTLB_GRAN(gran) (((u64)gran) >> (DMA_TLB_FLUSH_GRANU_OFFSET-4))
247#define QI_IOTLB_ADDR(addr) (((u64)addr) & PAGE_MASK_4K) 247#define QI_IOTLB_ADDR(addr) (((u64)addr) & VTD_PAGE_MASK)
248#define QI_IOTLB_IH(ih) (((u64)ih) << 6) 248#define QI_IOTLB_IH(ih) (((u64)ih) << 6)
249#define QI_IOTLB_AM(am) (((u8)am)) 249#define QI_IOTLB_AM(am) (((u8)am))
250 250
@@ -353,4 +353,11 @@ static inline int intel_iommu_found(void)
353} 353}
354#endif /* CONFIG_DMAR */ 354#endif /* CONFIG_DMAR */
355 355
356extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
357extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
358extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int);
359extern void intel_unmap_single(struct device *, dma_addr_t, size_t, int);
360extern int intel_map_sg(struct device *, struct scatterlist *, int, int);
361extern void intel_unmap_sg(struct device *, struct scatterlist *, int, int);
362
356#endif 363#endif