All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v16 0/5] iommu/arm-smmu: Add runtime pm/sleep support
@ 2018-08-30 14:45 ` Vivek Gautam
  0 siblings, 0 replies; 77+ messages in thread
From: Vivek Gautam @ 2018-08-30 14:45 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	robin.murphy-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: mark.rutland-5wv7dgnIgG8, architt-sgV2jX0FEOL9JmXXK+q4OQ,
	jcrouse-sgV2jX0FEOL9JmXXK+q4OQ, linux-pm-u79uwXL29TY76Z2rM5mHXA,
	sboyd-DgEjT+Ai2ygdnm+yROfE0A, sricharan-sgV2jX0FEOL9JmXXK+q4OQ,
	rjw-LthD3rsA81gm4RdzfppkhA, robdclark-Re5JQEeQqe8AvxtiuMwx3w,
	tfiga-F7+t8E8rja9g9hUCZPvPmw,
	alex.williamson-H+wXaHxf7aLQT0dZR+AlfA, Vivek Gautam,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ

This series provides the support for turning on the arm-smmu's
clocks/power domains using runtime pm. This is done using
device links between smmu and client devices. The device link
framework keeps the two devices in correct order for power-cycling
across runtime PM or across system-wide PM.

With addition of a new device link flag DL_FLAG_AUTOREMOVE_SUPPLIER [7],
the device links created between arm-smmu and its clients will be
automatically purged when arm-smmu driver unbinds from its device.

As not all implementations support clock/power gating, we are checking
for a valid 'smmu->dev's pm_domain' to conditionally enable the runtime
power management for such smmu implementations that can support it.
Otherwise, the clocks are turned to be always on in .probe until .remove.
With conditional runtime pm now, we avoid touching dev->power.lock
in fastpaths for smmu implementations that don't need to do anything
useful with pm_runtime.
This lets us to use the much-argued pm_runtime_get_sync/put_sync()
calls in map/unmap callbacks so that the clients do not have to
worry about handling any of the arm-smmu's power.

This series also adds support for Qcom's arm-smmu-v2 variant that
has different clocks and power requirements.

Previous version of this patch series is @ [1].

Build tested the series based on 4.19-rc1.

[v16] 
   * Addressed review comments from Rob about soc specific compatibles.
   * Removed pm_runtime_get/put calls from arm_smmu_device_probe(), as
     doing a runtime_get() eventually calls arm_smmu_device_reset().
     arm_smmu_device_reset() should be called only after
     arm_smmu_device_cfg_probe().
     Enabling the clocks by default in the probe, and using
     pm_runtime_set_active() as suggested by Tomasz to disable the
     clocks when pm_runtime is enabled.

[v15]
   * Added a list of valid values of '<soc>' in "qcom,<soc>-smmu-v2"
     compatible string as pointed out by Robin, and Rob in the thread [8]:
   * Added Srini's Tested-by.
   * Separated out the dt-bindings change from driver change into a new
     patch as suggested by new checkpatch warning.

     Rob, I took the liberty of removing your Reviewed-by (for your
     comment on '<soc>') for the new dt-bindings patch 4/5.
     Please feel free to review it again. Thanks!

[v14]
   * Moved arm_smmu_device_reset() from arm_smmu_pm_resume() to
     arm_smmu_runtime_resume() so that the pm_resume callback calls
     only runtime_resume to resume the device.
     This should take care of restoring the state of smmu in systems
     in which smmu lose register state on power-domain collapse.

[v13]
   Addressing Rafael's comments:
   * Added .suspend pm callback to disable the clocks in system wide suspend.
   * Added corresponding clock enable in .resume pm callback.
   * Explicitly enabling/disabling the clocks now when runtime PM is disabled.
   * device_link_add() doesn't depend on pm_runtime_enabled() as we can
     use device links across system suspend/resume too.

   Addressing Robin's comments:
   * Making device_link_add failures as non-fatal.

   * Removed IOMMU_OF_DECLARE() declaration as we don't need this after Rob's
     patch that removed all of these declarations.

[v12]
   * Use new device link's flag introduced in [7] -
     DL_FLAG_AUTOREMOVE_SUPPLIER. With this devices links are automatically
     purged when arm-smmu driver unbinds.
   * Using pm_runtime_force_suspend() instead of pm_runtime_disable() to
     avoid following warning from arm_smmu_device_remove()

     [295711.537507] ------------[ cut here ]------------
     [295711.544226] Unpreparing enabled smmu_mdp_ahb_clk
     [295711.549099] WARNING: CPU: 0 PID: 1 at ../drivers/clk/clk.c:697
                     clk_core_unprepare+0xd8/0xe0
     ...
     [295711.674073] Call trace:
     [295711.679454]  clk_core_unprepare+0xd8/0xe0
     [295711.682059]  clk_unprepare+0x28/0x40
     [295711.685964]  clk_bulk_unprepare+0x28/0x40
     [295711.689701]  arm_smmu_device_remove+0x88/0xd8
     [295711.693692]  arm_smmu_device_shutdown+0xc/0x18
     [295711.698120]  platform_drv_shutdown+0x20/0x30

[v11]
   * Some more cleanups for device link. We don't need an explicit
     delete for device link from the driver, but just set the flag
     DL_FLAG_AUTOREMOVE.
     device_link_add() API description says -
     "If the DL_FLAG_AUTOREMOVE is set, the link will be removed
     automatically when the consumer device driver unbinds."
   * Addressed the comments for 'smmu' in arm_smmu_map/unmap().
   * Dropped the patch [6] that introduced device_link_del_dev() API. 

[v10]
   * Introduce device_link_del_dev() API to delete the link between
     given consumer and supplier devices. The users of device link
     do not need to store link pointer to delete the link later.
     They can straightaway use this API by passing consumer and
     supplier devices.
   * Made corresponding changes to arm-smmu driver patch handling the
     device links.
   * Dropped the patch [5] that was adding device_link_find() API to
     device core layer. device_link_del_dev() serves the purpose to
     directly delete the link between two given devices.

[v9]
   * Removed 'rpm_supported' flag, instead checking on pm_domain
     to enable runtime pm.
   * Creating device link only when the runtime pm is enabled, as we
     don't need a device link besides managing the power dependency
     between supplier and consumer devices.
   * Introducing a patch to add device_link_find() API that finds
     and existing link between supplier and consumer devices.
     Also, made necessary change to device_link_add() to use this API.
   * arm_smmu_remove_device() now uses this device_link_find() to find
     the device link between smmu device and the master device, and then
     delete this link.
   * Dropped the destroy_domain_context() fix [4] as it was rather,
     introducing catastrophically bad problem by destroying
     'good dev's domain context.
   * Added 'Reviwed-by' tag for Tomasz's review.

[v8]
   * Major change -
     - Added a flag 'rpm_supported' which each platform that supports
       runtime pm, can enable, and we enable runtime_pm over arm-smmu
       only when this flag is set.
     - Adding the conditional pm_runtime_get/put() calls to .map, .unmap
       and .attach_dev ops.
     - Dropped the patch [2] that exported pm_runtim_get/put_suupliers(),
       and also dropped the user driver patch [3] for these APIs.

   * Clock code further cleanup
     - doing only clk_bulk_enable() and clk_bulk_disable() in runtime pm
       callbacks. We shouldn't be taking a slow path (clk_prepare/unprepare())
       from these runtime pm callbacks. Thereby, moved clk_bulk_prepare() to
       arm_smmu_device_probe(), and clk_bulk_unprepare() to
       arm_smmu_device_remove().
     - clk data filling to a common method arm_smmu_fill_clk_data() that
       fills the clock ids and number of clocks.

   * Addressed other nits and comments
     - device_link_add() error path fixed.
     - Fix for checking negative error value from pm_runtime_get_sync().
     - Documentation redo.

   * Added another patch fixing the error path in arm_smmu_attach_dev()
     to destroy allocated domain context.

** Change logs for previous versions is available in previous series [9].

[1] https://patchwork.kernel.org/cover/10576921/
[2] https://patchwork.kernel.org/patch/10204945/
[3] https://patchwork.kernel.org/patch/10204925/
[4] https://patchwork.kernel.org/patch/10254105/
[5] https://patchwork.kernel.org/patch/10277975/
[6] https://patchwork.kernel.org/patch/10281613/
[7] https://patchwork.kernel.org/patch/10491481/
[8] https://lore.kernel.org/patchwork/patch/974116/
[9] https://lkml.org/lkml/2018/7/8/124

Sricharan R (3):
  iommu/arm-smmu: Add pm_runtime/sleep ops
  iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device
  iommu/arm-smmu: Add the device_link between masters and smmu

Vivek Gautam (2):
  dt-bindings: arm-smmu: Add bindings for qcom,smmu-v2
  iommu/arm-smmu: Add support for qcom,smmu-v2 variant

 .../devicetree/bindings/iommu/arm,smmu.txt         |  39 +++++
 drivers/iommu/arm-smmu.c                           | 180 +++++++++++++++++++--
 2 files changed, 209 insertions(+), 10 deletions(-)

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply	[flat|nested] 77+ messages in thread

end of thread, other threads:[~2018-10-02  7:13 UTC | newest]

Thread overview: 77+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30 14:45 [PATCH v16 0/5] iommu/arm-smmu: Add runtime pm/sleep support Vivek Gautam
2018-08-30 14:45 ` Vivek Gautam
     [not found] ` <20180830144541.17740-1-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-30 14:45   ` [PATCH v16 1/5] iommu/arm-smmu: Add pm_runtime/sleep ops Vivek Gautam
