Received: from eggs.gnu.org ([208.118.235.92]:55273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6C3l-0007zk-Dr for qemu-devel@nongnu.org; Fri, 09 Mar 2012 21:29:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S6C3g-0001OX-8G for qemu-devel@nongnu.org; Fri, 09 Mar 2012 21:29:28 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39819 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S6C3f-0001O7-PK for qemu-devel@nongnu.org; Fri, 09 Mar 2012 21:29:24 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 10 Mar 2012 03:27:32 +0100 Message-Id: <1331346496-10736-1-git-send-email-afaerber@suse.de> In-Reply-To: <1330893156-26569-1-git-send-email-afaerber@suse.de> References: <1330893156-26569-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC v4 00/44] Introduce QOM CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Jan Kiszka , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori Hello, This is a heavily rebased and redone series introducing a QOM CPU base cl= ass. It now avoids the name conflict between typedef struct CPU CPU and CPU(ob= j) by freeing the identifier CPUState. Patch 1 is a patch by Alex that removes some unused occurrences of cpu_re= set(). Patch 2 renames cpu_reset() to avoid workarounds such as previous cpu_do_= reset(). These two have no dependency on the CPUState/CPU() issue under discussion= and could be applied independently. Patches 3-12 are hand-crafted patches converting CPUState uses to the app= ropriate CPU*State and prepare for mass conversion from CPUState to CPU*State. Patches 13-43 are scripted conversions, separated by architecture, cf. be= low. Patch 44 introduces CPUClass, CPU() and reintroduces a new CPUState. Available at: http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/qom-cpu.v4 Regards, Andreas Cc: Anthony Liguori Cc: Peter Maydell Cc: Jan Kiszka v3 -> v4: * Rebased on top of type_init() v2, qom-user v4 and ppc405 cleanup. * Rename cpu_reset() to cpu_state_reset(), so that cpu_reset() can be use= d for CPU class in place of cpu_do_reset() (suggested by Anthony). * Use container_of() for CPUState -> CPU macros (suggested by Anthony). * Resolve name conflict between struct CPU and CPU(obj) by renaming CPUSt= ate to CPUArchState and by restricting its use to places that must be repla= ced with new CPUState after all targets are converted. v2 -> v3: * Rebased against qom-upstream.14 branch (and that against master). * Move cpu.c from hw/ to qom/ (built only once). * Use proper GPL headers. v1 -> v2: * Drop processor_init() and MODULE_INIT_CPU in favor of MODULE_INIT_DEVIC= E. * Prepare cast macros for CPU. * Add documentation. * Prepare reset callback. ---8<--- #!/bin/sh for arch in `find . -maxdepth 1 -name "target-*" | cut -d- -f2 | sort`; d= o case $arch in "alpha") dest=3DCPUAlphaState ;; "arm") dest=3DCPUARMState ;; "cris") dest=3DCPUCRISState ;; "i386") dest=3DCPUX86State ;; "lm32") dest=3DCPULM32State ;; "m68k") dest=3DCPUM68KState ;; "microblaze") dest=3DCPUMBState ;; "mips") dest=3DCPUMIPSState ;; "ppc") dest=3DCPUPPCState ;; "s390x") dest=3DCPUS390XState ;; "sh4") dest=3DCPUSH4State ;; "sparc") dest=3DCPUSPARCState ;; "unicore32") dest=3DCPUUniCore32State ;; "xtensa") dest=3DCPUXtensaState ;; esac sed --in-place "s/CPUState/$dest/g" target-$arch/*.[hc] sed --in-place "s/#define $dest/#define CPUState/" target-$arch/cpu.h git commit --all --signoff --no-verify --file=3D- < CPUArchState EOM ---8<--- Alexander Graf (1): PPC: 405: Use proper CPU reset Andreas F=C3=A4rber (43): Rename cpu_reset() to cpu_state_reset() monitor: Don't access registers through CPUState monitor: Avoid CPUState in read/write functions target-lm32: Typedef struct CPULM32State target-microblaze: Typedef struct CPUMBState target-sparc: Typedef struct CPUSPARCState early target-unicore32: Rename to CPUUniCore32State hw/mc146818: Drop unneeded #includes linux-user: Don't overuse CPUState darwin-user: Don't overuse CPUState bsd-user: Don't overuse CPUState target-alpha: Don't overuse CPUState target-arm: Don't overuse CPUState target-cris: Don't overuse CPUState target-i386: Don't overuse CPUState target-lm32: Don't overuse CPUState target-m68k: Don't overuse CPUState target-microblaze: Don't overuse CPUState target-mips: Don't overuse CPUState target-ppc: Don't overuse CPUState target-s390x: Don't overuse CPUState target-sh4: Don't overuse CPUState target-sparc: Don't overuse CPUState target-unicore32: Don't overuse CPUState target-xtensa: Don't overuse CPUState arm-semi: Don't use CPUState m68k-semi: Don't use CPUState xtensa-semi: Don't use CPUState alpha hw/: Don't use CPUState arm hw/: Don't use CPUState cris hw/: Don't use CPUState i386 hw/: Don't use CPUState lm32 hw/: Don't use CPUState m68k hw/: Don't use CPUState microblaze hw/: Don't use CPUState mips hw/: Don't use CPUState ppc hw/: Don't use CPUState s390x hw/: Don't use CPUState sh4 hw/: Don't use CPUState sparc hw/: Don't use CPUState xtensa hw/: Don't use CPUState Rename CPUState -> CPUArchState qom: Introduce CPU class Makefile.objs | 3 + arm-semi.c | 10 +- bsd-user/main.c | 14 +- bsd-user/qemu.h | 12 +- bsd-user/signal.c | 2 +- configure | 1 + cpu-all.h | 56 ++-- cpu-defs.h | 2 +- cpu-exec.c | 20 +- cpus.c | 76 +++--- darwin-user/main.c | 22 +- darwin-user/qemu.h | 6 +- darwin-user/signal.c | 8 +- def-helper.h | 2 +- disas.c | 4 +- disas.h | 2 +- dyngen-exec.h | 4 +- exec-all.h | 38 ++-- exec.c | 114 +++++----- gdbstub.c | 100 ++++---- gdbstub.h | 16 +- gen-icount.h | 8 +- hw/alpha_dp264.c | 2 +- hw/alpha_sys.h | 2 +- hw/alpha_typhoon.c | 14 +- hw/an5206.c | 2 +- hw/apic.h | 2 +- hw/arm-misc.h | 8 +- hw/arm_boot.c | 10 +- hw/arm_pic.c | 4 +- hw/armv7m.c | 4 +- hw/axis_dev88.c | 2 +- hw/cris-boot.c | 6 +- hw/cris-boot.h | 2 +- hw/cris_pic_cpu.c | 4 +- hw/dummy_m68k.c | 2 +- hw/etraxfs.h | 2 +- hw/etraxfs_ser.c | 4 +- hw/exynos4210.h | 2 +- hw/grlib.h | 2 +- hw/highbank.c | 8 +- hw/integratorcp.c | 2 +- hw/kvm/apic.c | 2 +- hw/kvmvapic.c | 22 +- hw/leon3.c | 10 +- hw/lm32_boards.c | 12 +- hw/mc146818rtc.c | 2 - hw/mcf.h | 4 +- hw/mcf5206.c | 4 +- hw/mcf5208.c | 2 +- hw/mcf_intc.c | 4 +- hw/microblaze_boot.c | 10 +- hw/microblaze_boot.h | 4 +- hw/microblaze_pic_cpu.c | 4 +- hw/microblaze_pic_cpu.h | 2 +- hw/milkymist.c | 10 +- hw/mips_cpudevs.h | 4 +- hw/mips_fulong2e.c | 12 +- hw/mips_int.c | 6 +- hw/mips_jazz.c | 8 +- hw/mips_malta.c | 12 +- hw/mips_mipssim.c | 8 +- hw/mips_r4k.c | 8 +- hw/mips_timer.c | 20 +- hw/mpc8544_guts.c | 2 +- hw/musicpal.c | 2 +- hw/omap.h | 2 +- hw/omap1.c | 2 +- hw/omap2.c | 2 +- hw/pc.c | 22 +- hw/petalogix_ml605_mmu.c | 4 +- hw/petalogix_s3adsp1800_mmu.c | 4 +- hw/ppc.c | 123 +++++----- hw/ppc.h | 28 +- hw/ppc405.h | 8 +- hw/ppc405_uc.c | 50 ++--- hw/ppc440_bamboo.c | 8 +- hw/ppc4xx.h | 8 +- hw/ppc4xx_devs.c | 17 +- hw/ppc_booke.c | 20 +- hw/ppc_newworld.c | 11 +- hw/ppc_oldworld.c | 11 +- hw/ppc_prep.c | 13 +- hw/ppce500_mpc8544ds.c | 16 +- hw/ppce500_spin.c | 8 +- hw/pxa.h | 6 +- hw/pxa2xx.c | 2 +- hw/pxa2xx_gpio.c | 4 +- hw/pxa2xx_pic.c | 4 +- hw/r2d.c | 8 +- hw/realview.c | 2 +- hw/s390-virtio-bus.c | 6 +- hw/s390-virtio.c | 16 +- hw/sh.h | 2 +- hw/shix.c | 2 +- hw/spapr.c | 17 +- hw/spapr.h | 4 +- hw/spapr_hcall.c | 42 ++-- hw/spapr_llan.c | 10 +- hw/spapr_rtas.c | 4 +- hw/spapr_vio.c | 12 +- hw/spapr_vty.c | 4 +- hw/strongarm.h | 2 +- hw/sun4m.c | 16 +- hw/sun4u.c | 26 +- hw/versatilepb.c | 2 +- hw/vexpress.c | 4 +- hw/virtex_ml507.c | 12 +- hw/vmport.c | 12 +- hw/xen_machine_pv.c | 2 +- hw/xics.c | 10 +- hw/xilinx_zynq.c | 2 +- hw/xtensa_lx60.c | 10 +- hw/xtensa_pic.c | 16 +- hw/xtensa_sim.c | 4 +- include/qemu/cpu.h | 75 ++++++ kvm-all.c | 54 ++-- kvm-stub.c | 22 +- kvm.h | 60 +++--- linux-user/elfload.c | 40 ++-- linux-user/m68k/syscall.h | 2 +- linux-user/main.c | 44 ++-- linux-user/qemu.h | 14 +- linux-user/signal.c | 217 +++++++++-------- linux-user/syscall.c | 30 ++-- m68k-semi.c | 4 +- monitor.c | 544 ++++++++++++++++++++---------------= ----- poison.h | 2 +- qom/Makefile | 1 + qom/cpu.c | 58 +++++ softmmu-semi.h | 12 +- target-alpha/cpu.h | 26 +- target-alpha/helper.c | 18 +- target-alpha/machine.c | 44 ++-- target-alpha/op_helper.c | 6 +- target-alpha/translate.c | 56 ++-- target-arm/cpu.h | 12 +- target-arm/helper.c | 120 +++++----- target-arm/iwmmxt_helper.c | 66 +++--- target-arm/neon_helper.c | 88 ++++---- target-arm/op_helper.c | 6 +- target-arm/translate.c | 104 ++++---- target-cris/cpu.h | 14 +- target-cris/helper.c | 14 +- target-cris/mmu.c | 14 +- target-cris/mmu.h | 6 +- target-cris/op_helper.c | 6 +- target-cris/translate.c | 50 ++-- target-cris/translate_v10.c | 26 +- target-i386/cpu.h | 36 ++-- target-i386/helper.c | 40 ++-- target-i386/kvm.c | 76 +++--- target-i386/machine.c | 172 +++++++------- target-i386/op_helper.c | 34 ++-- target-i386/translate.c | 82 +++--- target-lm32/cpu.h | 31 ++-- target-lm32/helper.c | 18 +- target-lm32/machine.c | 22 +- target-lm32/op_helper.c | 4 +- target-lm32/translate.c | 38 ++-- target-m68k/cpu.h | 18 +- target-m68k/helper.c | 82 +++--- target-m68k/op_helper.c | 20 +- target-m68k/translate.c | 16 +- target-microblaze/cpu.h | 33 ++-- target-microblaze/helper.c | 10 +- target-microblaze/mmu.c | 8 +- target-microblaze/mmu.h | 6 +- target-microblaze/op_helper.c | 8 +- target-microblaze/translate.c | 54 ++-- target-mips/cpu.h | 42 ++-- target-mips/helper.c | 26 +- target-mips/machine.c | 4 +- target-mips/op_helper.c | 124 +++++----- target-mips/translate.c | 360 ++++++++++++++-------------- target-ppc/cpu.h | 43 ++-- target-ppc/helper.c | 82 +++--- target-ppc/kvm.c | 38 ++-- target-ppc/kvm_ppc.h | 12 +- target-ppc/machine.c | 4 +- target-ppc/op_helper.c | 12 +- target-ppc/translate.c | 78 +++--- target-ppc/translate_init.c | 42 ++-- target-s390x/cpu.h | 48 ++-- target-s390x/helper.c | 42 ++-- target-s390x/kvm.c | 56 ++-- target-s390x/op_helper.c | 70 +++--- target-s390x/translate.c | 56 ++-- target-sh4/cpu.h | 12 +- target-sh4/helper.c | 28 +- target-sh4/op_helper.c | 4 +- target-sh4/translate.c | 50 ++-- target-sparc/cc_helper.c | 66 +++--- target-sparc/cpu.h | 64 +++--- target-sparc/cpu_init.c | 4 +- target-sparc/fop_helper.c | 68 +++--- target-sparc/helper.c | 16 +- target-sparc/int32_helper.c | 6 +- target-sparc/int64_helper.c | 12 +- target-sparc/ldst_helper.c | 16 +- target-sparc/machine.c | 4 +- target-sparc/mmu_helper.c | 28 +- target-sparc/op_helper.c | 4 +- target-sparc/translate.c | 80 +++--- target-sparc/win_helper.c | 58 +++--- target-unicore32/cpu.h | 32 ++-- target-unicore32/helper.c | 62 +++--- target-unicore32/op_helper.c | 8 +- target-unicore32/translate.c | 60 +++--- target-xtensa/cpu.h | 46 ++-- target-xtensa/helper.c | 42 ++-- target-xtensa/op_helper.c | 30 ++-- target-xtensa/translate.c | 22 +- tcg/arm/tcg-target.c | 22 +- tcg/hppa/tcg-target.c | 8 +- tcg/i386/tcg-target.c | 2 +- tcg/ia64/tcg-target.c | 10 +- tcg/mips/tcg-target.c | 14 +- tcg/ppc/tcg-target.c | 4 +- tcg/ppc64/tcg-target.c | 4 +- tcg/s390/tcg-target.c | 8 +- tcg/sparc/tcg-target.c | 4 +- tcg/tci/tcg-target.c | 2 +- tcg/tci/tcg-target.h | 2 +- tci.c | 4 +- translate-all.c | 4 +- user-exec.c | 4 +- xen-all.c | 4 +- xtensa-semi.c | 2 +- 229 files changed, 3142 insertions(+), 2978 deletions(-) create mode 100644 include/qemu/cpu.h create mode 100644 qom/cpu.c --=20 1.7.7