qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 4/4] virtio: Convert feature properties to OnOffAuto


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v4 4/4] virtio: Convert feature properties to OnOffAuto
Date: Thu, 9 Jan 2025 11:56:12 +0100
User-agent: Mozilla Thunderbird

On 8/1/25 07:17, Akihiko Odaki wrote:
Some features are not always available with vhost. Legacy features are
not available with vp_vdpa in particular. virtio devices used to disable
them when not available even if the corresponding properties were
explicitly set to "on".

QEMU already has OnOffAuto type, which includes the "auto" value to let
it automatically decide the effective value. Convert feature properties
to OnOffAuto and set them "auto" by default to utilize it. This allows
QEMU to report an error if they are set "on" and the corresponding
features are not available.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
  include/hw/virtio/virtio.h | 38 +++++++++++++++++++++-----------------
  hw/core/machine.c          |  4 +++-
  hw/virtio/virtio-bus.c     | 14 ++++++++++++--
  hw/virtio/virtio.c         |  4 +++-
  4 files changed, 39 insertions(+), 21 deletions(-)


diff --git a/hw/core/machine.c b/hw/core/machine.c
index c949af97668d..bff26b95dd74 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -36,7 +36,9 @@
  #include "hw/virtio/virtio-iommu.h"
  #include "audio/audio.h"
-GlobalProperty hw_compat_9_2[] = {};
+GlobalProperty hw_compat_9_2[] = {
+    { TYPE_VIRTIO_DEVICE, "x-force-features-auto", "on" },
+};
  const size_t hw_compat_9_2_len = G_N_ELEMENTS(hw_compat_9_2);


diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 85110bce3744..83f803fc703d 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -4013,11 +4013,13 @@ static void virtio_device_instance_finalize(Object *obj)
  }
static const Property virtio_properties[] = {
-    DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, host_features),
+    DEFINE_VIRTIO_COMMON_FEATURES(VirtIODevice, requested_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,
                       disable_legacy_check, false),
+    DEFINE_PROP_BOOL("x-force-features-auto", VirtIODevice,
+                     force_features_auto, false),

This doesn't seem an experiment, so can we not use the 'x-' prefix?

  };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]