From: Fabiano Rosas <farosas@linux.ibm.com>
To: Bruno Piazera Larsen <bruno.larsen@eldorado.org.br>,
David Gibson <david@gibson.dropbear.id.au>
Cc: Luis Fernando Fujita Pires <luis.pires@eldorado.org.br>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Lucas Mateus Martins Araujo e Castro
<lucas.araujo@eldorado.org.br>,
Fernando Eckhardt Valle <fernando.valle@eldorado.org.br>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
Matheus Kowalczuk Ferst <matheus.ferst@eldorado.org.br>
Subject: RE: [RFC PATCH 3/4] target/ppc: Move SPR generation to separate file
Date: Wed, 28 Apr 2021 16:45:04 -0300 [thread overview]
Message-ID: <87h7jq2ny7.fsf@linux.ibm.com> (raw)
In-Reply-To: <CP2PR80MB449987FB35CC5BC79CACDAFBC7409@CP2PR80MB4499.lamprd80.prod.outlook.com>
Bruno Piazera Larsen <bruno.larsen@eldorado.org.br> writes:
>> > > +/*****************************************************************************/
>> > > +/* SPR definitions and registration */
>> > > +
>> > > +#ifdef CONFIG_TCG
>> > > +#ifdef CONFIG_USER_ONLY
>> > > +#define spr_register_kvm(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, uea_read, uea_write, initial_value)
>> > > +#define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, \
>> > > + one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, uea_read, uea_write, initial_value)
>> > > +#else /* CONFIG_USER_ONLY */
>> > > +#if !defined(CONFIG_KVM)
>> > > +#define spr_register_kvm(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, oea_read, oea_write, initial_value)
>> > > +#define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, \
>> > > + one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, initial_value)
>> > > +#else /* !CONFIG_KVM */
>> > > +#define spr_register_kvm(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, oea_read, oea_write, \
>> > > + one_reg_id, initial_value)
>> > > +#define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, \
>> > > + one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, \
>> > > + one_reg_id, initial_value)
>> > > +#endif /* !CONFIG_KVM */
>> > > +#endif /* CONFIG_USER_ONLY */
>> > > +#else /* CONFIG_TCG */
>> > > +#ifdef CONFIG_KVM /* sanity check */
>> > > +#define spr_register_kvm(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, one_reg_id, initial_value)
>> > > +#define spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, \
>> > > + one_reg_id, initial_value) \
>> > > + _spr_register(env, num, name, one_reg_id, initial_value)
>> > > +#else /* CONFIG_KVM */
>> > > +#error "Either TCG or KVM should be configured"
>> > > +#endif /* CONFIG_KVM */
>> > > +#endif /*CONFIG_TCG */
>> > > +
>> > > +#define spr_register(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, initial_value) \
>> > > + spr_register_kvm(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, 0, initial_value)
>> > > +
>> > > +#define spr_register_hv(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, \
>> > > + initial_value) \
>> > > + spr_register_kvm_hv(env, num, name, uea_read, uea_write, \
>> > > + oea_read, oea_write, hea_read, hea_write, \
>> > > + 0, initial_value)
>> >
>> > This change is crucial for this to work, we don't want it buried along
>> > with all of the code movement. It should be clearly described and in
>> > it's own patch at the top of the series.
>> >
>> > If you add this change, plus some #ifdef TCG around the spr callbacks,
>> > it should already be possible to compile this with disable-tcg. It would
>> > also make the series as a whole easier to understand.
>
> if we added this and removed TCG only files from meson.build it might
> compile already (not sure, I think there were a couple of things that
> used mmu functions),
I'm just pointing out that the set of changes needed to compile
translate_init.c.inc with disable-tcg is actually pretty small. Sure, we
want to move some stuff around and have new files and whatnot to make
the code easier to read/more maintainable, etc. But none of that is
strictly required.
> but wouldn't there be way too many ifdefs in that case?
> The R/W callbacks are spread all around the file, and we'd have to ifdef around
> some .h files that are included in common files.
Right, but it is easier to review only the macro change plus some
ifdefs. Once we are sure the change is correct and the ifdefs select the
right code, any follow-up patch that only moves things to another file
will be trivial. And if the first patch gets too silly we can always
squash them before merging, no worries.
>
> Bruno Piazera Larsen
>
> Instituto de Pesquisas ELDORADO<http://clickemailmkt.eldorado.org.br/ls/click?upn=UPoxpeIcHnAcbUZyo7TTaswyiVb1TXP3jEbQqiiJKKGsxOn8hBEs5ZsMLQfXkKuKXZ7MVDg0ij9eG8HV4TXI75dBzDiNGLxQ8Xx5PzCVNt6TpGrzBbU-2Biu0o69X5ce-2FW-2FOk1uUipuK0fZnWXJEgbRw-3D-3DJY4T_wWk-2BG6VvNBoa1YzxYjhCdFS9IfANIaBzDSklR1NyyrKOI1wj0P-2BdBFcuO4FnHcsA1MyHu0ly1Yt3oDMp7KKdJPM68iKuI2jiRH5v4B0d8wf3chU3qy5n5iXWnW1QjSaNFHOgELzxaP-2FnesTeBgJ5dFkjH4f279sVQpOtyjw5xAqj34M6pgNRAxVvuXif4IWDcVzXg1FzfYlEfkKzr9vvpA3Hg8kitwMtlU3zwbQUBCgL30fQoJPcRPMGKyOY8RmoAlXNqTJYDYIvqmfnI7KLUvw6vKB5R-2B5q1FJRAzX7H-2BmF0NnDET6jMLuIqtCcVIch>
>
> Departamento Computação Embarcada
>
> Analista de Software Trainee
>
> Aviso Legal - Disclaimer<https://www.eldorado.org.br/disclaimer.html>
next prev parent reply other threads:[~2021-04-28 19:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-28 14:47 [RFC PATCH 3/4] target/ppc: Move SPR generation to separate file Bruno Piazera Larsen
2021-04-28 19:45 ` Fabiano Rosas [this message]
2021-04-29 4:24 ` David Gibson
-- strict thread matches above, loose matches on Subject: below --
2021-04-23 19:18 [RFC PATCH 0/4] target/ppc: code motion to compile translate_init Bruno Larsen (billionai)
2021-04-23 19:18 ` [RFC PATCH 3/4] target/ppc: Move SPR generation to separate file Bruno Larsen (billionai)
2021-04-26 21:08 ` Fabiano Rosas
2021-04-27 3:35 ` 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=87h7jq2ny7.fsf@linux.ibm.com \
--to=farosas@linux.ibm.com \
--cc=bruno.larsen@eldorado.org.br \
--cc=david@gibson.dropbear.id.au \
--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 \
/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).