From: Jack Lange Date: Thu, 20 Feb 2014 18:47:48 +0000 (-0600) Subject: virtio-blk now handles config requests for non-declared config info X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=89537429397b93017ff307983442321665028f98 virtio-blk now handles config requests for non-declared config info --- diff --git a/palacios/src/devices/lnx_virtio_blk.c b/palacios/src/devices/lnx_virtio_blk.c index 476b284..0f32c77 100644 --- a/palacios/src/devices/lnx_virtio_blk.c +++ b/palacios/src/devices/lnx_virtio_blk.c @@ -59,6 +59,13 @@ struct blk_config { uint16_t cylinders; uint8_t heads; uint8_t sectors; + /* + uint32_t blk_size; + uint8_t phys_block_exp; + uint8_t alignment_offset; + uint16_t min_io_size; + uint32_t opt_io_size; + */ } __attribute__((packed)); @@ -466,8 +473,16 @@ static int virtio_io_read(struct guest_info * core, uint16_t port, void * dst, u memcpy(dst, cfg_ptr + cfg_offset, length); } else { - PrintError(core->vm_info, core, "Read of Unhandled Virtio Read\n"); - return -1; + + PrintError(core->vm_info,core,"Read of Unhandled Virtio Read. Returning 0\n"); + if (length == 1) { + *(uint8_t *)dst = 0; + } else if (length == 2) { + *(uint16_t *)dst = 0; + } else if (length == 4) { + *(uint32_t *)dst = 0; + } + } break; @@ -581,6 +596,7 @@ static int register_dev(struct virtio_dev_state * virtio, struct virtio_blk_stat blk_state->virtio_cfg.host_features = VIRTIO_SEG_MAX; blk_state->block_cfg.max_seg = QUEUE_SIZE - 2; + // Virtio Block only uses one queue blk_state->queue.queue_size = QUEUE_SIZE;