From: Marc Hartmayer <mhartmay@linux.ibm.com>
To: <qemu-devel@nongnu.org>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [RFC v2 3/3] libvhost-user: fence legacy virtio devices
Date: Fri, 17 Jul 2020 11:29:29 +0200 [thread overview]
Message-ID: <20200717092929.19453-4-mhartmay@linux.ibm.com> (raw)
In-Reply-To: <20200717092929.19453-1-mhartmay@linux.ibm.com>
libvhost-user has no support for legacy virtio devices therefore
let's fence them.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
contrib/libvhost-user/libvhost-access.h | 10 ++++++++++
contrib/libvhost-user/libvhost-user.c | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/contrib/libvhost-user/libvhost-access.h b/contrib/libvhost-user/libvhost-access.h
index 868ba3e7bfb8..aa505ea1ec02 100644
--- a/contrib/libvhost-user/libvhost-access.h
+++ b/contrib/libvhost-user/libvhost-access.h
@@ -1,11 +1,21 @@
#ifndef LIBVHOST_ACCESS_H
+#include <assert.h>
+
#include "qemu/bswap.h"
#include "libvhost-user.h"
+static inline bool vu_has_feature(VuDev *dev, unsigned int fbit);
+
static inline bool vu_access_is_big_endian(VuDev *dev)
{
+ /*
+ * TODO: can probably be removed as the fencing is already done in
+ * `vu_set_features_exec`
+ */
+ assert(vu_has_feature(dev, VIRTIO_F_VERSION_1));
+
/* Devices conforming to VIRTIO 1.0 or later are always LE. */
return false;
}
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index 0214b04c5291..93c4503b1f53 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -540,6 +540,12 @@ vu_set_features_exec(VuDev *dev, VhostUserMsg *vmsg)
DPRINT("u64: 0x%016"PRIx64"\n", vmsg->payload.u64);
dev->features = vmsg->payload.u64;
+ if (!vu_has_feature(dev, VIRTIO_F_VERSION_1)) {
+ /* We only support devices conforming to VIRTIO 1.0 or
+ * later */
+ vu_panic(dev, "virtio legacy devices aren't supported by libvhost-user");
+ return false;
+ }
if (!(dev->features & VHOST_USER_F_PROTOCOL_FEATURES)) {
vu_set_enable_all_rings(dev, true);
--
2.25.4
next prev parent reply other threads:[~2020-07-17 9:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 9:29 [RFC v2 0/3] Enable virtio-fs on s390x Marc Hartmayer
2020-07-17 9:29 ` [RFC v2 1/3] virtio: add vhost-user-fs-ccw device Marc Hartmayer
2020-07-21 13:47 ` Stefan Hajnoczi
2020-07-28 10:31 ` Cornelia Huck
2020-07-28 11:25 ` Halil Pasic
2020-07-28 11:33 ` Cornelia Huck
2020-07-17 9:29 ` [RFC v2 2/3] libvhost-user: handle endianness as mandated by the spec Marc Hartmayer
2020-07-21 12:48 ` Stefan Hajnoczi
2020-07-30 13:15 ` Marc Hartmayer
2020-07-21 13:40 ` Michael S. Tsirkin
2020-07-21 16:44 ` Halil Pasic
2020-07-28 10:48 ` Cornelia Huck
2020-07-28 11:31 ` Halil Pasic
2020-07-28 10:52 ` Marc Hartmayer
2020-07-29 14:13 ` Michael S. Tsirkin
2020-07-29 16:11 ` Marc Hartmayer
2020-07-17 9:29 ` Marc Hartmayer [this message]
2020-07-21 13:47 ` [RFC v2 3/3] libvhost-user: fence legacy virtio devices Stefan Hajnoczi
2020-07-17 10:26 ` [RFC v2 0/3] Enable virtio-fs on s390x no-reply
2020-07-17 10:31 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200717092929.19453-4-mhartmay@linux.ibm.com \
--to=mhartmay@linux.ibm.com \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=dgilbert@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).