From nobody Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702023; cv=none; d=zohomail.com; s=zohoarc; b=lbgitC3ZuqgVYflqMZEHktMD7zB8Umc2xUujOLlKpsc75B1uAW8Mjy34HxQzdPa9z0nHOzvJNiKcGCPxLmWFYf6+vGNLeiGvYdb/eOsl+UvO19jqsrx6IbrxouTsLETekPm4l8sXYMs80YoF1xrZ/JUWLWkou1/88UZcDDWYhZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702023; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QhaZGhUGT//OQOhXA4U9vk1hEzoswycgPYq+LACJTvA=; b=I+QpOOkBSaCgRl+Oeslx5UA4oZZg6RfAYQATWfgz6KAskSh/qKRuaGqcbkjn1vxV4+XEn0Qz6IrPDQ2g5Js9TJopTob/7iyT/WwkeshOAeWX98cXxbZlo/MA0pOOo5c9euHQ5ErYgmcvBN3UE38Wg7qiPbetJ3Y0MiMdty2/j3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702023596619.6713610596258; Thu, 28 May 2020 14:40:23 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQFy-0002hz-I2; Thu, 28 May 2020 21:40:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQFw-0002UC-So for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:04 +0000 Received: from forwardcorp1j.mail.yandex.net (unknown [2a02:6b8:0:1619::183]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c8016bb2-a12b-11ea-9947-bc764e2007e4; Thu, 28 May 2020 21:40:00 +0000 (UTC) Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id E14EF2E0E4D; Fri, 29 May 2020 00:39:58 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp2j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id 57WkjCjfeF-drfO2KuB; Fri, 29 May 2020 00:39:58 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-drXq1Pqx; Fri, 29 May 2020 00:39:53 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: c8016bb2-a12b-11ea-9947-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590701998; bh=QhaZGhUGT//OQOhXA4U9vk1hEzoswycgPYq+LACJTvA=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=J1hsV3Zu3Kdk9x90+JIO4BvbwGSJO3/RF4PmBR4BmaXKQVKnQcKyItZ63s7RucraM CURaYPuDINuwrQULpzWQrWMzSkGQLZf249L/ihkF3TkWOuuHW6eEBstRKf1TXLJltz yU/dtNb2Jdb5G1Tu53A2QGg3GUdAA+fck6P5utdE= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 1/8] virtio-blk: store opt_io_size with correct size Date: Fri, 29 May 2020 00:39:39 +0300 Message-Id: <20200528213946.1636444-2-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-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: - split out into separate patch [Philippe] 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 Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702031; cv=none; d=zohomail.com; s=zohoarc; b=eq5vmyZZk3WsSABHDyOnXO+408TcupDmCSDsm9cxNtlVZtM4QdP+XUEGpxeBFnPjnw6XwejFlTS+knw8rI6Scl7ZoE1pSx2c5DNybnIsNkCHKa+yMV5I+fwQ/Kzx2ZKmLCePDRa1squX29TfTGQ3qlesi9w+322vxxRQBWy79mQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702031; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kVY6FV62QcfCHwxFdjqYrHINjsHStH5S4jKjvLIimMs=; b=M/hkylNndT0FnIpc2VXcupV5oek+N2yV2akyWQp1x4lnIZ0MfiayS4peX/KGwcLpOjMYRIB+zPFD0LJRXayKZ3bcSJtZq2IHZcjKkiy1MPaxZamlZs6vwpNw7Yy7cT1gTPrfwlBUTP3/Vfu2chFnKpRv//HcFTXCXMm3Y1v8ANk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702031816488.65282910003566; Thu, 28 May 2020 14:40:31 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQG7-0002no-SU; Thu, 28 May 2020 21:40:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQG7-0002ng-CA for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:15 +0000 Received: from forwardcorp1o.mail.yandex.net (unknown [2a02:6b8:0:1a2d::193]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ceeda756-a12b-11ea-9dbe-bc764e2007e4; Thu, 28 May 2020 21:40:12 +0000 (UTC) Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 4A91E2E1628; Fri, 29 May 2020 00:40:11 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp1j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id XInhed9mIK-dxeurjwL; Fri, 29 May 2020 00:40:11 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-dxXqUetq; Fri, 29 May 2020 00:39:59 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: ceeda756-a12b-11ea-9dbe-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590702011; bh=kVY6FV62QcfCHwxFdjqYrHINjsHStH5S4jKjvLIimMs=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=dAOJ387Wr89LaCgO8aZBSZj8XlkSMTV3AooKBBL/EdBlxV9pMbY8nOpjz6FEtPuzA H7dAlIgS/nPvOhL9SHHTNGQF5uMK4v13qMLPlyVOofUzLmuWzIaCunO2IATxqmVP0A H+Li2Jbe/NBZGy9JBi5xc/q3AmH0zIx6qVfdOM00= Authentication-Results: mxbackcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 2/8] block: consolidate blocksize properties consistency checks Date: Fri, 29 May 2020 00:39:40 +0300 Message-Id: <20200528213946.1636444-3-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-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 Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702038; cv=none; d=zohomail.com; s=zohoarc; b=UykjmqkYT/fIfjdM9s575/V8oiJD3HpeF33q4d+oSlYHwyx5Gp4qB0ag3XViNrqSscOGoEtDkL5sLuDFDy8nXJor33Lpo0gJCeO5IIKf/B52KcqiDM7n/B2UMDnTITK0wjgHy7vdwpXsjSYFFRnNwSi1C6/MesgKxrlQj1J14Bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702038; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e/snD3eRLt3OD/77mBucMy84xJYC36ARRHwF7w0zqIc=; b=R/3NFgCI1zDVila3fmPOwodh8dywtAi9vtQsyRtRb8PaFTfyVFnkka/MZeuDbzeySXZIsPa/e5K93w6S2O0L+zSuxQGi5Hh1Sqxt2Xju2aQupH/CU38owV+Urvdg34eK7C0NzGxmx8Ju1BanQ+0f7YQnrpxqNHbUJ+1pW+Y3DsU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702038447640.2624085110222; Thu, 28 May 2020 14:40:38 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGE-0002q3-4s; Thu, 28 May 2020 21:40:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGD-0002pi-8R for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:21 +0000 Received: from forwardcorp1p.mail.yandex.net (unknown [2a02:6b8:0:1472:2741:0:8b6:217]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d2d25b1e-a12b-11ea-9947-bc764e2007e4; Thu, 28 May 2020 21:40:18 +0000 (UTC) Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id A2AEC2E094D; Fri, 29 May 2020 00:40:17 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp1g.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id XyXqfhV9ak-eBImwSEL; Fri, 29 May 2020 00:40:17 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-eBXqvQYw; Fri, 29 May 2020 00:40:11 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: d2d25b1e-a12b-11ea-9947-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590702017; bh=e/snD3eRLt3OD/77mBucMy84xJYC36ARRHwF7w0zqIc=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=a61iP8p1OPQXlCsL4kqDkdM1sPBrQA9F1w+ycRSumQdjV4xDstR5Ny80gfxO/6esp /FcUhqt6Jujttn9Mm77h/cHfZ5Mv6IY0LDDhTjwmgpFyFO7ZrjYnwed7WcpG6NBBba HAkjADgLWt15cvwTlBp0FcTWXNGN8BqNNOC1Cx5g= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 3/8] qdev-properties: blocksize: use same limits in code and description Date: Fri, 29 May 2020 00:39:41 +0300 Message-Id: <20200528213946.1636444-4-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-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 Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702040; cv=none; d=zohomail.com; s=zohoarc; b=OhBLRavgG6NDVsJ91jSJtZtH5EOPTCh6g3ZbVa+NMqOkfwYnx4+y8KF0OsbVReR7O85bclcdz+oNNW2t/fIUVRXaea0SC92NKFCNZbDsnKW+nkm/I9HF9NxPfQsdevUaSTVKnqXZdEw9L65YyEvmY4XohOqtYgH2CKkz2OoXCsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702040; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7tQKIjaOXt/4Y7vYYUMOTnckyEJyyiKNNu3wuyOniCw=; b=C8r7wIi3vlbSaqKAhAKxC9P4tBiuF79SzHvvvkNal/dHpBjSuRp25TqNi4zbgP6LT19N5/JIeM4+mDFn3pAqhqeUe4nZmfXoLDf6cWvj5M0HWBUie68BxYx9x5CYPDiT5p5dZ1chfWY8StoyndCuR3w+8ZlA7HPVUtSV7Xl4bAI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702040044101.70177906664787; Thu, 28 May 2020 14:40:40 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGI-0002rb-E9; Thu, 28 May 2020 21:40:26 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGG-0002r3-Mk for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:24 +0000 Received: from forwardcorp1j.mail.yandex.net (unknown [5.45.199.163]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d520d756-a12b-11ea-a842-12813bfff9fa; Thu, 28 May 2020 21:40:22 +0000 (UTC) Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id BA59E2E0E4D; Fri, 29 May 2020 00:40:21 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp1j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id cApy1ma1ft-eIeujrcV; Fri, 29 May 2020 00:40:21 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-eHXqcO0n; Fri, 29 May 2020 00:40:18 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: d520d756-a12b-11ea-a842-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590702021; bh=7tQKIjaOXt/4Y7vYYUMOTnckyEJyyiKNNu3wuyOniCw=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=IyJ61abDZvYdolV88vhvsRf/qW/U9Jap3J3kd6DM7xB7m+T+ajR/cSZy9vxxpNxa2 ZxymbfVphokM0ohXrOdASuTtNlN1PdAbADJyPpV2CZkMzy2juLJPZeOcM5N3AgbSSK PYCYZwm6nmz+tuIaEtq3V6JA4jSnR+uDVG77Scik= Authentication-Results: mxbackcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 4/8] qdev-properties: add size32 property type Date: Fri, 29 May 2020 00:39:42 +0300 Message-Id: <20200528213946.1636444-5-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Introduce size32 property type which handles size suffixes (k, m) just like size property, but is uint32_t rather than uint64_t. It's going to be useful for properties that are byte sizes but are inherently 32bit, like BlkConf.opt_io_size or .discard_granularity (they are switched to this new property type in a followup commit). The getter for size32 is left out for a separate patch as its benefit is less obvious, and it affects test output; for now the regular uint32 getter is used. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake --- v6 -> v7: - split out into separate patch [Eric] include/hw/qdev-properties.h | 3 +++ hw/core/qdev-properties.c | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index f161604fb6..c03eadfad6 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,6 +197,8 @@ 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 DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 249dc69bd8..d943755832 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -727,6 +727,46 @@ const PropertyInfo qdev_prop_pci_devfn =3D { .set_default_value =3D set_default_value_int, }; =20 +/* --- 32bit unsigned int 'size' type --- */ + +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_uint32, + .set =3D set_size32, + .set_default_value =3D set_default_value_uint, +}; + /* --- blocksize --- */ =20 /* lower limit is sector size */ --=20 2.26.2 From nobody Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702044; cv=none; d=zohomail.com; s=zohoarc; b=H2hYhmg0RNjhFEJE6ft5GQ9Isp/bG6FXlzcwinrjtDpMNik0LemMrWgp+B+6jj5IGom+71W6LQMfZCvt0BvWsze2skxwwcA+5T+i3YYj/rEi3QmFfvw0YPg7ROPLKfpkoBfct9wYAwsPO7MiEBht/PEi1dKfRcZm/qS619WbMiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702044; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5RSCVs6L6zfegAd6aySYoeQzRtcXoc5ATSUz8Gh7fPk=; b=LqB4lomahfp5pY1yqwrVnfhWdCjaVZ6f5O0iqcWmjS9arB5D73XS/ZZ160XZUIz9y6J8bCCBKck0bKLk3biIjJwjJhz1RPhQ5YyDMPxPjU4EVCkFFlsndO/kWCZ9k3X3n+y7STpvMd6A97e4f3QtAw3yt0tGwK4eAYiGQF9T+7I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702044333349.2420684505412; Thu, 28 May 2020 14:40:44 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGN-0002up-So; Thu, 28 May 2020 21:40:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGN-0002uN-1x for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:31 +0000 Received: from forwardcorp1j.mail.yandex.net (unknown [5.45.199.163]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d91c0f24-a12b-11ea-a842-12813bfff9fa; Thu, 28 May 2020 21:40:29 +0000 (UTC) Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id 679A02E0E4D; Fri, 29 May 2020 00:40:28 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp1g.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id PNbNuCHaNu-eMICwYct; Fri, 29 May 2020 00:40:28 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-eLXqFHpn; Fri, 29 May 2020 00:40:22 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: d91c0f24-a12b-11ea-a842-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590702028; bh=5RSCVs6L6zfegAd6aySYoeQzRtcXoc5ATSUz8Gh7fPk=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=kVYWGWsNParhYuG6ULSCFMbhl+gxJT6H8x1ZAyazb5XsNyFSE+XPP7uOEihSqQzUh s/6GsoCcf7GOlwuidJS7mwQ7ckF7WyaHiWOwi6qsOFo8xEhwJQkl9yA/L1hOmAQljZ 76CeB5+6F8X6R6RrQssMuyLtdgMHC9f2LhsTUVXo= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 5/8] qdev-properties: make blocksize accept size suffixes Date: Fri, 29 May 2020 00:39:43 +0300 Message-Id: <20200528213946.1636444-6-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" It appears convenient to be able to specify physical_block_size and logical_block_size using common size suffixes. Teach the blocksize property setter to interpret them. Also express the upper and lower limits in the respective units. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake --- v6 -> v7: - split out into separate patch [Eric] hw/core/qdev-properties.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index d943755832..a79062b428 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) @@ -771,17 +772,18 @@ const PropertyInfo qdev_prop_size32 =3D { =20 /* lower limit is sector size */ #define MIN_BLOCK_SIZE 512 -#define MIN_BLOCK_SIZE_STR stringify(MIN_BLOCK_SIZE) +#define MIN_BLOCK_SIZE_STR "512 B" /* 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) +#define MAX_BLOCK_SIZE (32 * KiB) +#define MAX_BLOCK_SIZE_STR "32 KiB" =20 static void set_blocksize(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint16_t value, *ptr =3D qdev_get_prop_ptr(dev, prop); + uint16_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t value; Error *local_err =3D NULL; =20 if (dev->realized) { @@ -789,7 +791,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; @@ -797,7 +799,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); @@ -816,7 +818,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t 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, --=20 2.26.2 From nobody Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702051; cv=none; d=zohomail.com; s=zohoarc; b=Bgxrcde/p2VPKs8Yy/DQsBhbXLsRtm1eZymGnWNLoQz40FMtunSlvPV97YQOwANVVIDGbFOZll376fy9xKH1mJzFS9VZdR1DOLA5maSzTsGNn1cQUmjzdPR5a6Rqumg6ij7AUwF+0+0WZF+cCqAkU+r96F0v1BOHIIVyuz4+1rQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702051; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RswyRtwtBWdULttAfpPdwBoW/nGa0Ey4G3dbrsYzIC8=; b=eUxMWcbU9kaLMeGlafI1s+tkmIaSRwFCyiDU1fbiluwO/cXh3ER2nwW+Hvm0G1i5t6JYee3ZCKLLsOd707fKCv0U4KfGuM20WDW+VH/RSqgTLvG2gxVc75Pa0qTPZwWjbulaNx3cbxmONZEuKHsB9IODJ8g9A0oRZcJD2UOBZEY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702051939949.9702322147293; Thu, 28 May 2020 14:40:51 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGS-0002xQ-5R; Thu, 28 May 2020 21:40:36 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGR-0002x4-H0 for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:35 +0000 Received: from forwardcorp1p.mail.yandex.net (unknown [77.88.29.217]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id dbf67356-a12b-11ea-a842-12813bfff9fa; Thu, 28 May 2020 21:40:34 +0000 (UTC) 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 368372E094D; Fri, 29 May 2020 00:40:33 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp2j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id 6B27twZHb8-eSfuTBtm; Fri, 29 May 2020 00:40:33 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-eSXqFT6u; Fri, 29 May 2020 00:40:28 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: dbf67356-a12b-11ea-a842-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590702033; bh=RswyRtwtBWdULttAfpPdwBoW/nGa0Ey4G3dbrsYzIC8=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=KwxoPh7NG4LGf33hEYMh1vMRub1HxR6OQDRFY9c+JmZ0VHWsfr4zRoFButnR8ThP9 97rZD1y420S4Hmiz9L6aecEAxN435n5FqK13YyO/7OC9QYB7BtiIKh2QHsCg9iYC8c A+vHMFWr1pNY1n36DJxND1Jqv1VrEwJ7Ax1j75y0= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 6/8] block: make BlockConf size props 32bit and accept size suffixes Date: Fri, 29 May 2020 00:39:44 +0300 Message-Id: <20200528213946.1636444-7-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Convert all size-related properties in BlockConf to 32bit. This will allow to accomodate bigger block sizes (in a followup patch). This also allows to make them all accept size suffixes, either via DEFINE_PROP_BLOCKSIZE or via DEFINE_PROP_SIZE32. 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 --- v6 -> v7: - split out into separate patch [Eric] - avoid overflow in min_io_size check [Eric] include/hw/block/block.h | 12 ++++++------ include/hw/qdev-properties.h | 2 +- hw/block/block.c | 11 +++++++++++ hw/core/qdev-properties.c | 4 ++-- 4 files changed, 20 insertions(+), 9 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 c03eadfad6..5252bb6b1a 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -200,7 +200,7 @@ extern const PropertyInfo qdev_prop_pcie_link_width; #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..7410b24dee 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 a79062b428..3cbe3f56a8 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -782,7 +782,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint16_t *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 @@ -821,7 +821,7 @@ const PropertyInfo qdev_prop_blocksize =3D { .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_uint32, .set =3D set_blocksize, .set_default_value =3D set_default_value_uint, }; --=20 2.26.2 From nobody Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702063; cv=none; d=zohomail.com; s=zohoarc; b=X6jK/Im4kKo5UXrkEBRXMiySsglPBAaq2Yhe9xVfOQxsNn3HBM/jnOU9luviQ75trPfVzl06iu0YHL+M/a1BHcFGzTsaosthFvkW0fuzN03ZxwXys4Hc5FYniJFPTalwUCU4r/BIvlPAKPc/lpKyeAI56tfLSLIghkT85eyXiYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702063; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Xz7jW75qNhpFVuRV01Pk9lJa6te4Bxqql0EsizkrxTU=; b=Uwn1e0rHgtGbHNRl4/vWpIOeEsEGSSXdlEYqJ0Ja2dN96IqQsBOlUkd1qEgiRWgIGYqUBpwpwVkR0NfCCUaX8/3TdBxRqGe5mfYIo8yz3cWn7AnkUWlH3F1xCtculzNx/lULlFH7c0mATmt9mDNXnw3UvEIYht5cVAc0ekII2W4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702063191721.4478422895826; Thu, 28 May 2020 14:41:03 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGZ-00031V-Ea; Thu, 28 May 2020 21:40:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGX-00030V-Mx for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:41 +0000 Received: from forwardcorp1j.mail.yandex.net (unknown [5.45.199.163]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id defc5566-a12b-11ea-81bc-bc764e2007e4; Thu, 28 May 2020 21:40:39 +0000 (UTC) Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id 45A832E0E4D; Fri, 29 May 2020 00:40:38 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp2j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id 3z677wbNTe-eXfGAqPR; Fri, 29 May 2020 00:40:38 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-eXXqGFjw; Fri, 29 May 2020 00:40:33 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: defc5566-a12b-11ea-81bc-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590702038; bh=Xz7jW75qNhpFVuRV01Pk9lJa6te4Bxqql0EsizkrxTU=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=aa9r5LeBt1dZoSoHCzm7DsFEbKay4sCQSO4XVOTcKvDtqlS/3xyG51daRWUprygk/ IKN7DD8DHVu5oEI8TTdII34upiI1idGFbLgW+yLJ4sYrlB0CY3BZ4Sr/g9ukkY3Egy 4EC3E+Teqeh2keDgtvz8RmoF6z1UcVOq7x5XsQmw= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 7/8] qdev-properties: add getter for size32 and blocksize Date: Fri, 29 May 2020 00:39:45 +0300 Message-Id: <20200528213946.1636444-8-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add getter for size32, and use it for blocksize, too. In its human-readable branch, it reports approximate size in human-readable units next to the exact byte value, like the getter for 64bit size does. Adjust the expected test output accordingly. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake --- v6 -> v7: - split out into separate patch [Eric] hw/core/qdev-properties.c | 15 +- tests/qemu-iotests/172.out | 530 ++++++++++++++++++------------------- 2 files changed, 278 insertions(+), 267 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 3cbe3f56a8..8f35d494a4 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -730,6 +730,17 @@ const PropertyInfo qdev_prop_pci_devfn =3D { =20 /* --- 32bit unsigned int 'size' type --- */ =20 +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) { @@ -763,7 +774,7 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, =20 const PropertyInfo qdev_prop_size32 =3D { .name =3D "size", - .get =3D get_uint32, + .get =3D get_size32, .set =3D set_size32, .set_default_value =3D set_default_value_uint, }; @@ -821,7 +832,7 @@ const PropertyInfo qdev_prop_blocksize =3D { .name =3D "size", .description =3D "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, - .get =3D get_uint32, + .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 Sun May 5 04:57:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1590702061; cv=none; d=zohomail.com; s=zohoarc; b=GeLSE2+Jwh67bDifU5Wte4xTfuzy9aKm5RpMJbXa+MDoynfGa68tY5iPphRhDX9tXYvsg1JwFwKqKZwlzf+V6MuDpvA6YEHa6JBfZNpJXOIf7g3Y7Co/bAIEoiXNTtpyvkYrKDgoasTlQEHIN9UYuhyCCl4E6U5+WXz2iEvF91A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590702061; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5lpXMZJx3pv3PDNCloJv50KPyO1W0cyKFfB8gLTBL3Y=; b=AzK0IeQEaXX1IIvv0Ufbg3zh7Qbny86t2LdbJfNtHtjzlAbIEBP0tqdG/z8rJAVa35nTyglSjG+ujblg9HoJV2LA6Iys21On4jLBTZo5amH9isgt/bMurmOC39VPQh5APJUSbehWUe2RSJBqf3KxbmaJlkKklbTfIGTqrU+bI+c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1590702061233469.104442858417; Thu, 28 May 2020 14:41:01 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGe-00035I-09; Thu, 28 May 2020 21:40:48 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jeQGc-00034O-NF for xen-devel@lists.xenproject.org; Thu, 28 May 2020 21:40:46 +0000 Received: from forwardcorp1j.mail.yandex.net (unknown [2a02:6b8:0:1619::183]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e0dcd298-a12b-11ea-81bc-bc764e2007e4; Thu, 28 May 2020 21:40:42 +0000 (UTC) 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 6BB102E157C; Fri, 29 May 2020 00:40:41 +0300 (MSK) Received: from vla5-58875c36c028.qloud-c.yandex.net (vla5-58875c36c028.qloud-c.yandex.net [2a02:6b8:c18:340b:0:640:5887:5c36]) by mxbackcorp1o.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id 6ayeGEvfGf-ecxW8imF; Fri, 29 May 2020 00:40:41 +0300 Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by vla5-58875c36c028.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id KqoauPPys3-ecXqZD3g; Fri, 29 May 2020 00:40:38 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Inumbo-ID: e0dcd298-a12b-11ea-81bc-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590702041; bh=5lpXMZJx3pv3PDNCloJv50KPyO1W0cyKFfB8gLTBL3Y=; h=In-Reply-To:Message-Id:References:Date:Subject:To:From:Cc; b=nBSx0HlWCym/ElDcHofQ6kqNW+l3CoR1a2nvOGtfo5CqGFoFTYK7ZEKQAHp5IGI8G 8Xfc4GlSO4SmCRLH9inLtJg4CeAbHbdRLlJVg6eS25NLFONIs1r5bGVA/V3YcX31AV 77m/0qSJr0anPFB1aJFVYU8/KhLK9fAkpJdJtixs= Authentication-Results: mxbackcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v7 8/8] block: lift blocksize property limit to 2 MiB Date: Fri, 29 May 2020 00:39:46 +0300 Message-Id: <20200528213946.1636444-9-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200528213946.1636444-1-rvkagan@yandex-team.ru> References: <20200528213946.1636444-1-rvkagan@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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 , Eric Blake , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Anthony Perard , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Keith Busch , xen-devel@lists.xenproject.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , John Snow Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-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 unnecessarily 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 --- v6 -> v7: - fix spelling in the log [Eric] 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 8f35d494a4..d66a498d36 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 "512 B" -/* upper limit is the max power of 2 that fits in uint16_t */ -#define MAX_BLOCK_SIZE (32 * KiB) -#define MAX_BLOCK_SIZE_STR "32 KiB" +/* + * 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