From patchwork Fri Aug 26 14:32:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniil Tatianin X-Patchwork-Id: 12956172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5A271ECAAA3 for ; Fri, 26 Aug 2022 15:10:58 +0000 (UTC) Received: from localhost ([::1]:38644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRaz3-0003i7-Bz for qemu-devel@archiver.kernel.org; Fri, 26 Aug 2022 11:10:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRaOe-0004FJ-0t; Fri, 26 Aug 2022 10:33:20 -0400 Received: from forwardcorp1p.mail.yandex.net ([77.88.29.217]:45456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRaOa-0007AW-AM; Fri, 26 Aug 2022 10:33:18 -0400 Received: from iva4-f06c35e68a0a.qloud-c.yandex.net (iva4-f06c35e68a0a.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:152e:0:640:f06c:35e6]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id C29342E0D96; Fri, 26 Aug 2022 17:33:05 +0300 (MSK) Received: from d-tatianin-nix.yandex-team.ru (unknown [2a02:6b8:b081:b581::1:d]) by iva4-f06c35e68a0a.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 7Ht2PirWaX-X4OqiTrR; Fri, 26 Aug 2022 17:33:05 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1661524385; bh=S4H3ViqxCeXn/pw4aRWRPjnuUjz3riUpBFwv65dnOPs=; h=Message-Id:Date:Cc:Subject:To:From; b=exjtJKSBy3TIz6zCuCYpp67qLYvS1AymNIeVK3SusrxVDLBDPSwcB1rFp2iU0kxxA ucWXZxFYGASrWwSITkzPDXzjrjo57fo6khAb7jgw9FN+Hgvaz33HgDzbcQf6lvGWZk c54V2Vofcfioj6A4GnJCn/lEGUSz9p7nQPIQzIuM= Authentication-Results: iva4-f06c35e68a0a.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Daniil Tatianin To: qemu-devel@nongnu.org Cc: yc-core@yandex-team.ru, mst@redhat.com, stefanha@redhat.com, raphael.norwitz@nutanix.com, kwolf@redhat.com, qemu-block@nongnu.org, jasowang@redhat.com, d-tatianin@yandex-team.ru Subject: [PATCH v2 0/8] vhost-user-blk: dynamically resize config space based on features Date: Fri, 26 Aug 2022 17:32:40 +0300 Message-Id: <20220826143248.580939-1-d-tatianin@yandex-team.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=77.88.29.217; envelope-from=d-tatianin@yandex-team.ru; helo=forwardcorp1p.mail.yandex.net 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_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This patch set attempts to align vhost-user-blk with virtio-blk in terms of backward compatibility and flexibility. It also improves the virtio core by introducing new common code that can be used by a virtio device to calculate its config space size. In particular it adds the following things: - Common virtio code for deducing the required device config size based on provided host features. - Ability to disable modern virtio-blk features like discard/write-zeroes for vhost-user-blk. - Dynamic configuration space resizing based on enabled features, by reusing the common code introduced in the earlier commits. - Cleans up the VHostUserBlk structure by reusing parent fields. Changes since v1 (mostly addresses Stefan's feedback): - Introduce VirtIOConfigSizeParams & virtio_get_config_size - Remove virtio_blk_set_config_size altogether, make virtio-blk-common.c only hold the virtio-blk config size parameters. - Reuse parent fields in vhost-user-blk instead of introducing new ones. Daniil Tatianin (8): virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size virtio-blk: utilize VirtIOConfigSizeParams & virtio_get_config_size virtio-net: utilize VirtIOConfigSizeParams & virtio_get_config_size virtio: remove the virtio_feature_get_config_size helper virtio-blk: move config size params to virtio-blk-common vhost-user-blk: make it possible to disable write-zeroes/discard vhost-user-blk: make 'config_wce' part of 'host_features' vhost-user-blk: dynamically resize config space based on features MAINTAINERS | 4 +++ hw/block/meson.build | 4 +-- hw/block/vhost-user-blk.c | 29 +++++++++++--------- hw/block/virtio-blk-common.c | 39 +++++++++++++++++++++++++++ hw/block/virtio-blk.c | 28 +++---------------- hw/net/virtio-net.c | 8 ++++-- hw/virtio/virtio.c | 10 ++++--- include/hw/virtio/vhost-user-blk.h | 1 - include/hw/virtio/virtio-blk-common.h | 20 ++++++++++++++ include/hw/virtio/virtio.h | 10 +++++-- 10 files changed, 104 insertions(+), 49 deletions(-) create mode 100644 hw/block/virtio-blk-common.c create mode 100644 include/hw/virtio/virtio-blk-common.h