[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC v4 00/44] Introduce QOM CPU
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH RFC v4 00/44] Introduce QOM CPU |
Date: |
Sat, 10 Mar 2012 03:27:32 +0100 |
Hello,
This is a heavily rebased and redone series introducing a QOM CPU base class.
It now avoids the name conflict between typedef struct CPU CPU and CPU(obj)
by freeing the identifier CPUState.
Patch 1 is a patch by Alex that removes some unused occurrences of cpu_reset().
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
appropriate
CPU*State and prepare for mass conversion from CPUState to CPU*State.
Patches 13-43 are scripted conversions, separated by architecture, cf. below.
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 <address@hidden>
Cc: Peter Maydell <address@hidden>
Cc: Jan Kiszka <address@hidden>
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 used
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 CPUState
to CPUArchState and by restricting its use to places that must be replaced
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_DEVICE.
* 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`; do
case $arch in
"alpha") dest=CPUAlphaState ;;
"arm") dest=CPUARMState ;;
"cris") dest=CPUCRISState ;;
"i386") dest=CPUX86State ;;
"lm32") dest=CPULM32State ;;
"m68k") dest=CPUM68KState ;;
"microblaze") dest=CPUMBState ;;
"mips") dest=CPUMIPSState ;;
"ppc") dest=CPUPPCState ;;
"s390x") dest=CPUS390XState ;;
"sh4") dest=CPUSH4State ;;
"sparc") dest=CPUSPARCState ;;
"unicore32") dest=CPUUniCore32State ;;
"xtensa") dest=CPUXtensaState ;;
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=- <<EOM
target-$arch: Don't overuse CPUState
Scripted conversion:
sed -i "s/CPUState/$dest/g" target-$arch/*.[hc]
sed -i "s/#define $dest/#define CPUState/" target-$arch/cpu.h
EOM
done
for arch in arm m68k xtensa; do
case $arch in
"arm") dest=CPUARMState ;;
"m68k") dest=CPUM68KState ;;
"xtensa") dest=CPUXtensaState ;;
esac
sed --in-place "s/CPUState/$dest/g" $arch-semi.c
git commit --all --signoff --no-verify --file=- <<EOM
$arch-semi: Don't use CPUState
Scripted conversion:
sed -i "s/CPUState/$dest/g" $arch-semi.c
EOM
done
INPUTS="hw/alpha_*.[hc]"
sed --in-place "s/CPUState/CPUAlphaState/g" $INPUTS
git commit --all --signoff --no-verify --file=- <<EOM
alpha hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUAlphaState/g" \$file
done
EOM
INPUTS="hw/arm-misc.h hw/arm_boot.c hw/arm_pic.c"
INPUTS="$INPUTS hw/armv7m.c hw/exynos4210.h hw/highbank.c hw/integratorcp.c
hw/musicpal.c"
INPUTS="$INPUTS hw/omap.h hw/pxa.h hw/pxa2xx_gpio.c hw/pxa2xx_pic.c
hw/realview.c"
INPUTS="$INPUTS hw/strongarm.h hw/versatilepb.c hw/vexpress.c "
INPUTS="$INPUTS hw/xilinx_zynq.c "
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUARMState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
arm hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUARMState/g" \$file
done
EOM
INPUTS="hw/cris-boot.[hc] hw/cris_pic_cpu.c hw/axis_dev88.c hw/etraxfs.h
hw/etraxfs_ser.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUCRISState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
cris hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUCRISState/g" \$file
done
EOM
INPUTS="hw/apic.h hw/kvm/apic.c hw/kvmvapic.c hw/pc.c hw/vmport.c
hw/xen_machine_pv.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUX86State/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
i386 hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUX86State/g" \$file
done
EOM
INPUTS="hw/lm32_boards.c hw/milkymist.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPULM32State/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
lm32 hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPULM32State/g" \$file
done
EOM
INPUTS="hw/an5206.c hw/dummy_m68k.c hw/mcf.h hw/mcf5206.c hw/mcf5208.c
hw/mcf_intc.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUM68KState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
m68k hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUM68KState/g" \$file
done
EOM
INPUTS="hw/microblaze_*.[hc]"
INPUTS="$INPUTS hw/petalogix_ml605_mmu.c hw/petalogix_s3adsp1800_mmu.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUMBState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
microblaze hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUMBState/g" \$file
done
EOM
INPUTS="hw/mips_*.[hc]"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUMIPSState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
mips hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUMIPSState/g" \$file
done
EOM
INPUTS="hw/ppc*.[hc] hw/mpc8544_guts.c hw/spapr*.[hc] hw/virtex_ml507.c
hw/xics.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUPPCState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
ppc hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUPPCState/g" \$file
done
EOM
INPUTS="hw/s390-*.[hc]"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUS390XState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
s390x hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUS390XState/g" \$file
done
EOM
INPUTS="hw/sh.h hw/shix.c hw/r2d.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUSH4State/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
sh4 hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUSH4State/g" \$file
done
EOM
INPUTS="hw/sun4m.c hw/sun4u.c hw/grlib.h hw/leon3.c"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUSPARCState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
sparc hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUSPARCState/g" \$file
done
EOM
INPUTS="hw/xtensa_*.[hc]"
for file in $INPUTS; do
sed --in-place "s/CPUState/CPUXtensaState/g" $file
done
git commit --all --signoff --no-verify --file=- <<EOM
xtensa hw/: Don't use CPUState
Scripted conversion:
for file in $INPUTS; do
sed -i "s/CPUState/CPUXtensaState/g" \$file
done
EOM
#exit
INPUTS="*.[hc] hw/*.[hc] hw/kvm/*.[hc]"
INPUTS="$INPUTS linux-user/*.[hc] linux-user/m68k/*.[hc]"
INPUTS="$INPUTS bsd-user/*.[hc]"
INPUTS="$INPUTS darwin-user/*.[hc]"
INPUTS="$INPUTS tcg/*/*.[hc]"
INPUTS="$INPUTS target-*/cpu.h"
for input in $INPUTS; do
sed --in-place "s/CPUState/CPUArchState/g" $input
done
git commit --all --no-verify --signoff --file=- <<EOM
Rename CPUState -> CPUArchState
EOM
---8<---
Alexander Graf (1):
PPC: 405: Use proper CPU reset
Andreas Färber (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
--
1.7.7
[Qemu-devel] [PATCH v4 01/44] PPC: 405: Use proper CPU reset, Andreas Färber, 2012/03/09
[Qemu-devel] [PATCH RFC v4 15/44] target-cris: Don't overuse CPUState, Andreas Färber, 2012/03/09
[Qemu-devel] [PATCH RFC v4 11/44] darwin-user: Don't overuse CPUState, Andreas Färber, 2012/03/09
[Qemu-devel] [PATCH RFC v4 19/44] target-microblaze: Don't overuse CPUState, Andreas Färber, 2012/03/09
[Qemu-devel] [PATCH RFC v4 14/44] target-arm: Don't overuse CPUState, Andreas Färber, 2012/03/09