dma_remapping.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #ifdef CONFIG_INTEL_IOMMU
  23. extern int iommu_calculate_agaw(struct intel_iommu *iommu);
  24. extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
  25. extern int dmar_disabled;
  26. extern int intel_iommu_enabled;
  27. #else
  28. static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
  29. {
  30. return 0;
  31. }
  32. static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
  33. {
  34. return 0;
  35. }
  36. #define dmar_disabled (1)
  37. #define intel_iommu_enabled (0)
  38. #endif
  39. #endif