From nobody Sat May 4 17:08:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590583606; cv=none; d=zohomail.com; s=zohoarc; b=CArRby/Xof+h6vhYLJhCccKUOG4B/m+hLeBhh6CwR1uKbTzo3Vb9hV1CJ3jCuO6V8UTTGIlQF0SEj2UZeyLpEg9Tp5fK9bCljBlOBYid8/Avx1GvII2YtQRJZLL5sqldNmLH3wkymu30deRqI7K24eNX1X7KUTtcCMMAmEvlCOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590583606; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oIN03DAZ4lQYUkl3lhide6Xs43zEdrUrV/56BgwHQX0=; b=a0We9J7eKOYPVP6yma55xFy3CH7/AZvm/SRMqfVuu/O9tvTVkC2Accfa5ApTl9dzDHrrD2rK3ummIDLlaLnM7skmQpHFvXJmdz4Iv3Y93kg6Dw3PHVdSIR0xxLGd4sJOn6MC3C30Q/XX6ILOl2roDkJs8JNjGWgRJYtuJD7Tgxk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590583606470223.88894530254265; Wed, 27 May 2020 05:46:46 -0700 (PDT) Received: from localhost ([::1]:60672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdvSH-0001TF-8y for importer@patchew.org; Wed, 27 May 2020 08:46:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvR1-00082J-UV; Wed, 27 May 2020 08:45:27 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:34548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvQz-0001Sl-Mh; Wed, 27 May 2020 08:45:26 -0400 Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 693EE2E15B2; Wed, 27 May 2020 15:45:22 +0300 (MSK) Received: from iva4-7c3d9abce76c.qloud-c.yandex.net (iva4-7c3d9abce76c.qloud-c.yandex.net [2a02:6b8:c0c:4e8e:0:640:7c3d:9abc]) by mxbackcorp1j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id NncoSmAIxp-jIF4FJjI; Wed, 27 May 2020 15:45:22 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b080:8308::1:12]) by iva4-7c3d9abce76c.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id bzO5qPtczO-jIWOql5q; Wed, 27 May 2020 15:45:18 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590583522; bh=oIN03DAZ4lQYUkl3lhide6Xs43zEdrUrV/56BgwHQX0=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=NI0AJsTTemllPECSfi+BL/N/9mtkS20hZ1UfRKA0K7Uhqy5GZMQwxjcKYKDr7hmtr //+nYgUXvj6RJUl+sDbsrRYAVCdOTsWshvGUgRhw/6Gd/7gE0esW0D/P+hHpqQqIKu j16B7hxVho1S7RMx409aZaf2tvAyPB6vHESIDjaQ= Authentication-Results: mxbackcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v6 1/5] virtio-blk: store opt_io_size with correct size Date: Wed, 27 May 2020 15:45:07 +0300 Message-Id: <20200527124511.986099-2-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527124511.986099-1-rvkagan@yandex-team.ru> References: <20200527124511.986099-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=77.88.29.217; envelope-from=rvkagan@yandex-team.ru; helo=forwardcorp1p.mail.yandex.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 08:45:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Stefano Stabellini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , qemu-block@nongnu.org, Paul Durrant , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , John Snow , Keith Busch , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The width of opt_io_size in virtio_blk_config is 32bit. However, it's written with virtio_stw_p; this may result in value truncation, and on big-endian systems with legacy virtio in completely bogus readings in the guest. Use the appropriate accessor to store it. Signed-off-by: Roman Kagan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Kevin Wolf --- v4 -> v5: - expand the log [Michael] hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index f5f6fc925e..413083e62f 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -918,7 +918,7 @@ static void virtio_blk_update_config(VirtIODevice *vdev= , uint8_t *config) virtio_stw_p(vdev, &blkcfg.geometry.cylinders, conf->cyls); virtio_stl_p(vdev, &blkcfg.blk_size, blk_size); virtio_stw_p(vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size); - virtio_stw_p(vdev, &blkcfg.opt_io_size, conf->opt_io_size / blk_size); + virtio_stl_p(vdev, &blkcfg.opt_io_size, conf->opt_io_size / blk_size); blkcfg.geometry.heads =3D conf->heads; /* * We must ensure that the block device capacity is a multiple of --=20 2.26.2 From nobody Sat May 4 17:08:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590583695; cv=none; d=zohomail.com; s=zohoarc; b=amlgVpEg+2hkYhbeM8wknawjs1k3aFrkUvd//CdL8pLhA/7FFLa2QeDeUXhQhWldNFKlSt8YVgjSERZj9ZYWZn3g7P3pMzmqeqXckuw1mNfOgvan8ujiDnu5rg2QWz6CQjwkMyJuBYhryGLie7Il2g9URABT7EVlGo5PE3HRRYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590583695; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7R0FdQjVPrwj0NU+a9BW8mDIxABy3m6MTEZ4IgcH4AU=; b=EBgWRrlxv9mSD5DxkfqSVh9nL+ZK0VjbFgWG6sYVK7wdOQBKFP1rkQ7K67+NK7PP91VvleFYRTbxr3r55z6cHIj+nVxBo74+5aOmbEUkKUInSM4HAZQ6qzpvVLFwAwgbiOUf9k/X6BPwT1uqV6U1DFbtz7ILtReaKLFrWJjjJU0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590583695085554.8464969301162; Wed, 27 May 2020 05:48:15 -0700 (PDT) Received: from localhost ([::1]:39226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdvTh-0004Je-QW for importer@patchew.org; Wed, 27 May 2020 08:48:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvR5-0008BF-WF; Wed, 27 May 2020 08:45:32 -0400 Received: from forwardcorp1o.mail.yandex.net ([95.108.205.193]:60110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvR4-0001YB-9T; Wed, 27 May 2020 08:45:31 -0400 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 760832E14EF; Wed, 27 May 2020 15:45:28 +0300 (MSK) Received: from iva4-7c3d9abce76c.qloud-c.yandex.net (iva4-7c3d9abce76c.qloud-c.yandex.net [2a02:6b8:c0c:4e8e:0:640:7c3d:9abc]) by mxbackcorp1g.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id EY5t1VtL3U-jMICaEGx; Wed, 27 May 2020 15:45:28 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b080:8308::1:12]) by iva4-7c3d9abce76c.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id bzO5qPtczO-jMWOe2sb; Wed, 27 May 2020 15:45:22 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590583528; bh=7R0FdQjVPrwj0NU+a9BW8mDIxABy3m6MTEZ4IgcH4AU=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=XnEB0m+xvqUPsgGEBKNnCHr3Pj4SBPUXBm6pEXDiyjEO+oDAb+Q5Wyj/VuYKUTIxm rkNBfvVM0iGMkCmzIEghsxLBVLv4pC0zURwZEQkKUa2InvSPmPgCzc2wSrm/yvJ2q9 Vvv2sUJPBNPMINIPTzIK7+eUl9i3m9u7p1Rl2zr0= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v6 2/5] block: consolidate blocksize properties consistency checks Date: Wed, 27 May 2020 15:45:08 +0300 Message-Id: <20200527124511.986099-3-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527124511.986099-1-rvkagan@yandex-team.ru> References: <20200527124511.986099-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=95.108.205.193; envelope-from=rvkagan@yandex-team.ru; helo=forwardcorp1o.mail.yandex.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 08:45:18 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Stefano Stabellini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , qemu-block@nongnu.org, Paul Durrant , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , John Snow , Keith Busch , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Several block device properties related to blocksize configuration must be in certain relationship WRT each other: physical block must be no smaller than logical block; min_io_size, opt_io_size, and discard_granularity must be a multiple of a logical block. To ensure these requirements are met, add corresponding consistency checks to blkconf_blocksizes, adjusting its signature to communicate possible error to the caller. Also remove the now redundant consistency checks from the specific devices. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake Reviewed-by: Paul Durrant --- v5 -> v6: - fix forgotten xen-block and swim v4 -> v5: - fix/reword error messages [Philippe, Kevin] - do early return on failed consistency check [Philippe] - use QEMU_IS_ALIGNED instead of open coding [Philippe] include/hw/block/block.h | 2 +- hw/block/block.c | 30 +++++++++++++++++++++++++++++- hw/block/fdc.c | 5 ++++- hw/block/nvme.c | 5 ++++- hw/block/swim.c | 5 ++++- hw/block/virtio-blk.c | 7 +------ hw/block/xen-block.c | 6 +----- hw/ide/qdev.c | 5 ++++- hw/scsi/scsi-disk.c | 12 +++++------- hw/usb/dev-storage.c | 5 ++++- tests/qemu-iotests/172.out | 2 +- 11 files changed, 58 insertions(+), 26 deletions(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index d7246f3862..784953a237 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -87,7 +87,7 @@ bool blk_check_size_and_read_all(BlockBackend *blk, void = *buf, hwaddr size, bool blkconf_geometry(BlockConf *conf, int *trans, unsigned cyls_max, unsigned heads_max, unsigned secs= _max, Error **errp); -void blkconf_blocksizes(BlockConf *conf); +bool blkconf_blocksizes(BlockConf *conf, Error **errp); bool blkconf_apply_backend_options(BlockConf *conf, bool readonly, bool resizable, Error **errp); =20 diff --git a/hw/block/block.c b/hw/block/block.c index bf56c7612b..b22207c921 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -61,7 +61,7 @@ bool blk_check_size_and_read_all(BlockBackend *blk, void = *buf, hwaddr size, return true; } =20 -void blkconf_blocksizes(BlockConf *conf) +bool blkconf_blocksizes(BlockConf *conf, Error **errp) { BlockBackend *blk =3D conf->blk; BlockSizes blocksizes; @@ -83,6 +83,34 @@ void blkconf_blocksizes(BlockConf *conf) conf->logical_block_size =3D BDRV_SECTOR_SIZE; } } + + if (conf->logical_block_size > conf->physical_block_size) { + error_setg(errp, + "logical_block_size > physical_block_size not supported= "); + return false; + } + + if (!QEMU_IS_ALIGNED(conf->min_io_size, conf->logical_block_size)) { + error_setg(errp, + "min_io_size must be a multiple of logical_block_size"); + return false; + } + + if (!QEMU_IS_ALIGNED(conf->opt_io_size, conf->logical_block_size)) { + error_setg(errp, + "opt_io_size must be a multiple of logical_block_size"); + return false; + } + + if (conf->discard_granularity !=3D -1 && + !QEMU_IS_ALIGNED(conf->discard_granularity, + conf->logical_block_size)) { + error_setg(errp, "discard_granularity must be " + "a multiple of logical_block_size"); + return false; + } + + return true; } =20 bool blkconf_apply_backend_options(BlockConf *conf, bool readonly, diff --git a/hw/block/fdc.c b/hw/block/fdc.c index c5fb9d6ece..8eda572ef4 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -554,7 +554,10 @@ static void floppy_drive_realize(DeviceState *qdev, Er= ror **errp) read_only =3D !blk_bs(dev->conf.blk) || blk_is_read_only(dev->conf= .blk); } =20 - blkconf_blocksizes(&dev->conf); + if (!blkconf_blocksizes(&dev->conf, errp)) { + return; + } + if (dev->conf.logical_block_size !=3D 512 || dev->conf.physical_block_size !=3D 512) { diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 2f3100e56c..672650e162 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1390,7 +1390,10 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) host_memory_backend_set_mapped(n->pmrdev, true); } =20 - blkconf_blocksizes(&n->conf); + if (!blkconf_blocksizes(&n->conf, errp)) { + return; + } + if (!blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.= blk), false, errp)) { return; diff --git a/hw/block/swim.c b/hw/block/swim.c index 8f124782f4..74f56e8f46 100644 --- a/hw/block/swim.c +++ b/hw/block/swim.c @@ -189,7 +189,10 @@ static void swim_drive_realize(DeviceState *qdev, Erro= r **errp) assert(ret =3D=3D 0); } =20 - blkconf_blocksizes(&dev->conf); + if (!blkconf_blocksizes(&dev->conf, errp)) { + return; + } + if (dev->conf.logical_block_size !=3D 512 || dev->conf.physical_block_size !=3D 512) { diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 413083e62f..4ffdb130be 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1162,12 +1162,7 @@ static void virtio_blk_device_realize(DeviceState *d= ev, Error **errp) return; } =20 - 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= "); + if (!blkconf_blocksizes(&conf->conf, errp)) { return; } =20 diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 570489d6d9..e17fec50e1 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -239,11 +239,7 @@ static void xen_block_realize(XenDevice *xendev, Error= **errp) return; } =20 - blkconf_blocksizes(conf); - - if (conf->logical_block_size > conf->physical_block_size) { - error_setg( - errp, "logical_block_size > physical_block_size not supported"= ); + if (!blkconf_blocksizes(conf, errp)) { return; } =20 diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 06b11583f5..b4821b2403 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -187,7 +187,10 @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKin= d kind, Error **errp) return; } =20 - blkconf_blocksizes(&dev->conf); + if (!blkconf_blocksizes(&dev->conf, errp)) { + return; + } + if (dev->conf.logical_block_size !=3D 512) { error_setg(errp, "logical_block_size must be 512 for IDE"); return; diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 387503e11b..8ce68a9dd6 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2346,12 +2346,7 @@ static void scsi_realize(SCSIDevice *dev, Error **er= rp) return; } =20 - blkconf_blocksizes(&s->qdev.conf); - - if (s->qdev.conf.logical_block_size > - s->qdev.conf.physical_block_size) { - error_setg(errp, - "logical_block_size > physical_block_size not supported= "); + if (!blkconf_blocksizes(&s->qdev.conf, errp)) { return; } =20 @@ -2436,7 +2431,9 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **= errp) if (s->qdev.conf.blk) { ctx =3D blk_get_aio_context(s->qdev.conf.blk); aio_context_acquire(ctx); - blkconf_blocksizes(&s->qdev.conf); + if (!blkconf_blocksizes(&s->qdev.conf, errp)) { + goto out; + } } s->qdev.blocksize =3D s->qdev.conf.logical_block_size; s->qdev.type =3D TYPE_DISK; @@ -2444,6 +2441,7 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **= errp) s->product =3D g_strdup("QEMU HARDDISK"); } scsi_realize(&s->qdev, errp); +out: if (ctx) { aio_context_release(ctx); } diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 4eba47538d..de461f37bd 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -599,7 +599,10 @@ static void usb_msd_storage_realize(USBDevice *dev, Er= ror **errp) return; } =20 - blkconf_blocksizes(&s->conf); + if (!blkconf_blocksizes(&s->conf, errp)) { + return; + } + if (!blkconf_apply_backend_options(&s->conf, blk_is_read_only(blk), tr= ue, errp)) { return; diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 7abbe82427..59cc70aebb 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -1204,7 +1204,7 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,physica drive-type =3D "144" =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,logical_block_size=3D4096 -QEMU_PROG: -device floppy,drive=3Dnone0,logical_block_size=3D4096: Physica= l and logical block size must be 512 for floppy +QEMU_PROG: -device floppy,drive=3Dnone0,logical_block_size=3D4096: logical= _block_size > physical_block_size not supported =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,physical_block_size=3D1024 QEMU_PROG: -device floppy,drive=3Dnone0,physical_block_size=3D1024: Physic= al and logical block size must be 512 for floppy --=20 2.26.2 From nobody Sat May 4 17:08:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590583612; cv=none; d=zohomail.com; s=zohoarc; b=PvVEN8hmVHudLUKixpaV6eEvEwK48Ck60mNw2OuQJH2DzuMuTtLxYdNQd2+nJuTEGZU/vNL1VEFFnWfyPP061UXZgA1PnWxxNeCUQkuykXiyKX1qEun1LnrpV8azkDJ/5kBuTpjuU7xzHHAIoAwJ0EssoEUIZKPcp2AxkFE9GoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590583612; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A0YhPbFgXOi7Ibarq6sWTVZlCf7rqVdJcWDX7rNnVYU=; b=EnEbCzLK1imDQ5N8qsPHn62w/Q/ze6zgq5oZgMoedQ5j55IgFDfrF+2PVQGlgAXafAw+JA7o0UcoLcyA1QugV1jFAUkMLZogw5wjaYdMM5BvoZXDR+SRWxYrsxjpxsbEhB8Qj650C7LvTUIes5qxGoLQzdTRGo484qBlXfujk58= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590583612517323.82173380179495; Wed, 27 May 2020 05:46:52 -0700 (PDT) Received: from localhost ([::1]:33074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdvSN-0001iZ-7T for importer@patchew.org; Wed, 27 May 2020 08:46:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvRD-0008S2-7S; Wed, 27 May 2020 08:45:39 -0400 Received: from forwardcorp1j.mail.yandex.net ([2a02:6b8:0:1619::183]:50708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvRB-0001cY-Lo; Wed, 27 May 2020 08:45:38 -0400 Received: from mxbackcorp1o.mail.yandex.net (mxbackcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::301]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id BD9702E156F; Wed, 27 May 2020 15:45:33 +0300 (MSK) Received: from iva4-7c3d9abce76c.qloud-c.yandex.net (iva4-7c3d9abce76c.qloud-c.yandex.net [2a02:6b8:c0c:4e8e:0:640:7c3d:9abc]) by mxbackcorp1o.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id RSC1xPiAcU-jSxK4aYo; Wed, 27 May 2020 15:45:33 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b080:8308::1:12]) by iva4-7c3d9abce76c.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id bzO5qPtczO-jSWO478g; Wed, 27 May 2020 15:45:28 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590583533; bh=A0YhPbFgXOi7Ibarq6sWTVZlCf7rqVdJcWDX7rNnVYU=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=WYnlLphKioMSFrz8oFbRygNduQl/bL8tD6c/NiJkHcDsYzLrYS1UyEnm0fIViPBRC /i9nB2GRviU/5H+9Xcv960vEViNd1mWl+0a99WkYzXHvzkDmt9FWAhM9XHz7hkxcjF P31LzMOyFKBdeJy8/Rew0UG3//wx5+hR5FCg/rl4= Authentication-Results: mxbackcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v6 3/5] qdev-properties: blocksize: use same limits in code and description Date: Wed, 27 May 2020 15:45:09 +0300 Message-Id: <20200527124511.986099-4-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527124511.986099-1-rvkagan@yandex-team.ru> References: <20200527124511.986099-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:0:1619::183; envelope-from=rvkagan@yandex-team.ru; helo=forwardcorp1j.mail.yandex.net X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Stefano Stabellini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , qemu-block@nongnu.org, Paul Durrant , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , John Snow , Keith Busch , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Make it easier (more visible) to maintain the limits on the blocksize properties in sync with the respective description, by using macros both in the code and in the description. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake --- v4 -> v5: - split out into separate patch [Philippe] hw/core/qdev-properties.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index cc924815da..249dc69bd8 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -729,6 +729,13 @@ const PropertyInfo qdev_prop_pci_devfn =3D { =20 /* --- blocksize --- */ =20 +/* lower limit is sector size */ +#define MIN_BLOCK_SIZE 512 +#define MIN_BLOCK_SIZE_STR stringify(MIN_BLOCK_SIZE) +/* upper limit is the max power of 2 that fits in uint16_t */ +#define MAX_BLOCK_SIZE 32768 +#define MAX_BLOCK_SIZE_STR stringify(MAX_BLOCK_SIZE) + static void set_blocksize(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -736,8 +743,6 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, Property *prop =3D opaque; uint16_t value, *ptr =3D qdev_get_prop_ptr(dev, prop); Error *local_err =3D NULL; - const int64_t min =3D 512; - const int64_t max =3D 32768; =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -750,9 +755,12 @@ static void set_blocksize(Object *obj, Visitor *v, con= st char *name, return; } /* value of 0 means "unset" */ - if (value && (value < min || value > max)) { - error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, - dev->id ? : "", name, (int64_t)value, min, max); + if (value && (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE)) { + error_setg(errp, + "Property %s.%s doesn't take value %" PRIu16 + " (minimum: " MIN_BLOCK_SIZE_STR + ", maximum: " MAX_BLOCK_SIZE_STR ")", + dev->id ? : "", name, value); return; } =20 @@ -769,7 +777,8 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, =20 const PropertyInfo qdev_prop_blocksize =3D { .name =3D "uint16", - .description =3D "A power of two between 512 and 32768", + .description =3D "A power of two between " MIN_BLOCK_SIZE_STR + " and " MAX_BLOCK_SIZE_STR, .get =3D get_uint16, .set =3D set_blocksize, .set_default_value =3D set_default_value_uint, --=20 2.26.2 From nobody Sat May 4 17:08:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590583708; cv=none; d=zohomail.com; s=zohoarc; b=WkHCwI/Pu6mR/8r/Vp+JRRvvzzdFxFq06TF8KmHvHCyLrFC7UKbkQGQi7dMmQva+z1CkltQGjHZjEzyYAZnMqqFybyKmxxqFq2Eq1iVZwAl747eHqVOz3ofvIXE4pp9T1if3Z4NkYc2moFrdZe9ZIOt0DjQyMnwdATdHZu+WlDk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590583708; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5W8C5oYNbfwIbGSjpB4jp+1QNqqk5DONxp7cMMQxQ3c=; b=IQKMPVuZzfhf3CLgQDOQ1vLpsrTq+iO18c/XieocAVFiP6cBlvHVInDcw9fBc+eT9rsJaClWzUAQCGZVajG1tugB9dfAkpUE9Y+wQR9tKsvzlNMXCVSQ2oVdVQiCujdgVP6D4W6CLZCQaX4L9GId0gGRv023/lBGLzzp52rjexk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590583708838198.22729408968507; Wed, 27 May 2020 05:48:28 -0700 (PDT) Received: from localhost ([::1]:40108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdvTv-0005AP-Em for importer@patchew.org; Wed, 27 May 2020 08:48:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvRI-0000Aa-Rj; Wed, 27 May 2020 08:45:44 -0400 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]:36568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvRF-0001dS-Kz; Wed, 27 May 2020 08:45:44 -0400 Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 5C7772E1590; Wed, 27 May 2020 15:45:37 +0300 (MSK) Received: from iva4-7c3d9abce76c.qloud-c.yandex.net (iva4-7c3d9abce76c.qloud-c.yandex.net [2a02:6b8:c0c:4e8e:0:640:7c3d:9abc]) by mxbackcorp1j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id K4MuwlsXgC-jYFOeB5T; Wed, 27 May 2020 15:45:37 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b080:8308::1:12]) by iva4-7c3d9abce76c.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id bzO5qPtczO-jXWODlkU; Wed, 27 May 2020 15:45:34 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590583537; bh=5W8C5oYNbfwIbGSjpB4jp+1QNqqk5DONxp7cMMQxQ3c=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=tgMD0FVC6Kkk5pyhPXCpSm0/Ii7pxD/QYpWNlhB59EwghvJb4UkNXKIFy7US5RYtx 12WH1B3QeOzy/c2E2TZtf4jWDI5VLqlNIVr2BgqTPudT3NdAx7ebMMNeDqaL9wcCtP +Z+itHy1FTjGj2Hr/HHhplRQcWLk9vj62ThvVMSc= Authentication-Results: mxbackcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v6 4/5] block: make size-related BlockConf properties accept size suffixes Date: Wed, 27 May 2020 15:45:10 +0300 Message-Id: <20200527124511.986099-5-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527124511.986099-1-rvkagan@yandex-team.ru> References: <20200527124511.986099-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:0:1472:2741:0:8b6:217; envelope-from=rvkagan@yandex-team.ru; helo=forwardcorp1p.mail.yandex.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 08:45:37 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Stefano Stabellini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , qemu-block@nongnu.org, Paul Durrant , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , John Snow , Keith Busch , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Several BlockConf properties represent respective sizes in bytes so it makes sense to accept size suffixes for them. Turn them all into uint32_t and use size-suffix-capable setters/getters on them; introduce DEFINE_PROP_SIZE32 and adjust DEFINE_PROP_BLOCKSIZE for that. (Making them uint64_t and reusing DEFINE_PROP_SIZE isn't justified because guests expect at most 32bit values.) Also, since min_io_size is exposed to the guest by scsi and virtio-blk devices as an uint16_t in units of logical blocks, introduce an additional check in blkconf_blocksizes to prevent its silent truncation. Signed-off-by: Roman Kagan --- v5 -> v6: - add prop_size32 instead of going with 64bit v4 -> v5: - make all BlockConf size props support suffixes - move qdev_prop_blocksize after qdev_prop_size, to reuse get_size - reword error messages [Kevin] include/hw/block/block.h | 12 +- include/hw/qdev-properties.h | 5 +- hw/block/block.c | 11 + hw/core/qdev-properties.c | 63 ++++- tests/qemu-iotests/172.out | 530 +++++++++++++++++------------------ 5 files changed, 344 insertions(+), 277 deletions(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 784953a237..1e8b6253dd 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -18,9 +18,9 @@ =20 typedef struct BlockConf { BlockBackend *blk; - uint16_t physical_block_size; - uint16_t logical_block_size; - uint16_t min_io_size; + uint32_t physical_block_size; + uint32_t logical_block_size; + uint32_t min_io_size; uint32_t opt_io_size; int32_t bootindex; uint32_t discard_granularity; @@ -51,9 +51,9 @@ static inline unsigned int get_physical_block_exp(BlockCo= nf *conf) _conf.logical_block_size), \ DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \ _conf.physical_block_size), \ - DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ - DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \ - DEFINE_PROP_UINT32("discard_granularity", _state, \ + DEFINE_PROP_SIZE32("min_io_size", _state, _conf.min_io_size, 0), \ + DEFINE_PROP_SIZE32("opt_io_size", _state, _conf.opt_io_size, 0), \ + DEFINE_PROP_SIZE32("discard_granularity", _state, \ _conf.discard_granularity, -1), \ DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \ ON_OFF_AUTO_AUTO), \ diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index f161604fb6..5252bb6b1a 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -29,6 +29,7 @@ extern const PropertyInfo qdev_prop_drive; extern const PropertyInfo qdev_prop_drive_iothread; extern const PropertyInfo qdev_prop_netdev; extern const PropertyInfo qdev_prop_pci_devfn; +extern const PropertyInfo qdev_prop_size32; extern const PropertyInfo qdev_prop_blocksize; extern const PropertyInfo qdev_prop_pci_host_devaddr; extern const PropertyInfo qdev_prop_uuid; @@ -196,8 +197,10 @@ extern const PropertyInfo qdev_prop_pcie_link_width; BlockdevOnError) #define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int) +#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t) #define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint16_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t) #define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddre= ss) #define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ diff --git a/hw/block/block.c b/hw/block/block.c index b22207c921..97c8129e60 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -96,6 +96,17 @@ bool blkconf_blocksizes(BlockConf *conf, Error **errp) return false; } =20 + /* + * all devices which support min_io_size (scsi and virtio-blk) expose = it to + * the guest as a uint16_t in units of logical blocks + */ + if (conf->min_io_size > conf->logical_block_size * UINT16_MAX) { + error_setg(errp, + "min_io_size must not exceed " stringify(UINT16_MAX) + " logical blocks"); + return false; + } + if (!QEMU_IS_ALIGNED(conf->opt_io_size, conf->logical_block_size)) { error_setg(errp, "opt_io_size must be a multiple of logical_block_size"); diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 249dc69bd8..e7ccd4d276 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -14,6 +14,7 @@ #include "qapi/visitor.h" #include "chardev/char.h" #include "qemu/uuid.h" +#include "qemu/units.h" =20 void qdev_prop_set_after_realize(DeviceState *dev, const char *name, Error **errp) @@ -727,6 +728,57 @@ const PropertyInfo qdev_prop_pci_devfn =3D { .set_default_value =3D set_default_value_int, }; =20 +/* --- 32bit unsigned int 'size' type --- */ + +static void get_size32(Object *obj, Visitor *v, const char *name, void *op= aque, + Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t value =3D *ptr; + + visit_type_size(v, name, &value, errp); +} + +static void set_size32(Object *obj, Visitor *v, const char *name, void *op= aque, + Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t value; + Error *local_err =3D NULL; + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + visit_type_size(v, name, &value, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + if (value > UINT32_MAX) { + error_setg(errp, + "Property %s.%s doesn't take value %" PRIu64 + " (maximum: " stringify(UINT32_MAX) ")", + dev->id ? : "", name, value); + return; + } + + *ptr =3D value; +} + +const PropertyInfo qdev_prop_size32 =3D { + .name =3D "size", + .get =3D get_size32, + .set =3D set_size32, + .set_default_value =3D set_default_value_uint, +}; + /* --- blocksize --- */ =20 /* lower limit is sector size */ @@ -741,7 +793,8 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint16_t value, *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t value; Error *local_err =3D NULL; =20 if (dev->realized) { @@ -749,7 +802,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, return; } =20 - visit_type_uint16(v, name, &value, &local_err); + visit_type_size(v, name, &value, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -757,7 +810,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, /* value of 0 means "unset" */ if (value && (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE)) { error_setg(errp, - "Property %s.%s doesn't take value %" PRIu16 + "Property %s.%s doesn't take value %" PRIu64 " (minimum: " MIN_BLOCK_SIZE_STR ", maximum: " MAX_BLOCK_SIZE_STR ")", dev->id ? : "", name, value); @@ -776,10 +829,10 @@ static void set_blocksize(Object *obj, Visitor *v, co= nst char *name, } =20 const PropertyInfo qdev_prop_blocksize =3D { - .name =3D "uint16", + .name =3D "size", .description =3D "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, - .get =3D get_uint16, + .get =3D get_size32, .set =3D set_blocksize, .set_default_value =3D set_default_value_uint, }; diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 59cc70aebb..e782c5957e 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -24,11 +24,11 @@ Testing: dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -54,11 +54,11 @@ Testing: -fda TEST_DIR/t.qcow2 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -81,22 +81,22 @@ Testing: -fdb TEST_DIR/t.qcow2 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -119,22 +119,22 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -160,11 +160,11 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -187,22 +187,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2,i= ndex=3D1 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -225,22 +225,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dfloppy,file=3DTEST_DIR/t dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -266,11 +266,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -gl= obal isa-fdc.driveA=3Dnone0 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -293,11 +293,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -gl= obal isa-fdc.driveB=3Dnone0 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -320,22 +320,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -361,11 +361,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -388,11 +388,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,unit=3D1 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -415,22 +415,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -456,22 +456,22 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -494,22 +494,22 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -532,11 +532,11 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -559,11 +559,11 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -589,22 +589,22 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -627,22 +627,22 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -665,22 +665,22 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -703,22 +703,22 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -750,22 +750,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dnone,file=3DTEST_DIR/t.q dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -788,22 +788,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dnone,file=3DTEST_DIR/t.q dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -832,22 +832,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -870,22 +870,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -908,22 +908,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -946,22 +946,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -999,11 +999,11 @@ Testing: -device floppy dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -1026,11 +1026,11 @@ Testing: -device floppy,drive-type=3D120 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "120" @@ -1053,11 +1053,11 @@ Testing: -device floppy,drive-type=3D144 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -1080,11 +1080,11 @@ Testing: -device floppy,drive-type=3D288 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -1110,11 +1110,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,drive-t dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "120" @@ -1137,11 +1137,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,drive-t dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -1167,11 +1167,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,logical dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -1194,11 +1194,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,physica dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" --=20 2.26.2 From nobody Sat May 4 17:08:26 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590583617; cv=none; d=zohomail.com; s=zohoarc; b=KdTZg1kUBfq3lcsd6A0P2WikXqEO8JADZ3ICtqKFmchQKmPVHxPT6UFc38OZWb6Fdb+ZBcwF535bFKM4topXr4NoPwvMVOCPpVP7VTkM3lv2UQTW07Qktu5mUuQaQ/du7wH83UT4hFEZQdvy23KOJdHPgaZTLllRzDPCxqEVfU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590583617; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5vTc+cYwJ0Yp/qYZkQZ2K2YBz+RbUpeML72x3NJFPMc=; b=QnbnDxDyPk92mCZs4vYPKKpRs5N/AxRshK3rhfTH+ZSuPkST30o5IuOf4zv1h5MWylnOIx+HoKPW/sFLo5YmD9QzstJt9rb5fgCnQM51alvZvWCAhMAl9o+WsYLzZ0D/Td3CAZ1DOvq3UONW02VkrfmXuH70v19t/KECylmGcyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590583616936860.514384071676; Wed, 27 May 2020 05:46:56 -0700 (PDT) Received: from localhost ([::1]:33586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdvSR-0001v1-In for importer@patchew.org; Wed, 27 May 2020 08:46:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvRI-00008M-14; Wed, 27 May 2020 08:45:44 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:34932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdvRG-0001eS-Uc; Wed, 27 May 2020 08:45:43 -0400 Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 05C1E2E15A3; Wed, 27 May 2020 15:45:41 +0300 (MSK) Received: from iva4-7c3d9abce76c.qloud-c.yandex.net (iva4-7c3d9abce76c.qloud-c.yandex.net [2a02:6b8:c0c:4e8e:0:640:7c3d:9abc]) by mxbackcorp2j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id nqQj86Bk57-jbfq4Pkl; Wed, 27 May 2020 15:45:40 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b080:8308::1:12]) by iva4-7c3d9abce76c.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id bzO5qPtczO-jbWOOqOL; Wed, 27 May 2020 15:45:37 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590583540; bh=5vTc+cYwJ0Yp/qYZkQZ2K2YBz+RbUpeML72x3NJFPMc=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=M8ZuAGhMsx+thLLDbKB6QLd0xI3uJHv/67y4TKRY/bZ+ez9EboHcOgdO7FSZX/7gx xj/pb4AGN2vS4pgcLBcJJgBd6ZYem3Hkwx03tMjUZRDlse10PYNpKpubdCsW5rUtkS Y0DVCZz3xDn0rgPyU2RF91ofdnmEY3eHdmqMoygs= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v6 5/5] block: lift blocksize property limit to 2 MiB Date: Wed, 27 May 2020 15:45:11 +0300 Message-Id: <20200527124511.986099-6-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200527124511.986099-1-rvkagan@yandex-team.ru> References: <20200527124511.986099-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=77.88.29.217; envelope-from=rvkagan@yandex-team.ru; helo=forwardcorp1p.mail.yandex.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/27 08:45:23 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Stefano Stabellini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , qemu-block@nongnu.org, Paul Durrant , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , John Snow , Keith Busch , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Logical and physical block sizes in QEMU are limited to 32 KiB. This appears unnecessary tight, and we've seen bigger block sizes handy at times. Lift the limitation up to 2 MiB which appears to be good enough for everybody, and matches the qcow2 cluster size limit. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake --- v4 -> v5: - split out into separate patch [Philippe] - as this patch has changed significantly lose Eric's r-b hw/core/qdev-properties.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index e7ccd4d276..ecd84262a9 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -784,9 +784,12 @@ const PropertyInfo qdev_prop_size32 =3D { /* lower limit is sector size */ #define MIN_BLOCK_SIZE 512 #define MIN_BLOCK_SIZE_STR stringify(MIN_BLOCK_SIZE) -/* upper limit is the max power of 2 that fits in uint16_t */ -#define MAX_BLOCK_SIZE 32768 -#define MAX_BLOCK_SIZE_STR stringify(MAX_BLOCK_SIZE) +/* + * upper limit is arbitrary, 2 MiB looks sufficient for all sensible uses,= and + * matches qcow2 cluster size limit + */ +#define MAX_BLOCK_SIZE (2 * MiB) +#define MAX_BLOCK_SIZE_STR "2 MiB" =20 static void set_blocksize(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) --=20 2.26.2