From: David Gibson <david@gibson.dropbear.id.au>
To: Fabiano Rosas <farosas@linux.ibm.com>
Cc: Leandro Lupori <leandro.lupori@eldorado.org.br>,
danielhb413@gmail.com, richard.henderson@linaro.org,
qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org,
clg@kaod.org, pbonzini@redhat.com, alex.bennee@linaro.org
Subject: Re: [RFC PATCH 1/6] target/ppc: Add support for the Processor Attention instruction
Date: Sat, 26 Mar 2022 14:15:14 +1100 [thread overview]
Message-ID: <Yj6FQubqactWyyNn@yekko> (raw)
In-Reply-To: <87tubm12z0.fsf@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 4018 bytes --]
On Fri, Mar 25, 2022 at 12:11:47PM -0300, Fabiano Rosas wrote:
> Leandro Lupori <leandro.lupori@eldorado.org.br> writes:
>
> > From: Cédric Le Goater <clg@kaod.org>
> >
> > Check the HID0 bit to send signal, currently modeled as a checkstop.
> > The QEMU implementation adds an exit using the GPR[3] value (that's a
> > hack for tests)
> >
> > Signed-off-by: Cédric Le Goater <clg@kaod.org>
> > Signed-off-by: Leandro Lupori <leandro.lupori@eldorado.org.br>
> > ---
> > target/ppc/cpu.h | 8 ++++++++
> > target/ppc/excp_helper.c | 27 +++++++++++++++++++++++++++
> > target/ppc/helper.h | 1 +
> > target/ppc/translate.c | 14 ++++++++++++++
> > 4 files changed, 50 insertions(+)
> >
> > diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> > index 047b24ba50..12f9f3a880 100644
> > --- a/target/ppc/cpu.h
> > +++ b/target/ppc/cpu.h
> > @@ -173,6 +173,12 @@ enum {
> > POWERPC_EXCP_PRIV_REG = 0x02, /* Privileged register exception */
> > /* Trap */
> > POWERPC_EXCP_TRAP = 0x40,
> > + /* Processor Attention */
> > + POWERPC_EXCP_ATTN = 0x100,
> > + /*
> > + * NOTE: POWERPC_EXCP_ATTN uses values from 0x100 to 0x1ff to return
> > + * error codes.
> > + */
> > };
> >
> > #define PPC_INPUT(env) ((env)->bus_model)
> > @@ -2089,6 +2095,8 @@ void ppc_compat_add_property(Object *obj, const char *name,
> > #define HID0_DOZE (1 << 23) /* pre-2.06 */
> > #define HID0_NAP (1 << 22) /* pre-2.06 */
> > #define HID0_HILE PPC_BIT(19) /* POWER8 */
> > +#define HID0_ATTN PPC_BIT(31) /* Processor Attention */
> > +#define HID0_POWER9_ATTN PPC_BIT(3)
> > #define HID0_POWER9_HILE PPC_BIT(4)
> >
> > /*****************************************************************************/
> > diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> > index d3e2cfcd71..b0c629905c 100644
> > --- a/target/ppc/excp_helper.c
> > +++ b/target/ppc/excp_helper.c
> > @@ -1379,6 +1379,9 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)
> > }
> > cs->halted = 1;
> > cpu_interrupt_exittb(cs);
> > + if ((env->error_code & ~0xff) == POWERPC_EXCP_ATTN) {
> > + exit(env->error_code & 0xff);
> > + }
> > }
> > if (env->msr_mask & MSR_HVB) {
> > /*
> > @@ -1971,6 +1974,30 @@ void helper_pminsn(CPUPPCState *env, powerpc_pm_insn_t insn)
> > env->resume_as_sreset = (insn != PPC_PM_STOP) ||
> > (env->spr[SPR_PSSCR] & PSSCR_EC);
> > }
> > +
> > +/*
> > + * Processor Attention instruction (Implementation dependent)
> > + */
> > +void helper_attn(CPUPPCState *env, target_ulong r3)
> > +{
> > + bool attn = false;
> > +
> > + if (env->excp_model == POWERPC_EXCP_POWER8) {
> > + attn = !!(env->spr[SPR_HID0] & HID0_ATTN);
> > + } else if (env->excp_model == POWERPC_EXCP_POWER9 ||
> > + env->excp_model == POWERPC_EXCP_POWER10) {
> > + attn = !!(env->spr[SPR_HID0] & HID0_POWER9_ATTN);
> > + }
>
> The excp_model is not a CPU identifier. This should ideally be a flag
> set during init_proc. Something like HID0_ATTN_P8/HID0_ATTN_P9.
>
> Maybe we should consider adding a hid0_mask similar to lpcr_mask.
I don't think that's a good idea. By definition, the meaning of the
HID registers is model specific - having a hid0_mask would imply it
always has the same meaning, just different bits that are present or
not. I think you want to explicitly dispath to cpu family specific
functions for this.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-03-26 3:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 19:08 [RFC PATCH 0/6] Port PPC64/PowerNV MMU tests to QEMU Leandro Lupori
2022-03-24 19:08 ` [RFC PATCH 1/6] target/ppc: Add support for the Processor Attention instruction Leandro Lupori
2022-03-25 15:11 ` Fabiano Rosas
2022-03-26 3:15 ` David Gibson [this message]
2022-03-26 13:04 ` Richard Henderson
2022-03-28 15:46 ` Cédric Le Goater
2022-03-24 19:08 ` [RFC PATCH 2/6] ppc/pnv: Activate " Leandro Lupori
2022-03-24 19:08 ` [RFC PATCH 3/6] tests/tcg/ppc64: add basic softmmu test support Leandro Lupori
2022-03-24 19:08 ` [RFC PATCH 4/6] tests/tcg: add support for ppc64le softmmu tests Leandro Lupori
2022-03-24 20:34 ` Alex Bennée
2022-03-24 21:11 ` Leandro Lupori
2022-03-25 9:50 ` Alex Bennée
2022-03-31 14:27 ` Leandro Lupori
2022-03-24 19:08 ` [RFC PATCH 5/6] tests/tcg/ppc64: add MMU test sources Leandro Lupori
2022-03-24 19:08 ` [RFC PATCH 6/6] tests/tcg/ppc64: add rules to build PowerNV tests Leandro Lupori
2022-03-26 13:13 ` [RFC PATCH 0/6] Port PPC64/PowerNV MMU tests to QEMU Richard Henderson
2022-03-28 14:54 ` Fabiano Rosas
2022-03-28 14:59 ` Richard Henderson
2022-03-28 16:24 ` 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=Yj6FQubqactWyyNn@yekko \
--to=david@gibson.dropbear.id.au \
--cc=alex.bennee@linaro.org \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=farosas@linux.ibm.com \
--cc=groug@kaod.org \
--cc=leandro.lupori@eldorado.org.br \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.