From nobody Mon Apr 29 17:12:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1568980704; cv=none; d=zoho.com; s=zohoarc; b=TfcDvGkPdK/nV95eVKpF6ddbKm/Tu6x++WCaVma5fSw9hn5yl5vukF6izaFX017+hwVEnLbByN6MJK9wsJYD5tENbHIUEPOdjnFaONcKfHjS+8ONrJQnAAihZjDHcqjoaIJAiUPGRDWPW5FVpAdriFymn5ba5vpV/SD8KXZazao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568980704; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=lOvcBWXZvYMMlNLfyAeOFlrAomKdbt0m4VflfPPuj34=; b=C0aW867UbDDus3KwOvtQqk0abImvxGGeh8NzIjXUw0+vrrIEXKzWJQfYYLDtEgQbuTLs7wMpTnI6R9FYaOrfFwSJoG3Am5XJpomQW3o3PVzAcTgQGKuuMka9iLT5DFyYLQnBpV7dLLpcWozfLQooxsf2lUxpmrA+KBgKzV6guSQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568980703632324.662072356119; Fri, 20 Sep 2019 04:58:23 -0700 (PDT) Received: from localhost ([::1]:58162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBHYH-0008Rc-Kx for importer@patchew.org; Fri, 20 Sep 2019 07:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40996) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBHWz-0007UB-Ax for qemu-devel@nongnu.org; Fri, 20 Sep 2019 07:57:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBHWy-0007Rh-7y for qemu-devel@nongnu.org; Fri, 20 Sep 2019 07:56:57 -0400 Received: from forwardcorp1j.mail.yandex.net ([5.45.199.163]:58814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBHWr-0007Hw-3d; Fri, 20 Sep 2019 07:56:49 -0400 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 DBFB72E14D3; Fri, 20 Sep 2019 14:56:41 +0300 (MSK) Received: from sas1-7fab0cd91cd2.qloud-c.yandex.net (sas1-7fab0cd91cd2.qloud-c.yandex.net [2a02:6b8:c14:3a93:0:640:7fab:cd9]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id t6yDCsn7xd-uf28JKOH; Fri, 20 Sep 2019 14:56:41 +0300 Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:f68c:50ff:fee9:44bd]) by sas1-7fab0cd91cd2.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3O334nXv8N-ueISkB8J; Fri, 20 Sep 2019 14:56:41 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) Precedence: bulk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1568980601; bh=lOvcBWXZvYMMlNLfyAeOFlrAomKdbt0m4VflfPPuj34=; h=Message-Id:Date:Subject:To:From:Cc; b=M5GtK5h2hOLlkMjjjzg70+I/XLLIAyPpFBdzfQOS3LM02P1Z/0hojwSPCwI6JLouf m6j3xoIzJEC16s38BWRmschN8MHSOc6v59uO5nUTziM/91Scz8KA/ar5u5hDkqcrU1 FE1X/EfhKW7LS89Jh/PXlZ9inHYu5VISJlkMRwks= Authentication-Results: mxbackcorp1g.mail.yandex.net; dkim=pass header.i=@yandex-team.ru From: Evgeny Yakovlev To: stefanha@redhat.com, mst@redhat.com, qemu-block@nongnu.org Subject: [RFC PATCH] virtio-blk: advertise F_WCE (F_FLUSH) if F_CONFIG_WCE is also advertised Date: Fri, 20 Sep 2019 14:56:30 +0300 Message-Id: <1568980590-806043-1-git-send-email-wrfsh@yandex-team.ru> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 5.45.199.163 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, yc-core@yandex-team.ru Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @yandex-team.ru) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Virtio spec 1.1 (and earlier), 5.2.5.1 Driver Requirements: Device Initialization: "Devices SHOULD always offer VIRTIO_BLK_F_FLUSH, and MUST offer it if they offer VIRTIO_BLK_F_CONFIG_WCE. It looks like currently F_CONFIG_WCE and F_WCE are not connected to each other. qemu will advertise F_CONFIG_WCE if config-wce argument is set for virtio-blk device. While F_WCE is advertised if underlying block backend actually has it's caching enabled. Those two things are not related to each other. Signed-off-by: Evgeny Yakovlev --- hw/block/virtio-blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 1885160..b45dc0c 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -990,7 +990,8 @@ static uint64_t virtio_blk_get_features(VirtIODevice *v= dev, uint64_t features, virtio_add_feature(&features, VIRTIO_BLK_F_SCSI); } =20 - if (blk_enable_write_cache(s->blk)) { + if (blk_enable_write_cache(s->blk) || + virtio_has_feature(features, VIRTIO_BLK_F_CONFIG_WCE)) { virtio_add_feature(&features, VIRTIO_BLK_F_WCE); } if (blk_is_read_only(s->blk)) { --=20 2.7.4