Hello, Based on my guest-memory-dump cleanup patches, this large series changes cpu_single_env, first_cpu, next_cpu and thread_env to CPUState.
As a prerequisite, most open-coded CPU loops are replaced by either qemu_for_each_cpu() or qemu_get_cpu(). Individual review appreciated! qemu_init_vcpu() is converted to CPUState and moved away from targets. cpu_unassigned_access(), cpu_dump_state() and cpu_dump_statistics() are turned into CPUClass methods. exec/hwaddr.h is modified to allows its use in qom/cpu.h. Available for testing at: git://github.com/afaerber/qemu-cpu.git qom-cpu-10.v1 https://github.com/afaerber/qemu-cpu/commits/qom-cpu-10.v1 Regards, Andreas Cc: Anthony Liguori <anth...@codemonkey.ws> Cc: Blue Swirl <blauwir...@gmail.com> Cc: Aurélien Jarno <aurel...@aurel32.net> Cc: Paolo Bonzini <pbonz...@redhat.com> (cpu_unassigned_access) Cc: Stefano Stabellini <stefano.stabell...@eu.citrix.com> (dummy CPU thread changes) Cc: Peter Maydell <peter.mayd...@linaro.org> (hwaddr) Andreas Färber (59): kvm: Change kvm_cpu_synchronize_state() argument to CPUState kvm: Change cpu_synchronize_state() argument to CPUState cpus: Simplify cpu_synchronize_all_post_reset() cpus: Simplify cpu_synchronize_all_post_init() cpus: Simplify pause_all_vcpus() cpus: Simplify resume_all_vcpus() cpus: Simplify set_numa_modes() cpus: Simplify qmp_inject_nmi() cpus: Simplify hw_error() cpus: Simplify qemu_tcg_wait_io_event() and qemu_tcg_cpu_thread_fn() monitor: Simplify do_inject_mce() gdbstub: Simplify find_cpu() cpu: Change cpu_exit() argument to CPUState cpus: Change cpu_thread_is_idle() argument to CPUState cpus: Change qemu_kvm_wait_io_event() argument to CPUState kvm: Change kvm_set_signal_mask() argument to CPUState cpus: Change qemu_kvm_init_cpu_signals() argument to CPUState cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks kvm: Change kvm_handle_internal_error() argument to CPUState kvm: Change kvm_cpu_exec() argument to CPUState gdbstub: Set gdb_set_stop_cpu() argument to CPUState cpus: Change cpu_handle_guest_debug() argument to CPUState cpus: Change qemu_kvm_start_vcpu() argument to CPUState cpus: Change qemu_dummy_start_vcpu() argument to CPUState cpu: Change qemu_init_vcpu() argument to CPUState hwaddr: Make hwaddr type usable beyond softmmu cpu: Turn cpu_unassigned_access() into a CPUState hook cpu: Replace cpu_single_env with CPUState cpu_single_cpu cputlb: Simplify cpu_tlb_reset_dirty_all() exec: Simplify tcg_commit() monitor: Simplify do_info_numa() kvm: Simplify kvm_{insert,remove,remove_all}_breakpoint[s]() kvm: Simplify kvm_remove_all_breakpoints() further kvm: Change kvm_remove_all_breakpoints() argument to CPUState linux-user: Simplify start_exclusive() linux-user/elfload: Abstract fill_note_info() with qemu_for_each_cpu() target-i386: Abstract cpu_x86_inject_mce() with qemu_for_each_cpu() translate-all: Abstract tb_flush() with qemu_for_each_cpu() translate-all: Abstract tb_phys_invalidate() with qemu_for_each_cpu() target-ppc: Abstract helper_msgsnd() with qemu_for_each_cpu() target-mips: Abstract helper_dvpe() with qemu_for_each_cpu() target-mips: Abstract helper_evpe() with qemu_for_each_cpu() kvmclock: Abstract kvmclock_vm_state_change() with qemu_for_each_cpu() kvmvapic: Abstract vapic_enable_tpr_reporting() with qemu_for_each_cpu() pc: Abstract pic_irq_request() with qemu_for_each_cpu() ppc: Abstract ppce500_set_mpic_proxy() with qemu_for_each_cpu() spapr: Abstract spapr_fix_cpu_dt() with qemu_for_each_cpu() cpus: Abstract all_cpu_threads_idle() with qemu_for_each_cpu() cpus: Abstract all_vcpus_paused() with qemu_for_each_cpu() cpus: Abstract qmp_query_cpus() with qemu_for_each_cpu() exec: Abstract qemu_get_cpu() with qemu_for_each_cpu() gdbstub: Abstract gdb_breakpoint_{insert,remove}() with qemu_for_each_cpu() gdbstub: Abstract gdb_breakpoint_remove_all() with qemu_for_each_cpu() spapr: Abstract spapr_create_fdt_skel() with qemu_for_each_cpu() spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu() spapr_rtas: Abstract rtas_start_cpu() with qemu_get_cpu() cpu: Make first_cpu and next_cpu CPUState (WIP) linux-user: Change thread_env to CPUState bsd-user: Change thread_env to CPUState bsd-user/elfload.c | 6 +- bsd-user/main.c | 9 +- bsd-user/qemu.h | 2 +- cpu-exec.c | 13 +- cpus.c | 375 ++++++++++++++++++++++-------------------- cputlb.c | 50 ++++-- exec.c | 92 ++++++----- gdbstub.c | 168 ++++++++++++------- hw/alpha/typhoon.c | 12 +- hw/arm/boot.c | 10 +- hw/arm/exynos4_boards.c | 4 +- hw/arm/highbank.c | 2 +- hw/arm/pxa2xx.c | 3 +- hw/arm/realview.c | 2 +- hw/arm/vexpress.c | 2 +- hw/arm/xilinx_zynq.c | 2 +- hw/i386/kvm/apic.c | 2 +- hw/i386/kvm/clock.c | 32 ++-- hw/i386/kvmvapic.c | 33 ++-- hw/i386/pc.c | 39 +++-- hw/i386/pc_piix.c | 3 +- hw/intc/arm_gic.c | 3 +- hw/intc/armv7m_nvic.c | 11 +- hw/intc/openpic.c | 5 +- hw/intc/sh_intc.c | 5 +- hw/isa/lpc_ich9.c | 2 +- hw/mips/mips_fulong2e.c | 6 +- hw/mips/mips_jazz.c | 6 +- hw/mips/mips_malta.c | 9 +- hw/misc/vmport.c | 26 +-- hw/ppc/mpc8544_guts.c | 3 +- hw/ppc/ppc.c | 23 +-- hw/ppc/ppce500_spin.c | 2 +- hw/ppc/prep.c | 12 +- hw/ppc/spapr.c | 315 +++++++++++++++++++---------------- hw/ppc/spapr_rtas.c | 30 ++-- hw/sparc/sun4m.c | 5 +- hw/timer/arm_mptimer.c | 2 - include/exec/cpu-all.h | 18 +- include/exec/cpu-common.h | 2 + include/exec/cpu-defs.h | 3 +- include/exec/gdbstub.h | 2 +- include/exec/hwaddr.h | 4 - include/exec/memory.h | 2 + include/qemu-common.h | 8 - include/qemu/log.h | 2 +- include/qom/cpu.h | 93 +++++++++++ include/sysemu/kvm.h | 12 +- kvm-all.c | 90 +++++----- kvm-stub.c | 10 +- linux-user/elfload.c | 32 ++-- linux-user/linuxload.c | 3 +- linux-user/main.c | 69 ++++---- linux-user/qemu.h | 2 +- linux-user/signal.c | 12 +- linux-user/syscall.c | 15 +- memory.c | 8 +- monitor.c | 60 ++++--- qom/cpu.c | 30 +++- stubs/cpus.c | 5 + target-alpha/cpu-qom.h | 2 + target-alpha/cpu.c | 5 +- target-alpha/cpu.h | 8 +- target-alpha/helper.c | 6 +- target-alpha/mem_helper.c | 10 +- target-arm/arm-semi.c | 3 +- target-arm/cpu-qom.h | 3 + target-arm/cpu.c | 2 +- target-arm/translate.c | 6 +- target-cris/cpu-qom.h | 3 + target-cris/cpu.c | 2 +- target-cris/helper.c | 4 +- target-cris/translate.c | 6 +- target-i386/arch_dump.c | 7 +- target-i386/cpu-qom.h | 3 + target-i386/cpu.c | 2 +- target-i386/helper.c | 41 +++-- target-i386/kvm.c | 20 ++- target-i386/misc_helper.c | 2 +- target-lm32/cpu-qom.h | 2 + target-lm32/cpu.c | 3 +- target-lm32/translate.c | 6 +- target-m68k/cpu-qom.h | 2 + target-m68k/cpu.c | 2 +- target-m68k/translate.c | 6 +- target-microblaze/cpu-qom.h | 2 + target-microblaze/cpu.c | 4 +- target-microblaze/cpu.h | 5 +- target-microblaze/helper.c | 4 +- target-microblaze/op_helper.c | 17 +- target-microblaze/translate.c | 6 +- target-mips/cpu-qom.h | 2 + target-mips/cpu.c | 3 +- target-mips/cpu.h | 5 +- target-mips/op_helper.c | 70 ++++---- target-mips/translate.c | 6 +- target-moxie/cpu.c | 8 +- target-moxie/cpu.h | 2 + target-moxie/helper.c | 4 +- target-moxie/translate.c | 6 +- target-openrisc/cpu.c | 2 +- target-openrisc/cpu.h | 2 + target-openrisc/translate.c | 12 +- target-ppc/cpu-qom.h | 4 + target-ppc/excp_helper.c | 23 ++- target-ppc/mmu-hash64.c | 2 +- target-ppc/translate.c | 15 +- target-ppc/translate_init.c | 4 +- target-s390x/cpu-qom.h | 2 + target-s390x/cpu.c | 2 +- target-s390x/cpu.h | 3 +- target-s390x/kvm.c | 9 +- target-s390x/translate.c | 6 +- target-sh4/cpu-qom.h | 2 + target-sh4/cpu.c | 2 +- target-sh4/translate.c | 7 +- target-sparc/cpu-qom.h | 2 + target-sparc/cpu.c | 11 +- target-sparc/cpu.h | 5 +- target-sparc/ldst_helper.c | 27 ++- target-unicore32/cpu-qom.h | 2 + target-unicore32/cpu.c | 4 +- target-unicore32/cpu.h | 2 +- target-unicore32/translate.c | 6 +- target-xtensa/cpu-qom.h | 2 + target-xtensa/cpu.c | 4 +- target-xtensa/op_helper.c | 4 +- target-xtensa/translate.c | 6 +- translate-all.c | 60 ++++--- user-exec.c | 6 +- 130 files changed, 1391 insertions(+), 955 deletions(-) -- 1.8.1.4