From: "罗勇刚(Yonggang Luo)" <luoyonggang@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: qemu-level <qemu-devel@nongnu.org>,
qemu-ppc@nongnu.org, Thomas Monjalon <thomas@monjalon.net>,
Aurelien Jarno <aurelien@aurel32.net>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: What's the correct way to implement rfi and related instruction.
Date: Tue, 12 Jan 2021 21:52:02 +0800 [thread overview]
Message-ID: <CAE2XoE-QDj2=o-WZBFh8R2cDxqRLGvDVC6kt0q0xap_R7pB0Rg@mail.gmail.com> (raw)
In-Reply-To: <96e02d87-3326-748d-9c97-de910b5b1533@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 3247 bytes --]
On Tue, Jan 12, 2021 at 5:23 PM Cédric Le Goater <clg@kaod.org> wrote:
>
> > QEMU 5.2.x, an e300 based machine ppc603 are impacted.
> > Here is my fix, narrowed down to MSR_TGPR and MSR_ILE
> > ```
> > From 42ce41671f1e6c4dd44e6fb481bbda9df09320bd Mon Sep 17 00:00:00 2001
> > From: Yonggang Luo <luoyonggang@gmail.com <mailto:luoyonggang@gmail.com
>>
> > Date: Sun, 10 Jan 2021 00:08:00 -0800
> > Subject: [PATCH] ppc: Fix rfi/rfid/hrfi/... emulation again
> >
> > This revert part mask bits for ppc603/ppc4x that disabled in
a2e71b28e832346409efc795ecd1f0a2bcb705a3.
> > Remove redundant macro MSR_BOOK3S_MASK.
> > Fixes boot VxWorks on e300
> >
> > Signed-off-by: Yonggang Luo <luoyonggang@gmail.com <mailto:
luoyonggang@gmail.com>>
> > ---
> > target/ppc/excp_helper.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> > index 1c48b9fdf6..df70c5a4e8 100644
> > --- a/target/ppc/excp_helper.c
> > +++ b/target/ppc/excp_helper.c
> > @@ -1156,8 +1156,10 @@ static inline void do_rfi(CPUPPCState *env,
target_ulong nip, target_ulong msr)
> > {
> > CPUState *cs = env_cpu(env);
> >
> > - /* MSR:POW cannot be set by any form of rfi */
> > + /* MSR:POW,TGPR,ILE cannot be set by any form of rfi */
> > msr &= ~(1ULL << MSR_POW);
> > + msr &= ~(1ULL << MSR_TGPR);
>
> Indeed. The e300 user manual says that TGPR is cleared by rfi. We should
> add a per-cpu family mask and not a global setting.
Refer to https://www.nxp.com/docs/en/reference-manual/e300coreRM.pdf
`Table 2-4. MSR Bit Settings`
```
Temporary GPR remapping (implementation-specific) 0 Normal operation 1
TGPR mode. GPR0–GPR3 are remapped to TGPR0–TGPR3 for use by TLB miss
routines. The contents of GPR0–GPR3 remain unchanged while MSR[TGPR] = 1.
Attempts to use GPR4–GPR31 with MSR[TGPR] = 1 yield undefined results.
Temporarily replaces TGPR0–TGPR3 with GPR0–GPR3 for use by TLB miss
routines. The TGPR bit is set when either an instruction TLB miss, data
read miss, or data write miss interrupt is taken. The TGPR bit is cleared
by an rfi instruction.
```
>
> > + msr &= ~(1ULL << MSR_ILE);
>
> that's curious. I am still trying to understand that part. May be this is
> due to the lack of HID2 modeling which contains a "True little-endian"
bit.
Don't understand this part, I am running VxWorks 6.9 on MPC8349EA
https://www.nxp.com/docs/en/reference-manual/MPC8349EARM.pdf
Didn't got any idea about why MSR_ILE are set
>
> Is your image Little endian ?
>
Big Endian vxworks image.
> C.
>
> >
> > #if defined(TARGET_PPC64)
> > /* Switching to 32-bit ? Crop the nip */
> > @@ -1190,7 +1192,6 @@ void helper_rfi(CPUPPCState *env)
> > do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xfffffffful);
> > }
> >
> > -#define MSR_BOOK3S_MASK
> > #if defined(TARGET_PPC64)
> > void helper_rfid(CPUPPCState *env)
> > {
> > --
> > 2.29.2.windows.3
> >
> > ```
> >
> > --
> > 此致
> > 礼
> > 罗勇刚
> > Yours
> > sincerely,
> > Yonggang Luo
>
--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo
[-- Attachment #2: Type: text/html, Size: 4471 bytes --]
next prev parent reply other threads:[~2021-01-12 13:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 19:14 What's the correct way to implement rfi and related instruction 罗勇刚(Yonggang Luo)
2021-01-07 21:54 ` Cédric Le Goater
2021-01-08 4:21 ` 罗勇刚(Yonggang Luo)
2021-01-08 10:02 ` Cédric Le Goater
2021-01-10 15:00 ` 罗勇刚(Yonggang Luo)
2021-01-12 9:23 ` Cédric Le Goater
2021-01-12 13:52 ` 罗勇刚(Yonggang Luo) [this message]
2021-01-13 14:19 ` Cédric Le Goater
2021-01-13 10:02 ` 罗勇刚(Yonggang Luo)
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='CAE2XoE-QDj2=o-WZBFh8R2cDxqRLGvDVC6kt0q0xap_R7pB0Rg@mail.gmail.com' \
--to=luoyonggang@gmail.com \
--cc=aurelien@aurel32.net \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thomas@monjalon.net \
/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).