aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iommu.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/iommu.h')
-rw-r--r--include/linux/iommu.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 20f9a527922a..379a6179fd96 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -57,8 +57,11 @@ struct iommu_domain {
57 struct iommu_domain_geometry geometry; 57 struct iommu_domain_geometry geometry;
58}; 58};
59 59
60#define IOMMU_CAP_CACHE_COHERENCY 0x1 60enum iommu_cap {
61#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 61 IOMMU_CAP_CACHE_COHERENCY, /* IOMMU can enforce cache coherent DMA
62 transactions */
63 IOMMU_CAP_INTR_REMAP, /* IOMMU supports interrupt isolation */
64};
62 65
63/* 66/*
64 * Following constraints are specifc to FSL_PAMUV1: 67 * Following constraints are specifc to FSL_PAMUV1:
@@ -94,7 +97,6 @@ enum iommu_attr {
94 * @map: map a physically contiguous memory region to an iommu domain 97 * @map: map a physically contiguous memory region to an iommu domain
95 * @unmap: unmap a physically contiguous memory region from an iommu domain 98 * @unmap: unmap a physically contiguous memory region from an iommu domain
96 * @iova_to_phys: translate iova to physical address 99 * @iova_to_phys: translate iova to physical address
97 * @domain_has_cap: domain capabilities query
98 * @add_device: add device to iommu grouping 100 * @add_device: add device to iommu grouping
99 * @remove_device: remove device from iommu grouping 101 * @remove_device: remove device from iommu grouping
100 * @domain_get_attr: Query domain attributes 102 * @domain_get_attr: Query domain attributes
@@ -102,6 +104,7 @@ enum iommu_attr {
102 * @pgsize_bitmap: bitmap of supported page sizes 104 * @pgsize_bitmap: bitmap of supported page sizes
103 */ 105 */
104struct iommu_ops { 106struct iommu_ops {
107 bool (*capable)(enum iommu_cap);
105 int (*domain_init)(struct iommu_domain *domain); 108 int (*domain_init)(struct iommu_domain *domain);
106 void (*domain_destroy)(struct iommu_domain *domain); 109 void (*domain_destroy)(struct iommu_domain *domain);
107 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 110 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
@@ -111,8 +114,6 @@ struct iommu_ops {
111 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 114 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
112 size_t size); 115 size_t size);
113 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); 116 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
114 int (*domain_has_cap)(struct iommu_domain *domain,
115 unsigned long cap);
116 int (*add_device)(struct device *dev); 117 int (*add_device)(struct device *dev);
117 void (*remove_device)(struct device *dev); 118 void (*remove_device)(struct device *dev);
118 int (*device_group)(struct device *dev, unsigned int *groupid); 119 int (*device_group)(struct device *dev, unsigned int *groupid);
@@ -142,6 +143,7 @@ struct iommu_ops {
142 143
143extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); 144extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops);
144extern bool iommu_present(struct bus_type *bus); 145extern bool iommu_present(struct bus_type *bus);
146extern bool iommu_capable(struct bus_type *bus, enum iommu_cap cap);
145extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); 147extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
146extern struct iommu_group *iommu_group_get_by_id(int id); 148extern struct iommu_group *iommu_group_get_by_id(int id);
147extern void iommu_domain_free(struct iommu_domain *domain); 149extern void iommu_domain_free(struct iommu_domain *domain);
@@ -154,8 +156,6 @@ extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
154extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, 156extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
155 size_t size); 157 size_t size);
156extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova); 158extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova);
157extern int iommu_domain_has_cap(struct iommu_domain *domain,
158 unsigned long cap);
159extern void iommu_set_fault_handler(struct iommu_domain *domain, 159extern void iommu_set_fault_handler(struct iommu_domain *domain,
160 iommu_fault_handler_t handler, void *token); 160 iommu_fault_handler_t handler, void *token);
161 161
@@ -250,6 +250,11 @@ static inline bool iommu_present(struct bus_type *bus)
250 return false; 250 return false;
251} 251}
252 252
253static inline bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
254{
255 return false;
256}
257
253static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) 258static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
254{ 259{
255 return NULL; 260 return NULL;
@@ -304,12 +309,6 @@ static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, dma_ad
304 return 0; 309 return 0;
305} 310}
306 311
307static inline int iommu_domain_has_cap(struct iommu_domain *domain,
308 unsigned long cap)
309{
310 return 0;
311}
312
313static inline void iommu_set_fault_handler(struct iommu_domain *domain, 312static inline void iommu_set_fault_handler(struct iommu_domain *domain,
314 iommu_fault_handler_t handler, void *token) 313 iommu_fault_handler_t handler, void *token)
315{ 314{