dma_remapping.h 957 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_PASS_THROUGH 2
  15. struct intel_iommu;
  16. struct dmar_domain;
  17. struct root_entry;
  18. extern void free_dmar_iommu(struct intel_iommu *iommu);
  19. #ifdef CONFIG_DMAR
  20. extern int iommu_calculate_agaw(struct intel_iommu *iommu);
  21. extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
  22. #else
  23. static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
  24. {
  25. return 0;
  26. }
  27. static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
  28. {
  29. return 0;
  30. }
  31. #endif
  32. extern int dmar_disabled;
  33. #endif