qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Asias He <asias@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	virtualization@lists.linux-foundation.org,
	target-devel@vger.kernel.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH V2 WIP 0/2] vhost-scsi: new device supporting the tcm_vhost Linux kernel module
Date: Thu, 14 Mar 2013 17:25:42 +0800	[thread overview]
Message-ID: <20130314092542.GB7892@hj.localdomain> (raw)
In-Reply-To: <20130314042514.GA28504@hj.localdomain>

On Thu, Mar 14, 2013 at 12:25:14PM +0800, Asias He wrote:
> On Tue, Mar 12, 2013 at 02:29:40PM +0800, Asias He wrote:
> > This is on top of Paolo and Nick's work.
> > 
> > Current status:
> > Works now (guest boots fine, no hang any more) with seabios's virtio-scsi disabled.
> > Rebased to latest qemu.org/master
> > Change details are in commit log.
> > 
> > TODO:
> > Make seabios happy.
> 
> Some updates:
> 
> In seabios, src/virtio-scsi.c:virtio_scsi_cmd()
> 
>     vring_kick(ioaddr, vq, 1);
>     /* Wait for reply */
>     while (!vring_more_used(vq))  ------------>>> we hang here
>         usleep(5);
> 
> In tcm_vhost:
> we got: vhost_get_vq_desc: head: -14, out: 0 in: 81216
> 
> The vring buffer provided by seabios is not correct?

More updates:

Basically, seabios + tcm_vhost works now, with the attached qemu and
seabios patches.

We still have one more issue, vhost_verify_ring_mappings fails.

I am seeing this without the comment out hack.

   Unable to map ring buffer for ring 2
   qemu-system-x86_64: /root/src/qemu/hw/vhost.c:426: vhost_set_memory:
   Assertion `r >= 0' failed.


> > Paolo Bonzini (2):
> >   virtio-scsi: create VirtIOSCSICommon
> >   vhost-scsi: new device supporting the tcm_vhost Linux kernel module
> > 
> >  hw/Makefile.objs           |   5 +-
> >  hw/s390x/s390-virtio-bus.c |  35 +++++++
> >  hw/vhost-scsi.c            | 242 +++++++++++++++++++++++++++++++++++++++++++++
> >  hw/vhost-scsi.h            |  64 ++++++++++++
> >  hw/virtio-pci.c            |  59 +++++++++++
> >  hw/virtio-scsi.c           | 199 +++++++++----------------------------
> >  hw/virtio-scsi.h           | 129 ++++++++++++++++++++++++
> >  include/qemu/osdep.h       |   4 +
> >  8 files changed, 586 insertions(+), 151 deletions(-)
> >  create mode 100644 hw/vhost-scsi.c
> >  create mode 100644 hw/vhost-scsi.h
> > 
> > -- 
> > 1.8.1.4
> > 
> 
> -- 
> Asias

--------------- 8 ---------------> qemu patch:
diff --git a/hw/vhost.c b/hw/vhost.c
index 4d6aee3..0c52ec4 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -421,10 +421,12 @@ static void vhost_set_memory(MemoryListener *listener,
         return;
     }
 
+#if 0
     if (dev->started) {
         r = vhost_verify_ring_mappings(dev, start_addr, size);
         assert(r >= 0);
     }
+#endif
 
     if (!dev->log_enabled) {
         r = ioctl(dev->control, VHOST_SET_MEM_TABLE, dev->mem);

--------------- 8 ---------------> seabios patch:
diff --git a/src/virtio-scsi.c b/src/virtio-scsi.c
index 879ddfb..4de1255 100644
--- a/src/virtio-scsi.c
+++ b/src/virtio-scsi.c
@@ -147,6 +147,9 @@ init_virtio_scsi(struct pci_device *pci)
         goto fail;
     }
 
+    vp_set_status(ioaddr, VIRTIO_CONFIG_S_ACKNOWLEDGE |
+                  VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK);
+
     int i, tot;
     for (tot = 0, i = 0; i < 256; i++)
         tot += virtio_scsi_scan_target(pci, ioaddr, vq, i);
@@ -154,8 +157,6 @@ init_virtio_scsi(struct pci_device *pci)
     if (!tot)
         goto fail;
 
-    vp_set_status(ioaddr, VIRTIO_CONFIG_S_ACKNOWLEDGE |
-                  VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_DRIVER_OK);
     return;
 
 fail:
diff --git a/src/virtio-scsi.h b/src/virtio-scsi.h
index bbfbf30..96c3701 100644
--- a/src/virtio-scsi.h
+++ b/src/virtio-scsi.h
@@ -26,7 +26,7 @@ struct virtio_scsi_req_cmd {
     u8 prio;
     u8 crn;
     char cdb[VIRTIO_SCSI_CDB_SIZE];
-};
+} __attribute__((packed));
 
 /* This is the first element of the "in" scatter-gather list. */
 struct virtio_scsi_resp_cmd {
@@ -36,7 +36,7 @@ struct virtio_scsi_resp_cmd {
     u8 status;
     u8 response;
     u8 sense[VIRTIO_SCSI_SENSE_SIZE];
-};
+} __attribute__((packed));
 
 #define VIRTIO_SCSI_S_OK            0

-- 
Asias

  reply	other threads:[~2013-03-14  9:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12  6:29 [Qemu-devel] [PATCH V2 WIP 0/2] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Asias He
2013-03-12  6:29 ` [Qemu-devel] [PATCH V2 WIP 1/2] virtio-scsi: create VirtIOSCSICommon Asias He
2013-03-12  6:29 ` [Qemu-devel] [PATCH V2 WIP 2/2] vhost-scsi: new device supporting the tcm_vhost Linux kernel module Asias He
2013-03-12  8:20   ` Stefan Hajnoczi
2013-03-13  2:49     ` Asias He
2013-03-14  4:25 ` [Qemu-devel] [PATCH V2 WIP 0/2] " Asias He
2013-03-14  9:25   ` Asias He [this message]
2013-03-14  9:46     ` Michael S. Tsirkin
2013-03-14 10:00       ` Paolo Bonzini
2013-03-14 10:21         ` Michael S. Tsirkin
2013-03-15  0:58         ` Asias He
2013-03-15  0:55       ` Asias He

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=20130314092542.GB7892@hj.localdomain \
    --to=asias@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=nab@linux-iscsi.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    --cc=stefanha@redhat.com \
    --cc=target-devel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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).