1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * Copyright (c) 2024, NVIDIA CORPORATION & AF 4 * 5 * DMA operations that map physical memory thr 6 */ 7 #ifndef _LINUX_IOMMU_DMA_H 8 #define _LINUX_IOMMU_DMA_H 9 10 #include <linux/dma-direction.h> 11 12 #ifdef CONFIG_IOMMU_DMA 13 static inline bool use_dma_iommu(struct device 14 { 15 return dev->dma_iommu; 16 } 17 #else 18 static inline bool use_dma_iommu(struct device 19 { 20 return false; 21 } 22 #endif /* CONFIG_IOMMU_DMA */ 23 24 dma_addr_t iommu_dma_map_page(struct device *d 25 unsigned long offset, size_t s 26 unsigned long attrs); 27 void iommu_dma_unmap_page(struct device *dev, 28 size_t size, enum dma_data_dir 29 int iommu_dma_map_sg(struct device *dev, struc 30 enum dma_data_direction dir, u 31 void iommu_dma_unmap_sg(struct device *dev, st 32 enum dma_data_direction dir, u 33 void *iommu_dma_alloc(struct device *dev, size 34 gfp_t gfp, unsigned long attrs 35 int iommu_dma_mmap(struct device *dev, struct 36 void *cpu_addr, dma_addr_t dma 37 unsigned long attrs); 38 int iommu_dma_get_sgtable(struct device *dev, 39 void *cpu_addr, dma_addr_t dma 40 unsigned long attrs); 41 unsigned long iommu_dma_get_merge_boundary(str 42 size_t iommu_dma_opt_mapping_size(void); 43 size_t iommu_dma_max_mapping_size(struct devic 44 void iommu_dma_free(struct device *dev, size_t 45 dma_addr_t handle, unsigned lo 46 dma_addr_t iommu_dma_map_resource(struct devic 47 size_t size, enum dma_data_dir 48 void iommu_dma_unmap_resource(struct device *d 49 size_t size, enum dma_data_dir 50 struct sg_table *iommu_dma_alloc_noncontiguous 51 enum dma_data_direction dir, g 52 void iommu_dma_free_noncontiguous(struct devic 53 struct sg_table *sgt, enum dma 54 void *iommu_dma_vmap_noncontiguous(struct devi 55 struct sg_table *sgt); 56 #define iommu_dma_vunmap_noncontiguous(dev, va 57 vunmap(vaddr); 58 int iommu_dma_mmap_noncontiguous(struct device 59 size_t size, struct sg_table * 60 void iommu_dma_sync_single_for_cpu(struct devi 61 size_t size, enum dma_data_dir 62 void iommu_dma_sync_single_for_device(struct d 63 size_t size, enum dma_data_dir 64 void iommu_dma_sync_sg_for_cpu(struct device * 65 int nelems, enum dma_data_dire 66 void iommu_dma_sync_sg_for_device(struct devic 67 int nelems, enum dma_data_dire 68 69 #endif /* _LINUX_IOMMU_DMA_H */ 70
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.