From: Michael Neuling <mikey@neuling.org>
To: Shreyas B Prabhu <shreyas@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>
Cc: ego@linux.vnet.ibm.com, benh@au1.ibm.com,
linux-kernel@vger.kernel.org, maddy@linux.vnet.ibm.com,
linuxppc-dev@lists.ozlabs.org,
Aneesh Kk Veetil <aneesh.kumar@in.ibm.com>
Subject: Re: [v6, 08/11] powerpc/powernv: Add platform support for stop instruction
Date: Tue, 21 Jun 2016 16:14:17 +1000 [thread overview]
Message-ID: <1466489657.25838.39.camel@neuling.org> (raw)
In-Reply-To: <5761518A.1040709@linux.vnet.ibm.com>
> > > +#define OPAL_PM_TIMEBASE_STOP 0x00000002
> > > +#define OPAL_PM_LOSE_HYP_CONTEXT 0x00002000
> > > +#define OPAL_PM_LOSE_FULL_CONTEXT 0x00004000
> > > =C2=A0#define OPAL_PM_NAP_ENABLED 0x00010000
> > > =C2=A0#define OPAL_PM_SLEEP_ENABLED 0x00020000
> > > =C2=A0#define OPAL_PM_WINKLE_ENABLED 0x00040000
> > > =C2=A0#define OPAL_PM_SLEEP_ENABLED_ER1 0x00080000 /* with
> > > workaround */
> > > +#define OPAL_PM_STOP_INST_FAST 0x00100000
> > > +#define OPAL_PM_STOP_INST_DEEP 0x00200000
> > I don't see the above in skiboot yet?
> I've posted it here -
> http://patchwork.ozlabs.org/patch/617828/
FWIW, this is in now.
https://github.com/open-power/skiboot/commit/952daa69baca407383bc900911f6c4=
0718a0e289
> >=20
> >=20
> > >=20
> > > diff --git a/arch/powerpc/include/asm/paca.h
> > > b/arch/powerpc/include/asm/paca.h
> > > index 546540b..ae91b44 100644
> > > --- a/arch/powerpc/include/asm/paca.h
> > > +++ b/arch/powerpc/include/asm/paca.h
> > > @@ -171,6 +171,8 @@ struct paca_struct {
> > > =C2=A0 /* Mask to denote subcore sibling threads */
> > > =C2=A0 u8 subcore_sibling_mask;
> > > =C2=A0#endif
> > > + /* Template for PSSCR with EC, ESL, TR, PSLL, MTL fields set
> > > */
> > > + u64 thread_psscr;
> > I'm not entirely clear on why that needs to be in the paca. Could it
> > not be global?
> >=20
> While we use Requested Level (RL) field of PSSCR to request a stop
> level, other fields in the SPR like EC, ESL, TR, PSLL, MTL can be
> modified by individual threads less frequently to alter the behaviour of
> stop. So the idea was to have a per-thread variable with all (except RL)
> fields of PSSCR set appropriately. Threads at the time of entering idle,
> can modify the RL field in the variable and execute stop instruction.
But we don't do any of this currently? This is setup at init
in=C2=A0pnv_init_idle_states() and only the RL is changed in power_stop().
So it can still be a global. =C2=A0It could just be a constant currently ev=
en.
> =C2=A0 .text
> > > =C2=A0
> > > =C2=A0/*
> > > @@ -61,8 +75,19 @@ save_sprs_to_stack:
> > > =C2=A0 =C2=A0* Note all register i.e per-core, per-subcore or per-thr=
ead=20
> > > is saved
> > > =C2=A0 =C2=A0* here since any thread in the core might wake up first
> > > =C2=A0 =C2=A0*/
> > > +BEGIN_FTR_SECTION
> > > + mfspr r3,SPRN_PTCR
> > > + std r3,_PTCR(r1)
> > > + mfspr r3,SPRN_LMRR
> > > + std r3,_LMRR(r1)
> > > + mfspr r3,SPRN_LMSER
> > > + std r3,_LMSER(r1)
> > > + mfspr r3,SPRN_ASDR
> > > + std r3,_ASDR(r1)
> > > +FTR_SECTION_ELSE
> > A comment here saying that SDR1 is removed in ISA 3.0 would be helpful.
> >=20
> Ok.
I thought we decided we didn't need LMRR, LMSR,=C2=A0
https://lkml.org/lkml/2016/6/8/1121
or ASDR isn't actually used at all yet and is only valid for some page
faults, so we don't need it here also.
> +END_MMU_FTR_SECTION_IFCLR(MMU_FTR_RADIX)
> > > +
> > > + /* Restore per thread state */
> > > +BEGIN_FTR_SECTION
> > > + bl=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0__restore_cpu_power9
> > > +
> > > + ld r4,_LMRR(r1)
> > > + mtspr SPRN_LMRR,r4
> > > + ld r4,_LMSER(r1)
> > > + mtspr SPRN_LMSER,r4
> > > + ld r4,_ASDR(r1)
> > > + mtspr SPRN_ASDR,r4
> > Should those be in __restore_cpu_power9 ?
> I was not sure how these registers will be used, but after speaking to
> Aneesh and Mikey I realized these registers will not need restoring.
> LMRR and LMSER are associated with the context and ADSR will be consumed
> before entering stop. So I'll be dropping the this hunk in next revision.
Yep.
>=C2=A0
> > > =C2=A0 pnv_alloc_idle_core_states();
> > > =C2=A0
> > > + if (supported_cpuidle_states & OPAL_PM_STOP_INST_FAST)
> > > + for_each_possible_cpu(i) {
> > > +
> > > + u64 psscr_init_val =3D PSSCR_ESL | PSSCR_EC |
> > > + PSSCR_PSLL_MASK | PSSCR_TR_MASK |
> > > + PSSCR_MTL_MASK;
> > > +
> > > + paca[i].thread_psscr =3D psscr_init_val;
This seems to be the only place you set this. =C2=A0Why put it in the paca,=
why
not just make this a constant?=C2=A0
Mikey
next prev parent reply other threads:[~2016-06-21 6:14 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 16:54 [PATCH v6 00/11] powerpc/powernv/cpuidle: Add support for POWER ISA v3 idle states Shreyas B. Prabhu
2016-06-08 16:54 ` [PATCH v6 01/11] powerpc/powernv: Use PNV_THREAD_WINKLE macro while requesting for winkle Shreyas B. Prabhu
2016-06-08 16:54 ` [PATCH v6 02/11] powerpc/kvm: make hypervisor state restore a function Shreyas B. Prabhu
2016-06-08 16:54 ` [PATCH v6 03/11] powerpc/powernv: Rename idle_power7.S to idle_power_common.S Shreyas B. Prabhu
2016-06-15 5:31 ` [v6, " Michael Ellerman
2016-06-08 16:54 ` [PATCH v6 04/11] powerpc/powernv: Rename reusable idle functions to hardware agnostic names Shreyas B. Prabhu
2016-06-08 16:54 ` [PATCH v6 05/11] powerpc/powernv: Make pnv_powersave_common more generic Shreyas B. Prabhu
2016-06-08 16:54 ` [PATCH v6 06/11] powerpc/powernv: abstraction for saving SPRs before entering deep idle states Shreyas B. Prabhu
2016-06-08 16:54 ` [PATCH v6 07/11] powerpc/powernv: set power_save func after the idle states are initialized Shreyas B. Prabhu
2016-06-15 5:41 ` [v6, " Michael Ellerman
2016-06-15 6:11 ` Shreyas B Prabhu
2016-06-22 1:54 ` [PATCH v6 " Benjamin Herrenschmidt
2016-06-22 5:11 ` Michael Neuling
2016-06-28 12:10 ` [v6, " Michael Ellerman
2016-06-08 16:54 ` [PATCH v6 08/11] powerpc/powernv: Add platform support for stop instruction Shreyas B. Prabhu
2016-06-15 11:14 ` [v6, " Michael Ellerman
2016-06-15 13:00 ` Shreyas B Prabhu
2016-06-21 6:14 ` Michael Neuling [this message]
2016-06-08 16:54 ` [PATCH v6 09/11] cpuidle/powernv: Use CPUIDLE_STATE_MAX instead of MAX_POWERNV_IDLE_STATES Shreyas B. Prabhu
2016-06-13 15:01 ` Daniel Lezcano
2016-06-13 20:58 ` Rafael J. Wysocki
2016-06-08 16:54 ` [PATCH v6 10/11] cpuidle/powernv: Add support for POWER ISA v3 idle states Shreyas B. Prabhu
2016-06-13 15:34 ` Daniel Lezcano
2016-06-14 10:47 ` Shreyas B Prabhu
2016-06-14 11:29 ` Benjamin Herrenschmidt
2016-06-15 4:57 ` Shreyas B Prabhu
2016-06-13 21:48 ` Benjamin Herrenschmidt
2016-06-14 11:11 ` Shreyas B Prabhu
2016-06-14 11:31 ` Benjamin Herrenschmidt
2016-06-08 16:54 ` [PATCH v6 11/11] powerpc/powernv: Use deepest stop state when cpu is offlined Shreyas B. Prabhu
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=1466489657.25838.39.camel@neuling.org \
--to=mikey@neuling.org \
--cc=aneesh.kumar@in.ibm.com \
--cc=benh@au1.ibm.com \
--cc=ego@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=shreyas@linux.vnet.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).