From ac843bf3cebc92d97ef9e451fbabdddf3bd204c0 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mar 18 2014 18:25:31 +0000 Subject: Update to qemu 2.0 rc0 --- diff --git a/.gitignore b/.gitignore index 7da4d22..c3dfe84 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ qemu-kvm-0.13.0-25fdf4a.tar.gz /qemu-1.6.1.tar.bz2 /qemu-1.7.0-rc1.tar.bz2 /qemu-1.7.0.tar.bz2 +/qemu-2.0.0-rc0.tar.bz2 diff --git a/0001-pci-do-not-export-pci_bus_reset.patch b/0001-pci-do-not-export-pci_bus_reset.patch deleted file mode 100644 index e23e793..0000000 --- a/0001-pci-do-not-export-pci_bus_reset.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 4f9f83c8b0a26a24ab2963e57a375b0ba99638f1 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Thu, 2 May 2013 11:38:37 +0200 -Subject: [PATCH] pci: do not export pci_bus_reset - -qbus_reset_all can be used instead. There is no semantic change -because pcibus_reset returns 1 and takes care of the device -tree traversal. - -This will be necessary once the traversal is done always in -qbus_reset_all *before* invoking pcibus_reset itself. - -Tested-by: Claudio Bley -Signed-off-by: Paolo Bonzini ---- - hw/pci/pci.c | 8 ++------ - hw/pci/pci_bridge.c | 2 +- - include/hw/pci/pci.h | 1 - - 3 files changed, 3 insertions(+), 8 deletions(-) - -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index 49eca95..504ed9d 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -212,8 +212,9 @@ void pci_device_reset(PCIDevice *dev) - * Trigger pci bus reset under a given bus. - * To be called on RST# assert. - */ --void pci_bus_reset(PCIBus *bus) -+static int pcibus_reset(BusState *qbus) - { -+ PCIBus *bus = DO_UPCAST(PCIBus, qbus, qbus); - int i; - - for (i = 0; i < bus->nirq; i++) { -@@ -224,11 +225,6 @@ void pci_bus_reset(PCIBus *bus) - pci_device_reset(bus->devices[i]); - } - } --} -- --static int pcibus_reset(BusState *qbus) --{ -- pci_bus_reset(DO_UPCAST(PCIBus, qbus, qbus)); - - /* topology traverse is done by pci_bus_reset(). - Tell qbus/qdev walker not to traverse the tree */ -diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c -index 290abab..41d8755 100644 ---- a/hw/pci/pci_bridge.c -+++ b/hw/pci/pci_bridge.c -@@ -268,7 +268,7 @@ void pci_bridge_write_config(PCIDevice *d, - newctl = pci_get_word(d->config + PCI_BRIDGE_CONTROL); - if (~oldctl & newctl & PCI_BRIDGE_CTL_BUS_RESET) { - /* Trigger hot reset on 0->1 transition. */ -- pci_bus_reset(&s->sec_bus); -+ qbus_reset_all(&s->sec_bus.qbus); - } - } - -diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h -index b783e68..754b82d 100644 ---- a/include/hw/pci/pci.h -+++ b/include/hw/pci/pci.h -@@ -373,7 +373,6 @@ void pci_bus_fire_intx_routing_notifier(PCIBus *bus); - void pci_device_set_intx_routing_notifier(PCIDevice *dev, - PCIINTxRoutingNotifier notifier); - void pci_device_reset(PCIDevice *dev); --void pci_bus_reset(PCIBus *bus); - - PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus, - const char *default_model, diff --git a/0002-qdev-allow-both-pre-and-post-order-vists-in-qdev-wal.patch b/0002-qdev-allow-both-pre-and-post-order-vists-in-qdev-wal.patch deleted file mode 100644 index 52e32c4..0000000 --- a/0002-qdev-allow-both-pre-and-post-order-vists-in-qdev-wal.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 60ab1ca9f2a40610902b610fa0a06fccea7f0f57 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Thu, 2 May 2013 11:38:38 +0200 -Subject: [PATCH] qdev: allow both pre- and post-order vists in qdev walking - functions - -Resetting should be done in post-order, not pre-order. However, -qdev_walk_children and qbus_walk_children do not allow this. Fix -it by adding two extra arguments to the functions. - -Tested-by: Claudio Bley -Signed-off-by: Paolo Bonzini ---- - hw/core/qdev.c | 45 +++++++++++++++++++++++++++++++++------------ - include/hw/qdev-core.h | 13 +++++++++---- - 2 files changed, 42 insertions(+), 16 deletions(-) - -diff --git a/hw/core/qdev.c b/hw/core/qdev.c -index e374a93..5ddf1aa 100644 ---- a/hw/core/qdev.c -+++ b/hw/core/qdev.c -@@ -240,12 +240,12 @@ static int qbus_reset_one(BusState *bus, void *opaque) - - void qdev_reset_all(DeviceState *dev) - { -- qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL); -+ qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL, NULL, NULL); - } - - void qbus_reset_all(BusState *bus) - { -- qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL); -+ qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL, NULL, NULL); - } - - void qbus_reset_all_fn(void *opaque) -@@ -337,49 +337,70 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name) - return NULL; - } - --int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn, -- qbus_walkerfn *busfn, void *opaque) -+int qbus_walk_children(BusState *bus, -+ qdev_walkerfn *pre_devfn, qbus_walkerfn *pre_busfn, -+ qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn, -+ void *opaque) - { - BusChild *kid; - int err; - -- if (busfn) { -- err = busfn(bus, opaque); -+ if (pre_busfn) { -+ err = pre_busfn(bus, opaque); - if (err) { - return err; - } - } - - QTAILQ_FOREACH(kid, &bus->children, sibling) { -- err = qdev_walk_children(kid->child, devfn, busfn, opaque); -+ err = qdev_walk_children(kid->child, -+ pre_devfn, pre_busfn, -+ post_devfn, post_busfn, opaque); - if (err < 0) { - return err; - } - } - -+ if (post_busfn) { -+ err = post_busfn(bus, opaque); -+ if (err) { -+ return err; -+ } -+ } -+ - return 0; - } - --int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, -- qbus_walkerfn *busfn, void *opaque) -+int qdev_walk_children(DeviceState *dev, -+ qdev_walkerfn *pre_devfn, qbus_walkerfn *pre_busfn, -+ qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn, -+ void *opaque) - { - BusState *bus; - int err; - -- if (devfn) { -- err = devfn(dev, opaque); -+ if (pre_devfn) { -+ err = pre_devfn(dev, opaque); - if (err) { - return err; - } - } - - QLIST_FOREACH(bus, &dev->child_bus, sibling) { -- err = qbus_walk_children(bus, devfn, busfn, opaque); -+ err = qbus_walk_children(bus, pre_devfn, pre_busfn, -+ post_devfn, post_busfn, opaque); - if (err < 0) { - return err; - } - } - -+ if (post_devfn) { -+ err = post_devfn(dev, opaque); -+ if (err) { -+ return err; -+ } -+ } -+ - return 0; - } - -diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h -index f2043a6..ecf5cb3 100644 ---- a/include/hw/qdev-core.h -+++ b/include/hw/qdev-core.h -@@ -253,10 +253,15 @@ BusState *qbus_create(const char *typename, DeviceState *parent, const char *nam - /* Returns > 0 if either devfn or busfn skip walk somewhere in cursion, - * < 0 if either devfn or busfn terminate walk somewhere in cursion, - * 0 otherwise. */ --int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn, -- qbus_walkerfn *busfn, void *opaque); --int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, -- qbus_walkerfn *busfn, void *opaque); -+int qbus_walk_children(BusState *bus, -+ qdev_walkerfn *pre_devfn, qbus_walkerfn *pre_busfn, -+ qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn, -+ void *opaque); -+int qdev_walk_children(DeviceState *dev, -+ qdev_walkerfn *pre_devfn, qbus_walkerfn *pre_busfn, -+ qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn, -+ void *opaque); -+ - void qdev_reset_all(DeviceState *dev); - - /** diff --git a/0003-qdev-switch-reset-to-post-order.patch b/0003-qdev-switch-reset-to-post-order.patch deleted file mode 100644 index a98f3dd..0000000 --- a/0003-qdev-switch-reset-to-post-order.patch +++ /dev/null @@ -1,143 +0,0 @@ -From b7906779d6a9eac1815d61cb34aa3d71154025bb Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Thu, 2 May 2013 11:38:39 +0200 -Subject: [PATCH] qdev: switch reset to post-order - -Post-order is the only sensible direction for the reset signals. -For example, suppose pre-order is used and the parent has some data -structures that cache children state (for example a list of active -requests). When the reset method is invoked on the parent, these caches -could be in any state. - -If post-order is used, on the other hand, these will be in a known state -when the reset method is invoked on the parent. - -This change means that it is no longer possible to block the visit of -the devices, so the callback is changed to return void. This is not -a problem, because PCI was returning 1 exactly in order to achieve the -same ordering that this patch implements. - -PCI can then rely on the qdev core having sent a "reset signal" -(whatever that means) to the device, and only do the PCI-specific -initialization with the new function pci_do_device_reset, extracted -from pci_device_reset. There is no change in the operation of FLR, -which used and still uses pci_device_reset. - -Tested-by: Claudio Bley -Signed-off-by: Paolo Bonzini ---- - hw/core/qdev.c | 6 +++--- - hw/pci/pci.c | 31 ++++++++++++++++--------------- - include/hw/qdev-core.h | 2 +- - 3 files changed, 20 insertions(+), 19 deletions(-) - -diff --git a/hw/core/qdev.c b/hw/core/qdev.c -index 5ddf1aa..d2ffe35 100644 ---- a/hw/core/qdev.c -+++ b/hw/core/qdev.c -@@ -233,19 +233,19 @@ static int qbus_reset_one(BusState *bus, void *opaque) - { - BusClass *bc = BUS_GET_CLASS(bus); - if (bc->reset) { -- return bc->reset(bus); -+ bc->reset(bus); - } - return 0; - } - - void qdev_reset_all(DeviceState *dev) - { -- qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL, NULL, NULL); -+ qdev_walk_children(dev, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL); - } - - void qbus_reset_all(BusState *bus) - { -- qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL, NULL, NULL); -+ qbus_walk_children(bus, NULL, NULL, qdev_reset_one, qbus_reset_one, NULL); - } - - void qbus_reset_all_fn(void *opaque) -diff --git a/hw/pci/pci.c b/hw/pci/pci.c -index 504ed9d..8806636 100644 ---- a/hw/pci/pci.c -+++ b/hw/pci/pci.c -@@ -46,7 +46,7 @@ - static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent); - static char *pcibus_get_dev_path(DeviceState *dev); - static char *pcibus_get_fw_dev_path(DeviceState *dev); --static int pcibus_reset(BusState *qbus); -+static void pcibus_reset(BusState *qbus); - static void pci_bus_finalize(Object *obj); - - static Property pci_props[] = { -@@ -167,16 +167,10 @@ void pci_device_deassert_intx(PCIDevice *dev) - } - } - --/* -- * This function is called on #RST and FLR. -- * FLR if PCI_EXP_DEVCTL_BCR_FLR is set -- */ --void pci_device_reset(PCIDevice *dev) -+static void pci_do_device_reset(PCIDevice *dev) - { - int r; - -- qdev_reset_all(&dev->qdev); -- - dev->irq_state = 0; - pci_update_irq_status(dev); - pci_device_deassert_intx(dev); -@@ -209,10 +203,21 @@ void pci_device_reset(PCIDevice *dev) - } - - /* -+ * This function is called on #RST and FLR. -+ * FLR if PCI_EXP_DEVCTL_BCR_FLR is set -+ */ -+void pci_device_reset(PCIDevice *dev) -+{ -+ qdev_reset_all(&dev->qdev); -+ pci_do_device_reset(dev); -+} -+ -+/* - * Trigger pci bus reset under a given bus. -- * To be called on RST# assert. -+ * Called via qbus_reset_all on RST# assert, after the devices -+ * have been reset qdev_reset_all-ed already. - */ --static int pcibus_reset(BusState *qbus) -+static void pcibus_reset(BusState *qbus) - { - PCIBus *bus = DO_UPCAST(PCIBus, qbus, qbus); - int i; -@@ -222,13 +227,9 @@ static int pcibus_reset(BusState *qbus) - } - for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) { - if (bus->devices[i]) { -- pci_device_reset(bus->devices[i]); -+ pci_do_device_reset(bus->devices[i]); - } - } -- -- /* topology traverse is done by pci_bus_reset(). -- Tell qbus/qdev walker not to traverse the tree */ -- return 1; - } - - static void pci_host_bus_register(PCIBus *bus, DeviceState *parent) -diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h -index ecf5cb3..a9ce4a3 100644 ---- a/include/hw/qdev-core.h -+++ b/include/hw/qdev-core.h -@@ -158,7 +158,7 @@ struct BusClass { - * bindings can be found at http://playground.sun.com/1275/bindings/. - */ - char *(*get_fw_dev_path)(DeviceState *dev); -- int (*reset)(BusState *bus); -+ void (*reset)(BusState *bus); - /* maximum devices allowed on the bus, 0: no limit. */ - int max_dev; - }; diff --git a/0004-virtio-bus-remove-vdev-field.patch b/0004-virtio-bus-remove-vdev-field.patch deleted file mode 100644 index b2823f5..0000000 --- a/0004-virtio-bus-remove-vdev-field.patch +++ /dev/null @@ -1,248 +0,0 @@ -From d704692d459a40bd28950e734a57075b0ab87393 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:50 +0200 -Subject: [PATCH] virtio-bus: remove vdev field - -The vdev field is complicated to synchronize. Just access the -BusState's list of children. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/virtio/virtio-bus.c | 65 +++++++++++++++++++++++++----------------- - hw/virtio/virtio-mmio.c | 9 +++--- - hw/virtio/virtio-pci.c | 2 +- - include/hw/virtio/virtio-bus.h | 16 ++++++++--- - 4 files changed, 57 insertions(+), 35 deletions(-) - -diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c -index e6b103c..17dd06e 100644 ---- a/hw/virtio/virtio-bus.c -+++ b/hw/virtio/virtio-bus.c -@@ -46,8 +46,6 @@ int virtio_bus_plug_device(VirtIODevice *vdev) - VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus); - DPRINTF("%s: plug device.\n", qbus->name); - -- bus->vdev = vdev; -- - if (klass->device_plugged != NULL) { - klass->device_plugged(qbus->parent); - } -@@ -58,9 +56,11 @@ int virtio_bus_plug_device(VirtIODevice *vdev) - /* Reset the virtio_bus */ - void virtio_bus_reset(VirtioBusState *bus) - { -+ VirtIODevice *vdev = virtio_bus_get_device(bus); -+ - DPRINTF("%s: reset device.\n", qbus->name); -- if (bus->vdev != NULL) { -- virtio_reset(bus->vdev); -+ if (vdev != NULL) { -+ virtio_reset(vdev); - } - } - -@@ -69,62 +69,71 @@ void virtio_bus_destroy_device(VirtioBusState *bus) - { - BusState *qbus = BUS(bus); - VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus); -+ VirtIODevice *vdev = virtio_bus_get_device(bus); -+ - DPRINTF("%s: remove device.\n", qbus->name); - -- if (bus->vdev != NULL) { -+ if (vdev != NULL) { - if (klass->device_unplug != NULL) { - klass->device_unplug(qbus->parent); - } -- object_unparent(OBJECT(bus->vdev)); -- bus->vdev = NULL; -+ object_unparent(OBJECT(vdev)); - } - } - - /* Get the device id of the plugged device. */ - uint16_t virtio_bus_get_vdev_id(VirtioBusState *bus) - { -- assert(bus->vdev != NULL); -- return bus->vdev->device_id; -+ VirtIODevice *vdev = virtio_bus_get_device(bus); -+ assert(vdev != NULL); -+ return vdev->device_id; - } - - /* Get the config_len field of the plugged device. */ - size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus) - { -- assert(bus->vdev != NULL); -- return bus->vdev->config_len; -+ VirtIODevice *vdev = virtio_bus_get_device(bus); -+ assert(vdev != NULL); -+ return vdev->config_len; - } - - /* Get the features of the plugged device. */ - uint32_t virtio_bus_get_vdev_features(VirtioBusState *bus, - uint32_t requested_features) - { -+ VirtIODevice *vdev = virtio_bus_get_device(bus); - VirtioDeviceClass *k; -- assert(bus->vdev != NULL); -- k = VIRTIO_DEVICE_GET_CLASS(bus->vdev); -+ -+ assert(vdev != NULL); -+ k = VIRTIO_DEVICE_GET_CLASS(vdev); - assert(k->get_features != NULL); -- return k->get_features(bus->vdev, requested_features); -+ return k->get_features(vdev, requested_features); - } - - /* Set the features of the plugged device. */ - void virtio_bus_set_vdev_features(VirtioBusState *bus, - uint32_t requested_features) - { -+ VirtIODevice *vdev = virtio_bus_get_device(bus); - VirtioDeviceClass *k; -- assert(bus->vdev != NULL); -- k = VIRTIO_DEVICE_GET_CLASS(bus->vdev); -+ -+ assert(vdev != NULL); -+ k = VIRTIO_DEVICE_GET_CLASS(vdev); - if (k->set_features != NULL) { -- k->set_features(bus->vdev, requested_features); -+ k->set_features(vdev, requested_features); - } - } - - /* Get bad features of the plugged device. */ - uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus) - { -+ VirtIODevice *vdev = virtio_bus_get_device(bus); - VirtioDeviceClass *k; -- assert(bus->vdev != NULL); -- k = VIRTIO_DEVICE_GET_CLASS(bus->vdev); -+ -+ assert(vdev != NULL); -+ k = VIRTIO_DEVICE_GET_CLASS(vdev); - if (k->bad_features != NULL) { -- return k->bad_features(bus->vdev); -+ return k->bad_features(vdev); - } else { - return 0; - } -@@ -133,22 +142,26 @@ uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus) - /* Get config of the plugged device. */ - void virtio_bus_get_vdev_config(VirtioBusState *bus, uint8_t *config) - { -+ VirtIODevice *vdev = virtio_bus_get_device(bus); - VirtioDeviceClass *k; -- assert(bus->vdev != NULL); -- k = VIRTIO_DEVICE_GET_CLASS(bus->vdev); -+ -+ assert(vdev != NULL); -+ k = VIRTIO_DEVICE_GET_CLASS(vdev); - if (k->get_config != NULL) { -- k->get_config(bus->vdev, config); -+ k->get_config(vdev, config); - } - } - - /* Set config of the plugged device. */ - void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config) - { -+ VirtIODevice *vdev = virtio_bus_get_device(bus); - VirtioDeviceClass *k; -- assert(bus->vdev != NULL); -- k = VIRTIO_DEVICE_GET_CLASS(bus->vdev); -+ -+ assert(vdev != NULL); -+ k = VIRTIO_DEVICE_GET_CLASS(vdev); - if (k->set_config != NULL) { -- k->set_config(bus->vdev, config); -+ k->set_config(vdev, config); - } - } - -diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c -index 29cf284..8829eb0 100644 ---- a/hw/virtio/virtio-mmio.c -+++ b/hw/virtio/virtio-mmio.c -@@ -95,7 +95,7 @@ static void virtio_mmio_bus_new(VirtioBusState *bus, size_t bus_size, - static uint64_t virtio_mmio_read(void *opaque, hwaddr offset, unsigned size) - { - VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque; -- VirtIODevice *vdev = proxy->bus.vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - - DPRINTF("virtio_mmio_read offset 0x%x\n", (int)offset); - -@@ -185,7 +185,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, - unsigned size) - { - VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque; -- VirtIODevice *vdev = proxy->bus.vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - - DPRINTF("virtio_mmio_write offset 0x%x value 0x%" PRIx64 "\n", - (int)offset, value); -@@ -298,12 +298,13 @@ static const MemoryRegionOps virtio_mem_ops = { - static void virtio_mmio_update_irq(DeviceState *opaque, uint16_t vector) - { - VirtIOMMIOProxy *proxy = VIRTIO_MMIO(opaque); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - int level; - -- if (!proxy->bus.vdev) { -+ if (!vdev) { - return; - } -- level = (proxy->bus.vdev->isr != 0); -+ level = (vdev->isr != 0); - DPRINTF("virtio_mmio setting IRQ %d\n", level); - qemu_set_irq(proxy->irq, level); - } -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 7647be8..76b7652 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -943,7 +943,7 @@ static void virtio_pci_device_plugged(DeviceState *d) - uint8_t *config; - uint32_t size; - -- proxy->vdev = bus->vdev; -+ proxy->vdev = virtio_bus_get_device(bus); - - config = proxy->pci_dev.config; - if (proxy->class_code) { -diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h -index 9217f85..ba0f86a 100644 ---- a/include/hw/virtio/virtio-bus.h -+++ b/include/hw/virtio/virtio-bus.h -@@ -72,10 +72,6 @@ typedef struct VirtioBusClass { - - struct VirtioBusState { - BusState parent_obj; -- /* -- * Only one VirtIODevice can be plugged on the bus. -- */ -- VirtIODevice *vdev; - }; - - int virtio_bus_plug_device(VirtIODevice *vdev); -@@ -98,4 +94,16 @@ void virtio_bus_get_vdev_config(VirtioBusState *bus, uint8_t *config); - /* Set config of the plugged device. */ - void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config); - -+static inline VirtIODevice *virtio_bus_get_device(VirtioBusState *bus) -+{ -+ BusState *qbus = &bus->parent_obj; -+ BusChild *kid = QTAILQ_FIRST(&qbus->children); -+ DeviceState *qdev = kid ? kid->child : NULL; -+ -+ /* This is used on the data path, the cast is guaranteed -+ * to succeed by the qdev machinery. -+ */ -+ return (VirtIODevice *)qdev; -+} -+ - #endif /* VIRTIO_BUS_H */ diff --git a/0005-virtio-pci-remove-vdev-field.patch b/0005-virtio-pci-remove-vdev-field.patch deleted file mode 100644 index 5e636b4..0000000 --- a/0005-virtio-pci-remove-vdev-field.patch +++ /dev/null @@ -1,447 +0,0 @@ -From 3dfc39e3dcdf006d3aef8b8be1f3947f9393b90f Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:51 +0200 -Subject: [PATCH] virtio-pci: remove vdev field - -The vdev field is complicated to synchronize. Just access the -BusState's list of children. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/s390x/virtio-ccw.h | 1 - - hw/virtio/virtio-pci.c | 107 +++++++++++++++++++++++++++++-------------------- - hw/virtio/virtio-pci.h | 1 - - 3 files changed, 63 insertions(+), 46 deletions(-) - -diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h -index 96d6f5d..00932c7 100644 ---- a/hw/s390x/virtio-ccw.h -+++ b/hw/s390x/virtio-ccw.h -@@ -77,7 +77,6 @@ typedef struct VirtIOCCWDeviceClass { - struct VirtioCcwDevice { - DeviceState parent_obj; - SubchDev *sch; -- VirtIODevice *vdev; - char *bus_id; - uint32_t host_features[VIRTIO_CCW_FEATURE_SIZE]; - VirtioBusState bus; -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index 76b7652..be18e92 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -113,31 +113,39 @@ static inline VirtIOPCIProxy *to_virtio_pci_proxy_fast(DeviceState *d) - static void virtio_pci_notify(DeviceState *d, uint16_t vector) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy_fast(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ - if (msix_enabled(&proxy->pci_dev)) - msix_notify(&proxy->pci_dev, vector); - else -- pci_set_irq(&proxy->pci_dev, proxy->vdev->isr & 1); -+ pci_set_irq(&proxy->pci_dev, vdev->isr & 1); - } - - static void virtio_pci_save_config(DeviceState *d, QEMUFile *f) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ - pci_device_save(&proxy->pci_dev, f); - msix_save(&proxy->pci_dev, f); - if (msix_present(&proxy->pci_dev)) -- qemu_put_be16(f, proxy->vdev->config_vector); -+ qemu_put_be16(f, vdev->config_vector); - } - - static void virtio_pci_save_queue(DeviceState *d, int n, QEMUFile *f) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ - if (msix_present(&proxy->pci_dev)) -- qemu_put_be16(f, virtio_queue_vector(proxy->vdev, n)); -+ qemu_put_be16(f, virtio_queue_vector(vdev, n)); - } - - static int virtio_pci_load_config(DeviceState *d, QEMUFile *f) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ - int ret; - ret = pci_device_load(&proxy->pci_dev, f); - if (ret) { -@@ -146,12 +154,12 @@ static int virtio_pci_load_config(DeviceState *d, QEMUFile *f) - msix_unuse_all_vectors(&proxy->pci_dev); - msix_load(&proxy->pci_dev, f); - if (msix_present(&proxy->pci_dev)) { -- qemu_get_be16s(f, &proxy->vdev->config_vector); -+ qemu_get_be16s(f, &vdev->config_vector); - } else { -- proxy->vdev->config_vector = VIRTIO_NO_VECTOR; -+ vdev->config_vector = VIRTIO_NO_VECTOR; - } -- if (proxy->vdev->config_vector != VIRTIO_NO_VECTOR) { -- return msix_vector_use(&proxy->pci_dev, proxy->vdev->config_vector); -+ if (vdev->config_vector != VIRTIO_NO_VECTOR) { -+ return msix_vector_use(&proxy->pci_dev, vdev->config_vector); - } - return 0; - } -@@ -159,13 +167,15 @@ static int virtio_pci_load_config(DeviceState *d, QEMUFile *f) - static int virtio_pci_load_queue(DeviceState *d, int n, QEMUFile *f) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ - uint16_t vector; - if (msix_present(&proxy->pci_dev)) { - qemu_get_be16s(f, &vector); - } else { - vector = VIRTIO_NO_VECTOR; - } -- virtio_queue_set_vector(proxy->vdev, n, vector); -+ virtio_queue_set_vector(vdev, n, vector); - if (vector != VIRTIO_NO_VECTOR) { - return msix_vector_use(&proxy->pci_dev, vector); - } -@@ -175,7 +185,8 @@ static int virtio_pci_load_queue(DeviceState *d, int n, QEMUFile *f) - static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy, - int n, bool assign, bool set_handler) - { -- VirtQueue *vq = virtio_get_queue(proxy->vdev, n); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ VirtQueue *vq = virtio_get_queue(vdev, n); - EventNotifier *notifier = virtio_queue_get_host_notifier(vq); - int r = 0; - -@@ -200,6 +211,7 @@ static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy, - - static void virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy) - { -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - int n, r; - - if (!(proxy->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD) || -@@ -209,7 +221,7 @@ static void virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy) - } - - for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -- if (!virtio_queue_get_num(proxy->vdev, n)) { -+ if (!virtio_queue_get_num(vdev, n)) { - continue; - } - -@@ -223,7 +235,7 @@ static void virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy) - - assign_error: - while (--n >= 0) { -- if (!virtio_queue_get_num(proxy->vdev, n)) { -+ if (!virtio_queue_get_num(vdev, n)) { - continue; - } - -@@ -236,6 +248,7 @@ assign_error: - - static void virtio_pci_stop_ioeventfd(VirtIOPCIProxy *proxy) - { -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - int r; - int n; - -@@ -244,7 +257,7 @@ static void virtio_pci_stop_ioeventfd(VirtIOPCIProxy *proxy) - } - - for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -- if (!virtio_queue_get_num(proxy->vdev, n)) { -+ if (!virtio_queue_get_num(vdev, n)) { - continue; - } - -@@ -257,7 +270,7 @@ static void virtio_pci_stop_ioeventfd(VirtIOPCIProxy *proxy) - static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) - { - VirtIOPCIProxy *proxy = opaque; -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - hwaddr pa; - - switch (addr) { -@@ -272,7 +285,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) - pa = (hwaddr)val << VIRTIO_PCI_QUEUE_ADDR_SHIFT; - if (pa == 0) { - virtio_pci_stop_ioeventfd(proxy); -- virtio_reset(proxy->vdev); -+ virtio_reset(vdev); - msix_unuse_all_vectors(&proxy->pci_dev); - } - else -@@ -299,7 +312,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) - } - - if (vdev->status == 0) { -- virtio_reset(proxy->vdev); -+ virtio_reset(vdev); - msix_unuse_all_vectors(&proxy->pci_dev); - } - -@@ -335,7 +348,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) - - static uint32_t virtio_ioport_read(VirtIOPCIProxy *proxy, uint32_t addr) - { -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - uint32_t ret = 0xFFFFFFFF; - - switch (addr) { -@@ -381,6 +394,7 @@ static uint64_t virtio_pci_config_read(void *opaque, hwaddr addr, - unsigned size) - { - VirtIOPCIProxy *proxy = opaque; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev); - uint64_t val = 0; - if (addr < config) { -@@ -390,16 +404,16 @@ static uint64_t virtio_pci_config_read(void *opaque, hwaddr addr, - - switch (size) { - case 1: -- val = virtio_config_readb(proxy->vdev, addr); -+ val = virtio_config_readb(vdev, addr); - break; - case 2: -- val = virtio_config_readw(proxy->vdev, addr); -+ val = virtio_config_readw(vdev, addr); - if (virtio_is_big_endian()) { - val = bswap16(val); - } - break; - case 4: -- val = virtio_config_readl(proxy->vdev, addr); -+ val = virtio_config_readl(vdev, addr); - if (virtio_is_big_endian()) { - val = bswap32(val); - } -@@ -413,6 +427,7 @@ static void virtio_pci_config_write(void *opaque, hwaddr addr, - { - VirtIOPCIProxy *proxy = opaque; - uint32_t config = VIRTIO_PCI_CONFIG(&proxy->pci_dev); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - if (addr < config) { - virtio_ioport_write(proxy, addr, val); - return; -@@ -424,19 +439,19 @@ static void virtio_pci_config_write(void *opaque, hwaddr addr, - */ - switch (size) { - case 1: -- virtio_config_writeb(proxy->vdev, addr, val); -+ virtio_config_writeb(vdev, addr, val); - break; - case 2: - if (virtio_is_big_endian()) { - val = bswap16(val); - } -- virtio_config_writew(proxy->vdev, addr, val); -+ virtio_config_writew(vdev, addr, val); - break; - case 4: - if (virtio_is_big_endian()) { - val = bswap32(val); - } -- virtio_config_writel(proxy->vdev, addr, val); -+ virtio_config_writel(vdev, addr, val); - break; - } - } -@@ -455,6 +470,7 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, - uint32_t val, int len) - { - VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - - pci_default_write_config(pci_dev, address, val, len); - -@@ -462,8 +478,7 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address, - !(pci_dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER) && - !(proxy->flags & VIRTIO_PCI_FLAG_BUS_MASTER_BUG)) { - virtio_pci_stop_ioeventfd(proxy); -- virtio_set_status(proxy->vdev, -- proxy->vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK); -+ virtio_set_status(vdev, vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK); - } - } - -@@ -506,7 +521,8 @@ static int kvm_virtio_pci_irqfd_use(VirtIOPCIProxy *proxy, - unsigned int vector) - { - VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector]; -- VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ VirtQueue *vq = virtio_get_queue(vdev, queue_no); - EventNotifier *n = virtio_queue_get_guest_notifier(vq); - int ret; - ret = kvm_irqchip_add_irqfd_notifier(kvm_state, n, NULL, irqfd->virq); -@@ -517,7 +533,8 @@ static void kvm_virtio_pci_irqfd_release(VirtIOPCIProxy *proxy, - unsigned int queue_no, - unsigned int vector) - { -- VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ VirtQueue *vq = virtio_get_queue(vdev, queue_no); - EventNotifier *n = virtio_queue_get_guest_notifier(vq); - VirtIOIRQFD *irqfd = &proxy->vector_irqfd[vector]; - int ret; -@@ -529,7 +546,7 @@ static void kvm_virtio_pci_irqfd_release(VirtIOPCIProxy *proxy, - static int kvm_virtio_pci_vector_use(VirtIOPCIProxy *proxy, int nvqs) - { - PCIDevice *dev = &proxy->pci_dev; -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - unsigned int vector; - int ret, queue_no; -@@ -578,7 +595,7 @@ undo: - static void kvm_virtio_pci_vector_release(VirtIOPCIProxy *proxy, int nvqs) - { - PCIDevice *dev = &proxy->pci_dev; -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - unsigned int vector; - int queue_no; - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -@@ -606,8 +623,9 @@ static int virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy, - unsigned int vector, - MSIMessage msg) - { -- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(proxy->vdev); -- VirtQueue *vq = virtio_get_queue(proxy->vdev, queue_no); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); -+ VirtQueue *vq = virtio_get_queue(vdev, queue_no); - EventNotifier *n = virtio_queue_get_guest_notifier(vq); - VirtIOIRQFD *irqfd; - int ret = 0; -@@ -626,10 +644,10 @@ static int virtio_pci_vq_vector_unmask(VirtIOPCIProxy *proxy, - * Otherwise, set it up now. - */ - if (k->guest_notifier_mask) { -- k->guest_notifier_mask(proxy->vdev, queue_no, false); -+ k->guest_notifier_mask(vdev, queue_no, false); - /* Test after unmasking to avoid losing events. */ - if (k->guest_notifier_pending && -- k->guest_notifier_pending(proxy->vdev, queue_no)) { -+ k->guest_notifier_pending(vdev, queue_no)) { - event_notifier_set(n); - } - } else { -@@ -642,13 +660,14 @@ static void virtio_pci_vq_vector_mask(VirtIOPCIProxy *proxy, - unsigned int queue_no, - unsigned int vector) - { -- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(proxy->vdev); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - - /* If guest supports masking, keep irqfd but mask it. - * Otherwise, clean it up now. - */ - if (k->guest_notifier_mask) { -- k->guest_notifier_mask(proxy->vdev, queue_no, true); -+ k->guest_notifier_mask(vdev, queue_no, true); - } else { - kvm_virtio_pci_irqfd_release(proxy, queue_no, vector); - } -@@ -658,7 +677,7 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector, - MSIMessage msg) - { - VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - int ret, queue_no; - - for (queue_no = 0; queue_no < proxy->nvqs_with_notifiers; queue_no++) { -@@ -688,7 +707,7 @@ undo: - static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector) - { - VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - int queue_no; - - for (queue_no = 0; queue_no < proxy->nvqs_with_notifiers; queue_no++) { -@@ -707,7 +726,7 @@ static void virtio_pci_vector_poll(PCIDevice *dev, - unsigned int vector_end) - { - VirtIOPCIProxy *proxy = container_of(dev, VirtIOPCIProxy, pci_dev); -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - int queue_no; - unsigned int vector; -@@ -739,8 +758,9 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign, - bool with_irqfd) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -- VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(proxy->vdev); -- VirtQueue *vq = virtio_get_queue(proxy->vdev, n); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); -+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); -+ VirtQueue *vq = virtio_get_queue(vdev, n); - EventNotifier *notifier = virtio_queue_get_guest_notifier(vq); - - if (assign) { -@@ -755,7 +775,7 @@ static int virtio_pci_set_guest_notifier(DeviceState *d, int n, bool assign, - } - - if (!msix_enabled(&proxy->pci_dev) && vdc->guest_notifier_mask) { -- vdc->guest_notifier_mask(proxy->vdev, n, !assign); -+ vdc->guest_notifier_mask(vdev, n, !assign); - } - - return 0; -@@ -770,7 +790,7 @@ static bool virtio_pci_query_guest_notifiers(DeviceState *d) - static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -- VirtIODevice *vdev = proxy->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - int r, n; - bool with_irqfd = msix_enabled(&proxy->pci_dev) && -@@ -864,11 +884,12 @@ static int virtio_pci_set_host_notifier(DeviceState *d, int n, bool assign) - static void virtio_pci_vmstate_change(DeviceState *d, bool running) - { - VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - - if (running) { - /* Try to find out if the guest has bus master disabled, but is - in ready state. Then we have a buggy guest OS. */ -- if ((proxy->vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) && -+ if ((vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) && - !(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) { - proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG; - } -@@ -943,8 +964,6 @@ static void virtio_pci_device_plugged(DeviceState *d) - uint8_t *config; - uint32_t size; - -- proxy->vdev = virtio_bus_get_device(bus); -- - config = proxy->pci_dev.config; - if (proxy->class_code) { - pci_config_set_class(config, proxy->class_code); -diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h -index 917bcc5..dc332ae 100644 ---- a/hw/virtio/virtio-pci.h -+++ b/hw/virtio/virtio-pci.h -@@ -82,7 +82,6 @@ typedef struct VirtioPCIClass { - - struct VirtIOPCIProxy { - PCIDevice pci_dev; -- VirtIODevice *vdev; - MemoryRegion bar; - uint32_t flags; - uint32_t class_code; diff --git a/0006-virtio-ccw-remove-vdev-field.patch b/0006-virtio-ccw-remove-vdev-field.patch deleted file mode 100644 index d1244d8..0000000 --- a/0006-virtio-ccw-remove-vdev-field.patch +++ /dev/null @@ -1,293 +0,0 @@ -From 6f5e351c3f91e76a70c0684276af8070cfeb07da Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:52 +0200 -Subject: [PATCH] virtio-ccw: remove vdev field - -The vdev field is complicated to synchronize. Just access the -BusState's list of children. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/s390x/virtio-ccw.c | 80 ++++++++++++++++++++++++++++----------------------- - 1 file changed, 44 insertions(+), 36 deletions(-) - -diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c -index f93a81c..8947196 100644 ---- a/hw/s390x/virtio-ccw.c -+++ b/hw/s390x/virtio-ccw.c -@@ -57,9 +57,10 @@ static const TypeInfo virtual_css_bus_info = { - VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch) - { - VirtIODevice *vdev = NULL; -+ VirtioCcwDevice *dev = sch->driver_data; - -- if (sch->driver_data) { -- vdev = ((VirtioCcwDevice *)sch->driver_data)->vdev; -+ if (dev) { -+ vdev = virtio_bus_get_device(&dev->bus); - } - return vdev; - } -@@ -67,7 +68,8 @@ VirtIODevice *virtio_ccw_get_vdev(SubchDev *sch) - static int virtio_ccw_set_guest2host_notifier(VirtioCcwDevice *dev, int n, - bool assign, bool set_handler) - { -- VirtQueue *vq = virtio_get_queue(dev->vdev, n); -+ VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); -+ VirtQueue *vq = virtio_get_queue(vdev, n); - EventNotifier *notifier = virtio_queue_get_host_notifier(vq); - int r = 0; - SubchDev *sch = dev->sch; -@@ -97,6 +99,7 @@ static int virtio_ccw_set_guest2host_notifier(VirtioCcwDevice *dev, int n, - - static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) - { -+ VirtIODevice *vdev; - int n, r; - - if (!(dev->flags & VIRTIO_CCW_FLAG_USE_IOEVENTFD) || -@@ -104,8 +107,9 @@ static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) - dev->ioeventfd_started) { - return; - } -+ vdev = virtio_bus_get_device(&dev->bus); - for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -- if (!virtio_queue_get_num(dev->vdev, n)) { -+ if (!virtio_queue_get_num(vdev, n)) { - continue; - } - r = virtio_ccw_set_guest2host_notifier(dev, n, true, true); -@@ -118,7 +122,7 @@ static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) - - assign_error: - while (--n >= 0) { -- if (!virtio_queue_get_num(dev->vdev, n)) { -+ if (!virtio_queue_get_num(vdev, n)) { - continue; - } - r = virtio_ccw_set_guest2host_notifier(dev, n, false, false); -@@ -132,13 +136,15 @@ static void virtio_ccw_start_ioeventfd(VirtioCcwDevice *dev) - - static void virtio_ccw_stop_ioeventfd(VirtioCcwDevice *dev) - { -+ VirtIODevice *vdev; - int n, r; - - if (!dev->ioeventfd_started) { - return; - } -+ vdev = virtio_bus_get_device(&dev->bus); - for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { -- if (!virtio_queue_get_num(dev->vdev, n)) { -+ if (!virtio_queue_get_num(vdev, n)) { - continue; - } - r = virtio_ccw_set_guest2host_notifier(dev, n, false, false); -@@ -189,7 +195,7 @@ typedef struct VirtioFeatDesc { - static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, - uint16_t index, uint16_t num) - { -- VirtioCcwDevice *dev = sch->driver_data; -+ VirtIODevice *vdev = virtio_ccw_get_vdev(sch); - - if (index > VIRTIO_PCI_QUEUE_MAX) { - return -EINVAL; -@@ -200,23 +206,23 @@ static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, - return -EINVAL; - } - -- if (!dev) { -+ if (!vdev) { - return -EINVAL; - } - -- virtio_queue_set_addr(dev->vdev, index, addr); -+ virtio_queue_set_addr(vdev, index, addr); - if (!addr) { -- virtio_queue_set_vector(dev->vdev, index, 0); -+ virtio_queue_set_vector(vdev, index, 0); - } else { - /* Fail if we don't have a big enough queue. */ - /* TODO: Add interface to handle vring.num changing */ -- if (virtio_queue_get_num(dev->vdev, index) > num) { -+ if (virtio_queue_get_num(vdev, index) > num) { - return -EINVAL; - } -- virtio_queue_set_vector(dev->vdev, index, index); -+ virtio_queue_set_vector(vdev, index, index); - } - /* tell notify handler in case of config change */ -- dev->vdev->config_vector = VIRTIO_PCI_QUEUE_MAX; -+ vdev->config_vector = VIRTIO_PCI_QUEUE_MAX; - return 0; - } - -@@ -230,6 +236,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - hwaddr indicators; - VqConfigBlock vq_config; - VirtioCcwDevice *dev = sch->driver_data; -+ VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); - bool check_len; - int len; - hwaddr hw_len; -@@ -272,7 +279,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - break; - case CCW_CMD_VDEV_RESET: - virtio_ccw_stop_ioeventfd(dev); -- virtio_reset(dev->vdev); -+ virtio_reset(vdev); - ret = 0; - break; - case CCW_CMD_READ_FEAT: -@@ -319,7 +326,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - features.features = ldl_le_phys(ccw.cda); - if (features.index < ARRAY_SIZE(dev->host_features)) { - virtio_bus_set_vdev_features(&dev->bus, features.features); -- dev->vdev->guest_features = features.features; -+ vdev->guest_features = features.features; - } else { - /* - * If the guest supports more feature bits, assert that it -@@ -337,30 +344,30 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - break; - case CCW_CMD_READ_CONF: - if (check_len) { -- if (ccw.count > dev->vdev->config_len) { -+ if (ccw.count > vdev->config_len) { - ret = -EINVAL; - break; - } - } -- len = MIN(ccw.count, dev->vdev->config_len); -+ len = MIN(ccw.count, vdev->config_len); - if (!ccw.cda) { - ret = -EFAULT; - } else { -- virtio_bus_get_vdev_config(&dev->bus, dev->vdev->config); -+ virtio_bus_get_vdev_config(&dev->bus, vdev->config); - /* XXX config space endianness */ -- cpu_physical_memory_write(ccw.cda, dev->vdev->config, len); -+ cpu_physical_memory_write(ccw.cda, vdev->config, len); - sch->curr_status.scsw.count = ccw.count - len; - ret = 0; - } - break; - case CCW_CMD_WRITE_CONF: - if (check_len) { -- if (ccw.count > dev->vdev->config_len) { -+ if (ccw.count > vdev->config_len) { - ret = -EINVAL; - break; - } - } -- len = MIN(ccw.count, dev->vdev->config_len); -+ len = MIN(ccw.count, vdev->config_len); - hw_len = len; - if (!ccw.cda) { - ret = -EFAULT; -@@ -371,9 +378,9 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - } else { - len = hw_len; - /* XXX config space endianness */ -- memcpy(dev->vdev->config, config, len); -+ memcpy(vdev->config, config, len); - cpu_physical_memory_unmap(config, hw_len, 0, hw_len); -- virtio_bus_set_vdev_config(&dev->bus, dev->vdev->config); -+ virtio_bus_set_vdev_config(&dev->bus, vdev->config); - sch->curr_status.scsw.count = ccw.count - len; - ret = 0; - } -@@ -397,9 +404,9 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) { - virtio_ccw_stop_ioeventfd(dev); - } -- virtio_set_status(dev->vdev, status); -- if (dev->vdev->status == 0) { -- virtio_reset(dev->vdev); -+ virtio_set_status(vdev, status); -+ if (vdev->status == 0) { -+ virtio_reset(vdev); - } - if (status & VIRTIO_CONFIG_S_DRIVER_OK) { - virtio_ccw_start_ioeventfd(dev); -@@ -463,7 +470,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) - ret = -EFAULT; - } else { - vq_config.index = lduw_phys(ccw.cda); -- vq_config.num_max = virtio_queue_get_num(dev->vdev, -+ vq_config.num_max = virtio_queue_get_num(vdev, - vq_config.index); - stw_phys(ccw.cda + sizeof(vq_config.index), vq_config.num_max); - sch->curr_status.scsw.count = ccw.count - sizeof(vq_config); -@@ -495,7 +502,6 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev) - sch->driver_data = dev; - dev->sch = sch; - -- dev->vdev = vdev; - dev->indicators = 0; - - /* Initialize subchannel structure. */ -@@ -608,7 +614,7 @@ static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev) - memset(&sch->id, 0, sizeof(SenseId)); - sch->id.reserved = 0xff; - sch->id.cu_type = VIRTIO_CCW_CU_TYPE; -- sch->id.cu_model = dev->vdev->device_id; -+ sch->id.cu_model = vdev->device_id; - - /* Only the first 32 feature bits are used. */ - dev->host_features[0] = virtio_bus_get_vdev_features(&dev->bus, -@@ -892,9 +898,10 @@ static unsigned virtio_ccw_get_features(DeviceState *d) - static void virtio_ccw_reset(DeviceState *d) - { - VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); -+ VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); - - virtio_ccw_stop_ioeventfd(dev); -- virtio_reset(dev->vdev); -+ virtio_reset(vdev); - css_reset_sch(dev->sch); - dev->indicators = 0; - dev->indicators2 = 0; -@@ -934,9 +941,10 @@ static int virtio_ccw_set_host_notifier(DeviceState *d, int n, bool assign) - static int virtio_ccw_set_guest_notifier(VirtioCcwDevice *dev, int n, - bool assign, bool with_irqfd) - { -- VirtQueue *vq = virtio_get_queue(dev->vdev, n); -+ VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); -+ VirtQueue *vq = virtio_get_queue(vdev, n); - EventNotifier *notifier = virtio_queue_get_guest_notifier(vq); -- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(dev->vdev); -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - - if (assign) { - int r = event_notifier_init(notifier, 0); -@@ -952,16 +960,16 @@ static int virtio_ccw_set_guest_notifier(VirtioCcwDevice *dev, int n, - * land in qemu (and only the irq fd) in this code. - */ - if (k->guest_notifier_mask) { -- k->guest_notifier_mask(dev->vdev, n, false); -+ k->guest_notifier_mask(vdev, n, false); - } - /* get lost events and re-inject */ - if (k->guest_notifier_pending && -- k->guest_notifier_pending(dev->vdev, n)) { -+ k->guest_notifier_pending(vdev, n)) { - event_notifier_set(notifier); - } - } else { - if (k->guest_notifier_mask) { -- k->guest_notifier_mask(dev->vdev, n, true); -+ k->guest_notifier_mask(vdev, n, true); - } - virtio_queue_set_guest_notifier_fd_handler(vq, false, with_irqfd); - event_notifier_cleanup(notifier); -@@ -973,7 +981,7 @@ static int virtio_ccw_set_guest_notifiers(DeviceState *d, int nvqs, - bool assigned) - { - VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d); -- VirtIODevice *vdev = dev->vdev; -+ VirtIODevice *vdev = virtio_bus_get_device(&dev->bus); - int r, n; - - for (n = 0; n < nvqs; n++) { diff --git a/0007-virtio-bus-cleanup-plug-unplug-interface.patch b/0007-virtio-bus-cleanup-plug-unplug-interface.patch deleted file mode 100644 index aa86829..0000000 --- a/0007-virtio-bus-cleanup-plug-unplug-interface.patch +++ /dev/null @@ -1,148 +0,0 @@ -From e26f88b6280b2386c36d3b3d5ec820deb1ac7749 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:53 +0200 -Subject: [PATCH] virtio-bus: cleanup plug/unplug interface - -Right now we have these pairs: - -- virtio_bus_plug_device/virtio_bus_destroy_device. The first - takes a VirtIODevice, the second takes a VirtioBusState - -- device_plugged/device_unplug callbacks in the VirtioBusClass - (here it's just the naming that is inconsistent) - -- virtio_bus_destroy_device is not called by anyone (and since - it calls qdev_free, it would be called by the proxies---but - then the callback is useless since the proxies can do whatever - they want before calling virtio_bus_destroy_device) - -And there is a k->init but no k->exit, hence virtio_device_exit is -overwritten by subclasses (except virtio-9p). This cleans it up by: - -- renaming the device_unplug callback to device_unplugged - -- renaming virtio_bus_plug_device to virtio_bus_device_plugged, - matching the callback name - -- renaming virtio_bus_destroy_device to virtio_bus_device_unplugged, - removing the qdev_free, making it take a VirtIODevice and calling it - from virtio_device_exit - -- adding a k->exit callback - -virtio_device_exit is still overwritten, the next patches will fix that. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/virtio/virtio-bus.c | 18 +++++++++--------- - hw/virtio/virtio.c | 7 ++++++- - include/hw/virtio/virtio-bus.h | 6 +++--- - include/hw/virtio/virtio.h | 1 + - 4 files changed, 19 insertions(+), 13 deletions(-) - -diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c -index 17dd06e..7aed6a4 100644 ---- a/hw/virtio/virtio-bus.c -+++ b/hw/virtio/virtio-bus.c -@@ -37,8 +37,8 @@ do { printf("virtio_bus: " fmt , ## __VA_ARGS__); } while (0) - #define DPRINTF(fmt, ...) do { } while (0) - #endif - --/* Plug the VirtIODevice */ --int virtio_bus_plug_device(VirtIODevice *vdev) -+/* A VirtIODevice is being plugged */ -+int virtio_bus_device_plugged(VirtIODevice *vdev) - { - DeviceState *qdev = DEVICE(vdev); - BusState *qbus = BUS(qdev_get_parent_bus(qdev)); -@@ -64,20 +64,20 @@ void virtio_bus_reset(VirtioBusState *bus) - } - } - --/* Destroy the VirtIODevice */ --void virtio_bus_destroy_device(VirtioBusState *bus) -+/* A VirtIODevice is being unplugged */ -+void virtio_bus_device_unplugged(VirtIODevice *vdev) - { -- BusState *qbus = BUS(bus); -+ DeviceState *qdev = DEVICE(vdev); -+ BusState *qbus = BUS(qdev_get_parent_bus(qdev)); -+ VirtioBusState *bus = VIRTIO_BUS(qbus); - VirtioBusClass *klass = VIRTIO_BUS_GET_CLASS(bus); -- VirtIODevice *vdev = virtio_bus_get_device(bus); - - DPRINTF("%s: remove device.\n", qbus->name); - - if (vdev != NULL) { -- if (klass->device_unplug != NULL) { -- klass->device_unplug(qbus->parent); -+ if (klass->device_unplugged != NULL) { -+ klass->device_unplugged(qbus->parent); - } -- object_unparent(OBJECT(vdev)); - } - } - -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c -index 2f1e73b..965b2c0 100644 ---- a/hw/virtio/virtio.c -+++ b/hw/virtio/virtio.c -@@ -1158,14 +1158,19 @@ static int virtio_device_init(DeviceState *qdev) - if (k->init(vdev) < 0) { - return -1; - } -- virtio_bus_plug_device(vdev); -+ virtio_bus_device_plugged(vdev); - return 0; - } - - static int virtio_device_exit(DeviceState *qdev) - { - VirtIODevice *vdev = VIRTIO_DEVICE(qdev); -+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(qdev); - -+ virtio_bus_device_unplugged(vdev); -+ if (k->exit) { -+ k->exit(vdev); -+ } - if (vdev->bus_name) { - g_free(vdev->bus_name); - vdev->bus_name = NULL; -diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h -index ba0f86a..0756545 100644 ---- a/include/hw/virtio/virtio-bus.h -+++ b/include/hw/virtio/virtio-bus.h -@@ -61,7 +61,7 @@ typedef struct VirtioBusClass { - * transport independent exit function. - * This is called by virtio-bus just before the device is unplugged. - */ -- void (*device_unplug)(DeviceState *d); -+ void (*device_unplugged)(DeviceState *d); - /* - * Does the transport have variable vring alignment? - * (ie can it ever call virtio_queue_set_align()?) -@@ -74,9 +74,9 @@ struct VirtioBusState { - BusState parent_obj; - }; - --int virtio_bus_plug_device(VirtIODevice *vdev); -+int virtio_bus_device_plugged(VirtIODevice *vdev); - void virtio_bus_reset(VirtioBusState *bus); --void virtio_bus_destroy_device(VirtioBusState *bus); -+void virtio_bus_device_unplugged(VirtIODevice *bus); - /* Get the device id of the plugged device. */ - uint16_t virtio_bus_get_vdev_id(VirtioBusState *bus); - /* Get the config_len field of the plugged device. */ -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h -index a90522d..59756c2 100644 ---- a/include/hw/virtio/virtio.h -+++ b/include/hw/virtio/virtio.h -@@ -127,6 +127,7 @@ typedef struct VirtioDeviceClass { - /* This is what a VirtioDevice must implement */ - DeviceClass parent; - int (*init)(VirtIODevice *vdev); -+ void (*exit)(VirtIODevice *vdev); - uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features); - uint32_t (*bad_features)(VirtIODevice *vdev); - void (*set_features)(VirtIODevice *vdev, uint32_t val); diff --git a/0008-virtio-blk-switch-exit-callback-to-VirtioDeviceClass.patch b/0008-virtio-blk-switch-exit-callback-to-VirtioDeviceClass.patch deleted file mode 100644 index cbf3ad3..0000000 --- a/0008-virtio-blk-switch-exit-callback-to-VirtioDeviceClass.patch +++ /dev/null @@ -1,53 +0,0 @@ -From e8821c68009a5b801ffef6d7d9ed5d770c0bfd9f Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:54 +0200 -Subject: [PATCH] virtio-blk: switch exit callback to VirtioDeviceClass - -This ensures hot-unplug is handled properly by the proxy. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/block/virtio-blk.c | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c -index 13f6d82..7f0440f 100644 ---- a/hw/block/virtio-blk.c -+++ b/hw/block/virtio-blk.c -@@ -728,20 +728,18 @@ static int virtio_blk_device_init(VirtIODevice *vdev) - return 0; - } - --static int virtio_blk_device_exit(DeviceState *dev) -+static void virtio_blk_device_exit(VirtIODevice *vdev) - { -- VirtIODevice *vdev = VIRTIO_DEVICE(dev); -- VirtIOBlock *s = VIRTIO_BLK(dev); -+ VirtIOBlock *s = VIRTIO_BLK(vdev); - #ifdef CONFIG_VIRTIO_BLK_DATA_PLANE - remove_migration_state_change_notifier(&s->migration_state_notifier); - virtio_blk_data_plane_destroy(s->dataplane); - s->dataplane = NULL; - #endif - qemu_del_vm_change_state_handler(s->change); -- unregister_savevm(dev, "virtio-blk", s); -+ unregister_savevm(DEVICE(vdev), "virtio-blk", s); - blockdev_mark_auto_del(s->bs); - virtio_cleanup(vdev); -- return 0; - } - - static Property virtio_blk_properties[] = { -@@ -753,10 +751,10 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -- dc->exit = virtio_blk_device_exit; - dc->props = virtio_blk_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - vdc->init = virtio_blk_device_init; -+ vdc->exit = virtio_blk_device_exit; - vdc->get_config = virtio_blk_update_config; - vdc->set_config = virtio_blk_set_config; - vdc->get_features = virtio_blk_get_features; diff --git a/0009-virtio-serial-switch-exit-callback-to-VirtioDeviceCl.patch b/0009-virtio-serial-switch-exit-callback-to-VirtioDeviceCl.patch deleted file mode 100644 index 840e1e3..0000000 --- a/0009-virtio-serial-switch-exit-callback-to-VirtioDeviceCl.patch +++ /dev/null @@ -1,53 +0,0 @@ -From b4ea3493c8c99bd854eec8640bd5c90c31e8ac14 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:55 +0200 -Subject: [PATCH] virtio-serial: switch exit callback to VirtioDeviceClass - -This ensures hot-unplug is handled properly by the proxy. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/char/virtio-serial-bus.c | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c -index 703f026..a7ede90 100644 ---- a/hw/char/virtio-serial-bus.c -+++ b/hw/char/virtio-serial-bus.c -@@ -987,12 +987,11 @@ static const TypeInfo virtio_serial_port_type_info = { - .class_init = virtio_serial_port_class_init, - }; - --static int virtio_serial_device_exit(DeviceState *dev) -+static void virtio_serial_device_exit(VirtIODevice *vdev) - { -- VirtIOSerial *vser = VIRTIO_SERIAL(dev); -- VirtIODevice *vdev = VIRTIO_DEVICE(dev); -+ VirtIOSerial *vser = VIRTIO_SERIAL(vdev); - -- unregister_savevm(dev, "virtio-console", vser); -+ unregister_savevm(DEVICE(vdev), "virtio-console", vser); - - g_free(vser->ivqs); - g_free(vser->ovqs); -@@ -1004,7 +1003,6 @@ static int virtio_serial_device_exit(DeviceState *dev) - g_free(vser->post_load); - } - virtio_cleanup(vdev); -- return 0; - } - - static Property virtio_serial_properties[] = { -@@ -1016,10 +1014,10 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -- dc->exit = virtio_serial_device_exit; - dc->props = virtio_serial_properties; - set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - vdc->init = virtio_serial_device_init; -+ vdc->exit = virtio_serial_device_exit; - vdc->get_features = get_features; - vdc->get_config = get_config; - vdc->set_config = set_config; diff --git a/0010-virtio-net-switch-exit-callback-to-VirtioDeviceClass.patch b/0010-virtio-net-switch-exit-callback-to-VirtioDeviceClass.patch deleted file mode 100644 index 0406b04..0000000 --- a/0010-virtio-net-switch-exit-callback-to-VirtioDeviceClass.patch +++ /dev/null @@ -1,58 +0,0 @@ -From d399f7bf1a035d6158d20d3f11a44f03e15132d0 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:56 +0200 -Subject: [PATCH] virtio-net: switch exit callback to VirtioDeviceClass - -This ensures hot-unplug is handled properly by the proxy. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/net/virtio-net.c | 11 ++++------- - 1 file changed, 4 insertions(+), 7 deletions(-) - -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c -index b75c753..93a81eb 100644 ---- a/hw/net/virtio-net.c -+++ b/hw/net/virtio-net.c -@@ -1570,16 +1570,15 @@ static int virtio_net_device_init(VirtIODevice *vdev) - return 0; - } - --static int virtio_net_device_exit(DeviceState *qdev) -+static void virtio_net_device_exit(VirtIODevice *vdev) - { -- VirtIONet *n = VIRTIO_NET(qdev); -- VirtIODevice *vdev = VIRTIO_DEVICE(qdev); -+ VirtIONet *n = VIRTIO_NET(vdev); - int i; - - /* This will stop vhost backend if appropriate. */ - virtio_net_set_status(vdev, 0); - -- unregister_savevm(qdev, "virtio-net", n); -+ unregister_savevm(DEVICE(vdev), "virtio-net", n); - - if (n->netclient_name) { - g_free(n->netclient_name); -@@ -1610,8 +1609,6 @@ static int virtio_net_device_exit(DeviceState *qdev) - g_free(n->vqs); - qemu_del_nic(n->nic); - virtio_cleanup(vdev); -- -- return 0; - } - - static void virtio_net_instance_init(Object *obj) -@@ -1638,10 +1635,10 @@ static void virtio_net_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -- dc->exit = virtio_net_device_exit; - dc->props = virtio_net_properties; - set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); - vdc->init = virtio_net_device_init; -+ vdc->exit = virtio_net_device_exit; - vdc->get_config = virtio_net_get_config; - vdc->set_config = virtio_net_set_config; - vdc->get_features = virtio_net_get_features; diff --git a/0011-virtio-scsi-switch-exit-callback-to-VirtioDeviceClas.patch b/0011-virtio-scsi-switch-exit-callback-to-VirtioDeviceClas.patch deleted file mode 100644 index d34ab57..0000000 --- a/0011-virtio-scsi-switch-exit-callback-to-VirtioDeviceClas.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 18a73436b50ec6c28afde849c6de23ad7ebed459 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:57 +0200 -Subject: [PATCH] virtio-scsi: switch exit callback to VirtioDeviceClass - -This ensures hot-unplug is handled properly by the proxy. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/scsi/vhost-scsi.c | 11 +++++------ - hw/scsi/virtio-scsi.c | 15 +++++++-------- - include/hw/virtio/virtio-scsi.h | 2 +- - 3 files changed, 13 insertions(+), 15 deletions(-) - -diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c -index 9e770fb..5e3cc61 100644 ---- a/hw/scsi/vhost-scsi.c -+++ b/hw/scsi/vhost-scsi.c -@@ -240,11 +240,10 @@ static int vhost_scsi_init(VirtIODevice *vdev) - return 0; - } - --static int vhost_scsi_exit(DeviceState *qdev) -+static void vhost_scsi_exit(VirtIODevice *vdev) - { -- VirtIODevice *vdev = VIRTIO_DEVICE(qdev); -- VHostSCSI *s = VHOST_SCSI(qdev); -- VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(qdev); -+ VHostSCSI *s = VHOST_SCSI(vdev); -+ VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev); - - migrate_del_blocker(s->migration_blocker); - error_free(s->migration_blocker); -@@ -253,7 +252,7 @@ static int vhost_scsi_exit(DeviceState *qdev) - vhost_scsi_set_status(vdev, 0); - - g_free(s->dev.vqs); -- return virtio_scsi_common_exit(vs); -+ virtio_scsi_common_exit(vs); - } - - static Property vhost_scsi_properties[] = { -@@ -265,10 +264,10 @@ static void vhost_scsi_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -- dc->exit = vhost_scsi_exit; - dc->props = vhost_scsi_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - vdc->init = vhost_scsi_init; -+ vdc->exit = vhost_scsi_exit; - vdc->get_features = vhost_scsi_get_features; - vdc->set_config = vhost_scsi_set_config; - vdc->set_status = vhost_scsi_set_status; -diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c -index 26d95a1..83344ea 100644 ---- a/hw/scsi/virtio-scsi.c -+++ b/hw/scsi/virtio-scsi.c -@@ -644,22 +644,21 @@ static int virtio_scsi_device_init(VirtIODevice *vdev) - return 0; - } - --int virtio_scsi_common_exit(VirtIOSCSICommon *vs) -+void virtio_scsi_common_exit(VirtIOSCSICommon *vs) - { - VirtIODevice *vdev = VIRTIO_DEVICE(vs); - - g_free(vs->cmd_vqs); - virtio_cleanup(vdev); -- return 0; - } - --static int virtio_scsi_device_exit(DeviceState *qdev) -+static void virtio_scsi_device_exit(VirtIODevice *vdev) - { -- VirtIOSCSI *s = VIRTIO_SCSI(qdev); -- VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(qdev); -+ VirtIOSCSI *s = VIRTIO_SCSI(vdev); -+ VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(vdev); - -- unregister_savevm(qdev, "virtio-scsi", s); -- return virtio_scsi_common_exit(vs); -+ unregister_savevm(DEVICE(vdev), "virtio-scsi", s); -+ virtio_scsi_common_exit(vs); - } - - static Property virtio_scsi_properties[] = { -@@ -680,10 +679,10 @@ static void virtio_scsi_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -- dc->exit = virtio_scsi_device_exit; - dc->props = virtio_scsi_properties; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - vdc->init = virtio_scsi_device_init; -+ vdc->exit = virtio_scsi_device_exit; - vdc->set_config = virtio_scsi_set_config; - vdc->get_features = virtio_scsi_get_features; - vdc->reset = virtio_scsi_reset; -diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h -index 9a98540..206c61d 100644 ---- a/include/hw/virtio/virtio-scsi.h -+++ b/include/hw/virtio/virtio-scsi.h -@@ -187,6 +187,6 @@ typedef struct { - VIRTIO_SCSI_F_CHANGE, true) - - int virtio_scsi_common_init(VirtIOSCSICommon *vs); --int virtio_scsi_common_exit(VirtIOSCSICommon *vs); -+void virtio_scsi_common_exit(VirtIOSCSICommon *vs); - - #endif /* _QEMU_VIRTIO_SCSI_H */ diff --git a/0012-virtio-balloon-switch-exit-callback-to-VirtioDeviceC.patch b/0012-virtio-balloon-switch-exit-callback-to-VirtioDeviceC.patch deleted file mode 100644 index 004dc8c..0000000 --- a/0012-virtio-balloon-switch-exit-callback-to-VirtioDeviceC.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 7f334f1eb88807e2fc7ae42cc729f8dd371833e4 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:58 +0200 -Subject: [PATCH] virtio-balloon: switch exit callback to VirtioDeviceClass - -This ensures hot-unplug is handled properly by the proxy. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/virtio/virtio-balloon.c | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c -index 9504877..d7a392d 100644 ---- a/hw/virtio/virtio-balloon.c -+++ b/hw/virtio/virtio-balloon.c -@@ -370,16 +370,14 @@ static int virtio_balloon_device_init(VirtIODevice *vdev) - return 0; - } - --static int virtio_balloon_device_exit(DeviceState *qdev) -+static void virtio_balloon_device_exit(VirtIODevice *vdev) - { -- VirtIOBalloon *s = VIRTIO_BALLOON(qdev); -- VirtIODevice *vdev = VIRTIO_DEVICE(qdev); -+ VirtIOBalloon *s = VIRTIO_BALLOON(vdev); - - balloon_stats_destroy_timer(s); - qemu_remove_balloon_handler(s); -- unregister_savevm(qdev, "virtio-balloon", s); -+ unregister_savevm(DEVICE(vdev), "virtio-balloon", s); - virtio_cleanup(vdev); -- return 0; - } - - static Property virtio_balloon_properties[] = { -@@ -390,10 +388,10 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -- dc->exit = virtio_balloon_device_exit; - dc->props = virtio_balloon_properties; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - vdc->init = virtio_balloon_device_init; -+ vdc->exit = virtio_balloon_device_exit; - vdc->get_config = virtio_balloon_get_config; - vdc->set_config = virtio_balloon_set_config; - vdc->get_features = virtio_balloon_get_features; diff --git a/0013-virtio-rng-switch-exit-callback-to-VirtioDeviceClass.patch b/0013-virtio-rng-switch-exit-callback-to-VirtioDeviceClass.patch deleted file mode 100644 index 5eabe78..0000000 --- a/0013-virtio-rng-switch-exit-callback-to-VirtioDeviceClass.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 8b9a562e23dbfdfb23a5eeb1b619619290216ad8 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:57:59 +0200 -Subject: [PATCH] virtio-rng: switch exit callback to VirtioDeviceClass - -This ensures hot-unplug is handled properly by the proxy. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/virtio/virtio-rng.c | 10 ++++------ - 1 file changed, 4 insertions(+), 6 deletions(-) - -diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c -index b22ccf1..42ca568 100644 ---- a/hw/virtio/virtio-rng.c -+++ b/hw/virtio/virtio-rng.c -@@ -190,16 +190,14 @@ static int virtio_rng_device_init(VirtIODevice *vdev) - return 0; - } - --static int virtio_rng_device_exit(DeviceState *qdev) -+static void virtio_rng_device_exit(VirtIODevice *vdev) - { -- VirtIORNG *vrng = VIRTIO_RNG(qdev); -- VirtIODevice *vdev = VIRTIO_DEVICE(qdev); -+ VirtIORNG *vrng = VIRTIO_RNG(vdev); - - timer_del(vrng->rate_limit_timer); - timer_free(vrng->rate_limit_timer); -- unregister_savevm(qdev, "virtio-rng", vrng); -+ unregister_savevm(DEVICE(vdev), "virtio-rng", vrng); - virtio_cleanup(vdev); -- return 0; - } - - static Property virtio_rng_properties[] = { -@@ -211,10 +209,10 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data) - { - DeviceClass *dc = DEVICE_CLASS(klass); - VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); -- dc->exit = virtio_rng_device_exit; - dc->props = virtio_rng_properties; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - vdc->init = virtio_rng_device_init; -+ vdc->exit = virtio_rng_device_exit; - vdc->get_features = get_features; - } - diff --git a/0014-virtio-pci-add-device_unplugged-callback.patch b/0014-virtio-pci-add-device_unplugged-callback.patch deleted file mode 100644 index 5fdc5d9..0000000 --- a/0014-virtio-pci-add-device_unplugged-callback.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 96412e68c312ae4d91d6febc2284951f8b295ef7 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Fri, 20 Sep 2013 16:58:00 +0200 -Subject: [PATCH] virtio-pci: add device_unplugged callback - -This fixes a crash in hot-unplug of virtio-pci devices behind a PCIe -switch. The crash happens because the ioeventfd is still set whent the -child is destroyed (destruction happens in postorder). Then the proxy -tries to unset to ioeventfd, but the virtqueue structure that holds the -EventNotifier has been trashed in the meanwhile. kvm_set_ioeventfd_pio -does not expect failure and aborts. - -The fix is simply to move parts of uninitialization to a new -device_unplugged callback, which is called before the child is destroyed. - -Cc: qemu-stable@nongnu.org -Signed-off-by: Paolo Bonzini ---- - hw/virtio/virtio-pci.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c -index be18e92..1a363ca 100644 ---- a/hw/virtio/virtio-pci.c -+++ b/hw/virtio/virtio-pci.c -@@ -1001,6 +1001,15 @@ static void virtio_pci_device_plugged(DeviceState *d) - proxy->host_features); - } - -+static void virtio_pci_device_unplugged(DeviceState *d) -+{ -+ PCIDevice *pci_dev = PCI_DEVICE(d); -+ VirtIOPCIProxy *proxy = VIRTIO_PCI(d); -+ -+ virtio_pci_stop_ioeventfd(proxy); -+ msix_uninit_exclusive_bar(pci_dev); -+} -+ - static int virtio_pci_init(PCIDevice *pci_dev) - { - VirtIOPCIProxy *dev = VIRTIO_PCI(pci_dev); -@@ -1015,9 +1024,7 @@ static int virtio_pci_init(PCIDevice *pci_dev) - static void virtio_pci_exit(PCIDevice *pci_dev) - { - VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev); -- virtio_pci_stop_ioeventfd(proxy); - memory_region_destroy(&proxy->bar); -- msix_uninit_exclusive_bar(pci_dev); - } - - static void virtio_pci_reset(DeviceState *qdev) -@@ -1552,6 +1559,7 @@ static void virtio_pci_bus_class_init(ObjectClass *klass, void *data) - k->set_guest_notifiers = virtio_pci_set_guest_notifiers; - k->vmstate_change = virtio_pci_vmstate_change; - k->device_plugged = virtio_pci_device_plugged; -+ k->device_unplugged = virtio_pci_device_unplugged; - } - - static const TypeInfo virtio_pci_bus_info = { diff --git a/0101-block-Close-backing-file-early-in-bdrv_img_create.patch b/0101-block-Close-backing-file-early-in-bdrv_img_create.patch deleted file mode 100644 index 86d4ad1..0000000 --- a/0101-block-Close-backing-file-early-in-bdrv_img_create.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 62a30a970548466900ac45962a0fe8c051514329 Mon Sep 17 00:00:00 2001 -From: Max Reitz -Date: Tue, 3 Dec 2013 14:57:52 +0100 -Subject: [PATCH] block: Close backing file early in bdrv_img_create - -Leaving the backing file open although it is not needed anymore can -cause problems if it is opened through a block driver which allows -exclusive access only and if the create function of the block driver -used for the top image (the one being created) tries to close and reopen -the image file (which will include opening the backing file a second -time). - -In particular, this will happen with a backing file opened through -qemu-nbd and using qcow2 as the top image file format (which reopens the -image to flush it to disk). - -In addition, the BlockDriverState in bdrv_img_create() is used for the -backing file only; it should therefore be made local to the respective -block. - -Signed-off-by: Max Reitz ---- - block.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/block.c b/block.c -index 382ea71..0468765 100644 ---- a/block.c -+++ b/block.c -@@ -4504,7 +4504,6 @@ void bdrv_img_create(const char *filename, const char *fmt, - { - QEMUOptionParameter *param = NULL, *create_options = NULL; - QEMUOptionParameter *backing_fmt, *backing_file, *size; -- BlockDriverState *bs = NULL; - BlockDriver *drv, *proto_drv; - BlockDriver *backing_drv = NULL; - Error *local_err = NULL; -@@ -4583,6 +4582,7 @@ void bdrv_img_create(const char *filename, const char *fmt, - size = get_option_parameter(param, BLOCK_OPT_SIZE); - if (size && size->value.n == -1) { - if (backing_file && backing_file->value.s) { -+ BlockDriverState *bs; - uint64_t size; - char buf[32]; - int back_flags; -@@ -4601,6 +4601,7 @@ void bdrv_img_create(const char *filename, const char *fmt, - error_get_pretty(local_err)); - error_free(local_err); - local_err = NULL; -+ bdrv_unref(bs); - goto out; - } - bdrv_get_geometry(bs, &size); -@@ -4608,6 +4609,8 @@ void bdrv_img_create(const char *filename, const char *fmt, - - snprintf(buf, sizeof(buf), "%" PRId64, size); - set_option_parameter(param, BLOCK_OPT_SIZE, buf); -+ -+ bdrv_unref(bs); - } else { - error_setg(errp, "Image creation needs a size parameter"); - goto out; -@@ -4638,9 +4641,6 @@ out: - free_option_parameters(create_options); - free_option_parameters(param); - -- if (bs) { -- bdrv_unref(bs); -- } - if (error_is_set(&local_err)) { - error_propagate(errp, local_err); - } diff --git a/0102-seccomp-add-kill-to-the-syscall-whitelist.patch b/0102-seccomp-add-kill-to-the-syscall-whitelist.patch deleted file mode 100644 index b101332..0000000 --- a/0102-seccomp-add-kill-to-the-syscall-whitelist.patch +++ /dev/null @@ -1,42 +0,0 @@ -From cebb1cd8d123360634243ac527c136721fb7fba7 Mon Sep 17 00:00:00 2001 -From: Paul Moore -Date: Thu, 21 Nov 2013 10:40:15 -0500 -Subject: [PATCH] seccomp: add kill() to the syscall whitelist - -The kill() syscall is triggered with the following command: - - # qemu -sandbox on -monitor stdio \ - -device intel-hda -device hda-duplex -vnc :0 - -The resulting syslog/audit message: - - # ausearch -m SECCOMP - ---- - time->Wed Nov 20 09:52:08 2013 - type=SECCOMP msg=audit(1384912328.482:6656): auid=0 uid=0 gid=0 ses=854 - subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=12087 - comm="qemu-kvm" sig=31 syscall=62 compat=0 ip=0x7f7a1d2abc67 code=0x0 - # scmp_sys_resolver 62 - kill - -Reported-by: CongLi -Tested-by: CongLi -Signed-off-by: Paul Moore -Acked-by: Eduardo Otubo -(cherry picked from commit e9eecb5bf82a71564bf018fcbbfc6cda19cab6c2) ---- - qemu-seccomp.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/qemu-seccomp.c b/qemu-seccomp.c -index 69cee44..cf07869 100644 ---- a/qemu-seccomp.c -+++ b/qemu-seccomp.c -@@ -114,6 +114,7 @@ static const struct QemuSeccompSyscall seccomp_whitelist[] = { - { SCMP_SYS(write), 244 }, - { SCMP_SYS(fcntl), 243 }, - { SCMP_SYS(tgkill), 242 }, -+ { SCMP_SYS(kill), 242 }, - { SCMP_SYS(rt_sigaction), 242 }, - { SCMP_SYS(pipe2), 242 }, - { SCMP_SYS(munmap), 242 }, diff --git a/0103-spice-flip-streaming-video-mode-to-off-by-default.patch b/0103-spice-flip-streaming-video-mode-to-off-by-default.patch deleted file mode 100644 index afa6ac5..0000000 --- a/0103-spice-flip-streaming-video-mode-to-off-by-default.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 200413b505dfc4ae8611d523e87f1dee18a6bf0f Mon Sep 17 00:00:00 2001 -From: Gerd Hoffmann -Date: Mon, 2 Dec 2013 11:17:04 +0100 -Subject: [PATCH] spice: flip streaming video mode to off by default - -Video streaming detection heuristics in spice-server have problems -keeping modern desktop animations (as done by gnome shell) and real -video playback apart. This leads to jpeg compression artefacts on -your desktop, due to spice using mjpeg to send what it thinks is -a video stream. - -Turn off video detection by default to avoid these artifacts. - -Signed-off-by: Gerd Hoffmann -Reviewed-by: Alon Levy -(cherry picked from commit f1d3e586f069e17f83b669842bc02d60d509daca) ---- - ui/spice-core.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/ui/spice-core.c b/ui/spice-core.c -index e4d533d..9fb9544 100644 ---- a/ui/spice-core.c -+++ b/ui/spice-core.c -@@ -776,6 +776,8 @@ void qemu_spice_init(void) - if (str) { - int streaming_video = parse_stream_video(str); - spice_server_set_streaming_video(spice_server, streaming_video); -+ } else { -+ spice_server_set_streaming_video(spice_server, SPICE_STREAM_VIDEO_OFF); - } - - spice_server_set_agent_mouse diff --git a/0104-scsi-bus-fix-transfer-length-and-direction-for-VERIF.patch b/0104-scsi-bus-fix-transfer-length-and-direction-for-VERIF.patch deleted file mode 100644 index a204453..0000000 --- a/0104-scsi-bus-fix-transfer-length-and-direction-for-VERIF.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 3b1f248f3f8ff06ed4a4269871138db66e336ec5 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Thu, 28 Nov 2013 11:01:13 +0100 -Subject: [PATCH] scsi-bus: fix transfer length and direction for VERIFY - command -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The amount of bytes to transfer depends on the BYTCHK field. -If any data is transferred, it is sent to the device. - -Cc: qemu-stable@nongnu.org -Tested-by: Hervé Poussineau -Signed-off-by: Paolo Bonzini -(cherry picked from commit d12ad44cc4cc9142179e64295608611f118b8ad8) ---- - hw/scsi/scsi-bus.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c -index ea916d1..2d6ce4d 100644 ---- a/hw/scsi/scsi-bus.c -+++ b/hw/scsi/scsi-bus.c -@@ -886,7 +886,6 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) - case RELEASE: - case ERASE: - case ALLOW_MEDIUM_REMOVAL: -- case VERIFY_10: - case SEEK_10: - case SYNCHRONIZE_CACHE: - case SYNCHRONIZE_CACHE_16: -@@ -903,6 +902,16 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) - case ALLOW_OVERWRITE: - cmd->xfer = 0; - break; -+ case VERIFY_10: -+ case VERIFY_12: -+ case VERIFY_16: -+ if ((buf[1] & 2) == 0) { -+ cmd->xfer = 0; -+ } else if ((buf[1] & 4) == 1) { -+ cmd->xfer = 1; -+ } -+ cmd->xfer *= dev->blocksize; -+ break; - case MODE_SENSE: - break; - case WRITE_SAME_10: -@@ -1100,6 +1109,9 @@ static void scsi_cmd_xfer_mode(SCSICommand *cmd) - case WRITE_VERIFY_12: - case WRITE_16: - case WRITE_VERIFY_16: -+ case VERIFY_10: -+ case VERIFY_12: -+ case VERIFY_16: - case COPY: - case COPY_VERIFY: - case COMPARE: diff --git a/0105-scsi-disk-fix-VERIFY-emulation.patch b/0105-scsi-disk-fix-VERIFY-emulation.patch deleted file mode 100644 index ba8f28e..0000000 --- a/0105-scsi-disk-fix-VERIFY-emulation.patch +++ /dev/null @@ -1,90 +0,0 @@ -From ddc0dda3d6352e4c28e0bd11cce1d90734dce0db Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Thu, 28 Nov 2013 11:18:56 +0100 -Subject: [PATCH] scsi-disk: fix VERIFY emulation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -VERIFY emulation was completely botched (and remained botched through -all the refactorings). The command must be emulated both in check-medium -mode (BYTCHK=00, which we implement by doing nothing) and in check-bytes -mode (which we do not implement yet). Unlike WRITE AND VERIFY (which we -treat simply as WRITE with FUA bit set), VERIFY cannot be handled like -READ. In fact the device is _receiving_ data for VERIFY, not _sending_ -it like READ. - -Cc: qemu-stable@nongnu.org -Tested-by: Hervé Poussineau -Signed-off-by: Paolo Bonzini -(cherry picked from commit d97e7730816094a71cd1f19a56d7a73f77cdbf96) - -Conflicts: - hw/scsi/scsi-disk.c ---- - hw/scsi/scsi-disk.c | 26 +++++++++++++++++++------- - 1 file changed, 19 insertions(+), 7 deletions(-) - -diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c -index 74e6a14..1fd1c26 100644 ---- a/hw/scsi/scsi-disk.c -+++ b/hw/scsi/scsi-disk.c -@@ -1597,6 +1597,14 @@ static void scsi_disk_emulate_write_data(SCSIRequest *req) - scsi_disk_emulate_unmap(r, r->iov.iov_base); - break; - -+ case VERIFY_10: -+ case VERIFY_12: -+ case VERIFY_16: -+ if (r->req.status == -1) { -+ scsi_check_condition(r, SENSE_CODE(INVALID_FIELD)); -+ } -+ break; -+ - default: - abort(); - } -@@ -1837,6 +1845,14 @@ static int32_t scsi_disk_emulate_command(SCSIRequest *req, uint8_t *buf) - case UNMAP: - DPRINTF("Unmap (len %lu)\n", (long)r->req.cmd.xfer); - break; -+ case VERIFY_10: -+ case VERIFY_12: -+ case VERIFY_16: -+ DPRINTF("Verify (bytchk %lu)\n", (r->req.buf[1] >> 1) & 3); -+ if (req->cmd.buf[1] & 6) { -+ goto illegal_request; -+ } -+ break; - case WRITE_SAME_10: - case WRITE_SAME_16: - nb_sectors = scsi_data_cdb_length(r->req.cmd.buf); -@@ -1936,10 +1952,6 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf) - scsi_check_condition(r, SENSE_CODE(WRITE_PROTECTED)); - return 0; - } -- /* fallthrough */ -- case VERIFY_10: -- case VERIFY_12: -- case VERIFY_16: - DPRINTF("Write %s(sector %" PRId64 ", count %u)\n", - (command & 0xe) == 0xe ? "And Verify " : "", - r->req.cmd.lba, len); -@@ -2207,14 +2219,14 @@ static const SCSIReqOps *const scsi_disk_reqops_dispatch[256] = { - [UNMAP] = &scsi_disk_emulate_reqops, - [WRITE_SAME_10] = &scsi_disk_emulate_reqops, - [WRITE_SAME_16] = &scsi_disk_emulate_reqops, -+ [VERIFY_10] = &scsi_disk_emulate_reqops, -+ [VERIFY_12] = &scsi_disk_emulate_reqops, -+ [VERIFY_16] = &scsi_disk_emulate_reqops, - - [READ_6] = &scsi_disk_dma_reqops, - [READ_10] = &scsi_disk_dma_reqops, - [READ_12] = &scsi_disk_dma_reqops, - [READ_16] = &scsi_disk_dma_reqops, -- [VERIFY_10] = &scsi_disk_dma_reqops, -- [VERIFY_12] = &scsi_disk_dma_reqops, -- [VERIFY_16] = &scsi_disk_dma_reqops, - [WRITE_6] = &scsi_disk_dma_reqops, - [WRITE_10] = &scsi_disk_dma_reqops, - [WRITE_12] = &scsi_disk_dma_reqops, diff --git a/qemu.spec b/qemu.spec index 95b1def..cfbe2a2 100644 --- a/qemu.spec +++ b/qemu.spec @@ -138,8 +138,8 @@ Summary: QEMU is a FAST! processor emulator Name: qemu -Version: 1.7.0 -Release: 5%{?dist} +Version: 2.0.0 +Release: 0.1.rc0%{?dist} Epoch: 2 License: GPLv2+ and LGPLv2+ and BSD Group: Development/Tools @@ -154,7 +154,8 @@ ExclusiveArch: %{kvm_archs} %define _smp_mflags %{nil} %endif -Source0: http://wiki.qemu-project.org/download/%{name}-%{version}.tar.bz2 +#Source0: http://wiki.qemu-project.org/download/%{name}-%{version}.tar.bz2 +Source0: http://wiki.qemu-project.org/download/%{name}-%{version}-rc0.tar.bz2 Source1: qemu.binfmt @@ -179,39 +180,7 @@ Source12: bridge.conf # qemu-kvm back compat wrapper Source13: qemu-kvm.sh -# Fix crash in lsi_soft_reset (bz #1000947) -# Patches posted upstream -Patch0001: 0001-pci-do-not-export-pci_bus_reset.patch -Patch0002: 0002-qdev-allow-both-pre-and-post-order-vists-in-qdev-wal.patch -Patch0003: 0003-qdev-switch-reset-to-post-order.patch -# CVE-2013-4377: Fix crash when unplugging virtio devices (bz #1012633, -# bz #1012641) -# Patches posted upstream -Patch0004: 0004-virtio-bus-remove-vdev-field.patch -Patch0005: 0005-virtio-pci-remove-vdev-field.patch -Patch0006: 0006-virtio-ccw-remove-vdev-field.patch -Patch0007: 0007-virtio-bus-cleanup-plug-unplug-interface.patch -Patch0008: 0008-virtio-blk-switch-exit-callback-to-VirtioDeviceClass.patch -Patch0009: 0009-virtio-serial-switch-exit-callback-to-VirtioDeviceCl.patch -Patch0010: 0010-virtio-net-switch-exit-callback-to-VirtioDeviceClass.patch -Patch0011: 0011-virtio-scsi-switch-exit-callback-to-VirtioDeviceClas.patch -Patch0012: 0012-virtio-balloon-switch-exit-callback-to-VirtioDeviceC.patch -Patch0013: 0013-virtio-rng-switch-exit-callback-to-VirtioDeviceClass.patch -Patch0014: 0014-virtio-pci-add-device_unplugged-callback.patch - -# Fix qemu-img create with NBD backing file (bz #1034433) -# Patch posted upstream -Patch0101: 0101-block-Close-backing-file-early-in-bdrv_img_create.patch -# Add kill() to seccomp whitelist, fix AC97 with -sandbox on (bz -# #1043521) -Patch0102: 0102-seccomp-add-kill-to-the-syscall-whitelist.patch -# Changing streaming mode default to off for spice (bz #1038336) -Patch0103: 0103-spice-flip-streaming-video-mode-to-off-by-default.patch -# Fix guest scsi verify command (bz #1001617) -Patch0104: 0104-scsi-bus-fix-transfer-length-and-direction-for-VERIF.patch -Patch0105: 0105-scsi-disk-fix-VERIFY-emulation.patch - -BuildRequires: SDL-devel +BuildRequires: SDL2-devel BuildRequires: zlib-devel BuildRequires: which BuildRequires: chrpath @@ -473,8 +442,8 @@ Requires: %{name}-common = %{epoch}:%{version}-%{release} Provides: kvm = 85 Obsoletes: kvm < 85 Requires: seavgabios-bin -# First version that ships aml files which we depend on -Requires: seabios-bin >= 1.7.3-2 +# First version that ships bios-256k.bin +Requires: seabios-bin >= 1.7.4-3 Requires: sgabios-bin Requires: ipxe-roms-qemu >= 20130517-2.gitc4bce43 %if 0%{?have_seccomp:1} @@ -708,40 +677,9 @@ Requires: libcacard = %{epoch}:%{version}-%{release} CAC emulation development files. %endif + %prep -%setup -q -n qemu-1.7.0 - -# Fix crash in lsi_soft_reset (bz #1000947) -# Patches posted upstream -%patch0001 -p1 -%patch0002 -p1 -%patch0003 -p1 -# CVE-2013-4377: Fix crash when unplugging virtio devices (bz #1012633, -# bz #1012641) -# Patches posted upstream -%patch0004 -p1 -%patch0005 -p1 -%patch0006 -p1 -%patch0007 -p1 -%patch0008 -p1 -%patch0009 -p1 -%patch0010 -p1 -%patch0011 -p1 -%patch0012 -p1 -%patch0013 -p1 -%patch0014 -p1 - -# Fix qemu-img create with NBD backing file (bz #1034433) -# Patch posted upstream -%patch0101 -p1 -# Add kill() to seccomp whitelist, fix AC97 with -sandbox on (bz -# #1043521) -%patch0102 -p1 -# Changing streaming mode default to off for spice (bz #1038336) -%patch0103 -p1 -# Fix guest scsi verify command (bz #1001617) -%patch0104 -p1 -%patch0105 -p1 +%setup -q -n qemu-2.0.0-rc0 %build @@ -754,8 +692,8 @@ CAC emulation development files. mips64el-softmmu or32-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu \ s390x-softmmu sh4-softmmu sh4eb-softmmu sparc-softmmu sparc64-softmmu \ xtensa-softmmu xtensaeb-softmmu unicore32-softmmu moxie-softmmu \ - i386-linux-user x86_64-linux-user alpha-linux-user arm-linux-user \ - armeb-linux-user cris-linux-user m68k-linux-user \ + i386-linux-user x86_64-linux-user aarch64-linux-user alpha-linux-user \ + arm-linux-user armeb-linux-user cris-linux-user m68k-linux-user \ microblaze-linux-user microblazeel-linux-user mips-linux-user \ mipsel-linux-user mips64-linux-user mips64el-linux-user \ mipsn32-linux-user mipsn32el-linux-user \ @@ -775,59 +713,57 @@ buildldflags="VL_LDFLAGS=-Wl,--build-id" sed -i.debug 's/"-g $CFLAGS"/"$CFLAGS"/g' configure %endif - -dobuild() { - ./configure \ - --prefix=%{_prefix} \ - --libdir=%{_libdir} \ - --sysconfdir=%{_sysconfdir} \ - --interp-prefix=%{_prefix}/qemu-%%M \ - --localstatedir=%{_localstatedir} \ - --libexecdir=%{_libexecdir} \ - --disable-strip \ - --extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \ - --extra-cflags="%{optflags} -fPIE -DPIE" \ - --disable-werror \ - --audio-drv-list=pa,sdl,alsa,oss \ - --enable-trace-backend=dtrace \ - --disable-xen \ - --enable-kvm \ - --enable-tpm \ +./configure \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --sysconfdir=%{_sysconfdir} \ + --interp-prefix=%{_prefix}/qemu-%%M \ + --localstatedir=%{_localstatedir} \ + --libexecdir=%{_libexecdir} \ + --disable-strip \ + --extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \ + --extra-cflags="%{optflags} -fPIE -DPIE" \ + --disable-werror \ + --target-list="$buildarch" \ + --audio-drv-list=pa,sdl,alsa,oss \ + --enable-trace-backend=dtrace \ + --disable-xen \ + --enable-kvm \ + --enable-tpm \ %if 0%{?have_spice:1} - --enable-spice \ + --enable-spice \ %else - --disable-spice \ + --disable-spice \ %endif %if 0%{?have_seccomp:1} - --enable-seccomp \ + --enable-seccomp \ %else - --disable-seccomp \ + --disable-seccomp \ %endif %if %{without rbd} - --disable-rbd \ + --disable-rbd \ %endif %if 0%{?need_fdt:1} - --enable-fdt \ + --enable-fdt \ %else - --disable-fdt \ + --disable-fdt \ %endif %if %{with gtk} - --with-gtkabi="3.0" \ + --with-gtkabi="3.0" \ %endif %ifarch s390 - --enable-tcg-interpreter \ + --enable-tcg-interpreter \ %endif - "$@" + --with-sdlabi="2.0" \ + --enable-quorum \ + "$@" - echo "config-host.mak contents:" - echo "===" - cat config-host.mak - echo "===" +echo "config-host.mak contents:" +echo "===" +cat config-host.mak +echo "===" - make V=1 %{?_smp_mflags} $buildldflags -} - -dobuild --target-list="$buildarch" +make V=1 %{?_smp_mflags} $buildldflags gcc %{SOURCE6} -O2 -g -o ksmctl @@ -925,6 +861,7 @@ rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/efi*rom rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/vgabios*bin # Provided by package seabios rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/bios.bin +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/bios-256k.bin rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/acpi-dsdt.aml rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}/q35-acpi-dsdt.aml # Provided by package sgabios @@ -955,6 +892,7 @@ rom_link ../seavgabios/vgabios-qxl.bin vgabios-qxl.bin rom_link ../seavgabios/vgabios-stdvga.bin vgabios-stdvga.bin rom_link ../seavgabios/vgabios-vmware.bin vgabios-vmware.bin rom_link ../seabios/bios.bin bios.bin +rom_link ../seabios/bios-256k.bin bios-256k.bin rom_link ../seabios/acpi-dsdt.aml acpi-dsdt.aml rom_link ../seabios/q35-acpi-dsdt.aml q35-acpi-dsdt.aml rom_link ../sgabios/sgabios.bin sgabios.bin @@ -1186,6 +1124,7 @@ getent passwd qemu >/dev/null || \ %{_exec_prefix}/lib/binfmt.d/qemu-*.conf %{_bindir}/qemu-i386 %{_bindir}/qemu-x86_64 +%{_bindir}/qemu-aarch64 %{_bindir}/qemu-alpha %{_bindir}/qemu-arm %{_bindir}/qemu-armeb @@ -1212,6 +1151,7 @@ getent passwd qemu >/dev/null || \ %{_bindir}/qemu-unicore32 %{_datadir}/systemtap/tapset/qemu-i386.stp %{_datadir}/systemtap/tapset/qemu-x86_64.stp +%{_datadir}/systemtap/tapset/qemu-aarch64.stp %{_datadir}/systemtap/tapset/qemu-alpha.stp %{_datadir}/systemtap/tapset/qemu-arm.stp %{_datadir}/systemtap/tapset/qemu-armeb.stp @@ -1252,6 +1192,7 @@ getent passwd qemu >/dev/null || \ %{_datadir}/%{name}/acpi-dsdt.aml %{_datadir}/%{name}/q35-acpi-dsdt.aml %{_datadir}/%{name}/bios.bin +%{_datadir}/%{name}/bios-256k.bin %{_datadir}/%{name}/sgabios.bin %{_datadir}/%{name}/linuxboot.bin %{_datadir}/%{name}/multiboot.bin @@ -1406,6 +1347,7 @@ getent passwd qemu >/dev/null || \ %{_mandir}/man1/qemu-system-sparc.1* %{_mandir}/man1/qemu-system-sparc64.1* %{_datadir}/%{name}/QEMU,tcx.bin +%{_datadir}/%{name}/QEMU,cgthree.bin %endif %if 0%{?system_ppc:1} @@ -1484,6 +1426,9 @@ getent passwd qemu >/dev/null || \ %endif %changelog +* Tue Mar 18 2014 Cole Robinson 2:2.0.0-0.1.rc0 +- Update to qemu 2.0.0-rc0 + * Tue Feb 18 2014 Richard W.M. Jones - 2:1.7.0-5 - Run qemu-sanity-check on x86 and armv7 too. The results are still only advisory. diff --git a/sources b/sources index 52b8f46..ae7d13f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -32893941d40d052a5e649efcf06aca06 qemu-1.7.0.tar.bz2 +d0cf27a6f861e835de2846f6f53151c2 qemu-2.0.0-rc0.tar.bz2