summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini2016-03-15 16:58:45 +0100
committerPaolo Bonzini2016-05-19 16:42:29 +0200
commit33c11879fd422b759483ed25fef133ea900ea8d7 (patch)
treefe171757f860842a3c5c76474ec7b11bc08c51c8
parentacpi: do not use TARGET_PAGE_SIZE (diff)
downloadqemu-33c11879fd422b759483ed25fef133ea900ea8d7.tar.gz
qemu-33c11879fd422b759483ed25fef133ea900ea8d7.tar.xz
qemu-33c11879fd422b759483ed25fef133ea900ea8d7.zip
qemu-common: push cpu.h inclusion out of qemu-common.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch_init.c2
-rw-r--r--cpus.c3
-rw-r--r--exec.c2
-rw-r--r--gdbstub.c2
-rw-r--r--hw/arm/nseries.c1
-rw-r--r--hw/arm/pxa2xx_gpio.c1
-rw-r--r--hw/core/nmi.c5
-rw-r--r--hw/display/cg3.c1
-rw-r--r--hw/i386/kvm/apic.c2
-rw-r--r--hw/i386/kvm/clock.c1
-rw-r--r--hw/i386/kvmvapic.c2
-rw-r--r--hw/intc/apic.c2
-rw-r--r--hw/intc/apic_common.c2
-rw-r--r--hw/intc/arm_gic_kvm.c2
-rw-r--r--hw/intc/armv7m_nvic.c1
-rw-r--r--hw/intc/openpic_kvm.c2
-rw-r--r--hw/intc/s390_flic_kvm.c2
-rw-r--r--hw/misc/mips_cpc.c1
-rw-r--r--hw/misc/mips_itu.c1
-rw-r--r--hw/ppc/ppc4xx_devs.c1
-rw-r--r--hw/ppc/prep.c1
-rw-r--r--hw/ppc/virtex_ml507.c1
-rw-r--r--hw/xtensa/pic_cpu.c1
-rw-r--r--include/disas/disas.h2
-rw-r--r--include/exec/gdbstub.h2
-rw-r--r--include/exec/hwaddr.h2
-rw-r--r--include/hw/arm/digic.h1
-rw-r--r--include/hw/arm/fsl-imx6.h1
-rw-r--r--include/hw/arm/virt-acpi-build.h1
-rw-r--r--include/hw/arm/virt.h1
-rw-r--r--include/hw/hw.h1
-rw-r--r--include/hw/sd/sd.h2
-rw-r--r--include/hw/xen/xen.h7
-rw-r--r--include/qemu-common.h5
-rw-r--r--include/sysemu/kvm.h1
-rw-r--r--ioport.c2
-rw-r--r--memory.c2
-rw-r--r--migration/ram.c2
-rw-r--r--migration/savevm.c1
-rw-r--r--monitor.c2
-rw-r--r--qtest.c2
-rw-r--r--scripts/tracetool/format/tcg_helper_c.py1
-rw-r--r--target-alpha/gdbstub.c1
-rw-r--r--target-alpha/machine.c2
-rw-r--r--target-arm/gdbstub.c1
-rw-r--r--target-arm/gdbstub64.c1
-rw-r--r--target-arm/kvm-stub.c1
-rw-r--r--target-arm/kvm32.c2
-rw-r--r--target-arm/kvm64.c2
-rw-r--r--target-arm/machine.c2
-rw-r--r--target-cris/gdbstub.c1
-rw-r--r--target-cris/machine.c2
-rw-r--r--target-i386/gdbstub.c1
-rw-r--r--target-i386/kvm-stub.c1
-rw-r--r--target-i386/kvm.c2
-rw-r--r--target-i386/machine.c2
-rw-r--r--target-lm32/gdbstub.c1
-rw-r--r--target-lm32/machine.c2
-rw-r--r--target-m68k/gdbstub.c1
-rw-r--r--target-microblaze/gdbstub.c1
-rw-r--r--target-mips/cpu.h18
-rw-r--r--target-mips/gdbstub.c1
-rw-r--r--target-mips/helper.c17
-rw-r--r--target-mips/kvm.c2
-rw-r--r--target-mips/machine.c2
-rw-r--r--target-moxie/machine.c2
-rw-r--r--target-openrisc/gdbstub.c1
-rw-r--r--target-openrisc/machine.c2
-rw-r--r--target-ppc/gdbstub.c1
-rw-r--r--target-ppc/kvm-stub.c1
-rw-r--r--target-ppc/kvm.c2
-rw-r--r--target-ppc/machine.c2
-rw-r--r--target-s390x/gdbstub.c1
-rw-r--r--target-s390x/kvm.c2
-rw-r--r--target-sh4/gdbstub.c1
-rw-r--r--target-sparc/gdbstub.c1
-rw-r--r--target-sparc/machine.c2
-rw-r--r--target-xtensa/gdbstub.c1
-rw-r--r--tcg/optimize.c3
-rw-r--r--tcg/tcg-op.c2
-rw-r--r--tcg/tcg.h1
-rw-r--r--xen-hvm.c1
82 files changed, 133 insertions, 36 deletions
diff --git a/arch_init.c b/arch_init.c
index e3bb1b3ac4..07f047fad4 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -22,6 +22,8 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "sysemu/sysemu.h"
#include "sysemu/arch_init.h"
#include "hw/pci/pci.h"
diff --git a/cpus.c b/cpus.c
index cbeb1f6139..7b6ebebde7 100644
--- a/cpus.c
+++ b/cpus.c
@@ -24,7 +24,8 @@
/* Needed early for CONFIG_BSD etc. */
#include "qemu/osdep.h"
-
+#include "qemu-common.h"
+#include "cpu.h"
#include "monitor/monitor.h"
#include "qapi/qmp/qerror.h"
#include "qemu/error-report.h"
diff --git a/exec.c b/exec.c
index ed10ba1af1..d26df55706 100644
--- a/exec.c
+++ b/exec.c
@@ -28,10 +28,10 @@
#include "hw/qdev-core.h"
#if !defined(CONFIG_USER_ONLY)
#include "hw/boards.h"
+#include "hw/xen/xen.h"
#endif
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
-#include "hw/xen/xen.h"
#include "qemu/timer.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
diff --git a/gdbstub.c b/gdbstub.c
index 0e431fd4df..c19ce39bdc 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -19,7 +19,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
-
+#include "cpu.h"
#ifdef CONFIG_USER_ONLY
#include "qemu.h"
#else
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index f3a9b1a826..6131c345b1 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "cpu.h"
#include "qemu/cutils.h"
#include "qemu/bswap.h"
#include "sysemu/sysemu.h"
diff --git a/hw/arm/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
index 67e7e70943..8c9626e9f2 100644
--- a/hw/arm/pxa2xx_gpio.c
+++ b/hw/arm/pxa2xx_gpio.c
@@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "hw/arm/pxa.h"
diff --git a/hw/core/nmi.c b/hw/core/nmi.c
index e8bcc4177b..f616a79312 100644
--- a/hw/core/nmi.c
+++ b/hw/core/nmi.c
@@ -20,11 +20,16 @@
*/
#include "qemu/osdep.h"
+#include "qom/cpu.h"
#include "hw/nmi.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "monitor/monitor.h"
+#if defined(TARGET_I386)
+#include "cpu.h"
+#endif
+
struct do_nmi_s {
int cpu_index;
Error *err;
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index fc0d97fa4b..eb0e71a90a 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/error-report.h"
#include "ui/console.h"
#include "hw/sysbus.h"
diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c
index 3c7c8fa007..c5983c79be 100644
--- a/hw/i386/kvm/apic.c
+++ b/hw/i386/kvm/apic.c
@@ -10,6 +10,8 @@
* See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/i386/apic_internal.h"
#include "hw/pci/msi.h"
#include "sysemu/kvm.h"
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index a3b300cadf..0f75dd385a 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -15,6 +15,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/host-utils.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index f14445d4fb..466c3c4cd7 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -9,6 +9,8 @@
* top-level directory.
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "sysemu/sysemu.h"
#include "sysemu/cpus.h"
#include "sysemu/kvm.h"
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 28c2ea5406..e1ab9354c6 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -17,6 +17,8 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/thread.h"
#include "hw/i386/apic_internal.h"
#include "hw/i386/apic.h"
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index 4abe145c68..e6eb694de0 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -19,6 +19,8 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/i386/apic.h"
#include "hw/i386/apic_internal.h"
#include "trace.h"
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
index bc85ab769f..5593cdb3e4 100644
--- a/hw/intc/arm_gic_kvm.c
+++ b/hw/intc/arm_gic_kvm.c
@@ -21,6 +21,8 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/sysbus.h"
#include "migration/migration.h"
#include "sysemu/kvm.h"
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index 669e82adfc..4d584ef74c 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "hw/sysbus.h"
#include "qemu/timer.h"
#include "hw/arm/arm.h"
diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c
index e47e94f2cf..0518e017c4 100644
--- a/hw/intc/openpic_kvm.c
+++ b/hw/intc/openpic_kvm.c
@@ -24,6 +24,8 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include <sys/ioctl.h>
#include "exec/address-spaces.h"
#include "hw/hw.h"
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index 02449b390e..eed6325cde 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -11,6 +11,8 @@
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include <sys/ioctl.h>
#include "qemu/error-report.h"
#include "hw/sysbus.h"
diff --git a/hw/misc/mips_cpc.c b/hw/misc/mips_cpc.c
index d2b8e42da7..05688b7c4b 100644
--- a/hw/misc/mips_cpc.c
+++ b/hw/misc/mips_cpc.c
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "cpu.h"
#include "hw/sysbus.h"
#include "hw/misc/mips_cpc.h"
diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
index da5455062d..c1a44537a3 100644
--- a/hw/misc/mips_itu.c
+++ b/hw/misc/mips_itu.c
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/sysbus.h"
#include "sysemu/sysemu.h"
diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
index 7d59018fc2..e7f413e49d 100644
--- a/hw/ppc/ppc4xx_devs.c
+++ b/hw/ppc/ppc4xx_devs.c
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/ppc/ppc.h"
#include "hw/ppc/ppc4xx.h"
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 3ffb85e601..07ffe72de1 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/timer/m48t59.h"
#include "hw/i386/pc.h"
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index b807a08c28..b97d96685c 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "cpu.h"
#include "hw/sysbus.h"
#include "hw/hw.h"
#include "hw/char/serial.h"
diff --git a/hw/xtensa/pic_cpu.c b/hw/xtensa/pic_cpu.c
index c835bd0096..ccf65fd8ad 100644
--- a/hw/xtensa/pic_cpu.c
+++ b/hw/xtensa/pic_cpu.c
@@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "qemu/log.h"
#include "qemu/timer.h"
diff --git a/include/disas/disas.h b/include/disas/disas.h
index 2b9293b62a..4930d78ac4 100644
--- a/include/disas/disas.h
+++ b/include/disas/disas.h
@@ -4,6 +4,8 @@
#include "qemu-common.h"
#ifdef NEED_CPU_H
+#include "cpu.h"
+
/* Disassemble this for me please... (debugging). */
void disas(FILE *out, void *code, unsigned long size);
void target_disas(FILE *out, CPUState *cpu, target_ulong code,
diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
index d9e8cf7715..8e3f8d8176 100644
--- a/include/exec/gdbstub.h
+++ b/include/exec/gdbstub.h
@@ -11,6 +11,8 @@
#define GDB_WATCHPOINT_ACCESS 4
#ifdef NEED_CPU_H
+#include "cpu.h"
+
typedef void (*gdb_syscall_complete_cb)(CPUState *cpu,
target_ulong ret, target_ulong err);
diff --git a/include/exec/hwaddr.h b/include/exec/hwaddr.h
index c9eb78fba1..bb41588b9d 100644
--- a/include/exec/hwaddr.h
+++ b/include/exec/hwaddr.h
@@ -3,6 +3,8 @@
#ifndef HWADDR_H
#define HWADDR_H
+#include <inttypes.h>
+
#define HWADDR_BITS 64
/* hwaddr is the type of a physical address (its size can
be different from 'target_ulong'). */
diff --git a/include/hw/arm/digic.h b/include/hw/arm/digic.h
index aaefe0b470..63785baaa8 100644
--- a/include/hw/arm/digic.h
+++ b/include/hw/arm/digic.h
@@ -18,6 +18,7 @@
#ifndef HW_ARM_DIGIC_H
#define HW_ARM_DIGIC_H
+#include "cpu.h"
#include "hw/timer/digic-timer.h"
#include "hw/char/digic-uart.h"
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
index d24aaee1c1..e9157ea4b3 100644
--- a/include/hw/arm/fsl-imx6.h
+++ b/include/hw/arm/fsl-imx6.h
@@ -29,6 +29,7 @@
#include "hw/sd/sdhci.h"
#include "hw/ssi/imx_spi.h"
#include "exec/memory.h"
+#include "cpu.h"
#define TYPE_FSL_IMX6 "fsl,imx6"
#define FSL_IMX6(obj) OBJECT_CHECK(FslIMX6State, (obj), TYPE_FSL_IMX6)
diff --git a/include/hw/arm/virt-acpi-build.h b/include/hw/arm/virt-acpi-build.h
index 7d3700ebf6..e43330ad65 100644
--- a/include/hw/arm/virt-acpi-build.h
+++ b/include/hw/arm/virt-acpi-build.h
@@ -22,6 +22,7 @@
#include "qemu-common.h"
#include "hw/arm/virt.h"
+#include "qemu/notify.h"
#define ACPI_GICC_ENABLED 1
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index ecd8589603..82703d2ecd 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -31,6 +31,7 @@
#define QEMU_ARM_VIRT_H
#include "qemu-common.h"
+#include "exec/hwaddr.h"
#define NUM_GICV2M_SPIS 64
#define NUM_VIRTIO_TRANSPORTS 32
diff --git a/include/hw/hw.h b/include/hw/hw.h
index 29931d1e43..a20321bada 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -2,7 +2,6 @@
#ifndef QEMU_HW_H
#define QEMU_HW_H
-
#ifdef CONFIG_USER_ONLY
#error Cannot include hw/hw.h from user emulation
#endif
diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h
index d5d273a449..c8a4b98d5d 100644
--- a/include/hw/sd/sd.h
+++ b/include/hw/sd/sd.h
@@ -29,6 +29,8 @@
#ifndef __hw_sd_h
#define __hw_sd_h 1
+#include "hw/qdev.h"
+
#define OUT_OF_RANGE (1 << 31)
#define ADDRESS_ERROR (1 << 30)
#define BLOCK_LEN_ERROR (1 << 29)
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index 6eb815aace..6365483473 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -7,8 +7,10 @@
* /usr/include/xen, so it can be included unconditionally.
*/
-#include "hw/irq.h"
#include "qemu-common.h"
+#include "qemu/typedefs.h"
+#include "exec/cpu-common.h"
+#include "hw/irq.h"
/* xen-machine.c */
enum xen_mode {
@@ -37,12 +39,11 @@ qemu_irq *xen_interrupt_controller_init(void);
void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
-#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory);
+
void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
struct MemoryRegion *mr, Error **errp);
void xen_modified_memory(ram_addr_t start, ram_addr_t length);
-#endif
void xen_register_framebuffer(struct MemoryRegion *mr);
diff --git a/include/qemu-common.h b/include/qemu-common.h
index cd3139b2df..835cbc68b8 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -22,11 +22,6 @@
#include "qemu/option.h"
-/* FIXME: Remove NEED_CPU_H. */
-#ifdef NEED_CPU_H
-#include "cpu.h"
-#endif /* !defined(NEED_CPU_H) */
-
/* main function, renamed */
#if defined(CONFIG_COCOA)
int qemu_main(int argc, char **argv, char **envp);
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 0e18f15c94..f9f00e2e56 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -218,6 +218,7 @@ int kvm_init_vcpu(CPUState *cpu);
int kvm_cpu_exec(CPUState *cpu);
#ifdef NEED_CPU_H
+#include "cpu.h"
void kvm_setup_guest_memory(void *start, size_t size);
void kvm_flush_coalesced_mmio_buffer(void);
diff --git a/ioport.c b/ioport.c
index 7a84d5444e..901a997793 100644
--- a/ioport.c
+++ b/ioport.c
@@ -26,6 +26,8 @@
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "exec/ioport.h"
#include "trace.h"
#include "exec/memory.h"
diff --git a/memory.c b/memory.c
index f76f85df95..a8ef85261f 100644
--- a/memory.c
+++ b/memory.c
@@ -15,6 +15,8 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "exec/memory.h"
#include "exec/address-spaces.h"
#include "exec/ioport.h"
diff --git a/migration/ram.c b/migration/ram.c
index 88fbffcce4..5e88080faf 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -26,6 +26,8 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include <zlib.h>
#include "qapi-event.h"
#include "qemu/cutils.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index 16ba443798..bfb3d9178f 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -27,6 +27,7 @@
*/
#include "qemu/osdep.h"
+#include "cpu.h"
#include "hw/boards.h"
#include "hw/hw.h"
#include "hw/qdev.h"
diff --git a/monitor.c b/monitor.c
index d1c193013e..812383ff4d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -23,6 +23,8 @@
*/
#include "qemu/osdep.h"
#include <dirent.h>
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "monitor/qdev.h"
#include "hw/usb.h"
diff --git a/qtest.c b/qtest.c
index 87575bc0b4..da4826c69f 100644
--- a/qtest.c
+++ b/qtest.c
@@ -13,6 +13,8 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "sysemu/qtest.h"
#include "hw/qdev.h"
#include "sysemu/char.h"
diff --git a/scripts/tracetool/format/tcg_helper_c.py b/scripts/tracetool/format/tcg_helper_c.py
index a089b0bf05..e3485b7f92 100644
--- a/scripts/tracetool/format/tcg_helper_c.py
+++ b/scripts/tracetool/format/tcg_helper_c.py
@@ -48,6 +48,7 @@ def generate(events, backend):
'',
'#include "qemu/osdep.h"',
'#include "qemu-common.h"',
+ '#include "cpu.h"',
'#include "trace.h"',
'#include "exec/helper-proto.h"',
'',
diff --git a/target-alpha/gdbstub.c b/target-alpha/gdbstub.c
index 199f028425..d64bcccfa0 100644
--- a/target-alpha/gdbstub.c
+++ b/target-alpha/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int alpha_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-alpha/machine.c b/target-alpha/machine.c
index 3f72943ca6..710b7835b4 100644
--- a/target-alpha/machine.c
+++ b/target-alpha/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "migration/cpu.h"
diff --git a/target-arm/gdbstub.c b/target-arm/gdbstub.c
index 3ba9aadd48..04c1208d03 100644
--- a/target-arm/gdbstub.c
+++ b/target-arm/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
/* Old gdb always expect FPA registers. Newer (xml-aware) gdb only expect
diff --git a/target-arm/gdbstub64.c b/target-arm/gdbstub64.c
index 634c6bc6f2..49bc3fc521 100644
--- a/target-arm/gdbstub64.c
+++ b/target-arm/gdbstub64.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int aarch64_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-arm/kvm-stub.c b/target-arm/kvm-stub.c
index 38bf433876..b2c66df532 100644
--- a/target-arm/kvm-stub.c
+++ b/target-arm/kvm-stub.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "kvm_arm.h"
bool write_kvmstate_to_list(ARMCPU *cpu)
diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c
index d44a7f92b6..7f5935ab13 100644
--- a/target-arm/kvm32.c
+++ b/target-arm/kvm32.c
@@ -15,11 +15,11 @@
#include <linux/kvm.h>
#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
#include "kvm_arm.h"
-#include "cpu.h"
#include "internals.h"
#include "hw/arm/arm.h"
diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c
index e8527bf0cc..e2a34f67a4 100644
--- a/target-arm/kvm64.c
+++ b/target-arm/kvm64.c
@@ -18,6 +18,7 @@
#include <linux/kvm.h>
#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/timer.h"
#include "qemu/error-report.h"
#include "qemu/host-utils.h"
@@ -25,7 +26,6 @@
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
#include "kvm_arm.h"
-#include "cpu.h"
#include "internals.h"
#include "hw/arm/arm.h"
diff --git a/target-arm/machine.c b/target-arm/machine.c
index c23feb18d6..2f452603f1 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "qemu/error-report.h"
diff --git a/target-cris/gdbstub.c b/target-cris/gdbstub.c
index 1bbf17b04a..3a72ee2a98 100644
--- a/target-cris/gdbstub.c
+++ b/target-cris/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int crisv10_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-cris/machine.c b/target-cris/machine.c
index 4c9287f310..6b797e8c1d 100644
--- a/target-cris/machine.c
+++ b/target-cris/machine.c
@@ -19,6 +19,8 @@
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "migration/cpu.h"
diff --git a/target-i386/gdbstub.c b/target-i386/gdbstub.c
index 4b5071398f..c494535df1 100644
--- a/target-i386/gdbstub.c
+++ b/target-i386/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
#ifdef TARGET_X86_64
diff --git a/target-i386/kvm-stub.c b/target-i386/kvm-stub.c
index 8df9c5953f..cdf1506109 100644
--- a/target-i386/kvm-stub.c
+++ b/target-i386/kvm-stub.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "kvm_i386.h"
bool kvm_allows_irq0_override(void)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 799fdfa682..c76e7bbc89 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -22,10 +22,10 @@
#include <linux/kvm_para.h>
#include "qemu-common.h"
+#include "cpu.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm_int.h"
#include "kvm_i386.h"
-#include "cpu.h"
#include "hyperv.h"
#include "exec/gdbstub.h"
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 57203b2fd3..658b066da0 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "hw/i386/pc.h"
diff --git a/target-lm32/gdbstub.c b/target-lm32/gdbstub.c
index 8ac1288bb6..cf929dd392 100644
--- a/target-lm32/gdbstub.c
+++ b/target-lm32/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
#include "hw/lm32/lm32_pic.h"
diff --git a/target-lm32/machine.c b/target-lm32/machine.c
index 6f562161ce..3c258a4bcc 100644
--- a/target-lm32/machine.c
+++ b/target-lm32/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "migration/cpu.h"
diff --git a/target-m68k/gdbstub.c b/target-m68k/gdbstub.c
index f02bb5caf4..c7f44c9bb3 100644
--- a/target-m68k/gdbstub.c
+++ b/target-m68k/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int m68k_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-microblaze/gdbstub.c b/target-microblaze/gdbstub.c
index 89d38980bf..7fb076c2e9 100644
--- a/target-microblaze/gdbstub.c
+++ b/target-microblaze/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int mb_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index c65f84e948..a7c8660d47 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -1145,22 +1145,8 @@ static inline void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val)
}
#endif
-static inline void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
- uint32_t exception,
- int error_code,
- uintptr_t pc)
-{
- CPUState *cs = CPU(mips_env_get_cpu(env));
-
- if (exception < EXCP_SC) {
- qemu_log_mask(CPU_LOG_INT, "%s: %d %d\n",
- __func__, exception, error_code);
- }
- cs->exception_index = exception;
- env->error_code = error_code;
-
- cpu_loop_exit_restore(cs, pc);
-}
+void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env, uint32_t exception,
+ int error_code, uintptr_t pc);
static inline void QEMU_NORETURN do_raise_exception(CPUMIPSState *env,
uint32_t exception,
diff --git a/target-mips/gdbstub.c b/target-mips/gdbstub.c
index b0b4a32ec0..2707ff5c2b 100644
--- a/target-mips/gdbstub.c
+++ b/target-mips/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int mips_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-mips/helper.c b/target-mips/helper.c
index cfea177ee5..1f35e7ff87 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -840,3 +840,20 @@ void r4k_invalidate_tlb (CPUMIPSState *env, int idx, int use_extra)
}
}
#endif
+
+void QEMU_NORETURN do_raise_exception_err(CPUMIPSState *env,
+ uint32_t exception,
+ int error_code,
+ uintptr_t pc)
+{
+ CPUState *cs = CPU(mips_env_get_cpu(env));
+
+ if (exception < EXCP_SC) {
+ qemu_log_mask(CPU_LOG_INT, "%s: %d %d\n",
+ __func__, exception, error_code);
+ }
+ cs->exception_index = exception;
+ env->error_code = error_code;
+
+ cpu_loop_exit_restore(cs, pc);
+}
diff --git a/target-mips/kvm.c b/target-mips/kvm.c
index 950bc05b7c..a854e4de59 100644
--- a/target-mips/kvm.c
+++ b/target-mips/kvm.c
@@ -16,11 +16,11 @@
#include <linux/kvm.h>
#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/error-report.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
-#include "cpu.h"
#include "sysemu/cpus.h"
#include "kvm_mips.h"
#include "exec/memattrs.h"
diff --git a/target-mips/machine.c b/target-mips/machine.c
index eb3d916ef3..7314cfe8c7 100644
--- a/target-mips/machine.c
+++ b/target-mips/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "cpu.h"
#include "migration/cpu.h"
diff --git a/target-moxie/machine.c b/target-moxie/machine.c
index 7810e1cd2b..282dcd869f 100644
--- a/target-moxie/machine.c
+++ b/target-moxie/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "machine.h"
diff --git a/target-openrisc/gdbstub.c b/target-openrisc/gdbstub.c
index edc301a7c5..cb16e76358 100644
--- a/target-openrisc/gdbstub.c
+++ b/target-openrisc/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int openrisc_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/target-openrisc/machine.c b/target-openrisc/machine.c
index bd5d50f338..17b0c77d6c 100644
--- a/target-openrisc/machine.c
+++ b/target-openrisc/machine.c
@@ -18,6 +18,8 @@
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "migration/cpu.h"
diff --git a/target-ppc/gdbstub.c b/target-ppc/gdbstub.c
index 569c380cfa..7a338136a8 100644
--- a/target-ppc/gdbstub.c
+++ b/target-ppc/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
static int ppc_gdb_register_len_apple(int n)
diff --git a/target-ppc/kvm-stub.c b/target-ppc/kvm-stub.c
index 627bcb4322..efeafca1df 100644
--- a/target-ppc/kvm-stub.c
+++ b/target-ppc/kvm-stub.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "hw/ppc/openpic.h"
int kvm_openpic_connect_vcpu(DeviceState *d, CPUState *cs)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index c4c81467e4..24d6032007 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -24,11 +24,11 @@
#include "qemu-common.h"
#include "qemu/error-report.h"
+#include "cpu.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
#include "kvm_ppc.h"
-#include "cpu.h"
#include "sysemu/cpus.h"
#include "sysemu/device_tree.h"
#include "mmu-hash64.h"
diff --git a/target-ppc/machine.c b/target-ppc/machine.c
index c0b91823a9..4911cb7139 100644
--- a/target-ppc/machine.c
+++ b/target-ppc/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "sysemu/kvm.h"
diff --git a/target-s390x/gdbstub.c b/target-s390x/gdbstub.c
index 9fc36cb54e..0992ae722b 100644
--- a/target-s390x/gdbstub.c
+++ b/target-s390x/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
#include "qemu/bitops.h"
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 55ae6d3304..8f46fd0f10 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -29,12 +29,12 @@
#include <asm/ptrace.h>
#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/error-report.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
#include "hw/hw.h"
-#include "cpu.h"
#include "sysemu/device_tree.h"
#include "qapi/qmp/qjson.h"
#include "exec/gdbstub.h"
diff --git a/target-sh4/gdbstub.c b/target-sh4/gdbstub.c
index 1b59ea8c73..13bea00d7d 100644
--- a/target-sh4/gdbstub.c
+++ b/target-sh4/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
/* Hint: Use "set architecture sh4" in GDB to see fpu registers */
diff --git a/target-sparc/gdbstub.c b/target-sparc/gdbstub.c
index e530dc52f5..ffc2baa2e7 100644
--- a/target-sparc/gdbstub.c
+++ b/target-sparc/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
#ifdef TARGET_ABI32
diff --git a/target-sparc/machine.c b/target-sparc/machine.c
index 04806f6728..c8823af951 100644
--- a/target-sparc/machine.c
+++ b/target-sparc/machine.c
@@ -1,4 +1,6 @@
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "hw/hw.h"
#include "hw/boards.h"
#include "qemu/timer.h"
diff --git a/target-xtensa/gdbstub.c b/target-xtensa/gdbstub.c
index 51d4db0836..bfcd591409 100644
--- a/target-xtensa/gdbstub.c
+++ b/target-xtensa/gdbstub.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "cpu.h"
#include "exec/gdbstub.h"
int xtensa_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index f01160815c..def4ba6913 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -24,9 +24,8 @@
*/
#include "qemu/osdep.h"
-
-
#include "qemu-common.h"
+#include "cpu.h"
#include "tcg-op.h"
#define CASE_OP_32_64(x) \
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index f554b86d40..7a159142e6 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -23,6 +23,8 @@
*/
#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "cpu.h"
#include "tcg.h"
#include "tcg-op.h"
diff --git a/tcg/tcg.h b/tcg/tcg.h
index a013d77a33..8abf318343 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -26,6 +26,7 @@
#define TCG_H
#include "qemu-common.h"
+#include "cpu.h"
#include "qemu/bitops.h"
#include "tcg-target.h"
diff --git a/xen-hvm.c b/xen-hvm.c
index 039680a6d9..4236f78ad8 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include <sys/mman.h>
+#include "cpu.h"
#include "hw/pci/pci.h"
#include "hw/i386/pc.h"
#include "hw/i386/apic-msidef.h"