From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507699; cv=none; d=zohomail.com; s=zohoarc; b=ccSPjKfc4Sw2LK2/lGnnqpsC6xrOBINytrtKV/HzbdpWZDDe3nbixexcUqX8Qo2d1ZYYofAWQJ4+lGPlGTxgiBwoCr+KySUB8Qn7RITUPghRedSd0wl9rg5TVgNwtxIYcCsqn9q1nbzxEEL4zPhig18AfLXRHfOQjk9shXdoMgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507699; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nEvjr/rjtMP/YizFqTyiySxe0kGgrUmoFO0GrcTZhZA=; b=LVE7QMRBRb4uNMo+J6FZhQgnI+JRPw2pGW3KpsvhIqNzWLiaLmTjbTk6AqL0tXkHbzTsb6kx1qmi2X+5aerGjBdHMkiAtFPzDhFFhzF28Uzk7MR1i6GZ+hOYm4eYOTNL6duUG6v23jqfv0F/22tr/Doyu57OHA915yCgQAjD2fY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630507699567377.9689120721363; Wed, 1 Sep 2021 07:48:19 -0700 (PDT) Received: from localhost ([::1]:60926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRXG-0005nY-Gz for importer@patchew.org; Wed, 01 Sep 2021 10:48:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54712) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMED-0003YF-Hf for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:17 -0400 Received: from relay.sw.ru ([185.231.240.75]:35420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OR-40 for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:17 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME0-000RwD-Hv; Wed, 01 Sep 2021 12:08:04 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=nEvjr/rjtMP/YizFqTyiySxe0kGgrUmoFO0GrcTZhZA=; b=ZWbWspGa6Yjp PD5QMfsTrndZmdj/MqfC5JAxWVUy8/9BhaFO4Lo1kdzhJl0xH3/lcpalcg0ELJpJUktZnly3Mz6E7 vr2IIK2mcnbzLUDsY0JmLa08s6tDBgYjLWb1dHkIQIJKbGZP6I36wIZXLwKa0/FY/ipJacUrKtFSP 1AOCo=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 1/8] qdev-properties: Add read-only 64 bit property Date: Wed, 1 Sep 2021 12:07:57 +0300 Message-Id: <20210901090804.7139-2-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507699854100001 Content-Type: text/plain; charset="utf-8" In some situations, we need a property that tracks the bit but can't change it (for instance, guest features of virtio device). Signed-off-by: Maxim Davydov --- hw/core/qdev-properties.c | 32 ++++++++++++++++++++++++++++++++ include/hw/qdev-properties.h | 5 +++++ 2 files changed, 37 insertions(+) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 50f4094..d7b0436 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -231,6 +231,38 @@ const PropertyInfo qdev_prop_bit64 =3D { .set_default_value =3D set_default_value_bool, }; =20 +/* Read-only Bit64 */ + +static void prop_set_read_only_bit64(Object *obj, Visitor *v, const char *= name, + void *opaque, Error **errp) +{ + return; +} + +static uint64_t qdev_get_prop_read_only_mask64(Property *prop) +{ + assert(prop->info =3D=3D &qdev_prop_read_only_bit64); + return 0x1ull << prop->bitnr; +} + +static void prop_get_read_only_bit64(Object *obj, Visitor *v, const char *= name, + void *opaque, Error **errp) +{ + Property *prop =3D opaque; + uint64_t *p =3D object_field_prop_ptr(obj, prop); + bool value =3D (*p & qdev_get_prop_read_only_mask64(prop)) !=3D 0; + + visit_type_bool(v, name, &value, errp); +} + +const PropertyInfo qdev_prop_read_only_bit64 =3D { + .name =3D "bool", + .description =3D "on/off", + .get =3D prop_get_read_only_bit64, + .set =3D prop_set_read_only_bit64, + .set_default_value =3D set_default_value_bool, +}; + /* --- bool --- */ =20 static void get_bool(Object *obj, Visitor *v, const char *name, void *opaq= ue, diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 0ef97d6..4c4bac7 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -46,6 +46,7 @@ struct PropertyInfo { =20 extern const PropertyInfo qdev_prop_bit; extern const PropertyInfo qdev_prop_bit64; +extern const PropertyInfo qdev_prop_read_only_bit64; extern const PropertyInfo qdev_prop_bool; extern const PropertyInfo qdev_prop_enum; extern const PropertyInfo qdev_prop_uint8; @@ -102,6 +103,10 @@ extern const PropertyInfo qdev_prop_link; .set_default =3D true, \ .defval.u =3D (bool)_defval) =20 +#define DEFINE_PROP_READ_ONLY_BIT64(_name, _state, _field, _bit) = \ + DEFINE_PROP(_name, _state, _field, qdev_prop_read_only_bit64, uint64_t= , \ + .bitnr =3D (_bit)) + #define PROP_ARRAY_LEN_PREFIX "len-" =20 /** --=20 1.8.3.1 From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507652; cv=none; d=zohomail.com; s=zohoarc; b=KaBQm5267IVs0KIjunqou1jn+rRdqwD4oKhhhG+rRXZ9K4n8xcDr3NM2TWJLNeNuyPpSjTdY3VIeuFw0MfszgujLV3oukYTRvoIek90d77h8TpTGNTuR/UMr75RrxxulvsBN93574PaCTF5e64JvJFjGbgnC2KB9ZvRCtamopLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507652; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8jL/D0NXc6rwIFR0XUaMUKl6lsA78rRrWSZtWk/wHZc=; b=XsxJAusF9mNFsoQGrfREUOH2VF9+kB8QJcwekmQyuYZwQwROecY+VHqM4fc3W28ltyuyta2F6CYX58UycYFUw0ExUoR+Ac7WvUdfRh4l06DqIweDS5OWT4+gEyvIIxNSpOPtjKT9w0mt5JLrFjr7HV1U61XU0/jz1H5s2EuwLow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630507652716208.42678554390056; Wed, 1 Sep 2021 07:47:32 -0700 (PDT) Received: from localhost ([::1]:57702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRWV-0003bI-BR for importer@patchew.org; Wed, 01 Sep 2021 10:47:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMEB-0003W6-OK for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:15 -0400 Received: from relay.sw.ru ([185.231.240.75]:35418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OW-4d for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:15 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME0-000RwD-Jy; Wed, 01 Sep 2021 12:08:04 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=8jL/D0NXc6rwIFR0XUaMUKl6lsA78rRrWSZtWk/wHZc=; b=C+uyGfoKZpSE s1W5piALaSawLabp4SDc36FQk56L/RMq7CHqN0W+YiwJ5XD7gLUSpFJBMXBIhDoYZ5C6MKAB7mD4W wtdqUi3JfcScHWBpNVy6mUZUz5PmKCtkJg5fdPM4715gR3nBCeChjnleVyA94Abso1czXF68kpA9O XY1io=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 2/8] virtio: Add tracking of the common virtio guest features Date: Wed, 1 Sep 2021 12:07:58 +0300 Message-Id: <20210901090804.7139-3-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507654904100001 Content-Type: text/plain; charset="utf-8" It implements common virtio features via macros that, by defining the virtio guest feature bit and the virtio host feature bit, allow you to checks acknowledged virtio features by the guest. Signed-off-by: Maxim Davydov --- hw/virtio/virtio.c | 2 +- include/hw/virtio/virtio.h | 39 ++++++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 874377f..5f113c7 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3717,7 +3717,7 @@ static void virtio_device_instance_finalize(Object *o= bj) } =20 static Property virtio_properties[] =3D { - DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features), + DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features, guest_featu= res), DEFINE_PROP_BOOL("use-started", VirtIODevice, use_started, true), DEFINE_PROP_BOOL("use-disabled-flag", VirtIODevice, use_disabled_flag,= true), DEFINE_PROP_BOOL("x-disable-legacy-check", VirtIODevice, diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 8bab9cf..50f334c 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -277,19 +277,32 @@ typedef struct virtio_input_conf virtio_input_conf; typedef struct VirtIOSCSIConf VirtIOSCSIConf; typedef struct VirtIORNGConf VirtIORNGConf; =20 -#define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \ - DEFINE_PROP_BIT64("indirect_desc", _state, _field, \ - VIRTIO_RING_F_INDIRECT_DESC, true), \ - DEFINE_PROP_BIT64("event_idx", _state, _field, \ - VIRTIO_RING_F_EVENT_IDX, true), \ - DEFINE_PROP_BIT64("notify_on_empty", _state, _field, \ - VIRTIO_F_NOTIFY_ON_EMPTY, true), \ - DEFINE_PROP_BIT64("any_layout", _state, _field, \ - VIRTIO_F_ANY_LAYOUT, true), \ - DEFINE_PROP_BIT64("iommu_platform", _state, _field, \ - VIRTIO_F_IOMMU_PLATFORM, false), \ - DEFINE_PROP_BIT64("packed", _state, _field, \ - VIRTIO_F_RING_PACKED, false) +#define DEFINE_VIRTIO_FEATURE_BIT(_name, _state, _host_field, _guest_field= , \ + _bit, _defval) = \ + DEFINE_PROP_BIT(_name, _state, _host_field, _bit, _defval), = \ + DEFINE_PROP_READ_ONLY_BIT64("acknowledged_by_guest_" _name, _state, = \ + _guest_field, _bit) + +#define DEFINE_VIRTIO_FEATURE_BIT64(_name, _state, _host_field, _guest_fie= ld, \ + _bit, _defval) = \ + DEFINE_PROP_BIT64(_name, _state, _host_field, _bit, _defval), = \ + DEFINE_PROP_READ_ONLY_BIT64("acknowledged_by_guest_" _name, _state, = \ + _guest_field, _bit) + +#define DEFINE_VIRTIO_COMMON_FEATURES(_state, _host_field, _guest_field) = \ + DEFINE_VIRTIO_FEATURE_BIT64("indirect_desc", _state, _host_field, = \ + _guest_field, VIRTIO_RING_F_INDIRECT_DESC,= \ + true), = \ + DEFINE_VIRTIO_FEATURE_BIT64("event_idx", _state, _host_field, = \ + _guest_field, VIRTIO_RING_F_EVENT_IDX, tru= e), \ + DEFINE_VIRTIO_FEATURE_BIT64("notify_on_empty", _state, _host_field, = \ + _guest_field, VIRTIO_F_NOTIFY_ON_EMPTY, tr= ue), \ + DEFINE_VIRTIO_FEATURE_BIT64("any_layout", _state, _host_field, = \ + _guest_field, VIRTIO_F_ANY_LAYOUT, true), = \ + DEFINE_VIRTIO_FEATURE_BIT64("iommu_platform", _state, _host_field, = \ + _guest_field, VIRTIO_F_IOMMU_PLATFORM, fal= se), \ + DEFINE_VIRTIO_FEATURE_BIT64("packed", _state, _host_field, = \ + _guest_field, VIRTIO_F_RING_PACKED, false) =20 hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); bool virtio_queue_enabled_legacy(VirtIODevice *vdev, int n); --=20 1.8.3.1 From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507654; cv=none; d=zohomail.com; s=zohoarc; b=Eb3euoR8Rrrz+xJl8u3iQOQCVqjSk8TUzEB2xbLR+f2kq03LlSVGmPh+4hZRJUB2EoWiPb/vhRohFsMzTaLyeSMZh3XBkn+tL3JrWBe53yeKxNKhFLjPEaDB1Iokq9iGdCrQJ/3Sg64/O57q6KrQxufHeSV8mqTGSQEOxy1kK0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507654; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p7exzmm+x0dT94zKEcY/RTOBFrg0MFsOXkdGUbZDuoI=; b=YQiUGu7kmkTzZ/Zkeh5yY/d1DmQjWRde54NDiuJ2IoKxwPaE266PwqZ0JMK31AHhcF2/dhcJVDHMsS0/pOZz4HJ6d8GDzTCBgrB6jIMYdFs420bRqWlSU/fB+rTqy+Z8CgI0h8jLHZEXZ6ZNM8z5QLFzKvm2q7L5GCTVrSbcFsU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630507654678879.4536027479257; Wed, 1 Sep 2021 07:47:34 -0700 (PDT) Received: from localhost ([::1]:57978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRWX-0003o6-K2 for importer@patchew.org; Wed, 01 Sep 2021 10:47:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMEC-0003Wa-8d for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:16 -0400 Received: from relay.sw.ru ([185.231.240.75]:35414) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OT-5Q for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:15 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME0-000RwD-Lv; Wed, 01 Sep 2021 12:08:04 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=p7exzmm+x0dT94zKEcY/RTOBFrg0MFsOXkdGUbZDuoI=; b=eMo+Y337j3QN QeDi44tre3U4UtiBFZYxKWfxKFu+nkEBBCJ6j8jC6mK+DdjvrFdlWd/2aEZwUZRIwoNIbmiJcvnud 6z5yZNRa5SbvjIvbvoi4APqPljszXDf/Ma7ndxU2ufr3zupAoQ+YD+hCO2FI1rMu54ljysRRULUyl KsTR0=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 3/8] virtio-gpu: Add tracking of the virtio guest feature bits Date: Wed, 1 Sep 2021 12:07:59 +0300 Message-Id: <20210901090804.7139-4-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507655927100003 Content-Type: text/plain; charset="utf-8" Add tracking of the bits acknowledged by the guest Signed-off-by: Maxim Davydov --- hw/display/vhost-user-gpu.c | 3 ++- hw/display/virtio-gpu.c | 8 +++++--- include/hw/virtio/virtio-gpu.h | 10 +++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 49df56c..8248a70 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -566,7 +566,8 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error = **errp) } =20 static Property vhost_user_gpu_properties[] =3D { - VIRTIO_GPU_BASE_PROPERTIES(VhostUserGPU, parent_obj.conf), + VIRTIO_GPU_BASE_PROPERTIES(VhostUserGPU, parent_obj.conf, + parent_obj.parent_obj.guest_features), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 990e71f..a1c52ac 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1387,11 +1387,13 @@ static const VMStateDescription vmstate_virtio_gpu = =3D { }; =20 static Property virtio_gpu_properties[] =3D { - VIRTIO_GPU_BASE_PROPERTIES(VirtIOGPU, parent_obj.conf), + VIRTIO_GPU_BASE_PROPERTIES(VirtIOGPU, parent_obj.conf, + parent_obj.parent_obj.guest_features), DEFINE_PROP_SIZE("max_hostmem", VirtIOGPU, conf_max_hostmem, 256 * MiB), - DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags, - VIRTIO_GPU_FLAG_BLOB_ENABLED, false), + DEFINE_VIRTIO_FEATURE_BIT("blob", VirtIOGPU, parent_obj.conf.flags, + parent_obj.parent_obj.guest_features, + VIRTIO_GPU_FLAG_BLOB_ENABLED, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 24c6628..948ef69 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -143,11 +143,11 @@ struct VirtIOGPUBaseClass { void (*gl_flushed)(VirtIOGPUBase *g); }; =20 -#define VIRTIO_GPU_BASE_PROPERTIES(_state, _conf) \ - DEFINE_PROP_UINT32("max_outputs", _state, _conf.max_outputs, 1), \ - DEFINE_PROP_BIT("edid", _state, _conf.flags, \ - VIRTIO_GPU_FLAG_EDID_ENABLED, true), \ - DEFINE_PROP_UINT32("xres", _state, _conf.xres, 1024), \ +#define VIRTIO_GPU_BASE_PROPERTIES(_state, _conf, _guest_field) \ + DEFINE_PROP_UINT32("max_outputs", _state, _conf.max_outputs, 1), \ + DEFINE_VIRTIO_FEATURE_BIT("edid", _state, _conf.flags, _guest_field, \ + VIRTIO_GPU_FLAG_EDID_ENABLED, true), \ + DEFINE_PROP_UINT32("xres", _state, _conf.xres, 1024), \ DEFINE_PROP_UINT32("yres", _state, _conf.yres, 768) =20 typedef struct VGPUDMABuf { --=20 1.8.3.1 From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507562; cv=none; d=zohomail.com; s=zohoarc; b=CE6Sqb+ehTbz4fBLA+Wn0jDqKDmuNu97PegIe+aPRZCTLkE5bLVdstbW/maQFXpl6P8ps+Wigeh6l8MDnpMPiEau9mTRVMGhQYdIA7T2P84EQcKlOl51t15KbTD5/b1xhzipv7dtN2SIrjkghczt5pVkqieokD58V0i6p4oH1UY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507562; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5pJA9oGAe27FBZ4nSv7x8XsZMxFH8WYlk01sKS0/9bA=; b=DJ8+jnnr7qDW18HaqNFGkTNPOwgDL35m1KqGTmrprlhIevTFTTkTmKJYbloNkDsGXURcLaryo69SGNOPi3aXbJnarylJoZxFnPQo5nJyH9o1DeXDoE+lBisAmnhJD4sqvU1J9Vvpt0HDQyutUsuSr9nY643kRxco/3q/oTxXRyw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630507561484497.6124782273703; Wed, 1 Sep 2021 07:46:01 -0700 (PDT) Received: from localhost ([::1]:52506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRV0-0008NQ-Ot for importer@patchew.org; Wed, 01 Sep 2021 10:45:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMEA-0003V5-OP for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:14 -0400 Received: from relay.sw.ru ([185.231.240.75]:35402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OZ-3v for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:14 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME0-000RwD-Nt; Wed, 01 Sep 2021 12:08:04 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=5pJA9oGAe27FBZ4nSv7x8XsZMxFH8WYlk01sKS0/9bA=; b=rwxIrtoYGPFK lm/y3etCqbw9oBOJF65Nns7XSKNPrpWhThCxti00TkIbGrRFZulN5tcq8TYRAXFblhOXQHLE8gVt/ zA1J2ZcIegOaaNtDcca0bxCheaxueNsEC/AAy2eFnpWXWVub/WYVoAGJ9HpI2FH1ZYmaW33YUL3SC 0IvYI=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 4/8] virtio-serial: Add tracking of the virtio guest feature bits Date: Wed, 1 Sep 2021 12:08:00 +0300 Message-Id: <20210901090804.7139-5-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507566267100001 Content-Type: text/plain; charset="utf-8" Add tracking of the VIRTIO_CONSOLE_F_EMERG_WRITE acknowledged by the guest. Signed-off-by: Maxim Davydov --- hw/char/virtio-serial-bus.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index dd6bc27..b5f9f42 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -1159,8 +1159,9 @@ static const VMStateDescription vmstate_virtio_consol= e =3D { static Property virtio_serial_properties[] =3D { DEFINE_PROP_UINT32("max_ports", VirtIOSerial, serial.max_virtserial_po= rts, 31), - DEFINE_PROP_BIT64("emergency-write", VirtIOSerial, host_features, - VIRTIO_CONSOLE_F_EMERG_WRITE, true), + DEFINE_VIRTIO_FEATURE_BIT64("emergency-write", VirtIOSerial, host_feat= ures, + parent_obj.guest_features, + VIRTIO_CONSOLE_F_EMERG_WRITE, true), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 1.8.3.1 From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507863; cv=none; d=zohomail.com; s=zohoarc; b=baaYsDtvO7/oFq6kYuFqL7NaDHHv2cVS+YpLClGfvVVbxXkP8LuI+qCgPvwkUV5HNREtrJ4IAPH4DnaJIlQZ3FFrrzW3V5QMYBpppNJG3T6uyoNjRqfvfwEk70HTrMrHYZMT/WfPSwbgElGJJC2Ee2u7y6FaDZCNTGfO1ZpIqV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507863; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LSZ2mWxs6D+YSxZ59e5bSlrlDZ4hklNR2402ethUa10=; b=hKLC70GTyKdXzM0qmrgcEoDus5SJohb587rBPRVd1yfhBLM8UfzJ1PdYhHl+TJQa55G9RopN6DpbP0UogKGehGFKri7cIC5GQ37KsJqF5+p7QMFXkth0I6p5VmYt0L4acdsF0Lu1rjSnOaFPTpyfIL2tDMAwdPQ0HmhxyUZwb84= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163050786374735.15388384450159; Wed, 1 Sep 2021 07:51:03 -0700 (PDT) Received: from localhost ([::1]:39918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRZu-0002PD-Bl for importer@patchew.org; Wed, 01 Sep 2021 10:51:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMEF-0003bJ-Ok for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:19 -0400 Received: from relay.sw.ru ([185.231.240.75]:35412) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OS-1I for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:19 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME0-000RwD-RB; Wed, 01 Sep 2021 12:08:04 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=LSZ2mWxs6D+YSxZ59e5bSlrlDZ4hklNR2402ethUa10=; b=MOxGKQLMhWEN vPujW2DpaNQala/TtADUYZBaxd3WQIWy1Y4Ge54mLIL1jD/bHfv1JM0yHlzsjdDA4INZzjjgaMPDh h/u4WXokLHg8YJE21kzP0Y4t1/5aE7IKwSNf434u5giWPUT72ZvGswn+p5vu/x9iYbDsz9ecUAp9F rpTaA=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 5/8] virtio-net: Add tracking of the virtio guest feature bits Date: Wed, 1 Sep 2021 12:08:01 +0300 Message-Id: <20210901090804.7139-6-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507864177100001 Content-Type: text/plain; charset="utf-8" Add tracking of the bits acknowledged by the guest Signed-off-by: Maxim Davydov --- hw/net/virtio-net.c | 118 ++++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 72 insertions(+), 46 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 16d20cd..2fd9171 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3562,52 +3562,78 @@ static const VMStateDescription vmstate_virtio_net = =3D { }; =20 static Property virtio_net_properties[] =3D { - DEFINE_PROP_BIT64("csum", VirtIONet, host_features, - VIRTIO_NET_F_CSUM, true), - DEFINE_PROP_BIT64("guest_csum", VirtIONet, host_features, - VIRTIO_NET_F_GUEST_CSUM, true), - DEFINE_PROP_BIT64("gso", VirtIONet, host_features, VIRTIO_NET_F_GSO, t= rue), - DEFINE_PROP_BIT64("guest_tso4", VirtIONet, host_features, - VIRTIO_NET_F_GUEST_TSO4, true), - DEFINE_PROP_BIT64("guest_tso6", VirtIONet, host_features, - VIRTIO_NET_F_GUEST_TSO6, true), - DEFINE_PROP_BIT64("guest_ecn", VirtIONet, host_features, - VIRTIO_NET_F_GUEST_ECN, true), - DEFINE_PROP_BIT64("guest_ufo", VirtIONet, host_features, - VIRTIO_NET_F_GUEST_UFO, true), - DEFINE_PROP_BIT64("guest_announce", VirtIONet, host_features, - VIRTIO_NET_F_GUEST_ANNOUNCE, true), - DEFINE_PROP_BIT64("host_tso4", VirtIONet, host_features, - VIRTIO_NET_F_HOST_TSO4, true), - DEFINE_PROP_BIT64("host_tso6", VirtIONet, host_features, - VIRTIO_NET_F_HOST_TSO6, true), - DEFINE_PROP_BIT64("host_ecn", VirtIONet, host_features, - VIRTIO_NET_F_HOST_ECN, true), - DEFINE_PROP_BIT64("host_ufo", VirtIONet, host_features, - VIRTIO_NET_F_HOST_UFO, true), - DEFINE_PROP_BIT64("mrg_rxbuf", VirtIONet, host_features, - VIRTIO_NET_F_MRG_RXBUF, true), - DEFINE_PROP_BIT64("status", VirtIONet, host_features, - VIRTIO_NET_F_STATUS, true), - DEFINE_PROP_BIT64("ctrl_vq", VirtIONet, host_features, - VIRTIO_NET_F_CTRL_VQ, true), - DEFINE_PROP_BIT64("ctrl_rx", VirtIONet, host_features, - VIRTIO_NET_F_CTRL_RX, true), - DEFINE_PROP_BIT64("ctrl_vlan", VirtIONet, host_features, - VIRTIO_NET_F_CTRL_VLAN, true), - DEFINE_PROP_BIT64("ctrl_rx_extra", VirtIONet, host_features, - VIRTIO_NET_F_CTRL_RX_EXTRA, true), - DEFINE_PROP_BIT64("ctrl_mac_addr", VirtIONet, host_features, - VIRTIO_NET_F_CTRL_MAC_ADDR, true), - DEFINE_PROP_BIT64("ctrl_guest_offloads", VirtIONet, host_features, - VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, true), - DEFINE_PROP_BIT64("mq", VirtIONet, host_features, VIRTIO_NET_F_MQ, fal= se), - DEFINE_PROP_BIT64("rss", VirtIONet, host_features, - VIRTIO_NET_F_RSS, false), - DEFINE_PROP_BIT64("hash", VirtIONet, host_features, - VIRTIO_NET_F_HASH_REPORT, false), - DEFINE_PROP_BIT64("guest_rsc_ext", VirtIONet, host_features, - VIRTIO_NET_F_RSC_EXT, false), + DEFINE_VIRTIO_FEATURE_BIT64("csum", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_CSUM, true), + DEFINE_VIRTIO_FEATURE_BIT64("guest_csum", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_GUEST_CSUM, true), + DEFINE_VIRTIO_FEATURE_BIT64("gso", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_GSO, true), + DEFINE_VIRTIO_FEATURE_BIT64("guest_tso4", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_GUEST_TSO4, true), + DEFINE_VIRTIO_FEATURE_BIT64("guest_tso6", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_GUEST_TSO6, true), + DEFINE_VIRTIO_FEATURE_BIT64("guest_ecn", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_GUEST_ECN, true), + DEFINE_VIRTIO_FEATURE_BIT64("guest_ufo", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_GUEST_UFO, true), + DEFINE_VIRTIO_FEATURE_BIT64("guest_announce", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_GUEST_ANNOUNCE, true), + DEFINE_VIRTIO_FEATURE_BIT64("host_tso4", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_HOST_TSO4, true), + DEFINE_VIRTIO_FEATURE_BIT64("host_tso6", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_HOST_TSO6, true), + DEFINE_VIRTIO_FEATURE_BIT64("host_ecn", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_HOST_ECN, true), + DEFINE_VIRTIO_FEATURE_BIT64("host_ufo", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_HOST_UFO, true), + DEFINE_VIRTIO_FEATURE_BIT64("mrg_rxbuf", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_MRG_RXBUF, true), + DEFINE_VIRTIO_FEATURE_BIT64("status", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_STATUS, true), + DEFINE_VIRTIO_FEATURE_BIT64("ctrl_vq", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_CTRL_VQ, true), + DEFINE_VIRTIO_FEATURE_BIT64("ctrl_rx", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_CTRL_RX, true), + DEFINE_VIRTIO_FEATURE_BIT64("ctrl_vlan", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_CTRL_VLAN, true), + DEFINE_VIRTIO_FEATURE_BIT64("ctrl_rx_extra", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_CTRL_RX_EXTRA, true), + DEFINE_VIRTIO_FEATURE_BIT64("ctrl_mac_addr", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_CTRL_MAC_ADDR, true), + DEFINE_VIRTIO_FEATURE_BIT64("ctrl_guest_offloads", VirtIONet, host_fea= tures, + parent_obj.guest_features, + VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, true), + DEFINE_VIRTIO_FEATURE_BIT64("mq", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_MQ, false), + DEFINE_VIRTIO_FEATURE_BIT64("rss", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_RSS, false), + DEFINE_VIRTIO_FEATURE_BIT64("hash", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_HASH_REPORT, false), + DEFINE_VIRTIO_FEATURE_BIT64("guest_rsc_ext", VirtIONet, host_features, + parent_obj.guest_features, + VIRTIO_NET_F_RSC_EXT, false), DEFINE_PROP_UINT32("rsc_interval", VirtIONet, rsc_timeout, VIRTIO_NET_RSC_DEFAULT_INTERVAL), DEFINE_NIC_PROPERTIES(VirtIONet, nic_conf), --=20 1.8.3.1 From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507818; cv=none; d=zohomail.com; s=zohoarc; b=YELE21kfiwX2GIgET9xoVmy0/slQwZMw+qIoI4D/8GP+UAWDKcOQI7jD5mCNS+34NV9BQa5DMI3lNFHxqPkKX8B+qWeKVmiUwxLqoR147i1Iy+r91x45qnVZHWb/P7anqZH9T5quJoimMwdKntiBkGSwF3RXX3N/RnG5aQd98z4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507818; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5VSyo9u1as5v2w8EoWPqVnnzXFcNIWYd4SGEqLo2lYo=; b=by+AV29zVSe6xzEX6jebWPppnrdvAdSMzyuiuXNZEvVyz0HRbZ5qKLFbbbMOyUg8u7qdJWqeD0/G7FiP6ONja2w3PTBybddVD3Wt1oH20NqLqodnq1KqI/7b30HsioooAgLC5pv9uJit34uEgQjosx2CM2VHPRTY1cN2/5Q7XD8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630507818974595.0834117054321; Wed, 1 Sep 2021 07:50:18 -0700 (PDT) Received: from localhost ([::1]:37518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRZB-0000gS-UP for importer@patchew.org; Wed, 01 Sep 2021 10:50:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMEE-0003Zo-KY for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:18 -0400 Received: from relay.sw.ru ([185.231.240.75]:35396) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OV-5U for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:18 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME0-000RwD-TB; Wed, 01 Sep 2021 12:08:04 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=5VSyo9u1as5v2w8EoWPqVnnzXFcNIWYd4SGEqLo2lYo=; b=s70xStYQPV9z wbR6d9Anr+ufJyVchI6YRZ4UwYsHkvTR/Jn6DWtThhIjGur4q+qsVmrh9IqTwg10fcSRngdv9PnCy Z1yRbC4RKLT5ESuajMCGrtkLktj/xo948pcNPMSWwO9Rk8rPHSZQBh/eVjQlKiK8DIxdjBcYnFnif I0V8U=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 6/8] scsi: Add tracking of the acknowledged feature bits Date: Wed, 1 Sep 2021 12:08:02 +0300 Message-Id: <20210901090804.7139-7-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507821121100001 Content-Type: text/plain; charset="utf-8" Add tracking of the VIRTIO_SCSI_F_HOTPLUG, VIRTIO_SCSI_F_CHANGE and VIRTIO_SCSI_F_T10_PI bits acknowledged by the guest Signed-off-by: Maxim Davydov --- hw/scsi/vhost-scsi.c | 6 +++--- hw/scsi/vhost-user-scsi.c | 18 +++++++++--------- hw/scsi/virtio-scsi.c | 10 ++++++---- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 8c611bf..4530295 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -277,9 +277,9 @@ static Property vhost_scsi_properties[] =3D { DEFINE_PROP_UINT32("max_sectors", VirtIOSCSICommon, conf.max_sectors, 0xFFFF), DEFINE_PROP_UINT32("cmd_per_lun", VirtIOSCSICommon, conf.cmd_per_lun, = 128), - DEFINE_PROP_BIT64("t10_pi", VHostSCSICommon, host_features, - VIRTIO_SCSI_F_T10_PI, - false), + DEFINE_VIRTIO_FEATURE_BIT64("t10_pi", VHostSCSICommon, + host_features, dev.acked_features, + VIRTIO_SCSI_F_T10_PI, false), DEFINE_PROP_BOOL("migratable", VHostSCSICommon, migratable, false), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index 1b2f7ee..40f885d 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -168,15 +168,15 @@ static Property vhost_user_scsi_properties[] =3D { DEFINE_PROP_UINT32("max_sectors", VirtIOSCSICommon, conf.max_sectors, 0xFFFF), DEFINE_PROP_UINT32("cmd_per_lun", VirtIOSCSICommon, conf.cmd_per_lun, = 128), - DEFINE_PROP_BIT64("hotplug", VHostSCSICommon, host_features, - VIRTIO_SCSI_F_HOTPLUG, - true), - DEFINE_PROP_BIT64("param_change", VHostSCSICommon, host_features, - VIRTIO_SCSI_F_CHANG= E, - true), - DEFINE_PROP_BIT64("t10_pi", VHostSCSICommon, host_features, - VIRTIO_SCSI_F_T10_PI, - false), + DEFINE_VIRTIO_FEATURE_BIT64("hotplug", VHostSCSICommon, + host_features, dev.acked_features, + VIRTIO_SCSI_F_HOTPLUG, true), + DEFINE_VIRTIO_FEATURE_BIT64("param_change", VHostSCSICommon, + host_features, dev.acked_features, + VIRTIO_SCSI_F_CHANGE, true), + DEFINE_VIRTIO_FEATURE_BIT64("t10_pi", VHostSCSICommon, + host_features, dev.acked_features, + VIRTIO_SCSI_F_T10_PI, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 6d80730..8f7dd14 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -1061,10 +1061,12 @@ static Property virtio_scsi_properties[] =3D { 0xFFFF), DEFINE_PROP_UINT32("cmd_per_lun", VirtIOSCSI, parent_obj.conf.cmd_per_= lun, 128), - DEFINE_PROP_BIT("hotplug", VirtIOSCSI, host_features, - VIRTIO_SCSI_F_HOTPLUG, true), - DEFINE_PROP_BIT("param_change", VirtIOSCSI, host_features, - VIRTIO_SCSI_F_CHANGE, true= ), + DEFINE_VIRTIO_FEATURE_BIT("hotplug", VirtIOSCSI, host_features, + parent_obj.parent_obj.guest_features, + VIRTIO_SCSI_F_HOTPLUG, true), + DEFINE_VIRTIO_FEATURE_BIT("param_change", VirtIOSCSI, host_features, + parent_obj.parent_obj.guest_features, + VIRTIO_SCSI_F_CHANGE, true), DEFINE_PROP_LINK("iothread", VirtIOSCSI, parent_obj.conf.iothread, TYPE_IOTHREAD, IOThread *), DEFINE_PROP_END_OF_LIST(), --=20 1.8.3.1 From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507931; cv=none; d=zohomail.com; s=zohoarc; b=IqT5u7Rfu0te2YF4Lc2z/lGjb/bgon0/u3kErnACwwEUPo/SyAHHc9Pc+TfIYufXnap5mMjVub+VuFa12j5AGEM4gkKe+Edl4ti7Q4C3V61+nMRSU6HL+UsYfFBY+pbVPhISEU+oynLN5bkvJDEjj7xvABGS7IXkYNETkorghqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507931; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nPiacBrr0uQwTXUm0yfQaTlAPSncgQfKpOtV272sm0A=; b=GLvwuDedr+txX3XgRcjIPYxwaAhxyJGQvOa4DJR0B5+rH0XpCP1F3ezkpZksAQI3K3ZZLdnj82mzoHEMoP3+KEaLDikTYpjGPSPFPVoCZP/5qtfSddZtrFwhXNf4nxfaIcfSOD2gNjjqNaKxQkNnz1RrNSHDB0319OchtJbT6v4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1630507931737391.29004330678777; Wed, 1 Sep 2021 07:52:11 -0700 (PDT) Received: from localhost ([::1]:42764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRb0-0004MN-Ig for importer@patchew.org; Wed, 01 Sep 2021 10:52:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMEG-0003c7-5o for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:20 -0400 Received: from relay.sw.ru ([185.231.240.75]:35398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OY-Fe for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:19 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME1-000RwD-5b; Wed, 01 Sep 2021 12:08:05 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=nPiacBrr0uQwTXUm0yfQaTlAPSncgQfKpOtV272sm0A=; b=oH71fPcD2UV1 nK0SN3XBPYrE0+0NrAaUEB4BaP5RtyTC9PfvWY7xtDrwPedacNLvf/lmGzA33BTkX+ZOEtmw96Hdk RCTe5v/XPG1WsScrdD6I7073D3oeL+STo/+0mgRHT/wbAJZDhEiRYp1VmHOONKbp7GBNXz+mRP+5f gOa6k=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 7/8] virtio-blk: Add tracking of the virtio guest feature bits Date: Wed, 1 Sep 2021 12:08:03 +0300 Message-Id: <20210901090804.7139-8-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507933089100001 Content-Type: text/plain; charset="utf-8" Add tracking of the bits acknowledged by the guests Signed-off-by: Maxim Davydov --- hw/block/virtio-blk.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index f139cd7..552b86c 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1287,11 +1287,13 @@ static Property virtio_blk_properties[] =3D { DEFINE_BLOCK_ERROR_PROPERTIES(VirtIOBlock, conf.conf), DEFINE_BLOCK_CHS_PROPERTIES(VirtIOBlock, conf.conf), DEFINE_PROP_STRING("serial", VirtIOBlock, conf.serial), - DEFINE_PROP_BIT64("config-wce", VirtIOBlock, host_features, - VIRTIO_BLK_F_CONFIG_WCE, true), + DEFINE_VIRTIO_FEATURE_BIT64("config-wce", VirtIOBlock, host_features, + parent_obj.guest_features, + VIRTIO_BLK_F_CONFIG_WCE, true), #ifdef __linux__ - DEFINE_PROP_BIT64("scsi", VirtIOBlock, host_features, - VIRTIO_BLK_F_SCSI, false), + DEFINE_VIRTIO_FEATURE_BIT64("scsi", VirtIOBlock, host_features, + parent_obj.guest_features, + VIRTIO_BLK_F_SCSI, false), #endif DEFINE_PROP_BIT("request-merging", VirtIOBlock, conf.request_merging, = 0, true), @@ -1301,12 +1303,14 @@ static Property virtio_blk_properties[] =3D { DEFINE_PROP_BOOL("seg-max-adjust", VirtIOBlock, conf.seg_max_adjust, t= rue), DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD, IOThread *), - DEFINE_PROP_BIT64("discard", VirtIOBlock, host_features, - VIRTIO_BLK_F_DISCARD, true), + DEFINE_VIRTIO_FEATURE_BIT64("discard", VirtIOBlock, host_features, + parent_obj.guest_features, + VIRTIO_BLK_F_DISCARD, true), DEFINE_PROP_BOOL("report-discard-granularity", VirtIOBlock, conf.report_discard_granularity, true), - DEFINE_PROP_BIT64("write-zeroes", VirtIOBlock, host_features, - VIRTIO_BLK_F_WRITE_ZEROES, true), + DEFINE_VIRTIO_FEATURE_BIT64("write-zeroes", VirtIOBlock, host_features, + parent_obj.guest_features, + VIRTIO_BLK_F_WRITE_ZEROES, true), DEFINE_PROP_UINT32("max-discard-sectors", VirtIOBlock, conf.max_discard_sectors, BDRV_REQUEST_MAX_SECTORS), DEFINE_PROP_UINT32("max-write-zeroes-sectors", VirtIOBlock, --=20 1.8.3.1 From nobody Sat May 4 14:41:47 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1630507483; cv=none; d=zohomail.com; s=zohoarc; b=Mibd/+bE9EohNjpNvWFF65Q2si2hWfDEe1KjxyMu9184GMtTxUJWJkTioTaPHaXZ6n/Eecq7s9NvVb01vgfhh/yolHTaaBwg9GtCt0LYarFuNYPSYhujN9k4wWi2zbaKp4xTcqk3wWMhtXLRvQM722UmEZrzdd58XY1oYgZh6vo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630507483; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c3dOGEHsnOZpdJ7FWaBjC7ETDtLHO0PC4IyBH1MkttQ=; b=PA3sKhqKA/1UoHjUx9wCM1AoLmWbrZo1kdz7OBPowD59bCiT2OuEvPkRfQNpG7PCHP4Fo3s6eNvDnLCatgayjvVUHMPoJAOQDOT35d5BRzdSmcGZ7xkRvvaBgde5TIrB8Moy2k9zSUM0jnS/ICvIOJwPDruxBx6cia/UplN8QX0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163050748372023.47386900836227; Wed, 1 Sep 2021 07:44:43 -0700 (PDT) Received: from localhost ([::1]:49146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRTm-00067T-N9 for importer@patchew.org; Wed, 01 Sep 2021 10:44:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLMEB-0003W5-O2 for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:15 -0400 Received: from relay.sw.ru ([185.231.240.75]:35400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLME6-0005OU-1M for qemu-devel@nongnu.org; Wed, 01 Sep 2021 05:08:15 -0400 Received: from [192.168.15.100] (helo=max-Swift-SF314-57.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1mLME1-000RwD-7b; Wed, 01 Sep 2021 12:08:05 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-Id:Date:Subject:From: Content-Type; bh=c3dOGEHsnOZpdJ7FWaBjC7ETDtLHO0PC4IyBH1MkttQ=; b=F2Mbn00vbbKr yr1En0kxKKe0CsZ0M6zKjTI5OrsGDIswVuoCki85GArYuc/Nf0uljxyZK83OdXSuL1DunsoT+gxFl bFPd57rJtlMuAz/2yDN0oK85iAQ52Xeipr7lkmC4aaCZJEZJKlcEE0ya9XlB7sz56CR7rl8V/tek0 qDd0k=; From: Maxim Davydov To: qemu-devel@nongnu.org Cc: den@openvz.org, mst@redhat.com, stefanha@redhat.com, fam@euphon.net, amit@kernel.org, kraxel@redhat.com, berrange@redhat.com, Maxim Davydov Subject: [PATCH v1 8/8] virtio-balloon: Add tracking of the virtio guest feature bits Date: Wed, 1 Sep 2021 12:08:04 +0300 Message-Id: <20210901090804.7139-9-maxim.davydov@virtuozzo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> References: <20210901090804.7139-1-maxim.davydov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.231.240.75; envelope-from=maxim.davydov@virtuozzo.com; helo=relay.sw.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 01 Sep 2021 10:43:12 -0400 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1630507485529100003 Content-Type: text/plain; charset="utf-8" Add tracking of the bits acknowledged by the guest Signed-off-by: Maxim Davydov --- hw/virtio/virtio-balloon.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 4b5d9e5..61575b7 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -1029,14 +1029,18 @@ static const VMStateDescription vmstate_virtio_ball= oon =3D { }; =20 static Property virtio_balloon_properties[] =3D { - DEFINE_PROP_BIT("deflate-on-oom", VirtIOBalloon, host_features, - VIRTIO_BALLOON_F_DEFLATE_ON_OOM, false), - DEFINE_PROP_BIT("free-page-hint", VirtIOBalloon, host_features, - VIRTIO_BALLOON_F_FREE_PAGE_HINT, false), - DEFINE_PROP_BIT("page-poison", VirtIOBalloon, host_features, - VIRTIO_BALLOON_F_PAGE_POISON, true), - DEFINE_PROP_BIT("free-page-reporting", VirtIOBalloon, host_features, - VIRTIO_BALLOON_F_REPORTING, false), + DEFINE_VIRTIO_FEATURE_BIT("deflate-on-oom", VirtIOBalloon, host_featur= es, + parent_obj.guest_features, + VIRTIO_BALLOON_F_DEFLATE_ON_OOM, false), + DEFINE_VIRTIO_FEATURE_BIT("free-page-hint", VirtIOBalloon, host_featur= es, + parent_obj.guest_features, + VIRTIO_BALLOON_F_FREE_PAGE_HINT, false), + DEFINE_VIRTIO_FEATURE_BIT("page-poison", VirtIOBalloon, host_features, + parent_obj.guest_features, + VIRTIO_BALLOON_F_PAGE_POISON, true), + DEFINE_VIRTIO_FEATURE_BIT("free-page-reporting", VirtIOBalloon, + host_features, parent_obj.guest_features, + VIRTIO_BALLOON_F_REPORTING, false), /* QEMU 4.0 accidentally changed the config size even when free-page-h= int * is disabled, resulting in QEMU 3.1 migration incompatibility. This * property retains this quirk for QEMU 4.1 machine types. --=20 1.8.3.1