[Qemu-devel] [PATCH] virtio: add ORDER_PLATFORM feature support

Ilya Maximets posted 1 patch 5 years, 3 months ago
Test checkpatch passed
Test asan passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test docker-clang@ubuntu passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181214173123.31223-1-i.maximets@samsung.com
hw/net/vhost_net.c         |  1 +
include/hw/virtio/virtio.h | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH] virtio: add ORDER_PLATFORM feature support
Posted by Ilya Maximets 5 years, 3 months ago
This patch adds new property "order_platform" which is required to
allow VIRTIO_F_ORDER_PLATFORM feature negotiation. Disabled by
default because needed only for HW assited vhost backends.

Enabling of this feature will request guest drivers to use heavier
(platform dependent) techniques for memory ordering if negotiated.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---

Note: Patch to change the name of the feature from VIRTIO_F_IO_BARRIER
      to VIRTIO_F_ORDER_PLATFORM is not merged yet:
      https://www.mail-archive.com/virtio-dev@lists.oasis-open.org/msg04114.html

Patch for DPDK virtio driver available here:
      http://patches.dpdk.org/patch/48886/

 hw/net/vhost_net.c         |  1 +
 include/hw/virtio/virtio.h | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index e037db63a3..71877e46a5 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -78,6 +78,7 @@ static const int user_feature_bits[] = {
     VIRTIO_NET_F_MRG_RXBUF,
     VIRTIO_NET_F_MTU,
     VIRTIO_F_IOMMU_PLATFORM,
+    VIRTIO_F_ORDER_PLATFORM,
 
     /* This bit implies RARP isn't sent by QEMU out of band */
     VIRTIO_NET_F_GUEST_ANNOUNCE,
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 9c1fa07d6d..7e206dadbc 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -29,6 +29,15 @@
                                 (0x1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \
                                 (0x1ULL << VIRTIO_F_ANY_LAYOUT))
 
+#ifndef VIRTIO_F_ORDER_PLATFORM
+/*
+ * This feature indicates that memory accesses by the driver and the device
+ * are ordered in a way described by the platform.
+ * Not yet defined in Linux, i.e. not in standard-headers.
+ */
+#define VIRTIO_F_ORDER_PLATFORM 36
+#endif
+
 struct VirtQueue;
 
 static inline hwaddr vring_align(hwaddr addr,
@@ -264,7 +273,9 @@ typedef struct VirtIORNGConf VirtIORNGConf;
     DEFINE_PROP_BIT64("any_layout", _state, _field, \
                       VIRTIO_F_ANY_LAYOUT, true), \
     DEFINE_PROP_BIT64("iommu_platform", _state, _field, \
-                      VIRTIO_F_IOMMU_PLATFORM, false)
+                      VIRTIO_F_IOMMU_PLATFORM, false),  \
+    DEFINE_PROP_BIT64("order_platform", _state, _field, \
+                      VIRTIO_F_ORDER_PLATFORM, false)
 
 hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n);
 hwaddr virtio_queue_get_avail_addr(VirtIODevice *vdev, int n);
-- 
2.17.1