diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-08-20 15:26:04 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-08-20 15:26:04 -0400 |
commit | f0b433e9f362e0b7f0ce7d1489dd7feba068605d (patch) | |
tree | d4bfd9489cf4a96a55d83af20919f477a846d585 /include/linux/iommu.h | |
parent | fa2f5bf09610d3c216d4c74855edbe00d636467c (diff) | |
parent | 28c42c28309244d0b15d1b385e33429d59997679 (diff) |
Merge tag 'asoc-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Additional updates for 3.6
A batch more bugfixes, all driver-specific and fairly small and
unremarkable in a global context. The biggest batch are for the newly
added Arizona drivers.
Diffstat (limited to 'include/linux/iommu.h')
-rw-r--r-- | include/linux/iommu.h | 140 |
1 files changed, 137 insertions, 3 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 450293f6d68b..54d6d690073c 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #define IOMMU_CACHE (4) /* DMA cache coherency */ | 26 | #define IOMMU_CACHE (4) /* DMA cache coherency */ |
27 | 27 | ||
28 | struct iommu_ops; | 28 | struct iommu_ops; |
29 | struct iommu_group; | ||
29 | struct bus_type; | 30 | struct bus_type; |
30 | struct device; | 31 | struct device; |
31 | struct iommu_domain; | 32 | struct iommu_domain; |
@@ -37,16 +38,28 @@ struct iommu_domain; | |||
37 | typedef int (*iommu_fault_handler_t)(struct iommu_domain *, | 38 | typedef int (*iommu_fault_handler_t)(struct iommu_domain *, |
38 | struct device *, unsigned long, int, void *); | 39 | struct device *, unsigned long, int, void *); |
39 | 40 | ||
41 | struct iommu_domain_geometry { | ||
42 | dma_addr_t aperture_start; /* First address that can be mapped */ | ||
43 | dma_addr_t aperture_end; /* Last address that can be mapped */ | ||
44 | bool force_aperture; /* DMA only allowed in mappable range? */ | ||
45 | }; | ||
46 | |||
40 | struct iommu_domain { | 47 | struct iommu_domain { |
41 | struct iommu_ops *ops; | 48 | struct iommu_ops *ops; |
42 | void *priv; | 49 | void *priv; |
43 | iommu_fault_handler_t handler; | 50 | iommu_fault_handler_t handler; |
44 | void *handler_token; | 51 | void *handler_token; |
52 | struct iommu_domain_geometry geometry; | ||
45 | }; | 53 | }; |
46 | 54 | ||
47 | #define IOMMU_CAP_CACHE_COHERENCY 0x1 | 55 | #define IOMMU_CAP_CACHE_COHERENCY 0x1 |
48 | #define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ | 56 | #define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ |
49 | 57 | ||
58 | enum iommu_attr { | ||
59 | DOMAIN_ATTR_MAX, | ||
60 | DOMAIN_ATTR_GEOMETRY, | ||
61 | }; | ||
62 | |||
50 | #ifdef CONFIG_IOMMU_API | 63 | #ifdef CONFIG_IOMMU_API |
51 | 64 | ||
52 | /** | 65 | /** |
@@ -59,7 +72,10 @@ struct iommu_domain { | |||
59 | * @unmap: unmap a physically contiguous memory region from an iommu domain | 72 | * @unmap: unmap a physically contiguous memory region from an iommu domain |
60 | * @iova_to_phys: translate iova to physical address | 73 | * @iova_to_phys: translate iova to physical address |
61 | * @domain_has_cap: domain capabilities query | 74 | * @domain_has_cap: domain capabilities query |
62 | * @commit: commit iommu domain | 75 | * @add_device: add device to iommu grouping |
76 | * @remove_device: remove device from iommu grouping | ||
77 | * @domain_get_attr: Query domain attributes | ||
78 | * @domain_set_attr: Change domain attributes | ||
63 | * @pgsize_bitmap: bitmap of supported page sizes | 79 | * @pgsize_bitmap: bitmap of supported page sizes |
64 | */ | 80 | */ |
65 | struct iommu_ops { | 81 | struct iommu_ops { |
@@ -75,10 +91,23 @@ struct iommu_ops { | |||
75 | unsigned long iova); | 91 | unsigned long iova); |
76 | int (*domain_has_cap)(struct iommu_domain *domain, | 92 | int (*domain_has_cap)(struct iommu_domain *domain, |
77 | unsigned long cap); | 93 | unsigned long cap); |
94 | int (*add_device)(struct device *dev); | ||
95 | void (*remove_device)(struct device *dev); | ||
78 | int (*device_group)(struct device *dev, unsigned int *groupid); | 96 | int (*device_group)(struct device *dev, unsigned int *groupid); |
97 | int (*domain_get_attr)(struct iommu_domain *domain, | ||
98 | enum iommu_attr attr, void *data); | ||
99 | int (*domain_set_attr)(struct iommu_domain *domain, | ||
100 | enum iommu_attr attr, void *data); | ||
79 | unsigned long pgsize_bitmap; | 101 | unsigned long pgsize_bitmap; |
80 | }; | 102 | }; |
81 | 103 | ||
104 | #define IOMMU_GROUP_NOTIFY_ADD_DEVICE 1 /* Device added */ | ||
105 | #define IOMMU_GROUP_NOTIFY_DEL_DEVICE 2 /* Pre Device removed */ | ||
106 | #define IOMMU_GROUP_NOTIFY_BIND_DRIVER 3 /* Pre Driver bind */ | ||
107 | #define IOMMU_GROUP_NOTIFY_BOUND_DRIVER 4 /* Post Driver bind */ | ||
108 | #define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */ | ||
109 | #define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */ | ||
110 | |||
82 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); | 111 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); |
83 | extern bool iommu_present(struct bus_type *bus); | 112 | extern bool iommu_present(struct bus_type *bus); |
84 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); | 113 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); |
@@ -97,7 +126,34 @@ extern int iommu_domain_has_cap(struct iommu_domain *domain, | |||
97 | unsigned long cap); | 126 | unsigned long cap); |
98 | extern void iommu_set_fault_handler(struct iommu_domain *domain, | 127 | extern void iommu_set_fault_handler(struct iommu_domain *domain, |
99 | iommu_fault_handler_t handler, void *token); | 128 | iommu_fault_handler_t handler, void *token); |
100 | extern int iommu_device_group(struct device *dev, unsigned int *groupid); | 129 | |
130 | extern int iommu_attach_group(struct iommu_domain *domain, | ||
131 | struct iommu_group *group); | ||
132 | extern void iommu_detach_group(struct iommu_domain *domain, | ||
133 | struct iommu_group *group); | ||
134 | extern struct iommu_group *iommu_group_alloc(void); | ||
135 | extern void *iommu_group_get_iommudata(struct iommu_group *group); | ||
136 | extern void iommu_group_set_iommudata(struct iommu_group *group, | ||
137 | void *iommu_data, | ||
138 | void (*release)(void *iommu_data)); | ||
139 | extern int iommu_group_set_name(struct iommu_group *group, const char *name); | ||
140 | extern int iommu_group_add_device(struct iommu_group *group, | ||
141 | struct device *dev); | ||
142 | extern void iommu_group_remove_device(struct device *dev); | ||
143 | extern int iommu_group_for_each_dev(struct iommu_group *group, void *data, | ||
144 | int (*fn)(struct device *, void *)); | ||
145 | extern struct iommu_group *iommu_group_get(struct device *dev); | ||
146 | extern void iommu_group_put(struct iommu_group *group); | ||
147 | extern int iommu_group_register_notifier(struct iommu_group *group, | ||
148 | struct notifier_block *nb); | ||
149 | extern int iommu_group_unregister_notifier(struct iommu_group *group, | ||
150 | struct notifier_block *nb); | ||
151 | extern int iommu_group_id(struct iommu_group *group); | ||
152 | |||
153 | extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, | ||
154 | void *data); | ||
155 | extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, | ||
156 | void *data); | ||
101 | 157 | ||
102 | /** | 158 | /** |
103 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework | 159 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework |
@@ -142,6 +198,7 @@ static inline int report_iommu_fault(struct iommu_domain *domain, | |||
142 | #else /* CONFIG_IOMMU_API */ | 198 | #else /* CONFIG_IOMMU_API */ |
143 | 199 | ||
144 | struct iommu_ops {}; | 200 | struct iommu_ops {}; |
201 | struct iommu_group {}; | ||
145 | 202 | ||
146 | static inline bool iommu_present(struct bus_type *bus) | 203 | static inline bool iommu_present(struct bus_type *bus) |
147 | { | 204 | { |
@@ -197,11 +254,88 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain, | |||
197 | { | 254 | { |
198 | } | 255 | } |
199 | 256 | ||
200 | static inline int iommu_device_group(struct device *dev, unsigned int *groupid) | 257 | int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group) |
258 | { | ||
259 | return -ENODEV; | ||
260 | } | ||
261 | |||
262 | void iommu_detach_group(struct iommu_domain *domain, struct iommu_group *group) | ||
263 | { | ||
264 | } | ||
265 | |||
266 | struct iommu_group *iommu_group_alloc(void) | ||
267 | { | ||
268 | return ERR_PTR(-ENODEV); | ||
269 | } | ||
270 | |||
271 | void *iommu_group_get_iommudata(struct iommu_group *group) | ||
272 | { | ||
273 | return NULL; | ||
274 | } | ||
275 | |||
276 | void iommu_group_set_iommudata(struct iommu_group *group, void *iommu_data, | ||
277 | void (*release)(void *iommu_data)) | ||
278 | { | ||
279 | } | ||
280 | |||
281 | int iommu_group_set_name(struct iommu_group *group, const char *name) | ||
282 | { | ||
283 | return -ENODEV; | ||
284 | } | ||
285 | |||
286 | int iommu_group_add_device(struct iommu_group *group, struct device *dev) | ||
287 | { | ||
288 | return -ENODEV; | ||
289 | } | ||
290 | |||
291 | void iommu_group_remove_device(struct device *dev) | ||
292 | { | ||
293 | } | ||
294 | |||
295 | int iommu_group_for_each_dev(struct iommu_group *group, void *data, | ||
296 | int (*fn)(struct device *, void *)) | ||
297 | { | ||
298 | return -ENODEV; | ||
299 | } | ||
300 | |||
301 | struct iommu_group *iommu_group_get(struct device *dev) | ||
302 | { | ||
303 | return NULL; | ||
304 | } | ||
305 | |||
306 | void iommu_group_put(struct iommu_group *group) | ||
307 | { | ||
308 | } | ||
309 | |||
310 | int iommu_group_register_notifier(struct iommu_group *group, | ||
311 | struct notifier_block *nb) | ||
201 | { | 312 | { |
202 | return -ENODEV; | 313 | return -ENODEV; |
203 | } | 314 | } |
204 | 315 | ||
316 | int iommu_group_unregister_notifier(struct iommu_group *group, | ||
317 | struct notifier_block *nb) | ||
318 | { | ||
319 | return 0; | ||
320 | } | ||
321 | |||
322 | int iommu_group_id(struct iommu_group *group) | ||
323 | { | ||
324 | return -ENODEV; | ||
325 | } | ||
326 | |||
327 | static inline int iommu_domain_get_attr(struct iommu_domain *domain, | ||
328 | enum iommu_attr attr, void *data) | ||
329 | { | ||
330 | return -EINVAL; | ||
331 | } | ||
332 | |||
333 | static inline int iommu_domain_set_attr(struct iommu_domain *domain, | ||
334 | enum iommu_attr attr, void *data) | ||
335 | { | ||
336 | return -EINVAL; | ||
337 | } | ||
338 | |||
205 | #endif /* CONFIG_IOMMU_API */ | 339 | #endif /* CONFIG_IOMMU_API */ |
206 | 340 | ||
207 | #endif /* __LINUX_IOMMU_H */ | 341 | #endif /* __LINUX_IOMMU_H */ |