[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v9 23/27] virtio-blk: Stub out SCSI commands
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [RFC v9 23/27] virtio-blk: Stub out SCSI commands |
Date: |
Wed, 18 Jul 2012 16:07:50 +0100 |
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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
- [Qemu-devel] [RFC v9 00/27] virtio: virtio-blk data plane, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 01/27] virtio-blk: Remove virtqueue request handling code, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 03/27] virtio-blk: Data plane thread event loop, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 02/27] virtio-blk: Set up host notifier for data plane, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 04/27] virtio-blk: Map vring, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 15/27] notifier: Add a function to set the notifier, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 05/27] virtio-blk: Do cheapest possible memory mapping, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 07/27] virtio-blk: Put dataplane code into its own directory, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 09/27] virtio-blk: Add Linux AIO queue, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 10/27] virtio-blk: Stop data plane thread cleanly, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 23/27] virtio-blk: Stub out SCSI commands,
Stefan Hajnoczi <=
- [Qemu-devel] [RFC v9 13/27] virtio-blk: Increase max requests for indirect vring, Stefan Hajnoczi, 2012/07/18
- [Qemu-devel] [RFC v9 06/27] virtio-blk: Take PCI memory range into account, Stefan Hajnoczi, 2012/07/18
[Qemu-devel] [RFC v9 12/27] virtio-blk: Add workaround for BUG_ON() dependency in virtio_ring.h, Stefan Hajnoczi, 2012/07/18
[Qemu-devel] [RFC v9 11/27] virtio-blk: Indirect vring and flush support, Stefan Hajnoczi, 2012/07/18