aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuman Anna2019-02-26 22:01:57 -0600
committerSuman Anna2019-03-03 17:39:54 -0600
commitb8ee97c59fb1bfc68e4c4a9ea2eda91dd70ef830 (patch)
treeebb03ae0365c18de0d75b99033322b113a0c6535
parent4252fc9bc3522b508d3a74b12b8c9a0be1e3d13f (diff)
downloadremoteproc-b8ee97c59fb1bfc68e4c4a9ea2eda91dd70ef830.tar.gz
remoteproc-b8ee97c59fb1bfc68e4c4a9ea2eda91dd70ef830.tar.xz
remoteproc-b8ee97c59fb1bfc68e4c4a9ea2eda91dd70ef830.zip
iommu/omap: introduce new API for runtime suspend/resume control
This patch adds the support for the OMAP IOMMUs to be suspended during the auto suspend/resume of the OMAP remoteproc devices. The remote processors are auto suspended after a certain time of idle or inactivity period. This is done by introducing two new API, omap_iommu_domain_deactivate() and omap_iommu_domain_activate() to allow the client users/master devices of the IOMMU devices to deactivate & activate the IOMMU devices from their runtime suspend/resume operations. There is no API exposed by the IOMMU layer at present, and so these new API are added directly in the OMAP IOMMU driver to minimize framework changes. The API simply decrements and increments the runtime usage count of the IOMMU devices and let the context be saved/restored using the existing runtime pm callbacks. Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r--drivers/iommu/omap-iommu.c58
-rw-r--r--include/linux/omap-iommu.h15
2 files changed, 73 insertions, 0 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index eff76edded94..c69d86900520 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -943,6 +943,64 @@ static void omap_iommu_restore_tlb_entries(struct omap_iommu *obj)
943} 943}
944 944
945/** 945/**
946 * omap_iommu_domain_deactivate - deactivate attached iommu devices
947 * @domain: iommu domain attached to the target iommu device
948 *
949 * This API allows the client devices of IOMMU devices to suspend
950 * the IOMMUs they control at runtime, after they are idled and
951 * suspended all activity. System Suspend will leverage the PM
952 * driver late callbacks.
953 **/
954int omap_iommu_domain_deactivate(struct iommu_domain *domain)
955{
956 struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
957 struct omap_iommu_device *iommu;
958 struct omap_iommu *oiommu;
959 int i;
960
961 if (!omap_domain->dev)
962 return 0;
963
964 iommu = omap_domain->iommus;
965 iommu += (omap_domain->num_iommus - 1);
966 for (i = 0; i < omap_domain->num_iommus; i++, iommu--) {
967 oiommu = iommu->iommu_dev;
968 pm_runtime_put_sync(oiommu->dev);
969 }
970
971 return 0;
972}
973EXPORT_SYMBOL_GPL(omap_iommu_domain_deactivate);
974
975/**
976 * omap_iommu_domain_activate - activate attached iommu devices
977 * @domain: iommu domain attached to the target iommu device
978 *
979 * This API allows the client devices of IOMMU devices to resume the
980 * IOMMUs they control at runtime, before they can resume operations.
981 * System Resume will leverage the PM driver late callbacks.
982 **/
983int omap_iommu_domain_activate(struct iommu_domain *domain)
984{
985 struct omap_iommu_domain *omap_domain = to_omap_domain(domain);
986 struct omap_iommu_device *iommu;
987 struct omap_iommu *oiommu;
988 int i;
989
990 if (!omap_domain->dev)
991 return 0;
992
993 iommu = omap_domain->iommus;
994 for (i = 0; i < omap_domain->num_iommus; i++, iommu++) {
995 oiommu = iommu->iommu_dev;
996 pm_runtime_get_sync(oiommu->dev);
997 }
998
999 return 0;
1000}
1001EXPORT_SYMBOL_GPL(omap_iommu_domain_activate);
1002
1003/**
946 * omap_iommu_runtime_suspend - disable an iommu device 1004 * omap_iommu_runtime_suspend - disable an iommu device
947 * @dev: iommu device 1005 * @dev: iommu device
948 * 1006 *
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h
index ce1b7c6283ee..5b66325bc63c 100644
--- a/include/linux/omap-iommu.h
+++ b/include/linux/omap-iommu.h
@@ -13,12 +13,27 @@
13#ifndef _OMAP_IOMMU_H_ 13#ifndef _OMAP_IOMMU_H_
14#define _OMAP_IOMMU_H_ 14#define _OMAP_IOMMU_H_
15 15
16struct iommu_domain;
17
16#ifdef CONFIG_OMAP_IOMMU 18#ifdef CONFIG_OMAP_IOMMU
17extern void omap_iommu_save_ctx(struct device *dev); 19extern void omap_iommu_save_ctx(struct device *dev);
18extern void omap_iommu_restore_ctx(struct device *dev); 20extern void omap_iommu_restore_ctx(struct device *dev);
21
22int omap_iommu_domain_deactivate(struct iommu_domain *domain);
23int omap_iommu_domain_activate(struct iommu_domain *domain);
19#else 24#else
20static inline void omap_iommu_save_ctx(struct device *dev) {} 25static inline void omap_iommu_save_ctx(struct device *dev) {}
21static inline void omap_iommu_restore_ctx(struct device *dev) {} 26static inline void omap_iommu_restore_ctx(struct device *dev) {}
27
28static inline int omap_iommu_domain_deactivate(struct iommu_domain *domain)
29{
30 return -ENOTSUP;
31}
32
33static inline int omap_iommu_domain_activate(struct iommu_domain *domain)
34{
35 return -ENOTSUP;
36}
22#endif 37#endif
23 38
24#endif 39#endif