summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2015-12-03 11:17:23 -0800
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-20 19:23:56 -0700
commite7f52c5c475be7ece4053cc4058776128a6e37c4 (patch)
tree99ed6183e2cbafee7249f7716b21e73c5533ad11
parentb7d9fb96e00d4d48ef580cd4d5a80daebd6e82ad (diff)
iommu: Add tlbi_domain op
Some higher-level DMA mappers might be able to squeeze out more performance if TLB invalidation can be delegated to them, since they might have more knowledge about when a stale TLB is problem than the IOMMU driver. Add a callback for this purpose that can be implemented by individual IOMMU drivers. CRs-Fixed: 997751 Change-Id: If817f5514fdd5d24b9c592440760b81b88ec71a8 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-rw-r--r--include/linux/iommu.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 303768c814c3..a41f34188840 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -173,6 +173,7 @@ struct iommu_dm_region {
* @trigger_fault: trigger a fault on the device attached to an iommu domain
* @reg_read: read an IOMMU register
* @reg_write: write an IOMMU register
+ * @tlbi_domain: Invalidate all TLBs covering an iommu domain
* @priv: per-instance data private to the iommu driver
*/
struct iommu_ops {
@@ -220,6 +221,7 @@ struct iommu_ops {
unsigned long offset);
void (*reg_write)(struct iommu_domain *domain, unsigned long val,
unsigned long offset);
+ void (*tlbi_domain)(struct iommu_domain *domain);
#ifdef CONFIG_OF_IOMMU
int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
@@ -382,6 +384,12 @@ extern struct iommu_group *pci_device_group(struct device *dev);
/* Generic device grouping function */
extern struct iommu_group *generic_device_group(struct device *dev);
+static inline void iommu_tlbiall(struct iommu_domain *domain)
+{
+ if (domain->ops->tlbi_domain)
+ domain->ops->tlbi_domain(domain);
+}
+
#else /* CONFIG_IOMMU_API */
struct iommu_ops {};
@@ -626,6 +634,10 @@ static int iommu_dma_supported(struct iommu_domain *domain, struct device *dev,
return -EINVAL;
}
+static inline void iommu_tlbiall(struct iommu_domain *domain)
+{
+}
+
#endif /* CONFIG_IOMMU_API */
#endif /* __LINUX_IOMMU_H */