From: Michael Ellerman <mpe@ellerman.id.au>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: rmclure@linux.ibm.com, ldufour@linux.ibm.com, npiggin@gmail.com
Subject: Re: [PATCH 2/2] powerpc/rtas: Fix RTAS MSR[HV] handling for Cell
Date: Thu, 25 Aug 2022 18:03:44 +1000 [thread overview]
Message-ID: <871qt4lpgf.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <c100477ab300d3e017ff1746a0be103e98048c49.camel@gmail.com>
Jordan Niethe <jniethe5@gmail.com> writes:
> On Wed, 2022-08-24 at 22:04 +1000, Michael Ellerman wrote:
>> Jordan Niethe <jniethe5@gmail.com> writes:
>> > On Tue, 2022-08-23 at 21:59 +1000, Michael Ellerman wrote:
>> > > The semi-recent changes to MSR handling when entering RTAS (firmware)
>> > > cause crashes on IBM Cell machines. An example trace:
>> ...
>> > > diff --git a/arch/powerpc/kernel/rtas_entry.S b/arch/powerpc/kernel/rtas_entry.S
>> > > index 9a434d42e660..6ce95ddadbcd 100644
>> > > --- a/arch/powerpc/kernel/rtas_entry.S
>> > > +++ b/arch/powerpc/kernel/rtas_entry.S
>> > > @@ -109,8 +109,12 @@ _GLOBAL(enter_rtas)
>> > > * its critical regions (as specified in PAPR+ section 7.2.1). MSR[S]
>> > > * is not impacted by RFI_TO_KERNEL (only urfid can unset it). So if
>> > > * MSR[S] is set, it will remain when entering RTAS.
>> > > + * If we're in HV mode, RTAS must also run in HV mode, so extract MSR_HV
>> > > + * from the saved MSR value and insert into the value RTAS will use.
>> > > */
>> >
>> > Interestingly it looks like these are the first uses of these extended
>> > mnemonics in the kernel?
>>
>> We used to have at least one use I know of in TM code, but it's since
>> been converted to C.
>>
>> > > + extrdi r0, r6, 1, 63 - MSR_HV_LG
>> >
>> > Or in non-mnemonic form...
>> > rldicl r0, r6, 64 - MSR_HV_LG, 63
>>
>> It's rldicl all the way down.
>>
>> > > LOAD_REG_IMMEDIATE(r6, MSR_ME | MSR_RI)
>> > > + insrdi r6, r0, 1, 63 - MSR_HV_LG
>> >
>> > Or in non-mnemonic form...
>> > rldimi r6, r0, MSR_HV_LG, 63 - MSR_HV_LG
>>
>> I think the extended mnemonics are slightly more readable than the
>> open-coded versions?
>
> Yeah definitely. I was just noting the plain instruction as I think we
> have some existing patterns that may be potential candidates for conversion to the
> extended version. Like in exceptions-64s.S
>
> rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
> to
> extrdi. r0, r12, 2, 63 - MSR_TS_LG - 1
>
> Would it be worth changing these?
Some folks are very comfortable with rldicl and probably prefer the
former, but I'm not sure there's many of those people around anymore :)
I think the extrdi is a bit more readable.
You could use MSR_TS_T_LG to avoid the - 1? All those uses have a
comment about it being 2 bits already.
cheers
next prev parent reply other threads:[~2022-08-25 8:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 11:59 [PATCH 1/2] Revert "powerpc: Remove unused FW_FEATURE_NATIVE references" Michael Ellerman
2022-08-23 11:59 ` [PATCH 2/2] powerpc/rtas: Fix RTAS MSR[HV] handling for Cell Michael Ellerman
2022-08-24 1:50 ` Jordan Niethe
2022-08-24 12:04 ` Michael Ellerman
2022-08-25 1:22 ` Jordan Niethe
2022-08-25 8:03 ` Michael Ellerman [this message]
2022-08-31 13:12 ` [PATCH 1/2] Revert "powerpc: Remove unused FW_FEATURE_NATIVE references" Michael Ellerman
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=871qt4lpgf.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=jniethe5@gmail.com \
--cc=ldufour@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=rmclure@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).