From: "Nicholas Piggin" <npiggin@gmail.com>
To: "BALATON Zoltan" <balaton@eik.bme.hu>, <qemu-devel@nongnu.org>,
<qemu-ppc@nongnu.org>
Cc: <clg@kaod.org>, "Greg Kurz" <groug@kaod.org>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>
Subject: Re: [PATCH 09/10] target/ppc: Simplify syscall exception handlers
Date: Wed, 14 Jun 2023 14:18:33 +1000 [thread overview]
Message-ID: <CTC3156BMOHL.1CSJOLOF48ZK5@wheely> (raw)
In-Reply-To: <ddb1379de4b3c20e543b37fb18fde5581191af49.1686522199.git.balaton@eik.bme.hu>
On Mon Jun 12, 2023 at 8:42 AM AEST, BALATON Zoltan wrote:
> After previous changes the hypercall handling in 7xx and 74xx
> exception handlers can be folded into one if statement to simpilfy
> this code.
>
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
> ---
> target/ppc/excp_helper.c | 26 ++++++++++----------------
> 1 file changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index 4f6a6dfb19..089417894e 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -738,26 +738,23 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp)
> break;
> case POWERPC_EXCP_SYSCALL: /* System call exception */
> {
> - int lev = env->error_code;
> + PowerPCCPU *cpu = env_archcpu(env);
I prefer to keep lev. Makes sense to combine the tests though
I suppose. Although with powernv it's not really clear that we
want to dump_syscall. dump_hcall is probably better (powernv
could support a non-PAPR hypervisor with different hcall
semantics, but also it could support an OS with different
syscall semantics too). I guess that could be changed back
when necessary though.
Thanks,
Nick
>
> - if (lev == 1 && cpu->vhyp) {
> - dump_hcall(env);
> - } else {
> - dump_syscall(env);
> - }
> /*
> * The Virtual Open Firmware (VOF) relies on the 'sc 1'
> * instruction to communicate with QEMU. The pegasos2 machine
> * uses VOF and the 7xx CPUs, so although the 7xx don't have
> * HV mode, we need to keep hypercall support.
> */
> - if (lev == 1 && cpu->vhyp) {
> + if (unlikely(env->error_code == 1 && cpu->vhyp)) {
> PPCVirtualHypervisorClass *vhc =
> PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
> + dump_hcall(env);
> vhc->hypercall(cpu->vhyp, cpu);
> return;
> + } else {
> + dump_syscall(env);
> }
> -
> break;
> }
> case POWERPC_EXCP_FPU: /* Floating-point unavailable exception */
> @@ -882,26 +879,23 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp)
> break;
> case POWERPC_EXCP_SYSCALL: /* System call exception */
> {
> - int lev = env->error_code;
> + PowerPCCPU *cpu = env_archcpu(env);
>
> - if (lev == 1 && cpu->vhyp) {
> - dump_hcall(env);
> - } else {
> - dump_syscall(env);
> - }
> /*
> * The Virtual Open Firmware (VOF) relies on the 'sc 1'
> * instruction to communicate with QEMU. The pegasos2 machine
> * uses VOF and the 74xx CPUs, so although the 74xx don't have
> * HV mode, we need to keep hypercall support.
> */
> - if (lev == 1 && cpu->vhyp) {
> + if (unlikely(env->error_code == 1 && cpu->vhyp)) {
> PPCVirtualHypervisorClass *vhc =
> PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp);
> + dump_hcall(env);
> vhc->hypercall(cpu->vhyp, cpu);
> return;
> + } else {
> + dump_syscall(env);
> }
> -
> break;
> }
> case POWERPC_EXCP_FPU: /* Floating-point unavailable exception */
> --
> 2.30.9
next prev parent reply other threads:[~2023-06-14 4:19 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-11 22:42 [PATCH 00/10] Misc clean ups to target/ppc exception handling BALATON Zoltan
2023-06-11 22:42 ` [PATCH 01/10] target/ppc: Remove some superfluous parentheses BALATON Zoltan
2023-06-14 3:25 ` Nicholas Piggin
2023-06-11 22:42 ` [PATCH 02/10] target/ppc: Remove unneeded parameter from powerpc_reset_wakeup() BALATON Zoltan
2023-06-14 3:26 ` Nicholas Piggin
2023-06-11 22:42 ` [PATCH 03/10] target/ppc: Move common check in exception handlers to a function BALATON Zoltan
2023-06-12 9:28 ` Philippe Mathieu-Daudé
2023-06-12 10:07 ` BALATON Zoltan
2023-06-14 3:35 ` Nicholas Piggin
2023-06-14 6:25 ` Cédric Le Goater
2023-06-15 1:50 ` Nicholas Piggin
2023-06-11 22:42 ` [PATCH 04/10] target/ppc: Use env_cpu for cpu_abort in excp_helper BALATON Zoltan
2023-06-14 3:36 ` Nicholas Piggin
2023-06-14 10:13 ` BALATON Zoltan
2023-06-15 1:01 ` Nicholas Piggin
2023-06-11 22:42 ` [PATCH 05/10] target/ppc: Change parameter of cpu_interrupt_exittb() to an env pointer BALATON Zoltan
2023-06-11 22:42 ` [PATCH 06/10] target/ppc: Readability improvements in exception handlers BALATON Zoltan
2023-06-14 3:42 ` Nicholas Piggin
2023-06-14 10:07 ` BALATON Zoltan
2023-06-15 0:59 ` Nicholas Piggin
2023-06-11 22:42 ` [PATCH 07/10] target/ppd: Remove unused define BALATON Zoltan
2023-06-12 9:29 ` Philippe Mathieu-Daudé
2023-06-14 3:42 ` Nicholas Piggin
2023-06-11 22:42 ` [PATCH 08/10] target/ppc: Fix gen_sc to use correct nip BALATON Zoltan
2023-06-14 3:47 ` Nicholas Piggin
2023-06-14 10:05 ` BALATON Zoltan
2023-06-14 21:27 ` BALATON Zoltan
2023-06-15 1:43 ` Nicholas Piggin
2023-06-15 23:02 ` BALATON Zoltan
2023-06-11 22:42 ` [PATCH 09/10] target/ppc: Simplify syscall exception handlers BALATON Zoltan
2023-06-14 4:18 ` Nicholas Piggin [this message]
2023-06-14 21:33 ` BALATON Zoltan
2023-06-15 1:47 ` Nicholas Piggin
2023-06-11 22:42 ` [PATCH 10/10] target/ppc: Get CPUState in one step BALATON Zoltan
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=CTC3156BMOHL.1CSJOLOF48ZK5@wheely \
--to=npiggin@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=groug@kaod.org \
--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).