On Fri, Sep 26, 2014 at 05:09:06PM +0200, Paolo Bonzini wrote: > Il 29/08/2014 22:31, Eduardo Habkost ha scritto: > > This makes explicit the fact that the method is for machine > > initialization, not just for accelerator object initialization. > > No, it is not for machine initialization. It just picks defaults if > necessary from the passed machine class.
The problem is that lots of the accelerator initialization code changes global state or machine state. But I want to be able to create accelerator objects usable for probing without affecting any global/machine state. The use case I have in mind is to return accelerator-specific runnable/features information when listing CPU model information. My plan here is to split accelerator initialization into: * instance_init(), which won't affect any machine/global state, and can be safely run multiple times; * machine_init(), which may affect machine/global state. In a perfect world, machine_init() wouldn't even exist because accelerators would never affect machine/global state, but we are a long way from that. -- Eduardo