From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1dKo-00027n-Nm for qemu-devel@nongnu.org; Mon, 30 Jun 2014 11:17:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1dKf-0002q6-15 for qemu-devel@nongnu.org; Mon, 30 Jun 2014 11:17:34 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:60182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1dKe-0002ps-Od for qemu-devel@nongnu.org; Mon, 30 Jun 2014 11:17:24 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Jun 2014 16:17:23 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 38CBB17D805A for ; Mon, 30 Jun 2014 16:18:50 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5UFHKvK31391896 for ; Mon, 30 Jun 2014 15:17:20 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s5UFHJbZ010908 for ; Mon, 30 Jun 2014 09:17:19 -0600 From: Greg Kurz Date: Mon, 30 Jun 2014 17:17:17 +0200 Message-ID: <20140630151704.7027.26979.stgit@bahia.local> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] virtio-scsi: scsi events must be converted to target endianness List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org From: Cédric Le Goater 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 --- hw/scsi/virtio-scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 0b0a331..5568479 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -591,8 +591,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 {