From: Cédric Le Goater Date: Mon, 30 Jun 2014 15:17:17 +0000 (+0200) Subject: virtio-scsi: scsi events must be converted to target endianness X-Git-Tag: qemu-xen-4.6.0-rc1~336^2~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=424baff549a9c8a7b5e814ce2bcb857d25163468;p=qemu-upstream-4.6-testing.git virtio-scsi: scsi events must be converted to target endianness Virtio SCSI Events need to be byteswapped before being pushed when host and guest have a different endianness. Not doing so breaks hotplug of virtio scsi disks, with the following error message being printed in the guest console: virtio_scsi: Unsupport virtio scsi event 1000000 This issue got uncovered while testing disk hotplug with a PowerKVM ppc64le guest. I have checked that this issue also affects a x86_64 guest run on a ppc64 host. Signed-off-by: Cédric Le Goater [ Ported from PowerKVM, Greg Kurz ] Signed-off-by: Greg Kurz Signed-off-by: Paolo Bonzini --- diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 3fecdcaa2..0eb069ae9 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -587,8 +587,8 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, evt = &req->resp.event; memset(evt, 0, sizeof(VirtIOSCSIEvent)); - evt->event = event; - evt->reason = reason; + evt->event = virtio_tswap32(vdev, event); + evt->reason = virtio_tswap32(vdev, reason); if (!dev) { assert(event == VIRTIO_SCSI_T_EVENTS_MISSED); } else {