Hello, This series changes cpu_single_env, first_cpu, next_cpu and thread_env to CPUState.
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 allow its use in qom/cpu.h. v2 takes the approach of leaving open-coded CPU loops in place and just changing them over to CPUState in one big patch. It goes on to remove qemu_for_each_cpu() and demonstrates the benefits of this invasive series by making a few devices target-independent. Available for testing at: git://github.com/afaerber/qemu-cpu.git qom-cpu-10.v2 https://github.com/afaerber/qemu-cpu/commits/qom-cpu-10.v2 Regards, Andreas v1 -> v2: * Fixed typo spotted by Li Guang. * Dropped qemu_for_each_cpu() conversion patches. * Applied most qemu_get_cpu() patches already. * Fixed Xen breakage due to NULL cpu_single_env (reported by Stefano). * Appended patch to drop qemu_for_each_cpu() (suggested by Markus). * Appended patches to build arm_gic, arm_mptimer, openpic and sh_intc only once. * Avoided some un-typed uses of CPUState::env_ptr. Cc: Anthony Liguori <anth...@codemonkey.ws> Cc: Blue Swirl <blauwir...@gmail.com> Cc: Aurélien Jarno <aurel...@aurel32.net> Cc: Markus Armbruster <arm...@redhat.com> 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, arm devs) Cc: Alexander Graf <ag...@suse.de> (openpic) Cc: Scott Wood <scottw...@freescale.com> (openpic) Andreas Färber (29): kvm: Change kvm_cpu_synchronize_state() argument to CPUState kvm: Change cpu_synchronize_state() argument to CPUState 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 kvm: Change kvm_remove_all_breakpoints() argument to CPUState cpu: Make first_cpu and next_cpu CPUState linux-user: Change thread_env to CPUState bsd-user: Change thread_env to CPUState cpu: Drop qemu_for_each_cpu() cpu: Move CPU_INTERRUPT_* to qom/cpu.h intc/sh_intc: Build sh_intc only once intc/arm_gic: Build arm_gic only once intc/openpic: Build openpic only once timer/arm_mptimer: Build arm_mptimer only once bsd-user/elfload.c | 6 +- bsd-user/main.c | 9 +- bsd-user/qemu.h | 2 +- cpu-exec.c | 13 +-- cpus.c | 227 ++++++++++++++++++++---------------------- cputlb.c | 19 ++-- dump.c | 16 ++- exec.c | 67 +++++-------- gdbstub.c | 61 +++++++----- hw/acpi/piix4.c | 20 ++-- 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 | 12 ++- hw/i386/kvmvapic.c | 21 ++-- hw/i386/pc.c | 28 +++--- hw/i386/pc_piix.c | 3 +- hw/intc/Makefile.objs | 6 +- hw/intc/arm_gic.c | 4 +- hw/intc/armv7m_nvic.c | 11 +- hw/intc/openpic.c | 7 +- hw/intc/sh_intc.c | 6 +- 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 | 12 +-- hw/ppc/ppce500_spin.c | 2 +- hw/ppc/prep.c | 12 ++- hw/ppc/spapr.c | 27 +++-- hw/ppc/spapr_rtas.c | 2 +- hw/sparc/sun4m.c | 5 +- hw/timer/Makefile.objs | 2 +- hw/timer/arm_mptimer.c | 3 +- include/exec/cpu-all.h | 66 ------------ 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/exec/poison.h | 13 --- include/hw/ppc/ppc.h | 2 - include/hw/ppc/ppc_e500.h | 6 ++ include/hw/sh4/sh.h | 2 + include/qemu-common.h | 8 -- include/qemu/log.h | 2 +- include/qom/cpu.h | 165 ++++++++++++++++++++++++++++-- include/sysemu/kvm.h | 12 +-- kvm-all.c | 45 ++++----- kvm-stub.c | 10 +- linux-user/elfload.c | 21 ++-- linux-user/linuxload.c | 3 +- linux-user/main.c | 56 ++++++----- linux-user/qemu.h | 2 +- linux-user/signal.c | 12 ++- linux-user/syscall.c | 15 +-- memory.c | 12 +-- memory_mapping.c | 16 +-- monitor.c | 23 ++--- qom/cpu.c | 60 +++++++---- stubs/cpus.c | 5 + target-alpha/cpu-qom.h | 2 + target-alpha/cpu.c | 5 +- target-alpha/cpu.h | 6 +- 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 | 26 +++-- 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 | 38 +++---- 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 | 9 +- target-ppc/kvm.c | 2 +- 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/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/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 | 32 +++--- user-exec.c | 9 +- 138 files changed, 964 insertions(+), 746 deletions(-) create mode 100644 include/hw/ppc/ppc_e500.h -- 1.8.1.4