From: Markus Schneider-Pargmann <msp@baylibre.com>
To: Nishanth Menon <nm@ti.com>, Tero Kristo <kristo@kernel.org>,
Santosh Shilimkar <ssantosh@kernel.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Vibhore Vardhan <vibhore@ti.com>,
Kevin Hilman <khilman@baylibre.com>, Dhruva Gole <d-gole@ti.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Markus Schneider-Pargmann <msp@baylibre.com>
Subject: [PATCH v12 5/5] firmware: ti_sci: add CPU latency constraint management
Date: Wed, 4 Sep 2024 21:42:29 +0200 [thread overview]
Message-ID: <20240904194229.109886-6-msp@baylibre.com> (raw)
In-Reply-To: <20240904194229.109886-1-msp@baylibre.com>
From: Kevin Hilman <khilman@baylibre.com>
During system-wide suspend, check if any of the CPUs have PM QoS
resume latency constraints set. If so, set TI SCI constraint.
TI SCI has a single system-wide latency constraint, so use the max of
any of the CPU latencies as the system-wide value.
Note: DM firmware clears all constraints at resume time, so
constraints need to be checked/updated/sent at each system suspend.
Co-developed-by: Vibhore Vardhan <vibhore@ti.com>
Signed-off-by: Vibhore Vardhan <vibhore@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
drivers/firmware/ti_sci.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index e0018d3e2df8..be02a923f7c6 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/bitmap.h>
+#include <linux/cpu.h>
#include <linux/debugfs.h>
#include <linux/export.h>
#include <linux/io.h>
@@ -19,6 +20,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/pm_qos.h>
#include <linux/property.h>
#include <linux/semaphore.h>
#include <linux/slab.h>
@@ -3668,7 +3670,27 @@ static int ti_sci_prepare_system_suspend(struct ti_sci_info *info)
static int __maybe_unused ti_sci_suspend(struct device *dev)
{
struct ti_sci_info *info = dev_get_drvdata(dev);
- int ret;
+ struct device *cpu_dev, *cpu_dev_max = NULL;
+ s32 val, cpu_lat = 0;
+ int i, ret;
+
+ if (info->fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED) {
+ for_each_possible_cpu(i) {
+ cpu_dev = get_cpu_device(i);
+ val = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_RESUME_LATENCY);
+ if (val != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) {
+ cpu_lat = max(cpu_lat, val);
+ cpu_dev_max = cpu_dev;
+ }
+ }
+ if (cpu_dev_max) {
+ dev_dbg(cpu_dev_max, "%s: sending max CPU latency=%u\n", __func__, cpu_lat);
+ ret = ti_sci_cmd_set_latency_constraint(&info->handle,
+ cpu_lat, TISCI_MSG_CONSTRAINT_SET);
+ if (ret)
+ return ret;
+ }
+ }
ret = ti_sci_prepare_system_suspend(info);
if (ret)
--
2.45.2
next prev parent reply other threads:[~2024-09-04 19:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 19:42 [PATCH v12 0/5] firmware: ti_sci: Introduce system suspend support Markus Schneider-Pargmann
2024-09-04 19:42 ` [PATCH v12 1/5] PM: QoS: Export dev_pm_qos_read_value Markus Schneider-Pargmann
2024-09-05 6:26 ` Dhruva Gole
2024-09-10 23:51 ` Kevin Hilman
2024-09-04 19:42 ` [PATCH v12 2/5] firmware: ti_sci: Add support for querying the firmware caps Markus Schneider-Pargmann
2024-09-04 19:42 ` [PATCH v12 3/5] firmware: ti_sci: Add system suspend and resume call Markus Schneider-Pargmann
2024-09-17 11:12 ` Kamlesh Gurudasani
2024-09-04 19:42 ` [PATCH v12 4/5] firmware: ti_sci: Introduce Power Management Ops Markus Schneider-Pargmann
2024-09-04 19:42 ` Markus Schneider-Pargmann [this message]
2024-09-06 16:01 ` [PATCH v12 0/5] firmware: ti_sci: Introduce system suspend support Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240904194229.109886-6-msp@baylibre.com \
--to=msp@baylibre.com \
--cc=d-gole@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@baylibre.com \
--cc=kristo@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=ssantosh@kernel.org \
--cc=vibhore@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®