From da34e65cb4025728566d6504a99916f6e7e1dd6a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 14 Mar 2016 09:01:28 +0100 Subject: [PATCH 01/28] include/qemu/osdep.h: Don't include qapi/error.h Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the Error typedef. Since then, we've moved to include qemu/osdep.h everywhere. Its file comment explains: "To avoid getting into possible circular include dependencies, this file should not include any other QEMU headers, with the exceptions of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which are doing a similar job to this file and are under similar constraints." qapi/error.h doesn't do a similar job, and it doesn't adhere to similar constraints: it includes qapi-types.h. That's in excess of 100KiB of crap most .c files don't actually need. Add the typedef to qemu/typedefs.h, and include that instead of qapi/error.h. Include qapi/error.h in .c files that need it and don't get it now. Include qapi-types.h in qom/object.h for uint16List. Update scripts/clean-includes accordingly. Update it further to match reality: replace config.h by config-target.h, add sysemu/os-posix.h, sysemu/os-win32.h. Update the list of includes in the qemu/osdep.h comment quoted above similarly. This reduces the number of objects depending on qapi/error.h from "all of them" to less than a third. Unfortunately, the number depending on qapi-types.h shrinks only a little. More work is needed for that one. Signed-off-by: Markus Armbruster [Fix compilation without the spice devel packages. - Paolo] Signed-off-by: Paolo Bonzini --- async.c | 1 + backends/baum.c | 1 + backends/hostmem-file.c | 1 + backends/hostmem-ram.c | 1 + backends/hostmem.c | 1 + backends/rng-egd.c | 1 + backends/rng-random.c | 1 + backends/rng.c | 1 + backends/tpm.c | 1 + block/backup.c | 1 + block/blkdebug.c | 1 + block/blkverify.c | 1 + block/bochs.c | 1 + block/cloop.c | 1 + block/commit.c | 1 + block/curl.c | 1 + block/dirty-bitmap.c | 2 +- block/dmg.c | 1 + block/gluster.c | 1 + block/io.c | 1 + block/mirror.c | 1 + block/nbd.c | 1 + block/null.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/qed.c | 1 + block/raw-posix.c | 1 + block/raw-win32.c | 1 + block/raw_bsd.c | 1 + block/rbd.c | 1 + block/sheepdog.c | 1 + block/snapshot.c | 1 + block/ssh.c | 1 + block/stream.c | 1 + block/vdi.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 + contrib/ivshmem-server/main.c | 1 + crypto/block-luks.c | 1 + crypto/block-qcow.c | 1 + crypto/block.c | 1 + crypto/cipher.c | 1 + crypto/hash.c | 1 + crypto/init.c | 1 + crypto/ivgen-essiv.c | 1 + crypto/ivgen-plain.c | 1 + crypto/ivgen-plain64.c | 1 + crypto/ivgen.c | 2 ++ crypto/pbkdf-gcrypt.c | 1 + crypto/pbkdf-nettle.c | 1 + crypto/pbkdf-stub.c | 1 + crypto/pbkdf.c | 1 + crypto/secret.c | 1 + crypto/tlscreds.c | 1 + crypto/tlscredsanon.c | 1 + crypto/tlscredsx509.c | 1 + crypto/tlssession.c | 1 + device_tree.c | 1 + exec.c | 1 + gdbstub.c | 1 + hw/9pfs/9p.c | 1 + hw/acpi/cpu_hotplug.c | 1 + hw/acpi/ich9.c | 1 + hw/acpi/pcihp.c | 1 + hw/acpi/piix4.c | 1 + hw/alpha/typhoon.c | 1 + hw/arm/allwinner-a10.c | 1 + hw/arm/armv7m.c | 1 + hw/arm/ast2400.c | 1 + hw/arm/bcm2835_peripherals.c | 1 + hw/arm/bcm2836.c | 1 + hw/arm/boot.c | 1 + hw/arm/cubieboard.c | 1 + hw/arm/digic.c | 1 + hw/arm/digic_boards.c | 1 + hw/arm/exynos4210.c | 1 + hw/arm/fsl-imx25.c | 1 + hw/arm/fsl-imx31.c | 1 + hw/arm/highbank.c | 1 + hw/arm/imx25_pdk.c | 1 + hw/arm/integratorcp.c | 1 + hw/arm/kzm.c | 1 + hw/arm/mainstone.c | 1 + hw/arm/musicpal.c | 1 + hw/arm/netduino2.c | 1 + hw/arm/nseries.c | 1 + hw/arm/omap1.c | 1 + hw/arm/omap2.c | 1 + hw/arm/omap_sx1.c | 1 + hw/arm/palm.c | 1 + hw/arm/palmetto-bmc.c | 1 + hw/arm/pxa2xx.c | 1 + hw/arm/raspi.c | 1 + hw/arm/realview.c | 1 + hw/arm/spitz.c | 1 + hw/arm/stellaris.c | 1 + hw/arm/stm32f205_soc.c | 1 + hw/arm/sysbus-fdt.c | 1 + hw/arm/tosa.c | 1 + hw/arm/versatilepb.c | 1 + hw/arm/vexpress.c | 1 + hw/arm/virt-acpi-build.c | 1 + hw/arm/virt.c | 1 + hw/arm/xilinx_zynq.c | 1 + hw/arm/xlnx-ep108.c | 1 + hw/arm/xlnx-zynqmp.c | 1 + hw/audio/adlib.c | 1 + hw/audio/gus.c | 1 + hw/block/block.c | 1 + hw/block/dataplane/virtio-blk.c | 1 + hw/block/fdc.c | 1 + hw/block/nand.c | 1 + hw/block/nvme.c | 1 + hw/block/onenand.c | 1 + hw/block/pflash_cfi01.c | 1 + hw/block/pflash_cfi02.c | 1 + hw/block/virtio-blk.c | 1 + hw/block/xen_disk.c | 1 + hw/bt/hci.c | 1 + hw/char/debugcon.c | 1 + hw/char/parallel.c | 1 + hw/char/serial-isa.c | 1 + hw/char/serial-pci.c | 1 + hw/char/serial.c | 1 + hw/char/spapr_vty.c | 1 + hw/char/virtio-serial-bus.c | 1 + hw/core/loader.c | 1 + hw/core/machine.c | 1 + hw/core/nmi.c | 1 + hw/core/qdev-properties-system.c | 1 + hw/core/qdev-properties.c | 1 + hw/cpu/a15mpcore.c | 1 + hw/cpu/a9mpcore.c | 1 + hw/cpu/arm11mpcore.c | 1 + hw/cpu/realview_mpcore.c | 1 + hw/cris/axis_dev88.c | 1 + hw/display/bcm2835_fb.c | 1 + hw/display/cg3.c | 1 + hw/display/cirrus_vga.c | 1 + hw/display/sm501.c | 1 + hw/display/tc6393xb.c | 1 + hw/display/tcx.c | 1 + hw/display/vga.c | 1 + hw/display/vmware_vga.c | 1 + hw/dma/bcm2835_dma.c | 1 + hw/dma/pl330.c | 1 + hw/dma/xilinx_axidma.c | 1 + hw/i386/acpi-build.c | 1 + hw/i386/kvm/i8254.c | 1 + hw/i386/kvm/pci-assign.c | 1 + hw/i386/pc_sysfw.c | 1 + hw/i386/pci-assign-load-rom.c | 1 + hw/i386/xen/xen_platform.c | 1 + hw/i386/xen/xen_pvdevice.c | 1 + hw/ide/qdev.c | 1 + hw/input/milkymist-softusb.c | 1 + hw/input/virtio-input-host.c | 1 + hw/input/virtio-input.c | 1 + hw/intc/apic_common.c | 1 + hw/intc/arm_gic.c | 1 + hw/intc/arm_gic_common.c | 1 + hw/intc/arm_gic_kvm.c | 1 + hw/intc/arm_gicv2m.c | 1 + hw/intc/arm_gicv3_common.c | 1 + hw/intc/arm_gicv3_kvm.c | 1 + hw/intc/armv7m_nvic.c | 1 + hw/intc/ioapic_common.c | 1 + hw/intc/openpic.c | 1 + hw/intc/openpic_kvm.c | 1 + hw/intc/realview_gic.c | 1 + hw/intc/xics.c | 1 + hw/intc/xics_kvm.c | 1 + hw/ipack/ipack.c | 1 + hw/ipmi/ipmi_bmc_extern.c | 1 + hw/ipmi/isa_ipmi_bt.c | 1 + hw/ipmi/isa_ipmi_kcs.c | 1 + hw/isa/isa-bus.c | 1 + hw/isa/pc87312.c | 1 + hw/m68k/an5206.c | 1 + hw/m68k/mcf5208.c | 1 + hw/mem/pc-dimm.c | 1 + hw/microblaze/petalogix_ml605_mmu.c | 1 + hw/microblaze/petalogix_s3adsp1800_mmu.c | 1 + hw/mips/mips_fulong2e.c | 1 + hw/mips/mips_mipssim.c | 1 + hw/mips/mips_r4k.c | 1 + hw/misc/bcm2835_mbox.c | 1 + hw/misc/bcm2835_property.c | 1 + hw/misc/ivshmem.c | 1 + hw/misc/macio/macio.c | 1 + hw/misc/tmp105.c | 1 + hw/moxie/moxiesim.c | 1 + hw/net/dp8393x.c | 1 + hw/net/milkymist-minimac2.c | 1 + hw/net/ne2000-isa.c | 1 + hw/net/xilinx_axienet.c | 1 + hw/nvram/spapr_nvram.c | 1 + hw/openrisc/openrisc_sim.c | 1 + hw/pci-bridge/pci_bridge_dev.c | 1 + hw/pci-host/piix.c | 1 + hw/pci-host/prep.c | 1 + hw/pci-host/q35.c | 1 + hw/pci/pcie.c | 1 + hw/pci/shpc.c | 1 + hw/ppc/e500.c | 1 + hw/ppc/mac_newworld.c | 1 + hw/ppc/mac_oldworld.c | 1 + hw/ppc/ppc405_boards.c | 1 + hw/ppc/ppc405_uc.c | 1 + hw/ppc/spapr.c | 1 + hw/ppc/spapr_drc.c | 1 + hw/ppc/spapr_events.c | 1 + hw/ppc/spapr_hcall.c | 1 + hw/ppc/spapr_pci.c | 1 + hw/ppc/spapr_pci_vfio.c | 1 + hw/ppc/spapr_rng.c | 1 + hw/ppc/spapr_vio.c | 1 + hw/s390x/event-facility.c | 1 + hw/s390x/ipl.c | 1 + hw/s390x/s390-virtio-ccw.c | 1 + hw/s390x/s390-virtio.c | 1 + hw/s390x/sclp.c | 1 + hw/s390x/virtio-ccw.c | 1 + hw/scsi/esp-pci.c | 1 + hw/scsi/esp.c | 1 + hw/scsi/scsi-bus.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/scsi/scsi-generic.c | 1 + hw/scsi/vhost-scsi.c | 1 + hw/scsi/virtio-scsi.c | 1 + hw/scsi/vmw_pvscsi.c | 1 + hw/sd/pxa2xx_mmci.c | 1 + hw/sd/sd.c | 1 + hw/sh4/r2d.c | 1 + hw/sh4/shix.c | 1 + hw/smbios/smbios.c | 1 + hw/sparc/leon3.c | 1 + hw/sparc/sun4m.c | 1 + hw/sparc64/sun4u.c | 1 + hw/timer/a9gtimer.c | 1 + hw/timer/arm_mptimer.c | 1 + hw/timer/hpet.c | 1 + hw/timer/m48t59.c | 1 + hw/tpm/tpm_tis.c | 1 + hw/tricore/tricore_testboard.c | 1 + hw/unicore32/puv3.c | 1 + hw/usb/bus.c | 1 + hw/usb/dev-hid.c | 1 + hw/usb/dev-hub.c | 1 + hw/usb/dev-mtp.c | 2 ++ hw/usb/dev-network.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/dev-smartcard-reader.c | 1 + hw/usb/dev-storage.c | 1 + hw/usb/hcd-ehci.c | 1 + hw/usb/hcd-ohci.c | 1 + hw/usb/hcd-uhci.c | 1 + hw/usb/host-libusb.c | 1 + hw/usb/redirect.c | 1 + hw/vfio/platform.c | 1 + hw/virtio/vhost-user.c | 1 + hw/virtio/vhost.c | 1 + hw/virtio/virtio-pci.c | 1 + hw/virtio/virtio-rng.c | 1 + hw/virtio/virtio.c | 1 + hw/xen/xen-host-pci-device.c | 1 + hw/xen/xen_pt.c | 1 + hw/xen/xen_pt_config_init.c | 1 + hw/xen/xen_pt_graphics.c | 1 + hw/xtensa/sim.c | 1 + hw/xtensa/xtfpga.c | 1 + include/qapi/error.h | 5 ----- include/qemu/osdep.h | 9 +++++---- include/qemu/typedefs.h | 1 + include/qom/object.h | 1 + include/ui/qemu-spice.h | 2 +- io/channel-command.c | 1 + io/channel-file.c | 1 + io/channel-socket.c | 1 + io/channel-tls.c | 1 + io/channel-websock.c | 1 + io/channel.c | 1 + io/task.c | 1 + iohandler.c | 1 + main-loop.c | 1 + memory.c | 1 + memory_mapping.c | 1 + migration/block.c | 1 + migration/exec.c | 1 + migration/fd.c | 1 + migration/rdma.c | 1 + nbd/client.c | 1 + nbd/common.c | 1 + nbd/server.c | 1 + net/dump.c | 1 + net/filter-buffer.c | 1 + net/filter.c | 1 + net/socket.c | 1 + net/tap-aix.c | 1 + net/tap-bsd.c | 1 + net/tap-haiku.c | 1 + net/tap-linux.c | 1 + net/tap-solaris.c | 1 + net/tap.c | 1 + qapi/opts-visitor.c | 1 + qapi/qapi-util.c | 1 + qapi/qapi-visit-core.c | 1 + qapi/qmp-dispatch.c | 1 + qapi/qmp-input-visitor.c | 1 + qapi/string-input-visitor.c | 1 + qemu-img.c | 1 + qemu-io-cmds.c | 1 + qemu-io.c | 1 + qemu-nbd.c | 1 + qga/channel-posix.c | 1 + qobject/json-parser.c | 1 + qom/cpu.c | 1 + qom/object.c | 1 + qom/object_interfaces.c | 1 + qom/qom-qobject.c | 1 + qtest.c | 1 + replay/replay-input.c | 1 + replay/replay.c | 1 + scripts/clean-includes | 5 +++-- scripts/qapi-visit.py | 1 + stubs/get-fd.c | 1 + target-alpha/cpu.c | 1 + target-arm/cpu.c | 1 + target-arm/cpu64.c | 1 + target-cris/cpu.c | 1 + target-i386/kvm.c | 1 + target-lm32/cpu.c | 1 + target-m68k/cpu.c | 1 + target-microblaze/cpu.c | 1 + target-mips/cpu.c | 1 + target-moxie/cpu.c | 1 + target-openrisc/cpu.c | 1 + target-ppc/mmu-hash64.c | 1 + target-ppc/mmu_helper.c | 1 + target-s390x/cpu.c | 1 + target-s390x/helper.c | 1 + target-sh4/cpu.c | 1 + target-sparc/cpu.c | 1 + target-tilegx/cpu.c | 1 + target-tricore/cpu.c | 1 + target-unicore32/cpu.c | 1 + target-xtensa/cpu.c | 1 + tests/check-qom-proplist.c | 1 + tests/io-channel-helpers.c | 1 + tests/test-aio.c | 1 + tests/test-base64.c | 2 +- tests/test-blockjob-txn.c | 1 + tests/test-crypto-afsplit.c | 1 + tests/test-crypto-block.c | 1 + tests/test-crypto-cipher.c | 1 + tests/test-crypto-ivgen.c | 1 + tests/test-crypto-pbkdf.c | 1 + tests/test-crypto-secret.c | 1 + tests/test-crypto-tlscredsx509.c | 1 + tests/test-crypto-tlssession.c | 1 + tests/test-io-channel-command.c | 1 + tests/test-io-channel-file.c | 2 +- tests/test-io-channel-socket.c | 1 + tests/test-io-task.c | 1 + tests/test-opts-visitor.c | 1 + tests/test-qemu-opts.c | 1 + tests/test-qmp-input-strict.c | 1 + tests/test-qmp-input-visitor.c | 1 + tests/test-qmp-output-visitor.c | 1 + tests/test-string-input-visitor.c | 1 + tests/test-string-output-visitor.c | 1 + tests/test-thread-pool.c | 1 + tests/test-throttle.c | 1 + tests/test-visitor-serialization.c | 1 + ui/input-linux.c | 1 + ui/vnc-auth-sasl.c | 1 + ui/vnc-auth-vencrypt.c | 1 + ui/vnc-ws.c | 1 + util/base64.c | 1 + util/error.c | 1 + util/oslib-posix.c | 1 + util/oslib-win32.c | 1 + util/qemu-option.c | 1 + util/qemu-sockets.c | 1 + util/throttle.c | 1 + 392 files changed, 399 insertions(+), 15 deletions(-) diff --git a/async.c b/async.c index d4dd2cc799..b4bf205a0c 100644 --- a/async.c +++ b/async.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/aio.h" #include "block/thread-pool.h" diff --git a/backends/baum.c b/backends/baum.c index eef3467c9f..f95f7be8a5 100644 --- a/backends/baum.c +++ b/backends/baum.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "sysemu/char.h" #include "qemu/timer.h" diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index fd59482693..c70f268d6f 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -10,6 +10,7 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "sysemu/hostmem.h" #include "sysemu/sysemu.h" diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index 44fb3902b8..04a7ac362b 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" #include "sysemu/hostmem.h" +#include "qapi/error.h" #include "qom/object_interfaces.h" #define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram" diff --git a/backends/hostmem.c b/backends/hostmem.c index 6c6f0da6d9..6e28be11eb 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "sysemu/hostmem.h" #include "hw/boards.h" +#include "qapi/error.h" #include "qapi/visitor.h" #include "qapi-types.h" #include "qapi-visit.h" diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 6e0ba22241..7a1b9242d8 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "sysemu/rng.h" #include "sysemu/char.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "hw/qdev.h" /* just for DEFINE_PROP_CHR */ diff --git a/backends/rng-random.c b/backends/rng-random.c index 122e8d494d..2e44e25190 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "sysemu/rng-random.h" #include "sysemu/rng.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/main-loop.h" diff --git a/backends/rng.c b/backends/rng.c index e57e2b4b52..398ebe4a7d 100644 --- a/backends/rng.c +++ b/backends/rng.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "sysemu/rng.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qom/object_interfaces.h" diff --git a/backends/tpm.c b/backends/tpm.c index d53da18627..536f262bb7 100644 --- a/backends/tpm.c +++ b/backends/tpm.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "sysemu/tpm_backend.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "sysemu/tpm.h" #include "qemu/thread.h" diff --git a/block/backup.c b/block/backup.c index ab3e345e92..77280c6b35 100644 --- a/block/backup.c +++ b/block/backup.c @@ -17,6 +17,7 @@ #include "block/block.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" #include "sysemu/block-backend.h" diff --git a/block/blkdebug.c b/block/blkdebug.c index f85c54bdc8..792d36b994 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/config-file.h" #include "block/block_int.h" diff --git a/block/blkverify.c b/block/blkverify.c index 2a885cc08d..41432e5565 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/sockets.h" /* for EINPROGRESS on Windows */ #include "block/block_int.h" #include "qapi/qmp/qdict.h" diff --git a/block/bochs.c b/block/bochs.c index 8b953bb44c..af8b7abdfd 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -23,6 +23,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "qemu/module.h" diff --git a/block/cloop.c b/block/cloop.c index 41bdee8d7f..a84f14019c 100644 --- a/block/cloop.c +++ b/block/cloop.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "qemu/module.h" diff --git a/block/commit.c b/block/commit.c index 446a3aeadd..cba0e8c1e8 100644 --- a/block/commit.c +++ b/block/commit.c @@ -16,6 +16,7 @@ #include "trace.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" #include "sysemu/block-backend.h" diff --git a/block/curl.c b/block/curl.c index c70bfb404d..fe331ca1f5 100644 --- a/block/curl.c +++ b/block/curl.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "block/block_int.h" diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 556e1d15c4..4902ca557f 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include "config-host.h" +#include "qapi/error.h" #include "qemu-common.h" #include "trace.h" #include "block/block_int.h" diff --git a/block/dmg.c b/block/dmg.c index 1018fd158e..a496eb7c9b 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "qemu/bswap.h" diff --git a/block/gluster.c b/block/gluster.c index 65077a0d0a..51e154c247 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include #include "block/block_int.h" +#include "qapi/error.h" #include "qemu/uri.h" typedef struct GlusterAIOCB { diff --git a/block/io.c b/block/io.c index 41d954cad2..041af3c711 100644 --- a/block/io.c +++ b/block/io.c @@ -28,6 +28,7 @@ #include "block/blockjob.h" #include "block/block_int.h" #include "block/throttle-groups.h" +#include "qapi/error.h" #include "qemu/error-report.h" #define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */ diff --git a/block/mirror.c b/block/mirror.c index 9635fa8e62..7bfd0d2996 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -16,6 +16,7 @@ #include "block/blockjob.h" #include "block/block_int.h" #include "sysemu/block-backend.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" #include "qemu/bitmap.h" diff --git a/block/nbd.c b/block/nbd.c index 836424c88c..d103894120 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -28,6 +28,7 @@ #include "qemu/osdep.h" #include "block/nbd-client.h" +#include "qapi/error.h" #include "qemu/uri.h" #include "block/block_int.h" #include "qemu/module.h" diff --git a/block/null.c b/block/null.c index d90165dea7..00bc6e478a 100644 --- a/block/null.c +++ b/block/null.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "block/block_int.h" #define NULL_OPT_LATENCY "latency-ns" diff --git a/block/parallels.c b/block/parallels.c index b322d05c08..9bba8b3d06 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -28,6 +28,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" diff --git a/block/qcow.c b/block/qcow.c index 73cf8a7081..8ea8e5ceef 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 3e887e9ab0..31ecc10304 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "block/qcow2.h" diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 52a0a9ffc3..ca6094ff5b 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "block/qcow2.h" diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 13f88d1b8b..269acc2f4e 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "block/qcow2.h" diff --git a/block/qed.c b/block/qed.c index 5b24a9783f..20f05fe2b9 100644 --- a/block/qed.c +++ b/block/qed.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "trace.h" #include "qed.h" diff --git a/block/raw-posix.c b/block/raw-posix.c index 8866121cf7..29dc658e43 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/timer.h" diff --git a/block/raw-win32.c b/block/raw-win32.c index 21a6cb89d7..bd07c93461 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h" #include "block/block_int.h" diff --git a/block/raw_bsd.c b/block/raw_bsd.c index ea16a231c0..41dddf8db3 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -28,6 +28,7 @@ #include "qemu/osdep.h" #include "block/block_int.h" +#include "qapi/error.h" #include "qemu/option.h" static QemuOptsList raw_create_opts = { diff --git a/block/rbd.c b/block/rbd.c index abfea612ec..4f3fa304d5 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "block/block_int.h" diff --git a/block/sheepdog.c b/block/sheepdog.c index a3aeae4a67..a6b179b11d 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/uri.h" #include "qemu/error-report.h" diff --git a/block/snapshot.c b/block/snapshot.c index 17a27b57ad..e9d721df68 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "block/snapshot.h" #include "block/block_int.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" QemuOptsList internal_snapshot_opts = { diff --git a/block/ssh.c b/block/ssh.c index 04deeba1ad..06928ed939 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -28,6 +28,7 @@ #include #include "block/block_int.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/uri.h" diff --git a/block/stream.c b/block/stream.c index cafaa07a01..9b0b0f3573 100644 --- a/block/stream.c +++ b/block/stream.c @@ -15,6 +15,7 @@ #include "trace.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" #include "sysemu/block-backend.h" diff --git a/block/vdi.c b/block/vdi.c index df9fa47db1..cdf6b85216 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -50,6 +50,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" diff --git a/block/vhdx-log.c b/block/vhdx-log.c index 369076126e..7ea7187fc4 100644 --- a/block/vhdx-log.c +++ b/block/vhdx-log.c @@ -18,6 +18,7 @@ * */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "qemu/error-report.h" diff --git a/block/vhdx.c b/block/vhdx.c index 78fe56ca04..59426d6c0f 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" diff --git a/block/vmdk.c b/block/vmdk.c index 29c8fc3d02..5e341c678b 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" diff --git a/block/vpc.c b/block/vpc.c index 8435205a0c..912dfc1a82 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -23,6 +23,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" diff --git a/block/vvfat.c b/block/vvfat.c index b8d29e17cd..bdce8da320 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" #include +#include "qapi/error.h" #include "qemu-common.h" #include "block/block_int.h" #include "qemu/module.h" diff --git a/bootdevice.c b/bootdevice.c index dbc0159392..2e83ff05eb 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "qapi/visitor.h" #include "qemu/error-report.h" diff --git a/contrib/ivshmem-server/main.c b/contrib/ivshmem-server/main.c index cca1061f0e..4c9a11f2c5 100644 --- a/contrib/ivshmem-server/main.c +++ b/contrib/ivshmem-server/main.c @@ -7,6 +7,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "ivshmem-server.h" diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 58c1b940e1..439f89230c 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/block-luks.h" diff --git a/crypto/block-qcow.c b/crypto/block-qcow.c index 9f378e8635..be88c6f0ef 100644 --- a/crypto/block-qcow.c +++ b/crypto/block-qcow.c @@ -25,6 +25,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/block-qcow.h" #include "crypto/secret.h" diff --git a/crypto/block.c b/crypto/block.c index 524ed91db8..da60eba85f 100644 --- a/crypto/block.c +++ b/crypto/block.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/blockpriv.h" #include "crypto/block-qcow.h" #include "crypto/block-luks.h" diff --git a/crypto/cipher.c b/crypto/cipher.c index 5402d18525..cafb454363 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/cipher.h" diff --git a/crypto/hash.c b/crypto/hash.c index 4a8c0caea1..b90af3495a 100644 --- a/crypto/hash.c +++ b/crypto/hash.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/hash.h" #ifdef CONFIG_GNUTLS_HASH diff --git a/crypto/init.c b/crypto/init.c index 31eea19bc9..1e564d9492 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "crypto/init.h" +#include "qapi/error.h" #include "qemu/thread.h" #ifdef CONFIG_GNUTLS diff --git a/crypto/ivgen-essiv.c b/crypto/ivgen-essiv.c index 5649c01b85..2fd89def0f 100644 --- a/crypto/ivgen-essiv.c +++ b/crypto/ivgen-essiv.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/ivgen-essiv.h" typedef struct QCryptoIVGenESSIV QCryptoIVGenESSIV; diff --git a/crypto/ivgen-plain.c b/crypto/ivgen-plain.c index 6a85256cac..a56675d592 100644 --- a/crypto/ivgen-plain.c +++ b/crypto/ivgen-plain.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/ivgen-plain.h" static int qcrypto_ivgen_plain_init(QCryptoIVGen *ivgen, diff --git a/crypto/ivgen-plain64.c b/crypto/ivgen-plain64.c index 9ca6db9df2..94d86730fb 100644 --- a/crypto/ivgen-plain64.c +++ b/crypto/ivgen-plain64.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/ivgen-plain.h" static int qcrypto_ivgen_plain_init(QCryptoIVGen *ivgen, diff --git a/crypto/ivgen.c b/crypto/ivgen.c index 4ffc1eb886..f66435112b 100644 --- a/crypto/ivgen.c +++ b/crypto/ivgen.c @@ -19,6 +19,8 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" + #include "crypto/ivgenpriv.h" #include "crypto/ivgen-plain.h" #include "crypto/ivgen-plain64.h" diff --git a/crypto/pbkdf-gcrypt.c b/crypto/pbkdf-gcrypt.c index 885614dfcc..997b311d84 100644 --- a/crypto/pbkdf-gcrypt.c +++ b/crypto/pbkdf-gcrypt.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/pbkdf.h" #include "gcrypt.h" diff --git a/crypto/pbkdf-nettle.c b/crypto/pbkdf-nettle.c index 1aa7395ea5..db9fc15780 100644 --- a/crypto/pbkdf-nettle.c +++ b/crypto/pbkdf-nettle.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/pbkdf.h" #include "nettle/pbkdf2.h" diff --git a/crypto/pbkdf-stub.c b/crypto/pbkdf-stub.c index cfc30d3c2a..266a5051b7 100644 --- a/crypto/pbkdf-stub.c +++ b/crypto/pbkdf-stub.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/pbkdf.h" bool qcrypto_pbkdf2_supports(QCryptoHashAlgorithm hash G_GNUC_UNUSED) diff --git a/crypto/pbkdf.c b/crypto/pbkdf.c index 90721d85d6..695cc35df1 100644 --- a/crypto/pbkdf.c +++ b/crypto/pbkdf.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/pbkdf.h" #ifndef _WIN32 #include diff --git a/crypto/secret.c b/crypto/secret.c index be736f2cd5..285ab7a63c 100644 --- a/crypto/secret.c +++ b/crypto/secret.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "crypto/secret.h" #include "crypto/cipher.h" +#include "qapi/error.h" #include "qom/object_interfaces.h" #include "qemu/base64.h" #include "trace.h" diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c index fc99589c22..1620e126ae 100644 --- a/crypto/tlscreds.c +++ b/crypto/tlscreds.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/tlscredspriv.h" #include "trace.h" diff --git a/crypto/tlscredsanon.c b/crypto/tlscredsanon.c index f36a793d16..1464220080 100644 --- a/crypto/tlscredsanon.c +++ b/crypto/tlscredsanon.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "crypto/tlscredsanon.h" #include "crypto/tlscredspriv.h" +#include "qapi/error.h" #include "qom/object_interfaces.h" #include "trace.h" diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c index 99130433fd..6a0179c2e1 100644 --- a/crypto/tlscredsx509.c +++ b/crypto/tlscredsx509.c @@ -22,6 +22,7 @@ #include "crypto/tlscredsx509.h" #include "crypto/tlscredspriv.h" #include "crypto/secret.h" +#include "qapi/error.h" #include "qom/object_interfaces.h" #include "trace.h" diff --git a/crypto/tlssession.c b/crypto/tlssession.c index e0d9658e80..a543e5a576 100644 --- a/crypto/tlssession.c +++ b/crypto/tlssession.c @@ -22,6 +22,7 @@ #include "crypto/tlssession.h" #include "crypto/tlscredsanon.h" #include "crypto/tlscredsx509.h" +#include "qapi/error.h" #include "qemu/acl.h" #include "trace.h" diff --git a/device_tree.c b/device_tree.c index 6204af88c8..ccba1fd4a4 100644 --- a/device_tree.c +++ b/device_tree.c @@ -17,6 +17,7 @@ #include #endif +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "sysemu/device_tree.h" diff --git a/exec.c b/exec.c index f398d212f6..151908ebdf 100644 --- a/exec.c +++ b/exec.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qapi/error.h" #ifndef _WIN32 #include #endif diff --git a/gdbstub.c b/gdbstub.c index fdcb0eea8f..e4e480f668 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #ifdef CONFIG_USER_ONLY diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index db5f4780dc..f5e30125fc 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "hw/virtio/virtio.h" #include "hw/i386/pc.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/iov.h" #include "qemu/sockets.h" diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c index 5a410a5287..4d86743fde 100644 --- a/hw/acpi/cpu_hotplug.c +++ b/hw/acpi/cpu_hotplug.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/acpi/cpu_hotplug.h" +#include "qapi/error.h" #include "qom/cpu.h" static uint64_t cpu_status_read(void *opaque, hwaddr addr, unsigned int size) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 72202545e0..27e978f5fd 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -25,6 +25,7 @@ */ #include "qemu/osdep.h" #include "hw/hw.h" +#include "qapi/error.h" #include "qapi/visitor.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 3e338b5ec2..71f4c4e14b 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -35,6 +35,7 @@ #include "exec/ioport.h" #include "exec/address-spaces.h" #include "hw/pci/pci_bus.h" +#include "qapi/error.h" #include "qom/qom-qobject.h" #include "qapi/qmp/qint.h" diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 9694e5238f..16abdf1624 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -26,6 +26,7 @@ #include "hw/pci/pci.h" #include "hw/acpi/acpi.h" #include "sysemu/sysemu.h" +#include "qapi/error.h" #include "qemu/range.h" #include "exec/ioport.h" #include "hw/nvram/fw_cfg.h" diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index b86ff5ea9b..97721b535d 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -7,6 +7,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "hw/hw.h" #include "hw/devices.h" diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index 02c8caa191..b4d3cf6d03 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/arm/allwinner-a10.h" diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index ed7d97fc21..c68d644588 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/loader.h" diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c index daa5518c92..976b651a62 100644 --- a/hw/arm/ast2400.c +++ b/hw/arm/ast2400.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "exec/address-spaces.h" #include "hw/arm/ast2400.h" #include "hw/char/serial.h" diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c index 8099a8a92e..234d518430 100644 --- a/hw/arm/bcm2835_peripherals.c +++ b/hw/arm/bcm2835_peripherals.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/bcm2835_peripherals.h" #include "hw/misc/bcm2835_mbox_defs.h" #include "hw/arm/raspi_platform.h" diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 89a6b35b81..d85f051af4 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/bcm2836.h" #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 8ba0e4272a..5975fbfa8c 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/arm/arm.h" #include "hw/arm/linux-boot-if.h" diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index 2382c59158..69fdfc9eeb 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/boards.h" diff --git a/hw/arm/digic.c b/hw/arm/digic.c index 82087bacb8..e0f9730325 100644 --- a/hw/arm/digic.c +++ b/hw/arm/digic.c @@ -21,6 +21,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/digic.h" #define DIGIC4_TIMER_BASE(n) (0xc0210000 + (n) * 0x100) diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c index e5308f47ab..c4bec429dd 100644 --- a/hw/arm/digic_boards.c +++ b/hw/arm/digic_boards.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/boards.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 6a8f0b54ce..e27a18274d 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/boards.h" #include "sysemu/sysemu.h" #include "hw/sysbus.h" diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 1fbc317b74..f47d471744 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/fsl-imx25.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h" diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 0d69a2c70b..2164e679f5 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/fsl-imx31.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h" diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index e37378c69f..d9930c0d34 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c index e3cffd190c..facd605bc8 100644 --- a/hw/arm/imx25_pdk.c +++ b/hw/arm/imx25_pdk.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/fsl-imx25.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index c6656a817c..5a4540b3b7 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/boards.h" diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c index 2eeb9d8973..12cbd052bb 100644 --- a/hw/arm/kzm.c +++ b/hw/arm/kzm.c @@ -14,6 +14,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/fsl-imx31.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index 98a892ff62..454acc5d2b 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -12,6 +12,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/arm/arm.h" diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 54548f38bb..28d5af1d9b 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c index 49da6e360d..23d792837f 100644 --- a/hw/arm/netduino2.c +++ b/hw/arm/netduino2.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/boards.h" #include "qemu/error-report.h" #include "hw/arm/stm32f205_soc.h" diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 9a5f33bd8a..4561d4a483 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "sysemu/sysemu.h" #include "hw/arm/omap.h" diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 6f68130419..387a776c83 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/boards.h" #include "hw/hw.h" #include "hw/arm/arm.h" diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index d11224e81e..74d45baed8 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/boards.h" diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index cd50691d8b..5d74026cb2 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -26,6 +26,7 @@ * with this program; if not, see . */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "ui/console.h" #include "hw/arm/omap.h" diff --git a/hw/arm/palm.c b/hw/arm/palm.c index cae0a46561..7f460732e3 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -17,6 +17,7 @@ * with this program; if not, see . */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "audio/audio.h" #include "sysemu/sysemu.h" diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c index 55d741918b..6b3bb77a6d 100644 --- a/hw/arm/palmetto-bmc.c +++ b/hw/arm/palmetto-bmc.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "exec/address-spaces.h" #include "hw/arm/arm.h" #include "hw/arm/ast2400.h" diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index ff6ac7a60a..24109091bf 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/pxa.h" #include "sysemu/sysemu.h" diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 83fe8097e5..d2b02e6f2b 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/bcm2836.h" #include "qemu/error-report.h" #include "hw/boards.h" diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 481ae00fbc..c45441aa34 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index c3048f3ea6..50949d06af 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/arm/arm.h" diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index c3c72f1b49..3caeb0679b 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/ssi/ssi.h" #include "hw/arm/arm.h" diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 79bfe6d10f..6ce2fdcea7 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/arm.h" #include "exec/address-spaces.h" #include "hw/arm/stm32f205_soc.h" diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index 49bd212d07..5debb3348c 100644 --- a/hw/arm/sysbus-fdt.c +++ b/hw/arm/sysbus-fdt.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include "qemu-common.h" #ifdef CONFIG_LINUX diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index d83c1e1785..4e9494f94c 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/arm/arm.h" diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 5f7523e355..43f429e951 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 769390c6c1..50832993a2 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 6a86b2ca2c..f51fe396ce 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -27,6 +27,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "hw/arm/virt-acpi-build.h" #include "qemu/bitmap.h" diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 95331a5662..a5e787dec6 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -29,6 +29,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index a35983a9ec..fa8bbe7100 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "net/net.h" diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c index a1bd283a52..3313ad0ed6 100644 --- a/hw/arm/xlnx-ep108.c +++ b/hw/arm/xlnx-ep108.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/xlnx-zynqmp.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 4fbb63550b..0cff6deaba 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/arm/xlnx-zynqmp.h" #include "hw/intc/arm_gic_common.h" #include "exec/address-spaces.h" diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 1270b19cc6..355a2595d4 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/audio/gus.c b/hw/audio/gus.c index b416a54909..9dd6947bee 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/audio/audio.h" #include "audio/audio.h" diff --git a/hw/block/block.c b/hw/block/block.c index 960df2b9d0..97a59d4fa2 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -11,6 +11,7 @@ #include "sysemu/blockdev.h" #include "sysemu/block-backend.h" #include "hw/block/block.h" +#include "qapi/error.h" #include "qemu/error-report.h" void blkconf_serial(BlockConf *conf, char **serial) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 36f3d2b813..e666dd4ff0 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "trace.h" #include "qemu/iov.h" #include "qemu/thread.h" diff --git a/hw/block/fdc.c b/hw/block/fdc.c index fc3aef9cd1..72dc1484b1 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -30,6 +30,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/block/fdc.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/timer.h" #include "hw/isa/isa.h" diff --git a/hw/block/nand.c b/hw/block/nand.c index f51e13fcac..29c6596810 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -23,6 +23,7 @@ #include "hw/block/flash.h" #include "sysemu/block-backend.h" #include "hw/qdev.h" +#include "qapi/error.h" #include "qemu/error-report.h" # define NAND_CMD_READ0 0x00 diff --git a/hw/block/nvme.c b/hw/block/nvme.c index c68b62521a..173988ee84 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -26,6 +26,7 @@ #include #include #include "sysemu/sysemu.h" +#include "qapi/error.h" #include "qapi/visitor.h" #include "sysemu/block-backend.h" diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 91896851f5..883f4b1faa 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "hw/hw.h" #include "hw/block/flash.h" diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index a4c4fa1c69..c475c2aea7 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -40,6 +40,7 @@ #include "hw/hw.h" #include "hw/block/flash.h" #include "sysemu/block-backend.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "qemu/bitops.h" #include "exec/address-spaces.h" diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index aaa697adbb..eadc61b7df 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -38,6 +38,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/block/flash.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h" diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index cb710f16fa..870d345244 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/iov.h" #include "qemu/error-report.h" diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 635328fa69..e619a1f7d9 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -29,6 +29,7 @@ #include "xen_blkif.h" #include "sysemu/blockdev.h" #include "sysemu/block-backend.h" +#include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" diff --git a/hw/bt/hci.c b/hw/bt/hci.c index 8bc33b50a5..1eaa442c38 100644 --- a/hw/bt/hci.c +++ b/hw/bt/hci.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h" #include "hw/usb.h" diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 148632e686..e7f025ec67 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -25,6 +25,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "sysemu/char.h" #include "hw/isa/isa.h" diff --git a/hw/char/parallel.c b/hw/char/parallel.c index f6ba76fd60..11c78fed88 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -23,6 +23,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "sysemu/char.h" #include "hw/isa/isa.h" diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index b9b5bc6db2..1594ec4db3 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/char/serial.h" #include "hw/isa/isa.h" diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index 8f1b6f3d84..303104dd19 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -26,6 +26,7 @@ /* see docs/specs/pci-serial.txt */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/char/serial.h" #include "hw/pci/pci.h" diff --git a/hw/char/serial.c b/hw/char/serial.c index 39e07db088..6f89f2c9e6 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "hw/char/serial.h" #include "sysemu/char.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 747c69d12d..f3aff5eeea 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/qdev.h" #include "sysemu/char.h" #include "hw/ppc/spapr.h" diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 99cb6836ad..6e5de6dec2 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/iov.h" #include "monitor/monitor.h" #include "qemu/error-report.h" diff --git a/hw/core/loader.c b/hw/core/loader.c index 8e8031ca3c..93410e35b5 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -43,6 +43,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "disas/disas.h" #include "monitor/monitor.h" diff --git a/hw/core/machine.c b/hw/core/machine.c index a8c4680b0c..136bf275bc 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "hw/boards.h" +#include "qapi/error.h" #include "qapi-visit.h" #include "qapi/visitor.h" #include "hw/sysbus.h" diff --git a/hw/core/nmi.c b/hw/core/nmi.c index 6ca569bd7f..e8bcc4177b 100644 --- a/hw/core/nmi.c +++ b/hw/core/nmi.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "hw/nmi.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "monitor/monitor.h" diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index e10cede749..891219ae05 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "net/net.h" #include "hw/qdev.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index bc89800246..eef932cbf1 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "net/net.h" #include "hw/qdev.h" +#include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "sysemu/block-backend.h" diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c index a221b8fe7b..bc05152fd3 100644 --- a/hw/cpu/a15mpcore.c +++ b/hw/cpu/a15mpcore.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/cpu/a15mpcore.h" #include "sysemu/kvm.h" #include "kvm_arm.h" diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c index 23c882fe9a..5459ae8c1b 100644 --- a/hw/cpu/a9mpcore.c +++ b/hw/cpu/a9mpcore.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/cpu/a9mpcore.h" static void a9mp_priv_set_irq(void *opaque, int irq, int level) diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c index 5f4ca31927..eb244658b9 100644 --- a/hw/cpu/arm11mpcore.c +++ b/hw/cpu/arm11mpcore.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/cpu/arm11mpcore.h" #include "hw/intc/realview_gic.h" diff --git a/hw/cpu/realview_mpcore.c b/hw/cpu/realview_mpcore.c index c5c4dfced5..39d4ebeb1d 100644 --- a/hw/cpu/realview_mpcore.c +++ b/hw/cpu/realview_mpcore.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/cpu/arm11mpcore.h" #include "hw/intc/realview_gic.h" diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index f2ba1d0775..8cfa082acd 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "net/net.h" #include "hw/block/flash.h" diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c index 779b56f07b..506f1d3d90 100644 --- a/hw/display/bcm2835_fb.c +++ b/hw/display/bcm2835_fb.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/display/bcm2835_fb.h" #include "hw/display/framebuffer.h" #include "ui/pixel_ops.h" diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 321a25157b..fc0d97fa4b 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "ui/console.h" diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 57b91a77ca..3d712d592f 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -27,6 +27,7 @@ * available at http://home.worldonline.dk/~finth/ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "ui/console.h" diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 29572437e4..183e1d2b60 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/char/serial.h" #include "ui/console.h" diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c index 31043b1783..da3ceceb0a 100644 --- a/hw/display/tc6393xb.c +++ b/hw/display/tc6393xb.c @@ -11,6 +11,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/devices.h" #include "hw/block/flash.h" diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 8afc2f33c6..cac9fe3d53 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "ui/console.h" #include "ui/pixel_ops.h" diff --git a/hw/display/vga.c b/hw/display/vga.c index 555cac64c7..25dc978b95 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "vga.h" #include "ui/console.h" diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 17bba630eb..0c63fa8513 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/loader.h" #include "trace.h" diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c index c7ce4e4881..5421175998 100644 --- a/hw/dma/bcm2835_dma.c +++ b/hw/dma/bcm2835_dma.c @@ -4,6 +4,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/dma/bcm2835_dma.h" /* DMA CS Control and Status bits */ diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 37ea7e41ff..ea89ecb00e 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -16,6 +16,7 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "sysemu/dma.h" diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c index ce5c1e6fbd..a4753e55a2 100644 --- a/hw/dma/xilinx_axidma.c +++ b/hw/dma/xilinx_axidma.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "hw/ptimer.h" #include "qemu/log.h" diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 325d8ce13c..35180efe0c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -21,6 +21,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "acpi-build.h" #include #include "qemu-common.h" diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index e43b5c4461..a4462e5ca9 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -23,6 +23,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "hw/timer/i8254.h" diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index d4089e7cc2..bf425a2b9f 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -21,6 +21,7 @@ * Copyright (C) 2008, IBM, Muli Ben-Yehuda (muli@il.ibm.com) */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include "hw/hw.h" #include "hw/i386/pc.h" diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 2324e700b0..f915ad0a36 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/block-backend.h" #include "qemu/error-report.h" #include "hw/sysbus.h" diff --git a/hw/i386/pci-assign-load-rom.c b/hw/i386/pci-assign-load-rom.c index bff979a4d0..4bbb08c955 100644 --- a/hw/i386/pci-assign-load-rom.c +++ b/hw/i386/pci-assign-load-rom.c @@ -2,6 +2,7 @@ * This is splited from hw/i386/kvm/pci-assign.c */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/i386/pc.h" #include "qemu/error-report.h" diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index a2247b917a..aa7839324c 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/ide.h" diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c index 1095c65d41..c093b34458 100644 --- a/hw/i386/xen/xen_pvdevice.c +++ b/hw/i386/xen/xen_pvdevice.c @@ -30,6 +30,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "trace.h" diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 2d14a768f1..4bc74a32d2 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include #include "sysemu/dma.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include #include "sysemu/block-backend.h" diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 64b929281e..40dfca157f 100644 --- a/hw/input/milkymist-softusb.c +++ b/hw/input/milkymist-softusb.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "trace.h" diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c index ddee54cb7d..9e0f46d88f 100644 --- a/hw/input/virtio-input-host.c +++ b/hw/input/virtio-input-host.c @@ -5,6 +5,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/sockets.h" diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c index 5061f4cf7a..672c207eb5 100644 --- a/hw/input/virtio-input.c +++ b/hw/input/virtio-input.c @@ -5,6 +5,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/iov.h" #include "hw/qdev.h" diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 659f377e55..4abe145c68 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -18,6 +18,7 @@ * License along with this library; if not, see */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/i386/apic.h" #include "hw/i386/apic_internal.h" #include "trace.h" diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index 0834c2f1a7..f55124174d 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" #include "gic_internal.h" +#include "qapi/error.h" #include "qom/cpu.h" //#define DEBUG_GIC diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c index 707d00ded4..0a1f56af19 100644 --- a/hw/intc/arm_gic_common.c +++ b/hw/intc/arm_gic_common.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "gic_internal.h" #include "hw/arm/linux-boot-if.h" diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c index e61c5d9d47..bc85ab769f 100644 --- a/hw/intc/arm_gic_kvm.c +++ b/hw/intc/arm_gic_kvm.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "migration/migration.h" #include "sysemu/kvm.h" diff --git a/hw/intc/arm_gicv2m.c b/hw/intc/arm_gicv2m.c index ebd368bbad..e8b5177dcc 100644 --- a/hw/intc/arm_gicv2m.c +++ b/hw/intc/arm_gicv2m.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/pci/msi.h" diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index e4f0f5a589..b9d3824f2b 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -21,6 +21,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/intc/arm_gicv3_common.h" static void gicv3_pre_save(void *opaque) diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 90c7950704..acc1730048 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/intc/arm_gicv3_common.h" #include "hw/sysbus.h" #include "sysemu/kvm.h" diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 92f6a44eec..3a23d34054 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "qemu/timer.h" #include "hw/arm/arm.h" diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c index 0a48de29b9..1b7ec5ec20 100644 --- a/hw/intc/ioapic_common.c +++ b/hw/intc/ioapic_common.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "monitor/monitor.h" #include "hw/i386/ioapic.h" #include "hw/i386/ioapic_internal.h" diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c index 7685250bf4..2d3769310f 100644 --- a/hw/intc/openpic.c +++ b/hw/intc/openpic.c @@ -41,6 +41,7 @@ #include "hw/ppc/ppc_e500.h" #include "hw/sysbus.h" #include "hw/pci/msi.h" +#include "qapi/error.h" #include "qemu/bitops.h" #include "qapi/qmp/qerror.h" diff --git a/hw/intc/openpic_kvm.c b/hw/intc/openpic_kvm.c index 778af4a7d4..e47e94f2cf 100644 --- a/hw/intc/openpic_kvm.c +++ b/hw/intc/openpic_kvm.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include "exec/address-spaces.h" #include "hw/hw.h" diff --git a/hw/intc/realview_gic.c b/hw/intc/realview_gic.c index 291f196637..50bbab66ee 100644 --- a/hw/intc/realview_gic.c +++ b/hw/intc/realview_gic.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/intc/realview_gic.h" static void realview_gic_set_irq(void *opaque, int irq, int level) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 213a370925..04a079cd55 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "trace.h" #include "qemu/timer.h" diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 9fe06677f9..9bd85ac03c 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "trace.h" #include "hw/ppc/spapr.h" diff --git a/hw/ipack/ipack.c b/hw/ipack/ipack.c index 7c5c30de55..5f99ed9a79 100644 --- a/hw/ipack/ipack.c +++ b/hw/ipack/ipack.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/ipack/ipack.h" IPackDevice *ipack_device_find(IPackBus *bus, int32_t slot) diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index c31a3a02c2..fe12112a2f 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -28,6 +28,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "sysemu/char.h" #include "sysemu/sysemu.h" diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index ace2dc0a80..aaea12ecdd 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/ipmi/ipmi.h" #include "hw/isa/isa.h" diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c index 9841b7f3d5..2742ce06c4 100644 --- a/hw/ipmi/isa_ipmi_kcs.c +++ b/hw/ipmi/isa_ipmi_kcs.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/ipmi/ipmi.h" #include "hw/isa/isa.h" diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index c3b7388529..7aa115caf2 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "monitor/monitor.h" #include "hw/sysbus.h" diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 6b5c7a2e02..c3ebf3e7a0 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/isa/pc87312.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index 85f72770d7..c00cc700b7 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -7,6 +7,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/m68k/mcf.h" #include "hw/boards.h" diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index 4f49d34a8f..67c3bb6815 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -6,6 +6,7 @@ * This code is licensed under the GPL */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/m68k/mcf.h" #include "qemu/timer.h" diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index c4b44300eb..9e7de56829 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "hw/mem/pc-dimm.h" +#include "qapi/error.h" #include "qemu/config-file.h" #include "qapi/visitor.h" #include "qemu/range.h" diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c index 85e974b72a..4505d183f2 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "net/net.h" diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c index 606ba1f01a..bf19ad730f 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "net/net.h" diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 4e5581b167..bdb716e725 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 1ecff44a54..23b2dcabf0 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 724b1e9d51..0ef2fb1655 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -8,6 +8,7 @@ * the standard PC ISA addresses. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c index 106585a7bf..263280fd49 100644 --- a/hw/misc/bcm2835_mbox.c +++ b/hw/misc/bcm2835_mbox.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/misc/bcm2835_mbox.h" #define MAIL0_PEEK 0x90 diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index 15dcc02f99..530411f841 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -4,6 +4,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/misc/bcm2835_property.h" #include "hw/misc/bcm2835_mbox_defs.h" #include "sysemu/dma.h" diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 1838bc8506..55071dc767 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -17,6 +17,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 42325bff50..6e94e3b7cf 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -23,6 +23,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/ppc/mac.h" #include "hw/pci/pci.h" diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c index b53f6babad..f5c2472b5b 100644 --- a/hw/misc/tmp105.c +++ b/hw/misc/tmp105.c @@ -22,6 +22,7 @@ #include "hw/hw.h" #include "hw/i2c/i2c.h" #include "tmp105.h" +#include "qapi/error.h" #include "qapi/visitor.h" static void tmp105_interrupt_update(TMP105State *s) diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c index d88c9428e0..800c7cc935 100644 --- a/hw/moxie/moxiesim.c +++ b/hw/moxie/moxiesim.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/i386/pc.h" diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index e847b77cf4..819743e117 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -21,6 +21,7 @@ #include "hw/sysbus.h" #include "hw/devices.h" #include "net/net.h" +#include "qapi/error.h" #include "qemu/timer.h" #include diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c index d35d39a0e5..f01e804272 100644 --- a/hw/net/milkymist-minimac2.c +++ b/hw/net/milkymist-minimac2.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "trace.h" diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c index 8dca7c936b..a7f5a9464d 100644 --- a/hw/net/ne2000-isa.c +++ b/hw/net/ne2000-isa.c @@ -29,6 +29,7 @@ #include "net/net.h" #include "ne2000.h" #include "exec/address-spaces.h" +#include "qapi/error.h" #include "qapi/visitor.h" #define TYPE_ISA_NE2000 "ne2k_isa" diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c index 2deb8ce84b..de23ab5dcd 100644 --- a/hw/net/xilinx_axienet.c +++ b/hw/net/xilinx_axienet.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" +#include "qapi/error.h" #include "qemu/log.h" #include "net/net.h" #include "net/checksum.h" diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index 32d5a361d0..2ca427b586 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include "sysemu/block-backend.h" diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index 46418c30f7..7967cfbea9 100644 --- a/hw/openrisc/openrisc_sim.c +++ b/hw/openrisc/openrisc_sim.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/boards.h" #include "elf.h" diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c index 862a2366f2..7b582e96ac 100644 --- a/hw/pci-bridge/pci_bridge_dev.c +++ b/hw/pci-bridge/pci_bridge_dev.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_ids.h" #include "hw/pci/msi.h" diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index 41aa66f828..df2b0e26f5 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -29,6 +29,7 @@ #include "hw/pci/pci_host.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" +#include "qapi/error.h" #include "qemu/range.h" #include "hw/xen/xen.h" #include "hw/pci-host/pam.h" diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 49cdaab36b..487e32ecbf 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 115fb8c046..70f897e3a9 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -30,6 +30,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/pci-host/q35.h" +#include "qapi/error.h" #include "qapi/visitor.h" /**************************************************************************** diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 4aca0c5912..728386ada7 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pcie.h" diff --git a/hw/pci/shpc.c b/hw/pci/shpc.c index aef838415f..3dcd472eba 100644 --- a/hw/pci/shpc.c +++ b/hw/pci/shpc.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/range.h" #include "qemu/error-report.h" diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 09154fa813..ee1c60b820 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -15,6 +15,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "e500.h" #include "e500-ccsr.h" diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index f0a36b3133..1086f88d83 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -47,6 +47,7 @@ * */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "hw/ppc/mac.h" diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index d952713313..9bfa02e097 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "mac.h" diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index d8db3199c9..b430832fb3 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "ppc405.h" diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index ec81f658c5..4f9aebc099 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "hw/boards.h" diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d0bb42305b..7e80f8ac3c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -25,6 +25,7 @@ * */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "sysemu/numa.h" #include "hw/hw.h" diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index ef063c05cf..b94b44a7a1 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/ppc/spapr_drc.h" #include "qom/object.h" #include "hw/qdev.h" diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index 39f4682f95..61204f0b6b 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -25,6 +25,7 @@ * */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "sysemu/sysemu.h" #include "sysemu/char.h" diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index b2b1b93cfd..2dcb676c6f 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "cpu.h" #include "helper_regs.h" diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 79baa7b177..12dbe902fc 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -23,6 +23,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "hw/pci/pci.h" diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c index 9e15924f50..6f9a6731d6 100644 --- a/hw/ppc/spapr_pci_vfio.c +++ b/hw/ppc/spapr_pci_vfio.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/ppc/spapr.h" #include "hw/pci-host/spapr.h" #include "hw/pci/msix.h" diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index 02d6be49f5..f2f89908d4 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "sysemu/device_tree.h" diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index 0f61a550cb..8aa021fde9 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "sysemu/sysemu.h" #include "hw/boards.h" diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 85be24d3da..34b2faf013 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "hw/s390x/sclp.h" diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 41ff002069..f104200273 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "cpu.h" #include "elf.h" diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 4361c8a5dc..01aeec90fe 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/boards.h" #include "exec/address-spaces.h" #include "s390-virtio.h" diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index 7c6e281af1..544c61643d 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index c8cc732163..85dbe1b600 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "sysemu/kvm.h" #include "exec/memory.h" diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index cb887ba7e2..d51642db0d 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 1de7706644..595f88b352 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -28,6 +28,7 @@ #include "hw/nvram/eeprom93xx.h" #include "hw/scsi/esp.h" #include "trace.h" +#include "qapi/error.h" #include "qemu/log.h" #define TYPE_AM53C974_DEVICE "am53c974" diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index e55c32c642..8961be2f34 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -27,6 +27,7 @@ #include "hw/sysbus.h" #include "hw/scsi/esp.h" #include "trace.h" +#include "qapi/error.h" #include "qemu/log.h" /* diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index a21752b67e..a5ad3c7ae5 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1,5 +1,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "hw/scsi/scsi.h" #include "block/scsi.h" diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 469aec2839..96c7953ecf 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -29,6 +29,7 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0) #endif #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "hw/scsi/scsi.h" diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index f8a1ff2cac..7459465f60 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "hw/scsi/scsi.h" diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index c86622cfeb..97a0dd1c1d 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -15,6 +15,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include "qemu/error-report.h" #include "qemu/queue.h" diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 0c30d2e692..ade49727d6 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -14,6 +14,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "standard-headers/linux/virtio_ids.h" #include "hw/virtio/virtio-scsi.h" #include "qemu/error-report.h" diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index 9abc086851..e690b4ec08 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/scsi/scsi.h" #include #include "hw/pci/msi.h" diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 9c3679b5db..3deccf02c9 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "hw/arm/pxa.h" diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 1568057e4f..b66e5d2dba 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -34,6 +34,7 @@ #include "hw/hw.h" #include "sysemu/block-backend.h" #include "hw/sd/sd.h" +#include "qapi/error.h" #include "qemu/bitmap.h" #include "hw/qdev-properties.h" #include "qemu/error-report.h" diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 7d9a1cd822..90672ac357 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/sh4/sh.h" diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c index 386a4854ea..986bd2950e 100644 --- a/hw/sh4/shix.c +++ b/hw/sh4/shix.c @@ -28,6 +28,7 @@ More information in target-sh4/README.sh4 */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/sh4/sh.h" #include "sysemu/sysemu.h" diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 1362e79b9b..cb8a111102 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/config-file.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h" diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index c579f5b9ea..9f085ec61d 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "qemu/timer.h" #include "hw/ptimer.h" diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 613ca7e332..f251915fbd 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "qemu/error-report.h" #include "qemu/timer.h" diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 54d200300c..b77e8d2e11 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/pci-host/apb.h" diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index fa4602ca04..afe577c76a 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -22,6 +22,7 @@ #include "qemu/osdep.h" #include "hw/timer/a9gtimer.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "qemu/bitops.h" #include "qemu/log.h" diff --git a/hw/timer/arm_mptimer.c b/hw/timer/arm_mptimer.c index 2bdaf42b72..d66bbf01b4 100644 --- a/hw/timer/arm_mptimer.c +++ b/hw/timer/arm_mptimer.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "hw/timer/arm_mptimer.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "qom/cpu.h" diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 0ad542037a..78140e6092 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -28,6 +28,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "ui/console.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/timer.h" #include "hw/timer/hpet.h" diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c index bbcfeb2192..c4db0e6462 100644 --- a/hw/timer/m48t59.c +++ b/hw/timer/m48t59.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/timer/m48t59.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "hw/sysbus.h" diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index c1c3d4dcc3..381e7266ea 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -31,6 +31,7 @@ #include "hw/i386/pc.h" #include "hw/pci/pci_ids.h" #include "tpm_tis.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/main-loop.h" #include "sysemu/tpm_backend.h" diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index 3cadb6521c..858040a046 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/hw.h" #include "hw/devices.h" #include "net/net.h" diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index 4522fa263b..d2933cb72a 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "ui/console.h" #include "elf.h" diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 4452bdbe20..a9a6f9e56d 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -2,6 +2,7 @@ #include "hw/hw.h" #include "hw/usb.h" #include "hw/qdev.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "monitor/monitor.h" diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index 40f38ad45e..24d05f76f9 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -27,6 +27,7 @@ #include "ui/console.h" #include "hw/usb.h" #include "hw/usb/desc.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "hw/input/hid.h" diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 64acdb0af0..a33f21cb38 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "trace.h" #include "hw/usb.h" diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 7391783193..3e0bdc1bae 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -10,12 +10,14 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include #include #ifdef __linux__ #include +#include "qapi/error.h" #include "qemu/main-loop.h" #endif diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index c6abd38c2a..b183cafece 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h" diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index afad1db8b3..ff4b0c588f 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "hw/usb.h" diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 96a1a13812..af4b851356 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -35,6 +35,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "hw/usb.h" diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 5ae0424923..284024e6f4 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/option.h" diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 1b50601fc1..f598937099 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -28,6 +28,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/usb/ehci-regs.h" #include "hw/usb/hcd-ehci.h" #include "trace.h" diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 17ed4617ef..f3dc26bcca 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -27,6 +27,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "hw/usb.h" #include "hw/pci/pci.h" diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index c370240be2..6521418681 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -30,6 +30,7 @@ #include "hw/usb.h" #include "hw/usb/uhci-regs.h" #include "hw/pci/pci.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "qemu/iov.h" #include "sysemu/dma.h" diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 5e7ec453d0..6458a94485 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -37,6 +37,7 @@ #include #include +#include "qapi/error.h" #include "qemu-common.h" #include "monitor/monitor.h" #include "qemu/error-report.h" diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 38a539311b..dbcc5a737f 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c index a2ab75d3f2..1798a00a3f 100644 --- a/hw/vfio/platform.c +++ b/hw/vfio/platform.c @@ -15,6 +15,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 7ed3dd9a13..5914e85107 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-backend.h" #include "hw/virtio/virtio-net.h" diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 392d848819..4400718154 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -14,6 +14,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/virtio/vhost.h" #include "hw/hw.h" #include "qemu/atomic.h" diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 0dadb6687f..bfedbbf17f 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -26,6 +26,7 @@ #include "hw/virtio/virtio-balloon.h" #include "hw/virtio/virtio-input.h" #include "hw/pci/pci.h" +#include "qapi/error.h" #include "qemu/error-report.h" #include "hw/pci/msi.h" #include "hw/pci/msix.h" diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index d7134646e2..6b991a7642 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/iov.h" #include "hw/qdev.h" #include "hw/virtio/virtio.h" diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 08275a9848..8ce19a0979 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "trace.h" #include "exec/address-spaces.h" diff --git a/hw/xen/xen-host-pci-device.c b/hw/xen/xen-host-pci-device.c index 9666fff8c9..4005d6ae76 100644 --- a/hw/xen/xen-host-pci-device.c +++ b/hw/xen/xen-host-pci-device.c @@ -7,6 +7,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "xen-host-pci-device.h" diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 657bf6cdc1..f593b046e5 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -53,6 +53,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include "hw/pci/pci.h" diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index 1b48f19183..9869ffda01 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "hw/xen/xen_backend.h" #include "xen_pt.h" diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index 71e745f8ca..0f4c8d77e2 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -2,6 +2,7 @@ * graphics passthrough */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "xen_pt.h" #include "xen-host-pci-device.h" #include "hw/xen/xen_backend.h" diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index 23050e8fb7..0967aa6c46 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/loader.h" diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 54e7f46868..1aff056356 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -26,6 +26,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/loader.h" diff --git a/include/qapi/error.h b/include/qapi/error.h index 02e9dd20a7..11be2327c0 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -117,11 +117,6 @@ #include "qapi-types.h" -/* - * Opaque error object. - */ -typedef struct Error Error; - /* * Overall category of an error. * Based on the qapi type QapiErrorClass, but reproduced here for nicer diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 4538fdca42..1c0ce4a1c7 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -7,8 +7,10 @@ * * To avoid getting into possible circular include dependencies, this * file should not include any other QEMU headers, with the exceptions - * of config-host.h, compiler.h, os-posix.h and os-win32.h, all of which - * are doing a similar job to this file and are under similar constraints. + * of config-host.h, config-target.h, qemu/compiler.h, + * sysemu/os-posix.h, sysemu/os-win32.h, glib-compat.h and + * qemu/typedefs.h, all of which are doing a similar job to this file + * and are under similar constraints. * * This header also contains prototypes for functions defined in * os-*.c and util/oslib-*.c; those would probably be better split @@ -98,8 +100,7 @@ extern int daemon(int, int); #endif #include "glib-compat.h" - -#include "qapi/error.h" +#include "qemu/typedefs.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0 diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index fd039e0e81..c987db6ddf 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -26,6 +26,7 @@ typedef struct DisplayChangeListener DisplayChangeListener; typedef struct DisplayState DisplayState; typedef struct DisplaySurface DisplaySurface; typedef struct DriveInfo DriveInfo; +typedef struct Error Error; typedef struct EventNotifier EventNotifier; typedef struct FWCfgIoState FWCfgIoState; typedef struct FWCfgMemState FWCfgMemState; diff --git a/include/qom/object.h b/include/qom/object.h index eda16df005..0eba22ef83 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -15,6 +15,7 @@ #define QEMU_OBJECT_H #include +#include "qapi-types.h" #include "qemu/queue.h" #include "qemu/typedefs.h" diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index 2dabe49f41..aa2436355f 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -18,11 +18,11 @@ #ifndef QEMU_SPICE_H #define QEMU_SPICE_H +#include "qapi/error.h" #ifdef CONFIG_SPICE #include - #include "qemu/option.h" #include "qemu/config-file.h" diff --git a/io/channel-command.c b/io/channel-command.c index 604514adfc..ad25313be1 100644 --- a/io/channel-command.c +++ b/io/channel-command.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "io/channel-command.h" #include "io/channel-watch.h" +#include "qapi/error.h" #include "qemu/sockets.h" #include "trace.h" diff --git a/io/channel-file.c b/io/channel-file.c index f28e2b0a5c..e1da2435e6 100644 --- a/io/channel-file.c +++ b/io/channel-file.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "io/channel-file.h" #include "io/channel-watch.h" +#include "qapi/error.h" #include "qemu/sockets.h" #include "trace.h" diff --git a/io/channel-socket.c b/io/channel-socket.c index d005070584..ca8bc20b17 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "io/channel-socket.h" #include "io/channel-watch.h" #include "trace.h" diff --git a/io/channel-tls.c b/io/channel-tls.c index 7608fd9de0..9a8525c816 100644 --- a/io/channel-tls.c +++ b/io/channel-tls.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "io/channel-tls.h" #include "trace.h" diff --git a/io/channel-websock.c b/io/channel-websock.c index 35860a2738..708178779e 100644 --- a/io/channel-websock.c +++ b/io/channel-websock.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "io/channel-websock.h" #include "crypto/hash.h" #include "trace.h" diff --git a/io/channel.c b/io/channel.c index dd6fc0eb28..692eb179b3 100644 --- a/io/channel.c +++ b/io/channel.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "io/channel.h" +#include "qapi/error.h" #include "qemu/coroutine.h" bool qio_channel_has_feature(QIOChannel *ioc, diff --git a/io/task.c b/io/task.c index bf1a3339b2..c7f97a9b16 100644 --- a/io/task.c +++ b/io/task.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "io/task.h" +#include "qapi/error.h" #include "qemu/thread.h" #include "trace.h" diff --git a/iohandler.c b/iohandler.c index 0abb4a7e7a..3f23433b5a 100644 --- a/iohandler.c +++ b/iohandler.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/queue.h" #include "block/aio.h" diff --git a/main-loop.c b/main-loop.c index 3a7f4cdbb2..9598c5f4c7 100644 --- a/main-loop.c +++ b/main-loop.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h" #include "qemu/sockets.h" // struct in_addr needed for libslirp.h diff --git a/memory.c b/memory.c index 95f720964b..f76f85df95 100644 --- a/memory.c +++ b/memory.c @@ -14,6 +14,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "exec/memory.h" #include "exec/address-spaces.h" #include "exec/ioport.h" diff --git a/memory_mapping.c b/memory_mapping.c index c8855de92b..2354b2b7f3 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include "qemu-common.h" diff --git a/migration/block.c b/migration/block.c index 72883d7c64..af8e16dfc7 100644 --- a/migration/block.c +++ b/migration/block.c @@ -14,6 +14,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "block/block.h" #include "qemu/error-report.h" diff --git a/migration/exec.c b/migration/exec.c index 62f892d4d9..559420969b 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -16,6 +16,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/sockets.h" #include "qemu/main-loop.h" diff --git a/migration/fd.c b/migration/fd.c index 085dd7c51e..3d788bb297 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -14,6 +14,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/main-loop.h" #include "qemu/sockets.h" diff --git a/migration/rdma.c b/migration/rdma.c index bcae1e81b3..0601d528bc 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -12,6 +12,7 @@ * */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "migration/migration.h" #include "migration/qemu-file.h" diff --git a/nbd/client.c b/nbd/client.c index 9e5b651082..f89c0a16ae 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -17,6 +17,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "nbd-internal.h" static int nbd_errno_to_system_errno(int err) diff --git a/nbd/common.c b/nbd/common.c index bde673a04a..a44718ce58 100644 --- a/nbd/common.c +++ b/nbd/common.c @@ -17,6 +17,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "nbd-internal.h" ssize_t nbd_wr_syncv(QIOChannel *ioc, diff --git a/nbd/server.c b/nbd/server.c index d4225cdb55..b95571bdf5 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -17,6 +17,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "nbd-internal.h" static int system_errno_to_nbd_errno(int err) diff --git a/net/dump.c b/net/dump.c index 94ac32a39f..41f7673efd 100644 --- a/net/dump.c +++ b/net/dump.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "clients.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/iov.h" diff --git a/net/filter-buffer.c b/net/filter-buffer.c index 972177b453..cc6bd94445 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "net/filter.h" #include "net/queue.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/timer.h" #include "qemu/iov.h" diff --git a/net/filter.c b/net/filter.c index a08ef68ae6..1c4fc5a2c7 100644 --- a/net/filter.c +++ b/net/filter.c @@ -7,6 +7,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" diff --git a/net/socket.c b/net/socket.c index 9826efb46f..9fa2cd8d51 100644 --- a/net/socket.c +++ b/net/socket.c @@ -26,6 +26,7 @@ #include "net/net.h" #include "clients.h" #include "monitor/monitor.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/option.h" diff --git a/net/tap-aix.c b/net/tap-aix.c index 9d830b7a32..0e6da63963 100644 --- a/net/tap-aix.c +++ b/net/tap-aix.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "tap_int.h" int tap_open(char *ifname, int ifname_size, int *vnet_hdr, diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 83de19a646..33642ae518 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "tap_int.h" #include "qemu-common.h" #include "sysemu/sysemu.h" diff --git a/net/tap-haiku.c b/net/tap-haiku.c index 397e53235e..b27e57e955 100644 --- a/net/tap-haiku.c +++ b/net/tap-haiku.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "tap_int.h" int tap_open(char *ifname, int ifname_size, int *vnet_hdr, diff --git a/net/tap-linux.c b/net/tap-linux.c index 0929cf76f5..8077d2b575 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -32,6 +32,7 @@ #include #include "sysemu/sysemu.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" diff --git a/net/tap-solaris.c b/net/tap-solaris.c index e3907a8218..26d2042922 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "tap_int.h" #include "sysemu/sysemu.h" diff --git a/net/tap.c b/net/tap.c index 8f790d15ff..3ddf9ecd7d 100644 --- a/net/tap.c +++ b/net/tap.c @@ -36,6 +36,7 @@ #include "clients.h" #include "monitor/monitor.h" #include "sysemu/sysemu.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 73e4acea7b..5e2b8832a8 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qapi/qmp/qerror.h" #include "qapi/opts-visitor.h" diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c index 8afb12eb43..818730a660 100644 --- a/qapi/qapi-util.c +++ b/qapi/qapi-util.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qapi/util.h" diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 856606b253..fa680c9991 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qapi/qmp/qobject.h" #include "qapi/qmp/qerror.h" diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 8f27c3456d..510a1aead8 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qapi/qmp/types.h" #include "qapi/qmp/dispatch.h" #include "qapi/qmp/json-parser.h" diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index e6598327c3..7cd1b777a0 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qapi/qmp-input-visitor.h" #include "qapi/visitor-impl.h" #include "qemu/queue.h" diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 59eb5dc4e3..ab129536e4 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qapi/string-input-visitor.h" #include "qapi/visitor-impl.h" diff --git a/qemu-img.c b/qemu-img.c index 29eae2a24b..8b54d05486 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qapi-visit.h" #include "qapi/qmp-output-visitor.h" #include "qapi/qmp/qerror.h" diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index e929d24a49..13fbb5944c 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -9,6 +9,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-io.h" #include "sysemu/block-backend.h" #include "block/block.h" diff --git a/qemu-io.c b/qemu-io.c index d7c2f26bbb..bc129536e4 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -11,6 +11,7 @@ #include #include +#include "qapi/error.h" #include "qemu-io.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" diff --git a/qemu-nbd.c b/qemu-nbd.c index f3528c8c04..2963c56df7 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -17,6 +17,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "sysemu/block-backend.h" #include "block/block_int.h" diff --git a/qga/channel-posix.c b/qga/channel-posix.c index 7ad3c00765..63458c6632 100644 --- a/qga/channel-posix.c +++ b/qga/channel-posix.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include #include +#include "qapi/error.h" #include "qemu/sockets.h" #include "qga/channel.h" diff --git a/qobject/json-parser.c b/qobject/json-parser.c index 6c05f6cc70..6e65b82264 100644 --- a/qobject/json-parser.c +++ b/qobject/json-parser.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qapi/qmp/qstring.h" #include "qapi/qmp/qint.h" diff --git a/qom/cpu.c b/qom/cpu.c index c45d0bb6de..c9007d3d06 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qom/cpu.h" #include "sysemu/kvm.h" diff --git a/qom/object.c b/qom/object.c index 844ae7a0fd..6a1f03019b 100644 --- a/qom/object.c +++ b/qom/object.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qom/object.h" #include "qom/object_interfaces.h" #include "qemu-common.h" diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index c2f6e2998e..ab5da35e4f 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qom/object_interfaces.h" #include "qemu/module.h" #include "qapi-visit.h" diff --git a/qom/qom-qobject.c b/qom/qom-qobject.c index 9cbc4c69a6..e6b17c1f1b 100644 --- a/qom/qom-qobject.c +++ b/qom/qom-qobject.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qom/object.h" #include "qom/qom-qobject.h" diff --git a/qtest.c b/qtest.c index 58a7732ef3..87575bc0b4 100644 --- a/qtest.c +++ b/qtest.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/qtest.h" #include "hw/qdev.h" #include "sysemu/char.h" diff --git a/replay/replay-input.c b/replay/replay-input.c index 2d5d9191ca..06babe0ecc 100644 --- a/replay/replay-input.c +++ b/replay/replay-input.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "sysemu/replay.h" #include "replay-internal.h" diff --git a/replay/replay.c b/replay/replay.c index fcfde4fc93..ec32c81072 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "sysemu/replay.h" #include "replay-internal.h" diff --git a/scripts/clean-includes b/scripts/clean-includes index 177d253eb9..8052bbd3b4 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -139,12 +139,13 @@ for f in "$@"; do # Remove includes that osdep.h already provides perl -n -i -e 'print if !/\s*#\s*include\s*(["<][^>"]*[">])/ || ! (grep { $_ eq $1 } qw ( - "config-host.h" "qemu/compiler.h" "config.h" + "config-host.h" "config-target.h" "qemu/compiler.h" - "glib-compat.h" "qapi/error.h" + "sysemu/os-posix.h, sysemu/os-win32.h "glib-compat.h" + "qemu/typedefs.h" ))' "$f" done diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index c147990efe..31d2330356 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -355,6 +355,7 @@ h_comment = ''' fdef.write(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h" +#include "qapi/error.h" #include "%(prefix)sqapi-visit.h" ''', prefix=prefix)) diff --git a/stubs/get-fd.c b/stubs/get-fd.c index 85881fb678..7dfdfb55f7 100644 --- a/stubs/get-fd.c +++ b/stubs/get-fd.c @@ -1,4 +1,5 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "monitor/monitor.h" diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c index 2eab0609e4..8a155cae90 100644 --- a/target-alpha/cpu.c +++ b/target-alpha/cpu.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h" diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 352d9f883d..e48e83acbb 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "internals.h" #include "qemu-common.h" diff --git a/target-arm/cpu64.c b/target-arm/cpu64.c index fa5eda2cd1..1635debc1a 100644 --- a/target-arm/cpu64.c +++ b/target-arm/cpu64.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #if !defined(CONFIG_USER_ONLY) diff --git a/target-cris/cpu.c b/target-cris/cpu.c index b2c8624dbf..1cb79dd977 100644 --- a/target-cris/cpu.c +++ b/target-cris/cpu.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "mmu.h" diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 08d6444741..87ab969ae1 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include #include #include diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c index f93bb5d0dd..6e7e1b8e63 100644 --- a/target-lm32/cpu.c +++ b/target-lm32/cpu.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" diff --git a/target-m68k/cpu.c b/target-m68k/cpu.c index 6de74bf28e..0b5f9a581e 100644 --- a/target-m68k/cpu.c +++ b/target-m68k/cpu.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h" diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c index 7a42897a00..fdfb01917f 100644 --- a/target-microblaze/cpu.c +++ b/target-microblaze/cpu.c @@ -22,6 +22,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "hw/qdev-properties.h" diff --git a/target-mips/cpu.c b/target-mips/cpu.c index 7dc3a44a15..0e2ecbebec 100644 --- a/target-mips/cpu.c +++ b/target-mips/cpu.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "kvm_mips.h" #include "qemu-common.h" diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c index b33c2b3741..b4ee84e906 100644 --- a/target-moxie/cpu.c +++ b/target-moxie/cpu.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h" diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c index cafc07f788..ae6ed9e92c 100644 --- a/target-openrisc/cpu.c +++ b/target-openrisc/cpu.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c index d175fdad45..72c4ab5d75 100644 --- a/target-ppc/mmu-hash64.c +++ b/target-ppc/mmu-hash64.c @@ -18,6 +18,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "exec/helper-proto.h" #include "qemu/error-report.h" diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c index fcb2cc5c79..ff217941b5 100644 --- a/target-ppc/mmu_helper.c +++ b/target-ppc/mmu_helper.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "exec/helper-proto.h" #include "sysemu/kvm.h" diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index 1cbf70355d..9746b1ddfe 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "qemu/timer.h" diff --git a/target-s390x/helper.c b/target-s390x/helper.c index 76d5fbebe8..92abe7e676 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "exec/gdbstub.h" #include "qemu/timer.h" diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c index 8621d70d4d..86ba38808b 100644 --- a/target-sh4/cpu.c +++ b/target-sh4/cpu.c @@ -20,6 +20,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h" diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c index ce903f8dfd..fe4119e2bc 100644 --- a/target-sparc/cpu.c +++ b/target-sparc/cpu.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu/error-report.h" diff --git a/target-tilegx/cpu.c b/target-tilegx/cpu.c index eceeb2c997..d2d0912034 100644 --- a/target-tilegx/cpu.c +++ b/target-tilegx/cpu.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "hw/qdev-properties.h" diff --git a/target-tricore/cpu.c b/target-tricore/cpu.c index f8b8518558..69fca8c068 100644 --- a/target-tricore/cpu.c +++ b/target-tricore/cpu.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c index c92ccc4251..66f43acfff 100644 --- a/target-unicore32/cpu.c +++ b/target-unicore32/cpu.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h" diff --git a/target-xtensa/cpu.c b/target-xtensa/cpu.c index d572d56795..01b251fdc7 100644 --- a/target-xtensa/cpu.c +++ b/target-xtensa/cpu.c @@ -29,6 +29,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h" diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c index a2bb556906..ffffd872f2 100644 --- a/tests/check-qom-proplist.c +++ b/tests/check-qom-proplist.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include +#include "qapi/error.h" #include "qom/object.h" #include "qemu/module.h" diff --git a/tests/io-channel-helpers.c b/tests/io-channel-helpers.c index a4dedbe0ad..05e5579cf8 100644 --- a/tests/io-channel-helpers.c +++ b/tests/io-channel-helpers.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "io-channel-helpers.h" +#include "qapi/error.h" struct QIOChannelTest { QIOChannel *src; diff --git a/tests/test-aio.c b/tests/test-aio.c index a109bd0c42..687dfa062e 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include #include "block/aio.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "qemu/sockets.h" #include "qemu/error-report.h" diff --git a/tests/test-base64.c b/tests/test-base64.c index ae0c107c7d..922e839dd6 100644 --- a/tests/test-base64.c +++ b/tests/test-base64.c @@ -21,9 +21,9 @@ #include "qemu/osdep.h" #include +#include "qapi/error.h" #include "qemu/base64.h" - static void test_base64_good(void) { const char input[] = diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c index c866da66c8..55fad9507a 100644 --- a/tests/test-blockjob-txn.c +++ b/tests/test-blockjob-txn.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include +#include "qapi/error.h" #include "qemu/main-loop.h" #include "block/blockjob.h" diff --git a/tests/test-crypto-afsplit.c b/tests/test-crypto-afsplit.c index ceaac0a06d..f9f2fcd417 100644 --- a/tests/test-crypto-afsplit.c +++ b/tests/test-crypto-afsplit.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/init.h" #include "crypto/afsplit.h" diff --git a/tests/test-crypto-block.c b/tests/test-crypto-block.c index cdbe09d4ed..a38110d3ff 100644 --- a/tests/test-crypto-block.c +++ b/tests/test-crypto-block.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/init.h" #include "crypto/block.h" #include "qemu/buffer.h" diff --git a/tests/test-crypto-cipher.c b/tests/test-crypto-cipher.c index e52b741f87..66d1c63fd5 100644 --- a/tests/test-crypto-cipher.c +++ b/tests/test-crypto-cipher.c @@ -23,6 +23,7 @@ #include "crypto/init.h" #include "crypto/cipher.h" +#include "qapi/error.h" typedef struct QCryptoCipherTestData QCryptoCipherTestData; struct QCryptoCipherTestData { diff --git a/tests/test-crypto-ivgen.c b/tests/test-crypto-ivgen.c index 96129da367..a5ff5d3da6 100644 --- a/tests/test-crypto-ivgen.c +++ b/tests/test-crypto-ivgen.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/ivgen.h" diff --git a/tests/test-crypto-pbkdf.c b/tests/test-crypto-pbkdf.c index bb9c14c110..8ceceb1827 100644 --- a/tests/test-crypto-pbkdf.c +++ b/tests/test-crypto-pbkdf.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "crypto/init.h" #ifndef _WIN32 #include diff --git a/tests/test-crypto-secret.c b/tests/test-crypto-secret.c index 2bbc4d9e3c..43e295240c 100644 --- a/tests/test-crypto-secret.c +++ b/tests/test-crypto-secret.c @@ -23,6 +23,7 @@ #include "crypto/init.h" #include "crypto/secret.h" +#include "qapi/error.h" static void test_secret_direct(void) { diff --git a/tests/test-crypto-tlscredsx509.c b/tests/test-crypto-tlscredsx509.c index 7ca387db65..af2f80e89c 100644 --- a/tests/test-crypto-tlscredsx509.c +++ b/tests/test-crypto-tlscredsx509.c @@ -22,6 +22,7 @@ #include "crypto-tls-x509-helpers.h" #include "crypto/tlscredsx509.h" +#include "qapi/error.h" #ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT diff --git a/tests/test-crypto-tlssession.c b/tests/test-crypto-tlssession.c index 036a86b0c3..1a4a066d76 100644 --- a/tests/test-crypto-tlssession.c +++ b/tests/test-crypto-tlssession.c @@ -24,6 +24,7 @@ #include "crypto/tlscredsx509.h" #include "crypto/tlssession.h" #include "qom/object_interfaces.h" +#include "qapi/error.h" #include "qemu/sockets.h" #include "qemu/acl.h" diff --git a/tests/test-io-channel-command.c b/tests/test-io-channel-command.c index 885543760a..1d1f461bed 100644 --- a/tests/test-io-channel-command.c +++ b/tests/test-io-channel-command.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "io/channel-command.h" #include "io-channel-helpers.h" +#include "qapi/error.h" #ifndef WIN32 static void test_io_channel_command_fifo(bool async) diff --git a/tests/test-io-channel-file.c b/tests/test-io-channel-file.c index 1e7f3c7f12..6bfede6bb7 100644 --- a/tests/test-io-channel-file.c +++ b/tests/test-io-channel-file.c @@ -22,7 +22,7 @@ #include "io/channel-file.h" #include "io/channel-util.h" #include "io-channel-helpers.h" - +#include "qapi/error.h" static void test_io_channel_file(void) { diff --git a/tests/test-io-channel-socket.c b/tests/test-io-channel-socket.c index be0c3003d4..9d94adb9ac 100644 --- a/tests/test-io-channel-socket.c +++ b/tests/test-io-channel-socket.c @@ -22,6 +22,7 @@ #include "io/channel-socket.h" #include "io/channel-util.h" #include "io-channel-helpers.h" +#include "qapi/error.h" #ifndef AI_ADDRCONFIG # define AI_ADDRCONFIG 0 diff --git a/tests/test-io-task.c b/tests/test-io-task.c index ae46c56a47..5a9775086c 100644 --- a/tests/test-io-task.c +++ b/tests/test-io-task.c @@ -22,6 +22,7 @@ #include #include "io/task.h" +#include "qapi/error.h" #define TYPE_DUMMY "qemu:dummy" diff --git a/tests/test-opts-visitor.c b/tests/test-opts-visitor.c index 297a02d6a2..008e677388 100644 --- a/tests/test-opts-visitor.c +++ b/tests/test-opts-visitor.c @@ -15,6 +15,7 @@ #include "qemu/config-file.h" /* qemu_add_opts() */ #include "qemu/option.h" /* qemu_opts_parse() */ +#include "qapi/error.h" #include "qapi/opts-visitor.h" /* opts_visitor_new() */ #include "test-qapi-visit.h" /* visit_type_UserDefOptions() */ diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c index 848374e2bd..32abed5ea1 100644 --- a/tests/test-qemu-opts.c +++ b/tests/test-qemu-opts.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qapi/qmp/qstring.h" #include "qemu/config-file.h" diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c index 6a33aa41e5..d71727e272 100644 --- a/tests/test-qmp-input-strict.c +++ b/tests/test-qmp-input-strict.c @@ -15,6 +15,7 @@ #include #include "qemu-common.h" +#include "qapi/error.h" #include "qapi/qmp-input-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c index 5941e90b35..80527eb850 100644 --- a/tests/test-qmp-input-visitor.c +++ b/tests/test-qmp-input-visitor.c @@ -14,6 +14,7 @@ #include #include "qemu-common.h" +#include "qapi/error.h" #include "qapi/qmp-input-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c index dc35752969..c70926793a 100644 --- a/tests/test-qmp-output-visitor.c +++ b/tests/test-qmp-output-visitor.c @@ -14,6 +14,7 @@ #include #include "qemu-common.h" +#include "qapi/error.h" #include "qapi/qmp-output-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index 4b48ec25d3..9e6906a567 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -14,6 +14,7 @@ #include #include "qemu-common.h" +#include "qapi/error.h" #include "qapi/string-input-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c index 0beccf98c7..1ecd75b853 100644 --- a/tests/test-string-output-visitor.c +++ b/tests/test-string-output-visitor.c @@ -14,6 +14,7 @@ #include #include "qemu-common.h" +#include "qapi/error.h" #include "qapi/string-output-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c index 40600b40bb..88dc7316b3 100644 --- a/tests/test-thread-pool.c +++ b/tests/test-thread-pool.c @@ -4,6 +4,7 @@ #include "block/aio.h" #include "block/thread-pool.h" #include "block/block.h" +#include "qapi/error.h" #include "qemu/timer.h" #include "qemu/error-report.h" diff --git a/tests/test-throttle.c b/tests/test-throttle.c index 59675fa57b..744a524368 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -16,6 +16,7 @@ #include #include #include "block/aio.h" +#include "qapi/error.h" #include "qemu/throttle.h" #include "qemu/error-report.h" #include "block/throttle-groups.h" diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c index ef4dac5e01..9adbc30a41 100644 --- a/tests/test-visitor-serialization.c +++ b/tests/test-visitor-serialization.c @@ -18,6 +18,7 @@ #include "qemu-common.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" +#include "qapi/error.h" #include "qapi/qmp/types.h" #include "qapi/qmp-input-visitor.h" #include "qapi/qmp-output-visitor.h" diff --git a/ui/input-linux.c b/ui/input-linux.c index 2cf5d4990c..84c52d3292 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -5,6 +5,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/config-file.h" #include "qemu/sockets.h" diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c index 56e45e3473..5ae29c14cf 100644 --- a/ui/vnc-auth-sasl.c +++ b/ui/vnc-auth-sasl.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "vnc.h" /* Max amount of data we send/recv for SASL steps to prevent DOS */ diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c index 8f3bb11cea..11c8c9a819 100644 --- a/ui/vnc-auth-vencrypt.c +++ b/ui/vnc-auth-vencrypt.c @@ -26,6 +26,7 @@ #include "qemu/osdep.h" #include "vnc.h" +#include "qapi/error.h" #include "qemu/main-loop.h" static void start_auth_vencrypt_subauth(VncState *vs) diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c index 1d3ecc2330..7c79a4c372 100644 --- a/ui/vnc-ws.c +++ b/ui/vnc-ws.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "vnc.h" #include "io/channel-websock.h" diff --git a/util/base64.c b/util/base64.c index d4bf2a61f9..9d3c46cbcc 100644 --- a/util/base64.c +++ b/util/base64.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/base64.h" static const char *base64_valid_chars = diff --git a/util/error.c b/util/error.c index 47f93afe5f..cae2511732 100644 --- a/util/error.c +++ b/util/error.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 7615be4e7a..dcc3c7ea01 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -46,6 +46,7 @@ #include "sysemu/sysemu.h" #include "trace.h" +#include "qapi/error.h" #include "qemu/sockets.h" #include #include diff --git a/util/oslib-win32.c b/util/oslib-win32.c index a3f0664763..4ef4a9a13b 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -32,6 +32,7 @@ #include "qemu/osdep.h" #include #include +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "qemu/main-loop.h" #include "trace.h" diff --git a/util/qemu-option.c b/util/qemu-option.c index e7aa43f857..98967ffde9 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu-common.h" #include "qemu/error-report.h" #include "qapi/qmp/types.h" diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 540649a7af..6f344d4405 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -18,6 +18,7 @@ #include "qemu/osdep.h" #include "monitor/monitor.h" +#include "qapi/error.h" #include "qemu/sockets.h" #include "qemu/main-loop.h" #include "qapi/qmp-input-visitor.h" diff --git a/util/throttle.c b/util/throttle.c index 371c769455..71246b2343 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/throttle.h" #include "qemu/timer.h" #include "block/aio.h" From 14b6d44d4720681a57b5d2c58cabdfc6364f8263 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 14 Mar 2016 10:00:42 +0100 Subject: [PATCH 02/28] Use scripts/clean-includes to drop redundant qemu/typedefs.h Re-run scripts/clean-includes to apply the previous commit's corrections and updates. Besides redundant qemu/typedefs.h, this only finds a redundant config-host.h include in ui/egl-helpers.c. No idea how that escaped the previous runs. Some manual whitespace trimming around dropped includes squashed in. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- hw/i386/acpi-build.h | 2 -- include/block/accounting.h | 2 -- include/block/aio.h | 1 - include/block/write-threshold.h | 2 -- include/exec/cpu-common.h | 1 - include/exec/memory.h | 1 - include/hw/acpi/acpi.h | 1 - include/hw/acpi/piix4.h | 2 -- include/hw/acpi/tco.h | 1 - include/hw/boards.h | 1 - include/hw/char/digic-uart.h | 1 - include/hw/hotplug.h | 1 - include/hw/i386/pc.h | 1 - include/hw/nvram/fw_cfg.h | 1 - include/hw/qdev-core.h | 1 - include/hw/scsi/scsi.h | 1 - include/hw/timer/digic-timer.h | 1 - include/hw/vfio/vfio.h | 2 -- include/hw/xen/xen.h | 1 - include/monitor/qdev.h | 1 - include/net/filter.h | 1 - include/qapi/visitor.h | 1 - include/qemu-common.h | 1 - include/qemu/coroutine.h | 1 - include/qemu/option.h | 1 - include/qemu/timer.h | 1 - include/qom/cpu.h | 1 - include/qom/object.h | 1 - include/sysemu/accel.h | 1 - include/sysemu/block-backend.h | 2 -- include/sysemu/memory_mapping.h | 1 - include/sysemu/replay.h | 1 - include/sysemu/sysemu.h | 1 - include/ui/console.h | 1 - include/ui/qemu-pixman.h | 2 -- stubs/target-get-monitor-def.c | 1 - stubs/target-monitor-defs.c | 1 - trace/control.h | 1 - trace/qmp.c | 1 - ui/egl-helpers.c | 1 - 40 files changed, 47 deletions(-) diff --git a/hw/i386/acpi-build.h b/hw/i386/acpi-build.h index 148c0f9977..007332e51c 100644 --- a/hw/i386/acpi-build.h +++ b/hw/i386/acpi-build.h @@ -2,8 +2,6 @@ #ifndef HW_I386_ACPI_BUILD_H #define HW_I386_ACPI_BUILD_H -#include "qemu/typedefs.h" - void acpi_setup(void); #endif diff --git a/include/block/accounting.h b/include/block/accounting.h index 2db2a009a1..20891639d5 100644 --- a/include/block/accounting.h +++ b/include/block/accounting.h @@ -25,8 +25,6 @@ #ifndef BLOCK_ACCOUNTING_H #define BLOCK_ACCOUNTING_H - -#include "qemu/typedefs.h" #include "qemu/timed-average.h" typedef struct BlockAcctTimedStats BlockAcctTimedStats; diff --git a/include/block/aio.h b/include/block/aio.h index e086e3b4ee..88a64eeb3c 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -14,7 +14,6 @@ #ifndef QEMU_AIO_H #define QEMU_AIO_H -#include "qemu/typedefs.h" #include "qemu-common.h" #include "qemu/queue.h" #include "qemu/event_notifier.h" diff --git a/include/block/write-threshold.h b/include/block/write-threshold.h index 8a79505ada..234d2193e0 100644 --- a/include/block/write-threshold.h +++ b/include/block/write-threshold.h @@ -12,8 +12,6 @@ #ifndef BLOCK_WRITE_THRESHOLD_H #define BLOCK_WRITE_THRESHOLD_H - -#include "qemu/typedefs.h" #include "qemu-common.h" /* diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index a0ad2acb43..9e839e50cd 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -14,7 +14,6 @@ #include "qemu/bswap.h" #include "qemu/queue.h" #include "qemu/fprintf-fn.h" -#include "qemu/typedefs.h" /** * CPUListState: diff --git a/include/exec/memory.h b/include/exec/memory.h index 2de789871d..e2a3e9953c 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -31,7 +31,6 @@ #include "qemu/notify.h" #include "qom/object.h" #include "qemu/rcu.h" -#include "qemu/typedefs.h" #define MAX_PHYS_ADDR_SPACE_BITS 62 #define MAX_PHYS_ADDR (((hwaddr)1 << MAX_PHYS_ADDR_SPACE_BITS) - 1) diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index 7462e20fe3..443687d484 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -19,7 +19,6 @@ * . */ -#include "qemu/typedefs.h" #include "qemu/notify.h" #include "qemu/option.h" #include "exec/memory.h" diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h index 65e6fd7aa0..26c2370e30 100644 --- a/include/hw/acpi/piix4.h +++ b/include/hw/acpi/piix4.h @@ -1,8 +1,6 @@ #ifndef HW_ACPI_PIIX4_H #define HW_ACPI_PIIX4_H -#include "qemu/typedefs.h" - Object *piix4_pm_find(void); #endif diff --git a/include/hw/acpi/tco.h b/include/hw/acpi/tco.h index c63afc8ca3..52ad767ddd 100644 --- a/include/hw/acpi/tco.h +++ b/include/hw/acpi/tco.h @@ -9,7 +9,6 @@ #ifndef HW_ACPI_TCO_H #define HW_ACPI_TCO_H -#include "qemu/typedefs.h" #include "qemu-common.h" /* As per ICH9 spec, the internal timer has an error of ~0.6s on every tick */ diff --git a/include/hw/boards.h b/include/hw/boards.h index 8efce0f91e..aad5f2a99f 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -3,7 +3,6 @@ #ifndef HW_BOARDS_H #define HW_BOARDS_H -#include "qemu/typedefs.h" #include "sysemu/blockdev.h" #include "sysemu/accel.h" #include "hw/qdev.h" diff --git a/include/hw/char/digic-uart.h b/include/hw/char/digic-uart.h index ef83a3059c..7b3f145372 100644 --- a/include/hw/char/digic-uart.h +++ b/include/hw/char/digic-uart.h @@ -19,7 +19,6 @@ #define HW_CHAR_DIGIC_UART_H #include "hw/sysbus.h" -#include "qemu/typedefs.h" #define TYPE_DIGIC_UART "digic-uart" #define DIGIC_UART(obj) \ diff --git a/include/hw/hotplug.h b/include/hw/hotplug.h index 2db025d0bd..da1d0e4ab8 100644 --- a/include/hw/hotplug.h +++ b/include/hw/hotplug.h @@ -13,7 +13,6 @@ #define HOTPLUG_H #include "qom/object.h" -#include "qemu/typedefs.h" #define TYPE_HOTPLUG_HANDLER "hotplug-handler" diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 847d92f550..96f0b66c77 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -2,7 +2,6 @@ #define HW_PC_H #include "qemu-common.h" -#include "qemu/typedefs.h" #include "exec/memory.h" #include "hw/boards.h" #include "hw/isa/isa.h" diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 4315f4e582..10a99715b2 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -4,7 +4,6 @@ #ifndef NO_QEMU_PROTOS #include "exec/hwaddr.h" -#include "qemu/typedefs.h" #endif #define FW_CFG_SIGNATURE 0x00 diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index c3ff99f975..1ce02b20da 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -3,7 +3,6 @@ #include "qemu/queue.h" #include "qemu/option.h" -#include "qemu/typedefs.h" #include "qemu/bitmap.h" #include "qom/object.h" #include "hw/irq.h" diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 29052f81a5..8acd3fa998 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -2,7 +2,6 @@ #define QEMU_HW_SCSI_H #include "hw/qdev.h" -#include "qemu/typedefs.h" #include "hw/block/block.h" #include "sysemu/sysemu.h" #include "qemu/notify.h" diff --git a/include/hw/timer/digic-timer.h b/include/hw/timer/digic-timer.h index ae913482c6..d9e67fe291 100644 --- a/include/hw/timer/digic-timer.h +++ b/include/hw/timer/digic-timer.h @@ -19,7 +19,6 @@ #define HW_TIMER_DIGIC_TIMER_H #include "hw/sysbus.h" -#include "qemu/typedefs.h" #include "hw/ptimer.h" #define TYPE_DIGIC_TIMER "digic-timer" diff --git a/include/hw/vfio/vfio.h b/include/hw/vfio/vfio.h index 7153604cd1..f27d599220 100644 --- a/include/hw/vfio/vfio.h +++ b/include/hw/vfio/vfio.h @@ -1,8 +1,6 @@ #ifndef VFIO_API_H #define VFIO_API_H -#include "qemu/typedefs.h" - bool vfio_eeh_as_ok(AddressSpace *as); int vfio_eeh_as_op(AddressSpace *as, uint32_t op); diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index bf3fe97927..6eb815aace 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -9,7 +9,6 @@ #include "hw/irq.h" #include "qemu-common.h" -#include "qemu/typedefs.h" /* xen-machine.c */ enum xen_mode { diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h index 50ec2ffc12..c4b8a05146 100644 --- a/include/monitor/qdev.h +++ b/include/monitor/qdev.h @@ -2,7 +2,6 @@ #define QEMU_QDEV_MONITOR_H #include "hw/qdev-core.h" -#include "qemu/typedefs.h" /*** monitor commands ***/ diff --git a/include/net/filter.h b/include/net/filter.h index cfb11728df..0c4a2ea6c9 100644 --- a/include/net/filter.h +++ b/include/net/filter.h @@ -11,7 +11,6 @@ #include "qom/object.h" #include "qemu-common.h" -#include "qemu/typedefs.h" #include "net/queue.h" #define TYPE_NETFILTER "netfilter" diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index 1000da2bda..9a8d0105fb 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -14,7 +14,6 @@ #ifndef QAPI_VISITOR_CORE_H #define QAPI_VISITOR_CORE_H -#include "qemu/typedefs.h" #include "qapi/qmp/qobject.h" /* This struct is layout-compatible with all other *List structs diff --git a/include/qemu-common.h b/include/qemu-common.h index 887ca71c8a..2de4ce2019 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -12,7 +12,6 @@ #ifndef QEMU_COMMON_H #define QEMU_COMMON_H -#include "qemu/typedefs.h" #include "qemu/fprintf-fn.h" #if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) || defined(__ia64__) diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index 99b939846b..305fe76c29 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -15,7 +15,6 @@ #ifndef QEMU_COROUTINE_H #define QEMU_COROUTINE_H -#include "qemu/typedefs.h" #include "qemu/queue.h" #include "qemu/timer.h" diff --git a/include/qemu/option.h b/include/qemu/option.h index 8809ce1e75..8542d2dfd6 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -28,7 +28,6 @@ #include "qemu/queue.h" #include "qapi/qmp/qdict.h" -#include "qemu/typedefs.h" const char *get_opt_name(char *buf, int buf_size, const char *p, char delim); const char *get_opt_value(char *buf, int buf_size, const char *p); diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 7197d0859a..028e309b7b 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -1,7 +1,6 @@ #ifndef QEMU_TIMER_H #define QEMU_TIMER_H -#include "qemu/typedefs.h" #include "qemu-common.h" #include "qemu/notify.h" #include "qemu/host-utils.h" diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 7052eee7b7..0b6fa2507c 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -27,7 +27,6 @@ #include "exec/memattrs.h" #include "qemu/queue.h" #include "qemu/thread.h" -#include "qemu/typedefs.h" typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size, void *opaque); diff --git a/include/qom/object.h b/include/qom/object.h index 0eba22ef83..21bb5ff149 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -17,7 +17,6 @@ #include #include "qapi-types.h" #include "qemu/queue.h" -#include "qemu/typedefs.h" struct TypeImpl; typedef struct TypeImpl *Type; diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 997720f36c..a74b2faf5f 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -23,7 +23,6 @@ #ifndef HW_ACCEL_H #define HW_ACCEL_H -#include "qemu/typedefs.h" #include "qom/object.h" typedef struct AccelState { diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index d839bffeb0..70f4eaf1e7 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -13,8 +13,6 @@ #ifndef BLOCK_BACKEND_H #define BLOCK_BACKEND_H -#include "qemu/typedefs.h" - /* * TODO Have to include block/block.h for a bunch of block layer * types. Unfortunately, this pulls in the whole BlockDriverState diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index d46d879b94..706152d533 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -15,7 +15,6 @@ #define MEMORY_MAPPING_H #include "qemu/queue.h" -#include "qemu/typedefs.h" #include "exec/memory.h" typedef struct GuestPhysBlock { diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index e7989199fc..5854adc4e6 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -13,7 +13,6 @@ */ #include "qapi-types.h" -#include "qemu/typedefs.h" /* replay clock kinds */ enum ReplayClockKind { diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 3bb8897727..38fb3cad35 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -2,7 +2,6 @@ #define SYSEMU_H /* Misc. things related to the system emulator. */ -#include "qemu/typedefs.h" #include "qemu/option.h" #include "qemu/queue.h" #include "qemu/timer.h" diff --git a/include/ui/console.h b/include/ui/console.h index f63697182f..eb9419dfd6 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -5,7 +5,6 @@ #include "qom/object.h" #include "qapi/qmp/qdict.h" #include "qemu/notify.h" -#include "qemu/typedefs.h" #include "qapi-types.h" #ifdef CONFIG_OPENGL diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index e34c4effcb..4a67e01232 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -16,8 +16,6 @@ #pragma GCC diagnostic pop #endif -#include "qemu/typedefs.h" - /* * pixman image formats are defined to be native endian, * that means host byte order on qemu. So we go define diff --git a/stubs/target-get-monitor-def.c b/stubs/target-get-monitor-def.c index 4d1033d12d..dd83052745 100644 --- a/stubs/target-get-monitor-def.c +++ b/stubs/target-get-monitor-def.c @@ -20,7 +20,6 @@ */ #include "qemu/osdep.h" -#include "qemu/typedefs.h" #include "stdint.h" int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval); diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c index 203ebb0f27..7a16ad7014 100644 --- a/stubs/target-monitor-defs.c +++ b/stubs/target-monitor-defs.c @@ -1,6 +1,5 @@ #include "qemu/osdep.h" #include "stddef.h" -#include "qemu/typedefs.h" const MonitorDef *target_monitor_defs(void); diff --git a/trace/control.h b/trace/control.h index f0fe535804..e2ba6d4de1 100644 --- a/trace/control.h +++ b/trace/control.h @@ -11,7 +11,6 @@ #define TRACE__CONTROL_H #include "qemu-common.h" -#include "qemu/typedefs.h" #include "trace/generated-events.h" diff --git a/trace/qmp.c b/trace/qmp.c index 6320b4b3b1..8aa2660aac 100644 --- a/trace/qmp.c +++ b/trace/qmp.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include "qemu/typedefs.h" #include "qmp-commands.h" #include "trace/control.h" diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 54be44ccea..558edfdeb7 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -2,7 +2,6 @@ #include #include -#include "config-host.h" #include "ui/egl-helpers.h" EGLDisplay *qemu_egl_display; From c80f6e9caa7647b576966534aaa0dc8f1b480f2b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 14 Mar 2016 11:25:21 +0100 Subject: [PATCH 03/28] Clean up includes some more Manually drop redundant includes that scripts/clean-includes misses, e.g. because they're hidden in generator programs, or they use the wrong kind of delimiter. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- hw/net/vmxnet_rx_pkt.h | 2 -- hw/net/vmxnet_tx_pkt.h | 2 -- hw/scsi/virtio-scsi-dataplane.c | 1 - include/hw/acpi/pcihp.h | 1 - include/qemu/range.h | 1 - qga/main.c | 1 - qga/vss-win32/requester.cpp | 1 - scripts/qapi-types.py | 5 ----- scripts/tracetool/backend/log.py | 6 +----- scripts/tracetool/format/events_h.py | 2 -- scripts/tracetool/format/h.py | 1 - scripts/tracetool/format/tcg_h.py | 2 -- scripts/tracetool/format/ust_events_c.py | 1 - stubs/gdbstub.c | 2 -- stubs/target-get-monitor-def.c | 1 - stubs/target-monitor-defs.c | 1 - tests/tcg/test-i386-fprem.c | 4 +--- 17 files changed, 2 insertions(+), 32 deletions(-) diff --git a/hw/net/vmxnet_rx_pkt.h b/hw/net/vmxnet_rx_pkt.h index a425846b52..0a45c1ba00 100644 --- a/hw/net/vmxnet_rx_pkt.h +++ b/hw/net/vmxnet_rx_pkt.h @@ -18,8 +18,6 @@ #ifndef VMXNET_RX_PKT_H #define VMXNET_RX_PKT_H -#include "stdint.h" -#include "stdbool.h" #include "net/eth.h" /* defines to enable packet dump functions */ diff --git a/hw/net/vmxnet_tx_pkt.h b/hw/net/vmxnet_tx_pkt.h index 57121a6fe5..f51e98ad95 100644 --- a/hw/net/vmxnet_tx_pkt.h +++ b/hw/net/vmxnet_tx_pkt.h @@ -18,8 +18,6 @@ #ifndef VMXNET_TX_PKT_H #define VMXNET_TX_PKT_H -#include "stdint.h" -#include "stdbool.h" #include "net/eth.h" #include "exec/hwaddr.h" diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c index 367e47643f..b44ac5dfa0 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -19,7 +19,6 @@ #include #include #include "hw/virtio/virtio-access.h" -#include "stdio.h" /* Context: QEMU global mutex held */ void virtio_scsi_set_iothread(VirtIOSCSI *s, IOThread *iothread) diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index 31b7820b6f..79a43923e8 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -27,7 +27,6 @@ #ifndef HW_ACPI_PCIHP_H #define HW_ACPI_PCIHP_H -#include #include "hw/acpi/acpi.h" #include "migration/vmstate.h" diff --git a/include/qemu/range.h b/include/qemu/range.h index 9fc547b9cb..c903eb574a 100644 --- a/include/qemu/range.h +++ b/include/qemu/range.h @@ -1,7 +1,6 @@ #ifndef QEMU_RANGE_H #define QEMU_RANGE_H -#include #include "qemu/queue.h" /* diff --git a/qga/main.c b/qga/main.c index 0a168e2da8..fb2f6638ba 100644 --- a/qga/main.c +++ b/qga/main.c @@ -24,7 +24,6 @@ #include "qapi/qmp/qjson.h" #include "qga/guest-agent-core.h" #include "qemu/module.h" -#include "signal.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/dispatch.h" #include "qga/channel.h" diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp index b57d5170e8..889052dedd 100644 --- a/qga/vss-win32/requester.cpp +++ b/qga/vss-win32/requester.cpp @@ -13,7 +13,6 @@ #include "qemu/osdep.h" #include "vss-common.h" #include "requester.h" -#include "assert.h" #include "inc/win2003/vswriter.h" #include "inc/win2003/vsbackup.h" diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index e09c8751a9..437cf6c8e3 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -294,11 +294,6 @@ fdef.write(mcgen(''' ''', prefix=prefix)) -# To avoid circular headers, use only typedefs.h here, not qobject.h -fdecl.write(mcgen(''' -#include "qemu/typedefs.h" -''')) - schema = QAPISchema(input_file) gen = QAPISchemaGenTypeVisitor() schema.visit(gen) diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py index a62c310705..e409b7326e 100644 --- a/scripts/tracetool/backend/log.py +++ b/scripts/tracetool/backend/log.py @@ -20,11 +20,7 @@ PUBLIC = True def generate_h_begin(events): - out('#include ', - '#include ', - '#include ', - '#include ', - '#include "trace/control.h"', + out('#include "trace/control.h"', '#include "qemu/log.h"', '') diff --git a/scripts/tracetool/format/events_h.py b/scripts/tracetool/format/events_h.py index bbfaa5bd1f..4529263e00 100644 --- a/scripts/tracetool/format/events_h.py +++ b/scripts/tracetool/format/events_h.py @@ -21,8 +21,6 @@ def generate(events, backend): '', '#ifndef TRACE__GENERATED_EVENTS_H', '#define TRACE__GENERATED_EVENTS_H', - '', - '#include ', '') # event identifiers diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index 2bd68a218e..0835406216 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -23,7 +23,6 @@ def generate(events, backend): '#define TRACE__GENERATED_TRACERS_H', '', '#include "qemu-common.h"', - '#include "qemu/typedefs.h"', '') backend.generate_begin(events) diff --git a/scripts/tracetool/format/tcg_h.py b/scripts/tracetool/format/tcg_h.py index 006eaa897c..e2331f251d 100644 --- a/scripts/tracetool/format/tcg_h.py +++ b/scripts/tracetool/format/tcg_h.py @@ -34,8 +34,6 @@ def generate(events, backend): '#ifndef TRACE__GENERATED_TCG_TRACERS_H', '#define TRACE__GENERATED_TCG_TRACERS_H', '', - '#include ', - '', '#include "trace.h"', '#include "exec/helper-proto.h"', '', diff --git a/scripts/tracetool/format/ust_events_c.py b/scripts/tracetool/format/ust_events_c.py index bf0b334362..9967c7a82e 100644 --- a/scripts/tracetool/format/ust_events_c.py +++ b/scripts/tracetool/format/ust_events_c.py @@ -32,5 +32,4 @@ def generate(events, backend): ' */', '#pragma GCC diagnostic ignored "-Wredundant-decls"', '', - '#include "qemu/typedefs.h"', '#include "generated-ust-provider.h"') diff --git a/stubs/gdbstub.c b/stubs/gdbstub.c index 359c28990a..2b7aee50d3 100644 --- a/stubs/gdbstub.c +++ b/stubs/gdbstub.c @@ -1,6 +1,4 @@ #include "qemu/osdep.h" -#include "stdbool.h" /* bool (in exec/gdbstub.h) */ -#include "stddef.h" /* NULL */ #include "exec/gdbstub.h" /* xml_builtin */ const char *const xml_builtin[][2] = { diff --git a/stubs/target-get-monitor-def.c b/stubs/target-get-monitor-def.c index dd83052745..394e0f9a7d 100644 --- a/stubs/target-get-monitor-def.c +++ b/stubs/target-get-monitor-def.c @@ -20,7 +20,6 @@ */ #include "qemu/osdep.h" -#include "stdint.h" int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval); diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c index 7a16ad7014..ac07b19064 100644 --- a/stubs/target-monitor-defs.c +++ b/stubs/target-monitor-defs.c @@ -1,5 +1,4 @@ #include "qemu/osdep.h" -#include "stddef.h" const MonitorDef *target_monitor_defs(void); diff --git a/tests/tcg/test-i386-fprem.c b/tests/tcg/test-i386-fprem.c index e91fb1ae93..1a71623204 100644 --- a/tests/tcg/test-i386-fprem.c +++ b/tests/tcg/test-i386-fprem.c @@ -22,10 +22,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ -#include "qemu/compiler.h" + #include "qemu/osdep.h" -#include -#include /* * Inspired by 's union ieee854_long_double, but with single From 6f061ea10f28c6cbe3ea588e84ef1f5fd27f0299 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 10 Mar 2016 14:09:58 +0100 Subject: [PATCH 04/28] fw_cfg: Split fw_cfg_keys.h off fw_cfg.h Much of fw_cfg.h's contents is #ifndef NO_QEMU_PROTOS. This lets a few places include it without satisfying the dependencies of the suppressed code. If you somehow include it with NO_QEMU_PROTOS, any future includes are ignored. Unnecessarily unclean. Move the stuff not under NO_QEMU_PROTOS into its own header fw_cfg_keys.h, and include it as appropriate. Tidy up the moved code to please checkpatch. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- include/hw/nvram/fw_cfg.h | 49 +--------------------------------- include/hw/nvram/fw_cfg_keys.h | 46 +++++++++++++++++++++++++++++++ pc-bios/optionrom/optionrom.h | 3 +-- tests/boot-order-test.c | 4 +-- tests/fw_cfg-test.c | 3 +-- tests/libqos/malloc-pc.c | 3 +-- 6 files changed, 51 insertions(+), 57 deletions(-) create mode 100644 include/hw/nvram/fw_cfg_keys.h diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h index 10a99715b2..d5169895dc 100644 --- a/include/hw/nvram/fw_cfg.h +++ b/include/hw/nvram/fw_cfg.h @@ -1,54 +1,9 @@ #ifndef FW_CFG_H #define FW_CFG_H -#ifndef NO_QEMU_PROTOS - #include "exec/hwaddr.h" -#endif +#include "hw/nvram/fw_cfg_keys.h" -#define FW_CFG_SIGNATURE 0x00 -#define FW_CFG_ID 0x01 -#define FW_CFG_UUID 0x02 -#define FW_CFG_RAM_SIZE 0x03 -#define FW_CFG_NOGRAPHIC 0x04 -#define FW_CFG_NB_CPUS 0x05 -#define FW_CFG_MACHINE_ID 0x06 -#define FW_CFG_KERNEL_ADDR 0x07 -#define FW_CFG_KERNEL_SIZE 0x08 -#define FW_CFG_KERNEL_CMDLINE 0x09 -#define FW_CFG_INITRD_ADDR 0x0a -#define FW_CFG_INITRD_SIZE 0x0b -#define FW_CFG_BOOT_DEVICE 0x0c -#define FW_CFG_NUMA 0x0d -#define FW_CFG_BOOT_MENU 0x0e -#define FW_CFG_MAX_CPUS 0x0f -#define FW_CFG_KERNEL_ENTRY 0x10 -#define FW_CFG_KERNEL_DATA 0x11 -#define FW_CFG_INITRD_DATA 0x12 -#define FW_CFG_CMDLINE_ADDR 0x13 -#define FW_CFG_CMDLINE_SIZE 0x14 -#define FW_CFG_CMDLINE_DATA 0x15 -#define FW_CFG_SETUP_ADDR 0x16 -#define FW_CFG_SETUP_SIZE 0x17 -#define FW_CFG_SETUP_DATA 0x18 -#define FW_CFG_FILE_DIR 0x19 - -#define FW_CFG_FILE_FIRST 0x20 -#define FW_CFG_FILE_SLOTS 0x10 -#define FW_CFG_MAX_ENTRY (FW_CFG_FILE_FIRST+FW_CFG_FILE_SLOTS) - -#define FW_CFG_WRITE_CHANNEL 0x4000 -#define FW_CFG_ARCH_LOCAL 0x8000 -#define FW_CFG_ENTRY_MASK ~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL) - -#define FW_CFG_INVALID 0xffff - -/* width in bytes of fw_cfg control register */ -#define FW_CFG_CTL_SIZE 0x02 - -#define FW_CFG_MAX_FILE_PATH 56 - -#ifndef NO_QEMU_PROTOS typedef struct FWCfgFile { uint32_t size; /* file size */ uint16_t select; /* write this to 0x510 to read it */ @@ -220,6 +175,4 @@ FWCfgState *fw_cfg_init_mem_wide(hwaddr ctl_addr, FWCfgState *fw_cfg_find(void); -#endif /* NO_QEMU_PROTOS */ - #endif diff --git a/include/hw/nvram/fw_cfg_keys.h b/include/hw/nvram/fw_cfg_keys.h new file mode 100644 index 0000000000..0f3e871884 --- /dev/null +++ b/include/hw/nvram/fw_cfg_keys.h @@ -0,0 +1,46 @@ +#ifndef FW_CFG_KEYS_H +#define FW_CFG_KEYS_H + +#define FW_CFG_SIGNATURE 0x00 +#define FW_CFG_ID 0x01 +#define FW_CFG_UUID 0x02 +#define FW_CFG_RAM_SIZE 0x03 +#define FW_CFG_NOGRAPHIC 0x04 +#define FW_CFG_NB_CPUS 0x05 +#define FW_CFG_MACHINE_ID 0x06 +#define FW_CFG_KERNEL_ADDR 0x07 +#define FW_CFG_KERNEL_SIZE 0x08 +#define FW_CFG_KERNEL_CMDLINE 0x09 +#define FW_CFG_INITRD_ADDR 0x0a +#define FW_CFG_INITRD_SIZE 0x0b +#define FW_CFG_BOOT_DEVICE 0x0c +#define FW_CFG_NUMA 0x0d +#define FW_CFG_BOOT_MENU 0x0e +#define FW_CFG_MAX_CPUS 0x0f +#define FW_CFG_KERNEL_ENTRY 0x10 +#define FW_CFG_KERNEL_DATA 0x11 +#define FW_CFG_INITRD_DATA 0x12 +#define FW_CFG_CMDLINE_ADDR 0x13 +#define FW_CFG_CMDLINE_SIZE 0x14 +#define FW_CFG_CMDLINE_DATA 0x15 +#define FW_CFG_SETUP_ADDR 0x16 +#define FW_CFG_SETUP_SIZE 0x17 +#define FW_CFG_SETUP_DATA 0x18 +#define FW_CFG_FILE_DIR 0x19 + +#define FW_CFG_FILE_FIRST 0x20 +#define FW_CFG_FILE_SLOTS 0x10 +#define FW_CFG_MAX_ENTRY (FW_CFG_FILE_FIRST + FW_CFG_FILE_SLOTS) + +#define FW_CFG_WRITE_CHANNEL 0x4000 +#define FW_CFG_ARCH_LOCAL 0x8000 +#define FW_CFG_ENTRY_MASK (~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL)) + +#define FW_CFG_INVALID 0xffff + +/* width in bytes of fw_cfg control register */ +#define FW_CFG_CTL_SIZE 0x02 + +#define FW_CFG_MAX_FILE_PATH 56 + +#endif diff --git a/pc-bios/optionrom/optionrom.h b/pc-bios/optionrom/optionrom.h index f1a9021ec1..6c4c2c82f4 100644 --- a/pc-bios/optionrom/optionrom.h +++ b/pc-bios/optionrom/optionrom.h @@ -19,8 +19,7 @@ */ -#define NO_QEMU_PROTOS -#include "../../include/hw/nvram/fw_cfg.h" +#include "../../include/hw/nvram/fw_cfg_keys.h" #define BIOS_CFG_IOPORT_CFG 0x510 #define BIOS_CFG_IOPORT_DATA 0x511 diff --git a/tests/boot-order-test.c b/tests/boot-order-test.c index 210964a00c..a6d8bd5cbf 100644 --- a/tests/boot-order-test.c +++ b/tests/boot-order-test.c @@ -15,9 +15,7 @@ #include "libqos/fw_cfg.h" #include "libqtest.h" -#define NO_QEMU_PROTOS -#include "hw/nvram/fw_cfg.h" -#undef NO_QEMU_PROTOS +#include "hw/nvram/fw_cfg_keys.h" typedef struct { const char *args; diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index 398643aada..b4392c2d38 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -14,8 +14,7 @@ #include #include "libqtest.h" -#define NO_QEMU_PROTOS -#include "hw/nvram/fw_cfg.h" +#include "hw/nvram/fw_cfg_keys.h" #include "libqos/fw_cfg.h" static uint64_t ram_size = 128 << 20; diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c index 74f76c59db..eee706bd63 100644 --- a/tests/libqos/malloc-pc.c +++ b/tests/libqos/malloc-pc.c @@ -14,8 +14,7 @@ #include "libqos/malloc-pc.h" #include "libqos/fw_cfg.h" -#define NO_QEMU_PROTOS -#include "hw/nvram/fw_cfg.h" +#include "hw/nvram/fw_cfg_keys.h" #include "qemu-common.h" #include From daf015ef5ab7b67f4676fcbe74c57b1709f6cb70 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 9 Mar 2016 10:52:44 +0100 Subject: [PATCH 05/28] include/qemu/iov.h: Don't include qemu-common.h qemu-common.h should only be included by .c files. Its file comment explains why: "No header file should depend on qemu-common.h, as this would easily lead to circular header dependencies." qemu/iov.h includes qemu-common.h for QEMUIOVector stuff. Move all that to qemu/iov.h and drop the ill-advised include. Include qemu/iov.h where the QEMUIOVector stuff is now missing. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- block/raw-aio.h | 2 ++ include/block/block.h | 2 +- include/hw/ppc/mac_dbdma.h | 1 + include/hw/usb.h | 1 + include/qemu-common.h | 28 ---------------------------- include/qemu/iov.h | 30 ++++++++++++++++++++++++++++-- include/sysemu/block-backend.h | 2 ++ util/iov.c | 1 + 8 files changed, 36 insertions(+), 31 deletions(-) diff --git a/block/raw-aio.h b/block/raw-aio.h index 31d791fe67..811e375018 100644 --- a/block/raw-aio.h +++ b/block/raw-aio.h @@ -15,6 +15,8 @@ #ifndef QEMU_RAW_AIO_H #define QEMU_RAW_AIO_H +#include "qemu/iov.h" + /* AIO request types */ #define QEMU_AIO_READ 0x0001 #define QEMU_AIO_WRITE 0x0002 diff --git a/include/block/block.h b/include/block/block.h index 01349efad5..47e80bc204 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -2,7 +2,7 @@ #define BLOCK_H #include "block/aio.h" -#include "qemu-common.h" +#include "qemu/iov.h" #include "qemu/option.h" #include "qemu/coroutine.h" #include "block/accounting.h" diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index c6870212e9..0cce4e8bb4 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -23,6 +23,7 @@ #define HW_MAC_DBDMA_H 1 #include "exec/memory.h" +#include "qemu/iov.h" typedef struct DBDMA_io DBDMA_io; diff --git a/include/hw/usb.h b/include/hw/usb.h index c8b6e7b571..163fe0490b 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -26,6 +26,7 @@ */ #include "hw/qdev.h" +#include "qemu/iov.h" #include "qemu/queue.h" /* Constants related to the USB / PCI interaction */ diff --git a/include/qemu-common.h b/include/qemu-common.h index 2de4ce2019..b8fbd9ea62 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -364,34 +364,6 @@ ssize_t qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send); #define qemu_co_send(sockfd, buf, bytes) \ qemu_co_send_recv(sockfd, buf, bytes, true) -typedef struct QEMUIOVector { - struct iovec *iov; - int niov; - int nalloc; - size_t size; -} QEMUIOVector; - -void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint); -void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov); -void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len); -void qemu_iovec_concat(QEMUIOVector *dst, - QEMUIOVector *src, size_t soffset, size_t sbytes); -size_t qemu_iovec_concat_iov(QEMUIOVector *dst, - struct iovec *src_iov, unsigned int src_cnt, - size_t soffset, size_t sbytes); -bool qemu_iovec_is_zero(QEMUIOVector *qiov); -void qemu_iovec_destroy(QEMUIOVector *qiov); -void qemu_iovec_reset(QEMUIOVector *qiov); -size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset, - void *buf, size_t bytes); -size_t qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset, - const void *buf, size_t bytes); -size_t qemu_iovec_memset(QEMUIOVector *qiov, size_t offset, - int fillc, size_t bytes); -ssize_t qemu_iovec_compare(QEMUIOVector *a, QEMUIOVector *b); -void qemu_iovec_clone(QEMUIOVector *dest, const QEMUIOVector *src, void *buf); -void qemu_iovec_discard_back(QEMUIOVector *qiov, size_t bytes); - bool buffer_is_zero(const void *buf, size_t len); void qemu_progress_init(int enabled, float min_skip); diff --git a/include/qemu/iov.h b/include/qemu/iov.h index 28475516eb..bd9fd55b0a 100644 --- a/include/qemu/iov.h +++ b/include/qemu/iov.h @@ -14,8 +14,6 @@ #ifndef IOV_H #define IOV_H -#include "qemu-common.h" - /** * count and return data size, in bytes, of an iovec * starting at `iov' of `iov_cnt' number of elements. @@ -138,4 +136,32 @@ size_t iov_discard_front(struct iovec **iov, unsigned int *iov_cnt, size_t iov_discard_back(struct iovec *iov, unsigned int *iov_cnt, size_t bytes); +typedef struct QEMUIOVector { + struct iovec *iov; + int niov; + int nalloc; + size_t size; +} QEMUIOVector; + +void qemu_iovec_init(QEMUIOVector *qiov, int alloc_hint); +void qemu_iovec_init_external(QEMUIOVector *qiov, struct iovec *iov, int niov); +void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len); +void qemu_iovec_concat(QEMUIOVector *dst, + QEMUIOVector *src, size_t soffset, size_t sbytes); +size_t qemu_iovec_concat_iov(QEMUIOVector *dst, + struct iovec *src_iov, unsigned int src_cnt, + size_t soffset, size_t sbytes); +bool qemu_iovec_is_zero(QEMUIOVector *qiov); +void qemu_iovec_destroy(QEMUIOVector *qiov); +void qemu_iovec_reset(QEMUIOVector *qiov); +size_t qemu_iovec_to_buf(QEMUIOVector *qiov, size_t offset, + void *buf, size_t bytes); +size_t qemu_iovec_from_buf(QEMUIOVector *qiov, size_t offset, + const void *buf, size_t bytes); +size_t qemu_iovec_memset(QEMUIOVector *qiov, size_t offset, + int fillc, size_t bytes); +ssize_t qemu_iovec_compare(QEMUIOVector *a, QEMUIOVector *b); +void qemu_iovec_clone(QEMUIOVector *dest, const QEMUIOVector *src, void *buf); +void qemu_iovec_discard_back(QEMUIOVector *qiov, size_t bytes); + #endif diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 70f4eaf1e7..c62b6fe96d 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -13,6 +13,8 @@ #ifndef BLOCK_BACKEND_H #define BLOCK_BACKEND_H +#include "qemu/iov.h" + /* * TODO Have to include block/block.h for a bunch of block layer * types. Unfortunately, this pulls in the whole BlockDriverState diff --git a/util/iov.c b/util/iov.c index 062f4e50c3..b69e4b7534 100644 --- a/util/iov.c +++ b/util/iov.c @@ -17,6 +17,7 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" #include "qemu/iov.h" #include "qemu/sockets.h" From 0137fdc0941cfe214e91c5c1444f3fcf6a5548b8 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 9 Mar 2016 12:19:37 +0100 Subject: [PATCH 06/28] include/hw/hw.h: Don't include qemu-common.h qemu-common.h should only be included by .c files. Its file comment explains why: "No header file should depend on qemu-common.h, as this would easily lead to circular header dependencies." hw/hw.h includes qemu-common.h, but its users generally need only hw_error() and qemu/module.h from it. Move the former to hw/hw.h, include the latter there, and drop the ill-advised include. hw/misc/cbus.c now misses hw_error(), so include hw/hw.h there. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- hw/misc/cbus.c | 2 +- include/hw/hw.h | 4 +++- include/qemu-common.h | 4 ---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/misc/cbus.c b/hw/misc/cbus.c index fafe0709ec..0c207e3104 100644 --- a/hw/misc/cbus.c +++ b/hw/misc/cbus.c @@ -21,7 +21,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "hw/hw.h" #include "hw/irq.h" #include "hw/devices.h" #include "sysemu/sysemu.h" diff --git a/include/hw/hw.h b/include/hw/hw.h index cd3d410f97..2cb69d5f5b 100644 --- a/include/hw/hw.h +++ b/include/hw/hw.h @@ -2,7 +2,6 @@ #ifndef QEMU_HW_H #define QEMU_HW_H -#include "qemu-common.h" #if !defined(CONFIG_USER_ONLY) && !defined(NEED_CPU_H) #include "exec/cpu-common.h" @@ -13,6 +12,7 @@ #include "block/aio.h" #include "migration/vmstate.h" #include "qemu/log.h" +#include "qemu/module.h" #ifdef NEED_CPU_H #if TARGET_LONG_BITS == 64 @@ -41,6 +41,8 @@ typedef void QEMUResetHandler(void *opaque); void qemu_register_reset(QEMUResetHandler *func, void *opaque); void qemu_unregister_reset(QEMUResetHandler *func, void *opaque); +void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2); + #ifdef NEED_CPU_H #if TARGET_LONG_BITS == 64 #define VMSTATE_UINTTL_V(_f, _s, _v) \ diff --git a/include/qemu-common.h b/include/qemu-common.h index b8fbd9ea62..ba37968503 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -303,10 +303,6 @@ int qemu_openpty_raw(int *aslave, char *pty_name); sendto(sockfd, buf, len, flags, destaddr, addrlen) #endif -/* Error handling. */ - -void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2); - struct ParallelIOArg { void *buffer; int count; From a7c4d9c7ca5178d32236fa5b31fa7fed4e4a7a9c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 9 Mar 2016 13:44:19 +0100 Subject: [PATCH 07/28] hw/pci/pci.h: Don't include qemu-common.h qemu-common.h should only be included by .c files. Its file comment explains why: "No header file should depend on qemu-common.h, as this would easily lead to circular header dependencies." hw/pci/pci.h includes qemu-common.h, but its users only need pcibus_t and PCIHostDeviceAddress from it. Move them to hw/pci/pci.h and drop the ill-advised include. Include hw/pci/pci.h where the moved stuff is now missing. Except we can't in target-i386/kvm_i386.h, because that would break the i386-linux-user compile. Add PCIHostDeviceAddress to qemu/typedefs.h instead. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- hw/core/qdev-properties.c | 1 + include/hw/pci/pci.h | 11 +++++++++-- include/qemu-common.h | 9 --------- include/qemu/typedefs.h | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index eef932cbf1..a8c77ec731 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -2,6 +2,7 @@ #include "net/net.h" #include "hw/qdev.h" #include "qapi/error.h" +#include "hw/pci/pci.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "sysemu/block-backend.h" diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 0be07c8352..ef6ba51f6c 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -1,8 +1,6 @@ #ifndef QEMU_PCI_H #define QEMU_PCI_H -#include "qemu-common.h" - #include "hw/qdev.h" #include "exec/memory.h" #include "sysemu/dma.h" @@ -97,6 +95,15 @@ #define FMT_PCIBUS PRIx64 +typedef uint64_t pcibus_t; + +struct PCIHostDeviceAddress { + unsigned int domain; + unsigned int bus; + unsigned int slot; + unsigned int function; +}; + typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, uint32_t address, uint32_t data, int len); typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev, diff --git a/include/qemu-common.h b/include/qemu-common.h index ba37968503..5a2d9972bd 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -310,15 +310,6 @@ struct ParallelIOArg { typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size); -typedef uint64_t pcibus_t; - -typedef struct PCIHostDeviceAddress { - unsigned int domain; - unsigned int bus; - unsigned int slot; - unsigned int function; -} PCIHostDeviceAddress; - void tcg_exec_init(unsigned long tb_size); bool tcg_enabled(void); diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index c987db6ddf..1dcf6f5d53 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -66,6 +66,7 @@ typedef struct PCIEPort PCIEPort; typedef struct PCIESlot PCIESlot; typedef struct PCIExpressDevice PCIExpressDevice; typedef struct PCIExpressHost PCIExpressHost; +typedef struct PCIHostDeviceAddress PCIHostDeviceAddress; typedef struct PCIHostState PCIHostState; typedef struct PCMachineClass PCMachineClass; typedef struct PCMachineState PCMachineState; From a8139632161d7546218b696cada0a4f64cc78fb7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 11 Mar 2016 13:41:13 +0100 Subject: [PATCH 08/28] Move HOST_LONG_BITS from qemu-common.h to qemu/osdep.h qemu-common.h should only be included by .c files. Its file comment explains why: "No header file should depend on qemu-common.h, as this would easily lead to circular header dependencies." One of the reasons for headers to include it is HOST_LONG_BITS. Move that to its more natural home qemu/osdep.h, to facilitate removing these ill-advised includes later on. This also lets us use HOST_LONG_BITS in bswap.h instead of duplicating its definition there to avoid cyclic inclusion. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 9 --------- include/qemu/bswap.h | 6 ++---- include/qemu/osdep.h | 9 +++++++++ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index 5a2d9972bd..fbd999cbcd 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -23,15 +23,6 @@ #include "qemu/option.h" #include "qemu/host-utils.h" -/* HOST_LONG_BITS is the size of a native pointer in bits. */ -#if UINTPTR_MAX == UINT32_MAX -# define HOST_LONG_BITS 32 -#elif UINTPTR_MAX == UINT64_MAX -# define HOST_LONG_BITS 64 -#else -# error Unknown pointer size -#endif - void cpu_ticks_init(void); /* icount */ diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 95071ba9e8..fcedf0d249 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -419,11 +419,9 @@ static inline void stfq_be_p(void *ptr, float64 v) static inline unsigned long leul_to_cpu(unsigned long v) { - /* In order to break an include loop between here and - qemu-common.h, don't rely on HOST_LONG_BITS. */ -#if ULONG_MAX == UINT32_MAX +#if HOST_LONG_BITS == 32 return le_bswap(v, 32); -#elif ULONG_MAX == UINT64_MAX +#elif HOST_LONG_BITS == 64 return le_bswap(v, 64); #else # error Unknown sizeof long diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 1c0ce4a1c7..64b06e30cd 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -127,6 +127,15 @@ extern int daemon(int, int); #define TIME_MAX LONG_MAX #endif +/* HOST_LONG_BITS is the size of a native pointer in bits. */ +#if UINTPTR_MAX == UINT32_MAX +# define HOST_LONG_BITS 32 +#elif UINTPTR_MAX == UINT64_MAX +# define HOST_LONG_BITS 64 +#else +# error Unknown pointer size +#endif + #ifndef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif From e07e540aaa08718c9ff8213067a3dcef31b3e313 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 11 Mar 2016 16:27:23 +0100 Subject: [PATCH 09/28] Move QEMU_ALIGN_*() from qemu-common.h to qemu/osdep.h qemu-common.h should only be included by .c files. Its file comment explains why: "No header file should depend on qemu-common.h, as this would easily lead to circular header dependencies." One of the reasons for headers to include it is QEMU_ALIGN_UP() and QEMU_ALIGN_DOWN(). Move them next to ROUND_UP() in qemu/osdep.h, to facilitate removing these ill-advised includes later on. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 6 ------ include/qemu/osdep.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index fbd999cbcd..f2727523e0 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -369,12 +369,6 @@ static inline uint8_t from_bcd(uint8_t val) return ((val >> 4) * 10) + (val & 0x0f); } -/* Round number down to multiple */ -#define QEMU_ALIGN_DOWN(n, m) ((n) / (m) * (m)) - -/* Round number up to multiple */ -#define QEMU_ALIGN_UP(n, m) QEMU_ALIGN_DOWN((n) + (m) - 1, (m)) - #include "qemu/module.h" /* diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 64b06e30cd..97a7fa22e8 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -149,6 +149,12 @@ extern int daemon(int, int); #define MIN_NON_ZERO(a, b) (((a) != 0 && (a) < (b)) ? (a) : (b)) #endif +/* Round number down to multiple */ +#define QEMU_ALIGN_DOWN(n, m) ((n) / (m) * (m)) + +/* Round number up to multiple */ +#define QEMU_ALIGN_UP(n, m) QEMU_ALIGN_DOWN((n) + (m) - 1, (m)) + #ifndef ROUND_UP #define ROUND_UP(n,d) (((n) + (d) - 1) & -(d)) #endif From 8a98ecada310b14b4a2c133822674e070a7ba350 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 9 Mar 2016 12:21:49 +0100 Subject: [PATCH 10/28] Move ParallelIOArg from qemu-common.h to sysemu/char.h ParallelIOArg is shared between just qemu-char.c and hw/char/parallel.c, and as such has no business in qemu-common.h. Move it to sysemu/char.h. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- include/qemu-common.h | 5 ----- include/sysemu/char.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/qemu-common.h b/include/qemu-common.h index f2727523e0..e7bd1f852f 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -294,11 +294,6 @@ int qemu_openpty_raw(int *aslave, char *pty_name); sendto(sockfd, buf, len, flags, destaddr, addrlen) #endif -struct ParallelIOArg { - void *buffer; - int count; -}; - typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size); void tcg_exec_init(unsigned long tb_size); diff --git a/include/sysemu/char.h b/include/sysemu/char.h index 4c2f777ad1..307fd8fde4 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -41,6 +41,11 @@ typedef struct { #define CHR_IOCTL_PP_EPP_WRITE 11 #define CHR_IOCTL_PP_DATA_DIR 12 +struct ParallelIOArg { + void *buffer; + int count; +}; + #define CHR_IOCTL_SERIAL_SET_TIOCM 13 #define CHR_IOCTL_SERIAL_GET_TIOCM 14 From bd36a618ccb61ea0fddb92e75f3754c4e1a7fbfe Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 9 Mar 2016 12:55:26 +0100 Subject: [PATCH 11/28] isa: Move DMA_transfer_handler from qemu-common.h to hw/isa/isa.h DMA_transfer_handler is actually an ISA thing, and as such has no business in qemu-common.h. Move it to hw/isa/isa.h, and rename it to IsaDmaTransferHandler. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- hw/dma/i8257.c | 2 +- include/hw/isa/i8257.h | 2 +- include/hw/isa/isa.h | 5 ++++- include/qemu-common.h | 2 -- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index 6078893efb..f345c54762 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -381,7 +381,7 @@ out: } static void i8257_dma_register_channel(IsaDma *obj, int nchan, - DMA_transfer_handler transfer_handler, + IsaDmaTransferHandler transfer_handler, void *opaque) { I8257State *d = I8257(obj); diff --git a/include/hw/isa/i8257.h b/include/hw/isa/i8257.h index 8d34ed17b7..8c44d36282 100644 --- a/include/hw/isa/i8257.h +++ b/include/hw/isa/i8257.h @@ -11,7 +11,7 @@ typedef struct I8257Regs { uint8_t pageh; uint8_t dack; uint8_t eop; - DMA_transfer_handler transfer_handler; + IsaDmaTransferHandler transfer_handler; void *opaque; } I8257Regs; diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 0bbe21cd48..ffb2ea7cdf 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -54,6 +54,9 @@ typedef enum { ISADMA_TRANSFER_ILLEGAL, } IsaDmaTransferMode; +typedef int (*IsaDmaTransferHandler)(void *opaque, int nchan, int pos, + int size); + typedef struct IsaDmaClass { InterfaceClass parent; @@ -65,7 +68,7 @@ typedef struct IsaDmaClass { void (*release_DREQ)(IsaDma *obj, int nchan); void (*schedule)(IsaDma *obj); void (*register_channel)(IsaDma *obj, int nchan, - DMA_transfer_handler transfer_handler, + IsaDmaTransferHandler transfer_handler, void *opaque); } IsaDmaClass; diff --git a/include/qemu-common.h b/include/qemu-common.h index e7bd1f852f..bbb45b2e64 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -294,8 +294,6 @@ int qemu_openpty_raw(int *aslave, char *pty_name); sendto(sockfd, buf, len, flags, destaddr, addrlen) #endif -typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size); - void tcg_exec_init(unsigned long tb_size); bool tcg_enabled(void); From 7136fc1da2690a2a8a6444311484283de0190065 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 11 Mar 2016 09:20:17 +0100 Subject: [PATCH 12/28] include/crypto: Include qapi-types.h or qemu/bswap.h instead of qemu-common.h qemu-common.h should only be included by .c files. Its file comment explains why: "No header file should depend on qemu-common.h, as this would easily lead to circular header dependencies." Several include/crypto/ headers include qemu-common.h, but either need just qapi-types.h from it, or qemu/bswap.h, or nothing at all. Replace or drop the include accordingly. tests/test-crypto-secret.c now misses qemu/module.h, so include it there. Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- crypto/ivgen-essiv.c | 1 + crypto/ivgen-plain.c | 1 + crypto/ivgen-plain64.c | 1 + include/crypto/cipher.h | 2 +- include/crypto/hash.h | 2 +- include/crypto/init.h | 2 -- include/crypto/secret.h | 1 - include/crypto/tlscreds.h | 1 - tests/test-crypto-secret.c | 1 + 9 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crypto/ivgen-essiv.c b/crypto/ivgen-essiv.c index 2fd89def0f..634de63338 100644 --- a/crypto/ivgen-essiv.c +++ b/crypto/ivgen-essiv.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/bswap.h" #include "crypto/ivgen-essiv.h" typedef struct QCryptoIVGenESSIV QCryptoIVGenESSIV; diff --git a/crypto/ivgen-plain.c b/crypto/ivgen-plain.c index a56675d592..9b9b4ad0bf 100644 --- a/crypto/ivgen-plain.c +++ b/crypto/ivgen-plain.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/bswap.h" #include "crypto/ivgen-plain.h" static int qcrypto_ivgen_plain_init(QCryptoIVGen *ivgen, diff --git a/crypto/ivgen-plain64.c b/crypto/ivgen-plain64.c index 94d86730fb..6c6b1b44c3 100644 --- a/crypto/ivgen-plain64.c +++ b/crypto/ivgen-plain64.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/bswap.h" #include "crypto/ivgen-plain.h" static int qcrypto_ivgen_plain_init(QCryptoIVGen *ivgen, diff --git a/include/crypto/cipher.h b/include/crypto/cipher.h index c04c3ac9b9..d770c4835a 100644 --- a/include/crypto/cipher.h +++ b/include/crypto/cipher.h @@ -21,7 +21,7 @@ #ifndef QCRYPTO_CIPHER_H__ #define QCRYPTO_CIPHER_H__ -#include "qemu-common.h" +#include "qapi-types.h" typedef struct QCryptoCipher QCryptoCipher; diff --git a/include/crypto/hash.h b/include/crypto/hash.h index aebccd1386..f38caed669 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -21,7 +21,7 @@ #ifndef QCRYPTO_HASH_H__ #define QCRYPTO_HASH_H__ -#include "qemu-common.h" +#include "qapi-types.h" /* See also "QCryptoHashAlgorithm" defined in qapi/crypto.json */ diff --git a/include/crypto/init.h b/include/crypto/init.h index 4836a37e3f..2513ed0986 100644 --- a/include/crypto/init.h +++ b/include/crypto/init.h @@ -21,8 +21,6 @@ #ifndef QCRYPTO_INIT_H__ #define QCRYPTO_INIT_H__ -#include "qemu-common.h" - int qcrypto_init(Error **errp); #endif /* QCRYPTO_INIT_H__ */ diff --git a/include/crypto/secret.h b/include/crypto/secret.h index 60f2a502b7..b7392c6ba0 100644 --- a/include/crypto/secret.h +++ b/include/crypto/secret.h @@ -21,7 +21,6 @@ #ifndef QCRYPTO_SECRET_H__ #define QCRYPTO_SECRET_H__ -#include "qemu-common.h" #include "qom/object.h" #define TYPE_QCRYPTO_SECRET "secret" diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h index 4bf1d2e255..8e2babd533 100644 --- a/include/crypto/tlscreds.h +++ b/include/crypto/tlscreds.h @@ -21,7 +21,6 @@ #ifndef QCRYPTO_TLSCRED_H__ #define QCRYPTO_TLSCRED_H__ -#include "qemu-common.h" #include "qom/object.h" #ifdef CONFIG_GNUTLS diff --git a/tests/test-crypto-secret.c b/tests/test-crypto-secret.c index 43e295240c..aa26c20499 100644 --- a/tests/test-crypto-secret.c +++ b/tests/test-crypto-secret.c @@ -24,6 +24,7 @@ #include "crypto/init.h" #include "crypto/secret.h" #include "qapi/error.h" +#include "qemu/module.h" static void test_secret_direct(void) { From 4771d756f46219762477aaeaaef9bd215e3d5c60 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 19 Jan 2016 21:51:44 +0100 Subject: [PATCH 13/28] hw: explicitly include qemu-common.h and cpu.h Signed-off-by: Paolo Bonzini --- hw/alpha/dp264.c | 2 ++ hw/alpha/pci.c | 2 ++ hw/arm/allwinner-a10.c | 2 ++ hw/arm/armv7m.c | 2 ++ hw/arm/ast2400.c | 2 ++ hw/arm/bcm2836.c | 2 ++ hw/arm/cubieboard.c | 2 ++ hw/arm/digic_boards.c | 2 ++ hw/arm/exynos4210.c | 2 ++ hw/arm/exynos4_boards.c | 2 ++ hw/arm/fsl-imx25.c | 2 ++ hw/arm/fsl-imx31.c | 2 ++ hw/arm/imx25_pdk.c | 2 ++ hw/arm/integratorcp.c | 2 ++ hw/arm/kzm.c | 2 ++ hw/arm/musicpal.c | 2 ++ hw/arm/omap1.c | 2 ++ hw/arm/omap2.c | 2 ++ hw/arm/palmetto-bmc.c | 2 ++ hw/arm/pxa2xx.c | 2 ++ hw/arm/pxa2xx_pic.c | 2 ++ hw/arm/raspi.c | 2 ++ hw/arm/realview.c | 2 ++ hw/arm/stm32f205_soc.c | 2 ++ hw/arm/strongarm.c | 1 + hw/arm/versatilepb.c | 2 ++ hw/arm/vexpress.c | 2 ++ hw/arm/xilinx_zynq.c | 2 ++ hw/arm/xlnx-ep108.c | 2 ++ hw/arm/xlnx-zynqmp.c | 2 ++ hw/char/spapr_vty.c | 2 ++ hw/cris/axis_dev88.c | 2 ++ hw/cris/boot.c | 2 ++ hw/display/sm501.c | 2 ++ hw/display/tcx.c | 1 + hw/i386/multiboot.c | 2 ++ hw/intc/armv7m_nvic.c | 1 + hw/intc/sh_intc.c | 2 ++ hw/intc/xics.c | 2 ++ hw/intc/xics_kvm.c | 2 ++ hw/isa/lpc_ich9.c | 1 + hw/lm32/lm32_boards.c | 2 ++ hw/lm32/milkymist.c | 2 ++ hw/m68k/an5206.c | 2 ++ hw/m68k/dummy_m68k.c | 2 ++ hw/m68k/mcf5206.c | 2 ++ hw/m68k/mcf5208.c | 2 ++ hw/m68k/mcf_intc.c | 2 ++ hw/microblaze/boot.c | 2 ++ hw/microblaze/petalogix_ml605_mmu.c | 2 ++ hw/microblaze/petalogix_s3adsp1800_mmu.c | 2 ++ hw/mips/mips_malta.c | 2 ++ hw/mips/mips_mipssim.c | 2 ++ hw/mips/mips_r4k.c | 2 ++ hw/moxie/moxiesim.c | 2 ++ hw/net/milkymist-minimac2.c | 2 ++ hw/net/spapr_llan.c | 2 ++ hw/net/xilinx_ethlite.c | 2 ++ hw/nvram/spapr_nvram.c | 2 ++ hw/openrisc/openrisc_sim.c | 2 ++ hw/ppc/mpc8544_guts.c | 2 ++ hw/ppc/ppc.c | 2 ++ hw/ppc/ppc405_boards.c | 2 ++ hw/ppc/ppc405_uc.c | 2 ++ hw/ppc/ppc_booke.c | 2 ++ hw/ppc/spapr_drc.c | 2 ++ hw/ppc/spapr_pci.c | 2 ++ hw/ppc/spapr_pci_vfio.c | 2 ++ hw/ppc/spapr_rng.c | 2 ++ hw/s390x/s390-pci-bus.c | 2 ++ hw/s390x/s390-pci-inst.c | 2 ++ hw/s390x/s390-virtio-ccw.c | 2 ++ hw/scsi/spapr_vscsi.c | 2 ++ hw/sh4/r2d.c | 2 ++ hw/sh4/shix.c | 2 ++ hw/sparc/leon3.c | 2 ++ hw/sparc/sun4m.c | 2 ++ hw/sparc64/sun4u.c | 2 ++ hw/timer/ds1338.c | 1 + hw/timer/mc146818rtc.c | 1 + hw/tricore/tricore_testboard.c | 2 ++ hw/unicore32/puv3.c | 2 ++ hw/virtio/virtio.c | 3 ++- hw/xtensa/sim.c | 2 ++ hw/xtensa/xtfpga.c | 2 ++ 85 files changed, 164 insertions(+), 1 deletion(-) diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 7c5989bdc7..1eee68b748 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -7,6 +7,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "elf.h" #include "hw/loader.h" diff --git a/hw/alpha/pci.c b/hw/alpha/pci.c index fb902bb92d..5baa0eaf15 100644 --- a/hw/alpha/pci.c +++ b/hw/alpha/pci.c @@ -7,6 +7,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "alpha_sys.h" #include "qemu/log.h" #include "sysemu/sysemu.h" diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index b4d3cf6d03..ca15d1c8cc 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -17,6 +17,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/arm/allwinner-a10.h" diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index c68d644588..bb2a22d967 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -9,6 +9,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/loader.h" diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c index 976b651a62..03f993863b 100644 --- a/hw/arm/ast2400.c +++ b/hw/arm/ast2400.c @@ -12,6 +12,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "exec/address-spaces.h" #include "hw/arm/ast2400.h" #include "hw/char/serial.h" diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index d85f051af4..af29dd1f19 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -10,6 +10,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/bcm2836.h" #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index 69fdfc9eeb..fbd78ed01c 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -17,6 +17,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/boards.h" diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c index c4bec429dd..520c8e9ff1 100644 --- a/hw/arm/digic_boards.c +++ b/hw/arm/digic_boards.c @@ -25,6 +25,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/boards.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index e27a18274d..be3c96d21e 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -23,6 +23,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/boards.h" #include "sysemu/sysemu.h" #include "hw/sysbus.h" diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c index 5b11cd9b4d..0efa194054 100644 --- a/hw/arm/exynos4_boards.c +++ b/hw/arm/exynos4_boards.c @@ -22,6 +22,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "sysemu/sysemu.h" #include "sysemu/qtest.h" #include "hw/sysbus.h" diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index f47d471744..2f878b935d 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -24,6 +24,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/fsl-imx25.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h" diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 2164e679f5..31a3a87911 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -21,6 +21,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/fsl-imx31.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h" diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c index facd605bc8..025b60843e 100644 --- a/hw/arm/imx25_pdk.c +++ b/hw/arm/imx25_pdk.c @@ -25,6 +25,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/fsl-imx25.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 5a4540b3b7..e31bca6e72 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -9,6 +9,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/devices.h" #include "hw/boards.h" diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c index 12cbd052bb..2c96ee33b6 100644 --- a/hw/arm/kzm.c +++ b/hw/arm/kzm.c @@ -15,6 +15,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/fsl-imx31.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 28d5af1d9b..7a4cc07dd5 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -11,6 +11,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 387a776c83..99ed43e3be 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -19,6 +19,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/boards.h" #include "hw/hw.h" #include "hw/arm/arm.h" diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 74d45baed8..3a0d77714a 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/boards.h" diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c index 6b3bb77a6d..89ebd92b93 100644 --- a/hw/arm/palmetto-bmc.c +++ b/hw/arm/palmetto-bmc.c @@ -11,6 +11,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "exec/address-spaces.h" #include "hw/arm/arm.h" #include "hw/arm/ast2400.h" diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 24109091bf..2076098b1d 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -9,6 +9,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/arm/pxa.h" #include "sysemu/sysemu.h" diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index 8a39b1caca..7e51532cde 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -9,6 +9,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/arm/pxa.h" #include "hw/sysbus.h" diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index d2b02e6f2b..2b295f14c4 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -10,6 +10,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/bcm2836.h" #include "qemu/error-report.h" #include "hw/boards.h" diff --git a/hw/arm/realview.c b/hw/arm/realview.c index c45441aa34..3222b360e4 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -9,6 +9,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 6ce2fdcea7..a5ea1e2370 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -24,6 +24,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/arm.h" #include "exec/address-spaces.h" #include "hw/arm/stm32f205_soc.h" diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 3b17a2126a..24240995ff 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -28,6 +28,7 @@ */ #include "qemu/osdep.h" +#include "cpu.h" #include "hw/boards.h" #include "hw/sysbus.h" #include "strongarm.h" diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 43f429e951..e5a80c2d2c 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -9,6 +9,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/devices.h" diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 50832993a2..70b3e701e0 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -23,6 +23,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "hw/arm/primecell.h" diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index fa8bbe7100..98b17c9aed 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -17,6 +17,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/arm/arm.h" #include "net/net.h" diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c index 3313ad0ed6..5f480182b2 100644 --- a/hw/arm/xlnx-ep108.c +++ b/hw/arm/xlnx-ep108.c @@ -17,6 +17,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/xlnx-zynqmp.h" #include "hw/boards.h" #include "qemu/error-report.h" diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 0cff6deaba..4d504da643 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -17,6 +17,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/arm/xlnx-zynqmp.h" #include "hw/intc/arm_gic_common.h" #include "exec/address-spaces.h" diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index f3aff5eeea..3498d7b052 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -1,5 +1,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/qdev.h" #include "sysemu/char.h" #include "hw/ppc/spapr.h" diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index 8cfa082acd..9f58658741 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -24,6 +24,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "net/net.h" #include "hw/block/flash.h" diff --git a/hw/cris/boot.c b/hw/cris/boot.c index 42485a4ca0..7d423ed92f 100644 --- a/hw/cris/boot.c +++ b/hw/cris/boot.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/loader.h" #include "elf.h" diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 183e1d2b60..5f71012108 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -24,6 +24,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/char/serial.h" #include "ui/console.h" diff --git a/hw/display/tcx.c b/hw/display/tcx.c index cac9fe3d53..8e26aae801 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "cpu.h" /* FIXME shouldn't use TARGET_PAGE_SIZE */ #include "ui/console.h" #include "ui/pixel_ops.h" #include "hw/loader.h" diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c index 9e164e65d9..387caa67d4 100644 --- a/hw/i386/multiboot.c +++ b/hw/i386/multiboot.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/nvram/fw_cfg.h" #include "multiboot.h" diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 3a23d34054..669e82adfc 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" #include "hw/sysbus.h" #include "qemu/timer.h" #include "hw/arm/arm.h" diff --git a/hw/intc/sh_intc.c b/hw/intc/sh_intc.c index f3cdfaf428..6ce2a8084f 100644 --- a/hw/intc/sh_intc.c +++ b/hw/intc/sh_intc.c @@ -9,6 +9,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sh4/sh_intc.h" #include "hw/hw.h" #include "hw/sh4/sh.h" diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 04a079cd55..8659be0171 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -27,6 +27,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "trace.h" #include "qemu/timer.h" diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 9bd85ac03c..9029d9ee0b 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -27,6 +27,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "trace.h" #include "hw/ppc/spapr.h" diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 0ee29c0ad2..99cd3ba9e1 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -29,6 +29,7 @@ */ #include "qemu/osdep.h" #include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "qapi/visitor.h" #include "qemu/range.h" diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index 5b61b76f2e..c0290560fc 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -18,6 +18,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/block/flash.h" diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index f71492ef7e..22169008be 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -18,6 +18,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/block/flash.h" diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c index c00cc700b7..142bab98c9 100644 --- a/hw/m68k/an5206.c +++ b/hw/m68k/an5206.c @@ -8,6 +8,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/m68k/mcf.h" #include "hw/boards.h" diff --git a/hw/m68k/dummy_m68k.c b/hw/m68k/dummy_m68k.c index 3c2174b505..0b11d2074a 100644 --- a/hw/m68k/dummy_m68k.c +++ b/hw/m68k/dummy_m68k.c @@ -7,6 +7,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/boards.h" #include "hw/loader.h" diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index 7fd3275b05..e14896e529 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -6,6 +6,8 @@ * This code is licensed under the GPL */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/m68k/mcf.h" #include "qemu/timer.h" diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c index 67c3bb6815..24155574f2 100644 --- a/hw/m68k/mcf5208.c +++ b/hw/m68k/mcf5208.c @@ -7,6 +7,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/m68k/mcf.h" #include "qemu/timer.h" diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c index ff95513582..cf581324eb 100644 --- a/hw/m68k/mcf_intc.c +++ b/hw/m68k/mcf_intc.c @@ -6,6 +6,8 @@ * This code is licensed under the GPL */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/m68k/mcf.h" #include "exec/address-spaces.h" diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index c24014a1f3..7a3759d692 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -25,6 +25,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/error-report.h" diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c index 4505d183f2..07527b677b 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -27,6 +27,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "net/net.h" diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c index bf19ad730f..f821e1cfef 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -25,6 +25,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "net/net.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index f5173c42de..4ff1bb2562 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index 23b2dcabf0..a2c2a1646e 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -26,6 +26,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 0ef2fb1655..21aca981c2 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -9,6 +9,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c index 800c7cc935..3069834cf4 100644 --- a/hw/moxie/moxiesim.c +++ b/hw/moxie/moxiesim.c @@ -26,6 +26,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/i386/pc.h" diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c index f01e804272..1e147c33c5 100644 --- a/hw/net/milkymist-minimac2.c +++ b/hw/net/milkymist-minimac2.c @@ -24,6 +24,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" /* FIXME: why does this use TARGET_PAGE_ALIGN? */ #include "hw/hw.h" #include "hw/sysbus.h" #include "trace.h" diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 5237b4d863..6aa06ccc50 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -25,6 +25,8 @@ * */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "net/net.h" #include "hw/qdev.h" diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 71a3224520..bc846e7096 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" /* FIXME should not use tswap* */ #include "hw/sysbus.h" #include "hw/hw.h" #include "net/net.h" diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c index 2ca427b586..802636ef35 100644 --- a/hw/nvram/spapr_nvram.c +++ b/hw/nvram/spapr_nvram.c @@ -24,6 +24,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include #include "sysemu/block-backend.h" diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c index 7967cfbea9..6d06d5be01 100644 --- a/hw/openrisc/openrisc_sim.c +++ b/hw/openrisc/openrisc_sim.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/boards.h" #include "elf.h" diff --git a/hw/ppc/mpc8544_guts.c b/hw/ppc/mpc8544_guts.c index ce399d1815..ba69178d69 100644 --- a/hw/ppc/mpc8544_guts.c +++ b/hw/ppc/mpc8544_guts.c @@ -18,6 +18,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "sysemu/sysemu.h" #include "hw/sysbus.h" diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index ce90b09003..d2167bbc64 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -22,6 +22,8 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "hw/ppc/ppc_e500.h" diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index b430832fb3..4b2f07aecb 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "ppc405.h" diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index 4f9aebc099..6da3204865 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "hw/boards.h" diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index a8d4e76426..b4c81d45e6 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -22,6 +22,8 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/ppc/ppc.h" #include "qemu/timer.h" diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index b94b44a7a1..96d66d658c 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -12,6 +12,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/ppc/spapr_drc.h" #include "qom/object.h" #include "hw/qdev.h" diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 12dbe902fc..8c20d34cdd 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -24,6 +24,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/sysbus.h" #include "hw/pci/pci.h" diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c index 6f9a6731d6..cbd3d23c91 100644 --- a/hw/ppc/spapr_pci_vfio.c +++ b/hw/ppc/spapr_pci_vfio.c @@ -19,6 +19,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/ppc/spapr.h" #include "hw/pci-host/spapr.h" #include "hw/pci/msix.h" diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index f2f89908d4..80515eb54d 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -19,6 +19,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "sysemu/device_tree.h" diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index f5f679f82c..918b58543e 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -12,6 +12,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "s390-pci-bus.h" #include #include diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 506147d670..b28e7d14f8 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -12,6 +12,8 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "s390-pci-inst.h" #include "s390-pci-bus.h" #include diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 01aeec90fe..e3df9c78ba 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -11,6 +11,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/boards.h" #include "exec/address-spaces.h" #include "s390-virtio.h" diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index e4833d5065..b00edf7fd4 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -32,6 +32,8 @@ * - Maybe do autosense (PAPR seems to mandate it, linux doesn't care) */ #include "qemu/osdep.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/scsi/scsi.h" #include "block/scsi.h" diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 90672ac357..db373c70c5 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -25,6 +25,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "hw/hw.h" #include "hw/sh4/sh.h" diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c index 986bd2950e..ccc9e75894 100644 --- a/hw/sh4/shix.c +++ b/hw/sh4/shix.c @@ -29,6 +29,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/sh4/sh.h" #include "sysemu/sysemu.h" diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 9f085ec61d..dbae41f3a4 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "qemu/timer.h" #include "hw/ptimer.h" diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index f251915fbd..30a6afcb9c 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/sysbus.h" #include "qemu/error-report.h" #include "qemu/timer.h" diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index b77e8d2e11..071a80e388 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/pci-host/apb.h" diff --git a/hw/timer/ds1338.c b/hw/timer/ds1338.c index ff315613bd..385b7d3076 100644 --- a/hw/timer/ds1338.c +++ b/hw/timer/ds1338.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qemu-common.h" #include "hw/i2c/i2c.h" /* Size of NVRAM including both the user-accessible area and the diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index eb0100aa25..5e655041bc 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "config-target.h" #include "hw/hw.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index 858040a046..8d3520f5be 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "hw/hw.h" #include "hw/devices.h" #include "net/net.h" diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index d2933cb72a..31cd171016 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -12,6 +12,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "cpu.h" +#include "qemu-common.h" #include "ui/console.h" #include "elf.h" #include "exec/address-spaces.h" diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 8ce19a0979..14d5d91397 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -13,7 +13,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" - +#include "qemu-common.h" +#include "cpu.h" #include "trace.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c index 0967aa6c46..5e94004261 100644 --- a/hw/xtensa/sim.c +++ b/hw/xtensa/sim.c @@ -27,6 +27,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/loader.h" diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 1aff056356..2d117369af 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -27,6 +27,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu-common.h" +#include "cpu.h" #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/loader.h" From 73bcb24d932912f8e75e1d88da0fc0ac6d4bce78 Mon Sep 17 00:00:00 2001 From: Rutuja Shah Date: Mon, 21 Mar 2016 21:32:30 +0530 Subject: [PATCH 14/28] Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND This patch replaces get_ticks_per_sec() calls with the macro NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec() is then removed. This replacement improves the readability and understandability of code. For example, timer_mod(fdctrl->result_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50)); NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns matches the unit of the expression on the right side of the plus. Signed-off-by: Rutuja Shah Signed-off-by: Paolo Bonzini --- audio/audio.c | 3 +-- audio/noaudio.c | 8 ++++---- audio/spiceaudio.c | 4 ++-- audio/wavaudio.c | 2 +- backends/baum.c | 2 +- block/qed.c | 2 +- cpus.c | 6 +++--- hw/acpi/core.c | 4 ++-- hw/arm/omap1.c | 17 +++++++++-------- hw/arm/spitz.c | 2 +- hw/arm/stellaris.c | 2 +- hw/arm/strongarm.c | 2 +- hw/audio/adlib.c | 2 +- hw/audio/sb16.c | 4 ++-- hw/block/fdc.c | 4 ++-- hw/block/pflash_cfi02.c | 8 ++++---- hw/bt/hci-csr.c | 4 ++-- hw/char/cadence_uart.c | 4 ++-- hw/char/serial.c | 10 ++++++---- hw/display/vga.c | 6 +++--- hw/dma/rc4030.c | 2 +- hw/ide/core.c | 4 ++-- hw/input/hid.c | 2 +- hw/input/tsc2005.c | 3 ++- hw/input/tsc210x.c | 3 ++- hw/intc/i8259.c | 2 +- hw/misc/arm_sysctl.c | 3 ++- hw/misc/macio/cuda.c | 16 ++++++++-------- hw/misc/macio/macio.c | 2 +- hw/net/dp8393x.c | 2 +- hw/ppc/ppc.c | 21 ++++++++++++--------- hw/ppc/ppc405_uc.c | 4 ++-- hw/ppc/ppc_booke.c | 2 +- hw/sd/sdhci-internal.h | 2 +- hw/sparc64/sun4u.c | 4 ++-- hw/timer/i8254.c | 4 ++-- hw/timer/i8254_common.c | 6 +++--- hw/timer/mc146818rtc.c | 14 ++++++++------ hw/timer/omap_gptimer.c | 2 +- hw/timer/omap_synctimer.c | 3 ++- hw/timer/pl031.c | 10 +++++----- hw/timer/pxa2xx_timer.c | 18 ++++++++++-------- hw/usb/hcd-ehci.c | 5 +++-- hw/usb/hcd-musb.c | 2 +- hw/usb/hcd-ohci.c | 10 +++++----- hw/usb/hcd-uhci.c | 6 +++--- hw/usb/tusb6010.c | 6 +++--- hw/watchdog/wdt_diag288.c | 2 +- hw/watchdog/wdt_ib700.c | 2 +- include/hw/acpi/acpi.h | 2 +- include/qemu/timer.h | 9 ++------- monitor.c | 4 ++-- target-ppc/kvm.c | 4 ++-- 53 files changed, 143 insertions(+), 134 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index e84153293c..ab0ade87f8 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1869,8 +1869,7 @@ static void audio_init (void) } conf.period.ticks = 1; } else { - conf.period.ticks = - muldiv64 (1, get_ticks_per_sec (), conf.period.hertz); + conf.period.ticks = NANOSECONDS_PER_SECOND / conf.period.hertz; } e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s); diff --git a/audio/noaudio.c b/audio/noaudio.c index 09588b9cd0..b360c199ac 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -49,8 +49,8 @@ static int no_run_out (HWVoiceOut *hw, int live) now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ticks = now - no->old_ticks; - bytes = muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); - bytes = audio_MIN (bytes, INT_MAX); + bytes = muldiv64(ticks, hw->info.bytes_per_second, NANOSECONDS_PER_SECOND); + bytes = audio_MIN(bytes, INT_MAX); samples = bytes >> hw->info.shift; no->old_ticks = now; @@ -61,7 +61,7 @@ static int no_run_out (HWVoiceOut *hw, int live) static int no_write (SWVoiceOut *sw, void *buf, int len) { - return audio_pcm_sw_write (sw, buf, len); + return audio_pcm_sw_write(sw, buf, len); } static int no_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque) @@ -106,7 +106,7 @@ static int no_run_in (HWVoiceIn *hw) int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); int64_t ticks = now - no->old_ticks; int64_t bytes = - muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); + muldiv64(ticks, hw->info.bytes_per_second, NANOSECONDS_PER_SECOND); no->old_ticks = now; bytes = audio_MIN (bytes, INT_MAX); diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index 297fd416ed..dea71d37af 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -104,11 +104,11 @@ static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate) now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ticks = now - rate->start_ticks; - bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ()); + bytes = muldiv64(ticks, info->bytes_per_second, NANOSECONDS_PER_SECOND); samples = (bytes - rate->bytes_sent) >> info->shift; if (samples < 0 || samples > 65536) { error_report("Resetting rate control (%" PRId64 " samples)", samples); - rate_start (rate); + rate_start(rate); samples = 0; } rate->bytes_sent += samples << info->shift; diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 343b1a10b9..345952e51e 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -51,7 +51,7 @@ static int wav_run_out (HWVoiceOut *hw, int live) int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); int64_t ticks = now - wav->old_ticks; int64_t bytes = - muldiv64 (ticks, hw->info.bytes_per_second, get_ticks_per_sec ()); + muldiv64(ticks, hw->info.bytes_per_second, NANOSECONDS_PER_SECOND); if (bytes > INT_MAX) { samples = INT_MAX >> hw->info.shift; diff --git a/backends/baum.c b/backends/baum.c index f95f7be8a5..c537141b22 100644 --- a/backends/baum.c +++ b/backends/baum.c @@ -337,7 +337,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len) /* Allow 100ms to complete the DisplayData packet */ timer_mod(baum->cellCount_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec() / 10); + NANOSECONDS_PER_SECOND / 10); for (i = 0; i < baum->x * baum->y ; i++) { EAT(c); cells[i] = c; diff --git a/block/qed.c b/block/qed.c index 20f05fe2b9..c1cc625d55 100644 --- a/block/qed.c +++ b/block/qed.c @@ -347,7 +347,7 @@ static void qed_start_need_check_timer(BDRVQEDState *s) * migration. */ timer_mod(s->need_check_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec() * QED_NEED_CHECK_TIMEOUT); + NANOSECONDS_PER_SECOND * QED_NEED_CHECK_TIMEOUT); } /* It's okay to call this multiple times or when no timer is started */ diff --git a/cpus.c b/cpus.c index 23cf7aad76..8ae477728d 100644 --- a/cpus.c +++ b/cpus.c @@ -276,7 +276,7 @@ void cpu_disable_ticks(void) fairly approximate, so ignore small variation. When the guest is idle real and virtual time will be aligned in the IO wait loop. */ -#define ICOUNT_WOBBLE (get_ticks_per_sec() / 10) +#define ICOUNT_WOBBLE (NANOSECONDS_PER_SECOND / 10) static void icount_adjust(void) { @@ -327,7 +327,7 @@ static void icount_adjust_vm(void *opaque) { timer_mod(icount_vm_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec() / 10); + NANOSECONDS_PER_SECOND / 10); icount_adjust(); } @@ -674,7 +674,7 @@ void configure_icount(QemuOpts *opts, Error **errp) icount_adjust_vm, NULL); timer_mod(icount_vm_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec() / 10); + NANOSECONDS_PER_SECOND / 10); } /***********************************************************/ diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 31ead6490f..7925a1a45b 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -389,7 +389,7 @@ uint16_t acpi_pm1_evt_get_sts(ACPIREGS *ar) acpi_pm_tmr_update function uses ns for setting the timer. */ int64_t d = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); if (d >= muldiv64(ar->tmr.overflow_time, - get_ticks_per_sec(), PM_TIMER_FREQUENCY)) { + NANOSECONDS_PER_SECOND, PM_TIMER_FREQUENCY)) { ar->pm1.evt.sts |= ACPI_BITMASK_TIMER_STATUS; } return ar->pm1.evt.sts; @@ -483,7 +483,7 @@ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable) /* schedule a timer interruption if needed */ if (enable) { - expire_time = muldiv64(ar->tmr.overflow_time, get_ticks_per_sec(), + expire_time = muldiv64(ar->tmr.overflow_time, NANOSECONDS_PER_SECOND, PM_TIMER_FREQUENCY); timer_mod(ar->tmr.timer, expire_time); } else { diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 99ed43e3be..56844c3030 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -110,7 +110,7 @@ static inline uint32_t omap_timer_read(struct omap_mpu_timer_s *timer) if (timer->st && timer->enable && timer->rate) return timer->val - muldiv64(distance >> (timer->ptv + 1), - timer->rate, get_ticks_per_sec()); + timer->rate, NANOSECONDS_PER_SECOND); else return timer->val; } @@ -128,7 +128,7 @@ static inline void omap_timer_update(struct omap_mpu_timer_s *timer) if (timer->enable && timer->st && timer->rate) { timer->val = timer->reset_val; /* Should skip this on clk enable */ expires = muldiv64((uint64_t) timer->val << (timer->ptv + 1), - get_ticks_per_sec(), timer->rate); + NANOSECONDS_PER_SECOND, timer->rate); /* If timer expiry would be sooner than in about 1 ms and * auto-reload isn't set, then fire immediately. This is a hack @@ -136,10 +136,11 @@ static inline void omap_timer_update(struct omap_mpu_timer_s *timer) * sets the interval to a very low value and polls the status bit * in a busy loop when it wants to sleep just a couple of CPU * ticks. */ - if (expires > (get_ticks_per_sec() >> 10) || timer->ar) + if (expires > (NANOSECONDS_PER_SECOND >> 10) || timer->ar) { timer_mod(timer->timer, timer->time + expires); - else + } else { qemu_bh_schedule(timer->tick); + } } else timer_del(timer->timer); } @@ -616,14 +617,14 @@ static void omap_ulpd_pm_write(void *opaque, hwaddr addr, now -= s->ulpd_gauge_start; /* 32-kHz ticks */ - ticks = muldiv64(now, 32768, get_ticks_per_sec()); + ticks = muldiv64(now, 32768, NANOSECONDS_PER_SECOND); s->ulpd_pm_regs[0x00 >> 2] = (ticks >> 0) & 0xffff; s->ulpd_pm_regs[0x04 >> 2] = (ticks >> 16) & 0xffff; if (ticks >> 32) /* OVERFLOW_32K */ s->ulpd_pm_regs[0x14 >> 2] |= 1 << 2; /* High frequency ticks */ - ticks = muldiv64(now, 12000000, get_ticks_per_sec()); + ticks = muldiv64(now, 12000000, NANOSECONDS_PER_SECOND); s->ulpd_pm_regs[0x08 >> 2] = (ticks >> 0) & 0xffff; s->ulpd_pm_regs[0x0c >> 2] = (ticks >> 16) & 0xffff; if (ticks >> 32) /* OVERFLOW_HI_FREQ */ @@ -3029,7 +3030,7 @@ static void omap_mcbsp_source_tick(void *opaque) omap_mcbsp_rx_newdata(s); timer_mod(s->source_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec()); + NANOSECONDS_PER_SECOND); } static void omap_mcbsp_rx_start(struct omap_mcbsp_s *s) @@ -3075,7 +3076,7 @@ static void omap_mcbsp_sink_tick(void *opaque) omap_mcbsp_tx_newdata(s); timer_mod(s->sink_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec()); + NANOSECONDS_PER_SECOND); } static void omap_mcbsp_tx_start(struct omap_mcbsp_s *s) diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 50949d06af..bf61d63b58 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -405,7 +405,7 @@ static void spitz_keyboard_tick(void *opaque) } timer_mod(s->kbdtimer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec() / 32); + NANOSECONDS_PER_SECOND / 32); } static void spitz_keyboard_pre_map(SpitzKeyboardState *s) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 3caeb0679b..c1766f856a 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -101,7 +101,7 @@ static void gptm_reload(gptm_state *s, int n, int reset) tick += (int64_t)count * system_clock_scale; } else if (s->config == 1) { /* 32-bit RTC. 1Hz tick. */ - tick += get_ticks_per_sec(); + tick += NANOSECONDS_PER_SECOND; } else if (s->mode[n] == 0xa) { /* PWM mode. Not implemented. */ } else { diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 24240995ff..80041280e2 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -1025,7 +1025,7 @@ static void strongarm_uart_update_parameters(StrongARMUARTState *s) ssp.parity = parity; ssp.data_bits = data_bits; ssp.stop_bits = stop_bits; - s->char_transmit_time = (get_ticks_per_sec() / speed) * frame_size; + s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size; if (s->chr) { qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); } diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 355a2595d4..7836446fc8 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -170,7 +170,7 @@ static void timer_handler (int c, double interval_Sec) s->ticking[n] = 1; #ifdef DEBUG - interval = get_ticks_per_sec () * interval_Sec; + interval = NANOSECONDS_PER_SECOND * interval_Sec; exp = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + interval; s->exp[n] = exp; #endif diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 6f8816cf64..3a4a57ac31 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -762,8 +762,8 @@ static void complete (SB16State *s) freq = s->freq > 0 ? s->freq : 11025; samples = dsp_get_lohi (s) + 1; bytes = samples << s->fmt_stereo << (s->fmt_bits == 16); - ticks = muldiv64 (bytes, get_ticks_per_sec (), freq); - if (ticks < get_ticks_per_sec () / 1024) { + ticks = muldiv64(bytes, NANOSECONDS_PER_SECOND, freq); + if (ticks < NANOSECONDS_PER_SECOND / 1024) { qemu_irq_raise (s->pic); } else { diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 72dc1484b1..372227569e 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -1939,8 +1939,8 @@ static void fdctrl_handle_readid(FDCtrl *fdctrl, int direction) FDrive *cur_drv = get_cur_drv(fdctrl); cur_drv->head = (fdctrl->fifo[1] >> 2) & 1; - timer_mod(fdctrl->result_timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50)); + timer_mod(fdctrl->result_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + (NANOSECONDS_PER_SECOND / 50)); } static void fdctrl_handle_format_track(FDCtrl *fdctrl, int direction) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index eadc61b7df..b13172c6e1 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -432,8 +432,8 @@ static void pflash_write (pflash_t *pfl, hwaddr offset, } pfl->status = 0x00; /* Let's wait 5 seconds before chip erase is done */ - timer_mod(pfl->timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() * 5)); + timer_mod(pfl->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + (NANOSECONDS_PER_SECOND * 5)); break; case 0x30: /* Sector erase */ @@ -447,8 +447,8 @@ static void pflash_write (pflash_t *pfl, hwaddr offset, } pfl->status = 0x00; /* Let's wait 1/2 second before sector erase is done */ - timer_mod(pfl->timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 2)); + timer_mod(pfl->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + (NANOSECONDS_PER_SECOND / 2)); break; default: DPRINTF("%s: invalid command %02x (wc 5)\n", __func__, cmd); diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c index 0189b0ae28..2e970b6561 100644 --- a/hw/bt/hci-csr.c +++ b/hw/bt/hci-csr.c @@ -363,7 +363,7 @@ static int csrhci_ioctl(struct CharDriverState *chr, int cmd, void *arg) switch (cmd) { case CHR_IOCTL_SERIAL_SET_PARAMS: ssp = (QEMUSerialSetParams *) arg; - s->baud_delay = get_ticks_per_sec() / ssp->speed; + s->baud_delay = NANOSECONDS_PER_SECOND / ssp->speed; /* Moments later... (but shorter than 100ms) */ s->modem_state |= CHR_TIOCM_CTS; break; @@ -389,7 +389,7 @@ static void csrhci_reset(struct csrhci_s *s) s->out_len = 0; s->out_size = FIFO_LEN; s->in_len = 0; - s->baud_delay = get_ticks_per_sec(); + s->baud_delay = NANOSECONDS_PER_SECOND; s->enable = 0; s->in_hdr = INT_MAX; s->in_data = INT_MAX; diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index b590d990d4..486591bf07 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -205,7 +205,7 @@ static void uart_parameters_setup(CadenceUARTState *s) } packet_size += ssp.data_bits + ssp.stop_bits; - s->char_tx_time = (get_ticks_per_sec() / ssp.speed) * packet_size; + s->char_tx_time = (NANOSECONDS_PER_SECOND / ssp.speed) * packet_size; if (s->chr) { qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); } @@ -479,7 +479,7 @@ static void cadence_uart_init(Object *obj) sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq); - s->char_tx_time = (get_ticks_per_sec() / 9600) * 10; + s->char_tx_time = (NANOSECONDS_PER_SECOND / 9600) * 10; } static int cadence_uart_post_load(void *opaque, int version_id) diff --git a/hw/char/serial.c b/hw/char/serial.c index 6f89f2c9e6..6d815b5c69 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -179,7 +179,7 @@ static void serial_update_parameters(SerialState *s) ssp.parity = parity; ssp.data_bits = data_bits; ssp.stop_bits = stop_bits; - s->char_transmit_time = (get_ticks_per_sec() / speed) * frame_size; + s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size; qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); DPRINTF("speed=%d parity=%c data=%d stop=%d\n", @@ -217,8 +217,10 @@ static void serial_update_msl(SerialState *s) /* The real 16550A apparently has a 250ns response latency to line status changes. We'll be lazy and poll only every 10ms, and only poll it at all if MSI interrupts are turned on */ - if (s->poll_msl) - timer_mod(s->modem_status_poll, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + get_ticks_per_sec() / 100); + if (s->poll_msl) { + timer_mod(s->modem_status_poll, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + NANOSECONDS_PER_SECOND / 100); + } } static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque) @@ -824,7 +826,7 @@ static void serial_reset(void *opaque) s->mcr = UART_MCR_OUT2; s->scr = 0; s->tsr_retry = 0; - s->char_transmit_time = (get_ticks_per_sec() / 9600) * 10; + s->char_transmit_time = (NANOSECONDS_PER_SECOND / 9600) * 10; s->poll_msl = 0; s->timeout_ipending = 0; diff --git a/hw/display/vga.c b/hw/display/vga.c index 25dc978b95..657e9f196d 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -236,9 +236,9 @@ static void vga_precise_update_retrace_info(VGACommonState *s) r->total_chars = vtotal_lines * htotal_chars; if (r->freq) { - r->ticks_per_char = get_ticks_per_sec() / (r->total_chars * r->freq); + r->ticks_per_char = NANOSECONDS_PER_SECOND / (r->total_chars * r->freq); } else { - r->ticks_per_char = get_ticks_per_sec() / chars_per_sec; + r->ticks_per_char = NANOSECONDS_PER_SECOND / chars_per_sec; } r->vstart = vretr_start_line; @@ -266,7 +266,7 @@ static void vga_precise_update_retrace_info(VGACommonState *s) "dots = %d\n" "ticks/char = %" PRId64 "\n" "\n", - (double) get_ticks_per_sec() / (r->ticks_per_char * r->total_chars), + (double) NANOSECONDS_PER_SECOND / (r->ticks_per_char * r->total_chars), htotal_chars, hretr_start_char, hretr_skew_chars, diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index 1c4f8df16b..a06c2359a7 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -112,7 +112,7 @@ static void set_next_tick(rc4030State *s) tm_hz = 1000 / (s->itr + 1); timer_mod(s->periodic_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec() / tm_hz); + NANOSECONDS_PER_SECOND / tm_hz); } /* called for accesses to rc4030 */ diff --git a/hw/ide/core.c b/hw/ide/core.c index 241e840de0..f8883b2110 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -975,8 +975,8 @@ static void ide_sector_write_cb(void *opaque, int ret) that at the expense of slower write performances. Use this option _only_ to install Windows 2000. You must disable it for normal use. */ - timer_mod(s->sector_write_timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 1000)); + timer_mod(s->sector_write_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + (NANOSECONDS_PER_SECOND / 1000)); } else { ide_set_irq(s->bus); } diff --git a/hw/input/hid.c b/hw/input/hid.c index 59126776f5..d92c7463ba 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -96,7 +96,7 @@ void hid_set_next_idle(HIDState *hs) { if (hs->idle) { uint64_t expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - get_ticks_per_sec() * hs->idle * 4 / 1000; + NANOSECONDS_PER_SECOND * hs->idle * 4 / 1000; if (!hs->idle_timer) { hs->idle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, hid_idle_timer, hs); } diff --git a/hw/input/tsc2005.c b/hw/input/tsc2005.c index 8da48876c1..9b359aaec0 100644 --- a/hw/input/tsc2005.c +++ b/hw/input/tsc2005.c @@ -291,7 +291,8 @@ static void tsc2005_pin_update(TSC2005State *s) s->precision = s->nextprecision; s->function = s->nextfunction; s->pdst = !s->pnd0; /* Synchronised on internal clock */ - expires = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() >> 7); + expires = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + (NANOSECONDS_PER_SECOND >> 7); timer_mod(s->timer, expires); } diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index d11ef048a1..93ca374fcd 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -835,7 +835,8 @@ static void tsc210x_pin_update(TSC210xState *s) s->busy = 1; s->precision = s->nextprecision; s->function = s->nextfunction; - expires = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() >> 10); + expires = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + (NANOSECONDS_PER_SECOND >> 10); timer_mod(s->timer, expires); } diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index 6f3a86350c..bb43669b93 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -230,7 +230,7 @@ int pic_read_irq(DeviceState *d) printf("IRQ%d latency=%0.3fus\n", irq, (double)(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - - irq_time[irq]) * 1000000.0 / get_ticks_per_sec()); + irq_time[irq]) * 1000000.0 / NANOSECONDS_PER_SECOND); #endif DPRINTF("pic_interrupt: irq=%d\n", irq); return intno; diff --git a/hw/misc/arm_sysctl.c b/hw/misc/arm_sysctl.c index 339205b5c3..34d90d5230 100644 --- a/hw/misc/arm_sysctl.c +++ b/hw/misc/arm_sysctl.c @@ -171,7 +171,8 @@ static uint64_t arm_sysctl_read(void *opaque, hwaddr offset, case 0x58: /* BOOTCS */ return 0; case 0x5c: /* 24MHz */ - return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24000000, get_ticks_per_sec()); + return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24000000, + NANOSECONDS_PER_SECOND); case 0x60: /* MISC */ return 0; case 0x84: /* PROCID0 */ diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index 481abdb754..83995ccf0f 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -145,7 +145,7 @@ static void cuda_update_irq(CUDAState *s) static uint64_t get_tb(uint64_t time, uint64_t freq) { - return muldiv64(time, freq, get_ticks_per_sec()); + return muldiv64(time, freq, NANOSECONDS_PER_SECOND); } static unsigned int get_counter(CUDATimer *ti) @@ -189,7 +189,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time) /* current counter value */ d = muldiv64(current_time - s->load_time, - CUDA_TIMER_FREQ, get_ticks_per_sec()); + CUDA_TIMER_FREQ, NANOSECONDS_PER_SECOND); /* the timer goes down from latch to -1 (period of latch + 2) */ if (d <= (s->counter_value + 1)) { counter = (s->counter_value - d) & 0xffff; @@ -208,7 +208,7 @@ static int64_t get_next_irq_time(CUDATimer *s, int64_t current_time) } CUDA_DPRINTF("latch=%d counter=%" PRId64 " delta_next=%" PRId64 "\n", s->latch, d, next_time - d); - next_time = muldiv64(next_time, get_ticks_per_sec(), CUDA_TIMER_FREQ) + + next_time = muldiv64(next_time, NANOSECONDS_PER_SECOND, CUDA_TIMER_FREQ) + s->load_time; if (next_time <= current_time) next_time = current_time + 1; @@ -531,7 +531,7 @@ static void cuda_adb_poll(void *opaque) } timer_mod(s->adb_poll_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - (get_ticks_per_sec() / (1000 / s->autopoll_rate_ms))); + (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms))); } /* description of commands */ @@ -559,7 +559,7 @@ static bool cuda_cmd_autopoll(CUDAState *s, if (autopoll) { timer_mod(s->adb_poll_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - (get_ticks_per_sec() / (1000 / s->autopoll_rate_ms))); + (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms))); } else { timer_del(s->adb_poll_timer); } @@ -585,7 +585,7 @@ static bool cuda_cmd_set_autorate(CUDAState *s, if (s->autopoll) { timer_mod(s->adb_poll_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - (get_ticks_per_sec() / (1000 / s->autopoll_rate_ms))); + (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms))); } return true; } @@ -665,7 +665,7 @@ static bool cuda_cmd_get_time(CUDAState *s, } ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - / get_ticks_per_sec()); + / NANOSECONDS_PER_SECOND); out_data[0] = ti >> 24; out_data[1] = ti >> 16; out_data[2] = ti >> 8; @@ -687,7 +687,7 @@ static bool cuda_cmd_set_time(CUDAState *s, ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16) + (((uint32_t)in_data[3]) << 8) + in_data[4]; s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - / get_ticks_per_sec()); + / NANOSECONDS_PER_SECOND); return true; } diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 6e94e3b7cf..be03926b96 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -254,7 +254,7 @@ static uint64_t timer_read(void *opaque, hwaddr addr, unsigned size) uint64_t systime = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); uint64_t kltime; - kltime = muldiv64(systime, 4194300, get_ticks_per_sec() * 4); + kltime = muldiv64(systime, 4194300, NANOSECONDS_PER_SECOND * 4); kltime = muldiv64(kltime, 18432000, 1048575); switch (addr) { diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 819743e117..0fa652c392 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -294,7 +294,7 @@ static void dp8393x_set_next_tick(dp8393xState *s) ticks = s->regs[SONIC_WT1] << 16 | s->regs[SONIC_WT0]; s->wt_last_update = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - delay = get_ticks_per_sec() * ticks / 5000000; + delay = NANOSECONDS_PER_SECOND * ticks / 5000000; timer_mod(s->watchdog, s->wt_last_update + delay); } diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index d2167bbc64..38ff2e1596 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -465,7 +465,7 @@ void ppce500_set_mpic_proxy(bool enabled) uint64_t cpu_ppc_get_tb(ppc_tb_t *tb_env, uint64_t vmclk, int64_t tb_offset) { /* TB time in tb periods */ - return muldiv64(vmclk, tb_env->tb_freq, get_ticks_per_sec()) + tb_offset; + return muldiv64(vmclk, tb_env->tb_freq, NANOSECONDS_PER_SECOND) + tb_offset; } uint64_t cpu_ppc_load_tbl (CPUPPCState *env) @@ -506,7 +506,9 @@ uint32_t cpu_ppc_load_tbu (CPUPPCState *env) static inline void cpu_ppc_store_tb(ppc_tb_t *tb_env, uint64_t vmclk, int64_t *tb_offsetp, uint64_t value) { - *tb_offsetp = value - muldiv64(vmclk, tb_env->tb_freq, get_ticks_per_sec()); + *tb_offsetp = value - + muldiv64(vmclk, tb_env->tb_freq, NANOSECONDS_PER_SECOND); + LOG_TB("%s: tb %016" PRIx64 " offset %08" PRIx64 "\n", __func__, value, *tb_offsetp); } @@ -640,11 +642,11 @@ static inline uint32_t _cpu_ppc_load_decr(CPUPPCState *env, uint64_t next) diff = next - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); if (diff >= 0) { - decr = muldiv64(diff, tb_env->decr_freq, get_ticks_per_sec()); + decr = muldiv64(diff, tb_env->decr_freq, NANOSECONDS_PER_SECOND); } else if (tb_env->flags & PPC_TIMER_BOOKE) { decr = 0; } else { - decr = -muldiv64(-diff, tb_env->decr_freq, get_ticks_per_sec()); + decr = -muldiv64(-diff, tb_env->decr_freq, NANOSECONDS_PER_SECOND); } LOG_TB("%s: %08" PRIx32 "\n", __func__, decr); @@ -676,7 +678,8 @@ uint64_t cpu_ppc_load_purr (CPUPPCState *env) diff = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - tb_env->purr_start; - return tb_env->purr_load + muldiv64(diff, tb_env->tb_freq, get_ticks_per_sec()); + return tb_env->purr_load + + muldiv64(diff, tb_env->tb_freq, NANOSECONDS_PER_SECOND); } /* When decrementer expires, @@ -752,7 +755,7 @@ static void __cpu_ppc_store_decr(PowerPCCPU *cpu, uint64_t *nextp, /* Calculate the next timer event */ now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - next = now + muldiv64(value, get_ticks_per_sec(), tb_env->decr_freq); + next = now + muldiv64(value, NANOSECONDS_PER_SECOND, tb_env->decr_freq); *nextp = next; /* Adjust timer */ @@ -1013,7 +1016,7 @@ static void cpu_4xx_fit_cb (void *opaque) /* Cannot occur, but makes gcc happy */ return; } - next = now + muldiv64(next, get_ticks_per_sec(), tb_env->tb_freq); + next = now + muldiv64(next, NANOSECONDS_PER_SECOND, tb_env->tb_freq); if (next == now) next++; timer_mod(ppc40x_timer->fit_timer, next); @@ -1044,7 +1047,7 @@ static void start_stop_pit (CPUPPCState *env, ppc_tb_t *tb_env, int is_excp) __func__, ppc40x_timer->pit_reload); now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); next = now + muldiv64(ppc40x_timer->pit_reload, - get_ticks_per_sec(), tb_env->decr_freq); + NANOSECONDS_PER_SECOND, tb_env->decr_freq); if (is_excp) next += tb_env->decr_next - now; if (next == now) @@ -1109,7 +1112,7 @@ static void cpu_4xx_wdt_cb (void *opaque) /* Cannot occur, but makes gcc happy */ return; } - next = now + muldiv64(next, get_ticks_per_sec(), tb_env->decr_freq); + next = now + muldiv64(next, NANOSECONDS_PER_SECOND, tb_env->decr_freq); if (next == now) next++; LOG_TB("%s: TCR " TARGET_FMT_lx " TSR " TARGET_FMT_lx "\n", __func__, diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index 6da3204865..d6d3fc2c4a 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -1356,7 +1356,7 @@ static uint32_t ppc4xx_gpt_readl (void *opaque, hwaddr addr) case 0x00: /* Time base counter */ ret = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + gpt->tb_offset, - gpt->tb_freq, get_ticks_per_sec()); + gpt->tb_freq, NANOSECONDS_PER_SECOND); break; case 0x10: /* Output enable */ @@ -1411,7 +1411,7 @@ static void ppc4xx_gpt_writel (void *opaque, switch (addr) { case 0x00: /* Time base counter */ - gpt->tb_offset = muldiv64(value, get_ticks_per_sec(), gpt->tb_freq) + gpt->tb_offset = muldiv64(value, NANOSECONDS_PER_SECOND, gpt->tb_freq) - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); ppc4xx_gpt_compute_timer(gpt); break; diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c index b4c81d45e6..ab8d026c32 100644 --- a/hw/ppc/ppc_booke.c +++ b/hw/ppc/ppc_booke.c @@ -165,7 +165,7 @@ static void booke_update_fixed_timer(CPUPPCState *env, ticks += delta_tick; } - *next = now + muldiv64(ticks, get_ticks_per_sec(), tb_env->tb_freq); + *next = now + muldiv64(ticks, NANOSECONDS_PER_SECOND, tb_env->tb_freq); if ((*next < now) || (*next > INT64_MAX)) { /* Overflow, so assume the biggest number the qemu timer supports. */ *next = INT64_MAX; diff --git a/hw/sd/sdhci-internal.h b/hw/sd/sdhci-internal.h index c712daf4ee..161177cf39 100644 --- a/hw/sd/sdhci-internal.h +++ b/hw/sd/sdhci-internal.h @@ -216,7 +216,7 @@ #define SD_HOST_SPECv2_VERS 0x2401 #define SDHC_REGISTERS_MAP_SIZE 0x100 -#define SDHC_INSERTION_DELAY (get_ticks_per_sec()) +#define SDHC_INSERTION_DELAY (NANOSECONDS_PER_SECOND) #define SDHC_TRANSFER_DELAY 100 #define SDHC_ADMA_DESCS_PER_DELAY 5 #define SDHC_CMD_RESPONSE (3 << 0) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 071a80e388..ee602805c0 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -448,12 +448,12 @@ static void hstick_irq(void *opaque) static int64_t cpu_to_timer_ticks(int64_t cpu_ticks, uint32_t frequency) { - return muldiv64(cpu_ticks, get_ticks_per_sec(), frequency); + return muldiv64(cpu_ticks, NANOSECONDS_PER_SECOND, frequency); } static uint64_t timer_to_cpu_ticks(int64_t timer_ticks, uint32_t frequency) { - return muldiv64(timer_ticks, frequency, get_ticks_per_sec()); + return muldiv64(timer_ticks, frequency, NANOSECONDS_PER_SECOND); } void cpu_tick_set_count(CPUTimer *timer, uint64_t count) diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c index b84a33f874..5e61ad50a8 100644 --- a/hw/timer/i8254.c +++ b/hw/timer/i8254.c @@ -53,7 +53,7 @@ static int pit_get_count(PITChannelState *s) int counter; d = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - s->count_load_time, PIT_FREQ, - get_ticks_per_sec()); + NANOSECONDS_PER_SECOND); switch(s->mode) { case 0: case 1: @@ -263,7 +263,7 @@ static void pit_irq_timer_update(PITChannelState *s, int64_t current_time) #ifdef DEBUG_PIT printf("irq_level=%d next_delay=%f\n", irq_level, - (double)(expire_time - current_time) / get_ticks_per_sec()); + (double)(expire_time - current_time) / NANOSECONDS_PER_SECOND); #endif s->next_transition_time = expire_time; if (expire_time != -1) diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c index ed511b885b..e18299a482 100644 --- a/hw/timer/i8254_common.c +++ b/hw/timer/i8254_common.c @@ -47,7 +47,7 @@ int pit_get_out(PITChannelState *s, int64_t current_time) int out; d = muldiv64(current_time - s->count_load_time, PIT_FREQ, - get_ticks_per_sec()); + NANOSECONDS_PER_SECOND); switch (s->mode) { default: case 0: @@ -81,7 +81,7 @@ int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time) int period2; d = muldiv64(current_time - s->count_load_time, PIT_FREQ, - get_ticks_per_sec()); + NANOSECONDS_PER_SECOND); switch (s->mode) { default: case 0: @@ -121,7 +121,7 @@ int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time) break; } /* convert to timer units */ - next_time = s->count_load_time + muldiv64(next_time, get_ticks_per_sec(), + next_time = s->count_load_time + muldiv64(next_time, NANOSECONDS_PER_SECOND, PIT_FREQ); /* fix potential rounding problems */ /* XXX: better solution: use a clock at PIT_FREQ Hz */ diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 5e655041bc..496a7cd815 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -107,8 +107,8 @@ static uint64_t get_guest_rtc_ns(RTCState *s) uint64_t guest_rtc; uint64_t guest_clock = qemu_clock_get_ns(rtc_clock); - guest_rtc = s->base_rtc * NANOSECONDS_PER_SECOND - + guest_clock - s->last_update + s->offset; + guest_rtc = s->base_rtc * NANOSECONDS_PER_SECOND + + guest_clock - s->last_update + s->offset; return guest_rtc; } @@ -121,7 +121,7 @@ static void rtc_coalesced_timer_update(RTCState *s) /* divide each RTC interval to 2 - 8 smaller intervals */ int c = MIN(s->irq_coalesced, 7) + 1; int64_t next_clock = qemu_clock_get_ns(rtc_clock) + - muldiv64(s->period / c, get_ticks_per_sec(), RTC_CLOCK_RATE); + muldiv64(s->period / c, NANOSECONDS_PER_SECOND, RTC_CLOCK_RATE); timer_mod(s->coalesced_timer, next_clock); } } @@ -167,10 +167,12 @@ static void periodic_timer_update(RTCState *s, int64_t current_time) s->period = period; #endif /* compute 32 khz clock */ - cur_clock = muldiv64(current_time, RTC_CLOCK_RATE, get_ticks_per_sec()); + cur_clock = + muldiv64(current_time, RTC_CLOCK_RATE, NANOSECONDS_PER_SECOND); + next_irq_clock = (cur_clock & ~(period - 1)) + period; - s->next_periodic_time = - muldiv64(next_irq_clock, get_ticks_per_sec(), RTC_CLOCK_RATE) + 1; + s->next_periodic_time = muldiv64(next_irq_clock, NANOSECONDS_PER_SECOND, + RTC_CLOCK_RATE) + 1; timer_mod(s->periodic_timer, s->next_periodic_time); } else { #ifdef TARGET_I386 diff --git a/hw/timer/omap_gptimer.c b/hw/timer/omap_gptimer.c index b30342129a..3a43863042 100644 --- a/hw/timer/omap_gptimer.c +++ b/hw/timer/omap_gptimer.c @@ -402,7 +402,7 @@ static void omap_gp_timer_write(void *opaque, hwaddr addr, if (s->trigger == gpt_trigger_none) omap_gp_timer_out(s, s->scpwm); /* TODO: make sure this doesn't overflow 32-bits */ - s->ticks_per_sec = get_ticks_per_sec() << (s->pre ? s->ptv + 1 : 0); + s->ticks_per_sec = NANOSECONDS_PER_SECOND << (s->pre ? s->ptv + 1 : 0); omap_gp_timer_update(s); break; diff --git a/hw/timer/omap_synctimer.c b/hw/timer/omap_synctimer.c index edd8d98d57..9ee6519793 100644 --- a/hw/timer/omap_synctimer.c +++ b/hw/timer/omap_synctimer.c @@ -29,7 +29,8 @@ struct omap_synctimer_s { /* 32-kHz Sync Timer of the OMAP2 */ static uint32_t omap_synctimer_read(struct omap_synctimer_s *s) { - return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 0x8000, get_ticks_per_sec()); + return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 0x8000, + NANOSECONDS_PER_SECOND); } void omap_synctimer_reset(struct omap_synctimer_s *s) diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c index 3ccb2cb460..bdec4785bb 100644 --- a/hw/timer/pl031.c +++ b/hw/timer/pl031.c @@ -80,7 +80,7 @@ static void pl031_interrupt(void * opaque) static uint32_t pl031_get_count(PL031State *s) { int64_t now = qemu_clock_get_ns(rtc_clock); - return s->tick_offset + now / get_ticks_per_sec(); + return s->tick_offset + now / NANOSECONDS_PER_SECOND; } static void pl031_set_alarm(PL031State *s) @@ -96,7 +96,7 @@ static void pl031_set_alarm(PL031State *s) pl031_interrupt(s); } else { int64_t now = qemu_clock_get_ns(rtc_clock); - timer_mod(s->timer, now + (int64_t)ticks * get_ticks_per_sec()); + timer_mod(s->timer, now + (int64_t)ticks * NANOSECONDS_PER_SECOND); } } @@ -204,7 +204,7 @@ static void pl031_init(Object *obj) sysbus_init_irq(dev, &s->irq); qemu_get_timedate(&tm, 0); s->tick_offset = mktimegm(&tm) - - qemu_clock_get_ns(rtc_clock) / get_ticks_per_sec(); + qemu_clock_get_ns(rtc_clock) / NANOSECONDS_PER_SECOND; s->timer = timer_new_ns(rtc_clock, pl031_interrupt, s); } @@ -216,7 +216,7 @@ static void pl031_pre_save(void *opaque) /* tick_offset is base_time - rtc_clock base time. Instead, we want to * store the base time relative to the QEMU_CLOCK_VIRTUAL for backwards-compatibility. */ int64_t delta = qemu_clock_get_ns(rtc_clock) - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - s->tick_offset_vmstate = s->tick_offset + delta / get_ticks_per_sec(); + s->tick_offset_vmstate = s->tick_offset + delta / NANOSECONDS_PER_SECOND; } static int pl031_post_load(void *opaque, int version_id) @@ -224,7 +224,7 @@ static int pl031_post_load(void *opaque, int version_id) PL031State *s = opaque; int64_t delta = qemu_clock_get_ns(rtc_clock) - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - s->tick_offset = s->tick_offset_vmstate - delta / get_ticks_per_sec(); + s->tick_offset = s->tick_offset_vmstate - delta / NANOSECONDS_PER_SECOND; pl031_set_alarm(s); return 0; } diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c index 33449e66b5..59002b407e 100644 --- a/hw/timer/pxa2xx_timer.c +++ b/hw/timer/pxa2xx_timer.c @@ -119,11 +119,11 @@ static void pxa2xx_timer_update(void *opaque, uint64_t now_qemu) uint64_t new_qemu; now_vm = s->clock + - muldiv64(now_qemu - s->lastload, s->freq, get_ticks_per_sec()); + muldiv64(now_qemu - s->lastload, s->freq, NANOSECONDS_PER_SECOND); for (i = 0; i < 4; i ++) { new_qemu = now_qemu + muldiv64((uint32_t) (s->timer[i].value - now_vm), - get_ticks_per_sec(), s->freq); + NANOSECONDS_PER_SECOND, s->freq); timer_mod(s->timer[i].qtimer, new_qemu); } } @@ -148,10 +148,10 @@ static void pxa2xx_timer_update4(void *opaque, uint64_t now_qemu, int n) now_vm = s->tm4[counter].clock + muldiv64(now_qemu - s->tm4[counter].lastload, - s->tm4[counter].freq, get_ticks_per_sec()); + s->tm4[counter].freq, NANOSECONDS_PER_SECOND); new_qemu = now_qemu + muldiv64((uint32_t) (s->tm4[n].tm.value - now_vm), - get_ticks_per_sec(), s->tm4[counter].freq); + NANOSECONDS_PER_SECOND, s->tm4[counter].freq); timer_mod(s->tm4[n].tm.qtimer, new_qemu); } @@ -190,7 +190,7 @@ static uint64_t pxa2xx_timer_read(void *opaque, hwaddr offset, return s->tm4[tm].tm.value; case OSCR: return s->clock + muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - - s->lastload, s->freq, get_ticks_per_sec()); + s->lastload, s->freq, NANOSECONDS_PER_SECOND); case OSCR11: tm ++; /* fall through */ case OSCR10: tm ++; @@ -214,15 +214,17 @@ static uint64_t pxa2xx_timer_read(void *opaque, hwaddr offset, s->snapshot = s->tm4[tm - 1].clock + muldiv64( qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - s->tm4[tm - 1].lastload, - s->tm4[tm - 1].freq, get_ticks_per_sec()); + s->tm4[tm - 1].freq, NANOSECONDS_PER_SECOND); else s->snapshot = s->tm4[tm - 1].clock; } if (!s->tm4[tm].freq) return s->tm4[tm].clock; - return s->tm4[tm].clock + muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - - s->tm4[tm].lastload, s->tm4[tm].freq, get_ticks_per_sec()); + return s->tm4[tm].clock + + muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - + s->tm4[tm].lastload, s->tm4[tm].freq, + NANOSECONDS_PER_SECOND); case OIER: return s->irq_enabled; case OSSR: /* Status register */ diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index f598937099..4f3af8f43c 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2304,10 +2304,11 @@ static void ehci_frame_timer(void *opaque) /* If we've raised int, we speed up the timer, so that we quickly * notice any new packets queued up in response */ if (ehci->int_req_by_async && (ehci->usbsts & USBSTS_INT)) { - expire_time = t_now + get_ticks_per_sec() / (FRAME_TIMER_FREQ * 4); + expire_time = t_now + + NANOSECONDS_PER_SECOND / (FRAME_TIMER_FREQ * 4); ehci->int_req_by_async = false; } else { - expire_time = t_now + (get_ticks_per_sec() + expire_time = t_now + (NANOSECONDS_PER_SECOND * (ehci->async_stepdown+1) / FRAME_TIMER_FREQ); } timer_mod(ehci->frame_timer, expire_time); diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c index cd2319735f..27d9d0bd82 100644 --- a/hw/usb/hcd-musb.c +++ b/hw/usb/hcd-musb.c @@ -564,7 +564,7 @@ static void musb_schedule_cb(USBPort *port, USBPacket *packey) ep->intv_timer[dir] = timer_new_ns(QEMU_CLOCK_VIRTUAL, musb_cb_tick, ep); timer_mod(ep->intv_timer[dir], qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - muldiv64(timeout, get_ticks_per_sec(), 8000)); + muldiv64(timeout, NANOSECONDS_PER_SECOND, 8000)); } static int musb_timeout(int ttype, int speed, int val) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index f3dc26bcca..ffab561cf6 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1850,12 +1850,12 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP - usb_frame_time = get_ticks_per_sec(); - usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); + usb_frame_time = NANOSECONDS_PER_SECOND; + usb_bit_time = NANOSECONDS_PER_SECOND / (USB_HZ / 1000); #else - usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); - if (get_ticks_per_sec() >= USB_HZ) { - usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); + usb_frame_time = NANOSECONDS_PER_SECOND / 1000; + if (NANOSECONDS_PER_SECOND >= USB_HZ) { + usb_bit_time = NANOSECONDS_PER_SECOND / USB_HZ; } else { usb_bit_time = 1; } diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 6521418681..18057bfb6e 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -403,7 +403,7 @@ static int uhci_post_load(void *opaque, int version_id) if (version_id < 2) { s->expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - (get_ticks_per_sec() / FRAME_TIMER_FREQ); + (NANOSECONDS_PER_SECOND / FRAME_TIMER_FREQ); } return 0; } @@ -445,7 +445,7 @@ static void uhci_port_write(void *opaque, hwaddr addr, /* start frame processing */ trace_usb_uhci_schedule_start(); s->expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - (get_ticks_per_sec() / FRAME_TIMER_FREQ); + (NANOSECONDS_PER_SECOND / FRAME_TIMER_FREQ); timer_mod(s->frame_timer, s->expire_time); s->status &= ~UHCI_STS_HCHALTED; } else if (!(val & UHCI_CMD_RS)) { @@ -1131,7 +1131,7 @@ static void uhci_frame_timer(void *opaque) UHCIState *s = opaque; uint64_t t_now, t_last_run; int i, frames; - const uint64_t frame_t = get_ticks_per_sec() / FRAME_TIMER_FREQ; + const uint64_t frame_t = NANOSECONDS_PER_SECOND / FRAME_TIMER_FREQ; s->completions_only = false; qemu_bh_cancel(s->bh); diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c index 9f6af90806..8f593a6fdb 100644 --- a/hw/usb/tusb6010.c +++ b/hw/usb/tusb6010.c @@ -516,7 +516,7 @@ static void tusb_async_writew(void *opaque, hwaddr addr, if (value & TUSB_DEV_OTG_TIMER_ENABLE) timer_mod(s->otg_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + muldiv64(TUSB_DEV_OTG_TIMER_VAL(value), - get_ticks_per_sec(), TUSB_DEVCLOCK)); + NANOSECONDS_PER_SECOND, TUSB_DEVCLOCK)); else timer_del(s->otg_timer); break; @@ -726,8 +726,8 @@ static void tusb6010_power(TUSBState *s, int on) /* Pull the interrupt down after TUSB6010 comes up. */ s->intr_ok = 0; tusb_intr_update(s); - timer_mod(s->pwr_timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + get_ticks_per_sec() / 2); + timer_mod(s->pwr_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + NANOSECONDS_PER_SECOND / 2); } } diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c index 1c3658e4a8..f54a35a0e3 100644 --- a/hw/watchdog/wdt_diag288.c +++ b/hw/watchdog/wdt_diag288.c @@ -79,7 +79,7 @@ static int wdt_diag288_handle_timer(DIAG288State *diag288, } timer_mod(diag288->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - timeout * get_ticks_per_sec()); + timeout * NANOSECONDS_PER_SECOND); break; case WDT_DIAG288_CANCEL: if (!diag288->enabled) { diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c index 532530b95b..532afe89e7 100644 --- a/hw/watchdog/wdt_ib700.c +++ b/hw/watchdog/wdt_ib700.c @@ -64,7 +64,7 @@ static void ib700_write_enable_reg(void *vp, uint32_t addr, uint32_t data) ib700_debug("addr = %x, data = %x\n", addr, data); - timeout = (int64_t) time_map[data & 0xF] * get_ticks_per_sec(); + timeout = (int64_t) time_map[data & 0xF] * NANOSECONDS_PER_SECOND; timer_mod(s->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + timeout); } diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index 443687d484..e0978c8b92 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -154,7 +154,7 @@ void acpi_pm_tmr_reset(ACPIREGS *ar); static inline int64_t acpi_pm_tmr_get_clock(void) { return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), PM_TIMER_FREQUENCY, - get_ticks_per_sec()); + NANOSECONDS_PER_SECOND); } /* PM1a_EVT: piix and ich9 don't implement PM1b. */ diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 028e309b7b..471969a24d 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -783,18 +783,13 @@ void cpu_enable_ticks(void); /* Caller must hold BQL */ void cpu_disable_ticks(void); -static inline int64_t get_ticks_per_sec(void) -{ - return 1000000000LL; -} - static inline int64_t get_max_clock_jump(void) { /* This should be small enough to prevent excessive interrupts from being * generated by the RTC on clock jumps, but large enough to avoid frequent * unnecessary resets in idle VMs. */ - return 60 * get_ticks_per_sec(); + return 60 * NANOSECONDS_PER_SECOND; } /* @@ -820,7 +815,7 @@ static inline int64_t get_clock(void) { LARGE_INTEGER ti; QueryPerformanceCounter(&ti); - return muldiv64(ti.QuadPart, get_ticks_per_sec(), clock_freq); + return muldiv64(ti.QuadPart, NANOSECONDS_PER_SECOND, clock_freq); } #else diff --git a/monitor.c b/monitor.c index 4c02f0f18f..3533602c23 100644 --- a/monitor.c +++ b/monitor.c @@ -1523,9 +1523,9 @@ int64_t dev_time; static void hmp_info_profile(Monitor *mon, const QDict *qdict) { monitor_printf(mon, "async time %" PRId64 " (%0.3f)\n", - dev_time, dev_time / (double)get_ticks_per_sec()); + dev_time, dev_time / (double)NANOSECONDS_PER_SECOND); monitor_printf(mon, "qemu time %" PRId64 " (%0.3f)\n", - tcg_time, tcg_time / (double)get_ticks_per_sec()); + tcg_time, tcg_time / (double)NANOSECONDS_PER_SECOND); tcg_time = 0; dev_time = 0; } diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 776336b8b4..40ec6fded2 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -1371,7 +1371,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run) /* Always wake up soon in case the interrupt was level based */ timer_mod(idle_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - (get_ticks_per_sec() / 50)); + (NANOSECONDS_PER_SECOND / 50)); } /* We don't know if there are more interrupts pending after this. However, @@ -1831,7 +1831,7 @@ uint32_t kvmppc_get_tbfreq(void) { char line[512]; char *ns; - uint32_t retval = get_ticks_per_sec(); + uint32_t retval = NANOSECONDS_PER_SECOND; if (read_cpuinfo("timebase", line, sizeof(line))) { return retval; From f348b6d1a53e5271cf1c9f9acc4646b4b98c1771 Mon Sep 17 00:00:00 2001 From: Veronia Bahaa Date: Sun, 20 Mar 2016 19:16:19 +0200 Subject: [PATCH 15/28] util: move declarations out of qemu-common.h Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h) Signed-off-by: Veronia Bahaa Signed-off-by: Paolo Bonzini --- arch_init.c | 1 + audio/audio.c | 1 + block.c | 3 +- block/archipelago.c | 2 +- block/backup.c | 1 + block/blkdebug.c | 2 +- block/blkverify.c | 1 + block/block-backend.c | 1 + block/curl.c | 1 + block/io.c | 1 + block/nbd.c | 2 +- block/qapi.c | 1 + block/qcow2-snapshot.c | 2 +- block/qcow2.c | 2 +- block/qed.h | 1 + block/raw-posix.c | 2 +- block/raw-win32.c | 2 +- block/rbd.c | 2 +- block/sheepdog.c | 2 +- block/vdi.c | 2 +- block/vmdk.c | 2 +- block/vvfat.c | 2 +- blockdev.c | 2 + bsd-user/elfload.c | 1 + bsd-user/main.c | 3 +- contrib/ivshmem-server/main.c | 2 +- disas/i386.c | 2 + dump.c | 2 +- exec.c | 2 +- gdbstub.c | 4 +- hmp.c | 1 + hw/9pfs/9p-handle.c | 1 + hw/9pfs/9p-local.c | 1 + hw/9pfs/9p-proxy.c | 1 + hw/9pfs/9p-synth.c | 1 + hw/alpha/dp264.c | 1 + hw/arm/nseries.c | 2 +- hw/arm/omap1.c | 2 + hw/arm/pxa2xx.c | 1 + hw/arm/strongarm.c | 1 + hw/block/nvme.h | 1 + hw/bt/hci.c | 1 + hw/core/loader.c | 1 + hw/core/machine.c | 1 + hw/cris/boot.c | 1 + hw/ide/core.c | 1 + hw/lm32/lm32_hwsetup.h | 1 + hw/lm32/milkymist.c | 1 + hw/microblaze/boot.c | 1 + hw/mips/mips_jazz.c | 1 + hw/misc/ivshmem.c | 1 + hw/misc/macio/cuda.c | 1 + hw/nvram/fw_cfg.c | 1 + hw/nvram/mac_nvram.c | 1 + hw/pci/pci.c | 1 + hw/ppc/mac_newworld.c | 1 + hw/ppc/mac_oldworld.c | 1 + hw/ppc/prep.c | 1 + hw/ppc/spapr.c | 2 +- hw/ppc/spapr_drc.c | 2 +- hw/ppc/spapr_events.c | 3 +- hw/ppc/spapr_rtas.c | 1 + hw/ppc/spapr_rtc.c | 1 + hw/scsi/scsi-bus.c | 1 + hw/scsi/scsi-disk.c | 2 +- hw/scsi/vhost-scsi.c | 1 + hw/sparc/sun4m.c | 1 + hw/sparc64/sun4u.c | 1 + hw/timer/ds1338.c | 1 + hw/timer/exynos4210_rtc.c | 1 + hw/timer/m48t59.c | 1 + hw/timer/mc146818rtc.c | 2 + hw/timer/pl031.c | 1 + hw/timer/twl92230.c | 1 + hw/usb/bus.c | 1 + hw/usb/dev-network.c | 1 + hw/usb/dev-serial.c | 1 + hw/usb/dev-storage.c | 1 + hw/watchdog/watchdog.c | 2 +- hw/xen/xen-host-pci-device.c | 1 + include/qemu-common.h | 257 ---------------------------------- include/qemu/bcd.h | 15 ++ include/qemu/cutils.h | 183 ++++++++++++++++++++++++ include/qemu/help_option.h | 22 +++ include/qemu/id.h | 13 ++ include/qemu/path.h | 7 + include/qemu/unicode.h | 6 + linux-user/elfload.c | 1 + linux-user/main.c | 4 +- linux-user/syscall.c | 2 + linux-user/uaccess.c | 1 + main-loop.c | 2 +- migration/block.c | 1 + migration/migration.c | 2 +- migration/ram.c | 1 + migration/rdma.c | 1 + migration/savevm.c | 3 +- migration/xbzrle.c | 2 +- monitor.c | 1 + net/net.c | 2 + net/netmap.c | 1 + net/slirp.c | 1 + net/tap-bsd.c | 2 +- net/tap-linux.c | 2 +- net/tap-solaris.c | 1 + net/tap.c | 1 + os-posix.c | 1 + qapi/opts-visitor.c | 2 +- qdev-monitor.c | 1 + qemu-char.c | 1 + qemu-img.c | 2 +- qemu-io-cmds.c | 1 + qemu-nbd.c | 1 + qga/commands-posix.c | 1 + qga/commands.c | 1 + qga/main.c | 1 + qmp.c | 2 +- qobject/json-parser.c | 1 - qobject/qdict.c | 1 + qobject/qjson.c | 1 + qom/object.c | 2 +- slirp/slirp.c | 1 + slirp/tftp.c | 1 + target-arm/arm-semi.c | 1 + target-i386/cpu.c | 1 + target-ppc/kvm.c | 1 + target-s390x/cpu.c | 1 + tcg/tcg.c | 2 +- tests/qom-test.c | 1 + tests/tcg/linux-test.c | 1 + tests/test-cutils.c | 3 +- tests/test-xbzrle.c | 1 + trace/control.c | 1 + ui/gtk.c | 1 + ui/sdl.c | 1 + ui/vnc.c | 1 + util/cutils.c | 33 +++++ util/event_notifier-posix.c | 1 + util/id.c | 1 + util/iov.c | 1 + util/osdep.c | 1 + util/oslib-posix.c | 1 + util/oslib-win32.c | 1 + util/path.c | 2 + util/qemu-option.c | 3 + util/qemu-sockets.c | 1 + util/readline.c | 1 + util/unicode.c | 2 +- vl.c | 3 +- 149 files changed, 435 insertions(+), 300 deletions(-) create mode 100644 include/qemu/bcd.h create mode 100644 include/qemu/cutils.h create mode 100644 include/qemu/help_option.h create mode 100644 include/qemu/id.h create mode 100644 include/qemu/path.h create mode 100644 include/qemu/unicode.h diff --git a/arch_init.c b/arch_init.c index f6aba02cb2..e3bb1b3ac4 100644 --- a/arch_init.c +++ b/arch_init.c @@ -31,6 +31,7 @@ #include "qemu/error-report.h" #include "qmp-commands.h" #include "hw/acpi/acpi.h" +#include "qemu/help_option.h" #ifdef TARGET_SPARC int graphic_width = 1024; diff --git a/audio/audio.c b/audio/audio.c index ab0ade87f8..e60c124de8 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -27,6 +27,7 @@ #include "monitor/monitor.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" +#include "qemu/cutils.h" #define AUDIO_CAP "audio" #include "audio_int.h" diff --git a/block.c b/block.c index b4107fcd4c..2a09403649 100644 --- a/block.c +++ b/block.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "trace.h" #include "block/block_int.h" #include "block/blockjob.h" @@ -40,6 +39,8 @@ #include "qemu/timer.h" #include "qapi-event.h" #include "block/throttle-groups.h" +#include "qemu/cutils.h" +#include "qemu/id.h" #ifdef CONFIG_BSD #include diff --git a/block/archipelago.c b/block/archipelago.c index 0507589063..b9f5e69d4a 100644 --- a/block/archipelago.c +++ b/block/archipelago.c @@ -51,7 +51,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "block/block_int.h" #include "qemu/error-report.h" #include "qemu/thread.h" diff --git a/block/backup.c b/block/backup.c index 77280c6b35..9170983ba9 100644 --- a/block/backup.c +++ b/block/backup.c @@ -20,6 +20,7 @@ #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" +#include "qemu/cutils.h" #include "sysemu/block-backend.h" #include "qemu/bitmap.h" diff --git a/block/blkdebug.c b/block/blkdebug.c index 792d36b994..20d25bda67 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -24,7 +24,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/config-file.h" #include "block/block_int.h" #include "qemu/module.h" diff --git a/block/blkverify.c b/block/blkverify.c index 41432e5565..9414b7a84e 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -13,6 +13,7 @@ #include "block/block_int.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" +#include "qemu/cutils.h" typedef struct { BdrvChild *test_file; diff --git a/block/block-backend.c b/block/block-backend.c index dca21d1eeb..adf592e867 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -18,6 +18,7 @@ #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" #include "qapi-event.h" +#include "qemu/id.h" /* Number of coroutines to reserve per attached device model */ #define COROUTINE_POOL_RESERVATION 64 diff --git a/block/curl.c b/block/curl.c index fe331ca1f5..5a8f8b6239 100644 --- a/block/curl.c +++ b/block/curl.c @@ -30,6 +30,7 @@ #include "qapi/qmp/qstring.h" #include "crypto/secret.h" #include +#include "qemu/cutils.h" // #define DEBUG_CURL // #define DEBUG_VERBOSE diff --git a/block/io.c b/block/io.c index 041af3c711..c2611e53c8 100644 --- a/block/io.c +++ b/block/io.c @@ -28,6 +28,7 @@ #include "block/blockjob.h" #include "block/block_int.h" #include "block/throttle-groups.h" +#include "qemu/cutils.h" #include "qapi/error.h" #include "qemu/error-report.h" diff --git a/block/nbd.c b/block/nbd.c index d103894120..896064a131 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -36,7 +36,7 @@ #include "qapi/qmp/qjson.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qstring.h" - +#include "qemu/cutils.h" #define EN_OPTSTR ":exportname=" diff --git a/block/qapi.c b/block/qapi.c index 6a4869a8d9..089614ee9d 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -32,6 +32,7 @@ #include "qapi/qmp-output-visitor.h" #include "qapi/qmp/types.h" #include "sysemu/block-backend.h" +#include "qemu/cutils.h" BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs, Error **errp) { diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 269acc2f4e..5f4a17e473 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -24,10 +24,10 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "block/block_int.h" #include "block/qcow2.h" #include "qemu/error-report.h" +#include "qemu/cutils.h" void qcow2_free_snapshots(BlockDriverState *bs) { diff --git a/block/qcow2.c b/block/qcow2.c index cec5bd02f2..642802971c 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" #include "qemu/module.h" @@ -36,6 +35,7 @@ #include "qapi-event.h" #include "trace.h" #include "qemu/option_int.h" +#include "qemu/cutils.h" /* Differences with QCOW: diff --git a/block/qed.h b/block/qed.h index 615e676fc8..22b3198751 100644 --- a/block/qed.h +++ b/block/qed.h @@ -16,6 +16,7 @@ #define BLOCK_QED_H #include "block/block_int.h" +#include "qemu/cutils.h" /* The layout of a QED file is as follows: * diff --git a/block/raw-posix.c b/block/raw-posix.c index 29dc658e43..c8e2ec40fb 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -23,7 +23,7 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/timer.h" #include "qemu/log.h" diff --git a/block/raw-win32.c b/block/raw-win32.c index bd07c93461..fd23891534 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -23,7 +23,7 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/timer.h" #include "block/block_int.h" #include "qemu/module.h" diff --git a/block/rbd.c b/block/rbd.c index 4f3fa304d5..5bc5b32530 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -14,10 +14,10 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "block/block_int.h" #include "crypto/secret.h" +#include "qemu/cutils.h" #include diff --git a/block/sheepdog.c b/block/sheepdog.c index a6b179b11d..48fc165422 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -14,13 +14,13 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/uri.h" #include "qemu/error-report.h" #include "qemu/sockets.h" #include "block/block_int.h" #include "sysemu/block-backend.h" #include "qemu/bitops.h" +#include "qemu/cutils.h" #define SD_PROTO_VER 0x01 diff --git a/block/vdi.c b/block/vdi.c index cdf6b85216..71f417c461 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -51,12 +51,12 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" #include "qemu/module.h" #include "migration/migration.h" #include "qemu/coroutine.h" +#include "qemu/cutils.h" #if defined(CONFIG_UUID) #include diff --git a/block/vmdk.c b/block/vmdk.c index 5e341c678b..a1a9371bf8 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -25,13 +25,13 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "block/block_int.h" #include "sysemu/block-backend.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/module.h" #include "migration/migration.h" +#include "qemu/cutils.h" #include #include diff --git a/block/vvfat.c b/block/vvfat.c index bdce8da320..eb1126cbad 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -25,13 +25,13 @@ #include "qemu/osdep.h" #include #include "qapi/error.h" -#include "qemu-common.h" #include "block/block_int.h" #include "qemu/module.h" #include "migration/migration.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qstring.h" +#include "qemu/cutils.h" #ifndef S_IWGRP #define S_IWGRP 0 diff --git a/blockdev.c b/blockdev.c index 24c886142a..3eb05d1a90 100644 --- a/blockdev.c +++ b/blockdev.c @@ -50,6 +50,8 @@ #include "qmp-commands.h" #include "trace.h" #include "sysemu/arch_init.h" +#include "qemu/cutils.h" +#include "qemu/help_option.h" static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states = QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states); diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 0a6092bdf7..898ee05472 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -5,6 +5,7 @@ #include "qemu.h" #include "disas/disas.h" +#include "qemu/path.h" #ifdef _ARCH_PPC64 #undef ARCH_DLINFO diff --git a/bsd-user/main.c b/bsd-user/main.c index 287ec1d369..27854c1f91 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -21,7 +21,8 @@ #include #include "qemu.h" -#include "qemu-common.h" +#include "qemu/path.h" +#include "qemu/help_option.h" /* For tb_lock */ #include "cpu.h" #include "tcg.h" diff --git a/contrib/ivshmem-server/main.c b/contrib/ivshmem-server/main.c index 4c9a11f2c5..533f501593 100644 --- a/contrib/ivshmem-server/main.c +++ b/contrib/ivshmem-server/main.c @@ -8,7 +8,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "ivshmem-server.h" diff --git a/disas/i386.c b/disas/i386.c index d40b72ab10..894b0a1e0f 100644 --- a/disas/i386.c +++ b/disas/i386.c @@ -33,6 +33,8 @@ #include "qemu/osdep.h" #include "disas/bfd.h" +#include "qemu/cutils.h" + /* include/opcode/i386.h r1.78 */ /* opcode/i386.h -- Intel 80386 opcode macros diff --git a/dump.c b/dump.c index 81d2d4f5a0..9726f1f477 100644 --- a/dump.c +++ b/dump.c @@ -12,7 +12,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "elf.h" #include "cpu.h" #include "exec/cpu-all.h" diff --git a/exec.c b/exec.c index 151908ebdf..be2a644619 100644 --- a/exec.c +++ b/exec.c @@ -22,7 +22,7 @@ #include #endif -#include "qemu-common.h" +#include "qemu/cutils.h" #include "cpu.h" #include "tcg.h" #include "hw/hw.h" diff --git a/gdbstub.c b/gdbstub.c index e4e480f668..0e431fd4df 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -18,9 +18,9 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" -#ifdef CONFIG_USER_ONLY +#include "qemu/cutils.h" +#ifdef CONFIG_USER_ONLY #include "qemu.h" #else #include "monitor/monitor.h" diff --git a/hmp.c b/hmp.c index 6ace227c66..d510236677 100644 --- a/hmp.c +++ b/hmp.c @@ -34,6 +34,7 @@ #include "ui/console.h" #include "block/qapi.h" #include "qemu-io.h" +#include "qemu/cutils.h" #ifdef CONFIG_SPICE #include diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c index 5088ef5dcb..894041488a 100644 --- a/hw/9pfs/9p-handle.c +++ b/hw/9pfs/9p-handle.c @@ -20,6 +20,7 @@ #include #include #include "qemu/xattr.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include #ifdef CONFIG_LINUX_MAGIC_H diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index ca995a79db..16f45f4854 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -21,6 +21,7 @@ #include #include #include "qemu/xattr.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include #include diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index 0805c9cab4..00a4eb2a7b 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -13,6 +13,7 @@ #include #include #include "9p.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "fsdev/qemu-fsdev.h" #include "9p-proxy.h" diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 365623e8f3..f1475dfd6d 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -20,6 +20,7 @@ #include "9p-synth.h" #include "qemu/rcu.h" #include "qemu/rcu_queue.h" +#include "qemu/cutils.h" /* Root node for synth file system */ static V9fsSynthNode v9fs_synth_root = { diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 1eee68b748..f1267b5441 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -20,6 +20,7 @@ #include "hw/ide.h" #include "hw/timer/i8254.h" #include "hw/char/serial.h" +#include "qemu/cutils.h" #define MAX_IDE_BUS 2 diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 4561d4a483..5382505559 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -20,7 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "sysemu/sysemu.h" #include "hw/arm/omap.h" #include "hw/arm/arm.h" diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index 56844c3030..b3cf0ec690 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -31,6 +31,8 @@ #include "sysemu/blockdev.h" #include "qemu/range.h" #include "hw/sysbus.h" +#include "qemu/cutils.h" +#include "qemu/bcd.h" /* Should signal the TCMI/GPMC */ uint32_t omap_badwidth_read8(void *opaque, hwaddr addr) diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 2076098b1d..1a8c36033a 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -20,6 +20,7 @@ #include "sysemu/char.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" +#include "qemu/cutils.h" static struct { hwaddr io_base; diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c index 80041280e2..1eeb1ab391 100644 --- a/hw/arm/strongarm.c +++ b/hw/arm/strongarm.c @@ -37,6 +37,7 @@ #include "sysemu/char.h" #include "sysemu/sysemu.h" #include "hw/ssi/ssi.h" +#include "qemu/cutils.h" //#define DEBUG diff --git a/hw/block/nvme.h b/hw/block/nvme.h index bf3a3ccac8..8fb0c10756 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -1,5 +1,6 @@ #ifndef HW_NVME_H #define HW_NVME_H +#include "qemu/cutils.h" typedef struct NvmeBar { uint64_t cap; diff --git a/hw/bt/hci.c b/hw/bt/hci.c index 1eaa442c38..7d52205093 100644 --- a/hw/bt/hci.c +++ b/hw/bt/hci.c @@ -27,6 +27,7 @@ #include "hw/bt.h" #include "qapi/qmp/qerror.h" #include "sysemu/replay.h" +#include "qemu/cutils.h" struct bt_hci_s { uint8_t *(*evt_packet)(void *opaque); diff --git a/hw/core/loader.c b/hw/core/loader.c index 93410e35b5..6b949fe44f 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -54,6 +54,7 @@ #include "exec/memory.h" #include "exec/address-spaces.h" #include "hw/boards.h" +#include "qemu/cutils.h" #include diff --git a/hw/core/machine.c b/hw/core/machine.c index 136bf275bc..6dbbc85b97 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -18,6 +18,7 @@ #include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "qemu/error-report.h" +#include "qemu/cutils.h" static char *machine_get_accel(Object *obj, Error **errp) { diff --git a/hw/cris/boot.c b/hw/cris/boot.c index 7d423ed92f..f896ed7f86 100644 --- a/hw/cris/boot.c +++ b/hw/cris/boot.c @@ -29,6 +29,7 @@ #include "hw/loader.h" #include "elf.h" #include "boot.h" +#include "qemu/cutils.h" static void main_cpu_reset(void *opaque) { diff --git a/hw/ide/core.c b/hw/ide/core.c index f8883b2110..90524d5e16 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -33,6 +33,7 @@ #include "sysemu/dma.h" #include "hw/block/block.h" #include "sysemu/block-backend.h" +#include "qemu/cutils.h" #include diff --git a/hw/lm32/lm32_hwsetup.h b/hw/lm32/lm32_hwsetup.h index 838754d5d8..b71e6eafba 100644 --- a/hw/lm32/lm32_hwsetup.h +++ b/hw/lm32/lm32_hwsetup.h @@ -26,6 +26,7 @@ #define QEMU_HW_LM32_HWSETUP_H #include "qemu-common.h" +#include "qemu/cutils.h" #include "hw/loader.h" typedef struct { diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index 22169008be..96e6f4dc2e 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -33,6 +33,7 @@ #include "milkymist-hw.h" #include "lm32.h" #include "exec/address-spaces.h" +#include "qemu/cutils.h" #define BIOS_FILENAME "mmone-bios.bin" #define BIOS_OFFSET 0x00860000 diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 7a3759d692..9eebb1a521 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -35,6 +35,7 @@ #include "sysemu/sysemu.h" #include "hw/loader.h" #include "elf.h" +#include "qemu/cutils.h" #include "boot.h" diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 4931cb1bf4..ac7c641258 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -45,6 +45,7 @@ #include "exec/address-spaces.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" +#include "qemu/help_option.h" enum jazz_model_e { diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 55071dc767..30ba1be957 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/cutils.h" #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/pci/pci.h" diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index 83995ccf0f..c7472aaa9d 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -28,6 +28,7 @@ #include "hw/input/adb.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" +#include "qemu/cutils.h" /* XXX: implement all timer modes */ diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 7866248b93..d96932f6ca 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -31,6 +31,7 @@ #include "trace.h" #include "qemu/error-report.h" #include "qemu/config-file.h" +#include "qemu/cutils.h" #define FW_CFG_NAME "fw_cfg" #define FW_CFG_PATH "/machine/" FW_CFG_NAME diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c index 1671f4686e..24f61212ba 100644 --- a/hw/nvram/mac_nvram.c +++ b/hw/nvram/mac_nvram.c @@ -27,6 +27,7 @@ #include "hw/nvram/openbios_firmware_abi.h" #include "sysemu/sysemu.h" #include "hw/ppc/mac.h" +#include "qemu/cutils.h" #include /* debug NVR */ diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e67664deb3..bb605efae0 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -40,6 +40,7 @@ #include "exec/address-spaces.h" #include "hw/hotplug.h" #include "hw/boards.h" +#include "qemu/cutils.h" //#define DEBUG_PCI #ifdef DEBUG_PCI diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 1086f88d83..32e88b3786 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -71,6 +71,7 @@ #include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" +#include "qemu/cutils.h" #define MAX_IDE_BUS 2 #define CFG_ADDR 0xf0000510 diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 9bfa02e097..a9bb1c27df 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -45,6 +45,7 @@ #include "kvm_ppc.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h" +#include "qemu/cutils.h" #define MAX_IDE_BUS 2 #define CFG_ADDR 0xf0000510 diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 793b9ed34e..3ffb85e601 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -46,6 +46,7 @@ #include "exec/address-spaces.h" #include "trace.h" #include "elf.h" +#include "qemu/cutils.h" /* SMP is not enabled, for now */ #define MAX_CPUS 1 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 7e80f8ac3c..2c380c26c5 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -64,7 +64,7 @@ #include "hw/nmi.h" #include "hw/compat.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 96d66d658c..e6eedf8946 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -12,8 +12,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "cpu.h" +#include "qemu/cutils.h" #include "hw/ppc/spapr_drc.h" #include "qom/object.h" #include "hw/qdev.h" diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index 61204f0b6b..1abec27ec6 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -37,7 +37,8 @@ #include "hw/pci/pci.h" #include "hw/pci-host/spapr.h" #include "hw/ppc/spapr_drc.h" - +#include "qemu/help_option.h" +#include "qemu/bcd.h" #include struct rtas_error_log { diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index b7c5ebde40..2db229272e 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -39,6 +39,7 @@ #include #include "hw/ppc/spapr_drc.h" +#include "qemu/cutils.h" /* #define DEBUG_SPAPR */ diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index 02fa373aee..3a17ac42e4 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -31,6 +31,7 @@ #include "sysemu/sysemu.h" #include "hw/ppc/spapr.h" #include "qapi-event.h" +#include "qemu/cutils.h" #define SPAPR_RTC(obj) \ OBJECT_CHECK(sPAPRRTCState, (obj), TYPE_SPAPR_RTC) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index a5ad3c7ae5..ad6f398c32 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -9,6 +9,7 @@ #include "sysemu/blockdev.h" #include "trace.h" #include "sysemu/dma.h" +#include "qemu/cutils.h" static char *scsibus_get_dev_path(DeviceState *dev); static char *scsibus_get_fw_dev_path(DeviceState *dev); diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 96c7953ecf..c3ce54a203 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -30,7 +30,6 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0) #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/error-report.h" #include "hw/scsi/scsi.h" #include "block/scsi.h" @@ -39,6 +38,7 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0) #include "sysemu/blockdev.h" #include "hw/block/block.h" #include "sysemu/dma.h" +#include "qemu/cutils.h" #ifdef __linux #include diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 97a0dd1c1d..9261d51da7 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -28,6 +28,7 @@ #include "hw/virtio/virtio-access.h" #include "hw/fw-path-provider.h" #include "linux/vhost.h" +#include "qemu/cutils.h" /* Features supported by host kernel. */ static const int kernel_feature_bits[] = { diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 30a6afcb9c..7bfc00abc2 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -46,6 +46,7 @@ #include "elf.h" #include "sysemu/block-backend.h" #include "trace.h" +#include "qemu/cutils.h" /* * Sun4m architecture was used in the following machines: diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index ee602805c0..3165e18eb7 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -44,6 +44,7 @@ #include "elf.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h" +#include "qemu/cutils.h" //#define DEBUG_IRQ //#define DEBUG_EBUS diff --git a/hw/timer/ds1338.c b/hw/timer/ds1338.c index 385b7d3076..0112949e23 100644 --- a/hw/timer/ds1338.c +++ b/hw/timer/ds1338.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "hw/i2c/i2c.h" +#include "qemu/bcd.h" /* Size of NVRAM including both the user-accessible area and the * secondary register area. diff --git a/hw/timer/exynos4210_rtc.c b/hw/timer/exynos4210_rtc.c index f21fb54f5c..da4dd451b9 100644 --- a/hw/timer/exynos4210_rtc.c +++ b/hw/timer/exynos4210_rtc.c @@ -29,6 +29,7 @@ #include "hw/sysbus.h" #include "qemu/timer.h" #include "qemu-common.h" +#include "qemu/bcd.h" #include "hw/ptimer.h" #include "hw/hw.h" diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c index c4db0e6462..e46ca88391 100644 --- a/hw/timer/m48t59.c +++ b/hw/timer/m48t59.c @@ -31,6 +31,7 @@ #include "hw/sysbus.h" #include "hw/isa/isa.h" #include "exec/address-spaces.h" +#include "qemu/bcd.h" //#define DEBUG_NVRAM diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 496a7cd815..2ac0fd3e48 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -23,6 +23,8 @@ */ #include "qemu/osdep.h" #include "config-target.h" +#include "qemu/cutils.h" +#include "qemu/bcd.h" #include "hw/hw.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" diff --git a/hw/timer/pl031.c b/hw/timer/pl031.c index bdec4785bb..38e0cb5ad6 100644 --- a/hw/timer/pl031.c +++ b/hw/timer/pl031.c @@ -15,6 +15,7 @@ #include "hw/sysbus.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" +#include "qemu/cutils.h" //#define DEBUG_PL031 diff --git a/hw/timer/twl92230.c b/hw/timer/twl92230.c index 1c92438b18..7ba4e9a7c9 100644 --- a/hw/timer/twl92230.c +++ b/hw/timer/twl92230.c @@ -25,6 +25,7 @@ #include "hw/i2c/i2c.h" #include "sysemu/sysemu.h" #include "ui/console.h" +#include "qemu/bcd.h" #define VERBOSE 1 diff --git a/hw/usb/bus.c b/hw/usb/bus.c index a9a6f9e56d..16c3461d99 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -7,6 +7,7 @@ #include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "trace.h" +#include "qemu/cutils.h" static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index b183cafece..74306b58e3 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -34,6 +34,7 @@ #include "qemu/config-file.h" #include "sysemu/sysemu.h" #include "qemu/iov.h" +#include "qemu/cutils.h" /*#define TRAFFIC_DEBUG*/ /* Thanks to NetChip Technologies for donating this product ID. diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index ff4b0c588f..ba8538e60e 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 284024e6f4..248a580457 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -22,6 +22,7 @@ #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "qapi/visitor.h" +#include "qemu/cutils.h" //#define DEBUG_MSD diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 194c9b4ed9..bbf3646bae 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -20,7 +20,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu/queue.h" @@ -29,6 +28,7 @@ #include "sysemu/watchdog.h" #include "qapi-event.h" #include "hw/nmi.h" +#include "qemu/help_option.h" static int watchdog_action = WDT_RESET; static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; diff --git a/hw/xen/xen-host-pci-device.c b/hw/xen/xen-host-pci-device.c index 4005d6ae76..eed8cc88e3 100644 --- a/hw/xen/xen-host-pci-device.c +++ b/hw/xen/xen-host-pci-device.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "xen-host-pci-device.h" #define XEN_HOST_PCI_MAX_EXT_CAP \ diff --git a/include/qemu-common.h b/include/qemu-common.h index bbb45b2e64..163bcbb861 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -49,205 +49,6 @@ int qemu_main(int argc, char **argv, char **envp); void qemu_get_timedate(struct tm *tm, int offset); int qemu_timedate_diff(struct tm *tm); -/** - * is_help_option: - * @s: string to test - * - * Check whether @s is one of the standard strings which indicate - * that the user is asking for a list of the valid values for a - * command option like -cpu or -M. The current accepted strings - * are 'help' and '?'. '?' is deprecated (it is a shell wildcard - * which makes it annoying to use in a reliable way) but provided - * for backwards compatibility. - * - * Returns: true if @s is a request for a list. - */ -static inline bool is_help_option(const char *s) -{ - return !strcmp(s, "?") || !strcmp(s, "help"); -} - -/* util/cutils.c */ -/** - * pstrcpy: - * @buf: buffer to copy string into - * @buf_size: size of @buf in bytes - * @str: string to copy - * - * Copy @str into @buf, including the trailing NUL, but do not - * write more than @buf_size bytes. The resulting buffer is - * always NUL terminated (even if the source string was too long). - * If @buf_size is zero or negative then no bytes are copied. - * - * This function is similar to strncpy(), but avoids two of that - * function's problems: - * * if @str fits in the buffer, pstrcpy() does not zero-fill the - * remaining space at the end of @buf - * * if @str is too long, pstrcpy() will copy the first @buf_size-1 - * bytes and then add a NUL - */ -void pstrcpy(char *buf, int buf_size, const char *str); -/** - * strpadcpy: - * @buf: buffer to copy string into - * @buf_size: size of @buf in bytes - * @str: string to copy - * @pad: character to pad the remainder of @buf with - * - * Copy @str into @buf (but *not* its trailing NUL!), and then pad the - * rest of the buffer with the @pad character. If @str is too large - * for the buffer then it is truncated, so that @buf contains the - * first @buf_size characters of @str, with no terminator. - */ -void strpadcpy(char *buf, int buf_size, const char *str, char pad); -/** - * pstrcat: - * @buf: buffer containing existing string - * @buf_size: size of @buf in bytes - * @s: string to concatenate to @buf - * - * Append a copy of @s to the string already in @buf, but do not - * allow the buffer to overflow. If the existing contents of @buf - * plus @str would total more than @buf_size bytes, then write - * as much of @str as will fit followed by a NUL terminator. - * - * @buf must already contain a NUL-terminated string, or the - * behaviour is undefined. - * - * Returns: @buf. - */ -char *pstrcat(char *buf, int buf_size, const char *s); -/** - * strstart: - * @str: string to test - * @val: prefix string to look for - * @ptr: NULL, or pointer to be written to indicate start of - * the remainder of the string - * - * Test whether @str starts with the prefix @val. - * If it does (including the degenerate case where @str and @val - * are equal) then return true. If @ptr is not NULL then a - * pointer to the first character following the prefix is written - * to it. If @val is not a prefix of @str then return false (and - * @ptr is not written to). - * - * Returns: true if @str starts with prefix @val, false otherwise. - */ -int strstart(const char *str, const char *val, const char **ptr); -/** - * stristart: - * @str: string to test - * @val: prefix string to look for - * @ptr: NULL, or pointer to be written to indicate start of - * the remainder of the string - * - * Test whether @str starts with the case-insensitive prefix @val. - * This function behaves identically to strstart(), except that the - * comparison is made after calling qemu_toupper() on each pair of - * characters. - * - * Returns: true if @str starts with case-insensitive prefix @val, - * false otherwise. - */ -int stristart(const char *str, const char *val, const char **ptr); -/** - * qemu_strnlen: - * @s: string - * @max_len: maximum number of bytes in @s to scan - * - * Return the length of the string @s, like strlen(), but do not - * examine more than @max_len bytes of the memory pointed to by @s. - * If no NUL terminator is found within @max_len bytes, then return - * @max_len instead. - * - * This function has the same behaviour as the POSIX strnlen() - * function. - * - * Returns: length of @s in bytes, or @max_len, whichever is smaller. - */ -int qemu_strnlen(const char *s, int max_len); -/** - * qemu_strsep: - * @input: pointer to string to parse - * @delim: string containing delimiter characters to search for - * - * Locate the first occurrence of any character in @delim within - * the string referenced by @input, and replace it with a NUL. - * The location of the next character after the delimiter character - * is stored into @input. - * If the end of the string was reached without finding a delimiter - * character, then NULL is stored into @input. - * If @input points to a NULL pointer on entry, return NULL. - * The return value is always the original value of *@input (and - * so now points to a NUL-terminated string corresponding to the - * part of the input up to the first delimiter). - * - * This function has the same behaviour as the BSD strsep() function. - * - * Returns: the pointer originally in @input. - */ -char *qemu_strsep(char **input, const char *delim); -time_t mktimegm(struct tm *tm); -int qemu_fdatasync(int fd); -int fcntl_setfl(int fd, int flag); -int qemu_parse_fd(const char *param); -int qemu_strtol(const char *nptr, const char **endptr, int base, - long *result); -int qemu_strtoul(const char *nptr, const char **endptr, int base, - unsigned long *result); -int qemu_strtoll(const char *nptr, const char **endptr, int base, - int64_t *result); -int qemu_strtoull(const char *nptr, const char **endptr, int base, - uint64_t *result); - -int parse_uint(const char *s, unsigned long long *value, char **endptr, - int base); -int parse_uint_full(const char *s, unsigned long long *value, int base); - -/* - * qemu_strtosz() suffixes used to specify the default treatment of an - * argument passed to qemu_strtosz() without an explicit suffix. - * These should be defined using upper case characters in the range - * A-Z, as qemu_strtosz() will use qemu_toupper() on the given argument - * prior to comparison. - */ -#define QEMU_STRTOSZ_DEFSUFFIX_EB 'E' -#define QEMU_STRTOSZ_DEFSUFFIX_PB 'P' -#define QEMU_STRTOSZ_DEFSUFFIX_TB 'T' -#define QEMU_STRTOSZ_DEFSUFFIX_GB 'G' -#define QEMU_STRTOSZ_DEFSUFFIX_MB 'M' -#define QEMU_STRTOSZ_DEFSUFFIX_KB 'K' -#define QEMU_STRTOSZ_DEFSUFFIX_B 'B' -int64_t qemu_strtosz(const char *nptr, char **end); -int64_t qemu_strtosz_suffix(const char *nptr, char **end, - const char default_suffix); -int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end, - const char default_suffix, int64_t unit); -#define K_BYTE (1ULL << 10) -#define M_BYTE (1ULL << 20) -#define G_BYTE (1ULL << 30) -#define T_BYTE (1ULL << 40) -#define P_BYTE (1ULL << 50) -#define E_BYTE (1ULL << 60) - -/* used to print char* safely */ -#define STR_OR_NULL(str) ((str) ? (str) : "null") - -/* id.c */ - -typedef enum IdSubSystems { - ID_QDEV, - ID_BLOCK, - ID_MAX /* last element, used as array size */ -} IdSubSystems; - -char *id_generate(IdSubSystems id); -bool id_wellformed(const char *id); - -/* path.c */ -void init_paths(const char *prefix); -const char *path(const char *pathname); - #define qemu_isalnum(c) isalnum((unsigned char)(c)) #define qemu_isalpha(c) isalpha((unsigned char)(c)) #define qemu_iscntrl(c) iscntrl((unsigned char)(c)) @@ -335,8 +136,6 @@ ssize_t qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send); #define qemu_co_send(sockfd, buf, bytes) \ qemu_co_send_recv(sockfd, buf, bytes, true) -bool buffer_is_zero(const void *buf, size_t len); - void qemu_progress_init(int enabled, float min_skip); void qemu_progress_end(void); void qemu_progress_print(float delta, int max); @@ -351,70 +150,14 @@ void os_setup_early_signal_handling(void); char *os_find_datadir(void); void os_parse_cmd_args(int index, const char *optarg); -/* Convert a byte between binary and BCD. */ -static inline uint8_t to_bcd(uint8_t val) -{ - return ((val / 10) << 4) | (val % 10); -} - -static inline uint8_t from_bcd(uint8_t val) -{ - return ((val >> 4) * 10) + (val & 0x0f); -} - #include "qemu/module.h" -/* - * Implementation of ULEB128 (http://en.wikipedia.org/wiki/LEB128) - * Input is limited to 14-bit numbers - */ - -int uleb128_encode_small(uint8_t *out, uint32_t n); -int uleb128_decode_small(const uint8_t *in, uint32_t *n); - -/* unicode.c */ -int mod_utf8_codepoint(const char *s, size_t n, char **end); - /* * Hexdump a buffer to a file. An optional string prefix is added to every line */ void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size); -/* vector definitions */ -#ifdef __ALTIVEC__ -#include -/* The altivec.h header says we're allowed to undef these for - * C++ compatibility. Here we don't care about C++, but we - * undef them anyway to avoid namespace pollution. - */ -#undef vector -#undef pixel -#undef bool -#define VECTYPE __vector unsigned char -#define SPLAT(p) vec_splat(vec_ld(0, p), 0) -#define ALL_EQ(v1, v2) vec_all_eq(v1, v2) -#define VEC_OR(v1, v2) ((v1) | (v2)) -/* altivec.h may redefine the bool macro as vector type. - * Reset it to POSIX semantics. */ -#define bool _Bool -#elif defined __SSE2__ -#include -#define VECTYPE __m128i -#define SPLAT(p) _mm_set1_epi8(*(p)) -#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF) -#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2)) -#else -#define VECTYPE unsigned long -#define SPLAT(p) (*(p) * (~0UL / 255)) -#define ALL_EQ(v1, v2) ((v1) == (v2)) -#define VEC_OR(v1, v2) ((v1) | (v2)) -#endif - -#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8 -bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len); -size_t buffer_find_nonzero_offset(const void *buf, size_t len); - /* * helper to parse debug environment variables */ diff --git a/include/qemu/bcd.h b/include/qemu/bcd.h new file mode 100644 index 0000000000..b4c9b64b8f --- /dev/null +++ b/include/qemu/bcd.h @@ -0,0 +1,15 @@ +#ifndef QEMU_BCD_H +#define QEMU_BCD_H 1 + +/* Convert a byte between binary and BCD. */ +static inline uint8_t to_bcd(uint8_t val) +{ + return ((val / 10) << 4) | (val % 10); +} + +static inline uint8_t from_bcd(uint8_t val) +{ + return ((val >> 4) * 10) + (val & 0x0f); +} + +#endif diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h new file mode 100644 index 0000000000..db7adadcf9 --- /dev/null +++ b/include/qemu/cutils.h @@ -0,0 +1,183 @@ +#ifndef QEMU_CUTILS_H +#define QEMU_CUTILS_H 1 + +#include "qemu/fprintf-fn.h" + +/** + * pstrcpy: + * @buf: buffer to copy string into + * @buf_size: size of @buf in bytes + * @str: string to copy + * + * Copy @str into @buf, including the trailing NUL, but do not + * write more than @buf_size bytes. The resulting buffer is + * always NUL terminated (even if the source string was too long). + * If @buf_size is zero or negative then no bytes are copied. + * + * This function is similar to strncpy(), but avoids two of that + * function's problems: + * * if @str fits in the buffer, pstrcpy() does not zero-fill the + * remaining space at the end of @buf + * * if @str is too long, pstrcpy() will copy the first @buf_size-1 + * bytes and then add a NUL + */ +void pstrcpy(char *buf, int buf_size, const char *str); +/** + * strpadcpy: + * @buf: buffer to copy string into + * @buf_size: size of @buf in bytes + * @str: string to copy + * @pad: character to pad the remainder of @buf with + * + * Copy @str into @buf (but *not* its trailing NUL!), and then pad the + * rest of the buffer with the @pad character. If @str is too large + * for the buffer then it is truncated, so that @buf contains the + * first @buf_size characters of @str, with no terminator. + */ +void strpadcpy(char *buf, int buf_size, const char *str, char pad); +/** + * pstrcat: + * @buf: buffer containing existing string + * @buf_size: size of @buf in bytes + * @s: string to concatenate to @buf + * + * Append a copy of @s to the string already in @buf, but do not + * allow the buffer to overflow. If the existing contents of @buf + * plus @str would total more than @buf_size bytes, then write + * as much of @str as will fit followed by a NUL terminator. + * + * @buf must already contain a NUL-terminated string, or the + * behaviour is undefined. + * + * Returns: @buf. + */ +char *pstrcat(char *buf, int buf_size, const char *s); +/** + * strstart: + * @str: string to test + * @val: prefix string to look for + * @ptr: NULL, or pointer to be written to indicate start of + * the remainder of the string + * + * Test whether @str starts with the prefix @val. + * If it does (including the degenerate case where @str and @val + * are equal) then return true. If @ptr is not NULL then a + * pointer to the first character following the prefix is written + * to it. If @val is not a prefix of @str then return false (and + * @ptr is not written to). + * + * Returns: true if @str starts with prefix @val, false otherwise. + */ +int strstart(const char *str, const char *val, const char **ptr); +/** + * stristart: + * @str: string to test + * @val: prefix string to look for + * @ptr: NULL, or pointer to be written to indicate start of + * the remainder of the string + * + * Test whether @str starts with the case-insensitive prefix @val. + * This function behaves identically to strstart(), except that the + * comparison is made after calling qemu_toupper() on each pair of + * characters. + * + * Returns: true if @str starts with case-insensitive prefix @val, + * false otherwise. + */ +int stristart(const char *str, const char *val, const char **ptr); +/** + * qemu_strnlen: + * @s: string + * @max_len: maximum number of bytes in @s to scan + * + * Return the length of the string @s, like strlen(), but do not + * examine more than @max_len bytes of the memory pointed to by @s. + * If no NUL terminator is found within @max_len bytes, then return + * @max_len instead. + * + * This function has the same behaviour as the POSIX strnlen() + * function. + * + * Returns: length of @s in bytes, or @max_len, whichever is smaller. + */ +int qemu_strnlen(const char *s, int max_len); +/** + * qemu_strsep: + * @input: pointer to string to parse + * @delim: string containing delimiter characters to search for + * + * Locate the first occurrence of any character in @delim within + * the string referenced by @input, and replace it with a NUL. + * The location of the next character after the delimiter character + * is stored into @input. + * If the end of the string was reached without finding a delimiter + * character, then NULL is stored into @input. + * If @input points to a NULL pointer on entry, return NULL. + * The return value is always the original value of *@input (and + * so now points to a NUL-terminated string corresponding to the + * part of the input up to the first delimiter). + * + * This function has the same behaviour as the BSD strsep() function. + * + * Returns: the pointer originally in @input. + */ +char *qemu_strsep(char **input, const char *delim); +time_t mktimegm(struct tm *tm); +int qemu_fdatasync(int fd); +int fcntl_setfl(int fd, int flag); +int qemu_parse_fd(const char *param); +int qemu_strtol(const char *nptr, const char **endptr, int base, + long *result); +int qemu_strtoul(const char *nptr, const char **endptr, int base, + unsigned long *result); +int qemu_strtoll(const char *nptr, const char **endptr, int base, + int64_t *result); +int qemu_strtoull(const char *nptr, const char **endptr, int base, + uint64_t *result); + +int parse_uint(const char *s, unsigned long long *value, char **endptr, + int base); +int parse_uint_full(const char *s, unsigned long long *value, int base); + +/* + * qemu_strtosz() suffixes used to specify the default treatment of an + * argument passed to qemu_strtosz() without an explicit suffix. + * These should be defined using upper case characters in the range + * A-Z, as qemu_strtosz() will use qemu_toupper() on the given argument + * prior to comparison. + */ +#define QEMU_STRTOSZ_DEFSUFFIX_EB 'E' +#define QEMU_STRTOSZ_DEFSUFFIX_PB 'P' +#define QEMU_STRTOSZ_DEFSUFFIX_TB 'T' +#define QEMU_STRTOSZ_DEFSUFFIX_GB 'G' +#define QEMU_STRTOSZ_DEFSUFFIX_MB 'M' +#define QEMU_STRTOSZ_DEFSUFFIX_KB 'K' +#define QEMU_STRTOSZ_DEFSUFFIX_B 'B' +int64_t qemu_strtosz(const char *nptr, char **end); +int64_t qemu_strtosz_suffix(const char *nptr, char **end, + const char default_suffix); +int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end, + const char default_suffix, int64_t unit); +#define K_BYTE (1ULL << 10) +#define M_BYTE (1ULL << 20) +#define G_BYTE (1ULL << 30) +#define T_BYTE (1ULL << 40) +#define P_BYTE (1ULL << 50) +#define E_BYTE (1ULL << 60) + +/* used to print char* safely */ +#define STR_OR_NULL(str) ((str) ? (str) : "null") + +bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len); +size_t buffer_find_nonzero_offset(const void *buf, size_t len); +bool buffer_is_zero(const void *buf, size_t len); + +/* + * Implementation of ULEB128 (http://en.wikipedia.org/wiki/LEB128) + * Input is limited to 14-bit numbers + */ + +int uleb128_encode_small(uint8_t *out, uint32_t n); +int uleb128_decode_small(const uint8_t *in, uint32_t *n); + +#endif diff --git a/include/qemu/help_option.h b/include/qemu/help_option.h new file mode 100644 index 0000000000..e39a66e77b --- /dev/null +++ b/include/qemu/help_option.h @@ -0,0 +1,22 @@ +#ifndef QEMU_HELP_OPTION_H +#define QEMU_HELP_OPTION_H 1 + +/** + * is_help_option: + * @s: string to test + * + * Check whether @s is one of the standard strings which indicate + * that the user is asking for a list of the valid values for a + * command option like -cpu or -M. The current accepted strings + * are 'help' and '?'. '?' is deprecated (it is a shell wildcard + * which makes it annoying to use in a reliable way) but provided + * for backwards compatibility. + * + * Returns: true if @s is a request for a list. + */ +static inline bool is_help_option(const char *s) +{ + return !strcmp(s, "?") || !strcmp(s, "help"); +} + +#endif diff --git a/include/qemu/id.h b/include/qemu/id.h new file mode 100644 index 0000000000..7d90335afb --- /dev/null +++ b/include/qemu/id.h @@ -0,0 +1,13 @@ +#ifndef QEMU_ID_H +#define QEMU_ID_H 1 + +typedef enum IdSubSystems { + ID_QDEV, + ID_BLOCK, + ID_MAX /* last element, used as array size */ +} IdSubSystems; + +char *id_generate(IdSubSystems id); +bool id_wellformed(const char *id); + +#endif diff --git a/include/qemu/path.h b/include/qemu/path.h new file mode 100644 index 0000000000..ed5fee086f --- /dev/null +++ b/include/qemu/path.h @@ -0,0 +1,7 @@ +#ifndef QEMU_PATH_H +#define QEMU_PATH_H 1 + +void init_paths(const char *prefix); +const char *path(const char *pathname); + +#endif diff --git a/include/qemu/unicode.h b/include/qemu/unicode.h new file mode 100644 index 0000000000..d8731652d2 --- /dev/null +++ b/include/qemu/unicode.h @@ -0,0 +1,6 @@ +#ifndef QEMU_UNICODE_H +#define QEMU_UNICODE_H 1 + +int mod_utf8_codepoint(const char *s, size_t n, char **end); + +#endif diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 19dc7f5457..e47caff7ae 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -7,6 +7,7 @@ #include "qemu.h" #include "disas/disas.h" +#include "qemu/path.h" #ifdef _ARCH_PPC64 #undef ARCH_DLINFO diff --git a/linux-user/main.c b/linux-user/main.c index 2b1e7552da..b432bf2b1e 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -22,7 +22,9 @@ #include #include "qemu.h" -#include "qemu-common.h" +#include "qemu/path.h" +#include "qemu/cutils.h" +#include "qemu/help_option.h" #include "cpu.h" #include "tcg.h" #include "qemu/timer.h" diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 951753143c..032d338869 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -18,6 +18,8 @@ */ #define _ATFILE_SOURCE #include "qemu/osdep.h" +#include "qemu/cutils.h" +#include "qemu/path.h" #include #include #include diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c index 75d890dfef..0a5c0b0b29 100644 --- a/linux-user/uaccess.c +++ b/linux-user/uaccess.c @@ -1,5 +1,6 @@ /* User memory access */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "qemu.h" diff --git a/main-loop.c b/main-loop.c index 9598c5f4c7..89a699419f 100644 --- a/main-loop.c +++ b/main-loop.c @@ -24,7 +24,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/timer.h" #include "qemu/sockets.h" // struct in_addr needed for libslirp.h #include "sysemu/qtest.h" diff --git a/migration/block.c b/migration/block.c index af8e16dfc7..1743317288 100644 --- a/migration/block.c +++ b/migration/block.c @@ -20,6 +20,7 @@ #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "hw/hw.h" +#include "qemu/cutils.h" #include "qemu/queue.h" #include "qemu/timer.h" #include "migration/block.h" diff --git a/migration/migration.c b/migration/migration.c index 034a918d32..991313a862 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -14,7 +14,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "migration/migration.h" diff --git a/migration/ram.c b/migration/ram.c index 704f6a95bf..3f057388cb 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -28,6 +28,7 @@ #include "qemu/osdep.h" #include #include "qapi-event.h" +#include "qemu/cutils.h" #include "qemu/bitops.h" #include "qemu/bitmap.h" #include "qemu/timer.h" diff --git a/migration/rdma.c b/migration/rdma.c index 0601d528bc..f6a9992b3e 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "migration/migration.h" #include "migration/qemu-file.h" #include "exec/cpu-common.h" diff --git a/migration/savevm.c b/migration/savevm.c index 0a33c227c5..16ba443798 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -27,7 +27,6 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" #include "hw/boards.h" #include "hw/hw.h" #include "hw/qdev.h" @@ -50,7 +49,7 @@ #include "qemu/iov.h" #include "block/snapshot.h" #include "block/qapi.h" - +#include "qemu/cutils.h" #ifndef ETH_P_RARP #define ETH_P_RARP 0x8035 diff --git a/migration/xbzrle.c b/migration/xbzrle.c index 4db3f6c5cc..c858339259 100644 --- a/migration/xbzrle.c +++ b/migration/xbzrle.c @@ -11,7 +11,7 @@ * */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "include/migration/migration.h" /* diff --git a/monitor.c b/monitor.c index 3533602c23..955ed35303 100644 --- a/monitor.c +++ b/monitor.c @@ -78,6 +78,7 @@ #include "qmp-introspect.h" #include "sysemu/block-backend.h" #include "sysemu/qtest.h" +#include "qemu/cutils.h" /* for hmp_info_irq/pic */ #if defined(TARGET_SPARC) diff --git a/net/net.c b/net/net.c index 1a78edf751..3b5a14298c 100644 --- a/net/net.c +++ b/net/net.c @@ -32,9 +32,11 @@ #include "monitor/monitor.h" #include "qemu-common.h" +#include "qemu/help_option.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/sockets.h" +#include "qemu/cutils.h" #include "qemu/config-file.h" #include "qmp-commands.h" #include "hw/qdev.h" diff --git a/net/netmap.c b/net/netmap.c index 6fa2c418a5..d9c21b2b86 100644 --- a/net/netmap.c +++ b/net/netmap.c @@ -37,6 +37,7 @@ #include "sysemu/sysemu.h" #include "qemu/error-report.h" #include "qemu/iov.h" +#include "qemu/cutils.h" typedef struct NetmapState { NetClientState nc; diff --git a/net/slirp.c b/net/slirp.c index 95239bceb0..0bcef226e2 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -38,6 +38,7 @@ #include "slirp/libslirp.h" #include "slirp/ip6.h" #include "sysemu/char.h" +#include "qemu/cutils.h" static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) { diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 33642ae518..c506ac31d6 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "tap_int.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "sysemu/sysemu.h" #include "qemu/error-report.h" diff --git a/net/tap-linux.c b/net/tap-linux.c index 8077d2b575..a503fa9c6e 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -33,8 +33,8 @@ #include "sysemu/sysemu.h" #include "qapi/error.h" -#include "qemu-common.h" #include "qemu/error-report.h" +#include "qemu/cutils.h" #define PATH_NET_TUN "/dev/net/tun" diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 26d2042922..a2a92356c1 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -26,6 +26,7 @@ #include "qapi/error.h" #include "tap_int.h" #include "sysemu/sysemu.h" +#include "qemu/cutils.h" #include #include diff --git a/net/tap.c b/net/tap.c index 3ddf9ecd7d..740e8a2613 100644 --- a/net/tap.c +++ b/net/tap.c @@ -38,6 +38,7 @@ #include "sysemu/sysemu.h" #include "qapi/error.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/error-report.h" #include "net/tap.h" diff --git a/os-posix.c b/os-posix.c index 92fa3baa1a..107fde38bf 100644 --- a/os-posix.c +++ b/os-posix.c @@ -38,6 +38,7 @@ #include "qemu/rcu.h" #include "qemu/error-report.h" #include "qemu/log.h" +#include "qemu/cutils.h" #ifdef CONFIG_LINUX #include diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 5e2b8832a8..602f2609cc 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -12,7 +12,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qapi/qmp/qerror.h" #include "qapi/opts-visitor.h" #include "qemu/queue.h" diff --git a/qdev-monitor.c b/qdev-monitor.c index be6a07ee49..e19617fa8b 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -27,6 +27,7 @@ #include "qapi/qmp/qerror.h" #include "qemu/config-file.h" #include "qemu/error-report.h" +#include "qemu/help_option.h" /* * Aliases were a bad idea from the start. Let's keep them diff --git a/qemu-char.c b/qemu-char.c index f90e4c1208..97aaaae439 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "sysemu/block-backend.h" diff --git a/qemu-img.c b/qemu-img.c index 8b54d05486..bd93d0a774 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -27,7 +27,7 @@ #include "qapi/qmp-output-visitor.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/config-file.h" #include "qemu/option.h" #include "qemu/error-report.h" diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index 13fbb5944c..139f7ebcbb 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -19,6 +19,7 @@ #include "qemu/main-loop.h" #include "qemu/timer.h" #include "sysemu/block-backend.h" +#include "qemu/cutils.h" #define CMD_NOFILE_OK 0x01 diff --git a/qemu-nbd.c b/qemu-nbd.c index 2963c56df7..9bb9cb7f61 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -19,6 +19,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "sysemu/block-backend.h" #include "block/block_int.h" #include "block/nbd.h" diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 9f51faea80..2ae37255d4 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -23,6 +23,7 @@ #include "qemu/host-utils.h" #include "qemu/sockets.h" #include "qemu/base64.h" +#include "qemu/cutils.h" #ifndef CONFIG_HAS_ENVIRON #ifdef __APPLE__ diff --git a/qga/commands.c b/qga/commands.c index e091ee1af1..95d8b04a16 100644 --- a/qga/commands.c +++ b/qga/commands.c @@ -16,6 +16,7 @@ #include "qga-qmp-commands.h" #include "qapi/qmp/qerror.h" #include "qemu/base64.h" +#include "qemu/cutils.h" /* Maximum captured guest-exec out_data/err_data - 16MB */ #define GUEST_EXEC_MAX_OUTPUT (16*1024*1024) diff --git a/qga/main.c b/qga/main.c index fb2f6638ba..f1cbd2a74c 100644 --- a/qga/main.c +++ b/qga/main.c @@ -28,6 +28,7 @@ #include "qapi/qmp/dispatch.h" #include "qga/channel.h" #include "qemu/bswap.h" +#include "qemu/help_option.h" #ifdef _WIN32 #include "qga/service-win32.h" #include "qga/vss-win32.h" diff --git a/qmp.c b/qmp.c index 3f16a77b44..9d0953bc29 100644 --- a/qmp.c +++ b/qmp.c @@ -14,7 +14,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "qmp-commands.h" diff --git a/qobject/json-parser.c b/qobject/json-parser.c index 6e65b82264..67ed727318 100644 --- a/qobject/json-parser.c +++ b/qobject/json-parser.c @@ -12,7 +12,6 @@ */ #include "qemu/osdep.h" - #include "qapi/error.h" #include "qemu-common.h" #include "qapi/qmp/qstring.h" diff --git a/qobject/qdict.c b/qobject/qdict.c index 9833bd0730..a1285361c4 100644 --- a/qobject/qdict.c +++ b/qobject/qdict.c @@ -19,6 +19,7 @@ #include "qapi/qmp/qobject.h" #include "qemu/queue.h" #include "qemu-common.h" +#include "qemu/cutils.h" /** * qdict_new(): Create a new QDict diff --git a/qobject/qjson.c b/qobject/qjson.c index 06dc210cbf..ef160d2119 100644 --- a/qobject/qjson.c +++ b/qobject/qjson.c @@ -21,6 +21,7 @@ #include "qapi/qmp/qbool.h" #include "qapi/qmp/qfloat.h" #include "qapi/qmp/qdict.h" +#include "qemu/unicode.h" typedef struct JSONParsingState { diff --git a/qom/object.c b/qom/object.c index 6a1f03019b..8e6e68dffc 100644 --- a/qom/object.c +++ b/qom/object.c @@ -14,7 +14,7 @@ #include "qapi/error.h" #include "qom/object.h" #include "qom/object_interfaces.h" -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qapi/visitor.h" #include "qapi-visit.h" #include "qapi/string-input-visitor.h" diff --git a/slirp/slirp.c b/slirp/slirp.c index 9ccf4157d8..3481fcc94b 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -28,6 +28,7 @@ #include "sysemu/char.h" #include "slirp.h" #include "hw/hw.h" +#include "qemu/cutils.h" /* host loopback address */ struct in_addr loopback_addr; diff --git a/slirp/tftp.c b/slirp/tftp.c index 25ad6efdf8..12b5ff6e25 100644 --- a/slirp/tftp.c +++ b/slirp/tftp.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include #include "qemu-common.h" +#include "qemu/cutils.h" static inline int tftp_session_in_use(struct tftp_session *spt) { diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c index 76c33b97e7..8be0645eb0 100644 --- a/target-arm/arm-semi.c +++ b/target-arm/arm-semi.c @@ -30,6 +30,7 @@ #include "qemu-common.h" #include "exec/gdbstub.h" #include "hw/arm/arm.h" +#include "qemu/cutils.h" #endif #define TARGET_SYS_OPEN 0x01 diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3ea6b294a4..eee00d6bbd 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -17,6 +17,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "cpu.h" #include "sysemu/kvm.h" diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 40ec6fded2..159ec69790 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -42,6 +42,7 @@ #include "exec/gdbstub.h" #include "exec/memattrs.h" #include "sysemu/hostmem.h" +#include "qemu/cutils.h" //#define DEBUG_KVM diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index 9746b1ddfe..4bfff341dc 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -27,6 +27,7 @@ #include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/timer.h" #include "qemu/error-report.h" #include "hw/hw.h" diff --git a/tcg/tcg.c b/tcg/tcg.c index 550671b94d..4c8c2d2991 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -36,7 +36,7 @@ #define NDEBUG #endif -#include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/host-utils.h" #include "qemu/timer.h" diff --git a/tests/qom-test.c b/tests/qom-test.c index 3c6cfca788..bd5cdde261 100644 --- a/tests/qom-test.c +++ b/tests/qom-test.c @@ -11,6 +11,7 @@ #include #include "qemu-common.h" +#include "qemu/cutils.h" #include "libqtest.h" #include "qapi/qmp/types.h" diff --git a/tests/tcg/linux-test.c b/tests/tcg/linux-test.c index 1c6c01318e..5070d31446 100644 --- a/tests/tcg/linux-test.c +++ b/tests/tcg/linux-test.c @@ -39,6 +39,7 @@ #include #include #include +#include "qemu/cutils.h" #define TESTPATH "/tmp/linux-test.tmp" #define TESTPORT 7654 diff --git a/tests/test-cutils.c b/tests/test-cutils.c index 398700df45..fb8f5b5321 100644 --- a/tests/test-cutils.c +++ b/tests/test-cutils.c @@ -28,8 +28,7 @@ #include "qemu/osdep.h" #include -#include "qemu-common.h" - +#include "qemu/cutils.h" static void test_parse_uint_null(void) { diff --git a/tests/test-xbzrle.c b/tests/test-xbzrle.c index abd309d418..49f64195a6 100644 --- a/tests/test-xbzrle.c +++ b/tests/test-xbzrle.c @@ -12,6 +12,7 @@ */ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "include/migration/migration.h" #define PAGE_SIZE 4096 diff --git a/trace/control.c b/trace/control.c index 20d3370bf8..ccddda537f 100644 --- a/trace/control.c +++ b/trace/control.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "trace/control.h" +#include "qemu/help_option.h" #ifdef CONFIG_TRACE_SIMPLE #include "trace/simple.h" #endif diff --git a/ui/gtk.c b/ui/gtk.c index 38ef3fdb42..f372a6d5ae 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -36,6 +36,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "ui/console.h" #include "ui/gtk.h" diff --git a/ui/sdl.c b/ui/sdl.c index abeef33095..d8cf5bcf74 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -30,6 +30,7 @@ #include #include "qemu-common.h" +#include "qemu/cutils.h" #include "ui/console.h" #include "ui/input.h" #include "sysemu/sysemu.h" diff --git a/ui/vnc.c b/ui/vnc.c index 6d39ddd3f9..d2ebf1fb71 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -44,6 +44,7 @@ #include "crypto/tlscredsanon.h" #include "crypto/tlscredsx509.h" #include "qom/object_interfaces.h" +#include "qemu/cutils.h" #define VNC_REFRESH_INTERVAL_BASE GUI_REFRESH_INTERVAL_DEFAULT #define VNC_REFRESH_INTERVAL_INC 50 diff --git a/util/cutils.c b/util/cutils.c index c3dd53453a..43d1afbbec 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -29,6 +29,7 @@ #include "qemu/sockets.h" #include "qemu/iov.h" #include "net/net.h" +#include "qemu/cutils.h" void strpadcpy(char *buf, int buf_size, const char *str, char pad) { @@ -160,6 +161,38 @@ int qemu_fdatasync(int fd) #endif } +/* vector definitions */ +#ifdef __ALTIVEC__ +#include +/* The altivec.h header says we're allowed to undef these for + * C++ compatibility. Here we don't care about C++, but we + * undef them anyway to avoid namespace pollution. + */ +#undef vector +#undef pixel +#undef bool +#define VECTYPE __vector unsigned char +#define SPLAT(p) vec_splat(vec_ld(0, p), 0) +#define ALL_EQ(v1, v2) vec_all_eq(v1, v2) +#define VEC_OR(v1, v2) ((v1) | (v2)) +/* altivec.h may redefine the bool macro as vector type. + * Reset it to POSIX semantics. */ +#define bool _Bool +#elif defined __SSE2__ +#include +#define VECTYPE __m128i +#define SPLAT(p) _mm_set1_epi8(*(p)) +#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF) +#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2)) +#else +#define VECTYPE unsigned long +#define SPLAT(p) (*(p) * (~0UL / 255)) +#define ALL_EQ(v1, v2) ((v1) == (v2)) +#define VEC_OR(v1, v2) ((v1) | (v2)) +#endif + +#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8 + static bool can_use_buffer_find_nonzero_offset_inner(const void *buf, size_t len) { diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 2e30e74bd6..b00189a754 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/event_notifier.h" #include "sysemu/char.h" #include "qemu/main-loop.h" diff --git a/util/id.c b/util/id.c index bbbadcc784..6141352955 100644 --- a/util/id.c +++ b/util/id.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/id.h" bool id_wellformed(const char *id) { diff --git a/util/iov.c b/util/iov.c index b69e4b7534..003fcce66f 100644 --- a/util/iov.c +++ b/util/iov.c @@ -20,6 +20,7 @@ #include "qemu-common.h" #include "qemu/iov.h" #include "qemu/sockets.h" +#include "qemu/cutils.h" size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt, size_t offset, const void *buf, size_t bytes) diff --git a/util/osdep.c b/util/osdep.c index 8356bdd3d8..d56d071111 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -37,6 +37,7 @@ extern int madvise(caddr_t, size_t, int); #endif #include "qemu-common.h" +#include "qemu/cutils.h" #include "qemu/sockets.h" #include "qemu/error-report.h" #include "monitor/monitor.h" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index dcc3c7ea01..09082564c4 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -52,6 +52,7 @@ #include #include #include +#include "qemu/cutils.h" #ifdef CONFIG_LINUX #include diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 4ef4a9a13b..c926db4a5c 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -37,6 +37,7 @@ #include "qemu/main-loop.h" #include "trace.h" #include "qemu/sockets.h" +#include "qemu/cutils.h" /* this must come after including "trace.h" */ #include diff --git a/util/path.c b/util/path.c index d09e8c5e14..5479f76c6d 100644 --- a/util/path.c +++ b/util/path.c @@ -7,6 +7,8 @@ #include #include #include "qemu-common.h" +#include "qemu/cutils.h" +#include "qemu/path.h" struct pathelem { diff --git a/util/qemu-option.c b/util/qemu-option.c index 98967ffde9..dd9e73df54 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -31,6 +31,9 @@ #include "qapi/qmp/types.h" #include "qapi/qmp/qerror.h" #include "qemu/option_int.h" +#include "qemu/cutils.h" +#include "qemu/id.h" +#include "qemu/help_option.h" /* * Extracts the name of an option from the parameter string (p points at the diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 6f344d4405..b87e17fa56 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -24,6 +24,7 @@ #include "qapi/qmp-input-visitor.h" #include "qapi/qmp-output-visitor.h" #include "qapi-visit.h" +#include "qemu/cutils.h" #ifndef AI_ADDRCONFIG # define AI_ADDRCONFIG 0 diff --git a/util/readline.c b/util/readline.c index e94c97521b..bbdee790b0 100644 --- a/util/readline.c +++ b/util/readline.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/readline.h" +#include "qemu/cutils.h" #define IS_NORM 0 #define IS_ESC 1 diff --git a/util/unicode.c b/util/unicode.c index 524dca8c7c..a812a35171 100644 --- a/util/unicode.c +++ b/util/unicode.c @@ -11,7 +11,7 @@ */ #include "qemu/osdep.h" -#include "qemu-common.h" +#include "qemu/unicode.h" /** * mod_utf8_codepoint: diff --git a/vl.c b/vl.c index 40ed4d0cb9..6566da22d3 100644 --- a/vl.c +++ b/vl.c @@ -22,7 +22,8 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" - +#include "qemu/cutils.h" +#include "qemu/help_option.h" #ifdef CONFIG_SECCOMP #include "sysemu/seccomp.h" From 5bd2ec3d7b47b2252745882795d79aef36380fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 15 Mar 2016 14:30:16 +0000 Subject: [PATCH 16/28] tcg: pass down TranslationBlock to tcg_code_gen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My later debugging patches need access to the origin PC which is held in the TranslationBlock structure. Pass down the whole structure as it also holds the information about the code start point. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <1458052224-9316-3-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- tcg/tcg.c | 6 +++--- tcg/tcg.h | 2 +- translate-all.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 4c8c2d2991..f1f1640c9b 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2328,7 +2328,7 @@ void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf) #endif -int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf) +int tcg_gen_code(TCGContext *s, TranslationBlock *tb) { int i, oi, oi_next, num_insns; @@ -2387,8 +2387,8 @@ int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf) tcg_reg_alloc_start(s); - s->code_buf = gen_code_buf; - s->code_ptr = gen_code_buf; + s->code_buf = tb->tc_ptr; + s->code_ptr = tb->tc_ptr; tcg_out_tb_init(s); diff --git a/tcg/tcg.h b/tcg/tcg.h index b83f76351c..40c8fbe2ae 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -636,7 +636,7 @@ void tcg_context_init(TCGContext *s); void tcg_prologue_init(TCGContext *s); void tcg_func_start(TCGContext *s); -int tcg_gen_code(TCGContext *s, tcg_insn_unit *gen_code_buf); +int tcg_gen_code(TCGContext *s, TranslationBlock *tb); void tcg_set_frame(TCGContext *s, TCGReg reg, intptr_t start, intptr_t size); diff --git a/translate-all.c b/translate-all.c index e9f409b762..b3207fe274 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1120,7 +1120,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, the tcg optimization currently hidden inside tcg_gen_code. All that should be required is to flush the TBs, allocate a new TB, re-initialize it per above, and re-do the actual code generation. */ - gen_code_size = tcg_gen_code(&tcg_ctx, gen_code_buf); + gen_code_size = tcg_gen_code(&tcg_ctx, tb); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; } From 541957361e0728c2ffe8330a712099cc872986a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 15 Mar 2016 14:30:17 +0000 Subject: [PATCH 17/28] qemu-log: correct help text for -d cpu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn't just dump CPU state on translation but on every block entrance. Signed-off-by: Alex Bennée Reviewed-by: Andreas Färber Reviewed-by: Richard Henderson Message-Id: <1458052224-9316-4-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- util/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/log.c b/util/log.c index 8b921de588..a14d480a53 100644 --- a/util/log.c +++ b/util/log.c @@ -120,7 +120,7 @@ const QEMULogItem qemu_log_items[] = { { CPU_LOG_EXEC, "exec", "show trace before each executed TB (lots of logs)" }, { CPU_LOG_TB_CPU, "cpu", - "show CPU state before block translation" }, + "show CPU registers before entering a TB (lots of logs)" }, { CPU_LOG_MMU, "mmu", "log MMU-related activities" }, { CPU_LOG_PCALL, "pcall", From 7ee606230e6b7645d92365d9b39179368e83ac54 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 15 Mar 2016 19:12:03 +0100 Subject: [PATCH 18/28] qemu-log: Avoid function call for disabled qemu_log_mask logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make qemu_log_mask() a macro which only calls the function to do the actual work if the logging is enabled. This avoids making a function call in possible fast paths where logging is disabled. Signed-off-by: Peter Maydell Signed-off-by: Alex Bennée Reviewed-by: Andreas Färber Signed-off-by: Paolo Bonzini --- include/qemu/log.h | 13 ++++++++++--- util/log.c | 11 ----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/qemu/log.h b/include/qemu/log.h index 40c24fda40..523c886078 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -66,10 +66,17 @@ qemu_log_vprintf(const char *fmt, va_list va) } } -/* log only if a bit is set on the current loglevel mask +/* log only if a bit is set on the current loglevel mask: + * @mask: bit to check in the mask + * @fmt: printf-style format string + * @args: optional arguments for format string */ -void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...); - +#define qemu_log_mask(MASK, FMT, ...) \ + do { \ + if (unlikely(qemu_loglevel_mask(MASK))) { \ + qemu_log(FMT, ## __VA_ARGS__); \ + } \ + } while (0) /* Maintenance: */ diff --git a/util/log.c b/util/log.c index a14d480a53..4e69586a73 100644 --- a/util/log.c +++ b/util/log.c @@ -38,17 +38,6 @@ void qemu_log(const char *fmt, ...) va_end(ap); } -void qemu_log_mask(int mask, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if ((qemu_loglevel & mask) && qemu_logfile) { - vfprintf(qemu_logfile, fmt, ap); - } - va_end(ap); -} - /* enable or disable low levels log */ void do_qemu_set_log(int log_flags, bool use_own_buffers) { From 1a830635229e14c403600167823ea6b3b79d3097 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Tue, 15 Mar 2016 14:30:19 +0000 Subject: [PATCH 19/28] qemu-log: Improve the "exec" TB execution logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve the TB execution logging so that it is easier to identify what is happening from trace logs: * move the "Trace" logging of executed TBs into cpu_tb_exec() so that it is emitted if and only if we actually execute a TB, and for consistency for the CPU state logging * log when we link two TBs together via tb_add_jump() * log when cpu_tb_exec() returns early from a chain of TBs The new style logging looks like this: Trace 0x7fb7cc822ca0 [ffffffc0000dce00] Linking TBs 0x7fb7cc822ca0 [ffffffc0000dce00] index 0 -> 0x7fb7cc823110 [ffffffc0000dce10] Trace 0x7fb7cc823110 [ffffffc0000dce10] Trace 0x7fb7cc823420 [ffffffc000302688] Trace 0x7fb7cc8234a0 [ffffffc000302698] Trace 0x7fb7cc823520 [ffffffc0003026a4] Trace 0x7fb7cc823560 [ffffffc0000dce44] Linking TBs 0x7fb7cc823560 [ffffffc0000dce44] index 1 -> 0x7fb7cc8235d0 [ffffffc0000dce70] Trace 0x7fb7cc8235d0 [ffffffc0000dce70] Stopped execution of TB chain before 0x7fb7cc8235d0 [ffffffc0000dce70] Trace 0x7fb7cc8235d0 [ffffffc0000dce70] Trace 0x7fb7cc822fd0 [ffffffc0000dd52c] Signed-off-by: Peter Maydell Signed-off-by: Alex Bennée [AJB: reword patch title, Abandoned->Stopped] Reviewed-by: Aurelien Jarno Reviewed-by: Richard Henderson Message-Id: <1458052224-9316-6-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- cpu-exec.c | 20 +++++++++++--------- include/exec/exec-all.h | 3 +++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index fd92452f16..6206cdf385 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -133,10 +133,14 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) #endif /* CONFIG USER ONLY */ /* Execute a TB, and fix up the CPU state afterwards if necessary */ -static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr) +static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb) { CPUArchState *env = cpu->env_ptr; uintptr_t next_tb; + uint8_t *tb_ptr = itb->tc_ptr; + + qemu_log_mask(CPU_LOG_EXEC, "Trace %p [" TARGET_FMT_lx "] %s\n", + itb->tc_ptr, itb->pc, lookup_symbol(itb->pc)); #if defined(DEBUG_DISAS) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { @@ -167,6 +171,10 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, uint8_t *tb_ptr) */ CPUClass *cc = CPU_GET_CLASS(cpu); TranslationBlock *tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); + qemu_log_mask(CPU_LOG_EXEC, + "Stopped execution of TB chain before %p [" + TARGET_FMT_lx "] %s\n", + itb->tc_ptr, itb->pc, lookup_symbol(itb->pc)); if (cc->synchronize_from_tb) { cc->synchronize_from_tb(cpu, tb); } else { @@ -202,7 +210,7 @@ static void cpu_exec_nocache(CPUState *cpu, int max_cycles, cpu->current_tb = tb; /* execute the generated code */ trace_exec_tb_nocache(tb, tb->pc); - cpu_tb_exec(cpu, tb->tc_ptr); + cpu_tb_exec(cpu, tb); cpu->current_tb = NULL; tb_phys_invalidate(tb, -1); tb_free(tb); @@ -344,7 +352,6 @@ int cpu_exec(CPUState *cpu) #endif int ret, interrupt_request; TranslationBlock *tb; - uint8_t *tc_ptr; uintptr_t next_tb; SyncClocks sc; @@ -500,10 +507,6 @@ int cpu_exec(CPUState *cpu) next_tb = 0; tcg_ctx.tb_ctx.tb_invalidated_flag = 0; } - if (qemu_loglevel_mask(CPU_LOG_EXEC)) { - qemu_log("Trace %p [" TARGET_FMT_lx "] %s\n", - tb->tc_ptr, tb->pc, lookup_symbol(tb->pc)); - } /* see if we can patch the calling TB. When the TB spans two pages, we cannot safely do a direct jump. */ @@ -515,10 +518,9 @@ int cpu_exec(CPUState *cpu) tb_unlock(); if (likely(!cpu->exit_request)) { trace_exec_tb(tb, tb->pc); - tc_ptr = tb->tc_ptr; /* execute the generated code */ cpu->current_tb = tb; - next_tb = cpu_tb_exec(cpu, tc_ptr); + next_tb = cpu_tb_exec(cpu, tb); cpu->current_tb = NULL; switch (next_tb & TB_EXIT_MASK) { case TB_EXIT_REQUESTED: diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 05a151da4a..1823ee3c78 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -379,6 +379,9 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, { /* NOTE: this test is only needed for thread safety */ if (!tb->jmp_next[n]) { + qemu_log_mask(CPU_LOG_EXEC, "Linking TBs %p [" TARGET_FMT_lx + "] index %d -> %p [" TARGET_FMT_lx "]\n", + tb->tc_ptr, tb->pc, n, tb_next->tc_ptr, tb_next->pc); /* patch the native jump address */ tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr); From 3514552e04388d8e7686bcf89efd022e892acb5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 15 Mar 2016 14:30:20 +0000 Subject: [PATCH 20/28] qemu-log: new option -dfilter to limit output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When debugging big programs or system emulation sometimes you want both the verbosity of cpu,exec et all but don't want to generate lots of logs for unneeded stuff. This patch adds a new option -dfilter which allows you to specify interesting address ranges in the form: -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,... Then logging code can use the new qemu_log_in_addr_range() function to decide if it will output logging information for the given range. Signed-off-by: Alex Bennée Message-Id: <1458052224-9316-7-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/log.h | 2 + qemu-options.hx | 18 ++++++++ tests/Makefile | 4 ++ tests/test-logging.c | 107 +++++++++++++++++++++++++++++++++++++++++++ util/log.c | 87 +++++++++++++++++++++++++++++++++++ vl.c | 3 ++ 6 files changed, 221 insertions(+) create mode 100644 tests/test-logging.c diff --git a/include/qemu/log.h b/include/qemu/log.h index 523c886078..1d0222dd2e 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -122,6 +122,8 @@ static inline void qemu_set_log(int log_flags) } void qemu_set_log_filename(const char *filename); +void qemu_set_dfilter_ranges(const char *ranges); +bool qemu_log_in_addr_range(uint64_t addr); int qemu_str_to_log_mask(const char *str); /* Print a usage message listing all the valid logging categories diff --git a/qemu-options.hx b/qemu-options.hx index 732ed8cbc5..c8bb70cf7c 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3163,6 +3163,24 @@ STEXI Output log in @var{logfile} instead of to stderr ETEXI +DEF("dfilter", HAS_ARG, QEMU_OPTION_DFILTER, \ + "-dfilter range,.. filter debug output to range of addresses (useful for -d cpu,exec,etc..)\n", + QEMU_ARCH_ALL) +STEXI +@item -dfilter @var{range1}[,...] +@findex -dfilter +Filter debug output to that relevant to a range of target addresses. The filter +spec can be either @var{start}+@var{size}, @var{start}-@var{size} or +@var{start}..@var{end} where @var{start} @var{end} and @var{size} are the +addresses and sizes required. For example: +@example + -dfilter 0x8000..0x8fff,0xffffffc000080000+0x200,0xffffffc000060000-0x1000 +@end example +Will dump output for any code in the 0x1000 sized block starting at 0x8000 and +the 0x200 sized block starting at 0xffffffc000080000 and another 0x1000 sized +block starting at 0xffffffc00005f000. +ETEXI + DEF("L", HAS_ARG, QEMU_OPTION_L, \ "-L path set the directory for the BIOS, VGA BIOS and keymaps\n", QEMU_ARCH_ALL) diff --git a/tests/Makefile b/tests/Makefile index 60371ca008..d27e31d2b7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -97,6 +97,8 @@ check-unit-y += tests/test-crypto-ivgen$(EXESUF) check-unit-y += tests/test-crypto-afsplit$(EXESUF) check-unit-y += tests/test-crypto-xts$(EXESUF) check-unit-y += tests/test-crypto-block$(EXESUF) +gcov-files-test-logging-y = tests/test-logging.c +check-unit-y += tests/test-logging$(EXESUF) check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh @@ -436,6 +438,8 @@ tests/test-timed-average$(EXESUF): tests/test-timed-average.o qemu-timer.o \ tests/test-base64$(EXESUF): tests/test-base64.o \ libqemuutil.a libqemustub.a +tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y) + tests/test-qapi-types.c tests/test-qapi-types.h :\ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \ diff --git a/tests/test-logging.c b/tests/test-logging.c new file mode 100644 index 0000000000..193fa9213e --- /dev/null +++ b/tests/test-logging.c @@ -0,0 +1,107 @@ +/* + * logging unit-tests + * + * Copyright (C) 2016 Linaro Ltd. + * + * Author: Alex Bennée + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include + +#include "qemu-common.h" +#include "include/qemu/log.h" + +static void test_parse_range(void) +{ + qemu_set_dfilter_ranges("0x1000+0x100"); + + g_assert_false(qemu_log_in_addr_range(0xfff)); + g_assert(qemu_log_in_addr_range(0x1000)); + g_assert(qemu_log_in_addr_range(0x1001)); + g_assert(qemu_log_in_addr_range(0x10ff)); + g_assert_false(qemu_log_in_addr_range(0x1100)); + + qemu_set_dfilter_ranges("0x1000-0x100"); + + g_assert_false(qemu_log_in_addr_range(0x1001)); + g_assert(qemu_log_in_addr_range(0x1000)); + g_assert(qemu_log_in_addr_range(0x0f01)); + g_assert_false(qemu_log_in_addr_range(0x0f00)); + + qemu_set_dfilter_ranges("0x1000..0x1100"); + + g_assert_false(qemu_log_in_addr_range(0xfff)); + g_assert(qemu_log_in_addr_range(0x1000)); + g_assert(qemu_log_in_addr_range(0x1100)); + g_assert_false(qemu_log_in_addr_range(0x1101)); + + qemu_set_dfilter_ranges("0x1000..0x1000"); + + g_assert_false(qemu_log_in_addr_range(0xfff)); + g_assert(qemu_log_in_addr_range(0x1000)); + g_assert_false(qemu_log_in_addr_range(0x1001)); + + qemu_set_dfilter_ranges("0x1000+0x100,0x2100-0x100,0x3000..0x3100"); + g_assert(qemu_log_in_addr_range(0x1050)); + g_assert(qemu_log_in_addr_range(0x2050)); + g_assert(qemu_log_in_addr_range(0x3050)); +} + +#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS +static void test_parse_invalid_range_subprocess(void) +{ + qemu_set_dfilter_ranges("0x1000+onehundred"); +} +static void test_parse_invalid_range(void) +{ + g_test_trap_subprocess("/logging/parse_invalid_range/subprocess", 0, 0); + g_test_trap_assert_failed(); + g_test_trap_assert_stdout(""); + g_test_trap_assert_stderr("*Failed to parse range in: 0x1000+onehundred\n"); +} +static void test_parse_zero_range_subprocess(void) +{ + qemu_set_dfilter_ranges("0x1000+0"); +} +static void test_parse_zero_range(void) +{ + g_test_trap_subprocess("/logging/parse_zero_range/subprocess", 0, 0); + g_test_trap_assert_failed(); + g_test_trap_assert_stdout(""); + g_test_trap_assert_stderr("*Failed to parse range in: 0x1000+0\n"); +} +#endif + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/logging/parse_range", test_parse_range); +#ifdef CONFIG_HAS_GLIB_SUBPROCESS_TESTS + g_test_add_func("/logging/parse_invalid_range/subprocess", test_parse_invalid_range_subprocess); + g_test_add_func("/logging/parse_invalid_range", test_parse_invalid_range); + g_test_add_func("/logging/parse_zero_range/subprocess", test_parse_zero_range_subprocess); + g_test_add_func("/logging/parse_zero_range", test_parse_zero_range); +#endif + + return g_test_run(); +} diff --git a/util/log.c b/util/log.c index 4e69586a73..671b6174e4 100644 --- a/util/log.c +++ b/util/log.c @@ -20,12 +20,16 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/log.h" +#include "qemu/range.h" +#include "qemu/error-report.h" +#include "qemu/cutils.h" #include "trace/control.h" static char *logfilename; FILE *qemu_logfile; int qemu_loglevel; static int log_append = 0; +static GArray *debug_regions; void qemu_log(const char *fmt, ...) { @@ -94,6 +98,89 @@ void qemu_set_log_filename(const char *filename) qemu_set_log(qemu_loglevel); } +/* Returns true if addr is in our debug filter or no filter defined + */ +bool qemu_log_in_addr_range(uint64_t addr) +{ + if (debug_regions) { + int i = 0; + for (i = 0; i < debug_regions->len; i++) { + struct Range *range = &g_array_index(debug_regions, Range, i); + if (addr >= range->begin && addr <= range->end) { + return true; + } + } + return false; + } else { + return true; + } +} + + +void qemu_set_dfilter_ranges(const char *filter_spec) +{ + gchar **ranges = g_strsplit(filter_spec, ",", 0); + if (ranges) { + gchar **next = ranges; + gchar *r = *next++; + debug_regions = g_array_sized_new(FALSE, FALSE, + sizeof(Range), g_strv_length(ranges)); + while (r) { + char *range_op = strstr(r, "-"); + char *r2 = range_op ? range_op + 1 : NULL; + if (!range_op) { + range_op = strstr(r, "+"); + r2 = range_op ? range_op + 1 : NULL; + } + if (!range_op) { + range_op = strstr(r, ".."); + r2 = range_op ? range_op + 2 : NULL; + } + if (range_op) { + const char *e = NULL; + uint64_t r1val, r2val; + + if ((qemu_strtoull(r, &e, 0, &r1val) == 0) && + (qemu_strtoull(r2, NULL, 0, &r2val) == 0) && + r2val > 0) { + struct Range range; + + g_assert(e == range_op); + + switch (*range_op) { + case '+': + { + range.begin = r1val; + range.end = r1val + (r2val - 1); + break; + } + case '-': + { + range.end = r1val; + range.begin = r1val - (r2val - 1); + break; + } + case '.': + range.begin = r1val; + range.end = r2val; + break; + default: + g_assert_not_reached(); + } + g_array_append_val(debug_regions, range); + + } else { + g_error("Failed to parse range in: %s", r); + } + } else { + g_error("Bad range specifier in: %s", r); + } + r = *next++; + } + g_strfreev(ranges); + } +} + const QEMULogItem qemu_log_items[] = { { CPU_LOG_TB_OUT_ASM, "out_asm", "show generated host assembly code for each compiled TB" }, diff --git a/vl.c b/vl.c index 6566da22d3..ae35176df4 100644 --- a/vl.c +++ b/vl.c @@ -3355,6 +3355,9 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_D: log_file = optarg; break; + case QEMU_OPTION_DFILTER: + qemu_set_dfilter_ranges(optarg); + break; case QEMU_OPTION_s: add_device_config(DEV_GDB, "tcp::" DEFAULT_GDBSTUB_PORT); break; From d977e1c2dbc9e63454b2000f91954d02543bf43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 15 Mar 2016 14:30:21 +0000 Subject: [PATCH 21/28] qemu-log: dfilter-ise exec, out_asm, op and opt_op MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures the code generation debug code will honour -dfilter if set. For the "exec" tracing I've added a new inline macro for efficiency's sake. Signed-off-by: Alex Bennée Reviewed-by: Aurelien Jarno Reviewed-by: Richard Henderson Message-Id: <1458052224-9316-8-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- cpu-exec.c | 13 +++++++------ include/exec/exec-all.h | 8 +++++--- include/qemu/log.h | 15 +++++++++++++++ tcg/tcg.c | 6 ++++-- translate-all.c | 3 ++- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 6206cdf385..bbfcbfb543 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -139,8 +139,9 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb) uintptr_t next_tb; uint8_t *tb_ptr = itb->tc_ptr; - qemu_log_mask(CPU_LOG_EXEC, "Trace %p [" TARGET_FMT_lx "] %s\n", - itb->tc_ptr, itb->pc, lookup_symbol(itb->pc)); + qemu_log_mask_and_addr(CPU_LOG_EXEC, itb->pc, + "Trace %p [" TARGET_FMT_lx "] %s\n", + itb->tc_ptr, itb->pc, lookup_symbol(itb->pc)); #if defined(DEBUG_DISAS) if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) { @@ -171,10 +172,10 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb) */ CPUClass *cc = CPU_GET_CLASS(cpu); TranslationBlock *tb = (TranslationBlock *)(next_tb & ~TB_EXIT_MASK); - qemu_log_mask(CPU_LOG_EXEC, - "Stopped execution of TB chain before %p [" - TARGET_FMT_lx "] %s\n", - itb->tc_ptr, itb->pc, lookup_symbol(itb->pc)); + qemu_log_mask_and_addr(CPU_LOG_EXEC, itb->pc, + "Stopped execution of TB chain before %p [" + TARGET_FMT_lx "] %s\n", + itb->tc_ptr, itb->pc, lookup_symbol(itb->pc)); if (cc->synchronize_from_tb) { cc->synchronize_from_tb(cpu, tb); } else { diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 1823ee3c78..736209505a 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -379,9 +379,11 @@ static inline void tb_add_jump(TranslationBlock *tb, int n, { /* NOTE: this test is only needed for thread safety */ if (!tb->jmp_next[n]) { - qemu_log_mask(CPU_LOG_EXEC, "Linking TBs %p [" TARGET_FMT_lx - "] index %d -> %p [" TARGET_FMT_lx "]\n", - tb->tc_ptr, tb->pc, n, tb_next->tc_ptr, tb_next->pc); + qemu_log_mask_and_addr(CPU_LOG_EXEC, tb->pc, + "Linking TBs %p [" TARGET_FMT_lx + "] index %d -> %p [" TARGET_FMT_lx "]\n", + tb->tc_ptr, tb->pc, n, + tb_next->tc_ptr, tb_next->pc); /* patch the native jump address */ tb_set_jmp_target(tb, n, (uintptr_t)tb_next->tc_ptr); diff --git a/include/qemu/log.h b/include/qemu/log.h index 1d0222dd2e..cf38adbdb0 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -78,6 +78,21 @@ qemu_log_vprintf(const char *fmt, va_list va) } \ } while (0) +/* log only if a bit is set on the current loglevel mask + * and we are in the address range we care about: + * @mask: bit to check in the mask + * @addr: address to check in dfilter + * @fmt: printf-style format string + * @args: optional arguments for format string + */ +#define qemu_log_mask_and_addr(MASK, ADDR, FMT, ...) \ + do { \ + if (unlikely(qemu_loglevel_mask(MASK)) && \ + qemu_log_in_addr_range(ADDR)) { \ + qemu_log(FMT, ## __VA_ARGS__); \ + } \ + } while (0) + /* Maintenance: */ /* fflush() the log file */ diff --git a/tcg/tcg.c b/tcg/tcg.c index f1f1640c9b..b46bf1acdf 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2351,7 +2351,8 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) #endif #ifdef DEBUG_DISAS - if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) { + if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP) + && qemu_log_in_addr_range(tb->pc))) { qemu_log("OP:\n"); tcg_dump_ops(s); qemu_log("\n"); @@ -2378,7 +2379,8 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb) #endif #ifdef DEBUG_DISAS - if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) { + if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT) + && qemu_log_in_addr_range(tb->pc))) { qemu_log("OP after optimization and liveness analysis:\n"); tcg_dump_ops(s); qemu_log("\n"); diff --git a/translate-all.c b/translate-all.c index b3207fe274..b4df1ec68f 100644 --- a/translate-all.c +++ b/translate-all.c @@ -1137,7 +1137,8 @@ TranslationBlock *tb_gen_code(CPUState *cpu, #endif #ifdef DEBUG_DISAS - if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) { + if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) && + qemu_log_in_addr_range(tb->pc)) { qemu_log("OUT: [size=%d]\n", gen_code_size); log_disas(tb->tc_ptr, gen_code_size); qemu_log("\n"); From 064860778bf1539f95c886fef86080aa132ca1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 15 Mar 2016 14:30:22 +0000 Subject: [PATCH 22/28] target-arm: dfilter support for in_asm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each individual architecture needs to use the qemu_log_in_addr_range() feature for enabling in_asm output as it is part of the frontend. Signed-off-by: Alex Bennée Reviewed-by: Aurelien Jarno Reviewed-by: Richard Henderson Message-Id: <1458052224-9316-9-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- target-arm/translate-a64.c | 3 ++- target-arm/translate.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index f0c73df5b0..b13cff756a 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -11225,7 +11225,8 @@ done_generating: gen_tb_end(tb, num_insns); #ifdef DEBUG_DISAS - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { + if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && + qemu_log_in_addr_range(pc_start)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(cs, pc_start, dc->pc - pc_start, diff --git a/target-arm/translate.c b/target-arm/translate.c index 5a818afc02..940ec8d981 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -11958,7 +11958,8 @@ done_generating: gen_tb_end(tb, num_insns); #ifdef DEBUG_DISAS - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { + if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && + qemu_log_in_addr_range(pc_start)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(cs, pc_start, dc->pc - pc_start, From f6880b7f48ffd4aa038d7a964a3820b1c18d5307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 15 Mar 2016 14:30:23 +0000 Subject: [PATCH 23/28] qemu-log: support simple pid substitution for logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When debugging stuff that occurs over several forks it would be useful not to keep overwriting the one logfile you've set-up. This allows a simple %d to be included once in the logfile parameter which is substituted with getpid(). As the test cases involve checking user output they need g_test_trap_subprocess() support. As a result they are currently skipped on Travis builds due to the older glib involved. Signed-off-by: Alex Bennée Reviewed-by: Leandro Dorileo Reviewed-by: Aurelien Jarno Reviewed-by: Richard Henderson Message-Id: <1458052224-9316-10-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- tests/test-logging.c | 36 +++++++++++++++++++++++++++++++++++- util/log.c | 21 +++++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/tests/test-logging.c b/tests/test-logging.c index 193fa9213e..ac8deedc9a 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -89,7 +89,37 @@ static void test_parse_zero_range(void) g_test_trap_assert_stdout(""); g_test_trap_assert_stderr("*Failed to parse range in: 0x1000+0\n"); } -#endif + +/* As the only real failure from a bad log filename path spec is + * reporting to the user we have to use the g_test_trap_subprocess + * mechanism and check no errors reported on stderr. + */ +static void test_parse_path_subprocess(void) +{ + /* All these should work without issue */ + qemu_set_log_filename("/tmp/qemu.log"); + qemu_set_log_filename("/tmp/qemu-%d.log"); + qemu_set_log_filename("/tmp/qemu.log.%d"); +} +static void test_parse_path(void) +{ + g_test_trap_subprocess ("/logging/parse_path/subprocess", 0, 0); + g_test_trap_assert_passed(); + g_test_trap_assert_stdout(""); + g_test_trap_assert_stderr(""); +} +static void test_parse_invalid_path_subprocess(void) +{ + qemu_set_log_filename("/tmp/qemu-%d%d.log"); +} +static void test_parse_invalid_path(void) +{ + g_test_trap_subprocess ("/logging/parse_invalid_path/subprocess", 0, 0); + g_test_trap_assert_passed(); + g_test_trap_assert_stdout(""); + g_test_trap_assert_stderr("Bad logfile format: /tmp/qemu-%d%d.log\n"); +} +#endif /* CONFIG_HAS_GLIB_SUBPROCESS_TESTS */ int main(int argc, char **argv) { @@ -101,6 +131,10 @@ int main(int argc, char **argv) g_test_add_func("/logging/parse_invalid_range", test_parse_invalid_range); g_test_add_func("/logging/parse_zero_range/subprocess", test_parse_zero_range_subprocess); g_test_add_func("/logging/parse_zero_range", test_parse_zero_range); + g_test_add_func("/logging/parse_path", test_parse_path); + g_test_add_func("/logging/parse_path/subprocess", test_parse_path_subprocess); + g_test_add_func("/logging/parse_invalid_path", test_parse_invalid_path); + g_test_add_func("/logging/parse_invalid_path/subprocess", test_parse_invalid_path_subprocess); #endif return g_test_run(); diff --git a/util/log.c b/util/log.c index 671b6174e4..b219081e91 100644 --- a/util/log.c +++ b/util/log.c @@ -89,11 +89,28 @@ void do_qemu_set_log(int log_flags, bool use_own_buffers) qemu_log_close(); } } - +/* + * Allow the user to include %d in their logfile which will be + * substituted with the current PID. This is useful for debugging many + * nested linux-user tasks but will result in lots of logs. + */ void qemu_set_log_filename(const char *filename) { + char *pidstr; g_free(logfilename); - logfilename = g_strdup(filename); + + pidstr = strstr(filename, "%"); + if (pidstr) { + /* We only accept one %d, no other format strings */ + if (pidstr[1] != 'd' || strchr(pidstr + 2, '%')) { + error_report("Bad logfile format: %s", filename); + logfilename = NULL; + } else { + logfilename = g_strdup_printf(filename, getpid()); + } + } else { + logfilename = g_strdup(filename); + } qemu_log_close(); qemu_set_log(qemu_loglevel); } From 8526e1f4e418443a4d6ed0714487e47d45ef9c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 15 Mar 2016 14:30:24 +0000 Subject: [PATCH 24/28] cputlb: modernise the debug support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid cluttering the code with #ifdef legs we wrap up the print statements into a tlb_debug() macro. As access to the virtual TLB can get quite heavy defining DEBUG_TLB_LOG will ensure all the logs go to the qemu_log target of CPU_LOG_MMU instead of stderr. This remains compile time optional as these debug statements haven't been considered for usefulness for user visible logging. I've also removed DEBUG_TLB_CHECK which wasn't used. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <1458052224-9316-11-git-send-email-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- cputlb.c | 88 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/cputlb.c b/cputlb.c index 2f7a166491..466663b56c 100644 --- a/cputlb.c +++ b/cputlb.c @@ -30,8 +30,30 @@ #include "exec/ram_addr.h" #include "tcg/tcg.h" -//#define DEBUG_TLB -//#define DEBUG_TLB_CHECK +/* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */ +/* #define DEBUG_TLB */ +/* #define DEBUG_TLB_LOG */ + +#ifdef DEBUG_TLB +# define DEBUG_TLB_GATE 1 +# ifdef DEBUG_TLB_LOG +# define DEBUG_TLB_LOG_GATE 1 +# else +# define DEBUG_TLB_LOG_GATE 0 +# endif +#else +# define DEBUG_TLB_GATE 0 +# define DEBUG_TLB_LOG_GATE 0 +#endif + +#define tlb_debug(fmt, ...) do { \ + if (DEBUG_TLB_LOG_GATE) { \ + qemu_log_mask(CPU_LOG_MMU, "%s: " fmt, __func__, \ + ## __VA_ARGS__); \ + } else if (DEBUG_TLB_GATE) { \ + fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); \ + } \ +} while (0) /* statistics */ int tlb_flush_count; @@ -52,9 +74,8 @@ void tlb_flush(CPUState *cpu, int flush_global) { CPUArchState *env = cpu->env_ptr; -#if defined(DEBUG_TLB) - printf("tlb_flush:\n"); -#endif + tlb_debug("(%d)\n", flush_global); + /* must reset current TB so that interrupts cannot modify the links while we are modifying them */ cpu->current_tb = NULL; @@ -73,9 +94,7 @@ static inline void v_tlb_flush_by_mmuidx(CPUState *cpu, va_list argp) { CPUArchState *env = cpu->env_ptr; -#if defined(DEBUG_TLB) - printf("tlb_flush_by_mmuidx:"); -#endif + tlb_debug("start\n"); /* must reset current TB so that interrupts cannot modify the links while we are modifying them */ cpu->current_tb = NULL; @@ -87,18 +106,12 @@ static inline void v_tlb_flush_by_mmuidx(CPUState *cpu, va_list argp) break; } -#if defined(DEBUG_TLB) - printf(" %d", mmu_idx); -#endif + tlb_debug("%d\n", mmu_idx); memset(env->tlb_table[mmu_idx], -1, sizeof(env->tlb_table[0])); memset(env->tlb_v_table[mmu_idx], -1, sizeof(env->tlb_v_table[0])); } -#if defined(DEBUG_TLB) - printf("\n"); -#endif - memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache)); } @@ -128,16 +141,14 @@ void tlb_flush_page(CPUState *cpu, target_ulong addr) int i; int mmu_idx; -#if defined(DEBUG_TLB) - printf("tlb_flush_page: " TARGET_FMT_lx "\n", addr); -#endif + tlb_debug("page :" TARGET_FMT_lx "\n", addr); + /* Check if we need to flush due to large pages. */ if ((addr & env->tlb_flush_mask) == env->tlb_flush_addr) { -#if defined(DEBUG_TLB) - printf("tlb_flush_page: forced full flush (" - TARGET_FMT_lx "/" TARGET_FMT_lx ")\n", - env->tlb_flush_addr, env->tlb_flush_mask); -#endif + tlb_debug("forcing full flush (" + TARGET_FMT_lx "/" TARGET_FMT_lx ")\n", + env->tlb_flush_addr, env->tlb_flush_mask); + tlb_flush(cpu, 1); return; } @@ -170,16 +181,14 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, ...) va_start(argp, addr); -#if defined(DEBUG_TLB) - printf("tlb_flush_page_by_mmu_idx: " TARGET_FMT_lx, addr); -#endif + tlb_debug("addr "TARGET_FMT_lx"\n", addr); + /* Check if we need to flush due to large pages. */ if ((addr & env->tlb_flush_mask) == env->tlb_flush_addr) { -#if defined(DEBUG_TLB) - printf(" forced full flush (" - TARGET_FMT_lx "/" TARGET_FMT_lx ")\n", - env->tlb_flush_addr, env->tlb_flush_mask); -#endif + tlb_debug("forced full flush (" + TARGET_FMT_lx "/" TARGET_FMT_lx ")\n", + env->tlb_flush_addr, env->tlb_flush_mask); + v_tlb_flush_by_mmuidx(cpu, argp); va_end(argp); return; @@ -198,9 +207,7 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, ...) break; } -#if defined(DEBUG_TLB) - printf(" %d", mmu_idx); -#endif + tlb_debug("idx %d\n", mmu_idx); tlb_flush_entry(&env->tlb_table[mmu_idx][i], addr); @@ -211,10 +218,6 @@ void tlb_flush_page_by_mmuidx(CPUState *cpu, target_ulong addr, ...) } va_end(argp); -#if defined(DEBUG_TLB) - printf("\n"); -#endif - tb_flush_jmp_cache(cpu, addr); } @@ -367,12 +370,9 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr, section = address_space_translate_for_iotlb(cpu, asidx, paddr, &xlat, &sz); assert(sz >= TARGET_PAGE_SIZE); -#if defined(DEBUG_TLB) - qemu_log_mask(CPU_LOG_MMU, - "tlb_set_page: vaddr=" TARGET_FMT_lx " paddr=0x" TARGET_FMT_plx - " prot=%x idx=%d\n", - vaddr, paddr, prot, mmu_idx); -#endif + tlb_debug("vaddr=" TARGET_FMT_lx " paddr=0x" TARGET_FMT_plx + " prot=%x idx=%d\n", + vaddr, paddr, prot, mmu_idx); address = vaddr; if (!memory_region_is_ram(section->mr) && !memory_region_is_romd(section->mr)) { From 5c3ece79cd0b7b4ed065f4285e7a0262bbfc283b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 17 Mar 2016 15:53:13 +0100 Subject: [PATCH 25/28] exec: fix error handling in file_ram_alloc One instance of double closing, and invalid close(-1) in some cases of "goto error". Reviewed-by: Laszlo Ersek Signed-off-by: Paolo Bonzini --- exec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exec.c b/exec.c index be2a644619..f46e596818 100644 --- a/exec.c +++ b/exec.c @@ -1239,7 +1239,7 @@ static void *file_ram_alloc(RAMBlock *block, char *sanitized_name; char *c; void *area; - int fd; + int fd = -1; int64_t page_size; if (kvm_enabled() && !kvm_has_sync_mmu()) { @@ -1321,7 +1321,6 @@ static void *file_ram_alloc(RAMBlock *block, if (area == MAP_FAILED) { error_setg_errno(errp, errno, "unable to map backing store for guest RAM"); - close(fd); goto error; } @@ -1336,7 +1335,9 @@ error: if (unlink_on_error) { unlink(path); } - close(fd); + if (fd != -1) { + close(fd); + } return NULL; } #endif From b6572b4f97a7b126c7b24e165893ed9fe3d72e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 11 Mar 2016 18:55:24 +0100 Subject: [PATCH 26/28] char: translate from QIOChannel error to errno MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Caller of CharDriverState.chr* callback assume errno error conventions. Translate QIOChannel error to errno (this fixes potential EAGAIN regression, for ex if a vhost-user backend block, qemu_chr_fe_read_all() could get error -2 and not wait) Signed-off-by: Marc-André Lureau Message-Id: <1457718924-19338-1-git-send-email-marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrange Signed-off-by: Paolo Bonzini --- qemu-char.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qemu-char.c b/qemu-char.c index 97aaaae439..270819aec3 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2799,6 +2799,13 @@ static ssize_t tcp_chr_recv(CharDriverState *chr, char *buf, size_t len) NULL); } + if (ret == QIO_CHANNEL_ERR_BLOCK) { + errno = EAGAIN; + ret = -1; + } else if (ret == -1) { + errno = EIO; + } + if (msgfds_num) { /* close and clean read_msgfds */ for (i = 0; i < s->read_msgfds_num; i++) { From cf7cc9291bf7f2f6470815db876ed28eb474ea52 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Tue, 12 Jan 2016 11:58:48 +0000 Subject: [PATCH 27/28] config.status: Pass extra parameters This allows you to do: ./config.status --the-option-you-forgot Signed-off-by: Dr. David Alan Gilbert Message-Id: <1452599928-7471-1-git-send-email-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index b88d0dbbf9..2f7600a783 100755 --- a/configure +++ b/configure @@ -5942,7 +5942,7 @@ cat <config.status EOD printf "exec" >>config.status printf " '%s'" "$0" "$@" >>config.status -echo >>config.status +echo ' "$@"' >>config.status chmod +x config.status rm -r "$TMPDIR1" From 0f70ed4759a29ca932af1e9525729f4f455642f8 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 9 Feb 2016 14:14:28 +0100 Subject: [PATCH 28/28] target-i386: implement PKE for TCG Tested with kvm-unit-tests. Signed-off-by: Paolo Bonzini --- target-i386/cpu.c | 13 ++++++++++--- target-i386/cpu.h | 6 +++++- target-i386/fpu_helper.c | 27 +++++++++++++++++++++++++++ target-i386/helper.c | 22 ++++++++++++++++++++++ target-i386/helper.h | 2 ++ target-i386/misc_helper.c | 27 +++++++++++++++++++++++++++ target-i386/translate.c | 18 +++++++++++++++++- 7 files changed, 110 insertions(+), 5 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index eee00d6bbd..ddae932ee1 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -361,7 +361,7 @@ static const char *cpuid_6_feature_name[] = { CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2, CPUID_7_0_EBX_ERMS, CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM, CPUID_7_0_EBX_RDSEED */ -#define TCG_7_0_ECX_FEATURES 0 +#define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE) #define TCG_APM_FEATURES 0 #define TCG_6_EAX_FEATURES CPUID_6_EAX_ARAT #define TCG_XSAVE_FEATURES (CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XGETBV1) @@ -2426,6 +2426,9 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, *eax = 0; /* Maximum ECX value for sub-leaves */ *ebx = env->features[FEAT_7_0_EBX]; /* Feature flags */ *ecx = env->features[FEAT_7_0_ECX]; /* Feature flags */ + if ((*ecx & CPUID_7_0_ECX_PKU) && env->cr[4] & CR4_PKE_MASK) { + *ecx |= CPUID_7_0_ECX_OSPKE; + } *edx = 0; /* Reserved */ } else { *eax = 0; @@ -2733,9 +2736,13 @@ static void x86_cpu_reset(CPUState *s) if (env->features[FEAT_1_EDX] & CPUID_SSE) { xcr0 |= XSTATE_SSE_MASK; } - if (env->features[FEAT_7_0_EBX] & CPUID_7_0_EBX_MPX) { - xcr0 |= XSTATE_BNDREGS_MASK | XSTATE_BNDCSR_MASK; + for (i = 2; i < ARRAY_SIZE(x86_ext_save_areas); i++) { + const ExtSaveArea *esa = &x86_ext_save_areas[i]; + if ((env->features[esa->feature] & esa->bits) == esa->bits) { + xcr0 |= 1ull << i; + } } + if (env->features[FEAT_1_ECX] & CPUID_EXT_XSAVE) { cr4 |= CR4_OSFXSR_MASK | CR4_OSXSAVE_MASK; } diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 5148c8252d..732eb6d7ec 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -232,6 +232,7 @@ #define CR4_OSXSAVE_MASK (1U << 18) #define CR4_SMEP_MASK (1U << 20) #define CR4_SMAP_MASK (1U << 21) +#define CR4_PKE_MASK (1U << 22) #define DR6_BD (1 << 13) #define DR6_BS (1 << 14) @@ -260,6 +261,7 @@ #define PG_PSE_BIT 7 #define PG_GLOBAL_BIT 8 #define PG_PSE_PAT_BIT 12 +#define PG_PKRU_BIT 59 #define PG_NX_BIT 63 #define PG_PRESENT_MASK (1 << PG_PRESENT_BIT) @@ -275,7 +277,8 @@ #define PG_ADDRESS_MASK 0x000ffffffffff000LL #define PG_HI_RSVD_MASK (PG_ADDRESS_MASK & ~PHYS_ADDR_MASK) #define PG_HI_USER_MASK 0x7ff0000000000000LL -#define PG_NX_MASK (1LL << PG_NX_BIT) +#define PG_PKRU_MASK (15ULL << PG_PKRU_BIT) +#define PG_NX_MASK (1ULL << PG_NX_BIT) #define PG_ERROR_W_BIT 1 @@ -284,6 +287,7 @@ #define PG_ERROR_U_MASK 0x04 #define PG_ERROR_RSVD_MASK 0x08 #define PG_ERROR_I_D_MASK 0x10 +#define PG_ERROR_PK_MASK 0x20 #define MCG_CTL_P (1ULL<<8) /* MCG_CAP register available */ #define MCG_SER_P (1ULL<<24) /* MCA recovery/new status bits */ diff --git a/target-i386/fpu_helper.c b/target-i386/fpu_helper.c index d1a7f4cbec..fee5573a10 100644 --- a/target-i386/fpu_helper.c +++ b/target-i386/fpu_helper.c @@ -1184,6 +1184,11 @@ static void do_xsave_bndcsr(CPUX86State *env, target_ulong addr, uintptr_t ra) cpu_stq_data_ra(env, addr + 8, env->bndcs_regs.sts, ra); } +static void do_xsave_pkru(CPUX86State *env, target_ulong addr, uintptr_t ra) +{ + cpu_stq_data_ra(env, addr, env->pkru, ra); +} + void helper_fxsave(CPUX86State *env, target_ulong ptr) { uintptr_t ra = GETPC(); @@ -1257,6 +1262,10 @@ static void do_xsave(CPUX86State *env, target_ulong ptr, uint64_t rfbm, target_ulong off = x86_ext_save_areas[XSTATE_BNDCSR_BIT].offset; do_xsave_bndcsr(env, ptr + off, ra); } + if (opt & XSTATE_PKRU_MASK) { + target_ulong off = x86_ext_save_areas[XSTATE_PKRU_BIT].offset; + do_xsave_pkru(env, ptr + off, ra); + } /* Update the XSTATE_BV field. */ old_bv = cpu_ldq_data_ra(env, ptr + 512, ra); @@ -1339,6 +1348,11 @@ static void do_xrstor_bndcsr(CPUX86State *env, target_ulong addr, uintptr_t ra) env->bndcs_regs.sts = cpu_ldq_data_ra(env, addr + 8, ra); } +static void do_xrstor_pkru(CPUX86State *env, target_ulong addr, uintptr_t ra) +{ + env->pkru = cpu_ldq_data_ra(env, addr, ra); +} + void helper_fxrstor(CPUX86State *env, target_ulong ptr) { uintptr_t ra = GETPC(); @@ -1438,6 +1452,19 @@ void helper_xrstor(CPUX86State *env, target_ulong ptr, uint64_t rfbm) } cpu_sync_bndcs_hflags(env); } + if (rfbm & XSTATE_PKRU_MASK) { + uint64_t old_pkru = env->pkru; + if (xstate_bv & XSTATE_PKRU_MASK) { + target_ulong off = x86_ext_save_areas[XSTATE_PKRU_BIT].offset; + do_xrstor_pkru(env, ptr + off, ra); + } else { + env->pkru = 0; + } + if (env->pkru != old_pkru) { + CPUState *cs = CPU(x86_env_get_cpu(env)); + tlb_flush(cs, 1); + } + } } uint64_t helper_xgetbv(CPUX86State *env, uint32_t ecx) diff --git a/target-i386/helper.c b/target-i386/helper.c index 3f60ec6122..575583942a 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -676,6 +676,10 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4) hflags |= HF_SMAP_MASK; } + if (!(env->features[FEAT_7_0_ECX] & CPUID_7_0_ECX_PKU)) { + new_cr4 &= ~CR4_PKE_MASK; + } + env->cr[4] = new_cr4; env->hflags = hflags; @@ -920,6 +924,24 @@ do_check_protect_pse36: goto do_fault_protect; } + if ((env->cr[4] & CR4_PKE_MASK) && (env->hflags & HF_LMA_MASK) && + (ptep & PG_USER_MASK) && env->pkru) { + uint32_t pk = (pte & PG_PKRU_MASK) >> PG_PKRU_BIT; + uint32_t pkru_ad = (env->pkru >> pk * 2) & 1; + uint32_t pkru_wd = (env->pkru >> pk * 2) & 2; + + if (pkru_ad) { + prot &= ~(PAGE_READ | PAGE_WRITE); + } else if (pkru_wd && (is_user || env->cr[0] & CR0_WP_MASK)) { + prot &= ~PAGE_WRITE; + } + if ((prot & (1 << is_write1)) == 0) { + assert(is_write1 != 2); + error_code |= PG_ERROR_PK_MASK; + goto do_fault_protect; + } + } + /* yes, it can! */ is_dirty = is_write && !(pte & PG_DIRTY_MASK); if (!(pte & PG_ACCESSED_MASK) || is_dirty) { diff --git a/target-i386/helper.h b/target-i386/helper.h index e33451aea9..1320edc016 100644 --- a/target-i386/helper.h +++ b/target-i386/helper.h @@ -198,6 +198,8 @@ DEF_HELPER_FLAGS_3(xsaveopt, TCG_CALL_NO_WG, void, env, tl, i64) DEF_HELPER_FLAGS_3(xrstor, TCG_CALL_NO_WG, void, env, tl, i64) DEF_HELPER_FLAGS_2(xgetbv, TCG_CALL_NO_WG, i64, env, i32) DEF_HELPER_FLAGS_3(xsetbv, TCG_CALL_NO_WG, void, env, i32, i64) +DEF_HELPER_FLAGS_2(rdpkru, TCG_CALL_NO_WG, i64, env, i32) +DEF_HELPER_FLAGS_3(wrpkru, TCG_CALL_NO_WG, void, env, i32, i64) DEF_HELPER_FLAGS_1(clz, TCG_CALL_NO_RWG_SE, tl, tl) DEF_HELPER_FLAGS_1(ctz, TCG_CALL_NO_RWG_SE, tl, tl) diff --git a/target-i386/misc_helper.c b/target-i386/misc_helper.c index 5fbab8fd0c..e31ec976a4 100644 --- a/target-i386/misc_helper.c +++ b/target-i386/misc_helper.c @@ -609,3 +609,30 @@ void helper_debug(CPUX86State *env) cs->exception_index = EXCP_DEBUG; cpu_loop_exit(cs); } + +uint64_t helper_rdpkru(CPUX86State *env, uint32_t ecx) +{ + if ((env->cr[4] & CR4_PKE_MASK) == 0) { + raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + } + if (ecx != 0) { + raise_exception_err_ra(env, EXCP0D_GPF, 0, GETPC()); + } + + return env->pkru; +} + +void helper_wrpkru(CPUX86State *env, uint32_t ecx, uint64_t val) +{ + CPUState *cs = CPU(x86_env_get_cpu(env)); + + if ((env->cr[4] & CR4_PKE_MASK) == 0) { + raise_exception_err_ra(env, EXCP06_ILLOP, 0, GETPC()); + } + if (ecx != 0 || (val & 0xFFFFFFFF00000000ull)) { + raise_exception_err_ra(env, EXCP0D_GPF, 0, GETPC()); + } + + env->pkru = val; + tlb_flush(cs, 1); +} diff --git a/target-i386/translate.c b/target-i386/translate.c index dd8d5cc360..1a1214dcb1 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7322,7 +7322,23 @@ static target_ulong disas_insn(CPUX86State *env, DisasContext *s, } gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 1); break; - + case 0xee: /* rdpkru */ + if (prefixes & PREFIX_LOCK) { + goto illegal_op; + } + tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_ECX]); + gen_helper_rdpkru(cpu_tmp1_i64, cpu_env, cpu_tmp2_i32); + tcg_gen_extr_i64_tl(cpu_regs[R_EAX], cpu_regs[R_EDX], cpu_tmp1_i64); + break; + case 0xef: /* wrpkru */ + if (prefixes & PREFIX_LOCK) { + goto illegal_op; + } + tcg_gen_concat_tl_i64(cpu_tmp1_i64, cpu_regs[R_EAX], + cpu_regs[R_EDX]); + tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_ECX]); + gen_helper_wrpkru(cpu_env, cpu_tmp2_i32, cpu_tmp1_i64); + break; CASE_MODRM_OP(6): /* lmsw */ if (s->cpl != 0) { gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);