From: "Cédric Le Goater" <clg@kaod.org>
To: Fabiano Rosas <farosas@linux.ibm.com>, <qemu-devel@nongnu.org>
Cc: danielhb413@gmail.com, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Subject: Re: [PATCH 2/4] target/ppc: powerpc_excp: Move common code to the caller function
Date: Tue, 8 Feb 2022 10:12:24 +0100 [thread overview]
Message-ID: <67b4a230-86ec-e214-f074-0e93221c766c@kaod.org> (raw)
In-Reply-To: <20220207183036.1507882-3-farosas@linux.ibm.com>
On 2/7/22 19:30, Fabiano Rosas wrote:
> Make the cpu-specific powerpc_excp_* functions a bit simpler by moving
> the bounds check and logging to powerpc_excp.
>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Thanks,
C.
> ---
> target/ppc/excp_helper.c | 57 +++++++---------------------------------
> 1 file changed, 9 insertions(+), 48 deletions(-)
>
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index c6646503aa..206314aaa2 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -396,14 +396,6 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp)
> target_ulong msr, new_msr, vector;
> int srr0, srr1;
>
> - if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
> - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
> - }
> -
> - qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
> - " => %s (%d) error=%02x\n", env->nip, powerpc_excp_name(excp),
> - excp, env->error_code);
> -
> /* new srr1 value excluding must-be-zero bits */
> msr = env->msr & ~0x783f0000ULL;
>
> @@ -554,14 +546,6 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp)
> CPUPPCState *env = &cpu->env;
> target_ulong msr, new_msr, vector;
>
> - if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
> - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
> - }
> -
> - qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
> - " => %s (%d) error=%02x\n", env->nip, powerpc_excp_name(excp),
> - excp, env->error_code);
> -
> /* new srr1 value excluding must-be-zero bits */
> msr = env->msr & ~0x783f0000ULL;
>
> @@ -746,14 +730,6 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp)
> CPUPPCState *env = &cpu->env;
> target_ulong msr, new_msr, vector;
>
> - if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
> - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
> - }
> -
> - qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
> - " => %s (%d) error=%02x\n", env->nip, powerpc_excp_name(excp),
> - excp, env->error_code);
> -
> /* new srr1 value excluding must-be-zero bits */
> msr = env->msr & ~0x783f0000ULL;
>
> @@ -926,14 +902,6 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp)
> CPUPPCState *env = &cpu->env;
> target_ulong msr, new_msr, vector;
>
> - if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
> - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
> - }
> -
> - qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
> - " => %s (%d) error=%02x\n", env->nip, powerpc_excp_name(excp),
> - excp, env->error_code);
> -
> /* new srr1 value excluding must-be-zero bits */
> msr = env->msr & ~0x783f0000ULL;
>
> @@ -1121,14 +1089,6 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int excp)
> target_ulong msr, new_msr, vector;
> int srr0, srr1;
>
> - if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
> - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
> - }
> -
> - qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
> - " => %s (%d) error=%02x\n", env->nip, powerpc_excp_name(excp),
> - excp, env->error_code);
> -
> msr = env->msr;
>
> /*
> @@ -1348,14 +1308,6 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)
> target_ulong msr, new_msr, vector;
> int srr0, srr1, lev = -1;
>
> - if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
> - cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
> - }
> -
> - qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
> - " => %s (%d) error=%02x\n", env->nip, powerpc_excp_name(excp),
> - excp, env->error_code);
> -
> /* new srr1 value excluding must-be-zero bits */
> msr = env->msr & ~0x783f0000ULL;
>
> @@ -1642,8 +1594,17 @@ static inline void powerpc_excp_books(PowerPCCPU *cpu, int excp)
>
> static void powerpc_excp(PowerPCCPU *cpu, int excp)
> {
> + CPUState *cs = CPU(cpu);
> CPUPPCState *env = &cpu->env;
>
> + if (excp <= POWERPC_EXCP_NONE || excp >= POWERPC_EXCP_NB) {
> + cpu_abort(cs, "Invalid PowerPC exception %d. Aborting\n", excp);
> + }
> +
> + qemu_log_mask(CPU_LOG_INT, "Raise exception at " TARGET_FMT_lx
> + " => %s (%d) error=%02x\n", env->nip, powerpc_excp_name(excp),
> + excp, env->error_code);
> +
> switch (env->excp_model) {
> case POWERPC_EXCP_40x:
> powerpc_excp_40x(cpu, excp);
>
next prev parent reply other threads:[~2022-02-08 10:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 18:30 [PATCH 0/4] target/ppc: powerpc_excp improvements (9/9) Fabiano Rosas
2022-02-07 18:30 ` [PATCH 1/4] target/ppc: Remove powerpc_excp_legacy Fabiano Rosas
2022-02-08 2:28 ` David Gibson
2022-02-08 9:11 ` Cédric Le Goater
2022-02-07 18:30 ` [PATCH 2/4] target/ppc: powerpc_excp: Move common code to the caller function Fabiano Rosas
2022-02-08 9:12 ` Cédric Le Goater [this message]
2022-02-07 18:30 ` [PATCH 3/4] target/ppc: Assert if MSR bits differ from msr_mask during exceptions Fabiano Rosas
2022-02-07 18:30 ` [PATCH 4/4] target/ppc: books: Remove excp_model argument from ppc_excp_apply_ail Fabiano Rosas
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=67b4a230-86ec-e214-f074-0e93221c766c@kaod.org \
--to=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=farosas@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.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).