Hello, This series is one of the missing puzzle pieces to allow using device_add for CPU hotplug mentioned on yesterdays's KVM call.
Historically, CPUs are created through cpu_init() macro aliased to cpu_<arch>_init() functions. Since v1.1 these all create a QOM object and then somehow "fiddle" with it as before. QOM realize allows us to make some of this code accessible to DeviceClass so that the existing device infrastructure can invoke it. Most importantly this is needed to actually initialize the TCG thread / KVM vCPU. :) I do not consider this Soft Freeze material and would like to queue this on my qom-cpu-next branch for v1.5. Only partially tested so far. alpha and unicore32 are still lacking a CPUClass::reset implementation. Once all are implemented, the cpu_reset() call would be moved to qom/cpu.c, and all target CPU realizefns would need to call the base type's realizefn, as done for CPUClass::reset today. As next step I intend to pull the realized = true bit out of cpu_init(), with *-user setting realized = true after cpu_init() and vl.c iterating over the CPUs in the final central location, before machine reset. Regards, Andreas Changes from sh4 subclasses series: * Adopted QOM realizefn signature, dropped error.h inclusion. Cc: Anthony Liguori <anth...@codemonkey.ws> Cc: Eduardo Habkost <ehabk...@redhat.com> Cc: Igor Mammedov <imamm...@redhat.com> Cc: Richard Henderson <r...@twiddle.net> (alpha, s390) Cc: Peter Maydell <peter.mayd...@linaro.org> (arm) Cc: Edgar E. Iglesias <edgar.igles...@gmail.com> (cris, microblaze) Cc: Michael Walle <mich...@walle.cc> (lm32) Cc: Aurélien Jarno <aurel...@aurel32.net> (mips, sh4) Cc: Alexander Graf <ag...@suse.de> (ppc, s390) Cc: qemu-ppc <qemu-...@nongnu.org> Cc: Blue Swirl <blauwir...@gmail.com> (sparc) Cc: Guan Xuetao <g...@mprc.pku.edu.cn> (unicore32) Cc: Max Filippov <jcmvb...@gmail.com> (xtensa) Cc: Jia Liu <pro...@gmail.com> (openrisc) Andreas Färber (15): target-alpha: Update CPU to QOM realizefn target-arm: Update CPU to QOM realizefn target-i386: Update CPU to QOM realizefn target-openrisc: Update CPU to QOM realizefn target-ppc: Update CPU to QOM realizefn target-cris: Introduce QOM realizefn for CRISCPU target-lm32: Introduce QOM realizefn for LM32CPU target-m68k: Introduce QOM realizefn for M68kCPU target-microblaze: Introduce QOM realizefn for MicroBlazeCPU target-mips: Introduce QOM realizefn for MIPSCPU target-s390x: Introduce QOM realizefn for S390CPU target-sh4: Introduce QOM realizefn for SuperHCPU target-sparc: Introduce QOM realizefn for SPARCCPU target-unicore32: Introduce QOM realizefn for UniCore32CPU target-xtensa: Introduce QOM realizefn for XtensaCPU target-alpha/cpu.c | 15 +++++++++++---- target-arm/cpu-qom.h | 1 - target-arm/cpu.c | 15 ++++++++------- target-arm/helper.c | 7 ++++--- target-cris/cpu.c | 11 +++++++++++ target-cris/translate.c | 3 +-- target-i386/cpu-qom.h | 3 --- target-i386/cpu.c | 7 +++++-- target-i386/helper.c | 2 +- target-lm32/cpu.c | 14 ++++++++++++-- target-lm32/helper.c | 4 ++-- target-m68k/cpu.c | 11 +++++++++++ target-m68k/helper.c | 3 +-- target-microblaze/cpu.c | 11 +++++++++++ target-microblaze/translate.c | 3 +-- target-mips/cpu.c | 11 +++++++++++ target-mips/translate.c | 5 +++-- target-openrisc/cpu.c | 9 ++++++--- target-openrisc/cpu.h | 2 -- target-ppc/translate_init.c | 9 ++++++--- target-s390x/cpu.c | 10 ++++++++++ target-s390x/helper.c | 4 +++- target-sh4/cpu.c | 11 +++++++++++ target-sh4/translate.c | 5 +++-- target-sparc/cpu.c | 13 ++++++++++++- target-unicore32/cpu.c | 15 +++++++++++++++ target-unicore32/helper.c | 2 +- target-xtensa/cpu.c | 10 ++++++++++ target-xtensa/helper.c | 4 +++- 29 Dateien geändert, 173 Zeilen hinzugefügt(+), 47 Zeilen entfernt(-) -- 1.7.10.4