dma-iommu.h 908 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef ASMARM_DMA_IOMMU_H
  3. #define ASMARM_DMA_IOMMU_H
  4. #ifdef __KERNEL__
  5. #include <linux/mm_types.h>
  6. #include <linux/scatterlist.h>
  7. #include <linux/kref.h>
  8. struct dma_iommu_mapping {
  9. /* iommu specific data */
  10. struct iommu_domain *domain;
  11. unsigned long **bitmaps; /* array of bitmaps */
  12. unsigned int nr_bitmaps; /* nr of elements in array */
  13. unsigned int extensions;
  14. size_t bitmap_size; /* size of a single bitmap */
  15. size_t bits; /* per bitmap */
  16. dma_addr_t base;
  17. spinlock_t lock;
  18. struct kref kref;
  19. };
  20. struct dma_iommu_mapping *
  21. arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size);
  22. void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
  23. int arm_iommu_attach_device(struct device *dev,
  24. struct dma_iommu_mapping *mapping);
  25. void arm_iommu_detach_device(struct device *dev);
  26. #endif /* __KERNEL__ */
  27. #endif