From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1dDS-0005ma-Ix for qemu-devel@nongnu.org; Mon, 30 Jun 2014 11:10:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1dDI-0008Ca-LV for qemu-devel@nongnu.org; Mon, 30 Jun 2014 11:09:58 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:58489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1dDI-0008CP-AS for qemu-devel@nongnu.org; Mon, 30 Jun 2014 11:09:48 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Jun 2014 16:09:47 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id E031D2190046 for ; Mon, 30 Jun 2014 16:09:31 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5UF9ibp33226870 for ; Mon, 30 Jun 2014 15:09:44 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 s5UF9hqD021218 for ; Mon, 30 Jun 2014 09:09:43 -0600 From: Greg Kurz Date: Mon, 30 Jun 2014 17:09:41 +0200 Message-ID: <20140630150813.6266.18168.stgit@bahia.local> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org Hotplug of a virtio scsi disk is currently broken: no disk appears in the guest (verified with a fedora 20 host running a fedora 20 guest with KVM). Bisect leeds to Paolo's patches to support any_layout, especially this commit: commit 36b15c79aa1bef5fe7543f9f2629b6413720bbfb Author: Paolo Bonzini Date: Tue Jun 10 16:21:18 2014 +0200 virtio-scsi: start preparing for any_layout It modifies virtio_scsi_pop_req() so that it is up to the callers to parse the virtio scsi request. It seems that virtio_scsi_push_event() was not modified accordingly... This patch adds a call to virtio_scsi_parse_req(). It also drops the in size sanity check since it is already done by virtio_scsi_parse_req(). This is enough to have hotplug working again. Signed-off-by: Greg Kurz --- I guess the following check could also be handled by virtio_scsi_parse_req() as it does not allow both in and out at the same time, but I am not sure: if (req->elem.out_num) { virtio_scsi_bad_req(); } Thoughts ? -- Greg hw/scsi/virtio-scsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 04ecfa7..0b0a331 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -565,7 +565,6 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, VirtIOSCSIReq *req; VirtIOSCSIEvent *evt; VirtIODevice *vdev = VIRTIO_DEVICE(s); - int in_size; if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { return; @@ -586,8 +585,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev, s->events_dropped = false; } - in_size = iov_size(req->elem.in_sg, req->elem.in_num); - if (in_size < sizeof(VirtIOSCSIEvent)) { + if (virtio_scsi_parse_req(req, 0, sizeof(VirtIOSCSIEvent))) { virtio_scsi_bad_req(); }