qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <gkurz@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PULL 1/3] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing
Date: Tue,  1 Jul 2014 10:22:34 +0200	[thread overview]
Message-ID: <1404202956-30657-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1404202956-30657-1-git-send-email-pbonzini@redhat.com>

From: Greg Kurz <gkurz@linux.vnet.ibm.com>

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 <pbonzini@redhat.com>
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 some
sanity checks that are already performed by virtio_scsi_parse_req().

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/virtio-scsi.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 04ecfa7..3fecdca 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;
@@ -577,17 +576,12 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
         return;
     }
 
-    if (req->elem.out_num) {
-        virtio_scsi_bad_req();
-    }
-
     if (s->events_dropped) {
         event |= VIRTIO_SCSI_T_EVENTS_MISSED;
         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();
     }
 
-- 
1.8.3.1

  reply	other threads:[~2014-07-01  8:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01  8:22 [Qemu-devel] [PULL for-2.1 0/3] virtio-scsi fixes, and block/iscsi compilation fix Paolo Bonzini
2014-07-01  8:22 ` Paolo Bonzini [this message]
2014-07-01  8:22 ` [Qemu-devel] [PULL 2/3] virtio-scsi: scsi events must be converted to target endianness Paolo Bonzini
2014-07-01  8:22 ` [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm Paolo Bonzini
2014-07-01  8:26   ` Peter Maydell
2014-07-01 17:26     ` Eric Blake
2014-07-02  7:02     ` Markus Armbruster
2014-07-02  9:40       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404202956-30657-2-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gkurz@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).