diff mbox

[RFC,1/4] iommu: add function iommu_min_pgsize

Message ID 1452241386-22830-2-git-send-email-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Niklas Söderlund Jan. 8, 2016, 8:23 a.m. UTC
This function is useful for drivers wishing to learn about the minimum
supported page size of the IOMMU. This information can for example be
used by drivers to align memory addresses it wish to map into its iommu
domain.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 include/linux/iommu.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox

Patch

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index f28dff3..53d7e69 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -317,6 +317,11 @@  static inline size_t iommu_map_sg(struct iommu_domain *domain,
 	return domain->ops->map_sg(domain, iova, sg, nents, prot);
 }
 
+static inline size_t iommu_min_pgsize(struct iommu_domain *domain)
+{
+	return 1 << __ffs(domain->ops->pgsize_bitmap);
+}
+
 /* PCI device grouping function */
 extern struct iommu_group *pci_device_group(struct device *dev);
 /* Generic device grouping function */
@@ -386,6 +391,11 @@  static inline size_t iommu_map_sg(struct iommu_domain *domain,
 	return -ENODEV;
 }
 
+static inline size_t iommu_min_pgsize(struct iommu_domain *domain)
+{
+	return -ENODEV;
+}
+
 static inline int iommu_domain_window_enable(struct iommu_domain *domain,
 					     u32 wnd_nr, phys_addr_t paddr,
 					     u64 size, int prot)