Hello, Based on my CPUState patches for 1.1 (qom-cpu-1.1) this series kills off the cpu_state_reset() function, which had been renamed as an interim solution to free the identifier "cpu_reset" for QOM.
The interested observer may note that the earlier sh4 SH7750 patches (that have been deferred due to time constraints for 1.1) were a test run and serve as template for propagating xxxCPU throughout the code base: (i) In target-specific code, accessing CPUxxxState* is a cheap pointer dereference from xxxCPU (&cpu->env), so xxxCPU should be preferred for any static helper functions and QOM/qdev state structs because fields in CPUState and in xxxCPU will increase over time. In state structs this also paves the way for QOM child<> or link<> properties. (ii) In TCG helpers, the target's xxxCPU can be obtained via xxx_env_get_cpu(). Be aware that this incurs one QOM cast. (iii) In generic code, the base CPU can be obtained via ENV_GET_CPU() macro. Note that this incurs two QOM casts, so local variables should be preferred over repeated macro usage within a function. (iv) In generic functions, only after all usages of env have been eliminated can the argument be changed from CPUArchState to CPUState. (v) Opaque xxxCPU* values are assigned directly to xxxCPU*, to save QOM casts; to CPUState* via CPU() cast, in case the casting mechanism ever gets changed. Historically, this series has been cherry-picked from a larger CPUState refactoring (guess why) and reordered to group subsystems and to enforce get, pass, use order. I had checked v1 to compile on ... * openSUSE 12.1 x86_64 w/KVM, * openSUSE Factory ppc w/KVM (with the AREG0 #error suppressed), * mingw32/64 cross-builds, * OpenBSD 5.1 amd64. Thus I'm confident that I got order, return types and local variables right; changes to opaque values however (keyword "pass") should be reviewed carefully. v2 fixes the changed cpu_init macros to return NULL if CPU init failed. Again, target maintainers are requested to start queuing their patches on their -next branches, where available, to avoid collisions. I've been careful to verbosely document which change is for what; the targets are not interdependent except for the final patch, neither is linux-user. PReP patches depend on target-ppc, so should go through the ppc tree please. Only target-mips actually depends on a 1.1 patch (the comment drop). Some logical next steps that were not strictly necessary for cpu_reset() have been deferred to part 4, including s390x and some more pxa2xx refactorings. Available for testing and cherry-picking (not pulling!) from: git://github.com/afaerber/qemu-cpu.git qom-cpu-reset.v2 https://github.com/afaerber/qemu-cpu/commits/qom-cpu-reset.v2 Regards, Andreas Cc: Anthony Liguori <anth...@codemonkey.ws> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Igor Mammedov <imamm...@redhat.com> Cc: Peter Maydell <peter.mayd...@linaro.org> Cc: Alexander Graf <ag...@suse.de> Cc: qemu-ppc <qemu-...@nongnu.org> Cc: Blue Swirl <blauwir...@gmail.com> Cc: Edgar E. Iglesias <edgar.igles...@gmail.com> Cc: Max Filippov <jcmvb...@gmail.com> Cc: Michael Walle <mich...@walle.cc> Cc: Aurelien Jarno <aurel...@aurel32.net> Cc: Richard Henderson <r...@twiddle.net> Cc: Riku Voipio <riku.voi...@iki.fi> v1 -> v2: * Handle cpu_xxx_init() failure gracefully by replacing the cpu_init() macros with static inline functions checking the return value. Reported by Peter. Andreas Färber (74): target-arm: Use cpu_reset() in cpu_arm_init() target-mips: Use cpu_reset() in cpu_mips_init() target-i386: Pass X86CPU to do_cpu_{init,sipi}() target-i386: Let cpu_x86_init() return X86CPU pc: Use cpu_x86_init() to obtain X86CPU pc: Pass X86CPU to pc_cpu_reset() target-sparc: Let cpu_sparc_init() return SPARCCPU sun4m: Use cpu_sparc_init() to obtain SPARCCPU sun4m: Pass SPARCCPU to {main,secondary}_cpu_reset() sun4u: Use cpu_sparc_init() to obtain SPARCCPU sun4u: Let cpu_devinit() return SPARCCPU sun4u: Store SPARCCPU in ResetData leon3: Use cpu_sparc_init() to obtain SPARCCPU leon3: Store SPARCCPU in ResetData target-ppc: Let cpu_ppc_init() return PowerPCCPU ppce500_mpc8544ds: Pass PowerPCCPU to mpc8544ds_cpu_reset[_sec] spapr: Use cpu_ppc_init() to obtain PowerPCCPU spapr: Pass PowerPCCPU to spapr_cpu_reset() ppc440_bamboo: Use cpu_ppc_init() to obtain PowerPCCPU ppc440_bamboo: Pass PowerPCCPU to main_cpu_reset() ppc4xx_devs: Use cpu_ppc_init() to obtain PowerPCCPU ppc4xx_devs: Pass PowerPCCPU to ppc4xx_reset() ppc_newworld: Use cpu_ppc_init() to obtain PowerPCCPU ppc_newworld: Pass PowerPCCPU to ppc_core99_reset() ppc_oldworld: Use cpu_ppc_init() to obtain PowerPCCPU ppc_oldworld: Pass PowerPCCPU to ppc_heathrow_reset() ppc_prep: Use cpu_ppc_init() to obtain PowerPCCPU ppc_prep: Pass PowerPCCPU to ppc_prep_reset() virtex_ml507: Use cpu_ppc_init() to obtain PowerPCCPU virtex_ml507: Let ppc440_init_xilinx() return PowerPCCPU virtex_ml507: Pass PowerPCCPU to main_cpu_reset() cpu-exec: Use cpu_reset() in cpu_exec() for TARGET_PPC pxa2xx: Use cpu_arm_init() and store ARMCPU omap: Use cpu_arm_init() to store ARMCPU in omap_mpu_state_s armv7m: Use cpu_arm_init() to obtain ARMCPU armv7m: Pass ARMCPU to armv7m_reset() arm_boot: Pass ARMCPU to do_cpu_reset() target-sh4: Let cpu_sh4_init() return SuperHCPU r2d: Use cpu_sh4_init() to obtain SuperHCPU r2d: Store SuperHCPU in ResetData target-lm32: Let cpu_lm32_init() return LM32CPU lm32_boards: Use cpu_lm32_init() to obtain LM32CPU lm32_boards: Store LM32CPU in ResetInfo milkymist: Use cpu_lm32_init() to obtain LM32CPU milkymist: Store LM32 in ResetInfo target-xtensa: Let cpu_xtensa_init() return XtensaCPU xtensa_sim: Use cpu_xtensa_init() to obtain XtensaCPU xtensa_sim: Pass XtensaCPU to sim_reset() xtensa_lx60: Use cpu_xtensa_init() to obtain XtensaCPU xtensa_lx60: Pass XtensaCPU to lx60_reset() target-cris: Reindent cpu_cris_init() target-cris: Let cpu_cris_init() return CRISCPU axis_dev88: Use cpu_cris_init() to obtain CRISCPU cris-boot: Pass CRISCPU to cris_load_image() cris-boot: Pass CRISCPU to main_cpu_reset(). target-microblaze: Let cpu_mb_init() return MicroBlazeCPU petalogix_ml605: Use cpu_mb_init() to obtain MicroBlazeCPU petalogix_s3adsp1800_mmu: Use cpu_mb_init() to obtain MicroBlazeCPU microblaze_boot: Pass MicroBlazeCPU to microblaze_load_kernel() target-mips: Use cpu_reset() in do_interrupt() target-mips: Let cpu_mips_init() return MIPSCPU mips_fulong2e: Use cpu_mips_cpu() to obtain MIPSCPU mips_fulong2e: Pass MIPSCPU to main_cpu_reset() mips_jazz: Use cpu_mips_init() to obtain MIPSCPU mips_jazz: Pass MIPSCPU to main_cpu_reset() mips_malta: Use cpu_mips_init() to obtain MIPSCPU mips_malta: Pass MIPSCPU to main_cpu_reset() mips_mipssim: Use cpu_mips_init() to obtain MIPSCPU mips_mipssim: Store MIPSCPU in ResetData mips_r4k: Use cpu_mips_init() to obtain MIPSCPU mips_r4k: Store MIPSCPU in ResetData bsd-user: Use cpu_reset() in after cpu_init() linux-user: Use cpu_reset() after cpu_init() / cpu_copy() Kill off cpu_state_reset() bsd-user/main.c | 2 +- cpu-all.h | 1 - cpu-exec.c | 9 ++- hw/arm_boot.c | 9 ++- hw/armv7m.c | 15 ++++-- hw/axis_dev88.c | 6 ++- hw/cris-boot.c | 10 ++-- hw/cris-boot.h | 2 +- hw/leon3.c | 14 +++-- hw/lm32_boards.c | 18 ++++--- hw/mainstone.c | 2 +- hw/microblaze_boot.c | 16 +++--- hw/microblaze_boot.h | 4 +- hw/milkymist.c | 12 +++-- hw/mips_fulong2e.c | 13 +++-- hw/mips_jazz.c | 13 +++-- hw/mips_malta.c | 15 ++++-- hw/mips_mipssim.c | 15 +++-- hw/mips_r4k.c | 15 +++-- hw/nseries.c | 6 +- hw/omap.h | 2 +- hw/omap1.c | 20 ++++--- hw/omap2.c | 8 ++-- hw/omap_sx1.c | 2 +- hw/palm.c | 2 +- hw/pc.c | 19 ++++--- hw/petalogix_ml605_mmu.c | 10 +++- hw/petalogix_s3adsp1800_mmu.c | 10 +++- hw/ppc440_bamboo.c | 13 +++-- hw/ppc4xx_devs.c | 13 +++-- hw/ppc_newworld.c | 13 +++-- hw/ppc_oldworld.c | 13 +++-- hw/ppc_prep.c | 13 +++-- hw/ppce500_mpc8544ds.c | 21 +++++--- hw/pxa.h | 2 +- hw/pxa2xx.c | 40 +++++++------- hw/r2d.c | 18 ++++--- hw/spapr.c | 14 +++-- hw/spitz.c | 2 +- hw/sun4m.c | 20 +++++--- hw/sun4u.c | 25 ++++++---- hw/tosa.c | 2 +- hw/virtex_ml507.c | 27 ++++++---- hw/xtensa_lx60.c | 15 +++-- hw/xtensa_sim.c | 17 ++++-- hw/z2.c | 2 +- linux-user/main.c | 2 +- linux-user/syscall.c | 2 +- target-arm/helper.c | 7 +-- target-cris/cpu.h | 12 ++++- target-cris/translate.c | 110 ++++++++++++++++++++--------------------- target-i386/cpu.h | 16 +++++-- target-i386/helper.c | 23 ++++----- target-i386/kvm.c | 6 ++- target-lm32/cpu.c | 2 +- target-lm32/cpu.h | 12 ++++- target-lm32/helper.c | 10 +--- target-m68k/helper.c | 5 -- target-microblaze/cpu.h | 12 ++++- target-microblaze/translate.c | 18 ++----- target-mips/cpu.h | 15 +++++- target-mips/helper.c | 3 +- target-mips/translate.c | 6 +- target-ppc/cpu.h | 12 ++++- target-ppc/helper.c | 9 +--- target-s390x/helper.c | 9 +--- target-sh4/cpu.h | 12 ++++- target-sh4/translate.c | 9 +--- target-sparc/cpu.c | 9 +--- target-sparc/cpu.h | 17 +++++- target-xtensa/cpu.c | 2 +- target-xtensa/cpu.h | 16 +++++- target-xtensa/helper.c | 9 +--- 73 files changed, 516 insertions(+), 389 deletions(-) -- 1.7.7