From: Paolo Bonzini <pbonzini@redhat.com>
To: "Claudio Fontana" <cfontana@suse.de>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: all class init functions for all types in QEMU are called in select_machine(). Expected?
Date: Fri, 12 Mar 2021 11:39:23 +0100 [thread overview]
Message-ID: <26c2b88b-4c9e-09a0-a1c0-350a01e9a697@redhat.com> (raw)
In-Reply-To: <3b7c6a4e-c191-063c-affa-0e179227a633@suse.de>
On 12/03/21 11:25, Claudio Fontana wrote:
> We can register them from there if needed I think,, but where ever we
> do it, we still have to point to the one set of ops or the other,
> depending on the cpu model that is finally chosen.
>
> So when we attach the tcg cpu accelerator object to the cpu, we
> currently should check which cpu it is, and behave accordingly.
>
> Maybe this is better? Ie, not set the tcg ops in different places (in
> the v7m cpu class init and in the tcg cpu accel init),
>
> but rather set them just in a single place, when we attach the accel
> cpu object, checking which cpu profile it is somehow (TBD), and then
> behave accordingly?
Take a look at
https://wiki.qemu.org/User:Paolo_Bonzini/Machine_init_sequence#Basic_phases.
The phases are:
- creating backends (PHASE_NO_MACHINE)
- creating machine (after which PHASE_MACHINE_CREATED is entered)
- creating accelerator (after which PHASE_ACCEL_CREATED is entered)
- initializing embedded devices (in machine_run_board_init, after which
PHASE_MACHINE_INITIALIZED is entered), including CPUs
- creating devices (in qmp_x_exit_preconfig, after which
PHASE_MACHINE_READY is entered)
And the last is where the guest actually starts.
I think that you should have a callback in the accelerator that runs
after -cpu is processed and before PHASE_MACHINE_INITIALIZED is entered.
So the right place to add it would be machine_run_board_init.
Maybe some kind of double dispatch, where the accelerator has an
acc->init_cpu(acc, cc) method and the CPU has a cc->init_tcg_ops(cc)
method. Then TCG's init_cpu calls into the latter.
Paolo
next prev parent reply other threads:[~2021-03-12 10:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 9:31 all class init functions for all types in QEMU are called in select_machine(). Expected? Claudio Fontana
2021-03-12 9:45 ` Philippe Mathieu-Daudé
2021-03-12 9:58 ` Claudio Fontana
2021-03-12 10:07 ` Paolo Bonzini
2021-03-12 10:25 ` Claudio Fontana
2021-03-12 10:39 ` Paolo Bonzini [this message]
2021-03-12 11:51 ` Claudio Fontana
2021-03-12 12:02 ` Paolo Bonzini
2021-03-12 13:40 ` Claudio Fontana
2021-03-12 14:00 ` Claudio Fontana
2021-03-12 17:04 ` Paolo Bonzini
2021-03-12 17:24 ` Claudio Fontana
2021-03-12 17:30 ` Paolo Bonzini
2021-03-12 9:46 ` Paolo Bonzini
2021-03-12 9:49 ` Claudio Fontana
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=26c2b88b-4c9e-09a0-a1c0-350a01e9a697@redhat.com \
--to=pbonzini@redhat.com \
--cc=cfontana@suse.de \
--cc=ehabkost@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@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).