diff options
| author | Joerg Roedel <joerg.roedel@amd.com> | 2012-01-26 13:40:52 -0500 |
|---|---|---|
| committer | Joerg Roedel <joerg.roedel@amd.com> | 2012-07-11 06:12:14 -0400 |
| commit | 0cd76dd13bdd2f7f02a2dc931e808e92b191082f (patch) | |
| tree | 210df4b7fda8f81121fd8fb1f89a57e3e358060e /include/linux | |
| parent | bd0a521e88aa7a06ae7aabaed7ae196ed4ad867a (diff) | |
iommu: Add domain-attribute handlers
This patch introduces an extension to the iommu-api to get
and set attributes for an iommu_domain. Two functions are
introduced for this:
* iommu_domain_get_attr()
* iommu_domain_set_attr()
These functions will be used to make the iommu-api suitable
for GART-like IOMMUs and to implement hardware-specifc
api-extensions.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/iommu.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 450293f6d68b..0eef096183e8 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
| @@ -47,6 +47,10 @@ struct iommu_domain { | |||
| 47 | #define IOMMU_CAP_CACHE_COHERENCY 0x1 | 47 | #define IOMMU_CAP_CACHE_COHERENCY 0x1 |
| 48 | #define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ | 48 | #define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ |
| 49 | 49 | ||
| 50 | enum iommu_attr { | ||
| 51 | DOMAIN_ATTR_MAX, | ||
| 52 | }; | ||
| 53 | |||
| 50 | #ifdef CONFIG_IOMMU_API | 54 | #ifdef CONFIG_IOMMU_API |
| 51 | 55 | ||
| 52 | /** | 56 | /** |
| @@ -59,7 +63,8 @@ struct iommu_domain { | |||
| 59 | * @unmap: unmap a physically contiguous memory region from an iommu domain | 63 | * @unmap: unmap a physically contiguous memory region from an iommu domain |
| 60 | * @iova_to_phys: translate iova to physical address | 64 | * @iova_to_phys: translate iova to physical address |
| 61 | * @domain_has_cap: domain capabilities query | 65 | * @domain_has_cap: domain capabilities query |
| 62 | * @commit: commit iommu domain | 66 | * @domain_get_attr: Query domain attributes |
| 67 | * @domain_set_attr: Change domain attributes | ||
| 63 | * @pgsize_bitmap: bitmap of supported page sizes | 68 | * @pgsize_bitmap: bitmap of supported page sizes |
| 64 | */ | 69 | */ |
| 65 | struct iommu_ops { | 70 | struct iommu_ops { |
| @@ -76,6 +81,10 @@ struct iommu_ops { | |||
| 76 | int (*domain_has_cap)(struct iommu_domain *domain, | 81 | int (*domain_has_cap)(struct iommu_domain *domain, |
| 77 | unsigned long cap); | 82 | unsigned long cap); |
| 78 | int (*device_group)(struct device *dev, unsigned int *groupid); | 83 | int (*device_group)(struct device *dev, unsigned int *groupid); |
| 84 | int (*domain_get_attr)(struct iommu_domain *domain, | ||
| 85 | enum iommu_attr attr, void *data); | ||
| 86 | int (*domain_set_attr)(struct iommu_domain *domain, | ||
| 87 | enum iommu_attr attr, void *data); | ||
| 79 | unsigned long pgsize_bitmap; | 88 | unsigned long pgsize_bitmap; |
| 80 | }; | 89 | }; |
| 81 | 90 | ||
| @@ -99,6 +108,11 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain, | |||
| 99 | iommu_fault_handler_t handler, void *token); | 108 | iommu_fault_handler_t handler, void *token); |
| 100 | extern int iommu_device_group(struct device *dev, unsigned int *groupid); | 109 | extern int iommu_device_group(struct device *dev, unsigned int *groupid); |
| 101 | 110 | ||
| 111 | extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, | ||
| 112 | void *data); | ||
| 113 | extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, | ||
| 114 | void *data); | ||
| 115 | |||
| 102 | /** | 116 | /** |
| 103 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework | 117 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework |
| 104 | * @domain: the iommu domain where the fault has happened | 118 | * @domain: the iommu domain where the fault has happened |
| @@ -202,6 +216,18 @@ static inline int iommu_device_group(struct device *dev, unsigned int *groupid) | |||
| 202 | return -ENODEV; | 216 | return -ENODEV; |
| 203 | } | 217 | } |
| 204 | 218 | ||
| 219 | static inline int iommu_domain_get_attr(struct iommu_domain *domain, | ||
| 220 | enum iommu_attr attr, void *data) | ||
| 221 | { | ||
| 222 | return -EINVAL; | ||
| 223 | } | ||
| 224 | |||
| 225 | static inline int iommu_domain_set_attr(struct iommu_domain *domain, | ||
| 226 | enum iommu_attr attr, void *data) | ||
| 227 | { | ||
| 228 | return -EINVAL; | ||
| 229 | } | ||
| 230 | |||
| 205 | #endif /* CONFIG_IOMMU_API */ | 231 | #endif /* CONFIG_IOMMU_API */ |
| 206 | 232 | ||
| 207 | #endif /* __LINUX_IOMMU_H */ | 233 | #endif /* __LINUX_IOMMU_H */ |
