dma_remapping.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 VTD_STRIDE_SHIFT (9)
  11. #define VTD_STRIDE_MASK (((u64)-1) << VTD_STRIDE_SHIFT)
  12. #define DMA_PTE_READ (1)
  13. #define DMA_PTE_WRITE (2)
  14. #define DMA_PTE_LARGE_PAGE (1 << 7)
  15. #define DMA_PTE_SNP (1 << 11)
  16. #define CONTEXT_TT_MULTI_LEVEL 0
  17. #define CONTEXT_TT_DEV_IOTLB 1
  18. #define CONTEXT_TT_PASS_THROUGH 2
  19. struct intel_iommu;
  20. struct dmar_domain;
  21. struct root_entry;
  22. extern void free_dmar_iommu(struct intel_iommu *iommu);
  23. #ifdef CONFIG_DMAR
  24. extern int iommu_calculate_agaw(struct intel_iommu *iommu);
  25. extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
  26. #else
  27. static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
  28. {
  29. return 0;
  30. }
  31. static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
  32. {
  33. return 0;
  34. }
  35. #endif
  36. extern int dmar_disabled;
  37. #endif