diff options
author | Joerg Roedel <joro@8bytes.org> | 2013-01-29 08:26:20 -0500 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2013-02-06 04:47:22 -0500 |
commit | d7787d579cbef9f8079104759a2259fc916c688c (patch) | |
tree | 28e2066c0c89b1d25e8caf2c60956ecc45e3f781 | |
parent | d2e121601619631517409cba34e50db3cbff5852 (diff) |
iommu: Add domain window handling functions
Add the iommu_domain_window_enable() and iommu_domain_window_disable()
functions to the IOMMU-API. These functions will be used to setup
domains that are based on subwindows and not on paging.
Signed-off-by: Joerg Roedel <joro@8bytes.org>
-rw-r--r-- | drivers/iommu/iommu.c | 20 | ||||
-rw-r--r-- | include/linux/iommu.h | 22 |
2 files changed, 42 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 0e0e5f2e0ccc..b3aced7356cc 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -852,6 +852,26 @@ size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova, size_t size) | |||
852 | } | 852 | } |
853 | EXPORT_SYMBOL_GPL(iommu_unmap); | 853 | EXPORT_SYMBOL_GPL(iommu_unmap); |
854 | 854 | ||
855 | |||
856 | int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, | ||
857 | phys_addr_t paddr, u64 size) | ||
858 | { | ||
859 | if (unlikely(domain->ops->domain_window_enable == NULL)) | ||
860 | return -ENODEV; | ||
861 | |||
862 | return domain->ops->domain_window_enable(domain, wnd_nr, paddr, size); | ||
863 | } | ||
864 | EXPORT_SYMBOL_GPL(iommu_domain_window_enable); | ||
865 | |||
866 | void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr) | ||
867 | { | ||
868 | if (unlikely(domain->ops->domain_window_disable == NULL)) | ||
869 | return; | ||
870 | |||
871 | return domain->ops->domain_window_disable(domain, wnd_nr); | ||
872 | } | ||
873 | EXPORT_SYMBOL_GPL(iommu_domain_window_disable); | ||
874 | |||
855 | static int __init iommu_init(void) | 875 | static int __init iommu_init(void) |
856 | { | 876 | { |
857 | iommu_group_kset = kset_create_and_add("iommu_groups", | 877 | iommu_group_kset = kset_create_and_add("iommu_groups", |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 26066f54a849..5ea3d7250917 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -101,6 +101,12 @@ struct iommu_ops { | |||
101 | enum iommu_attr attr, void *data); | 101 | enum iommu_attr attr, void *data); |
102 | int (*domain_set_attr)(struct iommu_domain *domain, | 102 | int (*domain_set_attr)(struct iommu_domain *domain, |
103 | enum iommu_attr attr, void *data); | 103 | enum iommu_attr attr, void *data); |
104 | |||
105 | /* Window handling functions */ | ||
106 | int (*domain_window_enable)(struct iommu_domain *domain, u32 wnd_nr, | ||
107 | phys_addr_t paddr, u64 size); | ||
108 | void (*domain_window_disable)(struct iommu_domain *domain, u32 wnd_nr); | ||
109 | |||
104 | unsigned long pgsize_bitmap; | 110 | unsigned long pgsize_bitmap; |
105 | }; | 111 | }; |
106 | 112 | ||
@@ -158,6 +164,10 @@ extern int iommu_domain_get_attr(struct iommu_domain *domain, enum iommu_attr, | |||
158 | extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, | 164 | extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr, |
159 | void *data); | 165 | void *data); |
160 | 166 | ||
167 | /* Window handling function prototypes */ | ||
168 | extern int iommu_domain_window_enable(struct iommu_domain *domain, u32 wnd_nr, | ||
169 | phys_addr_t offset, u64 size); | ||
170 | extern void iommu_domain_window_disable(struct iommu_domain *domain, u32 wnd_nr); | ||
161 | /** | 171 | /** |
162 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework | 172 | * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework |
163 | * @domain: the iommu domain where the fault has happened | 173 | * @domain: the iommu domain where the fault has happened |
@@ -240,6 +250,18 @@ static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova, | |||
240 | return -ENODEV; | 250 | return -ENODEV; |
241 | } | 251 | } |
242 | 252 | ||
253 | static inline int iommu_domain_window_enable(struct iommu_domain *domain, | ||
254 | u32 wnd_nr, phys_addr_t paddr, | ||
255 | u64 size) | ||
256 | { | ||
257 | return -ENODEV; | ||
258 | } | ||
259 | |||
260 | static inline void iommu_domain_window_disable(struct iommu_domain *domain, | ||
261 | u32 wnd_nr) | ||
262 | { | ||
263 | } | ||
264 | |||
243 | static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, | 265 | static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, |
244 | unsigned long iova) | 266 | unsigned long iova) |
245 | { | 267 | { |