]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Feb 2024 10:37:24 +0000 (11:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Feb 2024 10:37:24 +0000 (11:37 +0100)
added patches:
drm-msm-dsi-enable-runtime-pm.patch
pm-runtime-add-devm_pm_runtime_enable-helper.patch
pm-runtime-have-devm_pm_runtime_enable-handle-pm_runtime_dont_use_autosuspend.patch

queue-5.4/drm-msm-dsi-enable-runtime-pm.patch [new file with mode: 0644]
queue-5.4/pm-runtime-add-devm_pm_runtime_enable-helper.patch [new file with mode: 0644]
queue-5.4/pm-runtime-have-devm_pm_runtime_enable-handle-pm_runtime_dont_use_autosuspend.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/drm-msm-dsi-enable-runtime-pm.patch b/queue-5.4/drm-msm-dsi-enable-runtime-pm.patch
new file mode 100644 (file)
index 0000000..14a73c0
--- /dev/null
@@ -0,0 +1,39 @@
+From stable+bounces-16411-greg=kroah.com@vger.kernel.org Mon Jan 29 11:39:25 2024
+From: Amit Pundir <amit.pundir@linaro.org>
+Date: Mon, 29 Jan 2024 16:09:02 +0530
+Subject: drm/msm/dsi: Enable runtime PM
+To: Greg KH <gregkh@linuxfoundation.org>, Stable <stable@vger.kernel.org>, Sasha Levin <sashal@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, Douglas Anderson <dianders@chromium.org>
+Message-ID: <20240129103902.3239531-4-amit.pundir@linaro.org>
+
+From: Konrad Dybcio <konrad.dybcio@linaro.org>
+
+[ Upstream commit 6ab502bc1cf3147ea1d8540d04b83a7a4cb6d1f1 ]
+
+Some devices power the DSI PHY/PLL through a power rail that we model
+as a GENPD. Enable runtime PM to make it suspendable.
+
+Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/543352/
+Link: https://lore.kernel.org/r/20230620-topic-dsiphy_rpm-v2-2-a11a751f34f0@linaro.org
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Stable-dep-of: 3d07a411b4fa ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks")
+Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
++++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+@@ -606,6 +606,10 @@ static int dsi_phy_driver_probe(struct p
+                       goto fail;
+       }
++      ret = devm_pm_runtime_enable(&pdev->dev);
++      if (ret)
++              return ret;
++
+       /* PLL init will call into clk_register which requires
+        * register access, so we need to enable power and ahb clock.
+        */
diff --git a/queue-5.4/pm-runtime-add-devm_pm_runtime_enable-helper.patch b/queue-5.4/pm-runtime-add-devm_pm_runtime_enable-helper.patch
new file mode 100644 (file)
index 0000000..6b80ffd
--- /dev/null
@@ -0,0 +1,80 @@
+From stable+bounces-16409-greg=kroah.com@vger.kernel.org Mon Jan 29 11:39:17 2024
+From: Amit Pundir <amit.pundir@linaro.org>
+Date: Mon, 29 Jan 2024 16:09:00 +0530
+Subject: PM: runtime: add devm_pm_runtime_enable helper
+To: Greg KH <gregkh@linuxfoundation.org>, Stable <stable@vger.kernel.org>, Sasha Levin <sashal@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, Douglas Anderson <dianders@chromium.org>
+Cc: "Rafael J . Wysocki" <rafael@kernel.org>, Stephen Boyd <sboyd@kernel.org>
+Message-ID: <20240129103902.3239531-2-amit.pundir@linaro.org>
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+[ Upstream commit b3636a3a2c51715736d3ec45f635ed03191962ce ]
+
+A typical code pattern for pm_runtime_enable() call is to call it in the
+_probe function and to call pm_runtime_disable() both from _probe error
+path and from _remove function. For some drivers the whole remove
+function would consist of the call to pm_remove_disable().
+
+Add helper function to replace this bolierplate piece of code. Calling
+devm_pm_runtime_enable() removes the need for calling
+pm_runtime_disable() both in the probe()'s error path and in the
+remove() function.
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Link: https://lore.kernel.org/r/20210731195034.979084-2-dmitry.baryshkov@linaro.org
+Acked-by: Rafael J. Wysocki <rafael@kernel.org>
+Signed-off-by: Stephen Boyd <sboyd@kernel.org>
+Stable-dep-of: 3d07a411b4fa ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks")
+Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/base/power/runtime.c |   17 +++++++++++++++++
+ include/linux/pm_runtime.h   |    4 ++++
+ 2 files changed, 21 insertions(+)
+
+--- a/drivers/base/power/runtime.c
++++ b/drivers/base/power/runtime.c
+@@ -1461,6 +1461,23 @@ void pm_runtime_enable(struct device *de
+ }
+ EXPORT_SYMBOL_GPL(pm_runtime_enable);
++static void pm_runtime_disable_action(void *data)
++{
++      pm_runtime_disable(data);
++}
++
++/**
++ * devm_pm_runtime_enable - devres-enabled version of pm_runtime_enable.
++ * @dev: Device to handle.
++ */
++int devm_pm_runtime_enable(struct device *dev)
++{
++      pm_runtime_enable(dev);
++
++      return devm_add_action_or_reset(dev, pm_runtime_disable_action, dev);
++}
++EXPORT_SYMBOL_GPL(devm_pm_runtime_enable);
++
+ /**
+  * pm_runtime_forbid - Block runtime PM of a device.
+  * @dev: Device to handle.
+--- a/include/linux/pm_runtime.h
++++ b/include/linux/pm_runtime.h
+@@ -64,6 +64,8 @@ static inline int pm_runtime_get_if_in_u
+       return pm_runtime_get_if_active(dev, false);
+ }
++extern int devm_pm_runtime_enable(struct device *dev);
++
+ static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
+ {
+       dev->power.ignore_children = enable;
+@@ -160,6 +162,8 @@ static inline void __pm_runtime_disable(
+ static inline void pm_runtime_allow(struct device *dev) {}
+ static inline void pm_runtime_forbid(struct device *dev) {}
++static inline int devm_pm_runtime_enable(struct device *dev) { return 0; }
++
+ static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {}
+ static inline void pm_runtime_get_noresume(struct device *dev) {}
+ static inline void pm_runtime_put_noidle(struct device *dev) {}
diff --git a/queue-5.4/pm-runtime-have-devm_pm_runtime_enable-handle-pm_runtime_dont_use_autosuspend.patch b/queue-5.4/pm-runtime-have-devm_pm_runtime_enable-handle-pm_runtime_dont_use_autosuspend.patch
new file mode 100644 (file)
index 0000000..1dd5ef9
--- /dev/null
@@ -0,0 +1,75 @@
+From stable+bounces-16410-greg=kroah.com@vger.kernel.org Mon Jan 29 11:39:17 2024
+From: Amit Pundir <amit.pundir@linaro.org>
+Date: Mon, 29 Jan 2024 16:09:01 +0530
+Subject: PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend()
+To: Greg KH <gregkh@linuxfoundation.org>, Stable <stable@vger.kernel.org>, Sasha Levin <sashal@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, Douglas Anderson <dianders@chromium.org>
+Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Ulf Hansson <ulf.hansson@linaro.org>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
+Message-ID: <20240129103902.3239531-3-amit.pundir@linaro.org>
+
+From: Douglas Anderson <dianders@chromium.org>
+
+[ Upstream commit b4060db9251f919506e4d672737c6b8ab9a84701 ]
+
+The PM Runtime docs say:
+
+  Drivers in ->remove() callback should undo the runtime PM changes done
+  in ->probe(). Usually this means calling pm_runtime_disable(),
+  pm_runtime_dont_use_autosuspend() etc.
+
+>From grepping code, it's clear that many people aren't aware of the
+need to call pm_runtime_dont_use_autosuspend().
+
+When brainstorming solutions, one idea that came up was to leverage
+the new-ish devm_pm_runtime_enable() function. The idea here is that:
+
+ * When the devm action is called we know that the driver is being
+   removed. It's the perfect time to undo the use_autosuspend.
+
+ * The code of pm_runtime_dont_use_autosuspend() already handles the
+   case of being called when autosuspend wasn't enabled.
+
+Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Douglas Anderson <dianders@chromium.org>
+Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Stable-dep-of: 3d07a411b4fa ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks")
+Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/base/power/runtime.c |    5 +++++
+ include/linux/pm_runtime.h   |    5 +++++
+ 2 files changed, 10 insertions(+)
+
+--- a/drivers/base/power/runtime.c
++++ b/drivers/base/power/runtime.c
+@@ -1463,11 +1463,16 @@ EXPORT_SYMBOL_GPL(pm_runtime_enable);
+ static void pm_runtime_disable_action(void *data)
+ {
++      pm_runtime_dont_use_autosuspend(data);
+       pm_runtime_disable(data);
+ }
+ /**
+  * devm_pm_runtime_enable - devres-enabled version of pm_runtime_enable.
++ *
++ * NOTE: this will also handle calling pm_runtime_dont_use_autosuspend() for
++ * you at driver exit time if needed.
++ *
+  * @dev: Device to handle.
+  */
+ int devm_pm_runtime_enable(struct device *dev)
+--- a/include/linux/pm_runtime.h
++++ b/include/linux/pm_runtime.h
+@@ -300,6 +300,11 @@ static inline void pm_runtime_disable(st
+       __pm_runtime_disable(dev, true);
+ }
++/**
++ * NOTE: It's important to undo this with pm_runtime_dont_use_autosuspend()
++ * at driver exit time unless your driver initially enabled pm_runtime
++ * with devm_pm_runtime_enable() (which handles it for you).
++ */
+ static inline void pm_runtime_use_autosuspend(struct device *dev)
+ {
+       __pm_runtime_use_autosuspend(dev, true);
index 884ffc2f8c08c8275013a5ea19c2d85e65734553..951ef65cf7631ed1dc12a97e56eb935fe965924b 100644 (file)
@@ -254,6 +254,8 @@ netfilter-ipset-fix-performance-regression-in-swap-operation.patch
 netfilter-ipset-missing-gc-cancellations-fixed.patch
 net-prevent-mss-overflow-in-skb_segment.patch
 sched-membarrier-reduce-the-ability-to-hammer-on-sys_membarrier.patch
-mm-memcontrol-decouple-reference-counting-from-page-accounting.patch
 nilfs2-fix-potential-bug-in-end_buffer_async_write.patch
 nilfs2-replace-warn_ons-for-invalid-dat-metadata-block-requests.patch
+pm-runtime-add-devm_pm_runtime_enable-helper.patch
+pm-runtime-have-devm_pm_runtime_enable-handle-pm_runtime_dont_use_autosuspend.patch
+drm-msm-dsi-enable-runtime-pm.patch