qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [Qemu-devel] [PATCH 5/5] virtio-blk: add topology support
Date: Fri, 29 Jan 2010 20:05:31 +0100	[thread overview]
Message-ID: <20100129190531.GD25287@lst.de> (raw)
In-Reply-To: <20100129190417.GA25237@lst.de>

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: qemu/hw/virtio-blk.c
===================================================================
--- qemu.orig/hw/virtio-blk.c	2010-01-29 19:42:11.853022001 +0100
+++ qemu/hw/virtio-blk.c	2010-01-29 19:45:14.735253918 +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);
+    blkcfg.opt_io_size = bdrv_get_opt_io_size(s->bs);
     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-29 19:45:17.996022961 +0100
+++ qemu/hw/virtio-blk.h	2010-01-29 19:45:39.253318328 +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. */

  parent reply	other threads:[~2010-01-29 19:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 19:04 [Qemu-devel] [PATCH 1/4] virtio-blk: revert serial number support Christoph Hellwig
2010-01-29 19:04 ` [Qemu-devel] [PATCH 2/4] block: add block topology options Christoph Hellwig
2010-02-03 19:00   ` Anthony Liguori
2010-02-05 13:09     ` Christoph Hellwig
2010-02-05 16:16       ` Jamie Lokier
2010-02-05 16:22         ` Christoph Hellwig
2010-02-05 17:16           ` Jamie Lokier
2010-02-05 17:33       ` Anthony Liguori
2010-02-09 15:26         ` Markus Armbruster
2010-01-29 19:05 ` [Qemu-devel] [PATCH 3/5] scsi: add topology support Christoph Hellwig
2010-01-29 19:05 ` [Qemu-devel] [PATCH 4/5] ide: " Christoph Hellwig
2010-01-29 19:05 ` Christoph Hellwig [this message]
2010-02-01  9:09   ` [Qemu-devel] [PATCH v2 5/5] virtio-blk: " Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100129190531.GD25287@lst.de \
    --to=hch@lst.de \
    --cc=martin.petersen@oracle.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).