From patchwork Wed Sep 1 09:07:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=ZWbWspGa; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06NN6lX7z9sX3 for ; Thu, 2 Sep 2021 00:47:32 +1000 (AEST) Received: from localhost ([::1]:56844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRWU-0002zg-Nz for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:47:30 -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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 = { .set_default_value = set_default_value_bool, }; +/* 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 == &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 = opaque; + uint64_t *p = object_field_prop_ptr(obj, prop); + bool value = (*p & qdev_get_prop_read_only_mask64(prop)) != 0; + + visit_type_bool(v, name, &value, errp); +} + +const PropertyInfo qdev_prop_read_only_bit64 = { + .name = "bool", + .description = "on/off", + .get = prop_get_read_only_bit64, + .set = prop_set_read_only_bit64, + .set_default_value = set_default_value_bool, +}; + /* --- bool --- */ static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque, 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 { 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 = true, \ .defval.u = (bool)_defval) +#define DEFINE_PROP_READ_ONLY_BIT64(_name, _state, _field, _bit) \ + DEFINE_PROP(_name, _state, _field, qdev_prop_read_only_bit64, uint64_t, \ + .bitnr = (_bit)) + #define PROP_ARRAY_LEN_PREFIX "len-" /** From patchwork Wed Sep 1 09:07:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=C+uyGfoK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06MB1Lw1z9sW8 for ; Thu, 2 Sep 2021 00:46:30 +1000 (AEST) Received: from localhost ([::1]:53584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRVT-0000gw-Ry for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:46:27 -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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 *obj) } static Property virtio_properties[] = { - DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features), + DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features, guest_features), 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; -#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_field, \ + _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, true), \ + DEFINE_VIRTIO_FEATURE_BIT64("notify_on_empty", _state, _host_field, \ + _guest_field, VIRTIO_F_NOTIFY_ON_EMPTY, true), \ + 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, false), \ + DEFINE_VIRTIO_FEATURE_BIT64("packed", _state, _host_field, \ + _guest_field, VIRTIO_F_RING_PACKED, false) hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); bool virtio_queue_enabled_legacy(VirtIODevice *vdev, int n); From patchwork Wed Sep 1 09:07:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=eMo+Y337; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06MG5vDwz9sXk for ; Thu, 2 Sep 2021 00:46:34 +1000 (AEST) Received: from localhost ([::1]:54024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRVY-0000zW-I8 for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:46:32 -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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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) } static Property vhost_user_gpu_properties[] = { - 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(), }; 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 = { }; static Property virtio_gpu_properties[] = { - 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(), }; 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); }; -#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) typedef struct VGPUDMABuf { From patchwork Wed Sep 1 09:08:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523172 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=rwxIrtoY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06K84z45z9sW8 for ; Thu, 2 Sep 2021 00:44:44 +1000 (AEST) Received: from localhost ([::1]:48582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRTm-0005kv-Fo for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:44:42 -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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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_console = { static Property virtio_serial_properties[] = { DEFINE_PROP_UINT32("max_ports", VirtIOSerial, serial.max_virtserial_ports, 31), - DEFINE_PROP_BIT64("emergency-write", VirtIOSerial, host_features, - VIRTIO_CONSOLE_F_EMERG_WRITE, true), + DEFINE_VIRTIO_FEATURE_BIT64("emergency-write", VirtIOSerial, host_features, + parent_obj.guest_features, + VIRTIO_CONSOLE_F_EMERG_WRITE, true), DEFINE_PROP_END_OF_LIST(), }; From patchwork Wed Sep 1 09:08:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523178 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=MOxGKQLM; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06RK4BNZz9sW8 for ; Thu, 2 Sep 2021 00:50:05 +1000 (AEST) Received: from localhost ([::1]:36452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRYw-0008ND-RU for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:50: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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 = { }; static Property virtio_net_properties[] = { - 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, true), - 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, false), - 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_features, + 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), From patchwork Wed Sep 1 09:08:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523177 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=s70xStYQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06Q21GV4z9sX3 for ; Thu, 2 Sep 2021 00:48:58 +1000 (AEST) Received: from localhost ([::1]:33738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRXr-0006VJ-VD for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:48:55 -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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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[] = { 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[] = { 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_CHANGE, - 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(), }; 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[] = { 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(), From patchwork Wed Sep 1 09:08:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523179 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=oH71fPcD; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06Sy4Rhyz9sW8 for ; Thu, 2 Sep 2021 00:51:30 +1000 (AEST) Received: from localhost ([::1]:40860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRaK-000342-E5 for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:51:28 -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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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[] = { 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[] = { DEFINE_PROP_BOOL("seg-max-adjust", VirtIOBlock, conf.seg_max_adjust, true), 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, From patchwork Wed Sep 1 09:08:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Davydov X-Patchwork-Id: 1523170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=relay header.b=F2Mbn00v; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 ozlabs.org (Postfix) with ESMTPS id 4H06JL4QkTz9sX3 for ; Thu, 2 Sep 2021 00:44:02 +1000 (AEST) Received: from localhost ([::1]:45134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLRT6-0003MC-Cy for incoming@patchwork.ozlabs.org; Wed, 01 Sep 2021 10:44:00 -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 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=; 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 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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_balloon = { }; static Property virtio_balloon_properties[] = { - 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_features, + parent_obj.guest_features, + VIRTIO_BALLOON_F_DEFLATE_ON_OOM, false), + DEFINE_VIRTIO_FEATURE_BIT("free-page-hint", VirtIOBalloon, host_features, + 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-hint * is disabled, resulting in QEMU 3.1 migration incompatibility. This * property retains this quirk for QEMU 4.1 machine types.