From: "Nicholas A. Bellinger" Subject: Re: [PATCH V2] kvm tools: Add initial virtio-scsi support Date: Tue, 21 Aug 2012 20:48:07 -0700 Message-ID: <1345607287.23278.299.camel@haakon2.linux-iscsi.org> References: <1345195611-6026-1-git-send-email-asias.hejun@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Pekka Enberg , Sasha Levin , Ingo Molnar , Cyrill Gorcunov , kvm@vger.kernel.org, Stefan Hajnoczi , Paolo Bonzini , target-devel , "Michael S. Tsirkin" To: Asias He Return-path: In-Reply-To: <1345195611-6026-1-git-send-email-asias.hejun@gmail.com> Sender: target-devel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Fri, 2012-08-17 at 17:26 +0800, Asias He wrote: > This patch brings virito-scsi support to kvm tool. > > With the introduce of tcm_vhost (vhost-scsi) > > tcm_vhost: Initial merge for vhost level target fabric driver > > we can implement virito-scsi by simply having vhost-scsi to handle the > SCSI command. Excited to see vhost-scsi support within kvm-tool btw. :) Just one comment below wrt syncing up with v3.6-rc3 code.. > diff --git a/tools/kvm/include/kvm/virtio-scsi.h b/tools/kvm/include/kvm/virtio-scsi.h > new file mode 100644 > index 0000000..a780d7e > --- /dev/null > +++ b/tools/kvm/include/kvm/virtio-scsi.h > @@ -0,0 +1,26 @@ > +#ifndef KVM__SCSI_VIRTIO_H > +#define KVM__SCSI_VIRTIO_H > + > +#include "kvm/disk-image.h" > + > +struct kvm; > + > +int virtio_scsi_init(struct kvm *kvm); > +int virtio_scsi_exit(struct kvm *kvm); > + > +/*----------------------------------------------------*/ > +/* TODO: Remove this when tcm_vhost goes upstream */ > +#define TRANSPORT_IQN_LEN 224 > +#define VHOST_SCSI_ABI_VERSION 0 > +struct vhost_scsi_target { > + int abi_version; > + unsigned char vhost_wwpn[TRANSPORT_IQN_LEN]; > + unsigned short vhost_tpgt; > +}; > +/* VHOST_SCSI specific defines */ > +#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) > +#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) > +#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, struct vhost_scsi_target) > +/*----------------------------------------------------*/ > + Just a heads up that these have changed slightly based upon MST's feedback over the last weeks.. The vhost-scsi RFC-v3 for QEMU 1.3 + v3.6-rc3 PULL request for target rc-fixes have gone out today containing a slightly modified version of these definitions, so you'll want to go ahead and update to follow what's now in target-pending/master, which for vhost-scsi IOCTL ops are: struct vhost_scsi_target { int abi_version; char vhost_wwpn[TRANSPORT_IQN_LEN]; unsigned short vhost_tpgt; unsigned short reserved; }; and update the GET_ABI_VERSION to return 'int': #define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int) Aside from this minor bit, I think the patch looks good wrt to upstream tcm_vhost kernel code. Feel free to add my: Reviewed-by: Nicholas Bellinger Nice work Asias!