From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1tL8-00086t-HU for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1tKz-0003y4-DE for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:22:58 -0400 Received: from mail-we0-x236.google.com ([2a00:1450:400c:c03::236]:62003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1tKz-0003xo-0a for qemu-devel@nongnu.org; Tue, 01 Jul 2014 04:22:49 -0400 Received: by mail-we0-f182.google.com with SMTP id q59so9407037wes.13 for ; Tue, 01 Jul 2014 01:22:48 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 1 Jul 2014 10:22:35 +0200 Message-Id: <1404202956-30657-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1404202956-30657-1-git-send-email-pbonzini@redhat.com> References: <1404202956-30657-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 2/3] virtio-scsi: scsi events must be converted to target endianness List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Greg Kurz 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 Signed-off-by: Paolo Bonzini --- 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 3fecdca..0eb069a 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 { -- 1.8.3.1