aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-01-21 10:32:27 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2010-03-07 12:01:11 -0500
commit67651786948c360c3122b8a17cb1e59209d50880 (patch)
tree533a24ba14a513a99c19af4507dde499aaf1d9c5
parentcefc53c7f494240d4813c80154c7617452d1904d (diff)
iommu-api: Add ->{un}map callbacks to iommu_ops
This patch adds new callbacks for mapping and unmapping pages to the iommu_ops structure. These callbacks are aware of page sizes which makes them different to the ->{un}map_range callbacks. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--drivers/base/iommu.c6
-rw-r--r--include/linux/iommu.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/base/iommu.c b/drivers/base/iommu.c
index cf7cbec116ed..55d37e4609eb 100644
--- a/drivers/base/iommu.c
+++ b/drivers/base/iommu.c
@@ -119,6 +119,9 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
119 119
120 BUG_ON((iova | paddr) & invalid_mask); 120 BUG_ON((iova | paddr) & invalid_mask);
121 121
122 if (iommu_ops->map)
123 return iommu_ops->map(domain, iova, paddr, gfp_order, prot);
124
122 return iommu_ops->map_range(domain, iova, paddr, size, prot); 125 return iommu_ops->map_range(domain, iova, paddr, size, prot);
123} 126}
124EXPORT_SYMBOL_GPL(iommu_map); 127EXPORT_SYMBOL_GPL(iommu_map);
@@ -133,6 +136,9 @@ int iommu_unmap(struct iommu_domain *domain, unsigned long iova, int gfp_order)
133 136
134 BUG_ON(iova & invalid_mask); 137 BUG_ON(iova & invalid_mask);
135 138
139 if (iommu_ops->unmap)
140 return iommu_ops->unmap(domain, iova, gfp_order);
141
136 iommu_ops->unmap_range(domain, iova, size); 142 iommu_ops->unmap_range(domain, iova, size);
137 143
138 return gfp_order; 144 return gfp_order;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 6d0035bb1a0c..5a7a3d888dac 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -36,6 +36,10 @@ struct iommu_ops {
36 void (*domain_destroy)(struct iommu_domain *domain); 36 void (*domain_destroy)(struct iommu_domain *domain);
37 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 37 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
38 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 38 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
39 int (*map)(struct iommu_domain *domain, unsigned long iova,
40 phys_addr_t paddr, int gfp_order, int prot);
41 int (*unmap)(struct iommu_domain *domain, unsigned long iova,
42 int gfp_order);
39 int (*map_range)(struct iommu_domain *domain, unsigned long iova, 43 int (*map_range)(struct iommu_domain *domain, unsigned long iova,
40 phys_addr_t paddr, size_t size, int prot); 44 phys_addr_t paddr, size_t size, int prot);
41 void (*unmap_range)(struct iommu_domain *domain, unsigned long iova, 45 void (*unmap_range)(struct iommu_domain *domain, unsigned long iova,