From: David Gibson <david@gibson.dropbear.id.au>
To: "Bruno Larsen (billionai)" <bruno.larsen@eldorado.org.br>
Cc: farosas@linux.ibm.com, richard.henderson@linaro.org,
qemu-devel@nongnu.org, lucas.araujo@eldorado.org.br,
fernando.valle@eldorado.org.br, qemu-ppc@nongnu.org,
matheus.ferst@eldorado.org.br, luis.pires@eldorado.org.br
Subject: Re: [PATCH v2 7/7] target/ppc: wrapped some TCG only logic with ifdefs
Date: Wed, 19 May 2021 12:02:35 +1000 [thread overview]
Message-ID: <YKRxu6mcVAfQJUwo@yekko> (raw)
In-Reply-To: <20210518150515.57983-8-bruno.larsen@eldorado.org.br>
[-- Attachment #1: Type: text/plain, Size: 4153 bytes --]
On Tue, May 18, 2021 at 12:05:15PM -0300, Bruno Larsen (billionai) wrote:
> Wrapped some function calls in cpu_init.c, gdbstub.c, mmu-hash64.c and
> excp_helper.c that were TCG only with ifdef CONFIG_TCG, to support
> building without TCG.
>
> for excp_helper we also moved the function do_rfi higher in the file to
> reduce the ifdef count.
The description's no longer really accurate since some of the fixups
are no longer ifdef based.
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
> target/ppc/cpu_init.c | 16 +++++---
> target/ppc/excp_helper.c | 82 +++++++++++++++++++++++-----------------
> target/ppc/mmu-hash64.c | 8 ++++
> 3 files changed, 66 insertions(+), 40 deletions(-)
>
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index 88a8344eea..5ab4d4ef2b 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -1203,15 +1203,13 @@ static void register_BookE206_sprs(CPUPPCState *env, uint32_t mas_mask,
> /* TLB assist registers */
> /* XXX : not implemented */
> for (i = 0; i < 8; i++) {
> - void (*uea_write)(DisasContext *ctx, int sprn, int gprn) =
> - &spr_write_generic32;
> - if (i == 2 && (mas_mask & (1 << i)) && (env->insns_flags & PPC_64B)) {
> - uea_write = &spr_write_generic;
> - }
> if (mas_mask & (1 << i)) {
> spr_register(env, mas_sprn[i], mas_names[i],
> SPR_NOACCESS, SPR_NOACCESS,
> - &spr_read_generic, uea_write,
> + &spr_read_generic,
> + (i == 2 && (mas_mask & (1 << i)) &&
> + (env->insns_flags & PPC_64B))
> + ? &spr_write_generic : &spr_write_generic32,
Looks good.
> 0x00000000);
> }
> }
> @@ -8605,11 +8603,13 @@ static void ppc_cpu_realize(DeviceState *dev, Error **errp)
> }
> }
>
> +#ifdef CONFIG_TCG
> create_ppc_opcodes(cpu, &local_err);
> if (local_err != NULL) {
> error_propagate(errp, local_err);
> goto unrealize;
> }
> +#endif
In this instance, I think it would be cleaner to create a no-op stub
for create_ppc_opcodes() and destroy_ppc_opcodes() rather than using
ifdefs.
> init_ppc_proc(cpu);
>
> ppc_gdb_init(cs, pcc);
> @@ -8798,7 +8798,9 @@ static void ppc_cpu_unrealize(DeviceState *dev)
>
> cpu_remove_sync(CPU(cpu));
>
> +#ifdef CONFIG_TCG
> destroy_ppc_opcodes(cpu);
> +#endif
> }
>
> static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b)
> @@ -9296,7 +9298,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
> cc->class_by_name = ppc_cpu_class_by_name;
> cc->has_work = ppc_cpu_has_work;
> cc->dump_state = ppc_cpu_dump_state;
> +#ifdef CONFIG_TCG
> cc->dump_statistics = ppc_cpu_dump_statistics;
> +#endif
> cc->set_pc = ppc_cpu_set_pc;
> cc->gdb_read_register = ppc_cpu_gdb_read_register;
> cc->gdb_write_register = ppc_cpu_gdb_write_register;
> diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> index 80bb6e70e9..a14b529722 100644
> --- a/target/ppc/excp_helper.c
> +++ b/target/ppc/excp_helper.c
> @@ -19,9 +19,13 @@
> #include "qemu/osdep.h"
> #include "qemu/main-loop.h"
> #include "cpu.h"
> +#ifdef CONFIG_TCG
> #include "exec/helper-proto.h"
> +#endif
I don't like the look of ifdefs amongst the includes. Generally the
headers themselves should be made safe (if unnecessary) to include for
!TCG builds.
> #include "exec/exec-all.h"
> +#ifdef CONFIG_TCG
> #include "exec/cpu_ldst.h"
> +#endif
> #include "internal.h"
> #include "helper_regs.h"
The remaining ifdef changes look fine. Some it would be nice to clean
up better in future, but there's no rush.
--
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:[~2021-05-19 3:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 15:05 [PATCH v2 0/7] target/ppc: Misc motion to support disabling TCG Bruno Larsen (billionai)
2021-05-18 15:05 ` [PATCH v2 1/7] target/ppc: fix ppc_store_sdr1 for user-only compilation Bruno Larsen (billionai)
2021-05-19 1:54 ` David Gibson
2021-05-18 15:05 ` [PATCH v2 2/7] target/ppc: moved ppc_store_lpcr and ppc_store_msr to cpu.c Bruno Larsen (billionai)
2021-05-18 15:05 ` [PATCH v2 3/7] target/ppc: reduce usage of fpscr_set_rounding_mode Bruno Larsen (billionai)
2021-05-19 15:56 ` Richard Henderson
2021-05-18 15:05 ` [PATCH v2 4/7] target/ppc: overhauled and moved logic of storing fpscr Bruno Larsen (billionai)
2021-05-19 16:05 ` Richard Henderson
2021-05-18 15:05 ` [PATCH v2 5/7] target/ppc: removed unnecessary inclusion of helper-proto.h Bruno Larsen (billionai)
2021-05-19 16:06 ` Richard Henderson
2021-05-18 15:05 ` [PATCH v2 6/7] target/ppc: moved ppc_cpu_do_interrupt to cpu.c Bruno Larsen (billionai)
2021-05-18 15:05 ` [PATCH v2 7/7] target/ppc: wrapped some TCG only logic with ifdefs Bruno Larsen (billionai)
2021-05-19 2:02 ` David Gibson [this message]
2021-05-19 14:29 ` Bruno Piazera Larsen
2021-05-19 16:09 ` Richard Henderson
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=YKRxu6mcVAfQJUwo@yekko \
--to=david@gibson.dropbear.id.au \
--cc=bruno.larsen@eldorado.org.br \
--cc=farosas@linux.ibm.com \
--cc=fernando.valle@eldorado.org.br \
--cc=lucas.araujo@eldorado.org.br \
--cc=luis.pires@eldorado.org.br \
--cc=matheus.ferst@eldorado.org.br \
--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 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).