| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2007-2008 Advanced Micro Devices, Inc. | 
|  | 3 | * Author: Joerg Roedel <joerg.roedel@amd.com> | 
|  | 4 | * | 
|  | 5 | * This program is free software; you can redistribute it and/or modify it | 
|  | 6 | * under the terms of the GNU General Public License version 2 as published | 
|  | 7 | * by the Free Software Foundation. | 
|  | 8 | * | 
|  | 9 | * This program is distributed in the hope that it will be useful, | 
|  | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12 | * GNU General Public License for more details. | 
|  | 13 | * | 
|  | 14 | * You should have received a copy of the GNU General Public License | 
|  | 15 | * along with this program; if not, write to the Free Software | 
|  | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA | 
|  | 17 | */ | 
|  | 18 |  | 
|  | 19 | #ifndef __LINUX_IOMMU_H | 
|  | 20 | #define __LINUX_IOMMU_H | 
|  | 21 |  | 
| Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 22 | #include <linux/types.h> | 
| Laura Abbott | 74315cc | 2011-06-08 17:29:11 -0400 | [diff] [blame] | 23 | #include <linux/errno.h> | 
| Stepan Moskovchenko | 0b1345e | 2011-08-11 19:32:27 -0700 | [diff] [blame] | 24 | #include <linux/scatterlist.h> | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 25 | #include <linux/err.h> | 
| Laura Abbott | 74315cc | 2011-06-08 17:29:11 -0400 | [diff] [blame] | 26 |  | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 27 | #define IOMMU_READ	(1) | 
|  | 28 | #define IOMMU_WRITE	(2) | 
| Sheng Yang | 9cf0669 | 2009-03-18 15:33:07 +0800 | [diff] [blame] | 29 | #define IOMMU_CACHE	(4) /* DMA cache coherency */ | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 30 |  | 
| Joerg Roedel | 905d66c | 2011-09-06 16:03:26 +0200 | [diff] [blame] | 31 | struct iommu_ops; | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 32 | struct iommu_group; | 
| Joerg Roedel | ff21776 | 2011-08-26 16:48:26 +0200 | [diff] [blame] | 33 | struct bus_type; | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 34 | struct device; | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 35 | struct iommu_domain; | 
|  | 36 |  | 
|  | 37 | /* iommu fault flags */ | 
|  | 38 | #define IOMMU_FAULT_READ	0x0 | 
|  | 39 | #define IOMMU_FAULT_WRITE	0x1 | 
|  | 40 |  | 
|  | 41 | typedef int (*iommu_fault_handler_t)(struct iommu_domain *, | 
| Ohad Ben-Cohen | d506953 | 2012-05-21 20:20:05 +0300 | [diff] [blame] | 42 | struct device *, unsigned long, int, void *); | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 43 |  | 
|  | 44 | struct iommu_domain { | 
| Joerg Roedel | 905d66c | 2011-09-06 16:03:26 +0200 | [diff] [blame] | 45 | struct iommu_ops *ops; | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 46 | void *priv; | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 47 | iommu_fault_handler_t handler; | 
| Ohad Ben-Cohen | d506953 | 2012-05-21 20:20:05 +0300 | [diff] [blame] | 48 | void *handler_token; | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 49 | }; | 
|  | 50 |  | 
| Sheng Yang | dbb9fd8 | 2009-03-18 15:33:06 +0800 | [diff] [blame] | 51 | #define IOMMU_CAP_CACHE_COHERENCY	0x1 | 
| Tom Lyon | 323f99c | 2010-07-02 16:56:14 -0400 | [diff] [blame] | 52 | #define IOMMU_CAP_INTR_REMAP		0x2	/* isolates device intrs */ | 
| Sheng Yang | dbb9fd8 | 2009-03-18 15:33:06 +0800 | [diff] [blame] | 53 |  | 
| Joerg Roedel | 39d4ebb | 2011-09-06 16:48:40 +0200 | [diff] [blame] | 54 | #ifdef CONFIG_IOMMU_API | 
|  | 55 |  | 
| Ohad Ben-Cohen | 7d3002c | 2011-11-10 11:32:26 +0200 | [diff] [blame] | 56 | /** | 
|  | 57 | * struct iommu_ops - iommu ops and capabilities | 
|  | 58 | * @domain_init: init iommu domain | 
|  | 59 | * @domain_destroy: destroy iommu domain | 
|  | 60 | * @attach_dev: attach device to an iommu domain | 
|  | 61 | * @detach_dev: detach device from an iommu domain | 
|  | 62 | * @map: map a physically contiguous memory region to an iommu domain | 
|  | 63 | * @unmap: unmap a physically contiguous memory region from an iommu domain | 
|  | 64 | * @iova_to_phys: translate iova to physical address | 
|  | 65 | * @domain_has_cap: domain capabilities query | 
|  | 66 | * @commit: commit iommu domain | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 67 | * @add_device: add device to iommu grouping | 
|  | 68 | * @remove_device: remove device from iommu grouping | 
| Ohad Ben-Cohen | 7d3002c | 2011-11-10 11:32:26 +0200 | [diff] [blame] | 69 | * @pgsize_bitmap: bitmap of supported page sizes | 
|  | 70 | */ | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 71 | struct iommu_ops { | 
| Stepan Moskovchenko | ff2d366 | 2011-08-31 17:13:32 -0700 | [diff] [blame] | 72 | int (*domain_init)(struct iommu_domain *domain, int flags); | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 73 | void (*domain_destroy)(struct iommu_domain *domain); | 
|  | 74 | int (*attach_dev)(struct iommu_domain *domain, struct device *dev); | 
|  | 75 | void (*detach_dev)(struct iommu_domain *domain, struct device *dev); | 
| Joerg Roedel | 6765178 | 2010-01-21 16:32:27 +0100 | [diff] [blame] | 76 | int (*map)(struct iommu_domain *domain, unsigned long iova, | 
| Ohad Ben-Cohen | 5009065 | 2011-11-10 11:32:25 +0200 | [diff] [blame] | 77 | phys_addr_t paddr, size_t size, int prot); | 
|  | 78 | size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, | 
|  | 79 | size_t size); | 
| Stepan Moskovchenko | 0b1345e | 2011-08-11 19:32:27 -0700 | [diff] [blame] | 80 | int (*map_range)(struct iommu_domain *domain, unsigned int iova, | 
|  | 81 | struct scatterlist *sg, unsigned int len, int prot); | 
|  | 82 | int (*unmap_range)(struct iommu_domain *domain, unsigned int iova, | 
|  | 83 | unsigned int len); | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 84 | phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, | 
|  | 85 | unsigned long iova); | 
| Sheng Yang | dbb9fd8 | 2009-03-18 15:33:06 +0800 | [diff] [blame] | 86 | int (*domain_has_cap)(struct iommu_domain *domain, | 
|  | 87 | unsigned long cap); | 
| Shubhraprakash Das | 4c436f2 | 2011-12-02 18:01:57 -0700 | [diff] [blame] | 88 | phys_addr_t (*get_pt_base_addr)(struct iommu_domain *domain); | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 89 | int (*add_device)(struct device *dev); | 
|  | 90 | void (*remove_device)(struct device *dev); | 
| Ohad Ben-Cohen | 7d3002c | 2011-11-10 11:32:26 +0200 | [diff] [blame] | 91 | unsigned long pgsize_bitmap; | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 92 | }; | 
|  | 93 |  | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 94 | #define IOMMU_GROUP_NOTIFY_ADD_DEVICE		1 /* Device added */ | 
|  | 95 | #define IOMMU_GROUP_NOTIFY_DEL_DEVICE		2 /* Pre Device removed */ | 
|  | 96 | #define IOMMU_GROUP_NOTIFY_BIND_DRIVER		3 /* Pre Driver bind */ | 
|  | 97 | #define IOMMU_GROUP_NOTIFY_BOUND_DRIVER		4 /* Post Driver bind */ | 
|  | 98 | #define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER	5 /* Pre Driver unbind */ | 
|  | 99 | #define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER	6 /* Post Driver unbind */ | 
|  | 100 |  | 
| Joerg Roedel | ff21776 | 2011-08-26 16:48:26 +0200 | [diff] [blame] | 101 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); | 
| Joerg Roedel | a1b60c1 | 2011-09-06 18:46:34 +0200 | [diff] [blame] | 102 | extern bool iommu_present(struct bus_type *bus); | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 103 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags); | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 104 | extern void iommu_domain_free(struct iommu_domain *domain); | 
|  | 105 | extern int iommu_attach_device(struct iommu_domain *domain, | 
|  | 106 | struct device *dev); | 
|  | 107 | extern void iommu_detach_device(struct iommu_domain *domain, | 
|  | 108 | struct device *dev); | 
| Joerg Roedel | cefc53c | 2010-01-08 13:35:09 +0100 | [diff] [blame] | 109 | extern int iommu_map(struct iommu_domain *domain, unsigned long iova, | 
| Ohad Ben-Cohen | 7d3002c | 2011-11-10 11:32:26 +0200 | [diff] [blame] | 110 | phys_addr_t paddr, size_t size, int prot); | 
|  | 111 | extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, | 
|  | 112 | size_t size); | 
| Stepan Moskovchenko | 0b1345e | 2011-08-11 19:32:27 -0700 | [diff] [blame] | 113 | extern int iommu_map_range(struct iommu_domain *domain, unsigned int iova, | 
|  | 114 | struct scatterlist *sg, unsigned int len, int prot); | 
|  | 115 | extern int iommu_unmap_range(struct iommu_domain *domain, unsigned int iova, | 
|  | 116 | unsigned int len); | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 117 | extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, | 
|  | 118 | unsigned long iova); | 
| Sheng Yang | dbb9fd8 | 2009-03-18 15:33:06 +0800 | [diff] [blame] | 119 | extern int iommu_domain_has_cap(struct iommu_domain *domain, | 
|  | 120 | unsigned long cap); | 
| Shubhraprakash Das | 4c436f2 | 2011-12-02 18:01:57 -0700 | [diff] [blame] | 121 | extern phys_addr_t iommu_get_pt_base_addr(struct iommu_domain *domain); | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 122 | extern void iommu_set_fault_handler(struct iommu_domain *domain, | 
| Ohad Ben-Cohen | d506953 | 2012-05-21 20:20:05 +0300 | [diff] [blame] | 123 | iommu_fault_handler_t handler, void *token); | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 124 |  | 
|  | 125 | extern int iommu_attach_group(struct iommu_domain *domain, | 
|  | 126 | struct iommu_group *group); | 
|  | 127 | extern void iommu_detach_group(struct iommu_domain *domain, | 
|  | 128 | struct iommu_group *group); | 
|  | 129 | extern struct iommu_group *iommu_group_alloc(void); | 
|  | 130 | extern void *iommu_group_get_iommudata(struct iommu_group *group); | 
|  | 131 | extern void iommu_group_set_iommudata(struct iommu_group *group, | 
|  | 132 | void *iommu_data, | 
|  | 133 | void (*release)(void *iommu_data)); | 
|  | 134 | extern int iommu_group_set_name(struct iommu_group *group, const char *name); | 
|  | 135 | extern int iommu_group_add_device(struct iommu_group *group, | 
|  | 136 | struct device *dev); | 
|  | 137 | extern void iommu_group_remove_device(struct device *dev); | 
|  | 138 | extern int iommu_group_for_each_dev(struct iommu_group *group, void *data, | 
|  | 139 | int (*fn)(struct device *, void *)); | 
|  | 140 | extern struct iommu_group *iommu_group_get(struct device *dev); | 
| Olav Haugan | 0d06337 | 2012-12-06 16:53:56 -0800 | [diff] [blame] | 141 | extern struct iommu_group *iommu_group_find(const char *name); | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 142 | extern void iommu_group_put(struct iommu_group *group); | 
|  | 143 | extern int iommu_group_register_notifier(struct iommu_group *group, | 
|  | 144 | struct notifier_block *nb); | 
|  | 145 | extern int iommu_group_unregister_notifier(struct iommu_group *group, | 
|  | 146 | struct notifier_block *nb); | 
|  | 147 | extern int iommu_group_id(struct iommu_group *group); | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 148 |  | 
|  | 149 | /** | 
|  | 150 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework | 
|  | 151 | * @domain: the iommu domain where the fault has happened | 
|  | 152 | * @dev: the device where the fault has happened | 
|  | 153 | * @iova: the faulting address | 
|  | 154 | * @flags: mmu fault flags (e.g. IOMMU_FAULT_READ/IOMMU_FAULT_WRITE/...) | 
|  | 155 | * | 
|  | 156 | * This function should be called by the low-level IOMMU implementations | 
|  | 157 | * whenever IOMMU faults happen, to allow high-level users, that are | 
|  | 158 | * interested in such events, to know about them. | 
|  | 159 | * | 
|  | 160 | * This event may be useful for several possible use cases: | 
|  | 161 | * - mere logging of the event | 
|  | 162 | * - dynamic TLB/PTE loading | 
|  | 163 | * - if restarting of the faulting device is required | 
|  | 164 | * | 
|  | 165 | * Returns 0 on success and an appropriate error code otherwise (if dynamic | 
|  | 166 | * PTE/TLB loading will one day be supported, implementations will be able | 
|  | 167 | * to tell whether it succeeded or not according to this return value). | 
| Ohad Ben-Cohen | 0ed6d2d | 2011-09-27 07:36:40 -0400 | [diff] [blame] | 168 | * | 
|  | 169 | * Specifically, -ENOSYS is returned if a fault handler isn't installed | 
|  | 170 | * (though fault handlers can also return -ENOSYS, in case they want to | 
|  | 171 | * elicit the default behavior of the IOMMU drivers). | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 172 | */ | 
|  | 173 | static inline int report_iommu_fault(struct iommu_domain *domain, | 
|  | 174 | struct device *dev, unsigned long iova, int flags) | 
|  | 175 | { | 
| Ohad Ben-Cohen | 0ed6d2d | 2011-09-27 07:36:40 -0400 | [diff] [blame] | 176 | int ret = -ENOSYS; | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 177 |  | 
|  | 178 | /* | 
|  | 179 | * if upper layers showed interest and installed a fault handler, | 
|  | 180 | * invoke it. | 
|  | 181 | */ | 
|  | 182 | if (domain->handler) | 
| Ohad Ben-Cohen | d506953 | 2012-05-21 20:20:05 +0300 | [diff] [blame] | 183 | ret = domain->handler(domain, dev, iova, flags, | 
|  | 184 | domain->handler_token); | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 185 |  | 
|  | 186 | return ret; | 
|  | 187 | } | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 188 |  | 
|  | 189 | #else /* CONFIG_IOMMU_API */ | 
|  | 190 |  | 
| Joerg Roedel | 39d4ebb | 2011-09-06 16:48:40 +0200 | [diff] [blame] | 191 | struct iommu_ops {}; | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 192 | struct iommu_group {}; | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 193 |  | 
| Joerg Roedel | a1b60c1 | 2011-09-06 18:46:34 +0200 | [diff] [blame] | 194 | static inline bool iommu_present(struct bus_type *bus) | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 195 | { | 
|  | 196 | return false; | 
|  | 197 | } | 
|  | 198 |  | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 199 | static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags) | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 200 | { | 
|  | 201 | return NULL; | 
|  | 202 | } | 
|  | 203 |  | 
|  | 204 | static inline void iommu_domain_free(struct iommu_domain *domain) | 
|  | 205 | { | 
|  | 206 | } | 
|  | 207 |  | 
|  | 208 | static inline int iommu_attach_device(struct iommu_domain *domain, | 
|  | 209 | struct device *dev) | 
|  | 210 | { | 
|  | 211 | return -ENODEV; | 
|  | 212 | } | 
|  | 213 |  | 
|  | 214 | static inline void iommu_detach_device(struct iommu_domain *domain, | 
|  | 215 | struct device *dev) | 
|  | 216 | { | 
|  | 217 | } | 
|  | 218 |  | 
| Joerg Roedel | cefc53c | 2010-01-08 13:35:09 +0100 | [diff] [blame] | 219 | static inline int iommu_map(struct iommu_domain *domain, unsigned long iova, | 
|  | 220 | phys_addr_t paddr, int gfp_order, int prot) | 
|  | 221 | { | 
|  | 222 | return -ENODEV; | 
|  | 223 | } | 
|  | 224 |  | 
|  | 225 | static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova, | 
|  | 226 | int gfp_order) | 
|  | 227 | { | 
|  | 228 | return -ENODEV; | 
|  | 229 | } | 
|  | 230 |  | 
| Stepan Moskovchenko | 0b1345e | 2011-08-11 19:32:27 -0700 | [diff] [blame] | 231 | static inline int iommu_map_range(struct iommu_domain *domain, | 
|  | 232 | unsigned int iova, struct scatterlist *sg, | 
|  | 233 | unsigned int len, int prot) | 
|  | 234 | { | 
|  | 235 | return -ENODEV; | 
|  | 236 | } | 
|  | 237 |  | 
|  | 238 | static inline int iommu_unmap_range(struct iommu_domain *domain, | 
|  | 239 | unsigned int iova, unsigned int len) | 
|  | 240 | { | 
|  | 241 | return -ENODEV; | 
|  | 242 | } | 
|  | 243 |  | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 244 | static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, | 
|  | 245 | unsigned long iova) | 
|  | 246 | { | 
|  | 247 | return 0; | 
|  | 248 | } | 
|  | 249 |  | 
| Sheng Yang | dbb9fd8 | 2009-03-18 15:33:06 +0800 | [diff] [blame] | 250 | static inline int domain_has_cap(struct iommu_domain *domain, | 
|  | 251 | unsigned long cap) | 
|  | 252 | { | 
|  | 253 | return 0; | 
|  | 254 | } | 
|  | 255 |  | 
| Shubhraprakash Das | 4c436f2 | 2011-12-02 18:01:57 -0700 | [diff] [blame] | 256 | static inline phys_addr_t iommu_get_pt_base_addr(struct iommu_domain *domain) | 
|  | 257 | { | 
|  | 258 | return 0; | 
|  | 259 | } | 
| Ohad Ben-Cohen | a1c6df3 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 260 |  | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 261 | static inline void iommu_set_fault_handler(struct iommu_domain *domain, | 
| Ohad Ben-Cohen | d506953 | 2012-05-21 20:20:05 +0300 | [diff] [blame] | 262 | iommu_fault_handler_t handler, void *token) | 
| Ohad Ben-Cohen | 4f3f8d9 | 2011-09-13 15:25:23 -0400 | [diff] [blame] | 263 | { | 
|  | 264 | } | 
|  | 265 |  | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 266 | static inline int iommu_attach_group(struct iommu_domain *domain, | 
|  | 267 | struct iommu_group *group) | 
| Alex Williamson | 1460432 | 2011-10-21 15:56:05 -0400 | [diff] [blame] | 268 | { | 
|  | 269 | return -ENODEV; | 
|  | 270 | } | 
|  | 271 |  | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 272 | static inline void iommu_detach_group(struct iommu_domain *domain, | 
|  | 273 | struct iommu_group *group) | 
|  | 274 | { | 
|  | 275 | } | 
|  | 276 |  | 
|  | 277 | static inline struct iommu_group *iommu_group_alloc(void) | 
|  | 278 | { | 
|  | 279 | return ERR_PTR(-ENODEV); | 
|  | 280 | } | 
|  | 281 |  | 
|  | 282 | static inline void *iommu_group_get_iommudata(struct iommu_group *group) | 
|  | 283 | { | 
|  | 284 | return NULL; | 
|  | 285 | } | 
|  | 286 |  | 
|  | 287 | static inline void iommu_group_set_iommudata(struct iommu_group *group, | 
|  | 288 | void *iommu_data, | 
|  | 289 | void (*release)(void *iommu_data)) | 
|  | 290 | { | 
|  | 291 | } | 
|  | 292 |  | 
|  | 293 | static inline int iommu_group_set_name(struct iommu_group *group, | 
|  | 294 | const char *name) | 
|  | 295 | { | 
|  | 296 | return -ENODEV; | 
|  | 297 | } | 
|  | 298 |  | 
|  | 299 | static inline int iommu_group_add_device(struct iommu_group *group, | 
|  | 300 | struct device *dev) | 
|  | 301 | { | 
|  | 302 | return -ENODEV; | 
|  | 303 | } | 
|  | 304 |  | 
|  | 305 | static inline void iommu_group_remove_device(struct device *dev) | 
|  | 306 | { | 
|  | 307 | } | 
|  | 308 |  | 
|  | 309 | static inline int iommu_group_for_each_dev(struct iommu_group *group, | 
|  | 310 | void *data, | 
|  | 311 | int (*fn)(struct device *, void *)) | 
|  | 312 | { | 
|  | 313 | return -ENODEV; | 
|  | 314 | } | 
|  | 315 |  | 
|  | 316 | static inline struct iommu_group *iommu_group_get(struct device *dev) | 
|  | 317 | { | 
|  | 318 | return NULL; | 
|  | 319 | } | 
|  | 320 |  | 
| Olav Haugan | 0d06337 | 2012-12-06 16:53:56 -0800 | [diff] [blame] | 321 | static inline struct iommu_group *iommu_group_find(const char *name) | 
|  | 322 | { | 
|  | 323 | return NULL; | 
|  | 324 | } | 
|  | 325 |  | 
| Alex Williamson | 43a0ba6 | 2012-05-30 14:18:53 -0600 | [diff] [blame] | 326 | static inline void iommu_group_put(struct iommu_group *group) | 
|  | 327 | { | 
|  | 328 | } | 
|  | 329 |  | 
|  | 330 | static inline int iommu_group_register_notifier(struct iommu_group *group, | 
|  | 331 | struct notifier_block *nb) | 
|  | 332 | { | 
|  | 333 | return -ENODEV; | 
|  | 334 | } | 
|  | 335 |  | 
|  | 336 | static inline int iommu_group_unregister_notifier(struct iommu_group *group, | 
|  | 337 | struct notifier_block *nb) | 
|  | 338 | { | 
|  | 339 | return 0; | 
|  | 340 | } | 
|  | 341 |  | 
|  | 342 | static inline int iommu_group_id(struct iommu_group *group) | 
|  | 343 | { | 
|  | 344 | return -ENODEV; | 
|  | 345 | } | 
| Joerg Roedel | 4a77a6c | 2008-11-26 17:02:33 +0100 | [diff] [blame] | 346 | #endif /* CONFIG_IOMMU_API */ | 
|  | 347 |  | 
|  | 348 | #endif /* __LINUX_IOMMU_H */ |