aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/intel-iommu.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/intel-iommu.h')
-rw-r--r--include/linux/intel-iommu.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 2ff15195f73d..2e1fbde020ca 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -31,6 +31,7 @@
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/iommu.h> 32#include <linux/iommu.h>
33#include <linux/io-64-nonatomic-lo-hi.h> 33#include <linux/io-64-nonatomic-lo-hi.h>
34#include <linux/dmar.h>
34 35
35#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
36#include <asm/iommu.h> 37#include <asm/iommu.h>
@@ -387,6 +388,42 @@ struct pasid_entry;
387struct pasid_state_entry; 388struct pasid_state_entry;
388struct page_req_dsc; 389struct page_req_dsc;
389 390
391struct dmar_domain {
392 int nid; /* node id */
393
394 unsigned iommu_refcnt[DMAR_UNITS_SUPPORTED];
395 /* Refcount of devices per iommu */
396
397
398 u16 iommu_did[DMAR_UNITS_SUPPORTED];
399 /* Domain ids per IOMMU. Use u16 since
400 * domain ids are 16 bit wide according
401 * to VT-d spec, section 9.3 */
402
403 bool has_iotlb_device;
404 struct list_head devices; /* all devices' list */
405 struct iova_domain iovad; /* iova's that belong to this domain */
406
407 struct dma_pte *pgd; /* virtual address */
408 int gaw; /* max guest address width */
409
410 /* adjusted guest address width, 0 is level 2 30-bit */
411 int agaw;
412
413 int flags; /* flags to find out type of domain */
414
415 int iommu_coherency;/* indicate coherency of iommu access */
416 int iommu_snooping; /* indicate snooping control feature*/
417 int iommu_count; /* reference count of iommu */
418 int iommu_superpage;/* Level of superpages supported:
419 0 == 4KiB (no superpages), 1 == 2MiB,
420 2 == 1GiB, 3 == 512GiB, 4 == 1TiB */
421 u64 max_addr; /* maximum mapped address */
422
423 struct iommu_domain domain; /* generic domain data structure for
424 iommu core */
425};
426
390struct intel_iommu { 427struct intel_iommu {
391 void __iomem *reg; /* Pointer to hardware regs, virtual addr */ 428 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
392 u64 reg_phys; /* physical address of hw register set */ 429 u64 reg_phys; /* physical address of hw register set */
@@ -435,6 +472,25 @@ struct intel_iommu {
435 u32 flags; /* Software defined flags */ 472 u32 flags; /* Software defined flags */
436}; 473};
437 474
475/* PCI domain-device relationship */
476struct device_domain_info {
477 struct list_head link; /* link to domain siblings */
478 struct list_head global; /* link to global list */
479 u8 bus; /* PCI bus number */
480 u8 devfn; /* PCI devfn number */
481 u16 pfsid; /* SRIOV physical function source ID */
482 u8 pasid_supported:3;
483 u8 pasid_enabled:1;
484 u8 pri_supported:1;
485 u8 pri_enabled:1;
486 u8 ats_supported:1;
487 u8 ats_enabled:1;
488 u8 ats_qdep;
489 struct device *dev; /* it's NULL for PCIe-to-PCI bridge */
490 struct intel_iommu *iommu; /* IOMMU used by this device */
491 struct dmar_domain *domain; /* pointer to domain */
492};
493
438static inline void __iommu_flush_cache( 494static inline void __iommu_flush_cache(
439 struct intel_iommu *iommu, void *addr, int size) 495 struct intel_iommu *iommu, void *addr, int size)
440{ 496{
@@ -460,6 +516,11 @@ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
460 516
461extern int dmar_ir_support(void); 517extern int dmar_ir_support(void);
462 518
519struct dmar_domain *get_valid_domain_for_dev(struct device *dev);
520void *alloc_pgtable_page(int node);
521void free_pgtable_page(void *vaddr);
522struct intel_iommu *domain_get_iommu(struct dmar_domain *domain);
523
463#ifdef CONFIG_INTEL_IOMMU_SVM 524#ifdef CONFIG_INTEL_IOMMU_SVM
464extern int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu); 525extern int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu);
465extern int intel_svm_free_pasid_tables(struct intel_iommu *iommu); 526extern int intel_svm_free_pasid_tables(struct intel_iommu *iommu);