From patchwork Thu May 28 22:55:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 11577201 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3DAE7912 for ; Thu, 28 May 2020 22:56:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 144FC2074B for ; Thu, 28 May 2020 22:56:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=yandex-team.ru header.i=@yandex-team.ru header.b="eHQklP5M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 144FC2074B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=yandex-team.ru Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:59846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jeRS8-0000vP-6A for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 May 2020 18:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48792) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeRQx-0007Vi-E2; Thu, 28 May 2020 18:55:31 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:41874) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeRQt-0007sM-WB; Thu, 28 May 2020 18:55:29 -0400 Received: from mxbackcorp1o.mail.yandex.net (mxbackcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::301]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 7FE012E14E9; Fri, 29 May 2020 01:55:23 +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 42411HDFKv-tGx0AjR1; Fri, 29 May 2020 01:55:23 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1590706523; bh=bUJnbRB6fLAgdvUHR4vxsn1k8XIGmwL4yvdLETP4YEw=; h=Message-Id:Date:Subject:To:From:Cc; b=eHQklP5M7jKdipoVYcPit0Q9YR1xnbAZbfwiHxyU18yqXF8RL4w0ZWEIaaqkQfqFX d/QwHBTTr/nXZhih1CCsXqjZ12d0H3UYKhWSFeqX0j+VJMiBHvsyEU1y98I5AgL7Ix 1roQi0iBKl3xvR7GGgpcnQLmwDeFQ4PaAlyCHp3o= Authentication-Results: mxbackcorp1o.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:1318::1:10]) by iva4-7c3d9abce76c.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id tdfEhvD3Vg-tGWSfLS8; Fri, 29 May 2020 01:55:16 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) From: Roman Kagan To: qemu-devel@nongnu.org Subject: [PATCH v8 0/8] block: enhance handling of size-related BlockConf properties Date: Fri, 29 May 2020 01:55:08 +0300 Message-Id: <20200528225516.1676602-1-rvkagan@yandex-team.ru> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 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/28 17:40: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: Fam Zheng , Kevin Wolf , Stefano Stabellini , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , Eduardo Habkost , qemu-block@nongnu.org, Paul Durrant , John Snow , "Michael S. Tsirkin" , Laurent Vivier , Max Reitz , Keith Busch , Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" BlockConf includes several properties counted in bytes. Enhance their handling in some aspects, specifically - accept common size suffixes (k, m) - perform consistency checks on the values - lift the upper limit on physical_block_size and logical_block_size Also fix the accessor for opt_io_size in virtio-blk to make it consistent with the size of the field. History: v7 -> v8: - replace stringify with %u in error messages [Eric] - fix wording in logs [Eric] v6 -> v7: - avoid overflow in min_io_size check [Eric] - try again to perform the art form in patch splitting [Eric] v5 -> v6: - fix forgotten xen-block and swim - add prop_size32 instead of going with 64bit v4 -> v5: - re-split the patches [Philippe] - fix/reword error messages [Philippe, Kevin] - do early return on failed consistency check [Philippe] - use QEMU_IS_ALIGNED instead of open coding [Philippe] - make all BlockConf size props support suffixes - expand the log for virtio-blk opt_io_size [Michael] v3 -> v4: - add patch to fix opt_io_size width in virtio-blk - add patch to perform consistency checks [Kevin] - check min_io_size against truncation [Kevin] v2 -> v3: - mention qcow2 cluster size limit in the log and comment [Eric] v1 -> v2: - cap the property at 2 MiB [Eric] - accept size suffixes Roman Kagan (8): virtio-blk: store opt_io_size with correct size block: consolidate blocksize properties consistency checks qdev-properties: blocksize: use same limits in code and description qdev-properties: add size32 property type qdev-properties: make blocksize accept size suffixes block: make BlockConf size props 32bit and accept size suffixes qdev-properties: add getter for size32 and blocksize block: lift blocksize property limit to 2 MiB include/hw/block/block.h | 14 +- include/hw/qdev-properties.h | 5 +- hw/block/block.c | 40 ++- hw/block/fdc.c | 5 +- hw/block/nvme.c | 5 +- hw/block/swim.c | 5 +- hw/block/virtio-blk.c | 9 +- hw/block/xen-block.c | 6 +- hw/core/qdev-properties.c | 85 +++++- hw/ide/qdev.c | 5 +- hw/scsi/scsi-disk.c | 12 +- hw/usb/dev-storage.c | 5 +- tests/qemu-iotests/172.out | 532 +++++++++++++++++------------------ 13 files changed, 419 insertions(+), 309 deletions(-)