dma_remapping.h 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _DMA_REMAPPING_H
  2. #define _DMA_REMAPPING_H
  3. /*
  4. * VT-d hardware uses 4KiB page size regardless of host page size.
  5. */
  6. #define VTD_PAGE_SHIFT (12)
  7. #define VTD_PAGE_SIZE (1UL << VTD_PAGE_SHIFT)
  8. #define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT)
  9. #define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK)
  10. #define DMA_PTE_READ (1)
  11. #define DMA_PTE_WRITE (2)
  12. #define DMA_PTE_SNP (1 << 11)
  13. #define CONTEXT_TT_MULTI_LEVEL 0
  14. #define CONTEXT_TT_DEV_IOTLB 1
  15. #define CONTEXT_TT_PASS_THROUGH 2
  16. struct intel_iommu;
  17. struct dmar_domain;
  18. struct root_entry;
  19. extern void free_dmar_iommu(struct intel_iommu *iommu);
  20. #ifdef CONFIG_DMAR
  21. extern int iommu_calculate_agaw(struct intel_iommu *iommu);
  22. extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
  23. #else
  24. static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
  25. {
  26. return 0;
  27. }
  28. static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
  29. {
  30. return 0;
  31. }
  32. #endif
  33. extern int dmar_disabled;
  34. #endif