2018-08-30 14:45     ` Vivek Gautam
     [not found]     ` <20180830144541.17740-2-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-26 15:27       ` Robin Murphy
2018-09-26 15:27         ` Robin Murphy
     [not found]         ` <1a918f99-83b0-2f51-7634-126639a220de-5wv7dgnIgG8@public.gmane.org>
2018-09-27  8:31           ` Vivek Gautam
2018-09-27  8:31             ` Vivek Gautam
2018-09-28 11:59     ` Ulf Hansson
2018-10-01  5:49       ` Vivek Gautam
2018-10-01  5:49         ` Vivek Gautam
     [not found]         ` <CAFp+6iHZysBmMZj+pZghPocEwDzU7KfR1gLQAQRBui+-gdiSTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-01  9:38           ` Ulf Hansson
2018-10-01  9:38             ` Ulf Hansson
     [not found]             ` <CAPDyKFrCWaeDLbmbrRb23V_mRk8doBjM3u2X9tm0XNXm=-n5vA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-01 10:21               ` Vivek Gautam
2018-10-01 10:21                 ` Vivek Gautam
2018-10-01 10:32           ` Vivek Gautam
2018-10-01 10:32             ` Vivek Gautam
     [not found]             ` <CAFp+6iFJbQZ1MrNWD6g+GNp9TOMXuq0oDdzQ9XUMTmY67tNgWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-01 12:02               ` Ulf Hansson
