From: Claudio Fontana <cfontana@suse.de>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"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 15:00:18 +0100 [thread overview]
Message-ID: <14103764-c4d9-e712-47d0-ff8123eef9d4@suse.de> (raw)
In-Reply-To: <8ca3a983-05ad-a0de-31e9-65b6c41a2b4c@suse.de>
On 3/12/21 2:40 PM, Claudio Fontana wrote:
> On 3/12/21 1:02 PM, Paolo Bonzini wrote:
>> On 12/03/21 12:51, Claudio Fontana wrote:
>>> seems to me we already have, as the accel class init, fe, for x86/tcg:
>>>
>>> static void tcg_cpu_accel_class_init(ObjectClass *oc, void *data)
>>> {
>>> AccelCPUClass *acc = ACCEL_CPU_CLASS(oc);
>>>
>>> #ifndef CONFIG_USER_ONLY
>>> acc->cpu_realizefn = tcg_cpu_realizefn;
>>> #endif /* CONFIG_USER_ONLY */
>>>
>>> acc->cpu_class_init = tcg_cpu_class_init;
>>> acc->cpu_instance_init = tcg_cpu_instance_init;
>>> }
>>>
>>> acc->cpu_class_init() call would then be the acc->init_cpu call you mention.
>>>
>>> The only thing we seem to be missing is the cc->init_tcg_ops(cc)..
>>
>> Yes, called by tcg_cpu_class_init or tcg_cpu_instance_init.
>>
>> Paolo
>>
>>
>
> .. I wonder if we should make it a bit more general like:
>
> static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
> {
> CPUClass *cc = CPU_CLASS(klass);
> AccelCPUClass *accel_cpu = opaque;
>
> /*
> * double dispatch. The first callback allows the accel cpu
> * to run initializations for the CPU,
> * the second one allows the CPU to customize the accel cpu
> * behavior according to the CPU.
> *
> * The second is currently only used by TCG, to specialize the
> * TCGCPUOps depending on the CPU type.
> */
> cc->accel_cpu = accel_cpu;
> if (accel_cpu->cpu_class_init) {
> accel_cpu->cpu_class_init(cc);
> }
> if (cc->init_accel_cpu) {
> cc->init_accel_cpu(accel_cpu, cc);
> }
> }
>
> .. but maybe this is premature, and should wait for actual users of this beyond TCG on ARM?
>
> Ciao,
>
> C
>
I'll put my experiment in the ARM cleanup series.
Ciao and thanks,
Claudio
next prev parent reply other threads:[~2021-03-12 14:35 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
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 [this message]
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=14103764-c4d9-e712-47d0-ff8123eef9d4@suse.de \
--to=cfontana@suse.de \
--cc=ehabkost@redhat.com \
--cc=pbonzini@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).