From: Thomas Huth <thuth@redhat.com>
To: BALATON Zoltan <balaton@eik.bme.hu>, Miles Glenn <milesg@linux.ibm.com>
Cc: Harsh Prateek Bora <harshpb@linux.ibm.com>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@redhat.com,
npiggin@gmail.com, rathc@linux.ibm.com,
richard.henderson@linaro.org
Subject: Re: [PATCH v4 6/9] target/ppc: Add IBM PPE42 special instructions
Date: Wed, 17 Sep 2025 18:43:02 +0200 [thread overview]
Message-ID: <f698514c-798f-43f8-80cb-dc1b35b15f5e@redhat.com> (raw)
In-Reply-To: <2e4a6d39-650e-74a4-ad60-56d5422c83a1@eik.bme.hu>
On 17/09/2025 18.07, BALATON Zoltan wrote:
> On Wed, 17 Sep 2025, Miles Glenn wrote:
>> On Wed, 2025-09-17 at 08:20 +0200, Thomas Huth wrote:
>>> On 17/09/2025 06.57, Harsh Prateek Bora wrote:
>>>>
>>>> On 9/12/25 22:17, Glenn Miles wrote:
>>>>> Adds the following instructions exclusively for
>>>>> IBM PPE42 processors:
>>>>>
>>>>> LSKU
>>>>> LCXU
>>>>> STSKU
>>>>> STCXU
>>>>> LVD
>>>>> LVDU
>>>>> LVDX
>>>>> STVD
>>>>> STVDU
>>>>> STVDX
>>>>> SLVD
>>>>> SRVD
>>>>> CMPWBC
>>>>> CMPLWBC
>>>>> CMPWIBC
>>>>> BNBWI
>>>>> BNBW
>>>>> CLRBWIBC
>>>>> CLRWBC
>>>>> DCBQ
>>>>> RLDICL
>>>>> RLDICR
>>>>> RLDIMI
>>>>>
>>>>> A PPE42 GCC compiler is available here:
>>>>> https://github.com/open-power/ppe42-gcc
>>>>>
>>>>> For more information on the PPE42 processors please visit:
>>>>> https://wiki.raptorcs.com/w/images/a/a3/PPE_42X_Core_Users_Manual.pdf
>>>>>
>>>>> Signed-off-by: Glenn Miles <milesg@linux.ibm.com>
>>>>> ---
>>>>> Changes from v3:
>>>>> - Removed copy of CHECK_VDR
>>>>> - Refactored ld/st instructions
>>>>>
>>>>> target/ppc/insn32.decode | 66 ++-
>>>>> target/ppc/translate.c | 29 +-
>>>>> target/ppc/translate/ppe-impl.c.inc | 665 ++++++++++++++++++++++++++++
>>>>> 3 files changed, 750 insertions(+), 10 deletions(-)
>>>>> create mode 100644 target/ppc/translate/ppe-impl.c.inc
>>>>>
>>>>
>>>> <snip>
>>>>
>>>>> diff --git a/target/ppc/translate/ppe-impl.c.inc b/target/ppc/translate/
>>>>> ppe-impl.c.inc
>>>>> new file mode 100644
>>>>> index 0000000000..792103d7c2
>>>>> --- /dev/null
>>>>> +++ b/target/ppc/translate/ppe-impl.c.inc
>>>>> @@ -0,0 +1,665 @@
>>>>> +/*
>>>>> + * IBM PPE Instructions
>>>>> + *
>>>>> + * Copyright (c) 2025, IBM Corporation.
>>>>> + *
>>>>> + * SPDX-License-Identifier: GPL-2.0-or-later
>>>>> + */
>>>>> +
>>>>> +
>>>>> +#if !defined(TARGET_PPC64)
>>>>> +static bool vdr_is_valid(uint32_t vdr)
>>>>> +{
>>>>> + const uint32_t valid_bitmap = 0xf00003ff;
>>>>> + return !!((1ul << (vdr & 0x1f)) & valid_bitmap);
>>>>> +}
>>>>> +
>>>>> +static bool ppe_gpr_is_valid(uint32_t reg)
>>>>> +{
>>>>> + const uint32_t valid_bitmap = 0xf00027ff;
>>>>> + return !!((1ul << (reg & 0x1f)) & valid_bitmap);
>>>>> +}
>>>>> +#endif
>>>>> +
>>>>> +#define CHECK_VDR(CTX, VDR) \
>>>>> + do { \
>>>>> + if (unlikely(!vdr_is_valid(VDR))) { \
>>>>> + gen_invalid(CTX); \
>>>>> + return true; \
>>>>> + } \
>>>>> + } while (0)
>>>>> +
>>>>> +#define CHECK_PPE_GPR(CTX, REG) \
>>>>> + do { \
>>>>> + if (unlikely(!ppe_gpr_is_valid(REG))) { \
>>>>> + gen_invalid(CTX); \
>>>>> + return true; \
>>>>> + } \
>>>>> + } while (0)
>>>>> +
>>>>> +#define VDR_PAIR_REG(VDR) (((VDR) + 1) & 0x1f)
>>>>> +
>>>>> +#define CHECK_PPE_LEVEL(CTX, LVL) \
>>>>> + do { \
>>>>> + if (unlikely(!((CTX)->insns_flags2 & (LVL)))) { \
>>>>> + gen_invalid(CTX); \
>>>>> + return true; \
>>>>> + } \
>>>>> + } while (0)
>>>>> +
>>>>> +static bool trans_LCXU(DisasContext *ctx, arg_LCXU *a)
>>>>> +{
>>>>> +#if defined(TARGET_PPC64)
>>>>> + return false;
>>>>> +#else
>>>>
>>>> If we are building the PPE42 instructions only for !TARGET_PPC64, does
>>>> it still make it usable with qemu-system-ppc64?
>>>
>>> As explained in an earlier thread already, qemu-system-ppc64 is a superset
>>> of qemu-system-ppc. Thus the ppe42 stuff should work in qemu-system-
>>> ppc64, too.
>>>
>>> Thomas
>>>
>>
>> Ah, yes, I don't think I fully understood the ramifications of Thomas's
>> statements earlier. Looks like I'll need to scrub the code to ensure
>> that PPE42 can run even if TARGET_PPC64 is defined.
>>
>> Cedric, this requires me to change my response to your request to add
>> the check for TARGET_PPC64 inside the is_ppe() function. I will need
>> to leave that function as-is if we want PPE42 to be supported in both
>> targets. Will you be ok with that?
>
> Does it make sense to support it with !TARGET_PPC64 if its only use is in
> qemu-system-ppc64? Even if the CPU is 32-bit it has some 64-bit instructions
> IIUC so does that make it TARGET_PPC64 only?
As long as the GPRs are 32 bit only (which is the case here, I assume), it's
a 32-bit PPC CPU, isn't it? So that certainly should not go into the ppc64
binary only.
Thomas
next prev parent reply other threads:[~2025-09-17 16:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 16:47 [PATCH v4 0/9] Add IBM PPE42 CPU support Glenn Miles
2025-09-12 16:47 ` [PATCH v4 1/9] target/ppc: IBM PPE42 general regs and flags Glenn Miles
2025-09-12 16:47 ` [PATCH v4 2/9] target/ppc: Add IBM PPE42 family of processors Glenn Miles
2025-09-12 16:47 ` [PATCH v4 3/9] target/ppc: IBM PPE42 exception flags and regs Glenn Miles
2025-09-12 16:47 ` [PATCH v4 4/9] target/ppc: Add IBM PPE42 exception model Glenn Miles
2025-09-12 16:47 ` [PATCH v4 5/9] target/ppc: Support for IBM PPE42 MMU Glenn Miles
2025-09-12 16:47 ` [PATCH v4 6/9] target/ppc: Add IBM PPE42 special instructions Glenn Miles
2025-09-16 9:12 ` Cédric Le Goater
2025-09-17 4:57 ` Harsh Prateek Bora
2025-09-17 6:20 ` Thomas Huth
2025-09-17 14:38 ` Miles Glenn
2025-09-17 16:07 ` BALATON Zoltan
2025-09-17 16:43 ` Thomas Huth [this message]
2025-09-17 16:52 ` Miles Glenn
2025-09-17 16:35 ` Cédric Le Goater
2025-09-12 16:47 ` [PATCH v4 7/9] hw/ppc: Support for an IBM PPE42 CPU decrementer Glenn Miles
2025-09-12 16:47 ` [PATCH v4 8/9] hw/ppc: Add a test machine for the IBM PPE42 CPU Glenn Miles
2025-09-12 16:47 ` [PATCH v4 9/9] tests/functional: Add test for IBM PPE42 instructions Glenn Miles
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=f698514c-798f-43f8-80cb-dc1b35b15f5e@redhat.com \
--to=thuth@redhat.com \
--cc=balaton@eik.bme.hu \
--cc=clg@redhat.com \
--cc=harshpb@linux.ibm.com \
--cc=milesg@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 \
/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).