qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 5/5] virtio-blk: add topology support


From: Christoph Hellwig
Subject: [Qemu-devel] [PATCH v2 5/5] virtio-blk: add topology support
Date: Mon, 1 Feb 2010 10:09:04 +0100
User-agent: Mutt/1.3.28i

Export all topology information in the block config structure,
guarded by a new VIRTIO_BLK_F_TOPOLOGY config flag.

Note that there is no savevm support for the new information yet,
as it would be a pain without the table driven savevm format.
Juan has promised to send out a new version of the table driven
vmstate patches for virto next week.

Version 2 updates: store min_io_size and opt_io_size in terms of logical
blocks.

Signed-off-by: Christoph Hellwig <address@hidden>

Index: qemu/hw/virtio-blk.c
===================================================================
--- qemu.orig/hw/virtio-blk.c   2010-01-30 19:06:20.485254411 +0100
+++ qemu/hw/virtio-blk.c        2010-01-30 19:08:00.300254199 +0100
@@ -380,6 +380,10 @@ static void virtio_blk_update_config(Vir
     blkcfg.heads = heads;
     blkcfg.sectors = secs;
     blkcfg.size_max = 0;
+    blkcfg.physical_block_exp = bdrv_get_physical_block_exp(s->bs);
+    blkcfg.alignment_offset = 0;
+    blkcfg.min_io_size = bdrv_get_min_io_size(s->bs) / 512;
+    blkcfg.opt_io_size = bdrv_get_opt_io_size(s->bs) / 512;
     memcpy(config, &blkcfg, sizeof(struct virtio_blk_config));
 }
 
@@ -389,6 +393,7 @@ static uint32_t virtio_blk_get_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);
Index: qemu/hw/virtio-blk.h
===================================================================
--- qemu.orig/hw/virtio-blk.h   2010-01-30 19:06:20.496011220 +0100
+++ qemu/hw/virtio-blk.h        2010-01-30 19:07:40.142003536 +0100
@@ -32,6 +32,7 @@
 #define VIRTIO_BLK_F_SCSI       7       /* Supports scsi command passthru */
 /* #define VIRTIO_BLK_F_IDENTIFY   8       ATA IDENTIFY supported, DEPRECATED 
*/
 #define VIRTIO_BLK_F_WCACHE     9       /* write cache enabled */
+#define VIRTIO_BLK_F_TOPOLOGY   10      /* Topology information is available */
 
 struct virtio_blk_config
 {
@@ -42,6 +43,10 @@ struct virtio_blk_config
     uint8_t heads;
     uint8_t sectors;
     uint32_t _blk_size;    /* structure pad, currently unused */
+    uint8_t physical_block_exp;
+    uint8_t alignment_offset;
+    uint16_t min_io_size;
+    uint32_t opt_io_size;
 } __attribute__((packed));
 
 /* These two define direction. */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]