drivers: iommu: Add map/unmap range ops
Add IOMMU ops functions to allow mapping and unmapping
whole ranges of address space based on a scatterlist.
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index d56318c..f4f32a6 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -21,6 +21,7 @@
#include <linux/types.h>
#include <linux/errno.h>
+#include <linux/scatterlist.h>
#define IOMMU_READ (1)
#define IOMMU_WRITE (2)
@@ -44,6 +45,10 @@
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 int iova,
+ struct scatterlist *sg, unsigned int len, int prot);
+ int (*unmap_range)(struct iommu_domain *domain, unsigned int iova,
+ unsigned int len);
phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
unsigned long iova);
int (*domain_has_cap)(struct iommu_domain *domain,
@@ -64,6 +69,10 @@
phys_addr_t paddr, int gfp_order, int prot);
extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
int gfp_order);
+extern int iommu_map_range(struct iommu_domain *domain, unsigned int iova,
+ struct scatterlist *sg, unsigned int len, int prot);
+extern int iommu_unmap_range(struct iommu_domain *domain, unsigned int iova,
+ unsigned int len);
extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
unsigned long iova);
extern int iommu_domain_has_cap(struct iommu_domain *domain,
@@ -112,6 +121,19 @@
return -ENODEV;
}
+static inline int iommu_map_range(struct iommu_domain *domain,
+ unsigned int iova, struct scatterlist *sg,
+ unsigned int len, int prot)
+{
+ return -ENODEV;
+}
+
+static inline int iommu_unmap_range(struct iommu_domain *domain,
+ unsigned int iova, unsigned int len)
+{
+ return -ENODEV;
+}
+
static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
unsigned long iova)
{