~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/dma-iommu.h

Version: ~ [ linux-5.5-rc7 ] ~ [ linux-5.4.13 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.97 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.166 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.210 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.210 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.81 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2014-2015 ARM Ltd.
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License version 2 as
  6  * published by the Free Software Foundation.
  7  *
  8  * This program is distributed in the hope that it will be useful,
  9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 11  * GNU General Public License for more details.
 12  *
 13  * You should have received a copy of the GNU General Public License
 14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 15  */
 16 #ifndef __DMA_IOMMU_H
 17 #define __DMA_IOMMU_H
 18 
 19 #ifdef __KERNEL__
 20 #include <linux/types.h>
 21 #include <asm/errno.h>
 22 
 23 #ifdef CONFIG_IOMMU_DMA
 24 #include <linux/dma-mapping.h>
 25 #include <linux/iommu.h>
 26 #include <linux/msi.h>
 27 
 28 int iommu_dma_init(void);
 29 
 30 /* Domain management interface for IOMMU drivers */
 31 int iommu_get_dma_cookie(struct iommu_domain *domain);
 32 int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base);
 33 void iommu_put_dma_cookie(struct iommu_domain *domain);
 34 
 35 /* Setup call for arch DMA mapping code */
 36 int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
 37                 u64 size, struct device *dev);
 38 
 39 /* General helpers for DMA-API <-> IOMMU-API interaction */
 40 int dma_info_to_prot(enum dma_data_direction dir, bool coherent,
 41                      unsigned long attrs);
 42 
 43 /*
 44  * These implement the bulk of the relevant DMA mapping callbacks, but require
 45  * the arch code to take care of attributes and cache maintenance
 46  */
 47 struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp,
 48                 unsigned long attrs, int prot, dma_addr_t *handle,
 49                 void (*flush_page)(struct device *, const void *, phys_addr_t));
 50 void iommu_dma_free(struct device *dev, struct page **pages, size_t size,
 51                 dma_addr_t *handle);
 52 
 53 int iommu_dma_mmap(struct page **pages, size_t size, struct vm_area_struct *vma);
 54 
 55 dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
 56                 unsigned long offset, size_t size, int prot);
 57 int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
 58                 int nents, int prot);
 59 
 60 /*
 61  * Arch code with no special attribute handling may use these
 62  * directly as DMA mapping callbacks for simplicity
 63  */
 64 void iommu_dma_unmap_page(struct device *dev, dma_addr_t handle, size_t size,
 65                 enum dma_data_direction dir, unsigned long attrs);
 66 void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
 67                 enum dma_data_direction dir, unsigned long attrs);
 68 dma_addr_t iommu_dma_map_resource(struct device *dev, phys_addr_t phys,
 69                 size_t size, enum dma_data_direction dir, unsigned long attrs);
 70 void iommu_dma_unmap_resource(struct device *dev, dma_addr_t handle,
 71                 size_t size, enum dma_data_direction dir, unsigned long attrs);
 72 int iommu_dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
 73 
 74 /* The DMA API isn't _quite_ the whole story, though... */
 75 void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg);
 76 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
 77 
 78 #else
 79 
 80 struct iommu_domain;
 81 struct msi_msg;
 82 struct device;
 83 
 84 static inline int iommu_dma_init(void)
 85 {
 86         return 0;
 87 }
 88 
 89 static inline int iommu_get_dma_cookie(struct iommu_domain *domain)
 90 {
 91         return -ENODEV;
 92 }
 93 
 94 static inline int iommu_get_msi_cookie(struct iommu_domain *domain, dma_addr_t base)
 95 {
 96         return -ENODEV;
 97 }
 98 
 99 static inline void iommu_put_dma_cookie(struct iommu_domain *domain)
100 {
101 }
102 
103 static inline void iommu_dma_map_msi_msg(int irq, struct msi_msg *msg)
104 {
105 }
106 
107 static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list)
108 {
109 }
110 
111 #endif  /* CONFIG_IOMMU_DMA */
112 #endif  /* __KERNEL__ */
113 #endif  /* __DMA_IOMMU_H */
114 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp