qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Miles Glenn <milesg@linux.ibm.com>
To: Harsh Prateek Bora <harshpb@linux.ibm.com>,
	Chinmay Rath <rathc@linux.ibm.com>,
	qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, clg@redhat.com, npiggin@gmail.com,
	thuth@redhat.com,  richard.henderson@linaro.org
Subject: Re: [PATCH v5 2/9] target/ppc: Add IBM PPE42 family of processors
Date: Thu, 25 Sep 2025 10:29:45 -0500	[thread overview]
Message-ID: <6498d929eb80aeddc41f8a3c5b3f878f60599b57.camel@linux.ibm.com> (raw)
In-Reply-To: <2e723114-e98c-4912-adc1-495341f2f550@linux.ibm.com>

On Thu, 2025-09-25 at 10:27 +0530, Harsh Prateek Bora wrote:
> Hi Glenn,
> 
> On 9/24/25 20:36, Miles Glenn wrote:
> > > > > @@ -6802,53 +6916,63 @@ static void init_ppc_proc(PowerPCCPU *cpu)
> > > > >    
> > > > >        /* MSR bits & flags consistency checks */
> > > > >        if (env->msr_mask & (1 << 25)) {
> > > > > -        switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
> > > > > +        switch (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE |
> > > > > +                              POWERPC_FLAG_PPE42)) {
> > > > >            case POWERPC_FLAG_SPE:
> > > > >            case POWERPC_FLAG_VRE:
> > > > > +        case POWERPC_FLAG_PPE42:
> > > > >                break;
> > > > >            default:
> > > > >                fprintf(stderr, "PowerPC MSR definition inconsistency\n"
> > > > > -                    "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n");
> > > > > +                    "Should define POWERPC_FLAG_SPE or POWERPC_FLAG_VRE\n"
> > > > > +                    "or POWERPC_FLAG_PPE42\n");
> > > > >                exit(1);
> > > > >            }
> > > > >        } else if (env->flags & (POWERPC_FLAG_SPE | POWERPC_FLAG_VRE)) {
> > > > Hey Glenn,
> > > > 
> > > > Did you miss adding the POWERPC_FLAG_PPE42 flag here  ^  ?
> > > > 
> > > > Thanks,
> > > > Chinmay
> > > No. All PPE42 processors will have bit 1 << 25 set in env->msr_mask, so
> > > it will always fall into the previous condition block and never enter
> > > the 2nd check.
> > > 
> > > Glenn
> > > 
> > Ah, sorry, I should have looked closer!  This is supposed to be
> > checking that if 1 << 25 is not set that we shouldn't be setting the
> > PPE42 flag either.  So, yes, I'll add that in v6.
> 
> While we are at it, can we also replace all hard-coded bit shifts with
> appropriate macros which reflect what these shifts are about. There are
> few more such checks in the patch. May be audit other patches as well
> for such instances.
> 
> regards
> Harsh
> 

Hi Harsh,

Normally I would agree with you, but I think that all of the hard-coded 
bit shifts in this function (init_ppc_proc) are hard-coded because the
MSR bits have multiple meanings depending on the CPU and this function
is called on all PPC CPUs.  So, in this context, I think that using the
hard-coded bit number is appropriate and this is probably why it has
remained as a hard-coded value in this function since 2007.

That being said, if you still feel strongly that these hard-coded
values should be replaced with macros, could you provide suggestions on
what would be appropriate names in this function?

Thanks,

Glenn


> > Thanks,
> > 
> > Glenn



  reply	other threads:[~2025-09-25 15:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 18:27 [PATCH v5 0/9] Add IBM PPE42 CPU support Glenn Miles
2025-09-18 18:27 ` [PATCH v5 1/9] target/ppc: IBM PPE42 general regs and flags Glenn Miles
2025-09-24 12:28   ` Chinmay Rath
2025-09-18 18:27 ` [PATCH v5 2/9] target/ppc: Add IBM PPE42 family of processors Glenn Miles
2025-09-24 12:32   ` Chinmay Rath
2025-09-24 14:52     ` Miles Glenn
2025-09-24 15:06       ` Miles Glenn
2025-09-25  4:57         ` Harsh Prateek Bora
2025-09-25 15:29           ` Miles Glenn [this message]
2025-09-25 15:54             ` Harsh Prateek Bora
2025-09-18 18:27 ` [PATCH v5 3/9] target/ppc: IBM PPE42 exception flags and regs Glenn Miles
2025-09-25 16:25   ` Chinmay Rath
2025-09-18 18:27 ` [PATCH v5 4/9] target/ppc: Add IBM PPE42 exception model Glenn Miles
2025-09-25 16:49   ` Chinmay Rath
2025-09-18 18:27 ` [PATCH v5 5/9] target/ppc: Support for IBM PPE42 MMU Glenn Miles
2025-09-25 18:57   ` Chinmay Rath
2025-09-18 18:27 ` [PATCH v5 6/9] target/ppc: Add IBM PPE42 special instructions Glenn Miles
2025-09-22 10:18   ` Chinmay Rath
2025-09-18 18:27 ` [PATCH v5 7/9] hw/ppc: Support for an IBM PPE42 CPU decrementer Glenn Miles
2025-09-18 18:27 ` [PATCH v5 8/9] hw/ppc: Add a test machine for the IBM PPE42 CPU Glenn Miles
2025-09-18 18:27 ` [PATCH v5 9/9] tests/functional: Add test for IBM PPE42 instructions Glenn Miles
2025-09-19  8:29   ` Cédric Le Goater

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=6498d929eb80aeddc41f8a3c5b3f878f60599b57.camel@linux.ibm.com \
    --to=milesg@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=harshpb@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rathc@linux.ibm.com \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.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).