|
From: | Paolo Bonzini |
Subject: | Re: all class init functions for all types in QEMU are called in select_machine(). Expected? |
Date: | Fri, 12 Mar 2021 11:07:26 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
On 12/03/21 10:58, Claudio Fontana wrote:
Not really, but I have been using the accel class init function on x86 to register the TCG OPS, and this instead requires a bit more thought for ARM, because we currently register for the ARM M Profile the TCG Ops at arm_v7m_class_init time, which is called already at select_machine() time, so when we select the accelerator, and we call the tcg_cpu_class_init, we run the risk of overriding the existing tcg_ops Ideas? Looks horrible?
Not horrible, but wrong. The class_init function must be idempotent: classes have no side effect until they're instantiated (and even then, usually we delay that to later, e.g. realized for devices or complete for user-creatable objects).
Why can't you register ops in the machine init function for the accelerator? Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |