mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 13:30:52 +00:00
s390-virtio: Accommodate guests using virtqueues too early
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 <borntraeger@de.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
f8340b360b
commit
cb927b8aee
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user