diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-06-01 18:24:16 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-06-01 18:24:16 +0100 |
commit | afd76ffba966a072a7bbd0048bdf3b2ab69d3d4a (patch) | |
tree | 261752f0ee888216c16c9f97b8b3daa5dc7394d9 /hw | |
parent | 392fba9f583223786f844dce9b2e7f9a0ce0147a (diff) | |
parent | b5dfdb082fc350f3e68dfa61dc988d97cad28cfe (diff) | |
download | qemu-afd76ffba966a072a7bbd0048bdf3b2ab69d3d4a.zip qemu-afd76ffba966a072a7bbd0048bdf3b2ab69d3d4a.tar.gz qemu-afd76ffba966a072a7bbd0048bdf3b2ab69d3d4a.tar.bz2 |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* Linux header upgrade (Peter)
* firmware.json definition (Laszlo)
* IPMI migration fix (Corey)
* QOM improvements (Alexey, Philippe, me)
* Memory API cleanups (Jay, me, Tristan, Peter)
* WHPX fixes and improvements (Lucian)
* Chardev fixes (Marc-André)
* IOMMU documentation improvements (Peter)
* Coverity fixes (Peter, Philippe)
* Include cleanup (Philippe)
* -clock deprecation (Thomas)
* Disable -sandbox unless CONFIG_SECCOMP (Yi Min Zhao)
* Configurability improvements (me)
# gpg: Signature made Fri 01 Jun 2018 17:42:13 BST
# gpg: using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg: aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1
# Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83
* remotes/bonzini/tags/for-upstream: (56 commits)
hw: make virtio devices configurable via default-configs/
hw: allow compiling out SCSI
memory: Make operations using MemoryRegionIoeventfd struct pass by pointer.
char: Remove unwanted crlf conversion
qdev: Remove DeviceClass::init() and ::exit()
qdev: Simplify the SysBusDeviceClass::init path
hw/i2c: Use DeviceClass::realize instead of I2CSlaveClass::init
hw/i2c/smbus: Use DeviceClass::realize instead of SMBusDeviceClass::init
target/i386/kvm.c: Remove compatibility shim for KVM_HINTS_REALTIME
Update Linux headers to 4.17-rc6
target/i386/kvm.c: Handle renaming of KVM_HINTS_DEDICATED
scripts/update-linux-headers: Handle kernel license no longer being one file
scripts/update-linux-headers: Handle __aligned_u64
virtio-gpu-3d: Define VIRTIO_GPU_CAPSET_VIRGL2 elsewhere
gdbstub: Prevent fd leakage
docs/interop: add "firmware.json"
ipmi: Use proper struct reference for KCS vmstate
vmstate: Add a VSTRUCT type
tcg: remove softfloat from --disable-tcg builds
qemu-options: Mark the non-functional -clock option as deprecated
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
105 files changed, 165 insertions, 248 deletions
diff --git a/hw/9pfs/Makefile.objs b/hw/9pfs/Makefile.objs index fd90b62..e3fa673 100644 --- a/hw/9pfs/Makefile.objs +++ b/hw/9pfs/Makefile.objs @@ -1,3 +1,4 @@ +ifeq ($(call lor,$(CONFIG_VIRTIO_9P),$(CONFIG_XEN)),y) common-obj-y = 9p.o 9p-util.o common-obj-y += 9p-local.o 9p-xattr.o common-obj-y += 9p-xattr-user.o 9p-posix-acl.o @@ -5,6 +6,7 @@ common-obj-y += coth.o cofs.o codir.o cofile.o common-obj-y += coxattr.o 9p-synth.o common-obj-$(CONFIG_OPEN_BY_HANDLE) += 9p-handle.o common-obj-y += 9p-proxy.o -common-obj-$(CONFIG_XEN) += xen-9p-backend.o +endif -obj-$(CONFIG_VIRTIO) += virtio-9p-device.o +common-obj-$(CONFIG_XEN) += xen-9p-backend.o +obj-$(CONFIG_VIRTIO_9P) += virtio-9p-device.o diff --git a/hw/Makefile.objs b/hw/Makefile.objs index 6a0ffe0..a19c141 100644 --- a/hw/Makefile.objs +++ b/hw/Makefile.objs @@ -23,7 +23,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += nvram/ devices-dirs-$(CONFIG_SOFTMMU) += pci/ devices-dirs-$(CONFIG_PCI) += pci-bridge/ pci-host/ devices-dirs-$(CONFIG_SOFTMMU) += pcmcia/ -devices-dirs-$(CONFIG_SOFTMMU) += scsi/ +devices-dirs-$(CONFIG_SCSI) += scsi/ devices-dirs-$(CONFIG_SOFTMMU) += sd/ devices-dirs-$(CONFIG_SOFTMMU) += ssi/ devices-dirs-$(CONFIG_SOFTMMU) += timer/ diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 91c82fd..80d42e1 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -32,7 +32,6 @@ #include "hw/pci/pci.h" #include "hw/acpi/acpi.h" #include "sysemu/sysemu.h" -#include "exec/ioport.h" #include "exec/address-spaces.h" #include "hw/pci/pci_bus.h" #include "qapi/error.h" diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 8b70345..6404af5 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -28,7 +28,6 @@ #include "sysemu/sysemu.h" #include "qapi/error.h" #include "qemu/range.h" -#include "exec/ioport.h" #include "hw/nvram/fw_cfg.h" #include "exec/address-spaces.h" #include "hw/acpi/piix4.h" diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index aecb3c1..a7110a7 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -19,7 +19,6 @@ #include "hw/boards.h" #include "qemu/log.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "hw/loader.h" #include "qemu/error-report.h" diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 3c4b44a..6805a7d 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -15,7 +15,6 @@ #include "hw/arm/bcm2836.h" #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" -#include "exec/address-spaces.h" /* Peripheral base address seen by the CPU */ #define BCM2836_PERI_BASE 0x3F000000 diff --git a/hw/arm/collie.c b/hw/arm/collie.c index f8c566e..48b732c 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -16,7 +16,6 @@ #include "strongarm.h" #include "hw/arm/arm.h" #include "hw/block/flash.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "cpu.h" diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index ea2a3c5..56cb763 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -42,7 +42,6 @@ #include "hw/block/flash.h" #include "hw/devices.h" #include "hw/boards.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" #include "cpu.h" diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index 4215c02..0beb5c4 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -21,7 +21,6 @@ #include "hw/devices.h" #include "hw/boards.h" #include "hw/block/flash.h" -#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 32687af..906b7ca 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -35,7 +35,6 @@ #include "hw/hw.h" #include "hw/bt.h" #include "hw/loader.h" -#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "qemu/log.h" #include "exec/address-spaces.h" diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index e54c1f8..9af0472 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -28,8 +28,6 @@ #include "hw/arm/omap.h" #include "sysemu/sysemu.h" #include "hw/arm/soc_dma.h" -#include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "sysemu/qtest.h" #include "qemu/range.h" #include "hw/sysbus.h" diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index b8d0910..3c7d136 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -23,8 +23,6 @@ #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" -#include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "sysemu/qtest.h" #include "hw/boards.h" #include "hw/hw.h" diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index eccc19c..84550f0 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -33,7 +33,6 @@ #include "hw/boards.h" #include "hw/arm/arm.h" #include "hw/block/flash.h" -#include "sysemu/block-backend.h" #include "sysemu/qtest.h" #include "exec/address-spaces.h" #include "cpu.h" diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index a2803fd..b67b0ce 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -19,7 +19,6 @@ #include "hw/i2c/i2c.h" #include "hw/ssi/ssi.h" #include "chardev/char-fe.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "sysemu/qtest.h" #include "qemu/cutils.h" diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index e419e3c..3cc27a1 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -27,7 +27,6 @@ #include "hw/audio/wm8750.h" #include "audio/audio.h" #include "hw/boards.h" -#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" #include "cpu.h" diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index e01e319..a5a06b6 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -19,7 +19,6 @@ #include "hw/pci/pci.h" #include "hw/i2c/i2c.h" #include "hw/boards.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "hw/block/flash.h" #include "qemu/error-report.h" diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index f1e33c8..5bfe2e4 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -35,7 +35,6 @@ #include "hw/boards.h" #include "hw/loader.h" #include "exec/address-spaces.h" -#include "sysemu/block-backend.h" #include "hw/block/flash.h" #include "sysemu/device_tree.h" #include "qemu/error-report.h" diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a3a28e2..3aa19b2 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -38,7 +38,6 @@ #include "hw/vfio/vfio-amd-xgbe.h" #include "hw/devices.h" #include "net/net.h" -#include "sysemu/block-backend.h" #include "sysemu/device_tree.h" #include "sysemu/numa.h" #include "sysemu/sysemu.h" diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 899a263..f1496d2 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -26,7 +26,6 @@ #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/block/flash.h" -#include "sysemu/block-backend.h" #include "hw/loader.h" #include "hw/misc/zynq-xadc.h" #include "hw/ssi/ssi.h" diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index b126cf1..c70278c 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -22,7 +22,6 @@ #include "hw/arm/xlnx-zynqmp.h" #include "hw/boards.h" #include "qemu/error-report.h" -#include "exec/address-spaces.h" #include "qemu/log.h" #include "sysemu/qtest.h" diff --git a/hw/arm/z2.c b/hw/arm/z2.c index 730a539..697a822 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -21,7 +21,6 @@ #include "hw/boards.h" #include "sysemu/sysemu.h" #include "hw/block/flash.h" -#include "sysemu/block-backend.h" #include "ui/console.h" #include "hw/audio/wm8750.h" #include "audio/audio.h" diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index 416a78e..f4aa838 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -617,14 +617,12 @@ static const VMStateDescription vmstate_wm8750 = { } }; -static int wm8750_init(I2CSlave *i2c) +static void wm8750_realize(DeviceState *dev, Error **errp) { - WM8750State *s = WM8750(i2c); + WM8750State *s = WM8750(dev); AUD_register_card(CODEC, &s->card); wm8750_reset(I2C_SLAVE(s)); - - return 0; } #if 0 @@ -707,7 +705,7 @@ static void wm8750_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *sc = I2C_SLAVE_CLASS(klass); - sc->init = wm8750_init; + dc->realize = wm8750_realize; sc->event = wm8750_event; sc->recv = wm8750_rx; sc->send = wm8750_tx; diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs index 4c19a58..53ce575 100644 --- a/hw/block/Makefile.objs +++ b/hw/block/Makefile.objs @@ -11,8 +11,6 @@ common-obj-$(CONFIG_NVME_PCI) += nvme.o obj-$(CONFIG_SH4) += tc58128.o -obj-$(CONFIG_VIRTIO) += virtio-blk.o -obj-$(CONFIG_VIRTIO) += dataplane/ -ifeq ($(CONFIG_VIRTIO),y) +obj-$(CONFIG_VIRTIO_BLK) += virtio-blk.o +obj-$(CONFIG_VIRTIO_BLK) += dataplane/ obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk.o -endif diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 101f32c..d648aeb 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -19,7 +19,6 @@ #include "qemu/thread.h" #include "qemu/error-report.h" #include "hw/virtio/virtio-access.h" -#include "sysemu/block-backend.h" #include "hw/virtio/virtio-blk.h" #include "virtio-blk.h" #include "block/aio.h" diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index b49c8e9..a5ccffb 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -24,7 +24,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "hw/ssi/ssi.h" #include "qemu/bitops.h" #include "qemu/log.h" diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 85d2406..811084b 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -35,6 +35,7 @@ #include "sysemu/block-backend.h" #include "qemu/log.h" +#include "qemu/cutils.h" #include "trace.h" #include "nvme.h" diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 8f39811..cabcf20 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -1,6 +1,5 @@ #ifndef HW_NVME_H #define HW_NVME_H -#include "qemu/cutils.h" #include "block/nvme.h" typedef struct NvmeAsyncEvent { diff --git a/hw/block/onenand.c b/hw/block/onenand.c index ed77f85..0cb8d7f 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -25,9 +25,7 @@ #include "hw/block/flash.h" #include "hw/irq.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "exec/memory.h" -#include "exec/address-spaces.h" #include "hw/sysbus.h" #include "qemu/error-report.h" diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 2e82840..e4b5b3c 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -43,7 +43,6 @@ #include "qapi/error.h" #include "qemu/timer.h" #include "qemu/bitops.h" -#include "exec/address-spaces.h" #include "qemu/host-utils.h" #include "qemu/log.h" #include "hw/sysbus.h" diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 75d1ae1..a8b3f7f 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -41,7 +41,6 @@ #include "qapi/error.h" #include "qemu/timer.h" #include "sysemu/block-backend.h" -#include "exec/address-spaces.h" #include "qemu/host-utils.h" #include "hw/sysbus.h" diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index b1532e4..50b5c86 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -18,7 +18,6 @@ #include "qemu/error-report.h" #include "trace.h" #include "hw/block/block.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/virtio/virtio-blk.h" #include "dataplane/virtio-blk.h" diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs index 1b97910..b570531 100644 --- a/hw/char/Makefile.objs +++ b/hw/char/Makefile.objs @@ -6,7 +6,7 @@ common-obj-$(CONFIG_PL011) += pl011.o common-obj-$(CONFIG_SERIAL) += serial.o common-obj-$(CONFIG_SERIAL_ISA) += serial-isa.o common-obj-$(CONFIG_SERIAL_PCI) += serial-pci.o -common-obj-$(CONFIG_VIRTIO) += virtio-console.o +common-obj-$(CONFIG_VIRTIO_SERIAL) += virtio-console.o common-obj-$(CONFIG_XILINX) += xilinx_uartlite.o common-obj-$(CONFIG_XEN) += xen_console.o common-obj-$(CONFIG_CADENCE) += cadence_uart.o diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index faae083..787f985 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -10,7 +10,6 @@ #include "hw/sysbus.h" #include "hw/m68k/mcf.h" #include "chardev/char-fe.h" -#include "exec/address-spaces.h" typedef struct { SysBusDevice parent_obj; diff --git a/hw/char/serial.c b/hw/char/serial.c index 2c080c9..605b0d0 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -28,7 +28,6 @@ #include "chardev/char-serial.h" #include "qapi/error.h" #include "qemu/timer.h" -#include "exec/address-spaces.h" #include "qemu/error-report.h" //#define DEBUG_SERIAL diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c index 835b537..373a405 100644 --- a/hw/char/sh_serial.c +++ b/hw/char/sh_serial.c @@ -28,7 +28,6 @@ #include "hw/hw.h" #include "hw/sh4/sh.h" #include "chardev/char-fe.h" -#include "exec/address-spaces.h" #include "qapi/error.h" //#define DEBUG_SERIAL diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c index 0c4a720..6387854 100644 --- a/hw/core/loader-fit.c +++ b/hw/core/loader-fit.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" -#include "exec/address-spaces.h" #include "exec/memory.h" #include "hw/loader.h" #include "hw/loader-fit.h" diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index 807cb5c..e473a44 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include "hw/platform-bus.h" -#include "exec/address-spaces.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h" diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 5bbc2d9..989778a 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -5,7 +5,6 @@ #include "hw/pci/pci.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" -#include "sysemu/block-backend.h" #include "hw/block/block.h" #include "net/hub.h" #include "qapi/visitor.h" diff --git a/hw/core/qdev.c b/hw/core/qdev.c index f6f9247..ffec461 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -208,32 +208,6 @@ void device_listener_unregister(DeviceListener *listener) QTAILQ_REMOVE(&device_listeners, listener, link); } -static void device_realize(DeviceState *dev, Error **errp) -{ - DeviceClass *dc = DEVICE_GET_CLASS(dev); - - if (dc->init) { - int rc = dc->init(dev); - if (rc < 0) { - error_setg(errp, "Device initialization failed."); - return; - } - } -} - -static void device_unrealize(DeviceState *dev, Error **errp) -{ - DeviceClass *dc = DEVICE_GET_CLASS(dev); - - if (dc->exit) { - int rc = dc->exit(dev); - if (rc < 0) { - error_setg(errp, "Device exit failed."); - return; - } - } -} - void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, int required_for_version) { @@ -1065,8 +1039,6 @@ static void device_class_init(ObjectClass *class, void *data) DeviceClass *dc = DEVICE_CLASS(class); class->unparent = device_unparent; - dc->realize = device_realize; - dc->unrealize = device_unrealize; /* by default all devices were considered as hotpluggable, * so with intent to check it in generic qdev_unplug() / diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 5d0887f..ecfb0cf 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "monitor/monitor.h" #include "exec/address-spaces.h" @@ -200,15 +201,18 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size) } } -static int sysbus_device_init(DeviceState *dev) +/* TODO remove once all sysbus devices have been converted to realize */ +static void sysbus_realize(DeviceState *dev, Error **errp) { SysBusDevice *sd = SYS_BUS_DEVICE(dev); SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd); if (!sbc->init) { - return 0; + return; + } + if (sbc->init(sd) < 0) { + error_setg(errp, "Device initialization failed"); } - return sbc->init(sd); } DeviceState *sysbus_create_varargs(const char *name, @@ -324,7 +328,7 @@ MemoryRegion *sysbus_address_space(SysBusDevice *dev) static void sysbus_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); - k->init = sysbus_device_init; + k->realize = sysbus_realize; k->bus_type = TYPE_SYSTEM_BUS; /* * device_add plugs devices into a suitable bus. For "real" buses, diff --git a/hw/cris/axis_dev88.c b/hw/cris/axis_dev88.c index 409f3d5..56ee398 100644 --- a/hw/cris/axis_dev88.c +++ b/hw/cris/axis_dev88.c @@ -34,7 +34,6 @@ #include "hw/loader.h" #include "elf.h" #include "boot.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" #include "sysemu/sysemu.h" diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index d907b38..b5d97ab 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -36,8 +36,8 @@ obj-$(CONFIG_VGA) += vga.o common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o -obj-$(CONFIG_VIRTIO) += virtio-gpu.o virtio-gpu-3d.o -obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o +obj-$(CONFIG_VIRTIO_GPU) += virtio-gpu.o virtio-gpu-3d.o +obj-$(call land,$(CONFIG_VIRTIO_GPU),$(CONFIG_VIRTIO_PCI)) += virtio-gpu-pci.o obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.o virtio-gpu.o-cflags := $(VIRGL_CFLAGS) virtio-gpu.o-libs += $(VIRGL_LIBS) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index f4bb33c..e47be99 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -36,7 +36,6 @@ #include "hw/pci/pci.h" #include "qemu/range.h" #include "ui/pixel_ops.h" -#include "exec/address-spaces.h" /* * Status: 2010/05/07 diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c index 68a80b9..eb90ba2 100644 --- a/hw/display/ssd0303.c +++ b/hw/display/ssd0303.c @@ -297,13 +297,12 @@ static const GraphicHwOps ssd0303_ops = { .gfx_update = ssd0303_update_display, }; -static int ssd0303_init(I2CSlave *i2c) +static void ssd0303_realize(DeviceState *dev, Error **errp) { - ssd0303_state *s = SSD0303(i2c); + ssd0303_state *s = SSD0303(dev); - s->con = graphic_console_init(DEVICE(i2c), 0, &ssd0303_ops, s); + s->con = graphic_console_init(dev, 0, &ssd0303_ops, s); qemu_console_resize(s->con, 96 * MAGNIFY, 16 * MAGNIFY); - return 0; } static void ssd0303_class_init(ObjectClass *klass, void *data) @@ -311,7 +310,7 @@ static void ssd0303_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); - k->init = ssd0303_init; + dc->realize = ssd0303_realize; k->event = ssd0303_event; k->recv = ssd0303_recv; k->send = ssd0303_send; diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c index 464465b..8392e59 100644 --- a/hw/display/tc6393xb.c +++ b/hw/display/tc6393xb.c @@ -18,7 +18,6 @@ #include "hw/block/flash.h" #include "ui/console.h" #include "ui/pixel_ops.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #define IRQ_TC6393_NAND 0 diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c index 4c203ef..a560e3a 100644 --- a/hw/gpio/max7310.c +++ b/hw/gpio/max7310.c @@ -182,14 +182,13 @@ static void max7310_gpio_set(void *opaque, int line, int level) /* MAX7310 is SMBus-compatible (can be used with only SMBus protocols), * but also accepts sequences that are not SMBus so return an I2C device. */ -static int max7310_init(I2CSlave *i2c) +static void max7310_realize(DeviceState *dev, Error **errp) { - MAX7310State *s = MAX7310(i2c); + I2CSlave *i2c = I2C_SLAVE(dev); + MAX7310State *s = MAX7310(dev); qdev_init_gpio_in(&i2c->qdev, max7310_gpio_set, 8); qdev_init_gpio_out(&i2c->qdev, s->handler, 8); - - return 0; } static void max7310_class_init(ObjectClass *klass, void *data) @@ -197,7 +196,7 @@ static void max7310_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); - k->init = max7310_init; + dc->realize = max7310_realize; k->event = max7310_event; k->recv = max7310_rx; k->send = max7310_tx; diff --git a/hw/hppa/hppa_sys.h b/hw/hppa/hppa_sys.h index a182d1f..3f6c145 100644 --- a/hw/hppa/hppa_sys.h +++ b/hw/hppa/hppa_sys.h @@ -3,7 +3,6 @@ #ifndef HW_HPPA_SYS_H #define HW_HPPA_SYS_H -#include "target/hppa/cpu-qom.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ide.h" diff --git a/hw/i2c/core.c b/hw/i2c/core.c index cfccefc..ab72d5b 100644 --- a/hw/i2c/core.c +++ b/hw/i2c/core.c @@ -258,18 +258,6 @@ const VMStateDescription vmstate_i2c_slave = { } }; -static int i2c_slave_qdev_init(DeviceState *dev) -{ - I2CSlave *s = I2C_SLAVE(dev); - I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s); - - if (sc->init) { - return sc->init(s); - } - - return 0; -} - DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr) { DeviceState *dev; @@ -283,7 +271,6 @@ DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr) static void i2c_slave_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); - k->init = i2c_slave_qdev_init; set_bit(DEVICE_CATEGORY_MISC, k->categories); k->bus_type = TYPE_I2C_BUS; k->props = i2c_props; diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c index 2d1b79a..587ce1a 100644 --- a/hw/i2c/smbus.c +++ b/hw/i2c/smbus.c @@ -202,14 +202,6 @@ static int smbus_i2c_send(I2CSlave *s, uint8_t data) return 0; } -static int smbus_device_init(I2CSlave *i2c) -{ - SMBusDevice *dev = SMBUS_DEVICE(i2c); - SMBusDeviceClass *sc = SMBUS_DEVICE_GET_CLASS(dev); - - return sc->init(dev); -} - /* Master device commands. */ int smbus_quick_command(I2CBus *bus, uint8_t addr, int read) { @@ -350,7 +342,6 @@ static void smbus_device_class_init(ObjectClass *klass, void *data) { I2CSlaveClass *sc = I2C_SLAVE_CLASS(klass); - sc->init = smbus_device_init; sc->event = smbus_i2c_event; sc->recv = smbus_i2c_recv; sc->send = smbus_i2c_send; diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index b13ec0f..125c887 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -97,12 +97,11 @@ static uint8_t eeprom_read_data(SMBusDevice *dev, uint8_t cmd, int n) return eeprom_receive_byte(dev); } -static int smbus_eeprom_initfn(SMBusDevice *dev) +static void smbus_eeprom_realize(DeviceState *dev, Error **errp) { SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *)dev; eeprom->offset = 0; - return 0; } static Property smbus_eeprom_properties[] = { @@ -115,7 +114,7 @@ static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); SMBusDeviceClass *sc = SMBUS_DEVICE_CLASS(klass); - sc->init = smbus_eeprom_initfn; + dc->realize = smbus_eeprom_realize; sc->quick_cmd = eeprom_quick_cmd; sc->send_byte = eeprom_send_byte; sc->receive_byte = eeprom_receive_byte; diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index 13f20f4..d4d4a85 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -293,7 +293,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp) return; } - memory_region_init_reservation(&pit->ioports, NULL, "kvm-pit", 4); + memory_region_init_io(&pit->ioports, OBJECT(dev), NULL, NULL, "kvm-pit", 4); qdev_init_gpio_in(dev, kvm_pit_irq_control, 1); diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index 05394cd..83b6bfe 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -121,8 +121,8 @@ static void kvm_pic_realize(DeviceState *dev, Error **errp) PICCommonState *s = PIC_COMMON(dev); KVMPICClass *kpc = KVM_PIC_GET_CLASS(dev); - memory_region_init_reservation(&s->base_io, NULL, "kvm-pic", 2); - memory_region_init_reservation(&s->elcr_io, NULL, "kvm-elcr", 1); + memory_region_init_io(&s->base_io, OBJECT(dev), NULL, NULL, "kvm-pic", 2); + memory_region_init_io(&s->elcr_io, OBJECT(dev), NULL, NULL, "kvm-elcr", 1); kpc->parent_realize(dev, errp); } diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c index 98ca480..646f624 100644 --- a/hw/i386/kvm/ioapic.c +++ b/hw/i386/kvm/ioapic.c @@ -142,7 +142,7 @@ static void kvm_ioapic_realize(DeviceState *dev, Error **errp) { IOAPICCommonState *s = IOAPIC_COMMON(dev); - memory_region_init_reservation(&s->io_memory, NULL, "kvm-ioapic", 0x1000); + memory_region_init_io(&s->io_memory, OBJECT(dev), NULL, NULL, "kvm-ioapic", 0x1000); /* * KVM ioapic only supports 0x11 now. This will only be used when * we want to dump ioapic version. diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c index fc962c5..70f6f26 100644 --- a/hw/i386/kvmvapic.c +++ b/hw/i386/kvmvapic.c @@ -11,7 +11,6 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "cpu.h" -#include "exec/exec-all.h" #include "sysemu/sysemu.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d768930..8b0803c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -64,7 +64,6 @@ #include "hw/acpi/acpi.h" #include "hw/acpi/cpu_hotplug.h" #include "hw/boards.h" -#include "hw/pci/pci_host.h" #include "acpi-build.h" #include "hw/mem/pc-dimm.h" #include "qapi/error.h" diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c index 12fd932..628b813 100644 --- a/hw/i386/xen/xen-mapcache.c +++ b/hw/i386/xen/xen-mapcache.c @@ -14,7 +14,6 @@ #include <sys/resource.h> #include "hw/xen/xen_backend.h" -#include "sysemu/blockdev.h" #include "qemu/bitmap.h" #include <xen/hvm/params.h> diff --git a/hw/ide/core.c b/hw/ide/core.c index 866c659..cc9ca28 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" -#include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "qemu/error-report.h" #include "qemu/timer.h" diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 1ab0a89..fe1ceeb 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -26,7 +26,6 @@ #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" -#include "sysemu/block-backend.h" #include "sysemu/dma.h" #include "qemu/error-report.h" #include "hw/ide/pci.h" diff --git a/hw/ide/via.c b/hw/ide/via.c index 117ac4d..238f038 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -27,7 +27,6 @@ #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" -#include "sysemu/block-backend.h" #include "sysemu/sysemu.h" #include "sysemu/dma.h" diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs index 77e53e6..c8b00f7 100644 --- a/hw/input/Makefile.objs +++ b/hw/input/Makefile.objs @@ -7,10 +7,10 @@ common-obj-y += ps2.o common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o common-obj-$(CONFIG_TSC2005) += tsc2005.o -common-obj-$(CONFIG_VIRTIO) += virtio-input.o -common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o +common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input.o +common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-hid.o ifeq ($(CONFIG_LINUX),y) -common-obj-$(CONFIG_VIRTIO) += virtio-input-host.o +common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-host.o endif obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c index d399531..74da30d 100644 --- a/hw/input/lm832x.c +++ b/hw/input/lm832x.c @@ -464,20 +464,19 @@ static const VMStateDescription vmstate_lm_kbd = { }; -static int lm8323_init(I2CSlave *i2c) +static void lm8323_realize(DeviceState *dev, Error **errp) { - LM823KbdState *s = LM8323(i2c); + LM823KbdState *s = LM8323(dev); s->model = 0x8323; s->pwm.tm[0] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm0_tick, s); s->pwm.tm[1] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm1_tick, s); s->pwm.tm[2] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm2_tick, s); - qdev_init_gpio_out(DEVICE(i2c), &s->nirq, 1); + qdev_init_gpio_out(dev, &s->nirq, 1); lm_kbd_reset(s); qemu_register_reset((void *) lm_kbd_reset, s); - return 0; } void lm832x_key_event(DeviceState *dev, int key, int state) @@ -505,7 +504,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); - k->init = lm8323_init; + dc->realize = lm8323_realize; k->event = lm_i2c_event; k->recv = lm_i2c_rx; k->send = lm_i2c_tx; diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c index 689587b..a794315 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 "qemu/log.h" #include "qapi/error.h" #include "hw/hw.h" #include "hw/ipmi/ipmi.h" @@ -422,24 +423,69 @@ static void ipmi_isa_realize(DeviceState *dev, Error **errp) isa_register_ioport(isadev, &iik->kcs.io, iik->kcs.io_base); } -const VMStateDescription vmstate_ISAIPMIKCSDevice = { +static int ipmi_kcs_vmstate_post_load(void *opaque, int version) +{ + IPMIKCS *ik = opaque; + + /* Make sure all the values are sane. */ + if (ik->outpos >= MAX_IPMI_MSG_SIZE || ik->outlen >= MAX_IPMI_MSG_SIZE || + ik->outpos >= ik->outlen) { + qemu_log_mask(LOG_GUEST_ERROR, + "ipmi:kcs: vmstate transfer received bad out values: %d %d\n", + ik->outpos, ik->outlen); + ik->outpos = 0; + ik->outlen = 0; + } + + if (ik->inlen >= MAX_IPMI_MSG_SIZE) { + qemu_log_mask(LOG_GUEST_ERROR, + "ipmi:kcs: vmstate transfer received bad in value: %d\n", + ik->inlen); + ik->inlen = 0; + } + + return 0; +} + +static bool vmstate_kcs_before_version2(void *opaque, int version) +{ + return version <= 1; +} + +static const VMStateDescription vmstate_IPMIKCS = { + .name = TYPE_IPMI_INTERFACE_PREFIX "kcs", + .version_id = 2, + .minimum_version_id = 1, + .post_load = ipmi_kcs_vmstate_post_load, + .fields = (VMStateField[]) { + VMSTATE_BOOL(obf_irq_set, IPMIKCS), + VMSTATE_BOOL(atn_irq_set, IPMIKCS), + VMSTATE_UNUSED_TEST(vmstate_kcs_before_version2, 1), /* Was use_irq */ + VMSTATE_BOOL(irqs_enabled, IPMIKCS), + VMSTATE_UINT32(outpos, IPMIKCS), + VMSTATE_UINT32_V(outlen, IPMIKCS, 2), + VMSTATE_UINT8_ARRAY(outmsg, IPMIKCS, MAX_IPMI_MSG_SIZE), + VMSTATE_UINT32_V(inlen, IPMIKCS, 2), + VMSTATE_UINT8_ARRAY(inmsg, IPMIKCS, MAX_IPMI_MSG_SIZE), + VMSTATE_BOOL(write_end, IPMIKCS), + VMSTATE_UINT8(status_reg, IPMIKCS), + VMSTATE_UINT8(data_out_reg, IPMIKCS), + VMSTATE_INT16(data_in_reg, IPMIKCS), + VMSTATE_INT16(cmd_reg, IPMIKCS), + VMSTATE_UINT8(waiting_rsp, IPMIKCS), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_ISAIPMIKCSDevice = { .name = TYPE_IPMI_INTERFACE, - .version_id = 1, + .version_id = 2, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_BOOL(kcs.obf_irq_set, ISAIPMIKCSDevice), - VMSTATE_BOOL(kcs.atn_irq_set, ISAIPMIKCSDevice), - VMSTATE_BOOL(kcs.use_irq, ISAIPMIKCSDevice), - VMSTATE_BOOL(kcs.irqs_enabled, ISAIPMIKCSDevice), - VMSTATE_UINT32(kcs.outpos, ISAIPMIKCSDevice), - VMSTATE_UINT8_ARRAY(kcs.outmsg, ISAIPMIKCSDevice, MAX_IPMI_MSG_SIZE), - VMSTATE_UINT8_ARRAY(kcs.inmsg, ISAIPMIKCSDevice, MAX_IPMI_MSG_SIZE), - VMSTATE_BOOL(kcs.write_end, ISAIPMIKCSDevice), - VMSTATE_UINT8(kcs.status_reg, ISAIPMIKCSDevice), - VMSTATE_UINT8(kcs.data_out_reg, ISAIPMIKCSDevice), - VMSTATE_INT16(kcs.data_in_reg, ISAIPMIKCSDevice), - VMSTATE_INT16(kcs.cmd_reg, ISAIPMIKCSDevice), - VMSTATE_UINT8(kcs.waiting_rsp, ISAIPMIKCSDevice), + VMSTATE_VSTRUCT_TEST(kcs, ISAIPMIKCSDevice, vmstate_kcs_before_version2, + 0, vmstate_IPMIKCS, IPMIKCS, 1), + VMSTATE_VSTRUCT_V(kcs, ISAIPMIKCSDevice, 2, vmstate_IPMIKCS, + IPMIKCS, 2), VMSTATE_END_OF_LIST() } }; @@ -450,6 +496,11 @@ static void isa_ipmi_kcs_init(Object *obj) ipmi_bmc_find_and_link(obj, (Object **) &iik->kcs.bmc); + /* + * Version 1 had an incorrect name, it clashed with the BT + * IPMI device, so receive it, but transmit a different + * version. + */ vmstate_register(NULL, 0, &vmstate_ISAIPMIKCSDevice, iik); } diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 76286c8..8bc2f69 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -13,7 +13,6 @@ #include "qemu/error-report.h" #include "qapi/error.h" #include "sysemu/sysemu.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "chardev/char.h" #include "hw/isa/superio.h" @@ -43,7 +42,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) if (!k->parallel.is_enabled || k->parallel.is_enabled(sio, i)) { /* FIXME use a qdev chardev prop instead of parallel_hds[] */ chr = parallel_hds[i]; - if (chr == NULL || chr->be) { + if (chr == NULL) { name = g_strdup_printf("discarding-parallel%d", i); chr = qemu_chr_new(name, "null"); } else { @@ -83,7 +82,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) if (!k->serial.is_enabled || k->serial.is_enabled(sio, i)) { /* FIXME use a qdev chardev prop instead of serial_hd() */ chr = serial_hd(i); - if (chr == NULL || chr->be) { + if (chr == NULL) { name = g_strdup_printf("discarding-serial%d", i); chr = qemu_chr_new(name, "null"); } else { diff --git a/hw/lm32/lm32_boards.c b/hw/lm32/lm32_boards.c index 907e875..1670583 100644 --- a/hw/lm32/lm32_boards.c +++ b/hw/lm32/lm32_boards.c @@ -27,7 +27,6 @@ #include "hw/devices.h" #include "hw/boards.h" #include "hw/loader.h" -#include "sysemu/block-backend.h" #include "elf.h" #include "lm32_hwsetup.h" #include "lm32.h" diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index f9688e0..c36bbc4 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -30,7 +30,6 @@ #include "hw/boards.h" #include "hw/loader.h" #include "elf.h" -#include "sysemu/block-backend.h" #include "milkymist-hw.h" #include "lm32.h" #include "exec/address-spaces.h" diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index 6ad1e4b..7abd84a 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -14,7 +14,6 @@ #include "qemu/timer.h" #include "hw/ptimer.h" #include "sysemu/sysemu.h" -#include "exec/address-spaces.h" /* General purpose timer module. */ typedef struct { diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c index 8198afa..393ce28 100644 --- a/hw/m68k/mcf_intc.c +++ b/hw/m68k/mcf_intc.c @@ -11,7 +11,6 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "hw/m68k/mcf.h" -#include "exec/address-spaces.h" #define TYPE_MCF_INTC "mcf-intc" #define MCF_INTC(obj) OBJECT_CHECK(mcf_intc_state, (obj), TYPE_MCF_INTC) diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c index cf6bf3f..6c4a544 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -36,7 +36,6 @@ #include "sysemu/sysemu.h" #include "hw/devices.h" #include "hw/boards.h" -#include "sysemu/block-backend.h" #include "hw/char/serial.h" #include "exec/address-spaces.h" #include "hw/ssi/ssi.h" diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c index 1186002..0da3e62 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -34,7 +34,6 @@ #include "sysemu/sysemu.h" #include "hw/devices.h" #include "hw/boards.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "hw/char/xilinx_uartlite.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index af70ecf..494f84e 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -46,7 +46,6 @@ #include "elf.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" /* SysBusDevice */ #include "qemu/host-utils.h" diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index e04b49d..e5cf8ed 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -30,7 +30,6 @@ #include "hw/timer/mc146818rtc.h" #include "hw/input/i8042.h" #include "hw/timer/i8254.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c index 8a5f295..533e6e3 100644 --- a/hw/misc/arm_integrator_debug.c +++ b/hw/misc/arm_integrator_debug.c @@ -17,7 +17,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" -#include "exec/address-spaces.h" #include "hw/misc/arm_integrator_debug.h" #include "qemu/log.h" diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index c84a48b..ccc4c7d 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -18,13 +18,10 @@ */ #include "qemu/osdep.h" +#include "qemu/log.h" #include "qapi/error.h" #include "cpu.h" -#include "qemu/log.h" #include "exec/exec-all.h" -#include "hw/hw.h" -#include "hw/sysbus.h" -#include "sysemu/sysemu.h" #include "hw/misc/mips_itu.h" #define ITC_TAG_ADDRSPACE_SZ (ITC_ADDRESSMAP_NUM * 8) diff --git a/hw/misc/sga.c b/hw/misc/sga.c index 97fd63f..4a22a52 100644 --- a/hw/misc/sga.c +++ b/hw/misc/sga.c @@ -25,7 +25,7 @@ * */ #include "qemu/osdep.h" -#include "hw/pci/pci.h" +#include "hw/isa/isa.h" #include "hw/loader.h" #include "sysemu/sysemu.h" diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c index 9e22d64..0918f3a 100644 --- a/hw/misc/tmp105.c +++ b/hw/misc/tmp105.c @@ -229,15 +229,14 @@ static void tmp105_reset(I2CSlave *i2c) tmp105_interrupt_update(s); } -static int tmp105_init(I2CSlave *i2c) +static void tmp105_realize(DeviceState *dev, Error **errp) { + I2CSlave *i2c = I2C_SLAVE(dev); TMP105State *s = TMP105(i2c); qdev_init_gpio_out(&i2c->qdev, &s->pin, 1); tmp105_reset(&s->i2c); - - return 0; } static void tmp105_initfn(Object *obj) @@ -252,7 +251,7 @@ static void tmp105_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); - k->init = tmp105_init; + dc->realize = tmp105_realize; k->event = tmp105_event; k->recv = tmp105_rx; k->send = tmp105_tx; diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c index 4a505ab..c234044 100644 --- a/hw/misc/tmp421.c +++ b/hw/misc/tmp421.c @@ -335,13 +335,11 @@ static void tmp421_reset(I2CSlave *i2c) s->status = 0; } -static int tmp421_init(I2CSlave *i2c) +static void tmp421_realize(DeviceState *dev, Error **errp) { - TMP421State *s = TMP421(i2c); + TMP421State *s = TMP421(dev); tmp421_reset(&s->i2c); - - return 0; } static void tmp421_initfn(Object *obj) @@ -366,7 +364,7 @@ static void tmp421_class_init(ObjectClass *klass, void *data) I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); TMP421Class *sc = TMP421_CLASS(klass); - k->init = tmp421_init; + dc->realize = tmp421_realize; k->event = tmp421_event; k->recv = tmp421_rx; k->send = tmp421_tx; diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs index ab22968..fa461d4 100644 --- a/hw/net/Makefile.objs +++ b/hw/net/Makefile.objs @@ -36,7 +36,7 @@ obj-$(CONFIG_MILKYMIST) += milkymist-minimac2.o obj-$(CONFIG_PSERIES) += spapr_llan.o obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o -obj-$(CONFIG_VIRTIO) += virtio-net.o +obj-$(CONFIG_VIRTIO_NET) += virtio-net.o obj-y += vhost_net.o obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \ diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c index bfa6b4b..0091e4e 100644 --- a/hw/net/mcf_fec.c +++ b/hw/net/mcf_fec.c @@ -14,7 +14,6 @@ #include "hw/sysbus.h" /* For crc32 */ #include <zlib.h> -#include "exec/address-spaces.h" //#define DEBUG_FEC 1 diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c index 70e5c1d..c7fdeb0 100644 --- a/hw/net/ne2000-isa.c +++ b/hw/net/ne2000-isa.c @@ -27,7 +27,6 @@ #include "hw/qdev.h" #include "ne2000.h" #include "sysemu/sysemu.h" -#include "exec/address-spaces.h" #include "qapi/error.h" #include "qapi/visitor.h" diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c index 22183f5..27cd01e 100644 --- a/hw/nvram/eeprom_at24c.c +++ b/hw/nvram/eeprom_at24c.c @@ -116,31 +116,29 @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data) return 0; } -static -int at24c_eeprom_init(I2CSlave *i2c) +static void at24c_eeprom_realize(DeviceState *dev, Error **errp) { - EEPROMState *ee = AT24C_EE(i2c); - - ee->mem = g_malloc0(ee->rsize); + EEPROMState *ee = AT24C_EE(dev); if (ee->blk) { int64_t len = blk_getlength(ee->blk); if (len != ee->rsize) { - ERR(TYPE_AT24C_EE " : Backing file size %lu != %u\n", - (unsigned long)len, (unsigned)ee->rsize); - exit(1); + error_setg(errp, "%s: Backing file size %" PRId64 " != %u", + TYPE_AT24C_EE, len, ee->rsize); + return; } if (blk_set_perm(ee->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE, BLK_PERM_ALL, &error_fatal) < 0) { - ERR(TYPE_AT24C_EE - " : Backing file incorrect permission\n"); - exit(1); + error_setg(errp, "%s: Backing file incorrect permission", + TYPE_AT24C_EE); + return; } } - return 0; + + ee->mem = g_malloc0(ee->rsize); } static @@ -178,7 +176,7 @@ void at24c_eeprom_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); - k->init = &at24c_eeprom_init; + dc->realize = &at24c_eeprom_realize; k->event = &at24c_eeprom_event; k->recv = &at24c_eeprom_recv; k->send = &at24c_eeprom_send; diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index d0b02bd..7b19078 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -12,7 +12,6 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" -#include "exec/address-spaces.h" #include "qemu/log.h" /* Old and buggy versions of QEMU used the wrong mapping from diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 0b65893..d301067 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -37,7 +37,6 @@ #include "qemu/log.h" #include "qemu/error-report.h" #include "hw/loader.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define BIOS_FILENAME "ppc405_rom.bin" diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index a48e6e6..3dd23de 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -17,7 +17,6 @@ #include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" -#include "sysemu/blockdev.h" #include "hw/boards.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 213f6f9..2375cbe 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -35,7 +35,6 @@ #include "elf.h" #include "net/net.h" #include "sysemu/device_tree.h" -#include "sysemu/block-backend.h" #include "sysemu/cpus.h" #include "sysemu/hw_accel.h" #include "kvm_ppc.h" diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index a80cbdd..b4bb90d 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -44,8 +44,6 @@ #include "hw/ppc/ppc4xx.h" #include "ppc405.h" -#include "sysemu/block-backend.h" - #define EPAPR_MAGIC (0x45504150) #define FLASH_SIZE (16 * 1024 * 1024) diff --git a/hw/riscv/riscv_htif.c b/hw/riscv/riscv_htif.c index f735129..4f7b11d 100644 --- a/hw/riscv/riscv_htif.c +++ b/hw/riscv/riscv_htif.c @@ -29,7 +29,6 @@ #include "chardev/char-fe.h" #include "hw/riscv/riscv_htif.h" #include "qemu/timer.h" -#include "exec/address-spaces.h" #include "qemu/error-report.h" #define RISCV_DEBUG_HTIF 0 diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 22df33b..0a9bec4 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -13,8 +13,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/hw.h" -#include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" #include "net/net.h" diff --git a/hw/scsi/Makefile.objs b/hw/scsi/Makefile.objs index b188f72..718b4c2 100644 --- a/hw/scsi/Makefile.objs +++ b/hw/scsi/Makefile.objs @@ -8,7 +8,7 @@ common-obj-$(CONFIG_ESP) += esp.o common-obj-$(CONFIG_ESP_PCI) += esp-pci.o obj-$(CONFIG_PSERIES) += spapr_vscsi.o -ifeq ($(CONFIG_VIRTIO),y) +ifeq ($(CONFIG_VIRTIO_SCSI),y) obj-y += virtio-scsi.o virtio-scsi-dataplane.o obj-$(CONFIG_VHOST_SCSI) += vhost-scsi-common.o vhost-scsi.o obj-$(CONFIG_VHOST_USER_SCSI) += vhost-scsi-common.o vhost-user-scsi.o diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c index 3f061f3..4176e87 100644 --- a/hw/scsi/mptsas.c +++ b/hw/scsi/mptsas.c @@ -26,7 +26,6 @@ #include "hw/hw.h" #include "hw/pci/pci.h" #include "sysemu/dma.h" -#include "sysemu/block-backend.h" #include "hw/pci/msi.h" #include "qemu/iov.h" #include "hw/scsi/scsi.h" diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index 381f04e..03bce8f 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -17,7 +17,6 @@ #include "qemu/error-report.h" #include "hw/scsi/scsi.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #ifdef __linux__ diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 3ba1f7d..1cc94db 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -8,7 +8,6 @@ */ #include "qemu/osdep.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/sysbus.h" #include "hw/sd/sd.h" diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 63c44a4..3017e5a 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -26,8 +26,6 @@ #include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" -#include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "sysemu/dma.h" #include "qemu/timer.h" #include "qemu/bitops.h" diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index ae04b66..96542ec 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/ssi/ssi.h" #include "hw/sd/sd.h" diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 6b01d6e..8fe8766 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -40,7 +40,6 @@ #include "hw/loader.h" #include "hw/usb.h" #include "hw/block/flash.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #define FLASH_BASE 0x00000000 diff --git a/hw/sh4/sh7750.c b/hw/sh4/sh7750.c index 5a7d47d..2dc07a9 100644 --- a/hw/sh4/sh7750.c +++ b/hw/sh4/sh7750.c @@ -31,7 +31,6 @@ #include "hw/sh4/sh_intc.h" #include "cpu.h" #include "exec/exec-all.h" -#include "exec/address-spaces.h" #define NB_DEVICES 4 diff --git a/hw/timer/sh_timer.c b/hw/timer/sh_timer.c index 9afb2d0..5f8736c 100644 --- a/hw/timer/sh_timer.c +++ b/hw/timer/sh_timer.c @@ -13,7 +13,6 @@ #include "hw/sh4/sh.h" #include "qemu/timer.h" #include "qemu/main-loop.h" -#include "exec/address-spaces.h" #include "hw/ptimer.h" //#define DEBUG_TIMER diff --git a/hw/timer/twl92230.c b/hw/timer/twl92230.c index ef116c6..3b43b46 100644 --- a/hw/timer/twl92230.c +++ b/hw/timer/twl92230.c @@ -853,10 +853,9 @@ static const VMStateDescription vmstate_menelaus = { } }; -static int twl92230_init(I2CSlave *i2c) +static void twl92230_realize(DeviceState *dev, Error **errp) { - DeviceState *dev = DEVICE(i2c); - MenelausState *s = TWL92230(i2c); + MenelausState *s = TWL92230(dev); s->rtc.hz_tm = timer_new_ms(rtc_clock, menelaus_rtc_hz, s); /* Three output pins plus one interrupt pin. */ @@ -865,9 +864,7 @@ static int twl92230_init(I2CSlave *i2c) /* Three input pins plus one power-button pin. */ qdev_init_gpio_in(dev, menelaus_gpio_set, 4); - menelaus_reset(i2c); - - return 0; + menelaus_reset(I2C_SLAVE(dev)); } static void twl92230_class_init(ObjectClass *klass, void *data) @@ -875,7 +872,7 @@ static void twl92230_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); I2CSlaveClass *sc = I2C_SLAVE_CLASS(klass); - sc->init = twl92230_init; + dc->realize = twl92230_realize; sc->event = menelaus_event; sc->recv = menelaus_rx; sc->send = menelaus_tx; diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index b56c75a..d02acda 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -20,7 +20,6 @@ #include "monitor/monitor.h" #include "sysemu/sysemu.h" #include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "qapi/visitor.h" #include "qemu/cutils.h" diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index e67392c..76e4e8c 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -22,6 +22,7 @@ #include "hw/vfio/vfio-common.h" #include "hw/s390x/s390-ccw.h" #include "hw/s390x/ccw-device.h" +#include "exec/address-spaces.h" #include "qemu/error-report.h" #define TYPE_VFIO_CCW "vfio-ccw" diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c index 5c921c2..57c4a0e 100644 --- a/hw/vfio/platform.c +++ b/hw/vfio/platform.c @@ -24,6 +24,7 @@ #include "qemu/range.h" #include "sysemu/sysemu.h" #include "exec/memory.h" +#include "exec/address-spaces.h" #include "qemu/queue.h" #include "hw/sysbus.h" #include "trace.h" diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 765d363..1b2799c 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -1,15 +1,17 @@ ifeq ($(CONFIG_VIRTIO),y) -common-obj-y += virtio-rng.o -common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o common-obj-y += virtio-bus.o -common-obj-y += virtio-mmio.o +obj-y += virtio.o + +common-obj-$(CONFIG_VIRTIO_RNG) += virtio-rng.o +common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o +common-obj-$(CONFIG_VIRTIO_MMIO) += virtio-mmio.o +obj-$(CONFIG_VIRTIO_BALLOON) += virtio-balloon.o +obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-crypto.o +obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-pci.o -obj-y += virtio.o virtio-balloon.o obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o -obj-y += virtio-crypto.o -obj-$(CONFIG_VIRTIO_PCI) += virtio-crypto-pci.o endif -common-obj-$(call lnot,$(CONFIG_LINUX)) += vhost-stub.o +common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) += vhost-stub.o common-obj-$(CONFIG_ALL) += vhost-stub.o diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 5eb0c32..3a01fe9 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -32,7 +32,6 @@ #include "hw/pci/msix.h" #include "hw/loader.h" #include "sysemu/kvm.h" -#include "sysemu/block-backend.h" #include "virtio-pci.h" #include "qemu/range.h" #include "hw/virtio/virtio-bus.h" diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 1debb01..d4e4d98 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -123,11 +123,22 @@ static void virtio_free_region_cache(VRingMemoryRegionCaches *caches) g_free(caches); } +static void virtio_virtqueue_reset_region_cache(struct VirtQueue *vq) +{ + VRingMemoryRegionCaches *caches; + + caches = atomic_read(&vq->vring.caches); + atomic_rcu_set(&vq->vring.caches, NULL); + if (caches) { + call_rcu(caches, virtio_free_region_cache, rcu); + } +} + static void virtio_init_region_cache(VirtIODevice *vdev, int n) { VirtQueue *vq = &vdev->vq[n]; VRingMemoryRegionCaches *old = vq->vring.caches; - VRingMemoryRegionCaches *new; + VRingMemoryRegionCaches *new = NULL; hwaddr addr, size; int event_size; int64_t len; @@ -136,7 +147,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n) addr = vq->vring.desc; if (!addr) { - return; + goto out_no_cache; } new = g_new0(VRingMemoryRegionCaches, 1); size = virtio_queue_get_desc_size(vdev, n); @@ -170,11 +181,14 @@ static void virtio_init_region_cache(VirtIODevice *vdev, int n) return; err_avail: - address_space_cache_destroy(&new->used); + address_space_cache_destroy(&new->avail); err_used: - address_space_cache_destroy(&new->desc); + address_space_cache_destroy(&new->used); err_desc: + address_space_cache_destroy(&new->desc); +out_no_cache: g_free(new); + virtio_virtqueue_reset_region_cache(vq); } /* virt queue functions */ @@ -1168,17 +1182,6 @@ static enum virtio_device_endian virtio_current_cpu_endian(void) } } -static void virtio_virtqueue_reset_region_cache(struct VirtQueue *vq) -{ - VRingMemoryRegionCaches *caches; - - caches = atomic_read(&vq->vring.caches); - atomic_rcu_set(&vq->vring.caches, NULL); - if (caches) { - call_rcu(caches, virtio_free_region_cache, rcu); - } -} - void virtio_reset(void *opaque) { VirtIODevice *vdev = opaque; diff --git a/hw/xen/xen_devconfig.c b/hw/xen/xen_devconfig.c index fac9d3f..aebc19b 100644 --- a/hw/xen/xen_devconfig.c +++ b/hw/xen/xen_devconfig.c @@ -1,7 +1,6 @@ #include "qemu/osdep.h" #include "hw/xen/xen_backend.h" #include "qemu/option.h" -#include "sysemu/block-backend.h" #include "sysemu/blockdev.h" /* ------------------------------------------------------------- */ diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 63734c7..5dc1303 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -38,7 +38,6 @@ #include "net/net.h" #include "hw/sysbus.h" #include "hw/block/flash.h" -#include "sysemu/block-backend.h" #include "chardev/char.h" #include "sysemu/device_tree.h" #include "qemu/error-report.h" |