diff options
author | Christoph Hellwig <hch@lst.de> | 2010-02-10 23:37:25 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-02-10 16:53:54 -0600 |
commit | 9752c371a2f82b4fcde248dc35597f4066cd756c (patch) | |
tree | 63f6788ec34f5be9cb52904e9621c87f6f04ff79 /hw/virtio-blk.c | |
parent | 428c149b0be790b440e1cbee185b152cdb22feec (diff) | |
download | qemu-9752c371a2f82b4fcde248dc35597f4066cd756c.zip qemu-9752c371a2f82b4fcde248dc35597f4066cd756c.tar.gz qemu-9752c371a2f82b4fcde248dc35597f4066cd756c.tar.bz2 |
virtio-blk: add topology support
Export all topology information in the block config structure,
guarded by a new VIRTIO_BLK_F_TOPOLOGY feature flag.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r-- | hw/virtio-blk.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 6aa7f15..b80402d 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -26,6 +26,7 @@ typedef struct VirtIOBlock VirtQueue *vq; void *rq; QEMUBH *bh; + BlockConf *conf; } VirtIOBlock; static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) @@ -405,6 +406,10 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) blkcfg.heads = heads; blkcfg.sectors = secs; blkcfg.size_max = 0; + blkcfg.physical_block_exp = get_physical_block_exp(s->conf); + blkcfg.alignment_offset = 0; + blkcfg.min_io_size = s->conf->min_io_size / 512; + blkcfg.opt_io_size = s->conf->opt_io_size / 512; memcpy(config, &blkcfg, sizeof(struct virtio_blk_config)); } @@ -414,6 +419,7 @@ static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features) features |= (1 << VIRTIO_BLK_F_SEG_MAX); features |= (1 << VIRTIO_BLK_F_GEOMETRY); + features |= (1 << VIRTIO_BLK_F_TOPOLOGY); if (bdrv_enable_write_cache(s->bs)) features |= (1 << VIRTIO_BLK_F_WCACHE); @@ -471,6 +477,7 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf) s->vdev.get_features = virtio_blk_get_features; s->vdev.reset = virtio_blk_reset; s->bs = conf->dinfo->bdrv; + s->conf = conf; s->rq = NULL; bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); bdrv_set_geometry_hint(s->bs, cylinders, heads, secs); |