From: Pratik Rajesh Sampat <psampat@linux.ibm.com>
To: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
mpe@ellerman.id.au, mikey@neuling.org, npiggin@gmail.com,
vaidy@linux.ibm.com, ego@linux.vnet.ibm.com,
skiboot@lists.ozlabs.org, oohall@gmail.com,
psampat@linux.ibm.com, pratik.r.sampat@gmail.com
Subject: [RFC 2/3] Demonstration of handling an idle-stop quirk version
Date: Wed, 4 Mar 2020 21:31:22 +0530 [thread overview]
Message-ID: <4084fa08404fbf65942a08335318b6d800d363fc.1583332695.git.psampat@linux.ibm.com> (raw)
In-Reply-To: <cover.1583332695.git.psampat@linux.ibm.com>
Concept patch demonstrating an idle-stop version discovery from the
device tree, along with population its support and versioning. It also
assigns the function pointer to handle any idle-stop specific quirks.
Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>
---
arch/powerpc/include/asm/processor.h | 1 +
arch/powerpc/kernel/dt_cpu_ftrs.c | 16 ++++++++++++++++
arch/powerpc/platforms/powernv/idle.c | 8 ++++++++
3 files changed, 25 insertions(+)
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index da59f01a5c09..277dbabafd02 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -432,6 +432,7 @@ enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};
#define STOP_ENABLE 0x00000001
#define STOP_VERSION_P9 0x1
+#define STOP_VERSION_P9_V1 0x2
/*
* Classify the dependencies of the stop states
diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index db1a525e090d..63e30aa49356 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -298,6 +298,21 @@ static int __init feat_enable_idle_stop(struct dt_cpu_feature *f)
return 1;
}
+static int __init feat_enable_idle_stop_quirk(struct dt_cpu_feature *f)
+{
+ u64 lpcr;
+
+ /* Set PECE wakeup modes for ISAv3.0B */
+ lpcr = mfspr(SPRN_LPCR);
+ lpcr |= LPCR_PECE0;
+ lpcr |= LPCR_PECE1;
+ lpcr |= LPCR_PECE2;
+ mtspr(SPRN_LPCR, lpcr);
+ stop_dep.cpuidle_prop |= STOP_ENABLE;
+ stop_dep.stop_version = STOP_VERSION_P9_V1;
+
+ return 1;
+}
static int __init feat_enable_mmu_hash(struct dt_cpu_feature *f)
{
u64 lpcr;
@@ -592,6 +607,7 @@ static struct dt_cpu_feature_match __initdata
{"idle-nap", feat_enable_idle_nap, 0},
{"alignment-interrupt-dsisr", feat_enable_align_dsisr, 0},
{"idle-stop", feat_enable_idle_stop, 0},
+ {"idle-stop-v1", feat_enable_idle_stop_quirk, 0},
{"machine-check-power8", feat_enable_mce_power8, 0},
{"performance-monitor-power8", feat_enable_pmu_power8, 0},
{"data-stream-control-register", feat_enable_dscr, CPU_FTR_DSCR},
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index c32cdc37acf4..9f5b21da2fc5 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -805,6 +805,11 @@ static unsigned long power9_idle_stop(unsigned long psscr, bool mmu_on)
return srr1;
}
+static unsigned long power9_idle_quirky_stop(unsigned long psscr, bool mmu_on)
+{
+ return power9_idle_stop(psscr, mmu_on);
+}
+
#ifdef CONFIG_HOTPLUG_CPU
static unsigned long power9_offline_stop(unsigned long psscr)
{
@@ -1360,6 +1365,9 @@ static int __init pnv_init_idle_states(void)
case STOP_VERSION_P9:
stop_dep.idle_stop = power9_idle_stop;
break;
+ case STOP_VERSION_P9_V1:
+ stop_dep.idle_stop = power9_idle_quirky_stop;
+ break;
default:
stop_dep.idle_stop = NULL;
goto out;
--
2.24.1
next prev parent reply other threads:[~2020-03-04 16:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-04 16:01 [RFC 0/3] cpuidle/powernv: Interface to handle idle-stop versioning Pratik Rajesh Sampat
2020-03-04 16:01 ` [RFC 1/3] Interface for an idle-stop dependency structure Pratik Rajesh Sampat
2020-04-08 10:51 ` Gautham R Shenoy
2020-04-12 12:18 ` Pratik Sampat
2020-03-04 16:01 ` Pratik Rajesh Sampat [this message]
2020-03-04 16:01 ` [RFC 3/3] Introduce capability for firmware-enabled-stop Pratik Rajesh Sampat
2020-04-08 10:54 ` Gautham R Shenoy
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=4084fa08404fbf65942a08335318b6d800d363fc.1583332695.git.psampat@linux.ibm.com \
--to=psampat@linux.ibm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=oohall@gmail.com \
--cc=pratik.r.sampat@gmail.com \
--cc=skiboot@lists.ozlabs.org \
--cc=vaidy@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).