From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [RFC v9 23/27] virtio-blk: Stub out SCSI commands Date: Wed, 18 Jul 2012 22:05:14 +0300 Message-ID: <20120718190514.GF2498@redhat.com> References: <1342624074-24650-1-git-send-email-stefanha@linux.vnet.ibm.com> <1342624074-24650-24-git-send-email-stefanha@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Anthony Liguori , Kevin Wolf , Paolo Bonzini , Asias He , Khoa Huynh To: Stefan Hajnoczi Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1826 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755676Ab2GRTEo (ORCPT ); Wed, 18 Jul 2012 15:04:44 -0400 Content-Disposition: inline In-Reply-To: <1342624074-24650-24-git-send-email-stefanha@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 18, 2012 at 04:07:50PM +0100, Stefan Hajnoczi wrote: > Signed-off-by: Stefan Hajnoczi Why? > --- > hw/virtio-blk.c | 25 +++++++++++++++++-------- > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c > index 51807b5..8734029 100644 > --- a/hw/virtio-blk.c > +++ b/hw/virtio-blk.c > @@ -215,14 +215,8 @@ static void process_request(IOQueue *ioq, struct iovec iov[], unsigned int out_n > > /* TODO Linux sets the barrier bit even when not advertised! */ > uint32_t type = outhdr->type & ~VIRTIO_BLK_T_BARRIER; > - > - if (unlikely(type & ~(VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_FLUSH))) { > - fprintf(stderr, "virtio-blk unsupported request type %#x\n", outhdr->type); > - exit(1); > - } > - > struct iocb *iocb; > - switch (type & (VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_FLUSH)) { > + switch (type & (VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_SCSI_CMD | VIRTIO_BLK_T_FLUSH)) { > case VIRTIO_BLK_T_IN: > if (unlikely(out_num != 1)) { > fprintf(stderr, "virtio-blk invalid read request\n"); > @@ -239,6 +233,21 @@ static void process_request(IOQueue *ioq, struct iovec iov[], unsigned int out_n > iocb = ioq_rdwr(ioq, false, &iov[1], out_num - 1, outhdr->sector * 512UL); /* TODO is it always 512? */ > break; > > + case VIRTIO_BLK_T_SCSI_CMD: > + if (unlikely(in_num == 0)) { > + fprintf(stderr, "virtio-blk invalid SCSI command request\n"); > + exit(1); > + } > + > + /* TODO support SCSI commands */ > + { > + VirtIOBlock *s = container_of(ioq, VirtIOBlock, ioqueue); > + inhdr->status = VIRTIO_BLK_S_UNSUPP; > + vring_push(&s->vring, head, sizeof *inhdr); > + virtio_blk_notify_guest(s); > + } > + return; > + > case VIRTIO_BLK_T_FLUSH: > if (unlikely(in_num != 1 || out_num != 1)) { > fprintf(stderr, "virtio-blk invalid flush request\n"); > @@ -256,7 +265,7 @@ static void process_request(IOQueue *ioq, struct iovec iov[], unsigned int out_n > return; > > default: > - fprintf(stderr, "virtio-blk multiple request type bits set\n"); > + fprintf(stderr, "virtio-blk unsupported request type %#x\n", outhdr->type); > exit(1); > } > > -- > 1.7.10.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrZYC-00074w-6z for qemu-devel@nongnu.org; Wed, 18 Jul 2012 15:04:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SrZYB-0004tQ-1z for qemu-devel@nongnu.org; Wed, 18 Jul 2012 15:04:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SrZYA-0004tL-P7 for qemu-devel@nongnu.org; Wed, 18 Jul 2012 15:04:42 -0400 Date: Wed, 18 Jul 2012 22:05:14 +0300 From: "Michael S. Tsirkin" Message-ID: <20120718190514.GF2498@redhat.com> References: <1342624074-24650-1-git-send-email-stefanha@linux.vnet.ibm.com> <1342624074-24650-24-git-send-email-stefanha@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1342624074-24650-24-git-send-email-stefanha@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC v9 23/27] virtio-blk: Stub out SCSI commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , kvm@vger.kernel.org, qemu-devel@nongnu.org, Khoa Huynh , Paolo Bonzini , Asias He On Wed, Jul 18, 2012 at 04:07:50PM +0100, Stefan Hajnoczi wrote: > Signed-off-by: Stefan Hajnoczi Why? > --- > hw/virtio-blk.c | 25 +++++++++++++++++-------- > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c > index 51807b5..8734029 100644 > --- a/hw/virtio-blk.c > +++ b/hw/virtio-blk.c > @@ -215,14 +215,8 @@ static void process_request(IOQueue *ioq, struct iovec iov[], unsigned int out_n > > /* TODO Linux sets the barrier bit even when not advertised! */ > uint32_t type = outhdr->type & ~VIRTIO_BLK_T_BARRIER; > - > - if (unlikely(type & ~(VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_FLUSH))) { > - fprintf(stderr, "virtio-blk unsupported request type %#x\n", outhdr->type); > - exit(1); > - } > - > struct iocb *iocb; > - switch (type & (VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_FLUSH)) { > + switch (type & (VIRTIO_BLK_T_OUT | VIRTIO_BLK_T_SCSI_CMD | VIRTIO_BLK_T_FLUSH)) { > case VIRTIO_BLK_T_IN: > if (unlikely(out_num != 1)) { > fprintf(stderr, "virtio-blk invalid read request\n"); > @@ -239,6 +233,21 @@ static void process_request(IOQueue *ioq, struct iovec iov[], unsigned int out_n > iocb = ioq_rdwr(ioq, false, &iov[1], out_num - 1, outhdr->sector * 512UL); /* TODO is it always 512? */ > break; > > + case VIRTIO_BLK_T_SCSI_CMD: > + if (unlikely(in_num == 0)) { > + fprintf(stderr, "virtio-blk invalid SCSI command request\n"); > + exit(1); > + } > + > + /* TODO support SCSI commands */ > + { > + VirtIOBlock *s = container_of(ioq, VirtIOBlock, ioqueue); > + inhdr->status = VIRTIO_BLK_S_UNSUPP; > + vring_push(&s->vring, head, sizeof *inhdr); > + virtio_blk_notify_guest(s); > + } > + return; > + > case VIRTIO_BLK_T_FLUSH: > if (unlikely(in_num != 1 || out_num != 1)) { > fprintf(stderr, "virtio-blk invalid flush request\n"); > @@ -256,7 +265,7 @@ static void process_request(IOQueue *ioq, struct iovec iov[], unsigned int out_n > return; > > default: > - fprintf(stderr, "virtio-blk multiple request type bits set\n"); > + fprintf(stderr, "virtio-blk unsupported request type %#x\n", outhdr->type); > exit(1); > } > > -- > 1.7.10.4