1 #ifndef _DMA_REMAPPING_H
2 #define _DMA_REMAPPING_H
5 * VT-d hardware uses 4KiB page size regardless of host page size.
7 #define VTD_PAGE_SHIFT (12)
8 #define VTD_PAGE_SIZE (1UL << VTD_PAGE_SHIFT)
9 #define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT)
10 #define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK)
14 #define DMA_PTE_READ (1)
15 #define DMA_PTE_WRITE (2)
20 int id; /* domain id */
21 struct intel_iommu *iommu; /* back pointer to owning iommu */
23 struct list_head devices; /* all devices' list */
24 struct iova_domain iovad; /* iova's that belong to this domain */
26 struct dma_pte *pgd; /* virtual address */
27 spinlock_t mapping_lock; /* page table lock */
28 int gaw; /* max guest address width */
30 /* adjusted guest address width, 0 is level 2 30-bit */
33 #define DOMAIN_FLAG_MULTIPLE_DEVICES 1
37 /* PCI domain-device relationship */
38 struct device_domain_info {
39 struct list_head link; /* link to domain siblings */
40 struct list_head global; /* link to global list */
41 u8 bus; /* PCI bus numer */
42 u8 devfn; /* PCI devfn number */
43 struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */
44 struct dmar_domain *domain; /* pointer to domain */
47 extern void free_dmar_iommu(struct intel_iommu *iommu);
49 extern int dmar_disabled;
51 #ifndef CONFIG_DMAR_GFX_WA
52 static inline void iommu_prepare_gfx_mapping(void)
56 #endif /* !CONFIG_DMAR_GFX_WA */