]> xenbits.xensource.com Git - seabios.git/commit
init_virtio_scsi(): reset the HBA before freeing its virtio ring
authorLaszlo Ersek <lersek@redhat.com>
Wed, 15 Jan 2014 01:48:40 +0000 (02:48 +0100)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 17 Jan 2014 17:14:43 +0000 (12:14 -0500)
commit5f2d17d35b2339526f3b3d580b279ea78e406a25
tree34d76b6376856ab394b0e99d42da06d72340ca31
parent296ce2278bae60d844f6c5b96c4889f620b6b4bf
init_virtio_scsi(): reset the HBA before freeing its virtio ring

When init_virtio_scsi() finds no SCSI targets connected to the HBA, it
frees the virtio ring. Other code in SeaBIOS proceeds to overwrite the
area. However, the ring is in use by qemu at that point -- not only did we
report the (ACK|DRIVER|DRIVER_OK) status earlier, we even communicated
over the ring.

Of course SeaBIOS doesn't "kick" the HBA ever again, hence qemu has no
reason to look at the ring. However, when qemu uses KVM acceleration, and
ioeventfd is enabled for the HBA, then a vmstate change to "running"
(including stop->cont monitor commands and incoming migration) "forces" a
kick (see qemu commit 25db9ebe). Qemu then tries to interpret whatever
unrelated guest data is in the HBA's original ring area, as virtio
protocol. Qemu exits upon seeing the garbage.

init_virtio_scsi() should reset the HBA before allowing the virtio ring
memory to be reused. Device reset causes the hypervisor to drop its
references.

This change is justified / underpinned by pure virtio-spec compliance as
well.

Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1013418

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
src/hw/virtio-scsi.c