diff options
Diffstat (limited to 'include/linux/intel-iommu.h')
-rw-r--r-- | include/linux/intel-iommu.h | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index aa8c53171233..482dc91fd53a 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
@@ -53,6 +53,7 @@ | |||
53 | #define DMAR_PHMLIMIT_REG 0x78 /* pmrr high limit */ | 53 | #define DMAR_PHMLIMIT_REG 0x78 /* pmrr high limit */ |
54 | #define DMAR_IQH_REG 0x80 /* Invalidation queue head register */ | 54 | #define DMAR_IQH_REG 0x80 /* Invalidation queue head register */ |
55 | #define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ | 55 | #define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ |
56 | #define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */ | ||
56 | #define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ | 57 | #define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ |
57 | #define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ | 58 | #define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ |
58 | #define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ | 59 | #define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ |
@@ -120,8 +121,10 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
120 | (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16) | 121 | (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16) |
121 | #define ecap_coherent(e) ((e) & 0x1) | 122 | #define ecap_coherent(e) ((e) & 0x1) |
122 | #define ecap_qis(e) ((e) & 0x2) | 123 | #define ecap_qis(e) ((e) & 0x2) |
124 | #define ecap_pass_through(e) ((e >> 6) & 0x1) | ||
123 | #define ecap_eim_support(e) ((e >> 4) & 0x1) | 125 | #define ecap_eim_support(e) ((e >> 4) & 0x1) |
124 | #define ecap_ir_support(e) ((e >> 3) & 0x1) | 126 | #define ecap_ir_support(e) ((e >> 3) & 0x1) |
127 | #define ecap_dev_iotlb_support(e) (((e) >> 2) & 0x1) | ||
125 | #define ecap_max_handle_mask(e) ((e >> 20) & 0xf) | 128 | #define ecap_max_handle_mask(e) ((e >> 20) & 0xf) |
126 | #define ecap_sc_support(e) ((e >> 7) & 0x1) /* Snooping Control */ | 129 | #define ecap_sc_support(e) ((e >> 7) & 0x1) /* Snooping Control */ |
127 | 130 | ||
@@ -197,6 +200,8 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
197 | #define DMA_FSTS_PPF ((u32)2) | 200 | #define DMA_FSTS_PPF ((u32)2) |
198 | #define DMA_FSTS_PFO ((u32)1) | 201 | #define DMA_FSTS_PFO ((u32)1) |
199 | #define DMA_FSTS_IQE (1 << 4) | 202 | #define DMA_FSTS_IQE (1 << 4) |
203 | #define DMA_FSTS_ICE (1 << 5) | ||
204 | #define DMA_FSTS_ITE (1 << 6) | ||
200 | #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff) | 205 | #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff) |
201 | 206 | ||
202 | /* FRCD_REG, 32 bits access */ | 207 | /* FRCD_REG, 32 bits access */ |
@@ -225,7 +230,8 @@ do { \ | |||
225 | enum { | 230 | enum { |
226 | QI_FREE, | 231 | QI_FREE, |
227 | QI_IN_USE, | 232 | QI_IN_USE, |
228 | QI_DONE | 233 | QI_DONE, |
234 | QI_ABORT | ||
229 | }; | 235 | }; |
230 | 236 | ||
231 | #define QI_CC_TYPE 0x1 | 237 | #define QI_CC_TYPE 0x1 |
@@ -254,6 +260,12 @@ enum { | |||
254 | #define QI_CC_DID(did) (((u64)did) << 16) | 260 | #define QI_CC_DID(did) (((u64)did) << 16) |
255 | #define QI_CC_GRAN(gran) (((u64)gran) >> (DMA_CCMD_INVL_GRANU_OFFSET-4)) | 261 | #define QI_CC_GRAN(gran) (((u64)gran) >> (DMA_CCMD_INVL_GRANU_OFFSET-4)) |
256 | 262 | ||
263 | #define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32) | ||
264 | #define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16) | ||
265 | #define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK) | ||
266 | #define QI_DEV_IOTLB_SIZE 1 | ||
267 | #define QI_DEV_IOTLB_MAX_INVS 32 | ||
268 | |||
257 | struct qi_desc { | 269 | struct qi_desc { |
258 | u64 low, high; | 270 | u64 low, high; |
259 | }; | 271 | }; |
@@ -280,10 +292,10 @@ struct ir_table { | |||
280 | #endif | 292 | #endif |
281 | 293 | ||
282 | struct iommu_flush { | 294 | struct iommu_flush { |
283 | int (*flush_context)(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm, | 295 | void (*flush_context)(struct intel_iommu *iommu, u16 did, u16 sid, |
284 | u64 type, int non_present_entry_flush); | 296 | u8 fm, u64 type); |
285 | int (*flush_iotlb)(struct intel_iommu *iommu, u16 did, u64 addr, | 297 | void (*flush_iotlb)(struct intel_iommu *iommu, u16 did, u64 addr, |
286 | unsigned int size_order, u64 type, int non_present_entry_flush); | 298 | unsigned int size_order, u64 type); |
287 | }; | 299 | }; |
288 | 300 | ||
289 | enum { | 301 | enum { |
@@ -302,6 +314,7 @@ struct intel_iommu { | |||
302 | spinlock_t register_lock; /* protect register handling */ | 314 | spinlock_t register_lock; /* protect register handling */ |
303 | int seq_id; /* sequence id of the iommu */ | 315 | int seq_id; /* sequence id of the iommu */ |
304 | int agaw; /* agaw of this iommu */ | 316 | int agaw; /* agaw of this iommu */ |
317 | int msagaw; /* max sagaw of this iommu */ | ||
305 | unsigned int irq; | 318 | unsigned int irq; |
306 | unsigned char name[13]; /* Device Name */ | 319 | unsigned char name[13]; /* Device Name */ |
307 | 320 | ||
@@ -329,6 +342,7 @@ static inline void __iommu_flush_cache( | |||
329 | } | 342 | } |
330 | 343 | ||
331 | extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev); | 344 | extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev); |
345 | extern int dmar_find_matched_atsr_unit(struct pci_dev *dev); | ||
332 | 346 | ||
333 | extern int alloc_iommu(struct dmar_drhd_unit *drhd); | 347 | extern int alloc_iommu(struct dmar_drhd_unit *drhd); |
334 | extern void free_iommu(struct intel_iommu *iommu); | 348 | extern void free_iommu(struct intel_iommu *iommu); |
@@ -337,11 +351,12 @@ extern void dmar_disable_qi(struct intel_iommu *iommu); | |||
337 | extern int dmar_reenable_qi(struct intel_iommu *iommu); | 351 | extern int dmar_reenable_qi(struct intel_iommu *iommu); |
338 | extern void qi_global_iec(struct intel_iommu *iommu); | 352 | extern void qi_global_iec(struct intel_iommu *iommu); |
339 | 353 | ||
340 | extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, | 354 | extern void qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, |
341 | u8 fm, u64 type, int non_present_entry_flush); | 355 | u8 fm, u64 type); |
342 | extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, | 356 | extern void qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, |
343 | unsigned int size_order, u64 type, | 357 | unsigned int size_order, u64 type); |
344 | int non_present_entry_flush); | 358 | extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep, |
359 | u64 addr, unsigned mask); | ||
345 | 360 | ||
346 | extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | 361 | extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); |
347 | 362 | ||