Commit 67651786 authored by Joerg Roedel's avatar Joerg Roedel

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: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent cefc53c7
...@@ -119,6 +119,9 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova, ...@@ -119,6 +119,9 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
BUG_ON((iova | paddr) & invalid_mask); 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); return iommu_ops->map_range(domain, iova, paddr, size, prot);
} }
EXPORT_SYMBOL_GPL(iommu_map); EXPORT_SYMBOL_GPL(iommu_map);
...@@ -133,6 +136,9 @@ int iommu_unmap(struct iommu_domain *domain, unsigned long iova, int gfp_order) ...@@ -133,6 +136,9 @@ int iommu_unmap(struct iommu_domain *domain, unsigned long iova, int gfp_order)
BUG_ON(iova & invalid_mask); BUG_ON(iova & invalid_mask);
if (iommu_ops->unmap)
return iommu_ops->unmap(domain, iova, gfp_order);
iommu_ops->unmap_range(domain, iova, size); iommu_ops->unmap_range(domain, iova, size);
return gfp_order; return gfp_order;
......
...@@ -36,6 +36,10 @@ struct iommu_ops { ...@@ -36,6 +36,10 @@ struct iommu_ops {
void (*domain_destroy)(struct iommu_domain *domain); void (*domain_destroy)(struct iommu_domain *domain);
int (*attach_dev)(struct iommu_domain *domain, struct device *dev); int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
void (*detach_dev)(struct iommu_domain *domain, struct device *dev); void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
int (*map)(struct iommu_domain *domain, unsigned long iova,
phys_addr_t paddr, int gfp_order, int prot);
int (*unmap)(struct iommu_domain *domain, unsigned long iova,
int gfp_order);
int (*map_range)(struct iommu_domain *domain, unsigned long iova, int (*map_range)(struct iommu_domain *domain, unsigned long iova,
phys_addr_t paddr, size_t size, int prot); phys_addr_t paddr, size_t size, int prot);
void (*unmap_range)(struct iommu_domain *domain, unsigned long iova, void (*unmap_range)(struct iommu_domain *domain, unsigned long iova,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment