qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vhost-user-fs: fix features handling
@ 2021-04-08 19:55 Anton Kuchin
  2021-04-09 15:56 ` [Virtio-fs] " Vivek Goyal
  2021-04-13  8:47 ` Stefan Hajnoczi
  0 siblings, 2 replies; 9+ messages in thread
From: Anton Kuchin @ 2021-04-08 19:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: virtio-fs, Anton Kuchin, Dr. David Alan Gilbert, Stefan Hajnoczi,
	Michael S. Tsirkin

Make virtio-fs take into account server capabilities.

Just returning requested features assumes they all of then are implemented
by server and results in setting unsupported configuration if some of them
are absent.

Signed-off-by: Anton Kuchin <antonkuchin@yandex-team.ru>
---
 hw/virtio/vhost-user-fs.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c
index ac4fc34b36..6cf983ba0e 100644
--- a/hw/virtio/vhost-user-fs.c
+++ b/hw/virtio/vhost-user-fs.c
@@ -24,6 +24,14 @@
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
 
+static const int user_feature_bits[] = {
+    VIRTIO_F_VERSION_1,
+    VIRTIO_RING_F_INDIRECT_DESC,
+    VIRTIO_RING_F_EVENT_IDX,
+    VIRTIO_F_NOTIFY_ON_EMPTY,
+    VHOST_INVALID_FEATURE_BIT
+};
+
 static void vuf_get_config(VirtIODevice *vdev, uint8_t *config)
 {
     VHostUserFS *fs = VHOST_USER_FS(vdev);
@@ -129,11 +137,12 @@ static void vuf_set_status(VirtIODevice *vdev, uint8_t status)
 }
 
 static uint64_t vuf_get_features(VirtIODevice *vdev,
-                                      uint64_t requested_features,
-                                      Error **errp)
+                                 uint64_t features,
+                                 Error **errp)
 {
-    /* No feature bits used yet */
-    return requested_features;
+    VHostUserFS *fs = VHOST_USER_FS(vdev);
+
+    return vhost_get_features(&fs->vhost_dev, user_feature_bits, features);
 }
 
 static void vuf_handle_output(VirtIODevice *vdev, VirtQueue *vq)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-04-14  8:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 19:55 [PATCH] vhost-user-fs: fix features handling Anton Kuchin
2021-04-09 15:56 ` [Virtio-fs] " Vivek Goyal
2021-04-11  6:21   ` Anton Kuchin
2021-04-12 18:43     ` Vivek Goyal
2021-04-13  8:53       ` Stefan Hajnoczi
2021-04-13  8:47 ` Stefan Hajnoczi
2021-04-13 11:36   ` Dr. David Alan Gilbert
2021-04-13 13:35   ` [Virtio-fs] " Vivek Goyal
2021-04-14  7:00     ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).