summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-01-21 16:32:27 +0100
committerJoerg Roedel <joerg.roedel@amd.com>2010-03-07 18:01:11 +0100
commit67651786948c360c3122b8a17cb1e59209d50880 (patch)
tree533a24ba14a513a99c19af4507dde499aaf1d9c5 /drivers/base
parentiommu-api: Add iommu_map and iommu_unmap functions (diff)
downloadlinux-67651786948c360c3122b8a17cb1e59209d50880.tar.xz
linux-67651786948c360c3122b8a17cb1e59209d50880.zip
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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/iommu.c6
1 files changed, 6 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,
BUG_ON((iova | paddr) & invalid_mask);
+ if (iommu_ops->map)
+ return iommu_ops->map(domain, iova, paddr, gfp_order, prot);
+
return iommu_ops->map_range(domain, iova, paddr, size, prot);
}
EXPORT_SYMBOL_GPL(iommu_map);
@@ -133,6 +136,9 @@ int iommu_unmap(struct iommu_domain *domain, unsigned long iova, int gfp_order)
BUG_ON(iova & invalid_mask);
+ if (iommu_ops->unmap)
+ return iommu_ops->unmap(domain, iova, gfp_order);
+
iommu_ops->unmap_range(domain, iova, size);
return gfp_order;