qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Kanda <mark.kanda@oracle.com>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: stefanha@redhat.com, konrad.wilk@oracle.com,
	martin.petersen@oracle.com, ameya.more@oracle.com,
	karl.heubaum@oracle.com, Mark Kanda <mark.kanda@oracle.com>
Subject: [Qemu-devel] [PATCH 2/2] virtio-blk: reject configs with logical block size > physical block size
Date: Wed,  6 Dec 2017 13:54:01 -0600	[thread overview]
Message-ID: <0a69463200d64d81dc27898ff92ecd10b126d968.1512589016.git.mark.kanda@oracle.com> (raw)
In-Reply-To: <cover.1512589016.git.mark.kanda@oracle.com>
In-Reply-To: <cover.1512589016.git.mark.kanda@oracle.com>

virtio-blk logical block size should never be larger than physical block
size because it doesn't make sense to have such configurations. QEMU doesn't
have a way to effectively express this condition; the best it can do is
report the physical block exponent as 0 - indicating the logical block size
equals the physical block size.

This is identical to commit 3da023b5827543ee4c022986ea2ad9d1274410b2
but applied to virtio-blk (instead of virtio-scsi).

Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Ameya More <ameya.more@oracle.com>
---
 hw/block/virtio-blk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 002c56f..acfca78 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -949,6 +949,13 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
     }
     blkconf_blocksizes(&conf->conf);
 
+    if (conf->conf.logical_block_size >
+        conf->conf.physical_block_size) {
+        error_setg(errp,
+                   "logical_block_size > physical_block_size not supported");
+        return;
+    }
+
     virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK,
                 sizeof(struct virtio_blk_config));
 
-- 
1.8.3.1

  parent reply	other threads:[~2017-12-06 19:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 19:53 [Qemu-devel] [PATCH 0/2] virtio-blk: miscellaneous changes Mark Kanda
2017-12-06 19:54 ` [Qemu-devel] [PATCH 1/2] virtio-blk: make queue size configurable Mark Kanda
2017-12-08 10:13   ` Stefan Hajnoczi
2017-12-06 19:54 ` Mark Kanda [this message]
2017-12-06 20:41   ` [Qemu-devel] [PATCH 2/2] virtio-blk: reject configs with logical block size > physical block size Martin K. Petersen
2017-12-08 10:13   ` Stefan Hajnoczi
2017-12-08 15:57 ` [Qemu-devel] [PATCH v2 0/2] virtio-blk: miscellaneous changes Mark Kanda
2017-12-08 15:57   ` [Qemu-devel] [PATCH v2 1/2] virtio-blk: make queue size configurable Mark Kanda
2017-12-08 15:57   ` [Qemu-devel] [PATCH v2 2/2] virtio-blk: reject configs with logical block size > physical block size Mark Kanda
2017-12-11 10:30   ` [Qemu-devel] [PATCH v2 0/2] virtio-blk: miscellaneous changes Stefan Hajnoczi
2017-12-11 15:15     ` Mark Kanda

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=0a69463200d64d81dc27898ff92ecd10b126d968.1512589016.git.mark.kanda@oracle.com \
    --to=mark.kanda@oracle.com \
    --cc=ameya.more@oracle.com \
    --cc=karl.heubaum@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=martin.petersen@oracle.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).