2018-10-01 12:02                 ` Ulf Hansson
2018-08-30 14:45   ` [PATCH v16 2/5] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device Vivek Gautam
2018-08-30 14:45     ` Vivek Gautam
     [not found]     ` <20180830144541.17740-3-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-07  9:16       ` Tomasz Figa
2018-09-07  9:16         ` Tomasz Figa
     [not found]         ` <CAAFQd5B7YR03Jm1upOg2nsaKOb1iDD7-WGo-qx7S8m-nounCvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-07  9:38           ` Vivek Gautam
2018-09-07  9:38             ` Vivek Gautam
2018-09-07  9:52             ` Tomasz Figa
2018-09-07  9:52               ` Tomasz Figa
     [not found]               ` <CAAFQd5DMDWEeBU=fg6arye3pXnrCqOA4tDtMSGutXk7vSz-EtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-07 10:22                 ` Vivek Gautam
2018-09-07 10:22                   ` Vivek Gautam
     [not found]                   ` <CAFp+6iE3+qn6-gpXEzxfoP5yPMARmUcJNn0AZk-kA2AreTLnng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-18  3:11                     ` Vivek Gautam
2018-09-18  3:11                       ` Vivek Gautam
     [not found]                       ` <CAFp+6iHnHj_PkPFBUSTdJTW57K51wLqSEw6VOMKxAVo7O+ms9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-25  5:56                         ` Vivek Gautam
2018-09-25  5:56                           ` Vivek Gautam
     [not found]                           ` <CAFp+6iFvhdSq7upbvsEWgMewhAaaRM91iw9p7qOFPYrUxis0Hg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-25 18:55                             ` Robin Murphy
