[PATCH 4/6] iommu: add routine to check strict setting

Matthew Rosato posted 6 patches 2 weeks, 3 days ago
There is a newer version of this series
[PATCH 4/6] iommu: add routine to check strict setting
Posted by Matthew Rosato 2 weeks, 3 days ago
Add a simple routine to return whether or not strict TLB invalidation
is in effect for the iommu.  For drivers that implement the
def_domain_type op, this can be used to determine whether or not flush
queueing is allowed.

Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
---
 drivers/iommu/iommu.c | 5 +++++
 include/linux/iommu.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 599030e1e890..6bdede4177ff 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -715,6 +715,11 @@ void iommu_set_dma_strict(void)
 		iommu_def_domain_type = IOMMU_DOMAIN_DMA;
 }
 
+bool iommu_dma_is_strict(void)
+{
+	return iommu_dma_strict;
+}
+
 static ssize_t iommu_group_attr_show(struct kobject *kobj,
 				     struct attribute *__attr, char *buf)
 {
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 318d27841130..05279109c732 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -911,6 +911,7 @@ int iommu_set_pgtable_quirks(struct iommu_domain *domain,
 		unsigned long quirks);
 
 void iommu_set_dma_strict(void);
+extern bool iommu_dma_is_strict(void);
 
 extern int report_iommu_fault(struct iommu_domain *domain, struct device *dev,
 			      unsigned long iova, int flags);
-- 
2.47.0