Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1604713 > unrolled thread
| Started by | "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> |
|---|---|
| First post | 2017-03-20 17:00 +0100 |
| Last post | 2017-03-22 06:50 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[v2 PATCH 1/4] powernv: Move CPU-Offline idle state invocation from smp.c to idle.c "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2017-03-20 17:00 +0100
Re: [v2 PATCH 1/4] powernv: Move CPU-Offline idle state invocation from smp.c to idle.c Nicholas Piggin <npiggin@gmail.com> - 2017-03-20 17:40 +0100
Re: [v2 PATCH 1/4] powernv: Move CPU-Offline idle state invocation from smp.c to idle.c Gautham R Shenoy <ego@linux.vnet.ibm.com> - 2017-03-22 06:50 +0100
| From | "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-03-20 17:00 +0100 |
| Subject | [v2 PATCH 1/4] powernv: Move CPU-Offline idle state invocation from smp.c to idle.c |
| Message-ID | <tn7SV-6Ou-9@gated-at.bofh.it> |
From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Move the piece of code in powernv/smp.c::pnv_smp_cpu_kill_self() which
transitions the CPU to the deepest available platform idle state to a
new function named pnv_cpu_offline() in powernv/idle.c. The rationale
behind this code movement is that the data required to determine the
deepest available platform state resides in powernv/idle.c.
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/cpuidle.h | 1 +
arch/powerpc/platforms/powernv/idle.c | 25 +++++++++++++++++++++++++
arch/powerpc/platforms/powernv/powernv.h | 2 --
arch/powerpc/platforms/powernv/smp.c | 18 ++----------------
4 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/include/asm/cpuidle.h b/arch/powerpc/include/asm/cpuidle.h
index 1557315..4649ca0 100644
--- a/arch/powerpc/include/asm/cpuidle.h
+++ b/arch/powerpc/include/asm/cpuidle.h
@@ -46,6 +46,7 @@
extern u64 pnv_first_deep_stop_state;
+unsigned long pnv_cpu_offline(unsigned int cpu);
int validate_psscr_val_mask(u64 *psscr_val, u64 *psscr_mask, u32 flags);
static inline void report_invalid_psscr_val(u64 psscr_val, int err)
{
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index 4ee837e..419edff 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -266,6 +266,31 @@ static void power9_idle(void)
u64 pnv_deepest_stop_psscr_mask;
/*
+ * pnv_cpu_offline: A function that puts the CPU into the deepest
+ * available platform idle state on a CPU-Offline.
+ */
+unsigned long pnv_cpu_offline(unsigned int cpu)
+{
+ unsigned long srr1;
+
+ u32 idle_states = pnv_get_supported_cpuidle_states();
+
+ if (cpu_has_feature(CPU_FTR_ARCH_300)) {
+ srr1 = power9_idle_stop(pnv_deepest_stop_psscr_val,
+ pnv_deepest_stop_psscr_mask);
+ } else if (idle_states & OPAL_PM_WINKLE_ENABLED) {
+ srr1 = power7_winkle();
+ } else if ((idle_states & OPAL_PM_SLEEP_ENABLED) ||
+ (idle_states & OPAL_PM_SLEEP_ENABLED_ER1)) {
+ srr1 = power7_sleep();
+ } else {
+ srr1 = power7_nap(1);
+ }
+
+ return srr1;
+}
+
+/*
* Power ISA 3.0 idle initialization.
*
* POWER ISA 3.0 defines a new SPR Processor stop Status and Control
diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
index 6130522..6dbc0a1 100644
--- a/arch/powerpc/platforms/powernv/powernv.h
+++ b/arch/powerpc/platforms/powernv/powernv.h
@@ -18,8 +18,6 @@ static inline void pnv_pci_shutdown(void) { }
#endif
extern u32 pnv_get_supported_cpuidle_states(void);
-extern u64 pnv_deepest_stop_psscr_val;
-extern u64 pnv_deepest_stop_psscr_mask;
extern void pnv_lpc_init(void);
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 8b67e1e..914b456 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -35,6 +35,7 @@
#include <asm/dbell.h>
#include <asm/kvm_ppc.h>
#include <asm/ppc-opcode.h>
+#include <asm/cpuidle.h>
#include "powernv.h"
@@ -140,7 +141,6 @@ static void pnv_smp_cpu_kill_self(void)
{
unsigned int cpu;
unsigned long srr1, wmask;
- u32 idle_states;
/* Standard hot unplug procedure */
local_irq_disable();
@@ -155,8 +155,6 @@ static void pnv_smp_cpu_kill_self(void)
if (cpu_has_feature(CPU_FTR_ARCH_207S))
wmask = SRR1_WAKEMASK_P8;
- idle_states = pnv_get_supported_cpuidle_states();
-
/* We don't want to take decrementer interrupts while we are offline,
* so clear LPCR:PECE1. We keep PECE2 (and LPCR_PECE_HVEE on P9)
* enabled as to let IPIs in.
@@ -184,19 +182,7 @@ static void pnv_smp_cpu_kill_self(void)
kvmppc_set_host_ipi(cpu, 0);
ppc64_runlatch_off();
-
- if (cpu_has_feature(CPU_FTR_ARCH_300)) {
- srr1 = power9_idle_stop(pnv_deepest_stop_psscr_val,
- pnv_deepest_stop_psscr_mask);
- } else if (idle_states & OPAL_PM_WINKLE_ENABLED) {
- srr1 = power7_winkle();
- } else if ((idle_states & OPAL_PM_SLEEP_ENABLED) ||
- (idle_states & OPAL_PM_SLEEP_ENABLED_ER1)) {
- srr1 = power7_sleep();
- } else {
- srr1 = power7_nap(1);
- }
-
+ srr1 = pnv_cpu_offline(cpu);
ppc64_runlatch_on();
/*
--
1.9.4
[toc] | [next] | [standalone]
| From | Nicholas Piggin <npiggin@gmail.com> |
|---|---|
| Date | 2017-03-20 17:40 +0100 |
| Subject | Re: [v2 PATCH 1/4] powernv: Move CPU-Offline idle state invocation from smp.c to idle.c |
| Message-ID | <tn8vE-7pZ-3@gated-at.bofh.it> |
| In reply to | #1604713 |
On Mon, 20 Mar 2017 21:24:15 +0530 "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> wrote: > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> > > Move the piece of code in powernv/smp.c::pnv_smp_cpu_kill_self() which > transitions the CPU to the deepest available platform idle state to a > new function named pnv_cpu_offline() in powernv/idle.c. The rationale > behind this code movement is that the data required to determine the > deepest available platform state resides in powernv/idle.c. > > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> Looks good. As a nitpick, possibly one or two variables in idle.c could become static (pnv_deepest_stop_psscr_*). Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
[toc] | [prev] | [next] | [standalone]
| From | Gautham R Shenoy <ego@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-03-22 06:50 +0100 |
| Subject | Re: [v2 PATCH 1/4] powernv: Move CPU-Offline idle state invocation from smp.c to idle.c |
| Message-ID | <tnHjI-5ZR-7@gated-at.bofh.it> |
| In reply to | #1604750 |
Hi Nick, On Tue, Mar 21, 2017 at 02:35:17AM +1000, Nicholas Piggin wrote: > On Mon, 20 Mar 2017 21:24:15 +0530 > "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> wrote: > > > From: "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> > > > > Move the piece of code in powernv/smp.c::pnv_smp_cpu_kill_self() which > > transitions the CPU to the deepest available platform idle state to a > > new function named pnv_cpu_offline() in powernv/idle.c. The rationale > > behind this code movement is that the data required to determine the > > deepest available platform state resides in powernv/idle.c. > > > > Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com> > > Looks good. As a nitpick, possibly one or two variables in idle.c could > become static (pnv_deepest_stop_psscr_*). > I changed that, but it ended up being in the next patch. > Reviewed-by: Nicholas Piggin <npiggin@gmail.com> > Thanks! -- Thanks and Regards gautham.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web