Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61d711a6 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

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: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent f6be9386
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ extern struct dentry *iommu_debugfs_top;
 * @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 {
@@ -178,6 +179,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);
@@ -332,6 +334,12 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain,
extern int iommu_dma_supported(struct iommu_domain *domain, struct device *dev,
			       u64 mask);

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 {};
@@ -568,6 +576,10 @@ static inline int iommu_dma_supported(struct iommu_domain *domain,
	return -EINVAL;
}

static inline void iommu_tlbiall(struct iommu_domain *domain)
{
}

#endif /* CONFIG_IOMMU_API */

#endif /* __LINUX_IOMMU_H */