On Wed, May 23, 2012 at 3:07 AM, Andreas Färber <afaerber@xxxxxxx> wrote: > 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 target_ulong > or target_phys_addr_t) since the series got too long already and is expected to > spark some controversies due to collisions with several other series. > > The series is structured as preparatory refactorings interwoven with the actual > touch-all movement of one field ("cpu: Move ... to CPUState"), optionally > 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 > <arch>-next trees, only select parts thereof (e.g., use of cpu_s390x_init()). > > 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<X86CPU> properties > should be generalized outside the machine scope - I don't think so, since CPU > hotplug seems highly architecture-specific and not applicable everywhere (SoCs). > > Blue will likely have a superb idea how to avoid the cpu_tlb_flush() indirection > that I needed for VMState, but apart from having been a lot of dumb typing, it > works fine as interim solution. "Blah." wasn't terribly helpful as a comment. Unfortunately I don't have superb ideas today (as if I had them any other day...), only second rate jokes (as if they could be called jokes...). With 'Blah' I obviously meant that I didn't have a solution for that particular target_ulong/target_phys_addr_t problem. I'll try to improve on all these areas, if you know what I mean. > > 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 <anthony@xxxxxxxxxxxxx> > Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> > Cc: Igor Mammedov <imammedo@xxxxxxxxxx> > > Cc: Richard Henderson <rth@xxxxxxxxxxx> > Cc: Peter Maydell <peter.maydell@xxxxxxxxxx> > Cc: Edgar E. Iglesias <edgar.iglesias@xxxxxxxxx> > Cc: Michael Walle <michael@xxxxxxxx> > Cc: Aurélien Jarno <aurelien@xxxxxxxxxxx> > Cc: Alexander Graf <agraf@xxxxxxx> > Cc: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> > Cc: qemu-ppc <qemu-ppc@xxxxxxxxxx> > Cc: Blue Swirl <blauwirbel@xxxxxxxxx> > Cc: Guan Xuetao <gxt@xxxxxxxxxxxxxxx> > Cc: Max Filippov <jcmvbkbc@xxxxxxxxx> > > Cc: Avi Kivity <avi@xxxxxxxxxx> > Cc: Marcelo Tosatti <mtosatti@xxxxxxxxxx> > Cc: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> > Cc: kvm <kvm@xxxxxxxxxxxxxxx> > > Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> > Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx> > > Changes from preview in Igor's apic thread: > * Use g_strdup_printf() for "cpu[x]" to be safe wrt length and nul termination. > * 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() functions. > > Andreas Färber (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 => 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(-) > > -- > 1.7.7 > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html