From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH qom-next 00/59] QOM CPUState, part 4: CPU_COMMON Date: Wed, 23 May 2012 05:07:23 +0200 Message-ID: <1337742502-28565-1-git-send-email-afaerber@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Sender: kvm-owner@vger.kernel.org To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori , Paolo Bonzini , Igor Mammedov , Richard Henderson , Peter Maydell , "Edgar E. Iglesias" , Michael Walle , =?UTF-8?q?Aur=C3=A9lien=20Jarno?= , Alexander Graf , David Gibson , qemu-ppc , Blue Swirl , Guan Xuetao , Max Filippov , Avi Kivity , Marcelo Tosatti , Jan Kiszka , kvm , Stefano Stabellini , xen-devel List-Id: xen-devel@lists.xenproject.org Hello, This series, based on qom-next and the two pending ARM cleanup patches,= starts moving fields from CPUArchState (CPU_COMMON) to QOM CPUState. It stops = short of moving all easily possible fields (i.e., those not depending on targ= et_ulong or target_phys_addr_t) since the series got too long already and is exp= ected to spark some controversies due to collisions with several other series. The series is structured as preparatory refactorings interwoven with th= e actual touch-all movement of one field ("cpu: Move ... to CPUState"), optional= ly followed by type signature cleanups, culminating in the movement of two= fields that are tied together by VMState. Thus, unlike part 3, this series cannot randomly be cherry-picked to -next trees, only select parts thereof (e.g., use of cpu_s390x_in= it()). Please review and test. The use of cpu_index vs. cpuid_apic_id for x86 cpu[n] still needs some = thought. The question was brought up whether adding the CPUs a child pro= perties should be generalized outside the machine scope - I don't think so, sin= ce CPU hotplug seems highly architecture-specific and not applicable everywher= e (SoCs). Blue will likely have a superb idea how to avoid the cpu_tlb_flush() in= direction that I needed for VMState, but apart from having been a lot of dumb typ= ing, it works fine as interim solution. "Blah." wasn't terribly helpful as a co= mment. I have checked this to compile on ... * openSUSE 12.1 x86_64 w/KVM, * openSUSE Factory ppc w/KVM, * SLES 11 SP2 s390x w/KVM, * mingw32/64 cross-builds, * OpenBSD 5.1 amd64 (not for final version though, master doesn't build= ). Untested: Xen. Only some targets including i386 were lightly runtime-tested. Available for testing and cherry-picking (not pulling!) from: git://github.com/afaerber/qemu-cpu.git qom-cpu-common.v1 https://github.com/afaerber/qemu-cpu/commits/qom-cpu-common.v1 Regards, Andreas Cc: Anthony Liguori Cc: Paolo Bonzini Cc: Igor Mammedov Cc: Richard Henderson Cc: Peter Maydell Cc: Edgar E. Iglesias Cc: Michael Walle Cc: Aur=C3=A9lien Jarno Cc: Alexander Graf Cc: David Gibson Cc: qemu-ppc Cc: Blue Swirl Cc: Guan Xuetao Cc: Max Filippov Cc: Avi Kivity Cc: Marcelo Tosatti Cc: Jan Kiszka Cc: kvm Cc: Stefano Stabellini Cc: xen-devel Changes from preview in Igor's apic thread: * Use g_strdup_printf() for "cpu[x]" to be safe wrt length and nul term= ination. * Clean up removal of x86 version 5 load/save support. * Convert use of env->halted in s390x KVM code. * Convert some uses of env->halted/interrupt_request in ppc KVM code. * Convert some uses of env->halted in Xen code, prepend cpu_x86_init() = patch. * Avoid using POWERPC_CPU() / SPARC_CPU() macros inside *_set_irq() fun= ctions. Andreas F=C3=A4rber (59): qemu-thread: Let qemu_thread_is_self() return bool cpu: Move CPU_COMMON_THREAD into CPUState cpu: Move thread field into CPUState pc: Add CPU as /machine/cpu[n] apic: Replace cpu_env pointer by X86CPU link pc: Pass X86CPU to cpu_is_bsp() cpu: Move thread_kicked to CPUState Makefile.dis: Add include/ to include path cpus: Pass CPUState to qemu_cpu_is_self() cpus: Pass CPUState to qemu_cpu_kick_thread() cpu: Move created field to CPUState cpu: Move stop field to CPUState ppce500_spin: Store PowerPCCPU in SpinKick cpu: Move stopped field to CPUState cpus: Pass CPUState to cpu_is_stopped() cpus: Pass CPUState to cpu_can_run() cpu: Move halt_cond to CPUState cpus: Pass CPUState to qemu_tcg_cpu_thread_fn cpus: Pass CPUState to qemu_tcg_init_vcpu() ppc: Pass PowerPCCPU to ppc6xx_set_irq() ppc: Pass PowerPCCPU to ppc970_set_irq() ppc: Pass PowerPCCPU to power7_set_irq() ppc: Pass PowerPCCPU to ppc40x_set_irq() ppc: Pass PowerPCCPU to ppce500_set_irq() sun4m: Pass SPARCCPU to cpu_set_irq() sun4m: Pass SPARCCPU to cpu_kick_irq() sun4u: Pass SPARCCPU to {,s,hs}tick_irq() and cpu_timer_create() sun4u: Pass SPARCCPU to cpu_kick_irq() target-ppc: Rename kvm_kick_{env =3D> cpu} and pass PowerPCCPU target-s390x: Let cpu_s390x_init() return S390CPU s390-virtio: Use cpu_s390x_init() to obtain S390CPU s390-virtio: Let s390_cpu_addr2state() return S390CPU target-s390x: Pass S390CPU to s390_cpu_restart() cpus: Pass CPUState to qemu_cpu_kick() cpu: Move queued_work_{first,last} to CPUState cpus: Pass CPUState to flush_queued_work() cpus: Pass CPUState to qemu_wait_io_event_common() target-ppc: Pass PowerPCCPU to powerpc_excp() target-ppc: Pass PowerPCCPU to cpu_ppc_hypercall spapr: Pass PowerPCCPU to spapr_hypercall() spapr: Pass PowerPCCPU to hypercalls xtensa_pic: Pass XtensaCPU to xtensa_ccompare_cb() cpus: Pass CPUState to [qemu_]cpu_has_work() target-i386: Pass X86CPU to kvm_mce_inject() target-i386: Pass X86CPU to cpu_x86_inject_mce() cpus: Pass CPUState to run_on_cpu() cpu: Move thread_id to CPUState target-i386: Pass X86CPU to cpu_x86_load_seg_cache_sipi() target-i386: Drop version 5 CPU VMState support target-i386: Pass X86CPU to kvm_get_mp_state() target-i386: Pass X86CPU to kvm_handle_halt() target-mips: Pass MIPSCPU to mips_tc_wake() target-mips: Pass MIPSCPU to mips_vpe_is_wfi() target-mips: Pass MIPSCPU to mips_tc_sleep() target-mips: Pass MIPSCPU to mips_vpe_sleep() sun4u: Pass SPARCCPU to cpu_set_ivec_irq() cpu: Introduce mandatory tlb_flush callback xen_machine_pv: Use cpu_x86_init() to obtain X86CPU cpu: Move halted and interrupt_request to CPUState Makefile.dis | 1 + cpu-all.h | 4 - cpu-defs.h | 19 ---- cpu-exec.c | 40 ++++---- cpus.c | 233 +++++++++++++++++++++++------------= -------- exec.c | 44 ++++++--- gdbstub.c | 4 +- hw/apic.c | 34 ++++--- hw/apic.h | 2 +- hw/apic_common.c | 14 ++- hw/apic_internal.h | 2 +- hw/kvm/apic.c | 9 +- hw/kvmvapic.c | 6 +- hw/leon3.c | 2 +- hw/omap1.c | 4 +- hw/pc.c | 31 +++++- hw/ppc.c | 69 ++++++++----- hw/ppce500_mpc8544ds.c | 4 +- hw/ppce500_spin.c | 15 ++-- hw/pxa2xx_gpio.c | 3 +- hw/pxa2xx_pic.c | 2 +- hw/s390-virtio-bus.c | 6 +- hw/s390-virtio.c | 26 +++-- hw/spapr.c | 10 +- hw/spapr.h | 4 +- hw/spapr_hcall.c | 42 +++++--- hw/spapr_llan.c | 10 +- hw/spapr_rtas.c | 13 ++- hw/spapr_vio.c | 12 +- hw/spapr_vty.c | 4 +- hw/sun4m.c | 31 +++--- hw/sun4u.c | 47 +++++---- hw/xen_machine_pv.c | 6 +- hw/xics.c | 11 ++- hw/xtensa_pic.c | 14 ++- include/qemu/cpu.h | 81 +++++++++++++++ kvm-all.c | 15 ++- monitor.c | 6 +- qemu-common.h | 2 - qemu-thread-posix.c | 2 +- qemu-thread-win32.c | 2 +- qemu-thread.h | 3 +- qom/cpu.c | 11 ++ target-alpha/cpu.c | 18 +++- target-alpha/cpu.h | 4 +- target-alpha/translate.c | 3 +- target-arm/cpu.c | 10 ++ target-arm/cpu.h | 4 +- target-arm/helper.c | 3 +- target-arm/op_helper.c | 4 +- target-cris/cpu.c | 10 ++ target-cris/cpu.h | 4 +- target-cris/translate.c | 4 +- target-i386/cpu.c | 10 ++ target-i386/cpu.h | 16 ++- target-i386/helper.c | 21 ++-- target-i386/kvm.c | 77 ++++++++------ target-i386/machine.c | 10 +-- target-i386/op_helper.c | 13 ++- target-lm32/cpu.c | 10 ++ target-lm32/cpu.h | 4 +- target-lm32/op_helper.c | 4 +- target-m68k/cpu.c | 10 ++ target-m68k/cpu.h | 4 +- target-m68k/op_helper.c | 3 +- target-m68k/qregs.def | 1 - target-m68k/translate.c | 6 + target-microblaze/cpu.c | 10 ++ target-microblaze/cpu.h | 4 +- target-mips/cpu.c | 10 ++ target-mips/cpu.h | 15 ++-- target-mips/op_helper.c | 45 ++++++--- target-mips/translate.c | 8 +- target-ppc/cpu.h | 8 +- target-ppc/helper.c | 48 +++++---- target-ppc/helper_regs.h | 7 +- target-ppc/kvm.c | 25 +++-- target-ppc/op_helper.c | 8 +- target-ppc/translate.c | 3 +- target-ppc/translate_init.c | 10 ++ target-s390x/cpu.c | 12 ++- target-s390x/cpu.h | 16 ++-- target-s390x/helper.c | 14 ++- target-s390x/kvm.c | 18 ++- target-sh4/cpu.c | 10 ++ target-sh4/cpu.h | 4 +- target-sh4/helper.c | 5 +- target-sh4/op_helper.c | 4 +- target-sparc/cpu.c | 10 ++ target-sparc/cpu.h | 6 +- target-unicore32/cpu.c | 18 +++- target-unicore32/cpu.h | 4 +- target-xtensa/cpu.c | 10 ++ target-xtensa/cpu.h | 4 +- target-xtensa/op_helper.c | 4 +- xen-all.c | 10 +- 96 files changed, 974 insertions(+), 529 deletions(-) --=20 1.7.7