2018-09-25 18:55                               ` Robin Murphy
     [not found]                               ` <aedf3f32-68ae-566a-3735-ca4ec5c7559a-5wv7dgnIgG8@public.gmane.org>
2018-09-26  6:22                                 ` Vivek Gautam
2018-09-26  6:22                                   ` Vivek Gautam
2018-09-26 15:42       ` Robin Murphy
2018-09-26 15:42         ` Robin Murphy
2018-10-01 12:58       ` Will Deacon
2018-10-01 12:58         ` Will Deacon
     [not found]         ` <20181001125854.GB31488-5wv7dgnIgG8@public.gmane.org>
2018-10-02  4:14           ` Vivek Gautam
2018-10-02  4:14             ` Vivek Gautam
     [not found]             ` <CAFp+6iGkudBtZFfk4ST+k9OMRSGgU=pzVGC4QaSmPb+Xkdp3Xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-02  5:28               ` Vivek Gautam
2018-10-02  5:28                 ` Vivek Gautam
     [not found]                 ` <CAFp+6iFpm05Uu8HkYCC+O+gYwFwvxirc6=e6oOed+ZJk6QLDPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-02  7:12                   ` [PATCH v17 " Vivek Gautam
2018-10-02  7:12                     ` Vivek Gautam
2018-10-02  7:12                     ` Vivek Gautam
2018-08-30 14:45   ` [PATCH v16 3/5] iommu/arm-smmu: Add the device_link between masters and smmu Vivek Gautam
2018-08-30 14:45     ` Vivek Gautam
     [not found]     ` <20180830144541.17740-4-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-26 15:44       ` Robin Murphy
2018-09-26 15:44         ` Robin Murphy
2018-08-30 14:45   ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom, smmu-v2 Vivek Gautam
2018-08-30 14:45     ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom,smmu-v2 Vivek Gautam
     [not found]     ` <20180830144541.17740-5-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-06  3:52       ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom, smmu-v2 Vivek Gautam
2018-09-06  3:52         ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom,smmu-v2 Vivek Gautam
2018-09-10 18:02       ` Rob Herring
2018-09-10 18:02         ` Rob Herring
2018-09-11  8:34         ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom, smmu-v2 Vivek Gautam
2018-09-11  8:34           ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom,smmu-v2 Vivek Gautam
2018-09-26 15:46       ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom, smmu-v2 Robin Murphy
2018-09-26 15:46         ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom,smmu-v2 Robin Murphy
2018-10-01 12:18       ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom, smmu-v2 Will Deacon
2018-10-01 12:18         ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom,smmu-v2 Will Deacon
2018-10-01 17:36         ` Rob Herring
     [not found]           ` <CAL_Jsq+dSGXCiWsjLt00wu=s-ZW8M1pkQqKFWboc54M8gHFTYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-10-01 17:45             ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom, smmu-v2 Will Deacon
2018-10-01 17:45               ` [PATCH v16 4/5] dt-bindings: arm-smmu: Add bindings for qcom,smmu-v2 Will Deacon
2018-08-30 14:45   ` [PATCH v16 5/5] iommu/arm-smmu: Add support for qcom, smmu-v2 variant Vivek Gautam
2018-08-30 14:45     ` [PATCH v16 5/5] iommu/arm-smmu: Add support for qcom,smmu-v2 variant Vivek Gautam
     [not found]     ` <20180830144541.17740-6-vivek.gautam-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-26 15:59       ` [PATCH v16 5/5] iommu/arm-smmu: Add support for qcom, smmu-v2 variant Robin Murphy
2018-09-26 15:59         ` [PATCH v16 5/5] iommu/arm-smmu: Add support for qcom,smmu-v2 variant Robin Murphy
2018-09-27  6:55         ` Vivek Gautam
2018-09-27  6:55           ` Vivek Gautam
2018-09-28 13:57   ` [PATCH v16 0/5] iommu/arm-smmu: Add runtime pm/sleep support Will Deacon
2018-09-28 13:57     ` Will Deacon
2018-10-01  9:06     ` Vivek Gautam
2018-10-01  9:06       ` Vivek Gautam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.