[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/8] s390-virtio: Accommodate guests using virtqueues
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 1/8] s390-virtio: Accommodate guests using virtqueues too early |
Date: |
Fri, 8 May 2015 11:08:28 +0200 |
From: Christian Borntraeger <address@hidden>
Feature updates are not a synchronuous operation for the legacy
s390-virtio transport. This transport syncs the guest feature bits
(those from finalize) on the set_status hypercall. Before that qemu
thinks that features are zero, which means QEMU will misbehave, e.g.
it will not write the event index, even if the guest asks for it.
Let's detect the case where a kick happens before the driver is ready
and force sync the features.
With this workaround, it is now safe to switch to the common feature
bit handling code as used by all other transports.
Signed-off-by: Christian Borntraeger <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
hw/s390x/s390-virtio.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index 3a1b9ee..59750db 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -77,6 +77,16 @@ static int s390_virtio_hcall_notify(const uint64_t *args)
if (mem > ram_size) {
VirtIOS390Device *dev = s390_virtio_bus_find_vring(s390_bus, mem, &i);
if (dev) {
+ /*
+ * Older kernels will use the virtqueue before setting DRIVER_OK.
+ * In this case the feature bits are not yet up to date, meaning
+ * that several funny things can happen, e.g. the guest thinks
+ * EVENT_IDX is on and QEMU thinks it is off. Let's force a feature
+ * and status sync.
+ */
+ if (!(dev->vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
+ s390_virtio_device_update_status(dev);
+ }
virtio_queue_notify(dev->vdev, i);
} else {
r = -EINVAL;
--
2.4.0
- [Qemu-devel] [PULL 0/8] s390x: various patches, Cornelia Huck, 2015/05/08
- [Qemu-devel] [PULL 1/8] s390-virtio: Accommodate guests using virtqueues too early,
Cornelia Huck <=
- [Qemu-devel] [PULL 2/8] s390-virtio: use common features, Cornelia Huck, 2015/05/08
- [Qemu-devel] [PULL 3/8] s390-virtio: clear {used, avail}_event_idx on reset as well, Cornelia Huck, 2015/05/08
- [Qemu-devel] [PULL 4/8] virtio-ccw: change realization sequence, Cornelia Huck, 2015/05/08
- [Qemu-devel] [PULL 5/8] virtio-ccw: implement ->device_plugged, Cornelia Huck, 2015/05/08
- [Qemu-devel] [PULL 6/8] s390x/kvm: use ioctl KVM_S390_IRQ for vcpu interrupts, Cornelia Huck, 2015/05/08
- [Qemu-devel] [PULL 7/8] s390x: move fpu regs into a subsection of the vmstate, Cornelia Huck, 2015/05/08
- [Qemu-devel] [PULL 8/8] s390x/kvm: migrate vcpu interrupt state, Cornelia Huck, 2015/05/08
- Re: [Qemu-devel] [PULL 0/8] s390x: various patches, Peter Maydell, 2015/05/11