diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-23 00:38:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-23 00:38:22 -0400 |
commit | 687d680985b1438360a9ba470ece8b57cd205c3b (patch) | |
tree | ae253608531e5c3e823600974c610e722e7de759 /include/linux | |
parent | 1053414068bad659479e6efa62a67403b8b1ec0a (diff) | |
parent | 008fe148cb0fb51d266baabe2c09997b21cf90c6 (diff) |
Merge git://git.infradead.org/~dwmw2/iommu-2.6.31
* git://git.infradead.org/~dwmw2/iommu-2.6.31:
intel-iommu: Fix one last ia64 build problem in Pass Through Support
VT-d: support the device IOTLB
VT-d: cleanup iommu_flush_iotlb_psi and flush_unmaps
VT-d: add device IOTLB invalidation support
VT-d: parse ATSR in DMA Remapping Reporting Structure
PCI: handle Virtual Function ATS enabling
PCI: support the ATS capability
intel-iommu: dmar_set_interrupt return error value
intel-iommu: Tidy up iommu->gcmd handling
intel-iommu: Fix tiny theoretical race in write-buffer flush.
intel-iommu: Clean up handling of "caching mode" vs. IOTLB flushing.
intel-iommu: Clean up handling of "caching mode" vs. context flushing.
VT-d: fix invalid domain id for KVM context flush
Fix !CONFIG_DMAR build failure introduced by Intel IOMMU Pass Through Support
Intel IOMMU Pass Through Support
Fix up trivial conflicts in drivers/pci/{intel-iommu.c,intr_remapping.c}
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dma_remapping.h | 9 | ||||
-rw-r--r-- | include/linux/dmar.h | 9 | ||||
-rw-r--r-- | include/linux/intel-iommu.h | 35 | ||||
-rw-r--r-- | include/linux/pci.h | 2 | ||||
-rw-r--r-- | include/linux/pci_regs.h | 10 |
5 files changed, 55 insertions, 10 deletions
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index 1a455f1f86d7..5619f8522738 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h | |||
@@ -13,6 +13,10 @@ | |||
13 | #define DMA_PTE_WRITE (2) | 13 | #define DMA_PTE_WRITE (2) |
14 | #define DMA_PTE_SNP (1 << 11) | 14 | #define DMA_PTE_SNP (1 << 11) |
15 | 15 | ||
16 | #define CONTEXT_TT_MULTI_LEVEL 0 | ||
17 | #define CONTEXT_TT_DEV_IOTLB 1 | ||
18 | #define CONTEXT_TT_PASS_THROUGH 2 | ||
19 | |||
16 | struct intel_iommu; | 20 | struct intel_iommu; |
17 | struct dmar_domain; | 21 | struct dmar_domain; |
18 | struct root_entry; | 22 | struct root_entry; |
@@ -21,11 +25,16 @@ extern void free_dmar_iommu(struct intel_iommu *iommu); | |||
21 | 25 | ||
22 | #ifdef CONFIG_DMAR | 26 | #ifdef CONFIG_DMAR |
23 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); | 27 | extern int iommu_calculate_agaw(struct intel_iommu *iommu); |
28 | extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); | ||
24 | #else | 29 | #else |
25 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) | 30 | static inline int iommu_calculate_agaw(struct intel_iommu *iommu) |
26 | { | 31 | { |
27 | return 0; | 32 | return 0; |
28 | } | 33 | } |
34 | static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu) | ||
35 | { | ||
36 | return 0; | ||
37 | } | ||
29 | #endif | 38 | #endif |
30 | 39 | ||
31 | extern int dmar_disabled; | 40 | extern int dmar_disabled; |
diff --git a/include/linux/dmar.h b/include/linux/dmar.h index 10ff5c498824..1731fb5fd775 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h | |||
@@ -188,6 +188,15 @@ struct dmar_rmrr_unit { | |||
188 | 188 | ||
189 | #define for_each_rmrr_units(rmrr) \ | 189 | #define for_each_rmrr_units(rmrr) \ |
190 | list_for_each_entry(rmrr, &dmar_rmrr_units, list) | 190 | list_for_each_entry(rmrr, &dmar_rmrr_units, list) |
191 | |||
192 | struct dmar_atsr_unit { | ||
193 | struct list_head list; /* list of ATSR units */ | ||
194 | struct acpi_dmar_header *hdr; /* ACPI header */ | ||
195 | struct pci_dev **devices; /* target devices */ | ||
196 | int devices_cnt; /* target device count */ | ||
197 | u8 include_all:1; /* include all ports */ | ||
198 | }; | ||
199 | |||
191 | /* Intel DMAR initialization functions */ | 200 | /* Intel DMAR initialization functions */ |
192 | extern int intel_iommu_init(void); | 201 | extern int intel_iommu_init(void); |
193 | #else | 202 | #else |
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 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 1365c745bdb7..d304ddf412d0 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -196,6 +196,7 @@ struct pci_cap_saved_state { | |||
196 | struct pcie_link_state; | 196 | struct pcie_link_state; |
197 | struct pci_vpd; | 197 | struct pci_vpd; |
198 | struct pci_sriov; | 198 | struct pci_sriov; |
199 | struct pci_ats; | ||
199 | 200 | ||
200 | /* | 201 | /* |
201 | * The pci_dev structure is used to describe PCI devices. | 202 | * The pci_dev structure is used to describe PCI devices. |
@@ -293,6 +294,7 @@ struct pci_dev { | |||
293 | struct pci_sriov *sriov; /* SR-IOV capability related */ | 294 | struct pci_sriov *sriov; /* SR-IOV capability related */ |
294 | struct pci_dev *physfn; /* the PF this VF is associated with */ | 295 | struct pci_dev *physfn; /* the PF this VF is associated with */ |
295 | }; | 296 | }; |
297 | struct pci_ats *ats; /* Address Translation Service */ | ||
296 | #endif | 298 | #endif |
297 | }; | 299 | }; |
298 | 300 | ||
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 83b02f5a25b2..fcaee42c7ac2 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -502,6 +502,7 @@ | |||
502 | #define PCI_EXT_CAP_ID_DSN 3 | 502 | #define PCI_EXT_CAP_ID_DSN 3 |
503 | #define PCI_EXT_CAP_ID_PWR 4 | 503 | #define PCI_EXT_CAP_ID_PWR 4 |
504 | #define PCI_EXT_CAP_ID_ARI 14 | 504 | #define PCI_EXT_CAP_ID_ARI 14 |
505 | #define PCI_EXT_CAP_ID_ATS 15 | ||
505 | #define PCI_EXT_CAP_ID_SRIOV 16 | 506 | #define PCI_EXT_CAP_ID_SRIOV 16 |
506 | 507 | ||
507 | /* Advanced Error Reporting */ | 508 | /* Advanced Error Reporting */ |
@@ -620,6 +621,15 @@ | |||
620 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ | 621 | #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ |
621 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ | 622 | #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ |
622 | 623 | ||
624 | /* Address Translation Service */ | ||
625 | #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ | ||
626 | #define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f) /* Invalidate Queue Depth */ | ||
627 | #define PCI_ATS_MAX_QDEP 32 /* Max Invalidate Queue Depth */ | ||
628 | #define PCI_ATS_CTRL 0x06 /* ATS Control Register */ | ||
629 | #define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */ | ||
630 | #define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */ | ||
631 | #define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ | ||
632 | |||
623 | /* Single Root I/O Virtualization */ | 633 | /* Single Root I/O Virtualization */ |
624 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ | 634 | #define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ |
625 | #define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */ | 635 | #define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */ |