blob: 5619f8522738b44f3318392da050e7ef9f246020 [file] [log] [blame]
Suresh Siddhae61d98d2008-07-10 11:16:35 -07001#ifndef _DMA_REMAPPING_H
2#define _DMA_REMAPPING_H
3
4/*
Fenghua Yu5b6985c2008-10-16 18:02:32 -07005 * VT-d hardware uses 4KiB page size regardless of host page size.
Suresh Siddhae61d98d2008-07-10 11:16:35 -07006 */
Fenghua Yu5b6985c2008-10-16 18:02:32 -07007#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)
Suresh Siddhae61d98d2008-07-10 11:16:35 -070011
Suresh Siddhae61d98d2008-07-10 11:16:35 -070012#define DMA_PTE_READ (1)
13#define DMA_PTE_WRITE (2)
Sheng Yang9cf066972009-03-18 15:33:07 +080014#define DMA_PTE_SNP (1 << 11)
Suresh Siddhae61d98d2008-07-10 11:16:35 -070015
Fenghua Yu4ed0d3e2009-04-24 17:30:20 -070016#define CONTEXT_TT_MULTI_LEVEL 0
Yu Zhao93a23a72009-05-18 13:51:37 +080017#define CONTEXT_TT_DEV_IOTLB 1
Fenghua Yu4ed0d3e2009-04-24 17:30:20 -070018#define CONTEXT_TT_PASS_THROUGH 2
19
Suresh Siddhae61d98d2008-07-10 11:16:35 -070020struct intel_iommu;
Mark McLoughlin99126f72008-11-20 15:49:47 +000021struct dmar_domain;
22struct root_entry;
Suresh Siddhae61d98d2008-07-10 11:16:35 -070023
Suresh Siddhae61d98d2008-07-10 11:16:35 -070024extern void free_dmar_iommu(struct intel_iommu *iommu);
Ingo Molnarc66b9902009-01-04 10:55:02 +010025
26#ifdef CONFIG_DMAR
Weidong Han1b573682008-12-08 15:34:06 +080027extern int iommu_calculate_agaw(struct intel_iommu *iommu);
Fenghua Yu4ed0d3e2009-04-24 17:30:20 -070028extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
Ingo Molnarc66b9902009-01-04 10:55:02 +010029#else
30static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
31{
32 return 0;
33}
Fenghua Yu4ed0d3e2009-04-24 17:30:20 -070034static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
35{
36 return 0;
37}
Ingo Molnarc66b9902009-01-04 10:55:02 +010038#endif
Suresh Siddhae61d98d2008-07-10 11:16:35 -070039
Suresh Siddha2ae21012008-07-10 11:16:43 -070040extern int dmar_disabled;
41
Suresh Siddhae61d98d2008-07-10 11:16:35 -070042#endif