summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2015-12-14 16:04:46 -0800
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-20 19:23:57 -0700
commitfc72f2237909081f1953b5363d4b7258b14ebce5 (patch)
treef069bc4ede293c2559da30f7ffc8aea0557f53cd
parent19c21eee9ed01fe95973777a62876a17d5d34cd3 (diff)
iommu: Add {enable,disable}_config_clocks ops
There are certain use cases where it might be necessary to leave the IOMMU's configuration clocks on. This might happen in places where an IOMMU's clocks might not be known. A good example of this would be a test library that needs to be able to do TLB invalidation from atomic context. It would need to enable clocks up front (outside of atomic context) and leave them on for the duration of the test. Add some ops for enabling and disabling configuration clocks. CRs-Fixed: 997751 Change-Id: I95056952f60494fe5745f2183f9af8aab3a40315 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
-rw-r--r--include/linux/iommu.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index a41f34188840..7b6ea78f1667 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -174,6 +174,8 @@ struct iommu_dm_region {
* @reg_read: read an IOMMU register
* @reg_write: write an IOMMU register
* @tlbi_domain: Invalidate all TLBs covering an iommu domain
+ * @enable_config_clocks: Enable all config clocks for this domain's IOMMU
+ * @disable_config_clocks: Disable all config clocks for this domain's IOMMU
* @priv: per-instance data private to the iommu driver
*/
struct iommu_ops {
@@ -222,6 +224,8 @@ struct iommu_ops {
void (*reg_write)(struct iommu_domain *domain, unsigned long val,
unsigned long offset);
void (*tlbi_domain)(struct iommu_domain *domain);
+ int (*enable_config_clocks)(struct iommu_domain *domain);
+ void (*disable_config_clocks)(struct iommu_domain *domain);
#ifdef CONFIG_OF_IOMMU
int (*of_xlate)(struct device *dev, struct of_phandle_args *args);
@@ -390,6 +394,19 @@ static inline void iommu_tlbiall(struct iommu_domain *domain)
domain->ops->tlbi_domain(domain);
}
+static inline int iommu_enable_config_clocks(struct iommu_domain *domain)
+{
+ if (domain->ops->enable_config_clocks)
+ return domain->ops->enable_config_clocks(domain);
+ return 0;
+}
+
+static inline void iommu_disable_config_clocks(struct iommu_domain *domain)
+{
+ if (domain->ops->disable_config_clocks)
+ domain->ops->disable_config_clocks(domain);
+}
+
#else /* CONFIG_IOMMU_API */
struct iommu_ops {};
@@ -638,6 +655,15 @@ static inline void iommu_tlbiall(struct iommu_domain *domain)
{
}
+static inline int iommu_enable_config_clocks(struct iommu_domain *domain)
+{
+ return 0;
+}
+
+static inline void iommu_disable_config_clocks(struct iommu_domain *domain)
+{
+}
+
#endif /* CONFIG_IOMMU_API */
#endif /* __LINUX_IOMMU_H */