All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 1/4] iommu: add function iommu_min_pgsize
@ 2016-01-08  8:23 Niklas Söderlund
  0 siblings, 0 replies; only message in thread
From: Niklas Söderlund @ 2016-01-08  8:23 UTC (permalink / raw)
  To: linux-sh

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 --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)
-- 
2.6.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-08  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08  8:23 [RFC 1/4] iommu: add function iommu_min_pgsize Niklas Söderlund

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.