From: Matt Redfearn <matt.redfearn@mips.com>
To: Ralf Baechle <ralf@linux-mips.org>, <jhogan@kernel.org>
Cc: <linux-mips@linux-mips.org>,
Matt Redfearn <matt.redfearn@mips.com>,
Dengcheng Zhu <dengcheng.zhu@mips.com>,
<linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Paul Burton <paul.burton@mips.com>,
Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 2/2] MIPS: pm-cps: Warn if JTAG presence will block power gating
Date: Fri, 15 Dec 2017 09:34:54 +0000 [thread overview]
Message-ID: <1513330494-21249-2-git-send-email-matt.redfearn@mips.com> (raw)
In-Reply-To: <1513330494-21249-1-git-send-email-matt.redfearn@mips.com>
If a JTAG probe is connected to a MIPS cluster, then the CPC detects it
and latches the CPC.STAT_CONF.EJTAG_PROBE bit to 1. While set,
attempting to send a power-down command to a core will be blocked, and
the CPC will instead send the core to clock-off state. This can
interfere with systems fully entering a low power state where all cores,
CM, GIC, etc are powered down.
Detect that a JTAG probe is / has been connected to the cluster and emit
a warning that the attempted power down will fail, to aid debugging
system suspend where it is not currently obvious that a core has not
really powered down and will block a full power down of the cluster. We
use a ratelimited pr_warn since this path will also be hit by cpu idle
if it attempts to put cores into the powered down state.
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
---
arch/mips/kernel/pm-cps.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index 421e06dfee72..45776613a5be 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -11,6 +11,7 @@
#include <linux/cpuhotplug.h>
#include <linux/init.h>
#include <linux/percpu.h>
+#include <linux/ratelimit.h>
#include <linux/slab.h>
#include <asm/asm-offsets.h>
@@ -143,6 +144,18 @@ int cps_pm_enter_state(enum cps_pm_state state)
/* Setup the VPE to run mips_cps_pm_restore when started again */
if (IS_ENABLED(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
+ unsigned int stat = read_cpc_cl_stat_conf();
+
+ if (stat & CPC_Cx_STAT_CONF_EJTAG_PROBE) {
+ /*
+ * If we're attempting to gate power to the core, the
+ * JTAG detect bit indicates that the CPC will instead
+ * put the core into clock-off state. Emit a warning.
+ */
+ pr_warn_ratelimited("JTAG probe present - core%d will clock off instead of powering down\n",
+ core);
+ }
+
/* Power gating relies upon CPS SMP */
if (!mips_cps_smp_in_use())
return -EINVAL;
--
2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Matt Redfearn <matt.redfearn@mips.com>
To: Ralf Baechle <ralf@linux-mips.org>, jhogan@kernel.org
Cc: linux-mips@linux-mips.org, Matt Redfearn <matt.redfearn@mips.com>,
Dengcheng Zhu <dengcheng.zhu@mips.com>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Paul Burton <paul.burton@mips.com>,
Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 2/2] MIPS: pm-cps: Warn if JTAG presence will block power gating
Date: Fri, 15 Dec 2017 09:34:54 +0000 [thread overview]
Message-ID: <1513330494-21249-2-git-send-email-matt.redfearn@mips.com> (raw)
Message-ID: <20171215093454.VP1gCDJP878vjTe9_JFWMa3P23G1aD4eGwlPeOaqfb8@z> (raw)
In-Reply-To: <1513330494-21249-1-git-send-email-matt.redfearn@mips.com>
If a JTAG probe is connected to a MIPS cluster, then the CPC detects it
and latches the CPC.STAT_CONF.EJTAG_PROBE bit to 1. While set,
attempting to send a power-down command to a core will be blocked, and
the CPC will instead send the core to clock-off state. This can
interfere with systems fully entering a low power state where all cores,
CM, GIC, etc are powered down.
Detect that a JTAG probe is / has been connected to the cluster and emit
a warning that the attempted power down will fail, to aid debugging
system suspend where it is not currently obvious that a core has not
really powered down and will block a full power down of the cluster. We
use a ratelimited pr_warn since this path will also be hit by cpu idle
if it attempts to put cores into the powered down state.
Signed-off-by: Matt Redfearn <matt.redfearn@mips.com>
---
arch/mips/kernel/pm-cps.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
index 421e06dfee72..45776613a5be 100644
--- a/arch/mips/kernel/pm-cps.c
+++ b/arch/mips/kernel/pm-cps.c
@@ -11,6 +11,7 @@
#include <linux/cpuhotplug.h>
#include <linux/init.h>
#include <linux/percpu.h>
+#include <linux/ratelimit.h>
#include <linux/slab.h>
#include <asm/asm-offsets.h>
@@ -143,6 +144,18 @@ int cps_pm_enter_state(enum cps_pm_state state)
/* Setup the VPE to run mips_cps_pm_restore when started again */
if (IS_ENABLED(CONFIG_CPU_PM) && state == CPS_PM_POWER_GATED) {
+ unsigned int stat = read_cpc_cl_stat_conf();
+
+ if (stat & CPC_Cx_STAT_CONF_EJTAG_PROBE) {
+ /*
+ * If we're attempting to gate power to the core, the
+ * JTAG detect bit indicates that the CPC will instead
+ * put the core into clock-off state. Emit a warning.
+ */
+ pr_warn_ratelimited("JTAG probe present - core%d will clock off instead of powering down\n",
+ core);
+ }
+
/* Power gating relies upon CPS SMP */
if (!mips_cps_smp_in_use())
return -EINVAL;
--
2.7.4
next prev parent reply other threads:[~2017-12-15 9:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-15 9:34 [PATCH 1/2] MIPS: SMP-CPS: Remove duplicate assignment of core in play_dead Matt Redfearn
2017-12-15 9:34 ` Matt Redfearn
2017-12-15 9:34 ` Matt Redfearn [this message]
2017-12-15 9:34 ` [PATCH 2/2] MIPS: pm-cps: Warn if JTAG presence will block power gating Matt Redfearn
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=1513330494-21249-2-git-send-email-matt.redfearn@mips.com \
--to=matt.redfearn@mips.com \
--cc=dengcheng.zhu@mips.com \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mark.rutland@arm.com \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--cc=tglx@linutronix.de \
/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