From: David Gibson <david@gibson.dropbear.id.au>
To: Fabiano Rosas <farosas@linux.ibm.com>
Cc: bruno.larsen@eldorado.org.br,
"Lucas Mateus Castro \(alqotel\)" <lucas.araujo@eldorado.org.br>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH v2 2/2] hw/ppc: Moved TCG code to spapr_hcall_tcg
Date: Mon, 3 May 2021 14:35:37 +1000 [thread overview]
Message-ID: <YI99ma3RbAOPlvt7@yekko> (raw)
In-Reply-To: <87wnsj1gyq.fsf@linux.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3707 bytes --]
On Fri, Apr 30, 2021 at 08:38:05PM -0300, Fabiano Rosas wrote:
> "Lucas Mateus Castro (alqotel)" <lucas.araujo@eldorado.org.br> writes:
>
> > Also spapr_hcall_tcg.c only has 2 duplicated functions (valid_ptex and
> > is_ram_address), what is the advised way to deal with these
> > duplications?
>
> valid_ptex is only needed by the TCG hcalls isn't it?
>
> is_ram_address could in theory stay where it is but be exposed via
> hw/ppc/spapr.h since spapr_hcall.c will always be present.
>
> > Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
> > ---
> > hw/ppc/meson.build | 3 +
> > hw/ppc/spapr_hcall.c | 300 ++--------------------------------
> > hw/ppc/spapr_hcall_tcg.c | 343 +++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 363 insertions(+), 283 deletions(-)
> > create mode 100644 hw/ppc/spapr_hcall_tcg.c
>
> <snip>
>
> > @@ -2021,14 +1752,17 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
> >
> > static void hypercall_register_types(void)
> > {
> > +
> > +#ifndef CONFIG_TCG
> > /* hcall-pft */
> > - spapr_register_hypercall(H_ENTER, h_enter);
> > - spapr_register_hypercall(H_REMOVE, h_remove);
> > - spapr_register_hypercall(H_PROTECT, h_protect);
> > - spapr_register_hypercall(H_READ, h_read);
> > + spapr_register_hypercall(H_ENTER, h_tcg_only);
> > + spapr_register_hypercall(H_REMOVE, h_tcg_only);
> > + spapr_register_hypercall(H_PROTECT, h_tcg_only);
> > + spapr_register_hypercall(H_READ, h_tcg_only);
> >
> > /* hcall-bulk */
> > - spapr_register_hypercall(H_BULK_REMOVE, h_bulk_remove);
> > + spapr_register_hypercall(H_BULK_REMOVE, h_tcg_only);
> > +#endif /* !CONFIG_TCG */
>
> My suggestion for this was:
>
> #ifndef CONFIG_TCG
> static target_ulong h_tcg_only(PowerPCCPU *cpu, SpaprMachineState *spapr,
> target_ulong opcode, target_ulong *args)
> {
> g_assert_not_reached();
> }
>
> static void hypercall_register_tcg(void)
> {
> spapr_register_hypercall(H_ENTER, h_tcg_only);
> spapr_register_hypercall(H_REMOVE, h_tcg_only);
> spapr_register_hypercall(H_PROTECT, h_tcg_only);
> spapr_register_hypercall(H_READ, h_tcg_only);
> (...)
> }
> #endif
>
> static void hypercall_register_types(void)
> {
> hypercall_register_tcg();
>
> <register KVM hcalls>
> }
> type_init(hypercall_register_types);
Eh, swings and roundabouts. Either of these approaches is fine.
> > +static void hypercall_register_types(void)
> > +{
> > + /* hcall-pft */
> > + spapr_register_hypercall(H_ENTER, h_enter);
> > + spapr_register_hypercall(H_REMOVE, h_remove);
> > + spapr_register_hypercall(H_PROTECT, h_protect);
> > + spapr_register_hypercall(H_READ, h_read);
> > +
> > + /* hcall-bulk */
> > + spapr_register_hypercall(H_BULK_REMOVE, h_bulk_remove);
> > +}
> > +
> > +type_init(hypercall_register_types)
>
> And here:
>
> void hypercall_register_tcg(void)
> {
> /* hcall-pft */
> spapr_register_hypercall(H_ENTER, h_enter);
> spapr_register_hypercall(H_REMOVE, h_remove);
> spapr_register_hypercall(H_PROTECT, h_protect);
> spapr_register_hypercall(H_READ, h_read);
> (...)
> }
>
> Because the TCG and KVM builds are not mutually exlusive, so you would
> end up calling type_init twice (which I don't know much about but I
> assume is not allowed).
>
--
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-03 4:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-30 18:40 [RFC PATCH v2 0/2] hw/ppc: code motion to compile without TCG Lucas Mateus Castro (alqotel)
2021-04-30 18:40 ` [RFC PATCH v2 1/2] target/ppc: Moved functions out of mmu-hash64 Lucas Mateus Castro (alqotel)
2021-04-30 20:19 ` Fabiano Rosas
2021-05-03 4:24 ` David Gibson
2021-05-05 17:30 ` Lucas Mateus Martins Araujo e Castro
2021-05-06 2:03 ` David Gibson
2021-04-30 18:40 ` [RFC PATCH v2 2/2] hw/ppc: Moved TCG code to spapr_hcall_tcg Lucas Mateus Castro (alqotel)
2021-04-30 23:38 ` Fabiano Rosas
2021-05-03 4:35 ` David Gibson [this message]
2021-05-03 4:34 ` David Gibson
2021-05-04 18:14 ` Lucas Mateus Martins Araujo e Castro
2021-05-05 4:58 ` David Gibson
2021-04-30 18:54 ` [RFC PATCH v2 0/2] hw/ppc: code motion to compile without TCG no-reply
2021-05-03 22:21 ` Fabiano Rosas
2021-05-04 14:43 ` Bruno Piazera Larsen
2021-05-04 15:57 ` Lucas Mateus Martins Araujo e Castro
2021-05-05 4:42 ` David Gibson
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=YI99ma3RbAOPlvt7@yekko \
--to=david@gibson.dropbear.id.au \
--cc=bruno.larsen@eldorado.org.br \
--cc=farosas@linux.ibm.com \
--cc=lucas.araujo@eldorado.org.br \
--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).