* [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups
@ 2016-05-18 16:36 Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 01/52] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
` (8 more replies)
0 siblings, 9 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Thomas Huth, Cornelia Huck
This series removes usage of NEED_CPU_H from several central
include files in QEMU, most notably hw/hw.h and qemu-common.h.
Definitions conditional on NEED_CPU_H remain only in disas/disas.h,
exec/gdbstub.h, exec/helper-head.h and exec/log.h.
The interesting patches are interspersed with other miscellaenous
cleanups that I won't really dwell on in the cover letter; the main
changes are:
- make sure that target-independent code can access QOM objects
for the CPU through an opaque type. This is useful because often
target-independent code uses a header file that happens to include
pointers to ARMCPU* or similar. The target-independent code itself does
not use the pointed-to object, but the very presenece of the ARMCPU*
name means that all users of that header have to bring in cpu.h.
By providing the opaque type, a much smaller API can be exposed to all
these users in hw/ without doing complex surgery to split the header file.
- remove NEED_CPU_H from hw/hw.h, exec/memory.h and exec/cpu-common.h.
- remove three nested inclusions from qemu-common.h, including cpu.h
- remove inclusion of exec-all.h (TCG-specific) from cpu.h
- remove indirect inclusion of qemu-common.h from hw/hw.h
The next objectives should be removing unnecessary inclusions from/of
qemu-common.h (or delete it altogether) and exec/cpu-common.h.
As before, I would appreciate people compile-testing it on PPC. It should
fix all the problems reported previously. The changes are available in
the git repository at git://github.com/bonzini/qemu.git, branch need-cpu-h
(SHA1 for the top commit is 1c38e38aa3eff247da15cee7b06ebc8a405939ca).
Paolo Bonzini (52):
scripts: add script to build QEMU and analyze inclusions
s390x: move vregs_needed to machine.c
include: move CPU-related definitions out of qemu-common.h
log: do not use CONFIG_USER_ONLY
cpu: make cpu-qom.h only include-able from cpu.h
target-alpha: make cpu-qom.h not target specific
target-arm: make cpu-qom.h not target specific
target-cris: make cpu-qom.h not target specific
target-i386: make cpu-qom.h not target specific
target-lm32: make cpu-qom.h not target specific
target-m68k: make cpu-qom.h not target specific
target-microblaze: make cpu-qom.h not target specific
target-mips: make cpu-qom.h not target specific
target-ppc: do not use target_ulong in cpu-qom.h
target-ppc: do not make PowerPCCPUClass depend on target-specific
symbols
target-ppc: make cpu-qom.h not target specific
target-s390x: make cpu-qom.h not target specific
target-sh4: make cpu-qom.h not target specific
target-sparc: make cpu-qom.h not target specific
target-tricore: make cpu-qom.h not target specific
target-unicore32: make cpu-qom.h not target specific
target-xtensa: make cpu-qom.h not target specific
arm: include cpu-qom.h in files that require ARMCPU
m68k: include cpu-qom.h in files that require M68KCPU
sh4: include cpu-qom.h in files that require SuperHCPU
alpha: include cpu-qom.h in files that require AlphaCPU
mips: use MIPSCPU instead of CPUMIPSState
ppc: use PowerPCCPU instead of CPUPPCState
arm: remove useless cpu.h inclusion
explicitly include qom/cpu.h
explicitly include hw/qdev-core.h
explicitly include linux/kvm.h
apic: move target-dependent definitions to cpu.h
include: poison symbols in osdep.h
hw: do not use VMSTATE_*TL
hw: move CPU state serialization to migration/cpu.h
hw: cannot include hw/hw.h from user emulation
cpu: move endian-dependent load/store functions to cpu-all.h
qemu-common: stop including qemu/bswap.h from qemu-common.h
qemu-common: stop including qemu/host-utils.h from qemu-common.h
gdbstub: remove unnecessary includes from gdbstub-xml.c
dma: do not depend on kvm_enabled()
s390x: move stuff out of cpu.h
acpi: do not use TARGET_PAGE_SIZE
qemu-common: push cpu.h inclusion out of qemu-common.h
arm: move arm_log_exception into .c file
mips: move CP0 functions out of cpu.h
hw: explicitly include qemu/log.h
exec: extract exec/tb-context.h
cpu: move exec-all.h inclusion out of cpu.h
hw: remove pio_addr_t
hw: clean up hw/hw.h includes
arch_init.c | 2 +
audio/mixeng.c | 1 +
audio/noaudio.c | 1 +
audio/spiceaudio.c | 1 +
audio/wavaudio.c | 2 +-
block/bochs.c | 1 +
block/cloop.c | 1 +
block/parallels.c | 1 +
block/qcow.c | 1 +
block/qcow2-cluster.c | 1 +
block/qcow2-refcount.c | 1 +
block/qcow2-snapshot.c | 1 +
block/qcow2.c | 1 +
block/qed-table.c | 1 +
block/qed.c | 1 +
block/vdi.c | 1 +
block/vhdx-endian.c | 1 +
block/vhdx-log.c | 1 +
block/vhdx.c | 1 +
block/vmdk.c | 1 +
block/vpc.c | 1 +
block/vvfat.c | 1 +
bootdevice.c | 1 +
bsd-user/main.c | 2 +
bsd-user/qemu.h | 1 +
contrib/ivshmem-server/ivshmem-server.c | 1 +
cpu-exec-common.c | 1 +
cpu-exec.c | 1 +
cpus.c | 4 +-
cputlb.c | 1 +
crypto/afsplit.c | 1 +
crypto/block-luks.c | 1 +
device_tree.c | 1 +
disas/tci.c | 1 +
exec.c | 25 ++--
gdbstub.c | 3 +-
hw/acpi/core.c | 6 +
hw/acpi/nvdimm.c | 22 ++--
hw/acpi/piix4.c | 1 +
hw/alpha/alpha_sys.h | 1 +
hw/alpha/pci.c | 1 -
hw/arm/ast2400.c | 1 +
hw/arm/collie.c | 1 +
hw/arm/nseries.c | 3 +
hw/arm/palmetto-bmc.c | 1 +
hw/arm/pxa2xx_gpio.c | 2 +
hw/arm/stellaris.c | 1 +
hw/arm/stm32f205_soc.c | 1 -
hw/arm/strongarm.c | 1 +
hw/arm/strongarm.h | 1 +
hw/arm/xlnx-ep108.c | 1 +
hw/audio/pl041.c | 1 +
hw/block/hd-geometry.c | 1 +
hw/block/m25p80.c | 1 +
hw/block/pflash_cfi01.c | 1 +
hw/bt/hci-csr.c | 1 +
hw/bt/l2cap.c | 1 +
hw/bt/sdp.c | 1 +
hw/char/bcm2835_aux.c | 1 +
hw/char/cadence_uart.c | 4 +
hw/char/digic-uart.c | 1 +
hw/char/imx_serial.c | 1 +
hw/char/pl011.c | 1 +
hw/char/stm32f2xx_usart.c | 1 +
hw/core/Makefile.objs | 2 +-
hw/core/nmi.c | 5 +
hw/core/sysbus.c | 4 +-
hw/cpu/a9mpcore.c | 1 +
hw/display/bcm2835_fb.c | 1 +
hw/display/cg3.c | 2 +
hw/display/pl110.c | 1 +
hw/display/tc6393xb.c | 1 +
hw/display/virtio-gpu.c | 1 +
hw/dma/bcm2835_dma.c | 1 +
hw/dma/pl080.c | 1 +
hw/dma/pl330.c | 1 +
hw/dma/rc4030.c | 1 +
hw/gpio/gpio_key.c | 1 +
hw/gpio/imx_gpio.c | 1 +
hw/gpio/pl061.c | 1 +
hw/i2c/imx_i2c.c | 1 +
hw/i2c/versatile_i2c.c | 1 +
hw/i386/kvm/apic.c | 2 +
hw/i386/kvm/clock.c | 1 +
hw/i386/kvm/i8254.c | 1 +
hw/i386/kvm/pci-assign.c | 1 +
hw/i386/kvmvapic.c | 3 +
hw/input/pl050.c | 1 +
hw/intc/allwinner-a10-pic.c | 1 +
hw/intc/apic.c | 2 +
hw/intc/apic_common.c | 2 +
hw/intc/arm_gic.c | 1 +
hw/intc/arm_gic_kvm.c | 2 +
hw/intc/arm_gicv2m.c | 2 +
hw/intc/armv7m_nvic.c | 2 +
hw/intc/bcm2835_ic.c | 1 +
hw/intc/bcm2836_control.c | 1 +
hw/intc/i8259.c | 1 +
hw/intc/imx_avic.c | 1 +
hw/intc/ioapic.c | 1 +
hw/intc/openpic.c | 1 +
hw/intc/openpic_kvm.c | 2 +
hw/intc/pl190.c | 1 +
hw/intc/s390_flic_kvm.c | 2 +
hw/intc/xics_kvm.c | 1 +
hw/isa/lpc_ich9.c | 1 +
hw/mips/cps.c | 7 +-
hw/mips/cputimer.c | 4 +-
hw/mips/mips_fulong2e.c | 4 +-
hw/mips/mips_int.c | 3 +-
hw/mips/mips_jazz.c | 4 +-
hw/mips/mips_malta.c | 5 +-
hw/mips/mips_mipssim.c | 4 +-
hw/mips/mips_r4k.c | 4 +-
hw/misc/arm11scu.c | 1 +
hw/misc/arm_integrator_debug.c | 1 +
hw/misc/arm_l2x0.c | 1 +
hw/misc/arm_sysctl.c | 1 +
hw/misc/bcm2835_mbox.c | 1 +
hw/misc/bcm2835_property.c | 1 +
hw/misc/imx25_ccm.c | 1 +
hw/misc/imx31_ccm.c | 1 +
hw/misc/imx6_ccm.c | 1 +
hw/misc/imx6_src.c | 1 +
hw/misc/imx_ccm.c | 1 +
hw/misc/macio/cuda.c | 1 +
hw/misc/macio/mac_dbdma.c | 1 +
hw/misc/mips_cmgcr.c | 1 +
hw/misc/mips_cpc.c | 2 +
hw/misc/mips_itu.c | 3 +
hw/misc/pci-testdev.c | 1 +
hw/misc/stm32f2xx_syscfg.c | 1 +
hw/misc/zynq-xadc.c | 1 +
hw/misc/zynq_slcr.c | 1 +
hw/net/allwinner_emac.c | 1 +
hw/net/fsl_etsec/etsec.c | 1 +
hw/net/fsl_etsec/rings.c | 2 +-
hw/net/imx_fec.c | 1 +
hw/net/lan9118.c | 1 +
hw/net/spapr_llan.c | 9 +-
hw/pci-host/apb.c | 1 +
hw/pci-host/versatile.c | 1 +
hw/ppc/e500plat.c | 1 +
hw/ppc/ppc.c | 20 +--
hw/ppc/ppc4xx_devs.c | 1 +
hw/ppc/prep.c | 1 +
hw/ppc/spapr.c | 1 +
hw/ppc/spapr_hcall.c | 3 +
hw/ppc/spapr_iommu.c | 1 +
hw/ppc/spapr_pci.c | 1 +
hw/ppc/spapr_rtas.c | 2 +
hw/ppc/spapr_vio.c | 3 +-
hw/ppc/virtex_ml507.c | 1 +
hw/s390x/css.c | 4 +-
hw/s390x/s390-skeys.c | 1 +
hw/s390x/s390-virtio-ccw.c | 4 +-
hw/s390x/virtio-ccw.c | 5 +-
hw/s390x/virtio-ccw.h | 3 +-
hw/sd/pl181.c | 1 +
hw/sd/sd.c | 1 +
hw/sd/sdhci.c | 1 +
hw/sh4/sh7750.c | 1 +
hw/ssi/imx_spi.c | 1 +
hw/ssi/pl022.c | 1 +
hw/timer/allwinner-a10-pit.c | 1 +
hw/timer/arm_timer.c | 1 +
hw/timer/digic-timer.c | 1 +
hw/timer/imx_epit.c | 1 +
hw/timer/imx_gpt.c | 1 +
hw/timer/pl031.c | 1 +
hw/timer/stm32f2xx_timer.c | 1 +
hw/vfio/common.c | 3 +
hw/watchdog/wdt_diag288.c | 1 +
hw/xtensa/pic_cpu.c | 1 +
include/disas/disas.h | 2 +
include/exec/cpu-all.h | 25 ++++
include/exec/cpu-common.h | 14 ---
include/exec/cpu-defs.h | 1 +
include/exec/exec-all.h | 56 +--------
include/exec/gdbstub.h | 2 +
include/exec/helper-head.h | 23 ++--
include/exec/hwaddr.h | 2 +
include/exec/ioport.h | 19 +--
include/exec/memory.h | 17 ---
include/exec/poison.h | 8 --
include/exec/tb-context.h | 46 +++++++
include/hw/acpi/acpi.h | 7 --
include/hw/arm/arm.h | 2 +-
include/hw/arm/digic.h | 1 -
include/hw/arm/exynos4210.h | 1 +
include/hw/arm/fsl-imx6.h | 1 +
include/hw/arm/omap.h | 1 +
include/hw/arm/pxa.h | 1 +
include/hw/arm/virt-acpi-build.h | 1 +
include/hw/arm/virt.h | 1 +
include/hw/hw.h | 60 +--------
include/hw/i386/apic.h | 5 -
include/hw/isa/isa.h | 2 +-
include/hw/m68k/mcf.h | 2 +
include/hw/mips/cpudevs.h | 7 +-
include/hw/ppc/openpic.h | 3 +-
include/hw/ppc/ppc.h | 24 ++--
include/hw/ppc/spapr_vio.h | 2 +-
{hw => include/hw}/s390x/css.h | 31 ++++-
{target-s390x => include/hw/s390x}/ioinst.h | 16 +--
include/hw/sd/sd.h | 2 +
include/hw/sh4/sh.h | 1 +
include/hw/sysbus.h | 4 +-
include/hw/xen/xen.h | 7 +-
include/migration/cpu.h | 48 ++++++++
include/qemu-common.h | 32 -----
include/qemu/log.h | 17 +--
include/qemu/osdep.h | 2 +
include/qemu/timer.h | 1 +
include/qom/cpu.h | 19 +++
include/sysemu/cpus.h | 13 ++
include/sysemu/dma.h | 5 +-
include/sysemu/kvm.h | 1 +
io/channel-websock.c | 1 +
ioport.c | 14 ++-
kvm-stub.c | 1 -
linux-user/main.c | 2 +
linux-user/qemu.h | 1 +
memory.c | 2 +
migration/ram.c | 2 +
migration/savevm.c | 1 +
monitor.c | 4 +
nbd/nbd-internal.h | 1 +
page_cache.c | 1 +
qemu-nbd.c | 1 +
qtest.c | 2 +
scripts/analyze-inclusions | 102 ++++++++++++++++
scripts/create_config | 2 +-
scripts/feature_to_c.sh | 2 -
scripts/tracetool/format/tcg_helper_c.py | 1 +
slirp/slirp.h | 1 +
stubs/cpu-get-icount.c | 1 +
stubs/slirp.c | 1 +
target-alpha/cpu-qom.h | 41 +------
target-alpha/cpu.c | 1 +
target-alpha/cpu.h | 44 ++++++-
target-alpha/fpu_helper.c | 1 +
target-alpha/gdbstub.c | 1 +
target-alpha/helper.c | 1 +
target-alpha/int_helper.c | 1 +
target-alpha/machine.c | 3 +
target-alpha/mem_helper.c | 1 +
target-alpha/sys_helper.c | 1 +
target-alpha/translate.c | 1 +
target-alpha/vax_helper.c | 1 +
target-arm/arm-powerctl.c | 2 +
target-arm/arm_ldst.h | 1 +
target-arm/cpu-qom.h | 178 +--------------------------
target-arm/cpu.c | 1 +
target-arm/cpu.h | 181 +++++++++++++++++++++++++++-
target-arm/gdbstub.c | 1 +
target-arm/gdbstub64.c | 1 +
target-arm/helper-a64.c | 1 +
target-arm/helper.c | 16 +++
target-arm/internals.h | 15 ---
target-arm/kvm-stub.c | 1 +
target-arm/kvm.c | 1 +
target-arm/kvm32.c | 3 +-
target-arm/kvm64.c | 2 +-
target-arm/machine.c | 3 +
target-arm/op_helper.c | 1 +
target-arm/psci.c | 2 +-
target-arm/translate-a64.c | 1 +
target-arm/translate.c | 1 +
target-cris/cpu-qom.h | 40 +-----
target-cris/cpu.c | 1 +
target-cris/cpu.h | 43 ++++++-
target-cris/gdbstub.c | 1 +
target-cris/helper.c | 1 +
target-cris/machine.c | 3 +
target-cris/mmu.c | 1 +
target-cris/op_helper.c | 1 +
target-cris/translate.c | 1 +
target-i386/bpt_helper.c | 1 +
target-i386/cpu-qom.h | 98 +--------------
target-i386/cpu.c | 3 +-
target-i386/cpu.h | 107 +++++++++++++++-
target-i386/excp_helper.c | 1 +
target-i386/fpu_helper.c | 1 +
target-i386/gdbstub.c | 1 +
target-i386/helper.c | 1 +
target-i386/int_helper.c | 1 +
target-i386/kvm-stub.c | 1 +
target-i386/kvm.c | 2 +-
target-i386/machine.c | 6 +
target-i386/mem_helper.c | 1 +
target-i386/misc_helper.c | 1 +
target-i386/mpx_helper.c | 1 +
target-i386/seg_helper.c | 1 +
target-i386/svm_helper.c | 1 +
target-i386/translate.c | 1 +
target-lm32/cpu-qom.h | 42 +------
target-lm32/cpu.c | 1 +
target-lm32/cpu.h | 46 ++++++-
target-lm32/gdbstub.c | 1 +
target-lm32/helper.c | 1 +
target-lm32/machine.c | 3 +
target-lm32/op_helper.c | 1 +
target-lm32/translate.c | 1 +
target-m68k/cpu-qom.h | 34 +-----
target-m68k/cpu.c | 1 +
target-m68k/cpu.h | 38 +++++-
target-m68k/gdbstub.c | 1 +
target-m68k/helper.c | 1 +
target-m68k/m68k-semi.c | 1 +
target-m68k/op_helper.c | 1 +
target-m68k/translate.c | 1 +
target-microblaze/cpu-qom.h | 44 +------
target-microblaze/cpu.c | 1 +
target-microblaze/cpu.h | 47 +++++++-
target-microblaze/gdbstub.c | 1 +
target-microblaze/helper.c | 1 +
target-microblaze/mmu.c | 1 +
target-microblaze/op_helper.c | 1 +
target-microblaze/translate.c | 1 +
target-mips/cpu-qom.h | 37 +-----
target-mips/cpu.c | 1 +
target-mips/cpu.h | 171 +++++++-------------------
target-mips/gdbstub.c | 1 +
target-mips/helper.c | 126 +++++++++++++++++++
target-mips/kvm.c | 2 +-
target-mips/machine.c | 4 +-
target-mips/mips-semi.c | 1 +
target-mips/msa_helper.c | 1 +
target-mips/op_helper.c | 1 +
target-mips/translate.c | 1 +
target-moxie/cpu.c | 1 +
target-moxie/cpu.h | 1 -
target-moxie/machine.c | 3 +
target-openrisc/cpu.c | 1 +
target-openrisc/cpu.h | 2 -
target-openrisc/exception.c | 1 +
target-openrisc/gdbstub.c | 1 +
target-openrisc/interrupt.c | 1 +
target-openrisc/interrupt_helper.c | 1 +
target-openrisc/machine.c | 3 +
target-openrisc/mmu.c | 1 +
target-openrisc/mmu_helper.c | 1 +
target-openrisc/sys_helper.c | 1 +
target-ppc/cpu-qom.h | 169 +++++++++++++++++---------
target-ppc/cpu.h | 166 ++++++++-----------------
target-ppc/excp_helper.c | 1 +
target-ppc/gdbstub.c | 1 +
target-ppc/int_helper.c | 1 +
target-ppc/kvm-stub.c | 1 +
target-ppc/kvm.c | 2 +-
target-ppc/machine.c | 5 +
target-ppc/mem_helper.c | 2 +
target-ppc/misc_helper.c | 1 +
target-ppc/mmu-hash32.c | 3 +-
target-ppc/mmu-hash32.h | 2 +-
target-ppc/mmu-hash64.c | 3 +-
target-ppc/mmu-hash64.h | 2 +-
target-ppc/mmu_helper.c | 1 +
target-ppc/timebase_helper.c | 1 +
target-ppc/translate.c | 1 +
target-ppc/translate_init.c | 92 ++++++--------
target-s390x/cc_helper.c | 1 +
target-s390x/cpu-qom.h | 46 +------
target-s390x/cpu.c | 4 +-
target-s390x/cpu.h | 177 ++++++++++-----------------
target-s390x/fpu_helper.c | 1 +
target-s390x/gdbstub.c | 2 +
target-s390x/helper.c | 2 +
target-s390x/int_helper.c | 1 +
target-s390x/interrupt.c | 66 +++++++++-
target-s390x/ioinst.c | 2 +-
target-s390x/kvm.c | 2 +-
target-s390x/machine.c | 10 ++
target-s390x/mem_helper.c | 4 +
target-s390x/misc_helper.c | 3 +-
target-s390x/translate.c | 1 +
target-sh4/cpu-qom.h | 31 +----
target-sh4/cpu.c | 1 +
target-sh4/cpu.h | 34 +++++-
target-sh4/gdbstub.c | 1 +
target-sh4/helper.c | 1 +
target-sh4/op_helper.c | 1 +
target-sh4/translate.c | 1 +
target-sparc/cpu-qom.h | 38 +-----
target-sparc/cpu.c | 1 +
target-sparc/cpu.h | 40 +++++-
target-sparc/gdbstub.c | 1 +
target-sparc/helper.c | 1 +
target-sparc/ldst_helper.c | 1 +
target-sparc/machine.c | 6 +
target-sparc/mmu_helper.c | 1 +
target-sparc/translate.c | 1 +
target-tilegx/cpu.c | 1 +
target-tilegx/cpu.h | 2 -
target-tilegx/helper.c | 1 +
target-tilegx/translate.c | 1 +
target-tricore/cpu-qom.h | 28 +----
target-tricore/cpu.c | 1 +
target-tricore/cpu.h | 32 ++++-
target-tricore/helper.c | 1 +
target-tricore/op_helper.c | 1 +
target-tricore/translate.c | 1 +
target-unicore32/cpu-qom.h | 30 +----
target-unicore32/cpu.c | 1 +
target-unicore32/cpu.h | 32 ++++-
target-unicore32/helper.c | 1 +
target-unicore32/op_helper.c | 1 +
target-unicore32/softmmu.c | 1 +
target-unicore32/translate.c | 1 +
target-xtensa/cpu-qom.h | 39 +-----
target-xtensa/cpu.c | 1 +
target-xtensa/cpu.h | 38 +++++-
target-xtensa/gdbstub.c | 2 +
target-xtensa/op_helper.c | 1 +
target-xtensa/translate.c | 1 +
tcg/optimize.c | 3 +-
tcg/tcg-common.c | 2 +
tcg/tcg-op.c | 3 +
tcg/tcg.c | 5 +
tcg/tcg.h | 23 ++++
tests/ide-test.c | 1 +
tests/libqos/malloc.c | 1 +
translate-all.c | 1 +
translate-common.c | 1 +
ui/vnc-ws.c | 1 +
user-exec.c | 1 +
util/buffer.c | 1 +
util/log.c | 12 +-
vl.c | 2 +
xen-hvm.c | 9 +-
431 files changed, 2091 insertions(+), 1606 deletions(-)
create mode 100644 include/exec/tb-context.h
rename {hw => include/hw}/s390x/css.h (76%)
rename {target-s390x => include/hw/s390x}/ioinst.h (87%)
create mode 100644 include/migration/cpu.h
create mode 100644 scripts/analyze-inclusions
--
1.8.3.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 01/52] scripts: add script to build QEMU and analyze inclusions
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 02/52] s390x: move vregs_needed to machine.c Paolo Bonzini
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/analyze-inclusions | 102 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
create mode 100644 scripts/analyze-inclusions
diff --git a/scripts/analyze-inclusions b/scripts/analyze-inclusions
new file mode 100644
index 0000000..c64c023
--- /dev/null
+++ b/scripts/analyze-inclusions
@@ -0,0 +1,102 @@
+#! /bin/sh
+#
+# Copyright (C) 2016 Red Hat, Inc.
+#
+# Author: Paolo Bonzini <pbonzini@redhat.com>
+#
+# Print statistics about header file inclusions.
+#
+# The script has two modes of execution:
+#
+# 1) if invoked with a path on the command line (possibly
+# preceded by a "--" argument), it will run the analysis on
+# an existing build directory
+#
+# 2) otherwise, it will configure and builds QEMU itself in a
+# "+build" subdirectory which is left around when the script
+# exits. In this case the command line is passed directly to
+# "make" (typically used for a "-j" argument suitable for your
+# system).
+#
+# Inspired by a post by Markus Armbruster.
+
+case "x$1" in
+x--)
+ shift
+ cd "$1" || exit $?
+ ;;
+x-* | x)
+ mkdir -p +build
+ cd +build
+ test -f Makefile && make distclean
+ ../configure
+ make "$@"
+ ;;
+*)
+ cd "$1" || exit $?
+esac
+
+QEMU_CFLAGS=$(sed -n s/^QEMU_CFLAGS=//p config-host.mak)
+QEMU_INCLUDES=$(sed -n s/^QEMU_INCLUDES=//p config-host.mak | \
+ sed 's/$(SRC_PATH)/../g' )
+CFLAGS=$(sed -n s/^CFLAGS=//p config-host.mak)
+
+grep_include() {
+ find . -name "*.d" -exec grep -l "$@" {} + | wc -l
+}
+
+echo Found $(find . -name "*.d" | wc -l) object files
+echo $(grep_include -F 'include/qemu-common.h') files include qemu-common.h
+echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
+echo $(grep_include 'target-[a-z0-9]*/cpu\.h') files include cpu.h
+echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
+echo $(grep_include -F 'trace/generated-tracers.h') files include generated-tracers.h
+echo $(grep_include -F 'qapi/error.h') files include qapi/error.h
+echo $(grep_include -F 'qom/object.h') files include qom/object.h
+echo $(grep_include -F 'block/aio.h') files include block/aio.h
+echo $(grep_include -F 'exec/memory.h') files include exec/memory.h
+echo $(grep_include -F 'fpu/softfloat.h') files include fpu/softfloat.h
+echo $(grep_include -F 'qemu/bswap.h') files include qemu/bswap.h
+echo
+
+awk1='
+ /^# / { file = $3;next }
+ NR>1 { bytes[file]+=length()+1; lines[file]++ }
+ END { for(i in lines) print i,lines[i],bytes[i] }'
+
+awk2='
+ {tot_l+=$2;tot_b+=$3;tot_f++}
+ /\/usr.*\/glib/ {glib_l+=$2;glib_b+=$3;glib_f++;next}
+ /\/usr/ {sys_l+=$2;sys_b+=$3;sys_f++;next}
+ {qemu_l+=$2;qemu_b+=$3;qemu_f++;next}
+ END {
+ printf "%s\t %s\t %s\t %s\n", "lines", "bytes", "files", "source"
+ printf "%s\t %s\t %s\t %s\n", qemu_l, qemu_b, qemu_f, "QEMU"
+ printf "%s\t %s\t %s\t %s\n", sys_l, sys_b, sys_f, "system"
+ printf "%s\t %s\t %s\t %s\n", glib_l, glib_b, glib_f, "glib"
+ printf "%s\t %s\t %s\t %s\n", tot_l, tot_b, tot_f, "total"
+ }'
+
+analyze() {
+ cc $QEMU_CFLAGS $QEMU_INCLUDES $CFLAGS -E -o - "$@" | \
+ awk "$awk1" | awk "$awk2"
+ echo
+}
+
+echo osdep.h:
+analyze ../include/qemu/osdep.h
+
+echo qemu-common.h:
+analyze -include ../include/qemu/osdep.h ../include/qemu-common.h
+
+echo hw/hw.h:
+analyze -include ../include/qemu/osdep.h ../include/hw/hw.h
+
+echo trace/generated-tracers.h:
+analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
+
+echo target-i386/cpu.h:
+analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target-i386/cpu.h
+
+echo hw/hw.h + NEED_CPU_H:
+analyze -DNEED_CPU_H -I../target-i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 02/52] s390x: move vregs_needed to machine.c
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 01/52] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-18 16:52 ` Cornelia Huck
2016-05-18 16:36 ` [Qemu-devel] [PATCH 14/52] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
` (6 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel
It is only needed in one file, move it there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target-s390x/cpu.h | 15 ---------------
target-s390x/machine.c | 10 ++++++++++
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 6d97c08..62c24d1 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -1264,21 +1264,6 @@ static inline void s390_crypto_reset(void)
}
}
-#ifdef CONFIG_KVM
-static inline bool vregs_needed(void *opaque)
-{
- if (kvm_enabled()) {
- return kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS);
- }
- return 0;
-}
-#else
-static inline bool vregs_needed(void *opaque)
-{
- return 0;
-}
-#endif
-
/* machine check interruption code */
/* subclasses */
diff --git a/target-s390x/machine.c b/target-s390x/machine.c
index 6b26090..d2b52b2 100644
--- a/target-s390x/machine.c
+++ b/target-s390x/machine.c
@@ -76,6 +76,16 @@ static const VMStateDescription vmstate_fpu = {
}
};
+static bool vregs_needed(void *opaque)
+{
+#ifdef CONFIG_KVM
+ if (kvm_enabled()) {
+ return kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS);
+ }
+#endif
+ return 0;
+}
+
static const VMStateDescription vmstate_vregs = {
.name = "cpu/vregs",
.version_id = 1,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 14/52] target-ppc: do not use target_ulong in cpu-qom.h
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 01/52] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 02/52] s390x: move vregs_needed to machine.c Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 15/52] target-ppc: do not make PowerPCCPUClass depend on target-specific symbols Paolo Bonzini
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel
Bring the PowerPCCPUClass handle_mmu_fault method type into line with
the one in CPUClass.
Using vaddr also makes the cpu-qom.h file target independent.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target-ppc/cpu-qom.h | 3 +--
target-ppc/mmu-hash32.c | 2 +-
target-ppc/mmu-hash32.h | 2 +-
target-ppc/mmu-hash64.c | 2 +-
target-ppc/mmu-hash64.h | 2 +-
5 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index eb822a3..bab501f 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -73,8 +73,7 @@ typedef struct PowerPCCPUClass {
void (*init_proc)(CPUPPCState *env);
int (*check_pow)(CPUPPCState *env);
#if defined(CONFIG_SOFTMMU)
- int (*handle_mmu_fault)(PowerPCCPU *cpu, target_ulong eaddr, int rwx,
- int mmu_idx);
+ int (*handle_mmu_fault)(PowerPCCPU *cpu, vaddr eaddr, int rwx, int mmu_idx);
#endif
bool (*interrupts_big_endian)(PowerPCCPU *cpu);
} PowerPCCPUClass;
diff --git a/target-ppc/mmu-hash32.c b/target-ppc/mmu-hash32.c
index 39abb2f..06ce4d6 100644
--- a/target-ppc/mmu-hash32.c
+++ b/target-ppc/mmu-hash32.c
@@ -383,7 +383,7 @@ static hwaddr ppc_hash32_pte_raddr(target_ulong sr, ppc_hash_pte32_t pte,
return (rpn & ~mask) | (eaddr & mask);
}
-int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, target_ulong eaddr, int rwx,
+int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr, int rwx,
int mmu_idx)
{
CPUState *cs = CPU(cpu);
diff --git a/target-ppc/mmu-hash32.h b/target-ppc/mmu-hash32.h
index afbb9dd..aaceacd 100644
--- a/target-ppc/mmu-hash32.h
+++ b/target-ppc/mmu-hash32.h
@@ -5,7 +5,7 @@
hwaddr get_pteg_offset32(PowerPCCPU *cpu, hwaddr hash);
hwaddr ppc_hash32_get_phys_page_debug(PowerPCCPU *cpu, target_ulong addr);
-int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, target_ulong address, int rw,
+int ppc_hash32_handle_mmu_fault(PowerPCCPU *cpu, vaddr address, int rw,
int mmu_idx);
/*
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c
index 72c4ab5..5184626 100644
--- a/target-ppc/mmu-hash64.c
+++ b/target-ppc/mmu-hash64.c
@@ -589,7 +589,7 @@ unsigned ppc_hash64_hpte_page_shift_noslb(PowerPCCPU *cpu,
return 0;
}
-int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, target_ulong eaddr,
+int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr,
int rwx, int mmu_idx)
{
CPUState *cs = CPU(cpu);
diff --git a/target-ppc/mmu-hash64.h b/target-ppc/mmu-hash64.h
index 9bf8b9b..6423b9f 100644
--- a/target-ppc/mmu-hash64.h
+++ b/target-ppc/mmu-hash64.h
@@ -9,7 +9,7 @@ void dump_slb(FILE *f, fprintf_function cpu_fprintf, PowerPCCPU *cpu);
int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot,
target_ulong esid, target_ulong vsid);
hwaddr ppc_hash64_get_phys_page_debug(PowerPCCPU *cpu, target_ulong addr);
-int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, target_ulong address, int rw,
+int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, vaddr address, int rw,
int mmu_idx);
void ppc_hash64_store_hpte(PowerPCCPU *cpu, target_ulong index,
target_ulong pte0, target_ulong pte1);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 15/52] target-ppc: do not make PowerPCCPUClass depend on target-specific symbols
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
` (2 preceding siblings ...)
2016-05-18 16:36 ` [Qemu-devel] [PATCH 14/52] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-19 3:49 ` Thomas Huth
2016-05-18 16:36 ` [Qemu-devel] [PATCH 16/52] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
` (4 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel
Just leave some members in even if they are unused on e.g.
32-bit PPC or user-mode emulation. This avoids complications
when using PowerPCCPUClass in code that is compiled just
once (because it applies to both 32-bit and 64-bit PPC
for example) but still needs to peek at PPC-specific members.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target-ppc/cpu-qom.h | 4 ----
1 file changed, 4 deletions(-)
diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index bab501f..6f4e929 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -67,14 +67,10 @@ typedef struct PowerPCCPUClass {
uint32_t flags;
int bfd_mach;
uint32_t l1_dcache_size, l1_icache_size;
-#if defined(TARGET_PPC64)
const struct ppc_segment_page_sizes *sps;
-#endif
void (*init_proc)(CPUPPCState *env);
int (*check_pow)(CPUPPCState *env);
-#if defined(CONFIG_SOFTMMU)
int (*handle_mmu_fault)(PowerPCCPU *cpu, vaddr eaddr, int rwx, int mmu_idx);
-#endif
bool (*interrupts_big_endian)(PowerPCCPU *cpu);
} PowerPCCPUClass;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 16/52] target-ppc: make cpu-qom.h not target specific
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
` (3 preceding siblings ...)
2016-05-18 16:36 ` [Qemu-devel] [PATCH 15/52] target-ppc: do not make PowerPCCPUClass depend on target-specific symbols Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-19 3:53 ` Thomas Huth
2016-05-18 16:36 ` [Qemu-devel] [PATCH 22/52] target-xtensa: " Paolo Bonzini
` (3 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel
Make PowerPCCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h. Conversely, move all definitions needed to define
a class to cpu-qom.h. This helps making files independent of NEED_CPU_H
if they only need to pass around CPU pointers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target-ppc/cpu-qom.h | 161 ++++++++++++++++++++++++++++++++++----------------
target-ppc/cpu.h | 164 ++++++++++++++++-----------------------------------
2 files changed, 163 insertions(+), 162 deletions(-)
diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
index 6f4e929..9429bc9 100644
--- a/target-ppc/cpu-qom.h
+++ b/target-ppc/cpu-qom.h
@@ -38,6 +38,117 @@
OBJECT_GET_CLASS(PowerPCCPUClass, (obj), TYPE_POWERPC_CPU)
typedef struct PowerPCCPU PowerPCCPU;
+typedef struct CPUPPCState CPUPPCState;
+typedef struct ppc_tb_t ppc_tb_t;
+typedef struct ppc_dcr_t ppc_dcr_t;
+
+/*****************************************************************************/
+/* MMU model */
+typedef enum powerpc_mmu_t powerpc_mmu_t;
+enum powerpc_mmu_t {
+ POWERPC_MMU_UNKNOWN = 0x00000000,
+ /* Standard 32 bits PowerPC MMU */
+ POWERPC_MMU_32B = 0x00000001,
+ /* PowerPC 6xx MMU with software TLB */
+ POWERPC_MMU_SOFT_6xx = 0x00000002,
+ /* PowerPC 74xx MMU with software TLB */
+ POWERPC_MMU_SOFT_74xx = 0x00000003,
+ /* PowerPC 4xx MMU with software TLB */
+ POWERPC_MMU_SOFT_4xx = 0x00000004,
+ /* PowerPC 4xx MMU with software TLB and zones protections */
+ POWERPC_MMU_SOFT_4xx_Z = 0x00000005,
+ /* PowerPC MMU in real mode only */
+ POWERPC_MMU_REAL = 0x00000006,
+ /* Freescale MPC8xx MMU model */
+ POWERPC_MMU_MPC8xx = 0x00000007,
+ /* BookE MMU model */
+ POWERPC_MMU_BOOKE = 0x00000008,
+ /* BookE 2.06 MMU model */
+ POWERPC_MMU_BOOKE206 = 0x00000009,
+ /* PowerPC 601 MMU model (specific BATs format) */
+ POWERPC_MMU_601 = 0x0000000A,
+#if defined(TARGET_PPC64)
+#define POWERPC_MMU_64 0x00010000
+#define POWERPC_MMU_1TSEG 0x00020000
+#define POWERPC_MMU_AMR 0x00040000
+ /* 64 bits PowerPC MMU */
+ POWERPC_MMU_64B = POWERPC_MMU_64 | 0x00000001,
+ /* Architecture 2.03 and later (has LPCR) */
+ POWERPC_MMU_2_03 = POWERPC_MMU_64 | 0x00000002,
+ /* Architecture 2.06 variant */
+ POWERPC_MMU_2_06 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
+ | POWERPC_MMU_AMR | 0x00000003,
+ /* Architecture 2.06 "degraded" (no 1T segments) */
+ POWERPC_MMU_2_06a = POWERPC_MMU_64 | POWERPC_MMU_AMR
+ | 0x00000003,
+ /* Architecture 2.07 variant */
+ POWERPC_MMU_2_07 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
+ | POWERPC_MMU_AMR | 0x00000004,
+ /* Architecture 2.07 "degraded" (no 1T segments) */
+ POWERPC_MMU_2_07a = POWERPC_MMU_64 | POWERPC_MMU_AMR
+ | 0x00000004,
+#endif /* defined(TARGET_PPC64) */
+};
+
+/*****************************************************************************/
+/* Exception model */
+typedef enum powerpc_excp_t powerpc_excp_t;
+enum powerpc_excp_t {
+ POWERPC_EXCP_UNKNOWN = 0,
+ /* Standard PowerPC exception model */
+ POWERPC_EXCP_STD,
+ /* PowerPC 40x exception model */
+ POWERPC_EXCP_40x,
+ /* PowerPC 601 exception model */
+ POWERPC_EXCP_601,
+ /* PowerPC 602 exception model */
+ POWERPC_EXCP_602,
+ /* PowerPC 603 exception model */
+ POWERPC_EXCP_603,
+ /* PowerPC 603e exception model */
+ POWERPC_EXCP_603E,
+ /* PowerPC G2 exception model */
+ POWERPC_EXCP_G2,
+ /* PowerPC 604 exception model */
+ POWERPC_EXCP_604,
+ /* PowerPC 7x0 exception model */
+ POWERPC_EXCP_7x0,
+ /* PowerPC 7x5 exception model */
+ POWERPC_EXCP_7x5,
+ /* PowerPC 74xx exception model */
+ POWERPC_EXCP_74xx,
+ /* BookE exception model */
+ POWERPC_EXCP_BOOKE,
+ /* PowerPC 970 exception model */
+ POWERPC_EXCP_970,
+ /* POWER7 exception model */
+ POWERPC_EXCP_POWER7,
+ /* POWER8 exception model */
+ POWERPC_EXCP_POWER8,
+};
+
+/*****************************************************************************/
+/* Input pins model */
+typedef enum powerpc_input_t powerpc_input_t;
+enum powerpc_input_t {
+ PPC_FLAGS_INPUT_UNKNOWN = 0,
+ /* PowerPC 6xx bus */
+ PPC_FLAGS_INPUT_6xx,
+ /* BookE bus */
+ PPC_FLAGS_INPUT_BookE,
+ /* PowerPC 405 bus */
+ PPC_FLAGS_INPUT_405,
+ /* PowerPC 970 bus */
+ PPC_FLAGS_INPUT_970,
+ /* PowerPC POWER7 bus */
+ PPC_FLAGS_INPUT_POWER7,
+ /* PowerPC 401 bus */
+ PPC_FLAGS_INPUT_401,
+ /* Freescale RCPU bus */
+ PPC_FLAGS_INPUT_RCPU,
+};
+
+struct ppc_segment_page_sizes;
/**
* PowerPCCPUClass:
@@ -74,57 +185,7 @@ typedef struct PowerPCCPUClass {
bool (*interrupts_big_endian)(PowerPCCPU *cpu);
} PowerPCCPUClass;
-/**
- * PowerPCCPU:
- * @env: #CPUPPCState
- * @cpu_dt_id: CPU index used in the device tree. KVM uses this index too
- * @max_compat: Maximal supported logical PVR from the command line
- * @cpu_version: Current logical PVR, zero if in "raw" mode
- *
- * A PowerPC CPU.
- */
-struct PowerPCCPU {
- /*< private >*/
- CPUState parent_obj;
- /*< public >*/
-
- CPUPPCState env;
- int cpu_dt_id;
- uint32_t max_compat;
- uint32_t cpu_version;
-};
-
-static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)
-{
- return container_of(env, PowerPCCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(ppc_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(PowerPCCPU, env)
-
-PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);
-PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr);
-
-void ppc_cpu_do_interrupt(CPUState *cpu);
-bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
- int flags);
-void ppc_cpu_dump_statistics(CPUState *cpu, FILE *f,
- fprintf_function cpu_fprintf, int flags);
-int ppc_cpu_get_monitor_def(CPUState *cs, const char *name,
- uint64_t *pval);
-hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int ppc_cpu_gdb_read_register_apple(CPUState *cpu, uint8_t *buf, int reg);
-int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg);
-int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
- int cpuid, void *opaque);
#ifndef CONFIG_USER_ONLY
-void ppc_cpu_do_system_reset(CPUState *cs);
-extern const struct VMStateDescription vmstate_ppc_cpu;
-
typedef struct PPCTimebase {
uint64_t guest_timebase;
int64_t time_of_the_day_ns;
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 5282533..15540b2 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -76,7 +76,7 @@
#define CPUArchState struct CPUPPCState
#include "exec/cpu-defs.h"
-
+#include "cpu-qom.h"
#include "fpu/softfloat.h"
#if defined (TARGET_PPC64)
@@ -86,93 +86,6 @@
#endif
/*****************************************************************************/
-/* MMU model */
-typedef enum powerpc_mmu_t powerpc_mmu_t;
-enum powerpc_mmu_t {
- POWERPC_MMU_UNKNOWN = 0x00000000,
- /* Standard 32 bits PowerPC MMU */
- POWERPC_MMU_32B = 0x00000001,
- /* PowerPC 6xx MMU with software TLB */
- POWERPC_MMU_SOFT_6xx = 0x00000002,
- /* PowerPC 74xx MMU with software TLB */
- POWERPC_MMU_SOFT_74xx = 0x00000003,
- /* PowerPC 4xx MMU with software TLB */
- POWERPC_MMU_SOFT_4xx = 0x00000004,
- /* PowerPC 4xx MMU with software TLB and zones protections */
- POWERPC_MMU_SOFT_4xx_Z = 0x00000005,
- /* PowerPC MMU in real mode only */
- POWERPC_MMU_REAL = 0x00000006,
- /* Freescale MPC8xx MMU model */
- POWERPC_MMU_MPC8xx = 0x00000007,
- /* BookE MMU model */
- POWERPC_MMU_BOOKE = 0x00000008,
- /* BookE 2.06 MMU model */
- POWERPC_MMU_BOOKE206 = 0x00000009,
- /* PowerPC 601 MMU model (specific BATs format) */
- POWERPC_MMU_601 = 0x0000000A,
-#if defined(TARGET_PPC64)
-#define POWERPC_MMU_64 0x00010000
-#define POWERPC_MMU_1TSEG 0x00020000
-#define POWERPC_MMU_AMR 0x00040000
- /* 64 bits PowerPC MMU */
- POWERPC_MMU_64B = POWERPC_MMU_64 | 0x00000001,
- /* Architecture 2.03 and later (has LPCR) */
- POWERPC_MMU_2_03 = POWERPC_MMU_64 | 0x00000002,
- /* Architecture 2.06 variant */
- POWERPC_MMU_2_06 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
- | POWERPC_MMU_AMR | 0x00000003,
- /* Architecture 2.06 "degraded" (no 1T segments) */
- POWERPC_MMU_2_06a = POWERPC_MMU_64 | POWERPC_MMU_AMR
- | 0x00000003,
- /* Architecture 2.07 variant */
- POWERPC_MMU_2_07 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
- | POWERPC_MMU_AMR | 0x00000004,
- /* Architecture 2.07 "degraded" (no 1T segments) */
- POWERPC_MMU_2_07a = POWERPC_MMU_64 | POWERPC_MMU_AMR
- | 0x00000004,
-#endif /* defined(TARGET_PPC64) */
-};
-
-/*****************************************************************************/
-/* Exception model */
-typedef enum powerpc_excp_t powerpc_excp_t;
-enum powerpc_excp_t {
- POWERPC_EXCP_UNKNOWN = 0,
- /* Standard PowerPC exception model */
- POWERPC_EXCP_STD,
- /* PowerPC 40x exception model */
- POWERPC_EXCP_40x,
- /* PowerPC 601 exception model */
- POWERPC_EXCP_601,
- /* PowerPC 602 exception model */
- POWERPC_EXCP_602,
- /* PowerPC 603 exception model */
- POWERPC_EXCP_603,
- /* PowerPC 603e exception model */
- POWERPC_EXCP_603E,
- /* PowerPC G2 exception model */
- POWERPC_EXCP_G2,
- /* PowerPC 604 exception model */
- POWERPC_EXCP_604,
- /* PowerPC 7x0 exception model */
- POWERPC_EXCP_7x0,
- /* PowerPC 7x5 exception model */
- POWERPC_EXCP_7x5,
- /* PowerPC 74xx exception model */
- POWERPC_EXCP_74xx,
- /* BookE exception model */
- POWERPC_EXCP_BOOKE,
-#if defined(TARGET_PPC64)
- /* PowerPC 970 exception model */
- POWERPC_EXCP_970,
- /* POWER7 exception model */
- POWERPC_EXCP_POWER7,
- /* POWER8 exception model */
- POWERPC_EXCP_POWER8,
-#endif /* defined(TARGET_PPC64) */
-};
-
-/*****************************************************************************/
/* Exception vectors definitions */
enum {
POWERPC_EXCP_NONE = -1,
@@ -297,27 +210,6 @@ enum {
POWERPC_EXCP_TRAP = 0x40,
};
-/*****************************************************************************/
-/* Input pins model */
-typedef enum powerpc_input_t powerpc_input_t;
-enum powerpc_input_t {
- PPC_FLAGS_INPUT_UNKNOWN = 0,
- /* PowerPC 6xx bus */
- PPC_FLAGS_INPUT_6xx,
- /* BookE bus */
- PPC_FLAGS_INPUT_BookE,
- /* PowerPC 405 bus */
- PPC_FLAGS_INPUT_405,
- /* PowerPC 970 bus */
- PPC_FLAGS_INPUT_970,
- /* PowerPC POWER7 bus */
- PPC_FLAGS_INPUT_POWER7,
- /* PowerPC 401 bus */
- PPC_FLAGS_INPUT_401,
- /* Freescale RCPU bus */
- PPC_FLAGS_INPUT_RCPU,
-};
-
#define PPC_INPUT(env) (env->bus_model)
/*****************************************************************************/
@@ -327,9 +219,7 @@ typedef struct opc_handler_t opc_handler_t;
/* Types used to describe some PowerPC registers */
typedef struct CPUPPCState CPUPPCState;
typedef struct DisasContext DisasContext;
-typedef struct ppc_tb_t ppc_tb_t;
typedef struct ppc_spr_t ppc_spr_t;
-typedef struct ppc_dcr_t ppc_dcr_t;
typedef union ppc_avr_t ppc_avr_t;
typedef union ppc_tlb_t ppc_tlb_t;
@@ -1215,7 +1105,57 @@ do { \
env->wdt_period[3] = (d_); \
} while (0)
-#include "cpu-qom.h"
+/**
+ * PowerPCCPU:
+ * @env: #CPUPPCState
+ * @cpu_dt_id: CPU index used in the device tree. KVM uses this index too
+ * @max_compat: Maximal supported logical PVR from the command line
+ * @cpu_version: Current logical PVR, zero if in "raw" mode
+ *
+ * A PowerPC CPU.
+ */
+struct PowerPCCPU {
+ /*< private >*/
+ CPUState parent_obj;
+ /*< public >*/
+
+ CPUPPCState env;
+ int cpu_dt_id;
+ uint32_t max_compat;
+ uint32_t cpu_version;
+};
+
+static inline PowerPCCPU *ppc_env_get_cpu(CPUPPCState *env)
+{
+ return container_of(env, PowerPCCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(ppc_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(PowerPCCPU, env)
+
+PowerPCCPUClass *ppc_cpu_class_by_pvr(uint32_t pvr);
+PowerPCCPUClass *ppc_cpu_class_by_pvr_mask(uint32_t pvr);
+
+void ppc_cpu_do_interrupt(CPUState *cpu);
+bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
+void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
+ int flags);
+void ppc_cpu_dump_statistics(CPUState *cpu, FILE *f,
+ fprintf_function cpu_fprintf, int flags);
+int ppc_cpu_get_monitor_def(CPUState *cs, const char *name,
+ uint64_t *pval);
+hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int ppc_cpu_gdb_read_register_apple(CPUState *cpu, uint8_t *buf, int reg);
+int ppc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+int ppc_cpu_gdb_write_register_apple(CPUState *cpu, uint8_t *buf, int reg);
+int ppc64_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
+ int cpuid, void *opaque);
+#ifndef CONFIG_USER_ONLY
+void ppc_cpu_do_system_reset(CPUState *cs);
+extern const struct VMStateDescription vmstate_ppc_cpu;
+#endif
/*****************************************************************************/
PowerPCCPU *cpu_ppc_init(const char *cpu_model);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 22/52] target-xtensa: make cpu-qom.h not target specific
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
` (4 preceding siblings ...)
2016-05-18 16:36 ` [Qemu-devel] [PATCH 16/52] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 32/52] explicitly include linux/kvm.h Paolo Bonzini
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel; +Cc: Max Filippov
Make XtensaCPU an opaque type within cpu-qom.h, and move all definitions
of private methods, as well as all type definitions that require knowledge
of the layout to cpu.h. Conversely, move all definitions needed to
define a class to cpu-qom.h. This helps making files independent of
NEED_CPU_H if they only need to pass around CPU pointers.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target-xtensa/cpu-qom.h | 38 +++-----------------------------------
target-xtensa/cpu.h | 37 ++++++++++++++++++++++++++++++++++++-
2 files changed, 39 insertions(+), 36 deletions(-)
diff --git a/target-xtensa/cpu-qom.h b/target-xtensa/cpu-qom.h
index f5d9b9f..403bd95 100644
--- a/target-xtensa/cpu-qom.h
+++ b/target-xtensa/cpu-qom.h
@@ -40,6 +40,8 @@
#define XTENSA_CPU_GET_CLASS(obj) \
OBJECT_GET_CLASS(XtensaCPUClass, (obj), TYPE_XTENSA_CPU)
+typedef struct XtensaConfig XtensaConfig;
+
/**
* XtensaCPUClass:
* @parent_realize: The parent class' realize handler.
@@ -59,40 +61,6 @@ typedef struct XtensaCPUClass {
const XtensaConfig *config;
} XtensaCPUClass;
-/**
- * XtensaCPU:
- * @env: #CPUXtensaState
- *
- * An Xtensa CPU.
- */
-typedef struct XtensaCPU {
- /*< private >*/
- CPUState parent_obj;
- /*< public >*/
-
- CPUXtensaState env;
-} XtensaCPU;
-
-static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)
-{
- return container_of(env, XtensaCPU, env);
-}
-
-#define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e))
-
-#define ENV_OFFSET offsetof(XtensaCPU, env)
-
-void xtensa_cpu_do_interrupt(CPUState *cpu);
-bool xtensa_cpu_exec_interrupt(CPUState *cpu, int interrupt_request);
-void xtensa_cpu_do_unassigned_access(CPUState *cpu, hwaddr addr,
- bool is_write, bool is_exec, int opaque,
- unsigned size);
-void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
- fprintf_function cpu_fprintf, int flags);
-hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-int xtensa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
-int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
- int is_write, int is_user, uintptr_t retaddr);
+typedef struct XtensaCPU XtensaCPU;
#endif
diff --git a/target-xtensa/cpu.h b/target-xtensa/cpu.h
index d0bd9da..f6bbe29 100644
--- a/target-xtensa/cpu.h
+++ b/target-xtensa/cpu.h
@@ -34,6 +34,7 @@
#define CPUArchState struct CPUXtensaState
#include "qemu-common.h"
+#include "cpu-qom.h"
#include "exec/cpu-defs.h"
#include "fpu/softfloat.h"
@@ -379,7 +380,41 @@ typedef struct CPUXtensaState {
CPU_COMMON
} CPUXtensaState;
-#include "cpu-qom.h"
+/**
+ * XtensaCPU:
+ * @env: #CPUXtensaState
+ *
+ * An Xtensa CPU.
+ */
+struct XtensaCPU {
+ /*< private >*/
+ CPUState parent_obj;
+ /*< public >*/
+
+ CPUXtensaState env;
+};
+
+static inline XtensaCPU *xtensa_env_get_cpu(const CPUXtensaState *env)
+{
+ return container_of(env, XtensaCPU, env);
+}
+
+#define ENV_GET_CPU(e) CPU(xtensa_env_get_cpu(e))
+
+#define ENV_OFFSET offsetof(XtensaCPU, env)
+
+void xtensa_cpu_do_interrupt(CPUState *cpu);
+bool xtensa_cpu_exec_interrupt(CPUState *cpu, int interrupt_request);
+void xtensa_cpu_do_unassigned_access(CPUState *cpu, hwaddr addr,
+ bool is_write, bool is_exec, int opaque,
+ unsigned size);
+void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
+ fprintf_function cpu_fprintf, int flags);
+hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
+int xtensa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
+int xtensa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
+void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
+ int is_write, int is_user, uintptr_t retaddr);
#define cpu_exec cpu_xtensa_exec
#define cpu_signal_handler cpu_xtensa_signal_handler
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 32/52] explicitly include linux/kvm.h
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
` (5 preceding siblings ...)
2016-05-18 16:36 ` [Qemu-devel] [PATCH 22/52] target-xtensa: " Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 42/52] dma: do not depend on kvm_enabled() Paolo Bonzini
2016-05-19 4:04 ` [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Thomas Huth
8 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/kvm/i8254.c | 1 +
hw/i386/kvm/pci-assign.c | 1 +
hw/intc/xics_kvm.c | 1 +
hw/vfio/common.c | 3 +++
4 files changed, 6 insertions(+)
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index a4462e5..734992e 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -29,6 +29,7 @@
#include "hw/timer/i8254.h"
#include "hw/timer/i8254_internal.h"
#include "sysemu/kvm.h"
+#include "linux/kvm.h"
#define KVM_PIT_REINJECT_BIT 0
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index bf425a2..db2cbd2 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -33,6 +33,7 @@
#include "sysemu/sysemu.h"
#include "hw/pci/pci.h"
#include "hw/pci/msi.h"
+#include "linux/kvm.h"
#include "kvm_i386.h"
#include "hw/pci/pci-assign.h"
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index 9029d9e..b40292d 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -31,6 +31,7 @@
#include "cpu.h"
#include "hw/hw.h"
#include "trace.h"
+#include "linux/kvm.h"
#include "hw/ppc/spapr.h"
#include "hw/ppc/xics.h"
#include "kvm_ppc.h"
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index f27db36..88154a1 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -30,6 +30,9 @@
#include "hw/hw.h"
#include "qemu/error-report.h"
#include "sysemu/kvm.h"
+#ifdef CONFIG_KVM
+#include "linux/kvm.h"
+#endif
#include "trace.h"
struct vfio_group_head vfio_group_list =
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 42/52] dma: do not depend on kvm_enabled()
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
` (6 preceding siblings ...)
2016-05-18 16:36 ` [Qemu-devel] [PATCH 32/52] explicitly include linux/kvm.h Paolo Bonzini
@ 2016-05-18 16:36 ` Paolo Bonzini
2016-05-19 4:04 ` [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Thomas Huth
8 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-18 16:36 UTC (permalink / raw)
To: qemu-devel
Memory barriers are needed also by Xen and, when the ioeventfd
bugs are fixed, by TCG as well.
sysemu/kvm.h is not anymore needed in sysemu/dma.h, move it to
the actual users.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/intc/arm_gicv2m.c | 1 +
hw/intc/xics_kvm.c | 2 +-
hw/misc/pci-testdev.c | 1 +
hw/ppc/e500plat.c | 1 +
hw/ppc/spapr_hcall.c | 1 +
hw/ppc/spapr_pci.c | 1 +
hw/ppc/spapr_rtas.c | 1 +
include/sysemu/dma.h | 5 +----
8 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c
index e8b5177..589d315 100644
--- a/hw/intc/arm_gicv2m.c
+++ b/hw/intc/arm_gicv2m.c
@@ -29,6 +29,7 @@
#include "qapi/error.h"
#include "hw/sysbus.h"
#include "hw/pci/msi.h"
+#include "sysemu/kvm.h"
#define TYPE_ARM_GICV2M "arm-gicv2m"
#define ARM_GICV2M(obj) OBJECT_CHECK(ARMGICv2mState, (obj), TYPE_ARM_GICV2M)
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index b40292d..55fd801 100644
--- a/hw/intc/xics_kvm.c
+++ b/hw/intc/xics_kvm.c
@@ -31,7 +31,7 @@
#include "cpu.h"
#include "hw/hw.h"
#include "trace.h"
-#include "linux/kvm.h"
+#include "sysemu/kvm.h"
#include "hw/ppc/spapr.h"
#include "hw/ppc/xics.h"
#include "kvm_ppc.h"
diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
index 2f2e989..7d59902 100644
--- a/hw/misc/pci-testdev.c
+++ b/hw/misc/pci-testdev.c
@@ -21,6 +21,7 @@
#include "hw/hw.h"
#include "hw/pci/pci.h"
#include "qemu/event_notifier.h"
+#include "sysemu/kvm.h"
typedef struct PCITestDevHdr {
uint8_t test;
diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c
index b00565c..94b4545 100644
--- a/hw/ppc/e500plat.c
+++ b/hw/ppc/e500plat.c
@@ -14,6 +14,7 @@
#include "e500.h"
#include "hw/boards.h"
#include "sysemu/device_tree.h"
+#include "sysemu/kvm.h"
#include "hw/pci/pci.h"
#include "hw/ppc/openpic.h"
#include "kvm_ppc.h"
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 8f40602..4426a50 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -7,6 +7,7 @@
#include "mmu-hash64.h"
#include "cpu-models.h"
#include "trace.h"
+#include "sysemu/kvm.h"
#include "kvm_ppc.h"
struct SPRSyncState {
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 573e635..e55b505 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -44,6 +44,7 @@
#include "hw/pci/pci_bus.h"
#include "hw/ppc/spapr_drc.h"
#include "sysemu/device_tree.h"
+#include "sysemu/kvm.h"
#include "hw/vfio/vfio.h"
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index f073258..580829e 100644
--- a/hw/ppc/spapr_rtas.c
+++ b/hw/ppc/spapr_rtas.c
@@ -31,6 +31,7 @@
#include "hw/qdev.h"
#include "sysemu/device_tree.h"
#include "sysemu/cpus.h"
+#include "sysemu/kvm.h"
#include "hw/ppc/spapr.h"
#include "hw/ppc/spapr_vio.h"
diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h
index 0f7cd4d..d6e96a4 100644
--- a/include/sysemu/dma.h
+++ b/include/sysemu/dma.h
@@ -15,7 +15,6 @@
#include "hw/hw.h"
#include "block/block.h"
#include "block/accounting.h"
-#include "sysemu/kvm.h"
typedef struct ScatterGatherEntry ScatterGatherEntry;
@@ -67,9 +66,7 @@ static inline void dma_barrier(AddressSpace *as, DMADirection dir)
* use lighter barriers based on the direction of the
* transfer, the DMA context, etc...
*/
- if (kvm_enabled()) {
- smp_mb();
- }
+ smp_mb();
}
/* Checks that the given range of addresses is valid for DMA. This is
--
1.8.3.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 02/52] s390x: move vregs_needed to machine.c
2016-05-18 16:36 ` [Qemu-devel] [PATCH 02/52] s390x: move vregs_needed to machine.c Paolo Bonzini
@ 2016-05-18 16:52 ` Cornelia Huck
0 siblings, 0 replies; 14+ messages in thread
From: Cornelia Huck @ 2016-05-18 16:52 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Wed, 18 May 2016 18:36:15 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:
> It is only needed in one file, move it there.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target-s390x/cpu.h | 15 ---------------
> target-s390x/machine.c | 10 ++++++++++
> 2 files changed, 10 insertions(+), 15 deletions(-)
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 15/52] target-ppc: do not make PowerPCCPUClass depend on target-specific symbols
2016-05-18 16:36 ` [Qemu-devel] [PATCH 15/52] target-ppc: do not make PowerPCCPUClass depend on target-specific symbols Paolo Bonzini
@ 2016-05-19 3:49 ` Thomas Huth
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Huth @ 2016-05-19 3:49 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 18.05.2016 18:36, Paolo Bonzini wrote:
> Just leave some members in even if they are unused on e.g.
> 32-bit PPC or user-mode emulation. This avoids complications
> when using PowerPCCPUClass in code that is compiled just
> once (because it applies to both 32-bit and 64-bit PPC
> for example) but still needs to peek at PPC-specific members.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target-ppc/cpu-qom.h | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
> index bab501f..6f4e929 100644
> --- a/target-ppc/cpu-qom.h
> +++ b/target-ppc/cpu-qom.h
> @@ -67,14 +67,10 @@ typedef struct PowerPCCPUClass {
> uint32_t flags;
> int bfd_mach;
> uint32_t l1_dcache_size, l1_icache_size;
> -#if defined(TARGET_PPC64)
> const struct ppc_segment_page_sizes *sps;
> -#endif
> void (*init_proc)(CPUPPCState *env);
> int (*check_pow)(CPUPPCState *env);
> -#if defined(CONFIG_SOFTMMU)
> int (*handle_mmu_fault)(PowerPCCPU *cpu, vaddr eaddr, int rwx, int mmu_idx);
> -#endif
> bool (*interrupts_big_endian)(PowerPCCPU *cpu);
> } PowerPCCPUClass;
>
>
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 16/52] target-ppc: make cpu-qom.h not target specific
2016-05-18 16:36 ` [Qemu-devel] [PATCH 16/52] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
@ 2016-05-19 3:53 ` Thomas Huth
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Huth @ 2016-05-19 3:53 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 18.05.2016 18:36, Paolo Bonzini wrote:
> Make PowerPCCPU an opaque type within cpu-qom.h, and move all definitions
> of private methods, as well as all type definitions that require knowledge
> of the layout to cpu.h. Conversely, move all definitions needed to define
> a class to cpu-qom.h. This helps making files independent of NEED_CPU_H
> if they only need to pass around CPU pointers.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> target-ppc/cpu-qom.h | 161 ++++++++++++++++++++++++++++++++++----------------
> target-ppc/cpu.h | 164 ++++++++++++++++-----------------------------------
> 2 files changed, 163 insertions(+), 162 deletions(-)
>
> diff --git a/target-ppc/cpu-qom.h b/target-ppc/cpu-qom.h
> index 6f4e929..9429bc9 100644
> --- a/target-ppc/cpu-qom.h
> +++ b/target-ppc/cpu-qom.h
> @@ -38,6 +38,117 @@
> OBJECT_GET_CLASS(PowerPCCPUClass, (obj), TYPE_POWERPC_CPU)
>
> typedef struct PowerPCCPU PowerPCCPU;
> +typedef struct CPUPPCState CPUPPCState;
> +typedef struct ppc_tb_t ppc_tb_t;
> +typedef struct ppc_dcr_t ppc_dcr_t;
> +
> +/*****************************************************************************/
> +/* MMU model */
> +typedef enum powerpc_mmu_t powerpc_mmu_t;
> +enum powerpc_mmu_t {
> + POWERPC_MMU_UNKNOWN = 0x00000000,
> + /* Standard 32 bits PowerPC MMU */
> + POWERPC_MMU_32B = 0x00000001,
> + /* PowerPC 6xx MMU with software TLB */
> + POWERPC_MMU_SOFT_6xx = 0x00000002,
> + /* PowerPC 74xx MMU with software TLB */
> + POWERPC_MMU_SOFT_74xx = 0x00000003,
> + /* PowerPC 4xx MMU with software TLB */
> + POWERPC_MMU_SOFT_4xx = 0x00000004,
> + /* PowerPC 4xx MMU with software TLB and zones protections */
> + POWERPC_MMU_SOFT_4xx_Z = 0x00000005,
> + /* PowerPC MMU in real mode only */
> + POWERPC_MMU_REAL = 0x00000006,
> + /* Freescale MPC8xx MMU model */
> + POWERPC_MMU_MPC8xx = 0x00000007,
> + /* BookE MMU model */
> + POWERPC_MMU_BOOKE = 0x00000008,
> + /* BookE 2.06 MMU model */
> + POWERPC_MMU_BOOKE206 = 0x00000009,
> + /* PowerPC 601 MMU model (specific BATs format) */
> + POWERPC_MMU_601 = 0x0000000A,
> +#if defined(TARGET_PPC64)
> +#define POWERPC_MMU_64 0x00010000
> +#define POWERPC_MMU_1TSEG 0x00020000
> +#define POWERPC_MMU_AMR 0x00040000
> + /* 64 bits PowerPC MMU */
> + POWERPC_MMU_64B = POWERPC_MMU_64 | 0x00000001,
> + /* Architecture 2.03 and later (has LPCR) */
> + POWERPC_MMU_2_03 = POWERPC_MMU_64 | 0x00000002,
> + /* Architecture 2.06 variant */
> + POWERPC_MMU_2_06 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
> + | POWERPC_MMU_AMR | 0x00000003,
> + /* Architecture 2.06 "degraded" (no 1T segments) */
> + POWERPC_MMU_2_06a = POWERPC_MMU_64 | POWERPC_MMU_AMR
> + | 0x00000003,
> + /* Architecture 2.07 variant */
> + POWERPC_MMU_2_07 = POWERPC_MMU_64 | POWERPC_MMU_1TSEG
> + | POWERPC_MMU_AMR | 0x00000004,
> + /* Architecture 2.07 "degraded" (no 1T segments) */
> + POWERPC_MMU_2_07a = POWERPC_MMU_64 | POWERPC_MMU_AMR
> + | 0x00000004,
> +#endif /* defined(TARGET_PPC64) */
> +};
> +
> +/*****************************************************************************/
> +/* Exception model */
> +typedef enum powerpc_excp_t powerpc_excp_t;
> +enum powerpc_excp_t {
> + POWERPC_EXCP_UNKNOWN = 0,
> + /* Standard PowerPC exception model */
> + POWERPC_EXCP_STD,
> + /* PowerPC 40x exception model */
> + POWERPC_EXCP_40x,
> + /* PowerPC 601 exception model */
> + POWERPC_EXCP_601,
> + /* PowerPC 602 exception model */
> + POWERPC_EXCP_602,
> + /* PowerPC 603 exception model */
> + POWERPC_EXCP_603,
> + /* PowerPC 603e exception model */
> + POWERPC_EXCP_603E,
> + /* PowerPC G2 exception model */
> + POWERPC_EXCP_G2,
> + /* PowerPC 604 exception model */
> + POWERPC_EXCP_604,
> + /* PowerPC 7x0 exception model */
> + POWERPC_EXCP_7x0,
> + /* PowerPC 7x5 exception model */
> + POWERPC_EXCP_7x5,
> + /* PowerPC 74xx exception model */
> + POWERPC_EXCP_74xx,
> + /* BookE exception model */
> + POWERPC_EXCP_BOOKE,
> + /* PowerPC 970 exception model */
> + POWERPC_EXCP_970,
> + /* POWER7 exception model */
> + POWERPC_EXCP_POWER7,
> + /* POWER8 exception model */
> + POWERPC_EXCP_POWER8,
> +};
Hmm, now you've removed the "#if defined(TARGET_PPC64)" from the enum
powerpc_excp_t, but you kept it in the enum powerpc_mmu_t ... in case
you respin, maybe remove it from powerpc_mmu_t, too?
Thomas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
` (7 preceding siblings ...)
2016-05-18 16:36 ` [Qemu-devel] [PATCH 42/52] dma: do not depend on kvm_enabled() Paolo Bonzini
@ 2016-05-19 4:04 ` Thomas Huth
2016-05-19 10:55 ` Paolo Bonzini
8 siblings, 1 reply; 14+ messages in thread
From: Thomas Huth @ 2016-05-19 4:04 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Cornelia Huck
On 18.05.2016 18:36, Paolo Bonzini wrote:
> This series removes usage of NEED_CPU_H from several central
> include files in QEMU, most notably hw/hw.h and qemu-common.h.
> Definitions conditional on NEED_CPU_H remain only in disas/disas.h,
> exec/gdbstub.h, exec/helper-head.h and exec/log.h.
>
> The interesting patches are interspersed with other miscellaenous
> cleanups that I won't really dwell on in the cover letter; the main
> changes are:
>
> - make sure that target-independent code can access QOM objects
> for the CPU through an opaque type.
There still seems to be some target-specific code in some of the
cpu-qom.h headers:
$ grep -r TARGET_ target-*/cpu-qom.h
target-i386/cpu-qom.h:#ifdef TARGET_X86_64
target-mips/cpu-qom.h:#ifdef TARGET_MIPS64
target-ppc/cpu-qom.h:#ifdef TARGET_PPC64
target-ppc/cpu-qom.h:#elif defined(TARGET_PPCEMB)
target-ppc/cpu-qom.h:#if defined(TARGET_PPC64)
target-ppc/cpu-qom.h:#endif /* defined(TARGET_PPC64) */
target-sparc/cpu-qom.h:#ifdef TARGET_SPARC64
This will mainly affect the *_CPU_CLASS macros ... should these macros
now also be moved to target-*/cpu.h instead?
[...]
> As before, I would appreciate people compile-testing it on PPC. It should
> fix all the problems reported previously. The changes are available in
> the git repository at git://github.com/bonzini/qemu.git, branch need-cpu-h
I've just re-checked that branch, and now it compiles fine for me on PPC.
Thomas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups
2016-05-19 4:04 ` [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Thomas Huth
@ 2016-05-19 10:55 ` Paolo Bonzini
0 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-05-19 10:55 UTC (permalink / raw)
To: Thomas Huth, qemu-devel; +Cc: Cornelia Huck
On 19/05/2016 06:04, Thomas Huth wrote:
> On 18.05.2016 18:36, Paolo Bonzini wrote:
>> This series removes usage of NEED_CPU_H from several central
>> include files in QEMU, most notably hw/hw.h and qemu-common.h.
>> Definitions conditional on NEED_CPU_H remain only in disas/disas.h,
>> exec/gdbstub.h, exec/helper-head.h and exec/log.h.
>>
>> The interesting patches are interspersed with other miscellaenous
>> cleanups that I won't really dwell on in the cover letter; the main
>> changes are:
>>
>> - make sure that target-independent code can access QOM objects
>> for the CPU through an opaque type.
>
> There still seems to be some target-specific code in some of the
> cpu-qom.h headers:
>
> $ grep -r TARGET_ target-*/cpu-qom.h
> target-i386/cpu-qom.h:#ifdef TARGET_X86_64
> target-mips/cpu-qom.h:#ifdef TARGET_MIPS64
> target-ppc/cpu-qom.h:#ifdef TARGET_PPC64
> target-ppc/cpu-qom.h:#elif defined(TARGET_PPCEMB)
> target-ppc/cpu-qom.h:#if defined(TARGET_PPC64)
> target-ppc/cpu-qom.h:#endif /* defined(TARGET_PPC64) */
> target-sparc/cpu-qom.h:#ifdef TARGET_SPARC64
>
> This will mainly affect the *_CPU_CLASS macros ... should these macros
> now also be moved to target-*/cpu.h instead?
Probably, together with X86_CPU. A separate patch though.
Thanks,
Paolo
> [...]
>> As before, I would appreciate people compile-testing it on PPC. It should
>> fix all the problems reported previously. The changes are available in
>> the git repository at git://github.com/bonzini/qemu.git, branch need-cpu-h
>
> I've just re-checked that branch, and now it compiles fine for me on PPC.
>
> Thomas
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-05-19 10:56 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 16:36 [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 01/52] scripts: add script to build QEMU and analyze inclusions Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 02/52] s390x: move vregs_needed to machine.c Paolo Bonzini
2016-05-18 16:52 ` Cornelia Huck
2016-05-18 16:36 ` [Qemu-devel] [PATCH 14/52] target-ppc: do not use target_ulong in cpu-qom.h Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 15/52] target-ppc: do not make PowerPCCPUClass depend on target-specific symbols Paolo Bonzini
2016-05-19 3:49 ` Thomas Huth
2016-05-18 16:36 ` [Qemu-devel] [PATCH 16/52] target-ppc: make cpu-qom.h not target specific Paolo Bonzini
2016-05-19 3:53 ` Thomas Huth
2016-05-18 16:36 ` [Qemu-devel] [PATCH 22/52] target-xtensa: " Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 32/52] explicitly include linux/kvm.h Paolo Bonzini
2016-05-18 16:36 ` [Qemu-devel] [PATCH 42/52] dma: do not depend on kvm_enabled() Paolo Bonzini
2016-05-19 4:04 ` [Qemu-devel] [PATCH CFT v4 00/52] NEED_CPU_H / cpu.h / hw/hw.h cleanups Thomas Huth
2016-05-19 10:55 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.