qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [QEMU-KVM]: Megasas + TCM_Loop + SG_IO into Windows XP guests
@ 2010-05-13 21:38 Nicholas A. Bellinger
  2010-05-14  7:22 ` [Qemu-devel] " Hannes Reinecke
  0 siblings, 1 reply; 9+ messages in thread
From: Nicholas A. Bellinger @ 2010-05-13 21:38 UTC (permalink / raw)
  To: Hannes Reinecke, Gerd Hoffmann, Christoph Hellwig,
	FUJITA Tomonori, Mike Christie, Douglas Gilbert, James Bottomley
  Cc: qemu-devel, kvm-devel, linux-scsi

Greetings Hannes and co,

I have been spending a bit of time trying Megasas HBA emulation +
TCM_Loop + SG_IO with a Windows XP SP2 KVM guests..  So far, I noticed
that hw/scsi-generic.c:execute_command_run() using bdev_aio_ioctl()
appears to be broken for XP guests, which causes the first 36-byte
INQUIRY sent via SG_IO to never make it back to QEMU and results in the
win32 LSI drive taking the LUN offline, et al.  Note that everything
does appear to be functioning as expected in kernel space for the first
INQUIRY with the TCM_Loop LLD and Linux/SCSI code (AFAICT) and Linux KVM
guests using megasas emulation are still working.

So, I ended up needing requiring the following quick hack for
hw/scsi-generic.c:execute_command_run() to make SG_IO function
synchronously using bdrv_ioctl(), which at least gets LUN registration
and basic control path CDBs working for the XP guest.

Here is how it looks in action on a v2.6.34-rc7 host so far:

http://www.linux-iscsi.org/images/TCM-KVM-megasas-XP-05132010.png


diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 6c58742..aa1eb83 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -140,6 +140,7 @@ static int execute_command_run(SCSIGenericReq *r,
 {
     BlockDriverState *bdrv = r->req.dev->conf.dinfo->bdrv;
     SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, r->req.dev);
+    int ret;
 
     r->io_header.interface_id = 'S';
     r->io_header.dxfer_direction = sgdir[r->req.cmd.mode];
@@ -161,11 +162,16 @@ static int execute_command_run(SCSIGenericReq *r,
     printf("\n");
     }
 #endif
+#if 0
     r->req.aiocb = bdrv_aio_ioctl(bdrv, SG_IO, &r->io_header, complete, r);
     if (r->req.aiocb == NULL) {
         BADF("execute_command: read failed !\n");
         return -1;
     }
+#else
+    ret = bdrv_ioctl(bdrv, SG_IO, &r->io_header);
+    complete((void *)r, ret);
+#endif
 
      *      return 0;
 }


Beyond the initial LUN registration and control CDB parts, doing bulk
DATA_SG_IO traffic is completing successfully (and everything looks sane
with TCM_Loop and Linux/SCSI) but it appears that the correct blocks are
not actually getting written/read by megasas.  This appears to be the
case with both hw/scsi-generic.c and hw/scsi-disk.c modes of operation
for megasas with the win32 XP guest.

So I was wondering if anyone aware of known issues with QEMU
asynchronous SG_IO into MSFT KVM guests with virtio or hw/lsi53c895a.c,
or would this be something specific to megasas HBA emulation and XP
guests..?

Hannes, which MSFT guest + driver did you get work stable with bulk
DATA_SG_IO and hw/scsi-disk.c..?

Best,

--nab

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-05-31 19:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 21:38 [Qemu-devel] [QEMU-KVM]: Megasas + TCM_Loop + SG_IO into Windows XP guests Nicholas A. Bellinger
2010-05-14  7:22 ` [Qemu-devel] " Hannes Reinecke
2010-05-14  9:42   ` Nicholas A. Bellinger
2010-05-17 21:09     ` Nicholas A. Bellinger
2010-05-18  9:43       ` Hannes Reinecke
2010-05-18 11:18         ` Nicholas A. Bellinger
2010-05-30  4:25           ` Nicholas A. Bellinger
2010-05-31  9:52             ` Gerd Hoffmann
2010-05-31 19:18               ` Alexander Graf

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).