Skip to contentSkip to conversation

Implementation of vhost-pci for inter-vm commucation

PATCH RESEND In review Wei Wang 3 participants 46 messages Dec 19, 2016 – Jan 9, 2017 Networking

lore
Share & tools
lore

Wei Wang

author
#0 lore raw

cover Implementation of vhost-pci for inter-vm commucation

This patch series implements vhost-pci, which is a point-to-point based inter-vm communication solution. The QEMU side implementation includes the vhost-user extension, vhost-pci device emulation and management. The current device part implementation is based on virtio 1.0, but it can be easily upgraded to support the upcoming virtio 1.1.

The current QEMU implementation supports the polling mode driver on both sides to receive packets. More features, such as interrupt support, live migration support, protected memory accesses will be added later.

RESEND change: Fixed some coding style issue

Wei Wang (37):
vhost-pci-net: the fundamental vhost-pci-net device emulation
vhost-pci-net: the fundamental implementation of vhost-pci-net-pci
vhost-user: share the vhost-user protocol related structures
vl: add the vhost-pci-slave command line option
vhost-pci-slave: start the implementation of vhost-pci-slave
vhost-pci-slave: set up the fundamental handlers for the server socket vhost-pci-slave/msg: VHOST_USER_GET_FEATURES vhost-pci-slave/msg: VHOST_USER_SET_FEATURES vhost-pci-slave/msg: VHOST_USER_GET_PROTOCOL_FEATURES vhost-pci-slave/msg: VHOST_USER_SET_PROTOCOL_FEATURES vhost-user/msg: VHOST_USER_PROTOCOL_F_SET_DEVICE_ID vhost-pci-slave/msg: VHOST_USER_SET_DEVICE_ID vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_NUM vhost-pci-slave/msg: VHOST_USER_SET_OWNER vhost-pci-slave/msg: VHOST_USER_SET_MEM_TABLE vhost-pci-slave/msg: VHOST_USER_SET_VRING_NUM vhost-pci-slave/msg: VHOST_USER_SET_VRING_BASE
vhost-user: send guest physical address of virtqueues to the slave vhost-pci-slave/msg: VHOST_USER_SET_VRING_ADDR vhost-pci-slave/msg: VHOST_USER_SET_VRING_KICK vhost-pci-slave/msg: VHOST_USER_SET_VRING_CALL vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE vhost-pci-slave/msg: VHOST_USER_SET_LOG_BASE vhost-pci-slave/msg: VHOST_USER_SET_LOG_FD vhost-pci-slave/msg: VHOST_USER_SEND_RARP vhost-pci-slave/msg: VHOST_USER_GET_VRING_BASE
vhost-pci-net: pass the info collected by vp_slave to the device
vhost-pci-net: pass the mem and vring info to the driver vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (start) vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (stop) vhost-user/msg: send VHOST_USER_SET_VHOST_PCI (start/stop)
vhost-user: add asynchronous read for the vhost-user master
vhost-pci-net: send the negotiated feature bits to the master
vhost-pci-slave: add "peer_reset"
vhost-pci-net: start the vhost-pci-net device vhost-user/msg: handling VHOST_USER_SET_FEATURES
vl: enable vhost-pci-slave

 hw/net/Makefile.objs                           |   2 +-
 hw/net/vhost-pci-net.c                         | 268 ++++++++++++
 hw/net/vhost_net.c                             |  39 ++
 hw/virtio/Makefile.objs                        |   1 +
 hw/virtio/vhost-pci-slave.c                    | 570 +++++++++++++++++++++++++
 hw/virtio/vhost-user.c                         | 187 ++++----
 hw/virtio/vhost.c                              |  64 ++-
 hw/virtio/virtio-pci.c                         |  80 ++++
 hw/virtio/virtio-pci.h                         |  16 +
 include/hw/pci/pci.h                           |   1 +
 include/hw/virtio/vhost-backend.h              |   2 +
 include/hw/virtio/vhost-pci-net.h              |  45 ++
 include/hw/virtio/vhost-pci-slave.h            |  46 ++
 include/hw/virtio/vhost-user.h                 | 109 +++++
 include/hw/virtio/vhost.h                      |   3 +
 include/net/vhost-user.h                       |  22 +-
 include/net/vhost_net.h                        |   2 +
 include/standard-headers/linux/vhost_pci_net.h |  85 ++++
 include/standard-headers/linux/virtio_ids.h    |  29 +-
 net/vhost-user.c                               |  37 +-
 qemu-options.hx                                |   4 +
 vl.c                                           |  43 ++
 22 files changed, 1520 insertions(+), 135 deletions(-)
 create mode 100644 hw/net/vhost-pci-net.c
 create mode 100644 hw/virtio/vhost-pci-slave.c
 create mode 100644 include/hw/virtio/vhost-pci-net.h
 create mode 100644 include/hw/virtio/vhost-pci-slave.h
 create mode 100644 include/hw/virtio/vhost-user.h
 create mode 100644 include/standard-headers/linux/vhost_pci_net.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH RESEND 1/37 vhost-pci-net: the fundamental vhost-pci-net device emulation

This patch introduces the fundamental parts of the device emulation.

---
 hw/net/Makefile.objs                           |   2 +-
 hw/net/vhost-pci-net.c                         | 138 +++++++++++++++++++++++++
 include/hw/virtio/vhost-pci-net.h              |  36 +++++++
 include/standard-headers/linux/vhost_pci_net.h |  43 ++++++++
 include/standard-headers/linux/virtio_ids.h    |  29 +++---
 5 files changed, 233 insertions(+), 15 deletions(-)
 create mode 100644 hw/net/vhost-pci-net.c
 create mode 100644 include/hw/virtio/vhost-pci-net.h
 create mode 100644 include/standard-headers/linux/vhost_pci_net.h
hw/net/Makefile.objs +1 -1
index 610ed3e..71d6d2e 100644
@@ -33,7 +33,7 @@ obj-$(CONFIG_MILKYMIST) += milkymist-minimac2.o
 obj-$(CONFIG_PSERIES) += spapr_llan.o
 obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o
 
-obj-$(CONFIG_VIRTIO) += virtio-net.o
+obj-$(CONFIG_VIRTIO) += virtio-net.o vhost-pci-net.o
 obj-y += vhost_net.o
 
 obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \
hw/net/vhost-pci-net.c new file +138 -0

138 lines not on this page · raw message

include/hw/virtio/vhost-pci-net.h new file +36 -0
new file mode 100644
index 0000000..8f2e65f
@@ -0,0 +1,36 @@
+/*
+ * Virtio Network Device
+ *
+ * Copyright Intel, Corp. 2016
+ *
+ * Authors:
+ *  Wei Wang   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef _QEMU_VHOST_PCI_NET_H
+#define _QEMU_VHOST_PCI_NET_H
+
+#include "standard-headers/linux/vhost_pci_net.h"
+#include "hw/virtio/virtio.h"
+
+#define TYPE_VHOST_PCI_NET "vhost-pci-net-device"
+#define VHOST_PCI_NET(obj) \
+        OBJECT_CHECK(VhostPCINet, (obj), TYPE_VHOST_PCI_NET)
+
+typedef struct VhostPCINet {
+    VirtIODevice parent_obj;
+    /* Control receiveq: msg from host to guest */
+    VirtQueue *crq;
+    /* Datapath receiveq */
+    VirtQueue **rqs;
+    uint16_t status;
+    uint16_t peer_vq_num;
+    size_t config_size;
+    uint64_t device_features;
+} VhostPCINet;
+
+#endif
include/standard-headers/linux/vhost_pci_net.h new file +43 -0

43 lines not on this page · raw message

include/standard-headers/linux/virtio_ids.h +15 -14
index fe74e42..d581c92 100644
@@ -29,18 +29,19 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE. */
 
-#define VIRTIO_ID_NET		1 /* virtio net */
-#define VIRTIO_ID_BLOCK		2 /* virtio block */
-#define VIRTIO_ID_CONSOLE	3 /* virtio console */
-#define VIRTIO_ID_RNG		4 /* virtio rng */
-#define VIRTIO_ID_BALLOON	5 /* virtio balloon */
-#define VIRTIO_ID_RPMSG		7 /* virtio remote processor messaging */
-#define VIRTIO_ID_SCSI		8 /* virtio scsi */
-#define VIRTIO_ID_9P		9 /* 9p virtio console */
-#define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */
-#define VIRTIO_ID_CAIF	       12 /* Virtio caif */
-#define VIRTIO_ID_GPU          16 /* virtio GPU */
-#define VIRTIO_ID_INPUT        18 /* virtio input */
-#define VIRTIO_ID_VSOCK        19 /* virtio vsock transport */
-#define VIRTIO_ID_CRYPTO       20 /* virtio crypto */
+#define VIRTIO_ID_NET		 1 /* virtio net */
+#define VIRTIO_ID_BLOCK		 2 /* virtio block */
+#define VIRTIO_ID_CONSOLE	 3 /* virtio console */
+#define VIRTIO_ID_RNG		 4 /* virtio rng */
+#define VIRTIO_ID_BALLOON	 5 /* virtio balloon */
+#define VIRTIO_ID_RPMSG		 7 /* virtio remote processor messaging */
+#define VIRTIO_ID_SCSI		 8 /* virtio scsi */
+#define VIRTIO_ID_9P		 9 /* 9p virtio console */
+#define VIRTIO_ID_RPROC_SERIAL  11 /* virtio remoteproc serial link */
+#define VIRTIO_ID_CAIF	        12 /* Virtio caif */
+#define VIRTIO_ID_GPU           16 /* virtio GPU */
+#define VIRTIO_ID_INPUT         18 /* virtio input */
+#define VIRTIO_ID_VSOCK         19 /* virtio vsock transport */
+#define VIRTIO_ID_CRYPTO        20 /* virtio crypto */
+#define VIRTIO_ID_VHOST_PCI_NET 21 /* vhost-pci-net */
 #endif /* _LINUX_VIRTIO_IDS_H */
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH RESEND 2/37 vhost-pci-net: the fundamental implementation of vhost-pci-net-pci

In reply to Wei Wang
---
 hw/virtio/virtio-pci.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/virtio/virtio-pci.h | 14 ++++++++++++++
 include/hw/pci/pci.h   |  1 +
 3 files changed, 61 insertions(+)
hw/virtio/virtio-pci.c +46 -0
index 21c2b9d..baf70b4 100644
@@ -21,6 +21,7 @@
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-blk.h"
 #include "hw/virtio/virtio-net.h"
+#include "hw/virtio/vhost-pci-net.h"
 #include "hw/virtio/virtio-serial.h"
 #include "hw/virtio/virtio-scsi.h"
 #include "hw/virtio/virtio-balloon.h"
@@ -2309,6 +2310,50 @@ static const TypeInfo virtio_net_pci_info = {
     .class_init    = virtio_net_pci_class_init,
 };
 
+/* vhost-pci-net */
+
+static Property vpnet_pci_properties[] = {
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void vpnet_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
+{
+    VhostPCINetPCI *dev = VHOST_PCI_NET_PCI(vpci_dev);
+    DeviceState *vdev = DEVICE(&dev->vdev);
+
+    object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+}
+
+static void vpnet_pci_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+    VirtioPCIClass *vpciklass = VIRTIO_PCI_CLASS(klass);
+
+    k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
+    k->device_id = PCI_DEVICE_ID_VHOST_PCI_NET;
+    k->class_id = PCI_CLASS_NETWORK_ETHERNET;
+    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
+    dc->props = vpnet_pci_properties;
+    vpciklass->realize = vpnet_pci_realize;
+}
+
+static void vpnet_pci_instance_init(Object *obj)
+{
+    VhostPCINetPCI *dev = VHOST_PCI_NET_PCI(obj);
+
+    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
+                                TYPE_VHOST_PCI_NET);
+}
+
+static const TypeInfo vpnet_pci_info = {
+    .name          = TYPE_VHOST_PCI_NET_PCI,
+    .parent        = TYPE_VIRTIO_PCI,
+    .instance_size = sizeof(VhostPCINetPCI),
+    .instance_init = vpnet_pci_instance_init,
+    .class_init    = vpnet_pci_class_init,
+};
+
 /* virtio-rng-pci */
 
 static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
@@ -2537,6 +2582,7 @@ static void virtio_pci_register_types(void)
     type_register_static(&virtio_keyboard_pci_info);
     type_register_static(&virtio_mouse_pci_info);
     type_register_static(&virtio_tablet_pci_info);
+    type_register_static(&vpnet_pci_info);
 #ifdef CONFIG_LINUX
     type_register_static(&virtio_host_pci_info);
 #endif
hw/virtio/virtio-pci.h +14 -0
index 5e07886..0b4b04f 100644
@@ -18,6 +18,7 @@
 #include "hw/pci/msi.h"
 #include "hw/virtio/virtio-blk.h"
 #include "hw/virtio/virtio-net.h"
+#include "hw/virtio/vhost-pci-net.h"
 #include "hw/virtio/virtio-rng.h"
 #include "hw/virtio/virtio-serial.h"
 #include "hw/virtio/virtio-scsi.h"
@@ -43,6 +44,7 @@ typedef struct VirtIOSCSIPCI VirtIOSCSIPCI;
 typedef struct VirtIOBalloonPCI VirtIOBalloonPCI;
 typedef struct VirtIOSerialPCI VirtIOSerialPCI;
 typedef struct VirtIONetPCI VirtIONetPCI;
+typedef struct VhostPCINetPCI VhostPCINetPCI;
 typedef struct VHostSCSIPCI VHostSCSIPCI;
 typedef struct VirtIORngPCI VirtIORngPCI;
 typedef struct VirtIOInputPCI VirtIOInputPCI;
@@ -262,6 +264,18 @@ struct VirtIONetPCI {
     VirtIONet vdev;
 };
 
+ /*
+ * vhost-pci-net-pci: This extends VirtioPCIProxy.
+ */
+#define TYPE_VHOST_PCI_NET_PCI "vhost-pci-net-pci"
+#define VHOST_PCI_NET_PCI(obj) \
+        OBJECT_CHECK(VhostPCINetPCI, (obj), TYPE_VHOST_PCI_NET_PCI)
+
+struct VhostPCINetPCI {
+    VirtIOPCIProxy parent_obj;
+    VhostPCINet vdev;
+};
+
 /*
  * virtio-9p-pci: This extends VirtioPCIProxy.
  */
include/hw/pci/pci.h +1 -0
index 772692f..ef8468b 100644
@@ -83,6 +83,7 @@
 #define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
 #define PCI_DEVICE_ID_VIRTIO_9P          0x1009
 #define PCI_DEVICE_ID_VIRTIO_VSOCK       0x1012
+#define PCI_DEVICE_ID_VHOST_PCI_NET      0x1014
 
 #define PCI_VENDOR_ID_REDHAT             0x1b36
 #define PCI_DEVICE_ID_REDHAT_BRIDGE      0x0001
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH RESEND 3/37 vhost-user: share the vhost-user protocol related structures

In reply to Wei Wang

Put the vhost-user protocol related data structures into vhost-user.h, so that they can be used in other implementations (e.g. a slave implementation).

---
 hw/virtio/vhost-user.c         | 87 +---------------------------------------
 include/hw/virtio/vhost-user.h | 91 ++++++++++++++++++++++++++++++++++++++++++
 include/net/vhost-user.h       |  4 +-
 3 files changed, 94 insertions(+), 88 deletions(-)
 create mode 100644 include/hw/virtio/vhost-user.h
hw/virtio/vhost-user.c +1 -86
index 7ee92b3..9e089d4 100644
@@ -12,6 +12,7 @@
 #include "qapi/error.h"
 #include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-backend.h"
+#include "hw/virtio/vhost-user.h"
 #include "hw/virtio/virtio-net.h"
 #include "sysemu/char.h"
 #include "sysemu/kvm.h"
@@ -22,92 +23,6 @@
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-#include <linux/vhost.h>
-
-#define VHOST_MEMORY_MAX_NREGIONS    8
-#define VHOST_USER_F_PROTOCOL_FEATURES 30
-
-enum VhostUserProtocolFeature {
-    VHOST_USER_PROTOCOL_F_MQ = 0,
-    VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
-    VHOST_USER_PROTOCOL_F_RARP = 2,
-    VHOST_USER_PROTOCOL_F_REPLY_ACK = 3,
-
-    VHOST_USER_PROTOCOL_F_MAX
-};
-
-#define VHOST_USER_PROTOCOL_FEATURE_MASK ((1 << VHOST_USER_PROTOCOL_F_MAX) - 1)
-
-typedef enum VhostUserRequest {
-    VHOST_USER_NONE = 0,
-    VHOST_USER_GET_FEATURES = 1,
-    VHOST_USER_SET_FEATURES = 2,
-    VHOST_USER_SET_OWNER = 3,
-    VHOST_USER_RESET_OWNER = 4,
-    VHOST_USER_SET_MEM_TABLE = 5,
-    VHOST_USER_SET_LOG_BASE = 6,
-    VHOST_USER_SET_LOG_FD = 7,
-    VHOST_USER_SET_VRING_NUM = 8,
-    VHOST_USER_SET_VRING_ADDR = 9,
-    VHOST_USER_SET_VRING_BASE = 10,
-    VHOST_USER_GET_VRING_BASE = 11,
-    VHOST_USER_SET_VRING_KICK = 12,
-    VHOST_USER_SET_VRING_CALL = 13,
-    VHOST_USER_SET_VRING_ERR = 14,
-    VHOST_USER_GET_PROTOCOL_FEATURES = 15,
-    VHOST_USER_SET_PROTOCOL_FEATURES = 16,
-    VHOST_USER_GET_QUEUE_NUM = 17,
-    VHOST_USER_SET_VRING_ENABLE = 18,
-    VHOST_USER_SEND_RARP = 19,
-    VHOST_USER_MAX
-} VhostUserRequest;
-
-typedef struct VhostUserMemoryRegion {
-    uint64_t guest_phys_addr;
-    uint64_t memory_size;
-    uint64_t userspace_addr;
-    uint64_t mmap_offset;
-} VhostUserMemoryRegion;
-
-typedef struct VhostUserMemory {
-    uint32_t nregions;
-    uint32_t padding;
-    VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS];
-} VhostUserMemory;
-
-typedef struct VhostUserLog {
-    uint64_t mmap_size;
-    uint64_t mmap_offset;
-} VhostUserLog;
-
-typedef struct VhostUserMsg {
-    VhostUserRequest request;
-
-#define VHOST_USER_VERSION_MASK     (0x3)
-#define VHOST_USER_REPLY_MASK       (0x1<<2)
-#define VHOST_USER_NEED_REPLY_MASK  (0x1 << 3)
-    uint32_t flags;
-    uint32_t size; /* the following payload size */
-    union {
-#define VHOST_USER_VRING_IDX_MASK   (0xff)
-#define VHOST_USER_VRING_NOFD_MASK  (0x1<<8)
-        uint64_t u64;
-        struct vhost_vring_state state;
-        struct vhost_vring_addr addr;
-        VhostUserMemory memory;
-        VhostUserLog log;
-    } payload;
-} QEMU_PACKED VhostUserMsg;
-
-static VhostUserMsg m __attribute__ ((unused));
-#define VHOST_USER_HDR_SIZE (sizeof(m.request) \
-                            + sizeof(m.flags) \
-                            + sizeof(m.size))
-
-#define VHOST_USER_PAYLOAD_SIZE (sizeof(m) - VHOST_USER_HDR_SIZE)
-
-/* The version of the protocol we support */
-#define VHOST_USER_VERSION    (0x1)
 
 static bool ioeventfd_enabled(void)
 {
include/hw/virtio/vhost-user.h new file +91 -0

91 lines not on this page · raw message

include/net/vhost-user.h +2 -2
index 5bcd8a6..d9e328d 100644
@@ -8,8 +8,8 @@
  *
  */
 
-#ifndef VHOST_USER_H
-#define VHOST_USER_H
+#ifndef NET_VHOST_USER_H
+#define NET_VHOST_USER_H
 
 struct vhost_net;
 struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc);
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH RESEND 4/37 vl: add the vhost-pci-slave command line option

In reply to Wei Wang

An example of the command line option to create a vhost-pci-slave is:

-chardev socket,id=slave1,server,wait=off,path=/opt/vhost-pci-slave -vhost-pci-slave socket,chardev=slave1

---
 qemu-options.hx |  4 ++++
 vl.c            | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)
qemu-options.hx +4 -0
index c534a2f..5d60a1d 100644
@@ -4068,6 +4068,10 @@ contents of @code{iv.b64} to the second secret
 
 ETEXI
 
+DEF("vhost-pci-slave", HAS_ARG, QEMU_OPTION_vhost_pci_slave,
+    "-vhost-pci-slave socket,chrdev={id}\n"
+    "                  creates a vhost-pci-slave",
+    QEMU_ARCH_I386)
 
 HXCOMM This is the last statement. Insert new options before this line!
 STEXI
vl.c +22 -0
index d77dd86..deb116e 100644
@@ -509,6 +509,20 @@ static QemuOptsList qemu_fw_cfg_opts = {
     },
 };
 
+static QemuOptsList qemu_vhost_pci_slave_opts = {
+    .name = "vhost-pci-slave",
+    .implied_opt_name = "chardev",
+    .head = QTAILQ_HEAD_INITIALIZER(qemu_vhost_pci_slave_opts.head),
+    .desc = {
+        /*
+         * no elements => accept any
+         * sanity checking will happen later
+         * when setting device properties
+         */
+        { /* end of list */ }
+    },
+};
+
 #ifdef CONFIG_LIBISCSI
 static QemuOptsList qemu_iscsi_opts = {
     .name = "iscsi",
@@ -3073,6 +3087,7 @@ int main(int argc, char **argv, char **envp)
     qemu_add_opts(&qemu_icount_opts);
     qemu_add_opts(&qemu_semihosting_config_opts);
     qemu_add_opts(&qemu_fw_cfg_opts);
+    qemu_add_opts(&qemu_vhost_pci_slave_opts);
 #ifdef CONFIG_LIBISCSI
     qemu_add_opts(&qemu_iscsi_opts);
 #endif
@@ -4044,6 +4059,13 @@ int main(int argc, char **argv, char **envp)
                     exit(1);
                 }
                 break;
+            case QEMU_OPTION_vhost_pci_slave:
+                opts = qemu_opts_parse_noisily(
+                           qemu_find_opts("vhost-pci-slave"), optarg, false);
+                if (!opts) {
+                    exit(1);
+                }
+                break;
             default:
                 os_parse_cmd_args(popt->index, optarg);
             }
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH RESEND 5/37 vhost-pci-slave: start the implementation of vhost-pci-slave

In reply to Wei Wang

Vhost-pci-slave uses a QEMU socket to talk to the master. This patch associates the slave with the qemu sever socket.

---
 hw/virtio/Makefile.objs             |  1 +
 hw/virtio/vhost-pci-slave.c         | 53 +++++++++++++++++++++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h | 16 +++++++++++
 3 files changed, 70 insertions(+)
 create mode 100644 hw/virtio/vhost-pci-slave.c
 create mode 100644 include/hw/virtio/vhost-pci-slave.h
hw/virtio/Makefile.objs +1 -0
index 95c4c30..3af6787 100644
@@ -2,6 +2,7 @@ common-obj-y += virtio-rng.o
 common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 common-obj-y += virtio-bus.o
 common-obj-y += virtio-mmio.o
+common-obj-y += vhost-pci-slave.o
 
 obj-y += virtio.o virtio-balloon.o 
 obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
hw/virtio/vhost-pci-slave.c new file +53 -0

53 lines not on this page · raw message

include/hw/virtio/vhost-pci-slave.h new file +16 -0
new file mode 100644
index 0000000..c82c775
@@ -0,0 +1,16 @@
+#ifndef QEMU_VHOST_PCI_SLAVE_H
+#define QEMU_VHOST_PCI_SLAVE_H
+
+#include "sysemu/char.h"
+
+typedef struct VhostPCISlave {
+    CharBackend chr_be;
+} VhostPCISlave;
+
+extern VhostPCISlave *vp_slave;
+
+extern int vhost_pci_slave_init(QemuOpts *opts);
+
+extern int vhost_pci_slave_cleanup(void);
+
+#endif
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH RESEND 6/37 vhost-pci-slave: set up the fundamental handlers for the server socket

In reply to Wei Wang
---
 hw/virtio/vhost-pci-slave.c | 54 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
hw/virtio/vhost-pci-slave.c +54 -0
index 6b6deb2..cb3abae 100644
@@ -15,9 +15,60 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/vhost-pci-slave.h"
+#include "hw/virtio/vhost-user.h"
 
 VhostPCISlave *vp_slave;
 
+static void vp_slave_event(void *opaque, int event)
+{
+    switch (event) {
+    case CHR_EVENT_OPENED:
+        break;
+    case CHR_EVENT_CLOSED:
+        break;
+    }
+}
+
+static int vp_slave_can_read(void *opaque)
+{
+    return VHOST_USER_HDR_SIZE;
+}
+
+static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
+{
+    VhostUserMsg msg;
+    uint8_t *p = (uint8_t *) &msg;
+    CharBackend *chr_be = (CharBackend *)opaque;
+
+    if (size != VHOST_USER_HDR_SIZE) {
+        error_report("Wrong message size received %d", size);
+        return;
+    }
+
+    memcpy(p, buf, VHOST_USER_HDR_SIZE);
+
+    if (msg.size) {
+        p += VHOST_USER_HDR_SIZE;
+        size = qemu_chr_fe_read_all(chr_be, p, msg.size);
+        if (size != msg.size) {
+            error_report("Wrong message size received %d != %d",
+                           size, msg.size);
+            return;
+        }
+    }
+
+    if (msg.request > VHOST_USER_MAX) {
+        error_report("vhost-pci-slave read incorrect msg");
+    }
+
+    switch (msg.request) {
+    default:
+        error_report("vhost-pci-slave does not support msg request = %d",
+                     msg.request);
+        break;
+    }
+}
+
 static CharDriverState *vp_slave_parse_chardev(const char *id)
 {
     CharDriverState *chr = qemu_chr_find(id);
@@ -40,6 +91,9 @@ int vhost_pci_slave_init(QemuOpts *opts)
         return -1;
     }
     qemu_chr_fe_init(&vp_slave->chr_be, chr, &error_abort);
+    qemu_chr_fe_set_handlers(&vp_slave->chr_be, vp_slave_can_read,
+                             vp_slave_read, vp_slave_event,
+                             &vp_slave->chr_be, NULL, true);
 
     return 0;
 }
Signature · 1 line
2.7.4
author
#7 lore raw

PATCH RESEND 7/37 vhost-pci-slave/msg: VHOST_USER_GET_FEATURES

In reply to Wei Wang

Offer the initial feature bits, which haven't been negotiated with the slave driver, to the master.

---
 hw/virtio/vhost-pci-slave.c         | 38 +++++++++++++++++++++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  1 +
 2 files changed, 39 insertions(+)
hw/virtio/vhost-pci-slave.c +38 -0
index cb3abae..448b76c 100644
@@ -14,11 +14,37 @@
 
 #include "qapi/error.h"
 #include "qemu/error-report.h"
+#include "hw/virtio/virtio-pci.h"
 #include "hw/virtio/vhost-pci-slave.h"
 #include "hw/virtio/vhost-user.h"
 
 VhostPCISlave *vp_slave;
 
+static int vp_slave_write(CharBackend *chr_be, VhostUserMsg *msg)
+{
+    int size;
+
+    if (!msg) {
+        return 0;
+    }
+
+    size = msg->size + VHOST_USER_HDR_SIZE;
+    msg->flags &= ~VHOST_USER_VERSION_MASK;
+    msg->flags |= VHOST_USER_VERSION;
+
+    return qemu_chr_fe_write_all(chr_be, (const uint8_t *)msg, size)
+           == size ? 0 : -1;
+}
+
+static int vp_slave_get_features(CharBackend *chr_be, VhostUserMsg *msg)
+{
+    msg->payload.u64 = vp_slave->feature_bits;
+    msg->size = sizeof(msg->payload.u64);
+    msg->flags |= VHOST_USER_REPLY_MASK;
+
+    return vp_slave_write(chr_be, msg);
+}
+
 static void vp_slave_event(void *opaque, int event)
 {
     switch (event) {
@@ -36,6 +62,7 @@ static int vp_slave_can_read(void *opaque)
 
 static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
 {
+    int ret;
     VhostUserMsg msg;
     uint8_t *p = (uint8_t *) &msg;
     CharBackend *chr_be = (CharBackend *)opaque;
@@ -62,11 +89,21 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
     }
 
     switch (msg.request) {
+    case VHOST_USER_GET_FEATURES:
+        ret = vp_slave_get_features(chr_be, &msg);
+        if (ret < 0) {
+            goto err_handling;
+        }
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
         break;
     }
+    return;
+
+err_handling:
+    error_report("vhost-pci-slave handle request %d failed", msg.request);
 }
 
 static CharDriverState *vp_slave_parse_chardev(const char *id)
@@ -90,6 +127,7 @@ int vhost_pci_slave_init(QemuOpts *opts)
     if (!chr) {
         return -1;
     }
+    vp_slave->feature_bits =  1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
     qemu_chr_fe_init(&vp_slave->chr_be, chr, &error_abort);
     qemu_chr_fe_set_handlers(&vp_slave->chr_be, vp_slave_can_read,
                              vp_slave_read, vp_slave_event,
include/hw/virtio/vhost-pci-slave.h +1 -0
index c82c775..4ec25d4 100644
@@ -5,6 +5,7 @@
 
 typedef struct VhostPCISlave {
     CharBackend chr_be;
+    uint64_t feature_bits;
 } VhostPCISlave;
 
 extern VhostPCISlave *vp_slave;
Signature · 1 line
2.7.4
author
#8 lore raw

PATCH RESEND 8/37 vhost-pci-slave/msg: VHOST_USER_SET_FEATURES

In reply to Wei Wang

Store the feature bits that have been negotiated between the master device and driver. The feature bits will be negotiated with the slave driver.

---
 hw/virtio/vhost-pci-slave.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/virtio/vhost-pci-slave.c +10 -0
index 448b76c..68ab4ec 100644
@@ -45,6 +45,13 @@ static int vp_slave_get_features(CharBackend *chr_be, VhostUserMsg *msg)
     return vp_slave_write(chr_be, msg);
 }
 
+static void vp_slave_set_features(VhostUserMsg *msg)
+{
+   /* Clear the protocol feature bit, which is useless for the device */
+    vp_slave->feature_bits = msg->payload.u64
+                             & ~(1 << VHOST_USER_F_PROTOCOL_FEATURES);
+}
+
 static void vp_slave_event(void *opaque, int event)
 {
     switch (event) {
@@ -95,6 +102,9 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
             goto err_handling;
         }
         break;
+    case VHOST_USER_SET_FEATURES:
+        vp_slave_set_features(&msg);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
Signature · 1 line
2.7.4
author
#9 lore raw

PATCH RESEND 9/37 vhost-pci-slave/msg: VHOST_USER_GET_PROTOCOL_FEATURES

In reply to Wei Wang

Add a new protocol feature, VHOST_USER_PROTOCOL_F_VHOST_PCI. This feature indicates the support of the vhost-pci extension for inter-vm communiaction.

---
 hw/virtio/vhost-pci-slave.c    | 16 ++++++++++++++++
 include/hw/virtio/vhost-user.h |  6 ++++++
 2 files changed, 22 insertions(+)
hw/virtio/vhost-pci-slave.c +16 -0
index 68ab4ec..05255d1 100644
@@ -62,6 +62,16 @@ static void vp_slave_event(void *opaque, int event)
     }
 }
 
+static int vp_slave_get_protocol_features(CharBackend *chr_be,
+                                          VhostUserMsg *msg)
+{
+    msg->payload.u64 = VHOST_USER_PROTOCOL_FEATURES;
+    msg->size = sizeof(msg->payload.u64);
+    msg->flags |= VHOST_USER_REPLY_MASK;
+
+    return vp_slave_write(chr_be, msg);
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -105,6 +115,12 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
     case VHOST_USER_SET_FEATURES:
         vp_slave_set_features(&msg);
         break;
+    case VHOST_USER_GET_PROTOCOL_FEATURES:
+        ret = vp_slave_get_protocol_features(chr_be, &msg);
+        if (ret < 0) {
+            goto err_handling;
+        }
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-user.h +6 -0
index 8d43ffc..ad5eac9 100644
@@ -11,12 +11,18 @@ enum VhostUserProtocolFeature {
     VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
     VHOST_USER_PROTOCOL_F_RARP = 2,
     VHOST_USER_PROTOCOL_F_REPLY_ACK = 3,
+    VHOST_USER_PROTOCOL_F_VHOST_PCI = 4,
 
     VHOST_USER_PROTOCOL_F_MAX
 };
 
 #define VHOST_USER_PROTOCOL_FEATURE_MASK ((1 << VHOST_USER_PROTOCOL_F_MAX) - 1)
 
+#define VHOST_USER_PROTOCOL_FEATURES ((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \
+                               (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) | \
+                                    (1ULL << VHOST_USER_PROTOCOL_F_RARP) | \
+                              (1ULL << VHOST_USER_PROTOCOL_F_VHOST_PCI))
+
 typedef enum VhostUserRequest {
     VHOST_USER_NONE = 0,
     VHOST_USER_GET_FEATURES = 1,
Signature · 1 line
2.7.4
author
#10 lore raw

PATCH RESEND 10/37 vhost-pci-slave/msg: VHOST_USER_SET_PROTOCOL_FEATURES

In reply to Wei Wang

Not used currently.

---
 hw/virtio/vhost-pci-slave.c | 2 ++
 1 file changed, 2 insertions(+)
hw/virtio/vhost-pci-slave.c +2 -0
index 05255d1..020e279 100644
@@ -121,6 +121,8 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
             goto err_handling;
         }
         break;
+    case VHOST_USER_SET_PROTOCOL_FEATURES:
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
Signature · 1 line
2.7.4
author
#11 lore raw

PATCH RESEND 11/37 vhost-user/msg: VHOST_USER_PROTOCOL_F_SET_DEVICE_ID

In reply to Wei Wang

The feature, VHOST_USER_PROTOCOL_F_SET_DEVICE_ID, indicates that the slave side implementation supports different types of devices. The master tells the slave what type of device to create by sending the VHOST_USER_SET_DEVICE_ID message. Currently, only the net type is supported.

---
 hw/net/vhost_net.c             |  1 +
 hw/virtio/vhost-user.c         | 20 ++++++++++++++++++++
 include/hw/virtio/vhost-user.h |  5 ++++-
 include/hw/virtio/vhost.h      |  1 +
 4 files changed, 26 insertions(+), 1 deletion(-)
hw/net/vhost_net.c +1 -0
index f2d49ad..6524503 100644
@@ -152,6 +152,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
     net->dev.max_queues = 1;
     net->dev.nvqs = 2;
     net->dev.vqs = net->vqs;
+    net->dev.dev_type = VIRTIO_ID_NET;
 
     if (backend_kernel) {
         r = vhost_net_get_fd(options->net_backend);
hw/virtio/vhost-user.c +20 -0
index 9e089d4..6391d10 100644
@@ -452,6 +452,18 @@ static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features)
     return vhost_user_get_u64(dev, VHOST_USER_GET_FEATURES, features);
 }
 
+static int vhost_user_set_dev_id(struct vhost_dev *dev, uint16_t virtio_id)
+{
+    VhostUserMsg msg = {
+        .request = VHOST_USER_SET_DEVICE_ID,
+        .flags = VHOST_USER_VERSION,
+        .payload.u64 = virtio_id,
+        .size = sizeof(msg.payload.u64),
+    };
+
+    return vhost_user_write(dev, &msg, NULL, 0);
+}
+
 static int vhost_user_set_owner(struct vhost_dev *dev)
 {
     VhostUserMsg msg = {
@@ -509,6 +521,14 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque)
             return err;
         }
 
+        if (dev->protocol_features &
+            (1ULL << VHOST_USER_PROTOCOL_F_SET_DEVICE_ID)) {
+            err = vhost_user_set_dev_id(dev, dev->dev_type);
+            if (err < 0) {
+                return err;
+            }
+        }
+
         /* query the max queues we support if backend supports Multiple Queue */
         if (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MQ)) {
             err = vhost_user_get_u64(dev, VHOST_USER_GET_QUEUE_NUM,
include/hw/virtio/vhost-user.h +4 -1
index ad5eac9..e79a2ec 100644
@@ -12,6 +12,7 @@ enum VhostUserProtocolFeature {
     VHOST_USER_PROTOCOL_F_RARP = 2,
     VHOST_USER_PROTOCOL_F_REPLY_ACK = 3,
     VHOST_USER_PROTOCOL_F_VHOST_PCI = 4,
+    VHOST_USER_PROTOCOL_F_SET_DEVICE_ID = 5,
 
     VHOST_USER_PROTOCOL_F_MAX
 };
@@ -21,7 +22,8 @@ enum VhostUserProtocolFeature {
 #define VHOST_USER_PROTOCOL_FEATURES ((1ULL << VHOST_USER_PROTOCOL_F_MQ) | \
                                (1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD) | \
                                     (1ULL << VHOST_USER_PROTOCOL_F_RARP) | \
-                              (1ULL << VHOST_USER_PROTOCOL_F_VHOST_PCI))
+                               (1ULL << VHOST_USER_PROTOCOL_F_VHOST_PCI) | \
+                          (1ULL << VHOST_USER_PROTOCOL_F_SET_DEVICE_ID))
 
 typedef enum VhostUserRequest {
     VHOST_USER_NONE = 0,
@@ -44,6 +46,7 @@ typedef enum VhostUserRequest {
     VHOST_USER_GET_QUEUE_NUM = 17,
     VHOST_USER_SET_VRING_ENABLE = 18,
     VHOST_USER_SEND_RARP = 19,
+    VHOST_USER_SET_DEVICE_ID = 20,
     VHOST_USER_MAX
 } VhostUserRequest;
 
include/hw/virtio/vhost.h +1 -0
index 1fe5aad..9cf32e2 100644
@@ -43,6 +43,7 @@ struct vhost_dev {
     int n_mem_sections;
     MemoryRegionSection *mem_sections;
     struct vhost_virtqueue *vqs;
+    uint16_t dev_type;
     int nvqs;
     /* the first virtqueue which would be used by this vhost dev */
     int vq_index;
Signature · 1 line
2.7.4
author
#12 lore raw

PATCH RESEND 12/37 vhost-pci-slave/msg: VHOST_USER_SET_DEVICE_ID

In reply to Wei Wang

Initialize the feature bits according to the device type.

---
 hw/virtio/vhost-pci-slave.c         | 23 +++++++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  1 +
 2 files changed, 24 insertions(+)
hw/virtio/vhost-pci-slave.c +23 -0
index 020e279..3f35649 100644
@@ -18,6 +18,12 @@
 #include "hw/virtio/vhost-pci-slave.h"
 #include "hw/virtio/vhost-user.h"
 
+#define VHOST_PCI_FEATURE_BITS (1ULL << VIRTIO_F_VERSION_1)
+
+#define VHOST_PCI_NET_FEATURE_BITS ((1ULL << VIRTIO_NET_F_MRG_RXBUF) | \
+                                   (1ULL << VIRTIO_NET_F_CTRL_VQ) | \
+                                   (1ULL << VIRTIO_NET_F_MQ))
+
 VhostPCISlave *vp_slave;
 
 static int vp_slave_write(CharBackend *chr_be, VhostUserMsg *msg)
@@ -72,6 +78,20 @@ static int vp_slave_get_protocol_features(CharBackend *chr_be,
     return vp_slave_write(chr_be, msg);
 }
 
+static void vp_slave_set_device_type(VhostUserMsg *msg)
+{
+    vp_slave->dev_type = (uint16_t)msg->payload.u64;
+
+    switch (vp_slave->dev_type) {
+    case VIRTIO_ID_NET:
+        vp_slave->feature_bits |= (VHOST_PCI_FEATURE_BITS
+                                   | VHOST_PCI_NET_FEATURE_BITS);
+        break;
+    default:
+        error_report("device type %d is not supported", vp_slave->dev_type);
+    }
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -123,6 +143,9 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
         break;
     case VHOST_USER_SET_PROTOCOL_FEATURES:
         break;
+    case VHOST_USER_SET_DEVICE_ID:
+        vp_slave_set_device_type(&msg);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-pci-slave.h +1 -0
index 4ec25d4..8b162dc 100644
@@ -5,6 +5,7 @@
 
 typedef struct VhostPCISlave {
     CharBackend chr_be;
+    uint16_t dev_type;
     uint64_t feature_bits;
 } VhostPCISlave;
 
Signature · 1 line
2.7.4
author
#13 lore raw

PATCH RESEND 13/37 vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_NUM

In reply to Wei Wang

Send the max supported queue num according to the device type back to the master.

---
 hw/virtio/vhost-pci-slave.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
hw/virtio/vhost-pci-slave.c +23 -0
index 3f35649..7f237bd 100644
@@ -92,6 +92,23 @@ static void vp_slave_set_device_type(VhostUserMsg *msg)
     }
 }
 
+static int vp_slave_get_queue_num(CharBackend *chr_be, VhostUserMsg *msg)
+{
+    switch (vp_slave->dev_type) {
+    case VIRTIO_ID_NET:
+        msg->payload.u64 = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX;
+        break;
+    default:
+        error_report("GET_QUEUE_NUM: device type %d is not supported",
+                     vp_slave->dev_type);
+        return -1;
+    }
+    msg->size = sizeof(msg->payload.u64);
+    msg->flags |= VHOST_USER_REPLY_MASK;
+
+    return vp_slave_write(chr_be, msg);
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -146,6 +163,12 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
     case VHOST_USER_SET_DEVICE_ID:
         vp_slave_set_device_type(&msg);
         break;
+    case VHOST_USER_GET_QUEUE_NUM:
+        ret = vp_slave_get_queue_num(chr_be, &msg);
+        if (ret < 0) {
+            goto err_handling;
+        }
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
Signature · 1 line
2.7.4
author
#14 lore raw

PATCH RESEND 14/37 vhost-pci-slave/msg: VHOST_USER_SET_OWNER

In reply to Wei Wang

Do nothing currently.

---
 hw/virtio/vhost-pci-slave.c | 2 ++
 1 file changed, 2 insertions(+)
hw/virtio/vhost-pci-slave.c +2 -0
index 7f237bd..6f6c07f 100644
@@ -169,6 +169,8 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
             goto err_handling;
         }
         break;
+    case VHOST_USER_SET_OWNER:
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
Signature · 1 line
2.7.4
author
#15 lore raw

PATCH RESEND 15/37 vhost-pci-slave/msg: VHOST_USER_SET_MEM_TABLE

In reply to Wei Wang

Map the peer memory in QEMU, and prepare the memory for the guest using MemoryRegion. The controlq message of the memory info is constructed here, and it will be sent to the guest when the guest controlq is ready. With the the peer memory info reveived in the message, the guest will be able to translate any peer guest physical address to its own guest physical address.

Also add a cleanup function to free the related memory that has been set up.

---
 hw/virtio/vhost-pci-slave.c                    | 96 +++++++++++++++++++++++++-
 include/hw/virtio/vhost-pci-slave.h            |  9 +++
 include/standard-headers/linux/vhost_pci_net.h | 11 +++
 3 files changed, 115 insertions(+), 1 deletion(-)
hw/virtio/vhost-pci-slave.c +95 -1
index 6f6c07f..9d42566 100644
@@ -26,6 +26,21 @@
 
 VhostPCISlave *vp_slave;
 
+static void vp_slave_cleanup(void)
+{
+    int ret;
+    uint32_t i, nregions;
+
+    nregions = vp_slave->pmem_msg.nregions;
+    for (i = 0; i < nregions; i++) {
+        ret = munmap(vp_slave->mr_map_base[i], vp_slave->mr_map_size[i]);
+        if (ret < 0) {
+            error_report("cleanup: failed to unmap mr");
+        }
+        memory_region_del_subregion(vp_slave->bar_mr, vp_slave->sub_mr + i);
+    }
+}
+
 static int vp_slave_write(CharBackend *chr_be, VhostUserMsg *msg)
 {
     int size;
@@ -109,6 +124,76 @@ static int vp_slave_get_queue_num(CharBackend *chr_be, VhostUserMsg *msg)
     return vp_slave_write(chr_be, msg);
 }
 
+static uint64_t vp_slave_peer_mem_size_get(VhostUserMemory *pmem)
+{
+    int i;
+    uint64_t total_size = 0;
+    uint32_t nregions = pmem->nregions;
+    VhostUserMemoryRegion *pmem_regions = pmem->regions;
+
+    for (i = 0; i < nregions; i++) {
+        total_size += pmem_regions[i].memory_size;
+    }
+
+    return total_size;
+}
+
+static int vp_slave_set_mem_table(VhostUserMsg *msg, int *fds, int fd_num)
+{
+    VhostUserMemory *pmem = &msg->payload.memory;
+    VhostUserMemoryRegion *pmem_region = pmem->regions;
+    uint32_t i, nregions = pmem->nregions;
+    struct peer_mem_msg *pmem_msg = &vp_slave->pmem_msg;
+    pmem_msg->nregions = nregions;
+    MemoryRegion *bar_mr, *sub_mr;
+    uint64_t bar_size, bar_map_offset = 0;
+    void *mr_qva;
+
+    /* Sanity Check */
+    if (fd_num != nregions) {
+        error_report("SET_MEM_TABLE: fd num doesn't match region num");
+        return -1;
+    }
+
+    if (vp_slave->bar_mr == NULL) {
+        vp_slave->bar_mr = g_malloc(sizeof(MemoryRegion));
+    }
+    if (vp_slave->sub_mr == NULL) {
+        vp_slave->sub_mr = g_malloc(nregions * sizeof(MemoryRegion));
+    }
+    bar_mr = vp_slave->bar_mr;
+    sub_mr = vp_slave->sub_mr;
+
+    /*
+     * The top half of the bar area holds the peer memory, and the bottom
+     * half is reserved for memory hotplug
+     */
+    bar_size = 2 * vp_slave_peer_mem_size_get(pmem);
+    bar_size = pow2ceil(bar_size);
+    memory_region_init(bar_mr, NULL, "Peer Memory", bar_size);
+    for (i = 0; i < nregions; i++) {
+        vp_slave->mr_map_size[i] = pmem_region[i].memory_size
+                                       + pmem_region[i].mmap_offset;
+        vp_slave->mr_map_base[i] = mmap(NULL, vp_slave->mr_map_size[i],
+                      PROT_READ | PROT_WRITE, MAP_SHARED, fds[i], 0);
+        if (vp_slave->mr_map_base[i] == MAP_FAILED) {
+            error_report("SET_MEM_TABLE: map peer memory region %d failed", i);
+            return -1;
+        }
+
+        mr_qva = vp_slave->mr_map_base[i] + pmem_region[i].mmap_offset;
+        memory_region_init_ram_ptr(&sub_mr[i], NULL, "Peer Memory",
+                                   pmem_region[i].memory_size, mr_qva);
+        memory_region_add_subregion(bar_mr, bar_map_offset, &sub_mr[i]);
+        bar_map_offset += pmem_region[i].memory_size;
+        pmem_msg->regions[i].gpa = pmem_region[i].guest_phys_addr;
+        pmem_msg->regions[i].size = pmem_region[i].memory_size;
+    }
+    vp_slave->bar_map_offset = bar_map_offset;
+
+    return 0;
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -116,7 +201,7 @@ static int vp_slave_can_read(void *opaque)
 
 static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
 {
-    int ret;
+    int ret, fd_num, fds[MAX_GUEST_REGION];
     VhostUserMsg msg;
     uint8_t *p = (uint8_t *) &msg;
     CharBackend *chr_be = (CharBackend *)opaque;
@@ -171,6 +256,10 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
         break;
     case VHOST_USER_SET_OWNER:
         break;
+    case VHOST_USER_SET_MEM_TABLE:
+        fd_num = qemu_chr_fe_get_msgfds(chr_be, fds, sizeof(fds) / sizeof(int));
+        vp_slave_set_mem_table(&msg, fds, fd_num);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
@@ -204,6 +293,8 @@ int vhost_pci_slave_init(QemuOpts *opts)
         return -1;
     }
     vp_slave->feature_bits =  1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
+    vp_slave->bar_mr = NULL;
+    vp_slave->sub_mr = NULL;
     qemu_chr_fe_init(&vp_slave->chr_be, chr, &error_abort);
     qemu_chr_fe_set_handlers(&vp_slave->chr_be, vp_slave_can_read,
                              vp_slave_read, vp_slave_event,
@@ -214,7 +305,10 @@ int vhost_pci_slave_init(QemuOpts *opts)
 
 int vhost_pci_slave_cleanup(void)
 {
+    vp_slave_cleanup();
     qemu_chr_fe_deinit(&vp_slave->chr_be);
+    g_free(vp_slave->sub_mr);
+    g_free(vp_slave->bar_mr);
     g_free(vp_slave);
 
     return 0;
include/hw/virtio/vhost-pci-slave.h +9 -0
index 8b162dc..03e23eb 100644
@@ -2,11 +2,20 @@
 #define QEMU_VHOST_PCI_SLAVE_H
 
 #include "sysemu/char.h"
+#include "exec/memory.h"
+#include "standard-headers/linux/vhost_pci_net.h"
 
 typedef struct VhostPCISlave {
     CharBackend chr_be;
     uint16_t dev_type;
     uint64_t feature_bits;
+    /* hotplugged memory should be mapped following the offset */
+    uint64_t bar_map_offset;
+    MemoryRegion *bar_mr;
+    MemoryRegion *sub_mr;
+    void *mr_map_base[MAX_GUEST_REGION];
+    uint64_t mr_map_size[MAX_GUEST_REGION];
+    struct peer_mem_msg pmem_msg;
 } VhostPCISlave;
 
 extern VhostPCISlave *vp_slave;
include/standard-headers/linux/vhost_pci_net.h +11 -0
index bac293f..f4c8d0b 100644
@@ -29,6 +29,17 @@
 
 #include "standard-headers/linux/virtio_ids.h"
 
+struct pmem_region_msg {
+	uint64_t gpa;
+	uint64_t size;
+};
+
+#define MAX_GUEST_REGION 8
+struct peer_mem_msg {
+	uint32_t nregions;
+	struct pmem_region_msg regions[MAX_GUEST_REGION];
+};
+
 #define VPNET_S_LINK_UP	1	/* Link is up */
 
 struct vhost_pci_net_config {
Signature · 1 line
2.7.4
author
#16 lore raw

PATCH RESEND 16/37 vhost-pci-slave/msg: VHOST_USER_SET_VRING_NUM

In reply to Wei Wang

The protocol doesn't have a message to tell the slave how many virtqueues that the master device has. So, the slave side implementation uses a list to manage the virtqueue info sent from the master. SET_VRING_NUM is the first virtqueue info passed from the master, so the slave allocates a node when receiving this message, and inserts the node to the head of the list. Subsequent virtqueue info (e.g. base, addresses) will be updated to the head node.

The list of virtqueue info will be packed together and delievered to the driver via the controlq.

---
 hw/virtio/vhost-pci-slave.c         | 28 ++++++++++++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  7 +++++++
 2 files changed, 35 insertions(+)
hw/virtio/vhost-pci-slave.c +28 -0
index 9d42566..77a2f68 100644
@@ -30,6 +30,7 @@ static void vp_slave_cleanup(void)
 {
     int ret;
     uint32_t i, nregions;
+    PeerVqNode *pvq_node;
 
     nregions = vp_slave->pmem_msg.nregions;
     for (i = 0; i < nregions; i++) {
@@ -39,6 +40,13 @@ static void vp_slave_cleanup(void)
         }
         memory_region_del_subregion(vp_slave->bar_mr, vp_slave->sub_mr + i);
     }
+
+    if (!QLIST_EMPTY(&vp_slave->pvq_list)) {
+        QLIST_FOREACH(pvq_node, &vp_slave->pvq_list, node)
+            g_free(pvq_node);
+    }
+    QLIST_INIT(&vp_slave->pvq_list);
+    vp_slave->pvq_num = 0;
 }
 
 static int vp_slave_write(CharBackend *chr_be, VhostUserMsg *msg)
@@ -194,6 +202,20 @@ static int vp_slave_set_mem_table(VhostUserMsg *msg, int *fds, int fd_num)
     return 0;
 }
 
+static void vp_slave_alloc_pvq_node(void)
+{
+    PeerVqNode *pvq_node = g_malloc0(sizeof(PeerVqNode));
+    QLIST_INSERT_HEAD(&vp_slave->pvq_list, pvq_node, node);
+    vp_slave->pvq_num++;
+}
+
+static void vp_slave_set_vring_num(VhostUserMsg *msg)
+{
+    PeerVqNode *pvq_node = QLIST_FIRST(&vp_slave->pvq_list);
+
+    pvq_node->vring_num = msg->payload.u64;
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -260,6 +282,10 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
         fd_num = qemu_chr_fe_get_msgfds(chr_be, fds, sizeof(fds) / sizeof(int));
         vp_slave_set_mem_table(&msg, fds, fd_num);
         break;
+    case VHOST_USER_SET_VRING_NUM:
+        vp_slave_alloc_pvq_node();
+        vp_slave_set_vring_num(&msg);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
@@ -295,6 +321,8 @@ int vhost_pci_slave_init(QemuOpts *opts)
     vp_slave->feature_bits =  1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
     vp_slave->bar_mr = NULL;
     vp_slave->sub_mr = NULL;
+    QLIST_INIT(&vp_slave->pvq_list);
+    vp_slave->pvq_num = 0;
     qemu_chr_fe_init(&vp_slave->chr_be, chr, &error_abort);
     qemu_chr_fe_set_handlers(&vp_slave->chr_be, vp_slave_can_read,
                              vp_slave_read, vp_slave_event,
include/hw/virtio/vhost-pci-slave.h +7 -0
index 03e23eb..fe4824c 100644
@@ -5,6 +5,11 @@
 #include "exec/memory.h"
 #include "standard-headers/linux/vhost_pci_net.h"
 
+typedef struct PeerVqNode {
+    uint32_t vring_num;
+    QLIST_ENTRY(PeerVqNode) node;
+} PeerVqNode;
+
 typedef struct VhostPCISlave {
     CharBackend chr_be;
     uint16_t dev_type;
@@ -16,6 +21,8 @@ typedef struct VhostPCISlave {
     void *mr_map_base[MAX_GUEST_REGION];
     uint64_t mr_map_size[MAX_GUEST_REGION];
     struct peer_mem_msg pmem_msg;
+    uint16_t pvq_num;
+    QLIST_HEAD(, PeerVqNode) pvq_list;
 } VhostPCISlave;
 
 extern VhostPCISlave *vp_slave;
Signature · 1 line
2.7.4
author
#17 lore raw

PATCH RESEND 17/37 vhost-pci-slave/msg: VHOST_USER_SET_VRING_BASE

In reply to Wei Wang

Update last_avail_idx to the head node in the list.

---
 hw/virtio/vhost-pci-slave.c         | 10 ++++++++++
 include/hw/virtio/vhost-pci-slave.h |  1 +
 2 files changed, 11 insertions(+)
hw/virtio/vhost-pci-slave.c +10 -0
index 77a2f68..a74b16c 100644
@@ -216,6 +216,13 @@ static void vp_slave_set_vring_num(VhostUserMsg *msg)
     pvq_node->vring_num = msg->payload.u64;
 }
 
+static void vp_slave_set_vring_base(VhostUserMsg *msg)
+{
+    PeerVqNode *pvq_node = QLIST_FIRST(&vp_slave->pvq_list);
+
+    pvq_node->last_avail_idx = msg->payload.u64;
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -286,6 +293,9 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
         vp_slave_alloc_pvq_node();
         vp_slave_set_vring_num(&msg);
         break;
+    case VHOST_USER_SET_VRING_BASE:
+        vp_slave_set_vring_base(&msg);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-pci-slave.h +1 -0
index fe4824c..cfe4107 100644
@@ -6,6 +6,7 @@
 #include "standard-headers/linux/vhost_pci_net.h"
 
 typedef struct PeerVqNode {
+    uint16_t last_avail_idx;
     uint32_t vring_num;
     QLIST_ENTRY(PeerVqNode) node;
 } PeerVqNode;
Signature · 1 line
2.7.4
author
#18 lore raw

PATCH RESEND 18/37 vhost-user: send guest physical address of virtqueues to the slave

In reply to Wei Wang

In the vhost-pci case, the slave needs the master side guest physical address, rather than the qemu virtual address.

---
 hw/virtio/vhost.c         | 64 +++++++++++++++++++++++++++++++++--------------
 include/hw/virtio/vhost.h |  2 ++
 2 files changed, 47 insertions(+), 19 deletions(-)
hw/virtio/vhost.c +45 -19
index f7f7023..e945be8 100644
@@ -26,6 +26,7 @@
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
 #include "migration/migration.h"
+#include "hw/virtio/vhost-user.h"
 
 /* enabled until disconnected backend stabilizes */
 #define _VHOST_DEBUG 1
@@ -858,6 +859,12 @@ static int vhost_virtqueue_set_vring_endian_legacy(struct vhost_dev *dev,
     return -errno;
 }
 
+bool vhost_pci_enabled(struct vhost_dev *dev)
+{
+    return ((dev->protocol_features &
+            (1ULL << VHOST_USER_PROTOCOL_F_VHOST_PCI)) != 0);
+}
+
 static int vhost_virtqueue_start(struct vhost_dev *dev,
                                 struct VirtIODevice *vdev,
                                 struct vhost_virtqueue *vq,
@@ -901,26 +908,40 @@ static int vhost_virtqueue_start(struct vhost_dev *dev,
         }
     }
 
-    vq->desc_size = s = l = virtio_queue_get_desc_size(vdev, idx);
     vq->desc_phys = a = virtio_queue_get_desc_addr(vdev, idx);
-    vq->desc = cpu_physical_memory_map(a, &l, 0);
-    if (!vq->desc || l != s) {
-        r = -ENOMEM;
-        goto fail_alloc_desc;
+    if (vhost_pci_enabled(dev)) {
+        vq->desc = (void *)a;
+    } else {
+        vq->desc_size = s = l = virtio_queue_get_desc_size(vdev, idx);
+        vq->desc = cpu_physical_memory_map(a, &l, 0);
+        if (!vq->desc || l != s) {
+            r = -ENOMEM;
+            goto fail_alloc_desc;
+        }
     }
+
     vq->avail_size = s = l = virtio_queue_get_avail_size(vdev, idx);
     vq->avail_phys = a = virtio_queue_get_avail_addr(vdev, idx);
-    vq->avail = cpu_physical_memory_map(a, &l, 0);
-    if (!vq->avail || l != s) {
-        r = -ENOMEM;
-        goto fail_alloc_avail;
+    if (vhost_pci_enabled(dev)) {
+        vq->avail = (void *)a;
+    } else {
+        vq->avail = cpu_physical_memory_map(a, &l, 0);
+        if (!vq->avail || l != s) {
+            r = -ENOMEM;
+            goto fail_alloc_avail;
+        }
     }
+
     vq->used_size = s = l = virtio_queue_get_used_size(vdev, idx);
     vq->used_phys = a = virtio_queue_get_used_addr(vdev, idx);
-    vq->used = cpu_physical_memory_map(a, &l, 1);
-    if (!vq->used || l != s) {
-        r = -ENOMEM;
-        goto fail_alloc_used;
+    if (vhost_pci_enabled(dev)) {
+        vq->used = (void *)a;
+    } else {
+        vq->used = cpu_physical_memory_map(a, &l, 1);
+        if (!vq->used || l != s) {
+            r = -ENOMEM;
+            goto fail_alloc_used;
+        }
     }
 
     r = vhost_virtqueue_set_addr(dev, vq, vhost_vq_index, dev->log_enabled);
@@ -1003,12 +1024,17 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
                                                 vhost_vq_index);
     }
 
-    cpu_physical_memory_unmap(vq->used, virtio_queue_get_used_size(vdev, idx),
-                              1, virtio_queue_get_used_size(vdev, idx));
-    cpu_physical_memory_unmap(vq->avail, virtio_queue_get_avail_size(vdev, idx),
-                              0, virtio_queue_get_avail_size(vdev, idx));
-    cpu_physical_memory_unmap(vq->desc, virtio_queue_get_desc_size(vdev, idx),
-                              0, virtio_queue_get_desc_size(vdev, idx));
+    if (!vhost_pci_enabled(dev)) {
+        cpu_physical_memory_unmap(vq->used,
+                                  virtio_queue_get_used_size(vdev, idx),
+                                  1, virtio_queue_get_used_size(vdev, idx));
+        cpu_physical_memory_unmap(vq->avail,
+                                  virtio_queue_get_avail_size(vdev, idx),
+                                  0, virtio_queue_get_avail_size(vdev, idx));
+        cpu_physical_memory_unmap(vq->desc,
+                                  virtio_queue_get_desc_size(vdev, idx),
+                                  0, virtio_queue_get_desc_size(vdev, idx));
+    }
 }
 
 static void vhost_eventfd_add(MemoryListener *listener,
include/hw/virtio/vhost.h +2 -0
index 9cf32e2..9955e07 100644
@@ -92,4 +92,6 @@ bool vhost_has_free_slot(void);
 int vhost_net_set_backend(struct vhost_dev *hdev,
                           struct vhost_vring_file *file);
 
+bool vhost_pci_enabled(struct vhost_dev *dev);
+
 #endif
Signature · 1 line
2.7.4
author
#19 lore raw

PATCH RESEND 19/37 vhost-pci-slave/msg: VHOST_USER_SET_VRING_ADDR

In reply to Wei Wang

Update the virtqueue addresses to the head node of the list.

---
 hw/virtio/vhost-pci-slave.c         | 10 ++++++++++
 include/hw/virtio/vhost-pci-slave.h |  3 +++
 2 files changed, 13 insertions(+)
hw/virtio/vhost-pci-slave.c +10 -0
index a74b16c..5ddcb8f 100644
@@ -223,6 +223,13 @@ static void vp_slave_set_vring_base(VhostUserMsg *msg)
     pvq_node->last_avail_idx = msg->payload.u64;
 }
 
+static void vp_slave_set_vring_addr(VhostUserMsg *msg)
+{
+    PeerVqNode *pvq_node = QLIST_FIRST(&vp_slave->pvq_list);
+    memcpy(&pvq_node->addr, &msg->payload.addr,
+           sizeof(struct vhost_vring_addr));
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -296,6 +303,9 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
     case VHOST_USER_SET_VRING_BASE:
         vp_slave_set_vring_base(&msg);
         break;
+    case VHOST_USER_SET_VRING_ADDR:
+        vp_slave_set_vring_addr(&msg);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-pci-slave.h +3 -0
index cfe4107..439198d 100644
@@ -1,6 +1,8 @@
 #ifndef QEMU_VHOST_PCI_SLAVE_H
 #define QEMU_VHOST_PCI_SLAVE_H
 
+#include <linux/vhost.h>
+
 #include "sysemu/char.h"
 #include "exec/memory.h"
 #include "standard-headers/linux/vhost_pci_net.h"
@@ -8,6 +10,7 @@
 typedef struct PeerVqNode {
     uint16_t last_avail_idx;
     uint32_t vring_num;
+    struct vhost_vring_addr addr;
     QLIST_ENTRY(PeerVqNode) node;
 } PeerVqNode;
 
Signature · 1 line
2.7.4
author
#20 lore raw

PATCH RESEND 20/37 vhost-pci-slave/msg: VHOST_USER_SET_VRING_KICK

In reply to Wei Wang

Update the kickfd to the head node in the list.

This version of vhost-pci expects the driver to use polling to receive packets. So, other than storing the kickfd, we don't do anything more.

---
 hw/virtio/vhost-pci-slave.c         | 19 +++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  1 +
 2 files changed, 20 insertions(+)
hw/virtio/vhost-pci-slave.c +19 -0
index 5ddcb8f..1286ab6 100644
@@ -11,6 +11,7 @@
  */
 
 #include <qemu/osdep.h>
+#include <qemu/sockets.h>
 
 #include "qapi/error.h"
 #include "qemu/error-report.h"
@@ -230,6 +231,13 @@ static void vp_slave_set_vring_addr(VhostUserMsg *msg)
            sizeof(struct vhost_vring_addr));
 }
 
+static void vp_slave_set_vring_kick(int fd)
+{
+    PeerVqNode *pvq_node = QLIST_FIRST(&vp_slave->pvq_list);
+    if (!pvq_node)
+        pvq_node->kickfd = fd;
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -306,6 +314,17 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
     case VHOST_USER_SET_VRING_ADDR:
         vp_slave_set_vring_addr(&msg);
         break;
+    case VHOST_USER_SET_VRING_KICK:
+        /* consume the fd */
+        qemu_chr_fe_get_msgfds(chr_be, fds, 1);
+        vp_slave_set_vring_kick(fds[0]);
+        /*
+         * This is a non-blocking eventfd.
+         * The receive function forces it to be blocking,
+         * so revert it back to non-blocking.
+         */
+        qemu_set_nonblock(fds[0]);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-pci-slave.h +1 -0
index 439198d..4b6b213 100644
@@ -10,6 +10,7 @@
 typedef struct PeerVqNode {
     uint16_t last_avail_idx;
     uint32_t vring_num;
+    int kickfd;
     struct vhost_vring_addr addr;
     QLIST_ENTRY(PeerVqNode) node;
 } PeerVqNode;
Signature · 1 line
2.7.4
author
#21 lore raw

PATCH RESEND 21/37 vhost-pci-slave/msg: VHOST_USER_SET_VRING_CALL

In reply to Wei Wang

Update the callfd to the head node in the list.

This version of vhost-pci expects the master device to use polling to receive packets, so callfd is recorded here for tomorrow's implementation.

---
 hw/virtio/vhost-pci-slave.c         | 18 ++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  1 +
 2 files changed, 19 insertions(+)
hw/virtio/vhost-pci-slave.c +18 -0
index 1286ab6..5bb1285 100644
@@ -238,6 +238,13 @@ static void vp_slave_set_vring_kick(int fd)
         pvq_node->kickfd = fd;
 }
 
+static void vp_slave_set_vring_call(int fd)
+{
+    PeerVqNode *pvq_node = QLIST_FIRST(&vp_slave->pvq_list);
+    if (pvq_node)
+        pvq_node->callfd = fd;
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -325,6 +332,17 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
          */
         qemu_set_nonblock(fds[0]);
         break;
+    case VHOST_USER_SET_VRING_CALL:
+        /* consume the fd */
+        qemu_chr_fe_get_msgfds(chr_be, fds, 1);
+        vp_slave_set_vring_call(fds[0]);
+        /*
+         * This is a non-blocking eventfd.
+         * The receive function forces it to be blocking,
+         * so revert it back to non-blocking.
+         */
+        qemu_set_nonblock(fds[0]);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-pci-slave.h +1 -0
index 4b6b213..f6206a1 100644
@@ -11,6 +11,7 @@ typedef struct PeerVqNode {
     uint16_t last_avail_idx;
     uint32_t vring_num;
     int kickfd;
+    int callfd;
     struct vhost_vring_addr addr;
     QLIST_ENTRY(PeerVqNode) node;
 } PeerVqNode;
Signature · 1 line
2.7.4
author
#22 lore raw

PATCH RESEND 22/37 vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE

In reply to Wei Wang

Enable/Disable the corresponding virtqueue pairs in the list.

---
 hw/virtio/vhost-pci-slave.c         | 15 +++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  1 +
 2 files changed, 16 insertions(+)
hw/virtio/vhost-pci-slave.c +15 -0
index 5bb1285..4b4d3c8 100644
@@ -245,6 +245,18 @@ static void vp_slave_set_vring_call(int fd)
         pvq_node->callfd = fd;
 }
 
+static void vp_slave_set_vring_enable(VhostUserMsg *msg)
+{
+    struct vhost_vring_state *state = &msg->payload.state;
+    PeerVqNode *pvq_node;
+    QLIST_FOREACH(pvq_node, &vp_slave->pvq_list, node) {
+        if (pvq_node->vring_num == state->index) {
+            pvq_node->enabled = (int)state->num;
+            break;
+        }
+    }
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -343,6 +355,9 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
          */
         qemu_set_nonblock(fds[0]);
         break;
+    case VHOST_USER_SET_VRING_ENABLE:
+        vp_slave_set_vring_enable(&msg);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-pci-slave.h +1 -0
index f6206a1..3e0f4c7 100644
@@ -12,6 +12,7 @@ typedef struct PeerVqNode {
     uint32_t vring_num;
     int kickfd;
     int callfd;
+    int enabled;
     struct vhost_vring_addr addr;
     QLIST_ENTRY(PeerVqNode) node;
 } PeerVqNode;
Signature · 1 line
2.7.4
author
#23 lore raw

PATCH RESEND 23/37 vhost-pci-slave/msg: VHOST_USER_SET_LOG_BASE

In reply to Wei Wang

Live migration is not supported in this version, so do nothing here.

---
 hw/virtio/vhost-pci-slave.c | 2 ++
 1 file changed, 2 insertions(+)
hw/virtio/vhost-pci-slave.c +2 -0
index 4b4d3c8..799eb1e 100644
@@ -358,6 +358,8 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
     case VHOST_USER_SET_VRING_ENABLE:
         vp_slave_set_vring_enable(&msg);
         break;
+    case VHOST_USER_SET_LOG_BASE:
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
Signature · 1 line
2.7.4
author
#24 lore raw

PATCH RESEND 24/37 vhost-pci-slave/msg: VHOST_USER_SET_LOG_FD

In reply to Wei Wang

Not implemented in this version.

---
 hw/virtio/vhost-pci-slave.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/virtio/vhost-pci-slave.c +4 -0
index 799eb1e..7d451b4 100644
@@ -360,6 +360,10 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
         break;
     case VHOST_USER_SET_LOG_BASE:
         break;
+    case VHOST_USER_SET_LOG_FD:
+        qemu_chr_fe_get_msgfds(chr_be, fds, 1);
+        close(fds[0]);
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
Signature · 1 line
2.7.4
author
#25 lore raw

PATCH RESEND 25/37 vhost-pci-slave/msg: VHOST_USER_SEND_RARP

In reply to Wei Wang

Not implemented in this version.

---
 hw/virtio/vhost-pci-slave.c | 2 ++
 1 file changed, 2 insertions(+)
hw/virtio/vhost-pci-slave.c +2 -0
index 7d451b4..2cb84ed 100644
@@ -364,6 +364,8 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
         qemu_chr_fe_get_msgfds(chr_be, fds, 1);
         close(fds[0]);
         break;
+    case VHOST_USER_SEND_RARP:
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
Signature · 1 line
2.7.4
author
#26 lore raw

PATCH RESEND 26/37 vhost-pci-slave/msg: VHOST_USER_GET_VRING_BASE

In reply to Wei Wang
---
 hw/virtio/vhost-pci-slave.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
hw/virtio/vhost-pci-slave.c +16 -0
index 2cb84ed..ff9a251 100644
@@ -224,6 +224,16 @@ static void vp_slave_set_vring_base(VhostUserMsg *msg)
     pvq_node->last_avail_idx = msg->payload.u64;
 }
 
+static int vp_slave_get_vring_base(CharBackend *chr_be, VhostUserMsg *msg)
+{
+    /* send back vring base to qemu */
+    msg->flags |= VHOST_USER_REPLY_MASK;
+    msg->size = sizeof(m.payload.state);
+    msg->payload.state.num = 0;
+
+    return vp_slave_write(chr_be, msg);
+}
+
 static void vp_slave_set_vring_addr(VhostUserMsg *msg)
 {
     PeerVqNode *pvq_node = QLIST_FIRST(&vp_slave->pvq_list);
@@ -330,6 +340,12 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
     case VHOST_USER_SET_VRING_BASE:
         vp_slave_set_vring_base(&msg);
         break;
+    case VHOST_USER_GET_VRING_BASE:
+        ret = vp_slave_get_vring_base(chr_be, &msg);
+        if (ret < 0) {
+            goto err_handling;
+        }
+        break;
     case VHOST_USER_SET_VRING_ADDR:
         vp_slave_set_vring_addr(&msg);
         break;
Signature · 1 line
2.7.4
author
#27 lore raw

PATCH RESEND 27/37 vhost-pci-net: pass the info collected by vp_slave to the device

In reply to Wei Wang

When the device is realized, pass the vring info to the device from the slave maintained list. The device uses bar2 to hold the peer VM memory.

---
 hw/net/vhost-pci-net.c                         | 29 ++++++++++++++++++++++++++
 hw/virtio/virtio-pci.c                         | 14 +++++++++++++
 include/hw/virtio/vhost-pci-net.h              |  9 ++++++++
 include/standard-headers/linux/vhost_pci_net.h | 14 +++++++++++++
 4 files changed, 66 insertions(+)
hw/net/vhost-pci-net.c +29 -0
index b9141fd..b3475c2 100644
@@ -20,6 +20,35 @@
 #define VPNET_CQ_SIZE 32
 #define VPNET_RQ_SIZE 256
 
+void vpnet_set_peer_vq_num(VhostPCINet *vpnet, uint16_t num)
+{
+    vpnet->peer_vq_num = num;
+}
+
+void vpnet_init_device_features(VhostPCINet *vpnet, uint64_t features)
+{
+    vpnet->device_features = features;
+}
+
+void vpnet_set_peer_vq_msg(VhostPCINet *vpnet, PeerVqNode *vq_node)
+{
+    struct peer_vq_msg *pvq_msg;
+    uint32_t vring_num = vq_node->vring_num;
+
+    if (vpnet->pvq_msg == NULL) {
+        vpnet->pvq_msg = g_malloc0(sizeof(struct peer_vq_msg) *
+                                  (vring_num + 1));
+    }
+
+    pvq_msg = vpnet->pvq_msg + vring_num;
+    pvq_msg->last_avail_idx = vq_node->last_avail_idx;
+    pvq_msg->vring_num = vring_num;
+    pvq_msg->vring_enable = vq_node->enabled;
+    pvq_msg->desc_gpa = vq_node->addr.desc_user_addr;
+    pvq_msg->avail_gpa = vq_node->addr.avail_user_addr;
+    pvq_msg->used_gpa = vq_node->addr.used_user_addr;
+}
+
 static void vpnet_handle_rq(VirtIODevice *vdev, VirtQueue *vq)
 {
 }
hw/virtio/virtio-pci.c +14 -0
index baf70b4..20cbefc 100644
@@ -2320,7 +2320,21 @@ static void vpnet_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
 {
     VhostPCINetPCI *dev = VHOST_PCI_NET_PCI(vpci_dev);
     DeviceState *vdev = DEVICE(&dev->vdev);
+    int bar_id = 2;
+    PeerVqNode *vq_node;
 
+    qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
+
+    pci_register_bar(&vpci_dev->pci_dev, bar_id,
+                      PCI_BASE_ADDRESS_SPACE_MEMORY |
+                      PCI_BASE_ADDRESS_MEM_PREFETCH |
+                      PCI_BASE_ADDRESS_MEM_TYPE_64,
+                      vp_slave->bar_mr);
+    vpnet_set_peer_vq_num(&dev->vdev, vp_slave->pvq_num);
+    vpnet_init_device_features(&dev->vdev, vp_slave->feature_bits);
+    QLIST_FOREACH(vq_node, &vp_slave->pvq_list, node) {
+        vpnet_set_peer_vq_msg(&dev->vdev, vq_node);
+    }
     object_property_set_bool(OBJECT(vdev), true, "realized", errp);
 }
 
include/hw/virtio/vhost-pci-net.h +9 -0
index 8f2e65f..e813119 100644
@@ -16,6 +16,7 @@
 
 #include "standard-headers/linux/vhost_pci_net.h"
 #include "hw/virtio/virtio.h"
+#include "hw/virtio/vhost-pci-slave.h"
 
 #define TYPE_VHOST_PCI_NET "vhost-pci-net-device"
 #define VHOST_PCI_NET(obj) \
@@ -31,6 +32,14 @@ typedef struct VhostPCINet {
     uint16_t peer_vq_num;
     size_t config_size;
     uint64_t device_features;
+    struct peer_mem_msg pmem_msg;
+    struct peer_vq_msg *pvq_msg;
 } VhostPCINet;
 
+void vpnet_set_peer_vq_num(VhostPCINet *vpnet, uint16_t num);
+
+void vpnet_init_device_features(VhostPCINet *vpnet, uint64_t features);
+
+void vpnet_set_peer_vq_msg(VhostPCINet *vpnet, PeerVqNode *vq_node);
+
 #endif
include/standard-headers/linux/vhost_pci_net.h +14 -0
index f4c8d0b..e525569 100644
@@ -51,4 +51,18 @@ struct vhost_pci_net_config {
 	uint16_t status;
 } QEMU_PACKED;
 
+struct peer_vq_msg {
+	uint16_t last_avail_idx;
+        int32_t  vring_enable;
+	uint32_t vring_num;
+	uint64_t desc_gpa;
+	uint64_t avail_gpa;
+	uint64_t used_gpa;
+};
+
+struct peer_vqs_msg {
+	uint32_t nvqs;
+	struct peer_vq_msg pvq_msg[];
+};
+
 #endif
Signature · 1 line
2.7.4
author
#28 lore raw

PATCH RESEND 28/37 vhost-pci-net: pass the mem and vring info to the driver

In reply to Wei Wang

When DRIVER_OK, the device sends the mem and vring info to the driver via the controlq.

---
 hw/net/vhost-pci-net.c                         | 68 ++++++++++++++++++++++++++
 include/standard-headers/linux/vhost_pci_net.h | 17 +++++++
 2 files changed, 85 insertions(+)
hw/net/vhost-pci-net.c +68 -0
index b3475c2..2560e3d 100644
@@ -14,6 +14,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/iov.h"
 #include "hw/virtio/virtio-access.h"
 #include "hw/virtio/vhost-pci-net.h"
 
@@ -57,8 +58,75 @@ static void vpnet_handle_crq(VirtIODevice *vdev, VirtQueue *vq)
 {
 }
 
+static size_t vpnet_send_crq_msg(VhostPCINet *vpnet,
+                                 struct vpnet_controlq_msg *msg)
+{
+    VirtQueueElement *elem;
+    VirtQueue *vq;
+    size_t msg_len = VPNET_CQ_MSG_HDR_SIZE + msg->size;
+
+    vq = vpnet->crq;
+    if (!virtio_queue_ready(vq)) {
+        return 0;
+    }
+
+    elem = virtqueue_pop(vq, sizeof(VirtQueueElement));
+    if (!elem) {
+        return 0;
+    }
+
+    /* TODO: detect a buffer that's too short, set NEEDS_RESET */
+    iov_from_buf(elem->in_sg, elem->in_num, 0, msg, msg_len);
+
+    virtqueue_push(vq, elem, msg_len);
+    virtio_notify(VIRTIO_DEVICE(vpnet), vq);
+    g_free(elem);
+
+    return msg_len;
+}
+
+static void vpnet_send_peer_mem_msg(VhostPCINet *vpnet)
+{
+    struct vpnet_controlq_msg msg = {
+        .class = VHOST_PCI_CTRL_PEER_MEM_MSG,
+        .size = sizeof(struct peer_mem_msg),
+    };
+    memcpy(&msg.payload.pmem_msg, &vp_slave->pmem_msg, msg.size);
+    vpnet_send_crq_msg(vpnet, &msg);
+}
+
+static void vpnet_send_peer_vq_msg(VhostPCINet *vpnet)
+{
+    struct vpnet_controlq_msg *msg;
+    struct peer_vqs_msg *pvqs_msg;
+    struct peer_vq_msg *pvq_msg;
+    uint16_t pvq_num, msg_size, payload_size;
+
+    pvq_num = vpnet->peer_vq_num;
+    payload_size = sizeof(struct peer_vqs_msg)
+                   + sizeof(struct peer_vq_msg) * pvq_num;
+    msg_size = VPNET_CQ_MSG_HDR_SIZE + payload_size;
+    msg = g_malloc(msg_size);
+    msg->class = VHOST_PCI_CTRL_PEER_VQ_MSG,
+    msg->size = msg_size;
+
+    pvqs_msg = &msg->payload.pvqs_msg;
+    pvqs_msg->nvqs = pvq_num;
+    pvq_msg = pvqs_msg->pvq_msg;
+    memcpy(pvq_msg, vpnet->pvq_msg, payload_size);
+
+    vpnet_send_crq_msg(vpnet, msg);
+    g_free(msg);
+}
+
 static void vpnet_set_status(struct VirtIODevice *vdev, uint8_t status)
 {
+    VhostPCINet *vpnet = VHOST_PCI_NET(vdev);
+
+    if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
+        vpnet_send_peer_mem_msg(vpnet);
+        vpnet_send_peer_vq_msg(vpnet);
+    }
 }
 
 static uint64_t vpnet_get_features(VirtIODevice *vdev, uint64_t features,
include/standard-headers/linux/vhost_pci_net.h +17 -0
index e525569..770171e 100644
@@ -65,4 +65,21 @@ struct peer_vqs_msg {
 	struct peer_vq_msg pvq_msg[];
 };
 
+#define VHOST_PCI_CTRL_PEER_MEM_MSG    0
+#define VHOST_PCI_CTRL_PEER_VQ_MSG     1
+struct vpnet_controlq_msg {
+	uint8_t class;
+	uint8_t cmd;
+	uint16_t size;
+        union {
+		struct peer_mem_msg pmem_msg;
+		struct peer_vqs_msg pvqs_msg;
+	} payload;
+} __attribute__((packed));
+
+static struct vpnet_controlq_msg vpnet_msg __attribute__ ((unused));
+#define VPNET_CQ_MSG_HDR_SIZE (sizeof(vpnet_msg.class) \
+			      + sizeof(vpnet_msg.cmd)  \
+			      + sizeof(vpnet_msg.size))
+
 #endif
Signature · 1 line
2.7.4
author
#29 lore raw

PATCH RESEND 29/37 vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (start)

In reply to Wei Wang

The VHOST_USER_SET_VHOST_PCI msg is used to request the start or stop of the vhost-pci device.

This patch handles the start commandin the slave. When receiving the SET_VHOST_PCI request with the start command, the slave creates a vhost-pci device based on the previously received virtio_id.

---
 hw/virtio/vhost-pci-slave.c    | 53 ++++++++++++++++++++++++++++++++++++++++++
 include/hw/virtio/vhost-user.h |  5 ++++
 2 files changed, 58 insertions(+)
hw/virtio/vhost-pci-slave.c +53 -0
index ff9a251..5c16365 100644
@@ -13,6 +13,7 @@
 #include <qemu/osdep.h>
 #include <qemu/sockets.h>
 
+#include "monitor/qdev.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/virtio-pci.h"
@@ -267,6 +268,52 @@ static void vp_slave_set_vring_enable(VhostUserMsg *msg)
     }
 }
 
+static int vp_slave_device_create(uint16_t virtio_id)
+{
+    Error *local_err = NULL;
+    QemuOpts *opts;
+    DeviceState *dev;
+    char params[50];
+
+    switch (virtio_id) {
+    case VIRTIO_ID_NET:
+        strcpy(params, "driver=vhost-pci-net-pci,id=vhost-pci-0");
+        break;
+    default:
+        error_report("vhost-pci device create: device type %d not supported",
+                     virtio_id);
+    }
+
+    opts = qemu_opts_parse_noisily(qemu_find_opts("device"), params, true);
+    dev = qdev_device_add(opts, &local_err);
+    if (!dev) {
+        qemu_opts_del(opts);
+        return -1;
+    }
+    object_unref(OBJECT(dev));
+    return 0;
+}
+
+static int vp_slave_set_vhost_pci(CharBackend *chr_be, VhostUserMsg *msg)
+{
+    int ret;
+    uint8_t cmd = (uint8_t)msg->payload.u64;
+
+    switch (cmd) {
+    case VHOST_USER_SET_VHOST_PCI_start:
+        ret = vp_slave_device_create(vp_slave->dev_type);
+        if (ret < 0) {
+            return ret;
+        }
+        break;
+    default:
+        error_report("slave pconnection: cmd %d not supported yet", cmd);
+        return -1;
+    }
+
+    return ret;
+}
+
 static int vp_slave_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -382,6 +429,12 @@ static void vp_slave_read(void *opaque, const uint8_t *buf, int size)
         break;
     case VHOST_USER_SEND_RARP:
         break;
+    case VHOST_USER_SET_VHOST_PCI:
+        ret = vp_slave_set_vhost_pci(chr_be, &msg);
+        if (ret < 0) {
+            goto err_handling;
+        }
+        break;
     default:
         error_report("vhost-pci-slave does not support msg request = %d",
                      msg.request);
include/hw/virtio/vhost-user.h +5 -0
index e79a2ec..bf8c6ee 100644
@@ -25,6 +25,10 @@ enum VhostUserProtocolFeature {
                                (1ULL << VHOST_USER_PROTOCOL_F_VHOST_PCI) | \
                           (1ULL << VHOST_USER_PROTOCOL_F_SET_DEVICE_ID))
 
+/* control/status of the vhost-pci device */
+#define VHOST_USER_SET_VHOST_PCI_start    0
+#define VHOST_USER_SET_VHOST_PCI_stop     1
+
 typedef enum VhostUserRequest {
     VHOST_USER_NONE = 0,
     VHOST_USER_GET_FEATURES = 1,
@@ -47,6 +51,7 @@ typedef enum VhostUserRequest {
     VHOST_USER_SET_VRING_ENABLE = 18,
     VHOST_USER_SEND_RARP = 19,
     VHOST_USER_SET_DEVICE_ID = 20,
+    VHOST_USER_SET_VHOST_PCI = 21,
     VHOST_USER_MAX
 } VhostUserRequest;
 
Signature · 1 line
2.7.4
author
#30 lore raw

PATCH RESEND 30/37 vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (stop)

In reply to Wei Wang

The slave removes the slave device when receiving the request with the stop command.

In the case that the master side guest crashes, the crashed guest, typically, will be killed by the admin. This event will be captured via the close of the socket connection, so we can remove the vhost-pci device and free the related resources there.

---
 hw/net/vhost-pci-net.c              |  1 +
 hw/virtio/vhost-pci-slave.c         | 41 +++++++++++++++++++++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  2 ++
 3 files changed, 44 insertions(+)
hw/net/vhost-pci-net.c +1 -0
index 2560e3d..5ad4a9f 100644
@@ -173,6 +173,7 @@ static void vpnet_device_realize(DeviceState *dev, Error **errp)
                                          vpnet_handle_rq);
     }
     vpnet->status = 0;
+    vp_slave->vdev = vdev;
 }
 
 static void vpnet_device_unrealize(DeviceState *dev, Error **errp)
hw/virtio/vhost-pci-slave.c +41 -0

71 lines not on this page · raw message

include/hw/virtio/vhost-pci-slave.h +2 -0
index 3e0f4c7..79e1ffd 100644
@@ -19,6 +19,8 @@ typedef struct PeerVqNode {
 
 typedef struct VhostPCISlave {
     CharBackend chr_be;
+    /* Ponnter to the slave device */
+    VirtIODevice *vdev;
     uint16_t dev_type;
     uint64_t feature_bits;
     /* hotplugged memory should be mapped following the offset */
Signature · 1 line
2.7.4
author
#31 lore raw

PATCH RESEND 31/37 vhost-user/msg: send VHOST_USER_SET_VHOST_PCI (start/stop)

In reply to Wei Wang

The master requests the slave to create or destroy a vhost-pci device.

---
 hw/net/vhost_net.c                | 36 ++++++++++++++++++++++++++++++++++++
 hw/virtio/vhost-user.c            | 17 +++++++++++++++++
 include/hw/virtio/vhost-backend.h |  2 ++
 include/net/vhost_net.h           |  2 ++
 4 files changed, 57 insertions(+)
hw/net/vhost_net.c +36 -0
index 6524503..8256018 100644
@@ -18,6 +18,7 @@
 #include "net/tap.h"
 #include "net/vhost-user.h"
 
+#include "hw/virtio/vhost-user.h"
 #include "hw/virtio/virtio-net.h"
 #include "net/vhost_net.h"
 #include "qemu/error-report.h"
@@ -293,6 +294,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
     VirtioBusState *vbus = VIRTIO_BUS(qbus);
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
+    struct vhost_net *last_net;
     int r, e, i;
 
     if (!k->set_guest_notifiers) {
@@ -338,6 +340,15 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
         }
     }
 
+    last_net = get_vhost_net(ncs[total_queues - 1].peer);
+    if (vhost_pci_enabled(&last_net->dev)) {
+        r = vhost_set_vhost_pci(ncs[total_queues - 1].peer,
+                              VHOST_USER_SET_VHOST_PCI_start);
+        if (r < 0) {
+            goto err_start;
+        }
+    }
+
     return 0;
 
 err_start:
@@ -359,8 +370,15 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs,
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev)));
     VirtioBusState *vbus = VIRTIO_BUS(qbus);
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
+    struct vhost_net *last_net;
     int i, r;
 
+    last_net = get_vhost_net(ncs[total_queues - 1].peer);
+    if (vhost_pci_enabled(&last_net->dev)) {
+        vhost_set_vhost_pci(ncs[total_queues - 1].peer,
+                              VHOST_USER_SET_VHOST_PCI_stop);
+    }
+
     for (i = 0; i < total_queues; i++) {
         vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
     }
@@ -436,6 +454,18 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
     return 0;
 }
 
+int vhost_set_vhost_pci(NetClientState *nc, uint8_t cmd)
+{
+    VHostNetState *net = get_vhost_net(nc);
+    const VhostOps *vhost_ops = net->dev.vhost_ops;
+
+    if (vhost_ops && vhost_ops->vhost_set_vhost_pci) {
+        return vhost_ops->vhost_set_vhost_pci(&net->dev, cmd);
+    }
+
+    return 0;
+}
+
 #else
 uint64_t vhost_net_get_max_queues(VHostNetState *net)
 {
@@ -502,4 +532,10 @@ int vhost_set_vring_enable(NetClientState *nc, int enable)
 {
     return 0;
 }
+
+int vhost_set_vhost_pci(NetClientState *nc, uint8_t cmd)
+{
+    return 0;
+}
+
 #endif
hw/virtio/vhost-user.c +17 -0
index 6391d10..75e3998 100644
@@ -312,6 +312,22 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable)
     return 0;
 }
 
+static int vhost_user_set_vhost_pci(struct vhost_dev *dev, uint8_t cmd)
+{
+    VhostUserMsg msg = {
+        .request = VHOST_USER_SET_VHOST_PCI,
+        .flags = VHOST_USER_VERSION,
+        .payload.u64 = (uint64_t)cmd,
+        .size = sizeof(msg.payload.u64),
+    };
+
+    if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
 static int vhost_user_get_vring_base(struct vhost_dev *dev,
                                      struct vhost_vring_state *ring)
 {
@@ -640,6 +656,7 @@ const VhostOps user_ops = {
         .vhost_reset_device = vhost_user_reset_device,
         .vhost_get_vq_index = vhost_user_get_vq_index,
         .vhost_set_vring_enable = vhost_user_set_vring_enable,
+        .vhost_set_vhost_pci = vhost_user_set_vhost_pci,
         .vhost_requires_shm_log = vhost_user_requires_shm_log,
         .vhost_migration_done = vhost_user_migration_done,
         .vhost_backend_can_merge = vhost_user_can_merge,
include/hw/virtio/vhost-backend.h +2 -0
index 6e90703..60c0833 100644
@@ -67,6 +67,7 @@ typedef int (*vhost_reset_device_op)(struct vhost_dev *dev);
 typedef int (*vhost_get_vq_index_op)(struct vhost_dev *dev, int idx);
 typedef int (*vhost_set_vring_enable_op)(struct vhost_dev *dev,
                                          int enable);
+typedef int (*vhost_set_vhost_pci_op)(struct vhost_dev *dev, uint8_t cmd);
 typedef bool (*vhost_requires_shm_log_op)(struct vhost_dev *dev);
 typedef int (*vhost_migration_done_op)(struct vhost_dev *dev,
                                        char *mac_addr);
@@ -102,6 +103,7 @@ typedef struct VhostOps {
     vhost_reset_device_op vhost_reset_device;
     vhost_get_vq_index_op vhost_get_vq_index;
     vhost_set_vring_enable_op vhost_set_vring_enable;
+    vhost_set_vhost_pci_op vhost_set_vhost_pci;
     vhost_requires_shm_log_op vhost_requires_shm_log;
     vhost_migration_done_op vhost_migration_done;
     vhost_backend_can_merge_op vhost_backend_can_merge;
include/net/vhost_net.h +2 -0
index 5a08eff..82d5987 100644
@@ -35,4 +35,6 @@ int vhost_set_vring_enable(NetClientState * nc, int enable);
 
 uint64_t vhost_net_get_acked_features(VHostNetState *net);
 
+int vhost_set_vhost_pci(NetClientState *nc, uint8_t cmd);
+
 #endif
Signature · 1 line
2.7.4
author
#32 lore raw

PATCH RESEND 32/37 vhost-user: add asynchronous read for the vhost-user master

In reply to Wei Wang

Enable the vhost-user master to asynchronously receive messages from the slave.

---
 hw/virtio/vhost-user.c         | 43 +++++++++++++++++++++++++++++++++++++++++-
 include/hw/virtio/vhost-user.h |  4 ++++
 include/net/vhost-user.h       |  4 ++++
 net/vhost-user.c               | 23 +++++++++++++++++++---
 4 files changed, 70 insertions(+), 4 deletions(-)
hw/virtio/vhost-user.c +42 -1
index 75e3998..e9242a9 100644
@@ -14,7 +14,7 @@
 #include "hw/virtio/vhost-backend.h"
 #include "hw/virtio/vhost-user.h"
 #include "hw/virtio/virtio-net.h"
-#include "sysemu/char.h"
+#include "net/vhost-user.h"
 #include "sysemu/kvm.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
@@ -75,6 +75,47 @@ fail:
     return -1;
 }
 
+int vhost_user_can_read(void *opaque)
+{
+    return VHOST_USER_HDR_SIZE;
+}
+
+void vhost_user_asyn_read(void *opaque, const uint8_t *buf, int size)
+{
+    const char *name = opaque;
+    VhostUserMsg msg;
+    uint8_t *p = (uint8_t *) &msg;
+    CharBackend *chr_be = net_name_to_chr_be(name);
+
+    if (size != VHOST_USER_HDR_SIZE) {
+        error_report("Wrong message size received %d", size);
+        return;
+    }
+
+    memcpy(p, buf, VHOST_USER_HDR_SIZE);
+
+    if (msg.size) {
+        p += VHOST_USER_HDR_SIZE;
+        size = qemu_chr_fe_read_all(chr_be, p, msg.size);
+        if (size != msg.size) {
+            error_report("Wrong message size received %d != %d",
+                           size, msg.size);
+            return;
+        }
+    }
+
+    if (msg.request > VHOST_USER_MAX) {
+        error_report("vhost-user master read incorrect msg");
+    }
+
+    switch (msg.request) {
+    default:
+        error_report("vhost-user master does not support msg request = %d",
+                     msg.request);
+        break;
+    }
+}
+
 static int process_message_reply(struct vhost_dev *dev,
                                  VhostUserRequest request)
 {
include/hw/virtio/vhost-user.h +4 -0
index bf8c6ee..a672ad1 100644
@@ -102,4 +102,8 @@ static VhostUserMsg m __attribute__ ((unused));
 /* The version of the protocol we support */
 #define VHOST_USER_VERSION    (0x1)
 
+int vhost_user_can_read(void *opaque);
+
+void vhost_user_asyn_read(void *opaque, const uint8_t *buf, int size);
+
 #endif
include/net/vhost-user.h +4 -0
index d9e328d..1bb5f1a 100644
@@ -11,8 +11,12 @@
 #ifndef NET_VHOST_USER_H
 #define NET_VHOST_USER_H
 
+#include "sysemu/char.h"
+
 struct vhost_net;
 struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc);
 uint64_t vhost_user_get_acked_features(NetClientState *nc);
 
+CharBackend *net_name_to_chr_be(const char *name);
+
 #endif /* VHOST_USER_H */
net/vhost-user.c +20 -3
index 7aff77e..72010c2 100644
@@ -12,7 +12,7 @@
 #include "clients.h"
 #include "net/vhost_net.h"
 #include "net/vhost-user.h"
-#include "sysemu/char.h"
+#include "hw/virtio/vhost-user.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qmp-commands.h"
@@ -190,6 +190,22 @@ static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond,
     return FALSE;
 }
 
+CharBackend *net_name_to_chr_be(const char *name)
+{
+    NetClientState *ncs[MAX_QUEUE_NUM];
+    VhostUserState *s;
+    int queues;
+
+    queues = qemu_find_net_clients_except(name, ncs,
+                                          NET_CLIENT_DRIVER_NIC,
+                                          MAX_QUEUE_NUM);
+    assert(queues < MAX_QUEUE_NUM);
+
+    s = DO_UPCAST(VhostUserState, nc, ncs[0]);
+
+    return &s->chr;
+}
+
 static void net_vhost_user_event(void *opaque, int event)
 {
     const char *name = opaque;
@@ -265,8 +281,9 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
             error_report_err(err);
             return -1;
         }
-        qemu_chr_fe_set_handlers(&s->chr, NULL, NULL,
-                                 net_vhost_user_event, nc0->name, NULL, true);
+        qemu_chr_fe_set_handlers(&s->chr, vhost_user_can_read,
+                                 vhost_user_asyn_read, net_vhost_user_event,
+                                 nc0->name, NULL, true);
     } while (!s->started);
 
     assert(s->vhost_net);
Signature · 1 line
2.7.4
author
#33 lore raw

PATCH RESEND 33/37 vhost-pci-net: send the negotiated feature bits to the master

In reply to Wei Wang

The slave actively sends the negotiated feature bits to the master. "need_send" is used to detect if the 64-bit feature bits are ready to be sent.

---
 hw/net/vhost-pci-net.c              | 13 +++++++++++++
 hw/virtio/vhost-pci-slave.c         | 21 +++++++++++++++++++++
 include/hw/virtio/vhost-pci-slave.h |  2 ++
 3 files changed, 36 insertions(+)
hw/net/vhost-pci-net.c +13 -0
index 5ad4a9f..8e30281 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/iov.h"
+#include "qemu/error-report.h"
 #include "hw/virtio/virtio-access.h"
 #include "hw/virtio/vhost-pci-net.h"
 
@@ -139,6 +140,18 @@ static uint64_t vpnet_get_features(VirtIODevice *vdev, uint64_t features,
 
 static void vpnet_set_features(VirtIODevice *vdev, uint64_t features)
 {
+    static bool need_send;
+    int ret;
+
+    if (need_send) {
+        need_send = 0;
+        ret = vp_slave_send_feature_bits(features);
+        if (ret < 0) {
+            error_report("failed to send feature bits to the master");
+        }
+    } else {
+        need_send = 1;
+    }
 }
 
 static void vpnet_get_config(VirtIODevice *vdev, uint8_t *config)
hw/virtio/vhost-pci-slave.c +21 -0
index de08324..a966885 100644
@@ -88,6 +88,27 @@ static void vp_slave_set_features(VhostUserMsg *msg)
                              & ~(1 << VHOST_USER_F_PROTOCOL_FEATURES);
 }
 
+static int vp_slave_send_u64(int request, uint64_t u64)
+{
+    VhostUserMsg msg = {
+        .request = request,
+        .flags = VHOST_USER_VERSION,
+        .payload.u64 = u64,
+        .size = sizeof(msg.payload.u64),
+    };
+
+    if (vp_slave_write(&vp_slave->chr_be, &msg) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+int vp_slave_send_feature_bits(uint64_t features)
+{
+    return vp_slave_send_u64(VHOST_USER_SET_FEATURES, features);
+}
+
 static DeviceState *virtio_to_pci_dev(VirtIODevice *vdev, uint16_t virtio_id)
 {
     DeviceState *qdev;
include/hw/virtio/vhost-pci-slave.h +2 -0
index 79e1ffd..e60580a 100644
@@ -40,4 +40,6 @@ extern int vhost_pci_slave_init(QemuOpts *opts);
 
 extern int vhost_pci_slave_cleanup(void);
 
+extern int vp_slave_send_feature_bits(uint64_t features);
+
 #endif
Signature · 1 line
2.7.4
author
#34 lore raw

PATCH RESEND 34/37 vhost-pci-slave: add "peer_reset"

In reply to Wei Wang

Setting "peer_reset" flags that the peer device is about to be reset. This happens when the slave side device driver only accepts a subset of the feature bits offered by the peer device.

The peer device is expected to have a second run of the vhost-user protocol for the re-setup.

---
 hw/net/vhost-pci-net.c              |  4 ++++
 hw/virtio/vhost-pci-slave.c         | 20 ++++++++++++++++++--
 include/hw/virtio/vhost-pci-slave.h |  1 +
 3 files changed, 23 insertions(+), 2 deletions(-)
hw/net/vhost-pci-net.c +4 -0
index 8e30281..3289f4d 100644
@@ -144,6 +144,10 @@ static void vpnet_set_features(VirtIODevice *vdev, uint64_t features)
     int ret;
 
     if (need_send) {
+        if (vp_slave->feature_bits != features) {
+            vp_slave->feature_bits = features;
+            vp_slave->peer_reset = 1;
+        }
         need_send = 0;
         ret = vp_slave_send_feature_bits(features);
         if (ret < 0) {
hw/virtio/vhost-pci-slave.c +18 -2
index a966885..568e258 100644
@@ -38,6 +38,15 @@ static void vp_slave_cleanup(void)
         return;
     }
 
+    /*
+     * if this cleanup is not invoked due to peer reset, re-initialize
+     * the feature bits, so that the slave can work with a new master
+     */
+    if (!vp_slave->peer_reset) {
+        vp_slave->feature_bits =
+                1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
+    }
+
     nregions = vp_slave->pmem_msg.nregions;
     for (i = 0; i < nregions; i++) {
         ret = munmap(vp_slave->mr_map_base[i], vp_slave->mr_map_size[i]);
@@ -167,8 +176,11 @@ static void vp_slave_set_device_type(VhostUserMsg *msg)
 
     switch (vp_slave->dev_type) {
     case VIRTIO_ID_NET:
-        vp_slave->feature_bits |= (VHOST_PCI_FEATURE_BITS
-                                   | VHOST_PCI_NET_FEATURE_BITS);
+        /* Don't initialize the feature bits if they have been negotiated */
+        if (!vp_slave->peer_reset) {
+            vp_slave->feature_bits |= (VHOST_PCI_FEATURE_BITS
+                                       | VHOST_PCI_NET_FEATURE_BITS);
+        }
         break;
     default:
         error_report("device type %d is not supported", vp_slave->dev_type);
@@ -359,6 +371,9 @@ static int vp_slave_set_vhost_pci(CharBackend *chr_be, VhostUserMsg *msg)
 
     switch (cmd) {
     case VHOST_USER_SET_VHOST_PCI_start:
+        if (vp_slave->peer_reset) {
+            vp_slave->peer_reset = 0;
+        }
         ret = vp_slave_device_create(vp_slave->dev_type);
         if (ret < 0) {
             return ret;
@@ -534,6 +549,7 @@ int vhost_pci_slave_init(QemuOpts *opts)
     vp_slave->sub_mr = NULL;
     QLIST_INIT(&vp_slave->pvq_list);
     vp_slave->pvq_num = 0;
+    vp_slave->peer_reset = 0;
     qemu_chr_fe_init(&vp_slave->chr_be, chr, &error_abort);
     qemu_chr_fe_set_handlers(&vp_slave->chr_be, vp_slave_can_read,
                              vp_slave_read, vp_slave_event,
include/hw/virtio/vhost-pci-slave.h +1 -0
index e60580a..dd78ed4 100644
@@ -21,6 +21,7 @@ typedef struct VhostPCISlave {
     CharBackend chr_be;
     /* Ponnter to the slave device */
     VirtIODevice *vdev;
+    bool peer_reset;
     uint16_t dev_type;
     uint64_t feature_bits;
     /* hotplugged memory should be mapped following the offset */
Signature · 1 line
2.7.4
author
#35 lore raw

PATCH RESEND 35/37 vhost-pci-net: start the vhost-pci-net device

In reply to Wei Wang

If the peer device on the other side doesn't need to be reset, then start the device when DRIVER_OK is received.

---
 hw/net/vhost-pci-net.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
hw/net/vhost-pci-net.c +15 -0
index 3289f4d..4f2fab4 100644
@@ -22,6 +22,16 @@
 #define VPNET_CQ_SIZE 32
 #define VPNET_RQ_SIZE 256
 
+static void vpnet_set_link_up(VhostPCINet *vpnet)
+{
+    VirtIODevice *vdev = VIRTIO_DEVICE(vpnet);
+    uint16_t old_status = vpnet->status;
+
+    vpnet->status |= VPNET_S_LINK_UP;
+    if (vpnet->status != old_status)
+        virtio_notify_config(vdev);
+}
+
 void vpnet_set_peer_vq_num(VhostPCINet *vpnet, uint16_t num)
 {
     vpnet->peer_vq_num = num;
@@ -127,6 +137,11 @@ static void vpnet_set_status(struct VirtIODevice *vdev, uint8_t status)
     if (status & VIRTIO_CONFIG_S_DRIVER_OK) {
         vpnet_send_peer_mem_msg(vpnet);
         vpnet_send_peer_vq_msg(vpnet);
+        /* If the peer device is not reset, start the device now */
+        if (!vp_slave->peer_reset) {
+            vdev->status = status;
+            vpnet_set_link_up(vpnet);
+        }
     }
 }
 
Signature · 1 line
2.7.4
author
#36 lore raw

PATCH RESEND 36/37 vhost-user/msg: handling VHOST_USER_SET_FEATURES

In reply to Wei Wang

If the featuer bits sent by the slave are not equal to the ones that were sent by the master, perform a reset of the master device.

---
 hw/net/vhost_net.c       |  2 ++
 hw/virtio/vhost-user.c   | 20 ++++++++++++++++++++
 hw/virtio/virtio-pci.c   | 20 ++++++++++++++++++++
 hw/virtio/virtio-pci.h   |  2 ++
 include/net/vhost-user.h | 14 ++++++++++++++
 net/vhost-user.c         | 14 +++++---------
 6 files changed, 63 insertions(+), 9 deletions(-)
hw/net/vhost_net.c +2 -0
index 8256018..e8a2d4f 100644
@@ -349,6 +349,8 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
         }
     }
 
+    vhost_user_set_master_dev(ncs[0].peer, dev);
+
     return 0;
 
 err_start:
hw/virtio/vhost-user.c +20 -0
index e9242a9..990275f 100644
@@ -12,6 +12,7 @@
 #include "qapi/error.h"
 #include "hw/virtio/vhost.h"
 #include "hw/virtio/vhost-backend.h"
+#include "hw/virtio/virtio-pci.h"
 #include "hw/virtio/vhost-user.h"
 #include "hw/virtio/virtio-net.h"
 #include "net/vhost-user.h"
@@ -75,6 +76,22 @@ fail:
     return -1;
 }
 
+static void handle_slave_acked_features(const char *name, VhostUserMsg *msg)
+{
+    CharBackend *chr_be = net_name_to_chr_be(name);
+    VhostUserState *s = container_of(chr_be, VhostUserState, chr);
+    VirtIODevice *vdev = s->vdev;
+    uint64_t master_features, slave_features;
+
+    master_features = vhost_net_get_acked_features(s->vhost_net)
+                      & ~(1 << VHOST_USER_F_PROTOCOL_FEATURES);
+    slave_features = msg->payload.u64;
+
+    if (master_features != slave_features) {
+        master_reset_virtio_net(vdev);
+    }
+}
+
 int vhost_user_can_read(void *opaque)
 {
     return VHOST_USER_HDR_SIZE;
@@ -109,6 +126,9 @@ void vhost_user_asyn_read(void *opaque, const uint8_t *buf, int size)
     }
 
     switch (msg.request) {
+    case VHOST_USER_SET_FEATURES:
+        handle_slave_acked_features(name, &msg);
+        break;
     default:
         error_report("vhost-user master does not support msg request = %d",
                      msg.request);
hw/virtio/virtio-pci.c +20 -0
index 20cbefc..82b2920 100644
@@ -38,6 +38,7 @@
 #include "qemu/range.h"
 #include "hw/virtio/virtio-bus.h"
 #include "qapi/visitor.h"
+#include "monitor/qdev.h"
 
 #define VIRTIO_PCI_REGION_SIZE(dev)     VIRTIO_PCI_CONFIG_OFF(msix_present(dev))
 
@@ -2257,6 +2258,25 @@ static const TypeInfo virtio_serial_pci_info = {
 
 /* virtio-net-pci */
 
+void master_reset_virtio_net(VirtIODevice *vdev)
+{
+    VirtIONet *net = VIRTIO_NET(vdev);
+    VirtIONetPCI *net_pci = container_of(net, VirtIONetPCI, vdev);
+    VirtIOPCIProxy *proxy = &net_pci->parent_obj;
+    DeviceState *qdev = DEVICE(proxy);
+    DeviceState *qdev_new;
+    Error *err = NULL;
+
+    virtio_pci_reset(qdev);
+    qdev_unplug(qdev, &err);
+    qdev->realized = false;
+    qdev_new = qdev_device_add(qdev->opts, &err);
+    if (!qdev_new) {
+        qemu_opts_del(qdev->opts);
+    }
+    object_unref(OBJECT(qdev));
+}
+
 static Property virtio_net_properties[] = {
     DEFINE_PROP_BIT("ioeventfd", VirtIOPCIProxy, flags,
                     VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT, false),
hw/virtio/virtio-pci.h +2 -0
index 0b4b04f..c41c621 100644
@@ -383,4 +383,6 @@ struct VirtIOCryptoPCI {
 /* Virtio ABI version, if we increment this, we break the guest driver. */
 #define VIRTIO_PCI_ABI_VERSION          0
 
+void master_reset_virtio_net(VirtIODevice *vdev);
+
 #endif
include/net/vhost-user.h +14 -0
index 1bb5f1a..4cd14c9 100644
@@ -12,6 +12,18 @@
 #define NET_VHOST_USER_H
 
 #include "sysemu/char.h"
+#include "net/vhost_net.h"
+
+typedef struct VhostUserState {
+    NetClientState nc;
+    CharBackend chr; /* only queue index 0 */
+    VHostNetState *vhost_net;
+    guint watch;
+    uint64_t acked_features;
+    bool started;
+    /* Pointer to the master device */
+    VirtIODevice *vdev;
+} VhostUserState;
 
 struct vhost_net;
 struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc);
@@ -19,4 +31,6 @@ uint64_t vhost_user_get_acked_features(NetClientState *nc);
 
 CharBackend *net_name_to_chr_be(const char *name);
 
+void vhost_user_set_master_dev(NetClientState *nc, VirtIODevice *vdev);
+
 #endif /* VHOST_USER_H */
net/vhost-user.c +5 -9
index 72010c2..5b31224 100644
@@ -10,7 +10,6 @@
 
 #include "qemu/osdep.h"
 #include "clients.h"
-#include "net/vhost_net.h"
 #include "net/vhost-user.h"
 #include "hw/virtio/vhost-user.h"
 #include "qemu/config-file.h"
@@ -18,14 +17,11 @@
 #include "qmp-commands.h"
 #include "trace.h"
 
-typedef struct VhostUserState {
-    NetClientState nc;
-    CharBackend chr; /* only queue index 0 */
-    VHostNetState *vhost_net;
-    guint watch;
-    uint64_t acked_features;
-    bool started;
-} VhostUserState;
+void vhost_user_set_master_dev(NetClientState *nc, VirtIODevice *vdev)
+{
+    VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
+    s->vdev = vdev;
+}
 
 VHostNetState *vhost_user_get_vhost_net(NetClientState *nc)
 {
Signature · 1 line
2.7.4
author
#37 lore raw

Re: [Qemu-devel] [RESEND Patch v1 36/37] vhost-user/msg: handling VHOST_USER_SET_FEATURES

Quoted 29 lines · Wei Wang

If the featuer bits sent by the slave are not equal to the ones that were sent by the master, perform a reset of the master device.

---
  hw/net/vhost_net.c       |  2 ++
  hw/virtio/vhost-user.c   | 20 ++++++++++++++++++++
  hw/virtio/virtio-pci.c   | 20 ++++++++++++++++++++
  hw/virtio/virtio-pci.h   |  2 ++
  include/net/vhost-user.h | 14 ++++++++++++++
  net/vhost-user.c         | 14 +++++---------
  6 files changed, 63 insertions(+), 9 deletions(-)
hw/net/vhost_net.c +9 -0
index 8256018..e8a2d4f 100644
 
  /* virtio-net-pci */
 
+void master_reset_virtio_net(VirtIODevice *vdev)
+{
+    VirtIONet *net = VIRTIO_NET(vdev);
+    VirtIONetPCI *net_pci = container_of(net, VirtIONetPCI, vdev);
+    VirtIOPCIProxy *proxy = &net_pci->parent_obj;
+    DeviceState *qdev = DEVICE(proxy);
+    DeviceState *qdev_new;
+    Error *err = NULL;
+

hw/net/vhost_net.c

Quoted 10 lines
hw/net/vhost_net.c +10 -0
+    virtio_pci_reset(qdev);
+    qdev_unplug(qdev, &err);
+    qdev->realized = false;
+    qdev_new = qdev_device_add(qdev->opts, &err);
+    if (!qdev_new) {
+        qemu_opts_del(qdev->opts);
+    }
+    object_unref(OBJECT(qdev));
+}
+

I still have a problem with this patch. Looks like the virtio reset here only clears the registers and queue related things. Do we have a power reset of virtio, which has the same effect as re-plugging into the virtio device (the driver probe() are re-invoked and feature bits are re-negotiated). Thanks.

Best,
Wei

author
#38 lore raw

PATCH RESEND 37/37 vl: enable vhost-pci-slave

In reply to Wei Wang

Enable vhost-pci-slave in vl.c

---
 vl.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
vl.c +21 -0
index deb116e..b8649be 100644
@@ -123,6 +123,7 @@ int main(int argc, char **argv)
 #include "sysemu/replay.h"
 #include "qapi/qmp/qerror.h"
 #include "sysemu/iothread.h"
+#include "hw/virtio/vhost-pci-slave.h"
 
 #define MAX_VIRTIO_CONSOLES 1
 #define MAX_SCLP_CONSOLES 1
@@ -180,6 +181,7 @@ bool boot_strict;
 uint8_t *boot_splash_filedata;
 size_t boot_splash_filedata_size;
 uint8_t qemu_extra_params_fw[2];
+bool vhost_pci_slave_enabled;
 
 int icount_align_option;
 
@@ -4065,6 +4067,7 @@ int main(int argc, char **argv, char **envp)
                 if (!opts) {
                     exit(1);
                 }
+                vhost_pci_slave_enabled = true;
                 break;
             default:
                 os_parse_cmd_args(popt->index, optarg);
@@ -4582,6 +4585,16 @@ int main(int argc, char **argv, char **envp)
         exit(1);
     }
 
+    /* check if the vhost-pci-server is enabled */
+    if (vhost_pci_slave_enabled) {
+        int ret;
+        ret = vhost_pci_slave_init(qemu_opts_find(
+                                    qemu_find_opts("vhost-pci-slave"),
+                                    NULL));
+        if (ret < 0)
+            exit(1);
+    }
+
     /* init USB devices */
     if (machine_usb(current_machine)) {
         if (foreach_device_config(DEV_USB, usb_parse) < 0)
@@ -4711,6 +4724,14 @@ int main(int argc, char **argv, char **envp)
     pause_all_vcpus();
     res_free();
 
+    if (vhost_pci_slave_enabled) {
+        int ret;
+        ret = vhost_pci_slave_cleanup();
+        if (ret < 0) {
+            exit(1);
+        }
+    }
+
     /* vhost-user must be cleaned up before chardevs.  */
     net_cleanup();
     audio_cleanup();
Signature · 1 line
2.7.4
#39 lore raw
In reply to Wei Wang
Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.

Hi,

Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.

Type: series
Subject: [Qemu-devel] [RESEND Patch v1 00/37] Implementation of vhost-pci for inter-vm commucation
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=16
make docker-test-quick@centos6
make docker-test-mingw@fedora
make docker-test-build@min-glib
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
beb40e0 vl: enable vhost-pci-slave
0824666 vhost-user/msg: handling VHOST_USER_SET_FEATURES
5870fda vhost-pci-net: start the vhost-pci-net device
6bc2bec vhost-pci-slave: add "peer_reset"
dc3c238 vhost-pci-net: send the negotiated feature bits to the master 3e14cac vhost-user: add asynchronous read for the vhost-user master ef0e17b vhost-user/msg: send VHOST_USER_SET_VHOST_PCI (start/stop) aa299cf vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (stop) ee7b187 vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (start) 4749112 vhost-pci-net: pass the mem and vring info to the driver c057260 vhost-pci-net: pass the info collected by vp_slave to the device e840ce7 vhost-pci-slave/msg: VHOST_USER_GET_VRING_BASE
cf38853 vhost-pci-slave/msg: VHOST_USER_SEND_RARP
8517203 vhost-pci-slave/msg: VHOST_USER_SET_LOG_FD
b6acf7e vhost-pci-slave/msg: VHOST_USER_SET_LOG_BASE
e08d52f vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE
20f33bf vhost-pci-slave/msg: VHOST_USER_SET_VRING_CALL
fe0c39c vhost-pci-slave/msg: VHOST_USER_SET_VRING_KICK
5619835 vhost-pci-slave/msg: VHOST_USER_SET_VRING_ADDR
ec4cc63 vhost-user: send guest physical address of virtqueues to the slave 14b6246 vhost-pci-slave/msg: VHOST_USER_SET_VRING_BASE
71b9da1 vhost-pci-slave/msg: VHOST_USER_SET_VRING_NUM
6daa7d3 vhost-pci-slave/msg: VHOST_USER_SET_MEM_TABLE
8b56999 vhost-pci-slave/msg: VHOST_USER_SET_OWNER
0a4f797 vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_NUM
bfa8984 vhost-pci-slave/msg: VHOST_USER_SET_DEVICE_ID
52088b8 vhost-user/msg: VHOST_USER_PROTOCOL_F_SET_DEVICE_ID 0d625b1 vhost-pci-slave/msg: VHOST_USER_SET_PROTOCOL_FEATURES f346fdd vhost-pci-slave/msg: VHOST_USER_GET_PROTOCOL_FEATURES 2edf22f vhost-pci-slave/msg: VHOST_USER_SET_FEATURES
7001dd0 vhost-pci-slave/msg: VHOST_USER_GET_FEATURES
83c1ba7 vhost-pci-slave: set up the fundamental handlers for the server socket 2cf6b75 vhost-pci-slave: start the implementation of vhost-pci-slave 57f0d47 vl: add the vhost-pci-slave command line option
ba540b8 vhost-user: share the vhost-user protocol related structures c3d68e8 vhost-pci-net: the fundamental implementation of vhost-pci-net-pci 183ce9e vhost-pci-net: the fundamental vhost-pci-net device emulation

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into 'dtc'...
Submodule path 'dtc': checked out '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
BUILD centos6
make[1]: Entering directory `/var/tmp/patchew-tester-tmp-w_6waclo/src'
ARCHIVE qemu.tgz
ARCHIVE dtc.tgz
COPY RUNNER
RUN test-quick in qemu:centos6
Packages installed:
SDL-devel-1.2.14-7.el6_7.1.x86_64
ccache-3.1.6-2.el6.x86_64
epel-release-6-8.noarch
gcc-4.4.7-17.el6.x86_64
git-1.7.1-4.el6_7.1.x86_64
glib2-devel-2.28.8-5.el6.x86_64
libfdt-devel-1.4.0-1.el6.x86_64
make-3.81-23.el6.x86_64
package g++ is not installed
pixman-devel-0.32.8-1.el6.x86_64
tar-1.23-15.el6_8.x86_64
zlib-devel-1.2.3-29.el6.x86_64

Environment variables:
PACKAGES=libfdt-devel ccache tar git make gcc g++ zlib-devel glib2-devel SDL-devel pixman-devel epel-release
HOSTNAME=e46ed646b088
TERM=xterm
MAKEFLAGS= -j16
HISTSIZE=1000
J=16
USER=root
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/
LANG=en_US.UTF-8
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES= dtc
DEBUG=
G_BROKEN_FILENAMES=1
CCACHE_HASHDIR=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install No C++ compiler available; disabling C++ specific optional code

Install prefix    /var/tmp/qemu-build/install
BIOS directory    /var/tmp/qemu-build/install/share/qemu
binary directory  /var/tmp/qemu-build/install/bin

library directory /var/tmp/qemu-build/install/lib module directory /var/tmp/qemu-build/install/lib/qemu libexec directory /var/tmp/qemu-build/install/libexec include directory /var/tmp/qemu-build/install/include config directory /var/tmp/qemu-build/install/etc
local state directory /var/tmp/qemu-build/install/var
Manual directory /var/tmp/qemu-build/install/share/man ELF interp prefix /usr/gnemul/qemu-%M

Source path       /tmp/qemu-test/src
C compiler        cc
Host C compiler   cc
C++ compiler      
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g 
QEMU_CFLAGS       -I/usr/include/pixman-1    -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.14)
GTK support       no 
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no 
nettle kdf        no
libtasn1          no
curses support    no
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  no
VNC PNG support   no
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
COLO support      yes
RDMA support      no
TCG interpreter   no
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes

libcap-ng support no
vhost-net support yes
vhost-scsi support yes
vhost-vsock support yes

Trace backends    log
spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no

build guest agent yes
QGA VSS support no
QGA w32 disk info no
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
debug stack usage no
GlusterFS support no
Archipelago support no

gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
lzo support       no
snappy support    no
bzip2 support     no

NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization no
replication support yes

  GEN     x86_64-softmmu/config-devices.mak.tmp
  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     config-host.h
  GEN     qemu-options.def
  GEN     qmp-commands.h
  GEN     qapi-types.h
  GEN     qapi-visit.h
  GEN     qapi-event.h
  GEN     qmp-introspect.h
  GEN     module_block.h
  GEN     tests/test-qapi-types.h
  GEN     tests/test-qapi-visit.h
  GEN     tests/test-qmp-commands.h
  GEN     tests/test-qapi-event.h
  GEN     tests/test-qmp-introspect.h
  GEN     trace/generated-tracers.h
  GEN     trace/generated-tcg-tracers.h
  GEN     trace/generated-helpers-wrappers.h
  GEN     x86_64-softmmu/config-devices.mak
  GEN     aarch64-softmmu/config-devices.mak
  GEN     trace/generated-helpers.h
  GEN     config-all-devices.mak
  CC      tests/qemu-iotests/socket_scm_helper.o
  GEN     qga/qapi-generated/qga-qapi-types.h
  GEN     qga/qapi-generated/qga-qapi-visit.h
  GEN     qga/qapi-generated/qga-qmp-commands.h
  GEN     qga/qapi-generated/qga-qapi-types.c
  GEN     qga/qapi-generated/qga-qapi-visit.c
  GEN     qapi-visit.c
  GEN     qga/qapi-generated/qga-qmp-marshal.c
  GEN     qmp-introspect.c
  GEN     qapi-types.c
  GEN     qapi-event.c
  CC      qapi/qapi-visit-core.o
  CC      qapi/qapi-dealloc-visitor.o
  CC      qapi/qobject-input-visitor.o
  CC      qapi/qobject-output-visitor.o
  CC      qapi/qmp-registry.o
  CC      qapi/qmp-dispatch.o
  CC      qapi/string-input-visitor.o
  CC      qapi/string-output-visitor.o
  CC      qapi/opts-visitor.o
  CC      qapi/qapi-clone-visitor.o
  CC      qapi/qmp-event.o
  CC      qapi/qapi-util.o
  CC      qobject/qnull.o
  CC      qobject/qint.o
  CC      qobject/qstring.o
  CC      qobject/qdict.o
  CC      qobject/qlist.o
  CC      qobject/qfloat.o
  CC      qobject/qbool.o
  CC      qobject/qjson.o
  CC      qobject/qobject.o
  CC      qobject/json-lexer.o
  CC      qobject/json-streamer.o
  CC      qobject/json-parser.o
  GEN     trace/generated-tracers.c
  CC      trace/control.o
  CC      trace/qmp.o
  CC      util/osdep.o
  CC      util/cutils.o
  CC      util/unicode.o
  CC      util/qemu-timer-common.o
  CC      util/bufferiszero.o
  CC      util/compatfd.o
  CC      util/event_notifier-posix.o
  CC      util/oslib-posix.o
  CC      util/mmap-alloc.o
  CC      util/memfd.o
  CC      util/qemu-openpty.o
  CC      util/path.o
  CC      util/qemu-thread-posix.o
  CC      util/envlist.o
  CC      util/module.o
  CC      util/bitmap.o
  CC      util/hbitmap.o
  CC      util/bitops.o
  CC      util/acl.o
  CC      util/fifo8.o
  CC      util/error.o
  CC      util/qemu-error.o
  CC      util/id.o
  CC      util/iov.o
  CC      util/qemu-config.o
  CC      util/qemu-sockets.o
  CC      util/uri.o
  CC      util/notify.o
  CC      util/qemu-option.o
  CC      util/qemu-progress.o
  CC      util/hexdump.o
  CC      util/crc32c.o
  CC      util/uuid.o
  CC      util/throttle.o
  CC      util/getauxval.o
  CC      util/readline.o
  CC      util/rcu.o
  CC      util/qemu-coroutine-io.o
  CC      util/qemu-coroutine.o
  CC      util/qemu-coroutine-lock.o
  CC      util/qemu-coroutine-sleep.o
  CC      util/coroutine-ucontext.o
  CC      util/buffer.o
  CC      util/timed-average.o
  CC      util/base64.o
  CC      util/log.o
  CC      util/qdist.o
  CC      util/qht.o
  CC      util/range.o
  CC      stubs/arch-query-cpu-model-expansion.o
  CC      crypto/pbkdf-stub.o
  CC      stubs/arch-query-cpu-def.o
  CC      stubs/arch-query-cpu-model-comparison.o
  CC      stubs/arch-query-cpu-model-baseline.o
  CC      stubs/bdrv-next-monitor-owned.o
  CC      stubs/blk-commit-all.o
  CC      stubs/blockdev-close-all-bdrv-states.o
  CC      stubs/clock-warp.o
  CC      stubs/cpu-get-clock.o
  CC      stubs/cpu-get-icount.o
  CC      stubs/error-printf.o
  CC      stubs/fdset-add-fd.o
  CC      stubs/dump.o
  CC      stubs/fdset-remove-fd.o
  CC      stubs/fdset-find-fd.o
  CC      stubs/fdset-get-fd.o
  CC      stubs/gdbstub.o
  CC      stubs/get-fd.o
  CC      stubs/get-next-serial.o
  CC      stubs/get-vm-name.o
  CC      stubs/iothread.o
  CC      stubs/iothread-lock.o
  CC      stubs/is-daemonized.o
  CC      stubs/machine-init-done.o
  CC      stubs/migr-blocker.o
  CC      stubs/mon-is-qmp.o
  CC      stubs/monitor-init.o
  CC      stubs/qtest.o
  CC      stubs/notify-event.o
  CC      stubs/replay.o
  CC      stubs/replay-user.o
  CC      stubs/reset.o
  CC      stubs/runstate-check.o
  CC      stubs/set-fd-handler.o
  CC      stubs/slirp.o
  CC      stubs/sysbus.o
  CC      stubs/trace-control.o
  CC      stubs/uuid.o
  CC      stubs/vm-stop.o
  CC      stubs/cpus.o
  CC      stubs/vmstate.o
  CC      stubs/kvm.o
  CC      stubs/qmp_pc_dimm_device_list.o
  CC      stubs/target-monitor-defs.o
  CC      stubs/target-get-monitor-def.o
  CC      stubs/vhost.o
  CC      stubs/iohandler.o
  CC      stubs/smbios_type_38.o
  CC      stubs/ipmi.o
  CC      stubs/pc_madt_cpu_entry.o
  CC      contrib/ivshmem-client/ivshmem-client.o
  CC      stubs/migration-colo.o
  CC      contrib/ivshmem-client/main.o
  CC      contrib/ivshmem-server/ivshmem-server.o
  CC      contrib/ivshmem-server/main.o
  CC      async.o
  CC      qemu-nbd.o
  CC      thread-pool.o
  CC      block.o
  CC      blockjob.o
  CC      iohandler.o
  CC      main-loop.o
  CC      qemu-timer.o
  CC      aio-posix.o
  CC      qemu-io-cmds.o
  CC      replication.o
  CC      block/raw_bsd.o
  CC      block/qcow.o
  CC      block/vdi.o
  CC      block/vmdk.o
  CC      block/cloop.o
  CC      block/vpc.o
  CC      block/bochs.o
  CC      block/vvfat.o
  CC      block/dmg.o
  CC      block/qcow2.o
  CC      block/qcow2-refcount.o
  CC      block/qcow2-cluster.o
  CC      block/qcow2-snapshot.o
  CC      block/qcow2-cache.o
  CC      block/qed.o
  CC      block/qed-gencb.o
  CC      block/qed-l2-cache.o
  CC      block/qed-table.o
  CC      block/qed-cluster.o
  CC      block/qed-check.o
  CC      block/vhdx.o
  CC      block/vhdx-log.o
  CC      block/vhdx-endian.o
  CC      block/quorum.o
  CC      block/parallels.o
  CC      block/blkdebug.o
  CC      block/blkverify.o
  CC      block/blkreplay.o
  CC      block/block-backend.o
  CC      block/snapshot.o
  CC      block/qapi.o
  CC      block/raw-posix.o
  CC      block/null.o
  CC      block/mirror.o
  CC      block/commit.o
  CC      block/io.o
  CC      block/throttle-groups.o
  CC      block/nbd.o
  CC      block/nbd-client.o
  CC      block/sheepdog.o
  CC      block/accounting.o
  CC      block/dirty-bitmap.o
  CC      block/backup.o
  CC      block/write-threshold.o
  CC      block/replication.o
  CC      block/crypto.o
  CC      nbd/server.o
  CC      nbd/client.o
  CC      nbd/common.o
  CC      crypto/init.o
  CC      crypto/hash.o
  CC      crypto/hash-glib.o
  CC      crypto/aes.o
  CC      crypto/desrfb.o
  CC      crypto/tlscredsanon.o
  CC      crypto/cipher.o
  CC      crypto/tlscreds.o
  CC      crypto/tlscredsx509.o
  CC      crypto/tlssession.o
  CC      crypto/secret.o
  CC      crypto/random-platform.o
  CC      crypto/pbkdf.o
  CC      crypto/ivgen.o
  CC      crypto/ivgen-essiv.o
  CC      crypto/ivgen-plain.o
  CC      crypto/ivgen-plain64.o
  CC      crypto/afsplit.o
  CC      crypto/xts.o
  CC      crypto/block.o
  CC      crypto/block-qcow.o
  CC      crypto/block-luks.o
  CC      io/channel-buffer.o
  CC      io/channel.o
  CC      io/channel-command.o
  CC      io/channel-socket.o
  CC      io/channel-file.o
  CC      io/channel-tls.o
  CC      io/channel-util.o
  CC      io/channel-watch.o
  CC      io/channel-websock.o
  CC      qom/object.o
  CC      io/task.o
  CC      qom/container.o
  CC      qom/qom-qobject.o
  GEN     qemu-img-cmds.h
  CC      qom/object_interfaces.o
  CC      qemu-io.o
  CC      blockdev.o
  CC      qemu-bridge-helper.o
  CC      blockdev-nbd.o
  CC      iothread.o
  CC      device-hotplug.o
  CC      qdev-monitor.o
  CC      os-posix.o
  CC      qemu-char.o
  CC      page_cache.o
  CC      accel.o
  CC      bt-host.o
  CC      bt-vhci.o
  CC      vl.o
  CC      dma-helpers.o
  CC      tpm.o
  CC      device_tree.o
  GEN     qmp-marshal.c
  CC      qmp.o
  CC      audio/audio.o
  CC      hmp.o
  CC      cpus-common.o
  CC      audio/noaudio.o
  CC      audio/wavaudio.o
  CC      audio/mixeng.o
  CC      audio/ossaudio.o
  CC      audio/sdlaudio.o
  CC      audio/wavcapture.o
  CC      backends/rng-egd.o
  CC      backends/rng.o
  CC      backends/rng-random.o
  CC      backends/testdev.o
  CC      backends/msmouse.o
  CC      backends/tpm.o
  CC      backends/hostmem.o
  CC      backends/hostmem-file.o
  CC      backends/hostmem-ram.o
  CC      backends/cryptodev.o
  CC      disas/arm.o
  CC      block/stream.o
  CC      backends/cryptodev-builtin.o
  CC      disas/i386.o
  CC      fsdev/qemu-fsdev-dummy.o
  CC      fsdev/qemu-fsdev-opts.o
  CC      hw/acpi/core.o
  CC      hw/acpi/piix4.o
  CC      hw/acpi/ich9.o
  CC      hw/acpi/pcihp.o
  CC      hw/acpi/tco.o
  CC      hw/acpi/cpu_hotplug.o
  CC      hw/acpi/memory_hotplug.o
  CC      hw/acpi/memory_hotplug_acpi_table.o
  CC      hw/acpi/cpu.o
  CC      hw/acpi/nvdimm.o
  CC      hw/acpi/acpi_interface.o
  CC      hw/acpi/bios-linker-loader.o
  CC      hw/acpi/aml-build.o
  CC      hw/acpi/ipmi.o
  CC      hw/audio/sb16.o
  CC      hw/audio/es1370.o
  CC      hw/audio/ac97.o
  CC      hw/audio/fmopl.o
  CC      hw/audio/adlib.o
  CC      hw/audio/gus.o
  CC      hw/audio/gusemu_hal.o
  CC      hw/audio/cs4231a.o
  CC      hw/audio/intel-hda.o
  CC      hw/audio/gusemu_mixer.o
  CC      hw/audio/hda-codec.o
  CC      hw/audio/pcspk.o
  CC      hw/audio/wm8750.o
  CC      hw/audio/pl041.o
  CC      hw/audio/lm4549.o
  CC      hw/audio/marvell_88w8618.o
  CC      hw/block/block.o
  CC      hw/block/hd-geometry.o
  CC      hw/block/cdrom.o
  CC      hw/block/fdc.o
  CC      hw/block/m25p80.o
  CC      hw/block/nand.o
  CC      hw/block/pflash_cfi01.o
  CC      hw/block/pflash_cfi02.o
  CC      hw/block/ecc.o
  CC      hw/block/onenand.o
  CC      hw/block/nvme.o
  CC      hw/bt/l2cap.o
  CC      hw/bt/core.o
  CC      hw/bt/sdp.o
  CC      hw/bt/hci.o
  CC      hw/bt/hid.o
  CC      hw/bt/hci-csr.o
  CC      hw/char/ipoctal232.o
  CC      hw/char/pl011.o
  CC      hw/char/parallel.o
  CC      hw/char/serial.o
  CC      hw/char/serial-isa.o
  CC      hw/char/serial-pci.o
  CC      hw/char/virtio-console.o
  CC      hw/char/cadence_uart.o
  CC      hw/char/imx_serial.o
  CC      hw/char/debugcon.o
  CC      hw/core/qdev.o
  CC      hw/core/qdev-properties.o
  CC      hw/core/bus.o
  CC      hw/core/fw-path-provider.o
  CC      hw/core/hotplug.o
  CC      hw/core/irq.o
  CC      hw/core/ptimer.o
  CC      hw/core/sysbus.o
  CC      hw/core/null-machine.o
  CC      hw/core/machine.o
  CC      hw/core/loader.o
  CC      hw/core/qdev-properties-system.o
  CC      hw/core/register.o
  CC      hw/core/or-irq.o
  CC      hw/core/platform-bus.o
  CC      hw/display/ads7846.o
  CC      hw/display/pl110.o
  CC      hw/display/cirrus_vga.o
  CC      hw/display/ssd0323.o
  CC      hw/display/ssd0303.o
  CC      hw/display/vga-pci.o
  CC      hw/display/vga-isa.o
  CC      hw/display/vmware_vga.o
  CC      hw/display/blizzard.o
  CC      hw/display/exynos4210_fimd.o
  CC      hw/display/tc6393xb.o
  CC      hw/display/framebuffer.o
  CC      hw/dma/pl080.o
  CC      hw/dma/pl330.o
  CC      hw/dma/i8257.o
  CC      hw/dma/xlnx-zynq-devcfg.o
  CC      hw/gpio/pl061.o
  CC      hw/gpio/max7310.o
  CC      hw/gpio/zaurus.o
  CC      hw/gpio/gpio_key.o
  CC      hw/i2c/core.o
  CC      hw/i2c/smbus.o
  CC      hw/i2c/i2c-ddc.o
  CC      hw/i2c/smbus_eeprom.o
  CC      hw/i2c/versatile_i2c.o
  CC      hw/i2c/smbus_ich9.o
  CC      hw/i2c/pm_smbus.o
  CC      hw/i2c/bitbang_i2c.o
  CC      hw/i2c/exynos4210_i2c.o
  CC      hw/i2c/imx_i2c.o
  CC      hw/ide/core.o
  CC      hw/i2c/aspeed_i2c.o
  CC      hw/ide/pci.o
  CC      hw/ide/atapi.o
  CC      hw/ide/qdev.o
  CC      hw/ide/isa.o
  CC      hw/ide/piix.o
  CC      hw/ide/ich.o
  CC      hw/ide/microdrive.o
  CC      hw/ide/ahci.o
  CC      hw/input/hid.o
  CC      hw/input/lm832x.o
  CC      hw/input/pckbd.o
  CC      hw/input/pl050.o
  CC      hw/input/ps2.o
  CC      hw/input/stellaris_input.o
  CC      hw/input/tsc2005.o
  CC      hw/input/vmmouse.o
  CC      hw/input/virtio-input.o
  CC      hw/input/virtio-input-hid.o
  CC      hw/input/virtio-input-host.o
  CC      hw/intc/i8259_common.o
  CC      hw/intc/i8259.o
  CC      hw/intc/pl190.o
  CC      hw/intc/imx_avic.o
  CC      hw/intc/realview_gic.o
  CC      hw/intc/ioapic_common.o
  CC      hw/intc/arm_gic_common.o
  CC      hw/intc/arm_gic.o
  CC      hw/intc/arm_gicv2m.o
  CC      hw/intc/arm_gicv3_common.o
  CC      hw/intc/arm_gicv3.o
  CC      hw/intc/arm_gicv3_dist.o
  CC      hw/intc/arm_gicv3_redist.o
  CC      hw/intc/arm_gicv3_its_common.o
  CC      hw/intc/intc.o
  CC      hw/ipack/tpci200.o
  CC      hw/ipack/ipack.o
  CC      hw/ipmi/ipmi.o
  CC      hw/ipmi/ipmi_bmc_sim.o
  CC      hw/ipmi/ipmi_bmc_extern.o
  CC      hw/ipmi/isa_ipmi_kcs.o
  CC      hw/ipmi/isa_ipmi_bt.o
  CC      hw/isa/isa-bus.o
  CC      hw/isa/apm.o
  CC      hw/mem/pc-dimm.o
  CC      hw/mem/nvdimm.o
  CC      hw/misc/applesmc.o
  CC      hw/misc/max111x.o
  CC      hw/misc/tmp105.o
  CC      hw/misc/debugexit.o
  CC      hw/misc/sga.o
  CC      hw/misc/pc-testdev.o
  CC      hw/misc/pci-testdev.o
  CC      hw/misc/arm_l2x0.o
  CC      hw/misc/arm_integrator_debug.o
  CC      hw/misc/a9scu.o
  CC      hw/misc/arm11scu.o
  CC      hw/net/ne2000.o
  CC      hw/net/eepro100.o
  CC      hw/net/pcnet-pci.o
  CC      hw/net/pcnet.o
  CC      hw/net/e1000.o
  CC      hw/net/e1000x_common.o
  CC      hw/net/net_rx_pkt.o
  CC      hw/net/net_tx_pkt.o
  CC      hw/net/e1000e.o
  CC      hw/net/e1000e_core.o
  CC      hw/net/vmxnet3.o
  CC      hw/net/rtl8139.o
  CC      hw/net/smc91c111.o
  CC      hw/net/lan9118.o
  CC      hw/net/ne2000-isa.o
  CC      hw/net/xgmac.o
  CC      hw/net/allwinner_emac.o
  CC      hw/net/imx_fec.o
  CC      hw/net/cadence_gem.o
  CC      hw/net/stellaris_enet.o
  CC      hw/net/rocker/rocker.o
  CC      hw/net/rocker/rocker_fp.o
  CC      hw/net/rocker/rocker_desc.o
  CC      hw/net/rocker/rocker_world.o
  CC      hw/net/rocker/rocker_of_dpa.o
  CC      hw/nvram/eeprom93xx.o
  CC      hw/nvram/fw_cfg.o
  CC      hw/nvram/chrp_nvram.o
  CC      hw/pci-bridge/pci_bridge_dev.o
  CC      hw/pci-bridge/pci_expander_bridge.o
  CC      hw/pci-bridge/xio3130_upstream.o
  CC      hw/pci-bridge/xio3130_downstream.o
  CC      hw/pci-bridge/ioh3420.o
  CC      hw/pci-bridge/i82801b11.o
  CC      hw/pci-host/pam.o
  CC      hw/pci-host/versatile.o
  CC      hw/pci-host/piix.o
  CC      hw/pci-host/q35.o
  CC      hw/pci-host/gpex.o
  CC      hw/pci/pci.o
  CC      hw/pci/pci_bridge.o
  CC      hw/pci/msix.o
  CC      hw/pci/msi.o
  CC      hw/pci/shpc.o
  CC      hw/pci/slotid_cap.o
  CC      hw/pci/pci_host.o
  CC      hw/pci/pcie_host.o
  CC      hw/pci/pcie.o
  CC      hw/pci/pcie_aer.o
/tmp/qemu-test/src/hw/nvram/fw_cfg.c: In function ‘fw_cfg_dma_transfer’:
/tmp/qemu-test/src/hw/nvram/fw_cfg.c:329: warning: ‘read’ may be used uninitialized in this function
  CC      hw/pci/pcie_port.o
  CC      hw/pci/pci-stub.o
  CC      hw/pcmcia/pcmcia.o
  CC      hw/scsi/scsi-disk.o
  CC      hw/scsi/scsi-generic.o
  CC      hw/scsi/scsi-bus.o
  CC      hw/scsi/lsi53c895a.o
  CC      hw/scsi/mptsas.o
  CC      hw/scsi/mptconfig.o
  CC      hw/scsi/mptendian.o
  CC      hw/scsi/megasas.o
  CC      hw/scsi/vmw_pvscsi.o
  CC      hw/scsi/esp.o
  CC      hw/scsi/esp-pci.o
  CC      hw/sd/pl181.o
  CC      hw/sd/ssi-sd.o
  CC      hw/sd/sd.o
  CC      hw/sd/core.o
  CC      hw/sd/sdhci.o
  CC      hw/smbios/smbios.o
  CC      hw/smbios/smbios_type_38.o
  CC      hw/ssi/pl022.o
  CC      hw/ssi/ssi.o
  CC      hw/ssi/xilinx_spips.o
  CC      hw/ssi/aspeed_smc.o
  CC      hw/ssi/stm32f2xx_spi.o
  CC      hw/timer/arm_timer.o
  CC      hw/timer/arm_mptimer.o
  CC      hw/timer/a9gtimer.o
  CC      hw/timer/cadence_ttc.o
  CC      hw/timer/ds1338.o
  CC      hw/timer/hpet.o
  CC      hw/timer/i8254_common.o
  CC      hw/timer/i8254.o
  CC      hw/timer/pl031.o
  CC      hw/timer/twl92230.o
  CC      hw/timer/imx_epit.o
  CC      hw/timer/imx_gpt.o
  CC      hw/timer/stm32f2xx_timer.o
  CC      hw/timer/aspeed_timer.o
  CC      hw/tpm/tpm_tis.o
  CC      hw/tpm/tpm_passthrough.o
  CC      hw/tpm/tpm_util.o
  CC      hw/usb/core.o
  CC      hw/usb/combined-packet.o
  CC      hw/usb/bus.o
  CC      hw/usb/libhw.o
  CC      hw/usb/desc.o
  CC      hw/usb/desc-msos.o
  CC      hw/usb/hcd-uhci.o
  CC      hw/usb/hcd-ohci.o
  CC      hw/usb/hcd-ehci.o
  CC      hw/usb/hcd-ehci-pci.o
  CC      hw/usb/hcd-ehci-sysbus.o
  CC      hw/usb/hcd-xhci.o
  CC      hw/usb/hcd-musb.o
  CC      hw/usb/dev-hub.o
  CC      hw/usb/dev-hid.o
  CC      hw/usb/dev-wacom.o
  CC      hw/usb/dev-storage.o
  CC      hw/usb/dev-uas.o
  CC      hw/usb/dev-audio.o
  CC      hw/usb/dev-serial.o
  CC      hw/usb/dev-network.o
  CC      hw/usb/dev-bluetooth.o
  CC      hw/usb/dev-smartcard-reader.o
  CC      hw/usb/dev-mtp.o
  CC      hw/usb/host-stub.o
  CC      hw/virtio/virtio-rng.o
  CC      hw/virtio/virtio-pci.o
  CC      hw/virtio/virtio-bus.o
  CC      hw/virtio/virtio-mmio.o
  CC      hw/virtio/vhost-pci-slave.o
  CC      hw/watchdog/watchdog.o
  CC      hw/watchdog/wdt_i6300esb.o
  CC      hw/watchdog/wdt_ib700.o
  CC      migration/migration.o
  CC      migration/socket.o
  CC      migration/fd.o
  CC      migration/exec.o
  CC      migration/tls.o
  CC      migration/colo-comm.o
  CC      migration/colo.o
  CC      migration/colo-failover.o
  CC      migration/vmstate.o
  CC      migration/qemu-file.o
  CC      migration/qemu-file-channel.o
  CC      migration/xbzrle.o
  CC      migration/postcopy-ram.o
  CC      migration/qjson.o
  CC      migration/block.o
  CC      net/queue.o
  CC      net/net.o
  CC      net/checksum.o
  CC      net/util.o
  CC      net/hub.o
  CC      net/socket.o
  CC      net/dump.o
  CC      net/eth.o
  CC      net/l2tpv3.o
  CC      net/tap.o
  CC      net/vhost-user.o
  CC      net/tap-linux.o
  CC      net/slirp.o
  CC      net/filter.o
  CC      net/filter-mirror.o
  CC      net/filter-buffer.o
  CC      net/colo-compare.o
  CC      net/colo.o
  CC      net/filter-rewriter.o
  CC      qom/cpu.o
  CC      replay/replay.o
  CC      replay/replay-internal.o
  CC      replay/replay-events.o
  CC      replay/replay-time.o
  CC      replay/replay-input.o
  CC      replay/replay-char.o
  CC      replay/replay-snapshot.o
  CC      slirp/cksum.o
/tmp/qemu-test/src/replay/replay-internal.c: In function ‘replay_put_array’:
/tmp/qemu-test/src/replay/replay-internal.c:65: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
  CC      slirp/if.o
  CC      slirp/ip_icmp.o
  CC      slirp/ip6_icmp.o
  CC      slirp/ip6_input.o
  CC      slirp/ip6_output.o
  CC      slirp/ip_input.o
  CC      slirp/ip_output.o
  CC      slirp/dnssearch.o
  CC      slirp/dhcpv6.o
  CC      slirp/slirp.o
  CC      slirp/mbuf.o
  CC      slirp/misc.o
  CC      slirp/sbuf.o
  CC      slirp/socket.o
  CC      slirp/tcp_input.o
  CC      slirp/tcp_output.o
  CC      slirp/tcp_subr.o
  CC      slirp/tcp_timer.o
  CC      slirp/udp.o
  CC      slirp/udp6.o
  CC      slirp/bootp.o
  CC      slirp/tftp.o
  CC      slirp/arp_table.o
  CC      slirp/ndp_table.o
  CC      ui/keymaps.o
  CC      ui/console.o

/tmp/qemu-test/src/slirp/tcp_input.c: In function ‘tcp_input’:
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_p’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_len’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_tos’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_id’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_off’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_ttl’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_sum’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_src.s_addr’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_dst.s_addr’ may be used uninitialized in this function /tmp/qemu-test/src/slirp/tcp_input.c:220: warning: ‘save_ip6.ip_nh’ may be used uninitialized in this function

  CC      ui/cursor.o
  CC      ui/qemu-pixman.o
  CC      ui/input.o
  CC      ui/input-keymap.o
  CC      ui/input-legacy.o
  CC      ui/input-linux.o
  CC      ui/sdl.o
  CC      ui/sdl_zoom.o
  CC      ui/x_keymap.o
  CC      ui/vnc.o
  CC      ui/vnc-enc-zlib.o
  CC      ui/vnc-enc-hextile.o
  CC      ui/vnc-enc-tight.o
  CC      ui/vnc-palette.o
  CC      ui/vnc-enc-zrle.o
  CC      ui/vnc-auth-vencrypt.o
  CC      ui/vnc-ws.o
  CC      ui/vnc-jobs.o
  LINK    tests/qemu-iotests/socket_scm_helper
  CC      qga/commands.o
  CC      qga/guest-agent-command-state.o
  CC      qga/main.o
  CC      qga/commands-posix.o
  CC      qga/channel-posix.o
  CC      qga/qapi-generated/qga-qapi-types.o
  CC      qga/qapi-generated/qga-qapi-visit.o
  CC      qga/qapi-generated/qga-qmp-marshal.o
  CC      qmp-introspect.o
  CC      qapi-types.o
  CC      qapi-visit.o
  CC      qapi-event.o
  AR      libqemustub.a
  CC      qemu-img.o
  CC      qmp-marshal.o
  CC      trace/generated-tracers.o
  AR      libqemuutil.a
  AS      optionrom/multiboot.o
  AS      optionrom/linuxboot.o
  AS      optionrom/kvmvapic.o
  CC      optionrom/linuxboot_dma.o
cc unrecognized option '-no-integrated-as'
cc unrecognized option '-no-integrated-as'
  BUILD   optionrom/linuxboot_dma.img
  BUILD   optionrom/linuxboot_dma.raw
  BUILD   optionrom/multiboot.img
  BUILD   optionrom/linuxboot.img
  SIGN    optionrom/linuxboot_dma.bin
  BUILD   optionrom/kvmvapic.img
  BUILD   optionrom/multiboot.raw
  BUILD   optionrom/linuxboot.raw
  SIGN    optionrom/multiboot.bin
  BUILD   optionrom/kvmvapic.raw
  SIGN    optionrom/linuxboot.bin
  SIGN    optionrom/kvmvapic.bin
/tmp/qemu-test/src/hw/virtio/vhost-pci-slave.c: In function ‘vp_slave_device_del’:
/tmp/qemu-test/src/hw/virtio/vhost-pci-slave.c:123: warning: ‘qdev’ may be used uninitialized in this function
/tmp/qemu-test/src/hw/virtio/vhost-pci-slave.c:123: note: ‘qdev’ was declared here
  LINK    qemu-ga
  LINK    ivshmem-client
  LINK    ivshmem-server
  LINK    qemu-nbd
  LINK    qemu-img
  LINK    qemu-io
  LINK    qemu-bridge-helper
  GEN     x86_64-softmmu/config-target.h
  GEN     x86_64-softmmu/hmp-commands.h
  GEN     x86_64-softmmu/hmp-commands-info.h
  CC      x86_64-softmmu/cpu-exec.o
  CC      x86_64-softmmu/exec.o
  CC      x86_64-softmmu/translate-all.o
  CC      x86_64-softmmu/translate-common.o
  CC      x86_64-softmmu/tcg/optimize.o
  CC      x86_64-softmmu/cpu-exec-common.o
  CC      x86_64-softmmu/tcg/tcg.o
  GEN     aarch64-softmmu/hmp-commands-info.h
  CC      x86_64-softmmu/tcg/tcg-op.o
  GEN     aarch64-softmmu/hmp-commands.h
  CC      x86_64-softmmu/tcg/tcg-common.o
  GEN     aarch64-softmmu/config-target.h
  CC      x86_64-softmmu/fpu/softfloat.o
  CC      x86_64-softmmu/disas.o
  CC      x86_64-softmmu/tcg-runtime.o
  CC      x86_64-softmmu/arch_init.o
  CC      x86_64-softmmu/cpus.o
  CC      x86_64-softmmu/monitor.o
  CC      x86_64-softmmu/ioport.o
  CC      x86_64-softmmu/gdbstub.o
  CC      x86_64-softmmu/balloon.o
  CC      x86_64-softmmu/numa.o
  CC      x86_64-softmmu/qtest.o
  CC      x86_64-softmmu/bootdevice.o
  CC      x86_64-softmmu/kvm-all.o
  CC      x86_64-softmmu/memory.o
  CC      x86_64-softmmu/memory_mapping.o
  CC      x86_64-softmmu/cputlb.o
  CC      x86_64-softmmu/dump.o
  CC      x86_64-softmmu/migration/ram.o
  CC      x86_64-softmmu/migration/savevm.o
  CC      x86_64-softmmu/xen-common-stub.o
  CC      x86_64-softmmu/xen-hvm-stub.o
  CC      x86_64-softmmu/hw/block/virtio-blk.o
  CC      x86_64-softmmu/hw/block/dataplane/virtio-blk.o
  CC      x86_64-softmmu/hw/char/virtio-serial-bus.o
  CC      x86_64-softmmu/hw/core/nmi.o
  CC      x86_64-softmmu/hw/core/generic-loader.o
  CC      x86_64-softmmu/hw/cpu/core.o
  CC      x86_64-softmmu/hw/display/vga.o
  CC      x86_64-softmmu/hw/display/virtio-gpu.o
  CC      x86_64-softmmu/hw/display/virtio-gpu-3d.o
  CC      x86_64-softmmu/hw/display/virtio-gpu-pci.o
  CC      x86_64-softmmu/hw/display/virtio-vga.o
  CC      x86_64-softmmu/hw/intc/apic.o
  CC      x86_64-softmmu/hw/intc/apic_common.o
  CC      x86_64-softmmu/hw/intc/ioapic.o
  CC      x86_64-softmmu/hw/isa/lpc_ich9.o
  CC      x86_64-softmmu/hw/misc/vmport.o
  CC      x86_64-softmmu/hw/misc/ivshmem.o
  CC      x86_64-softmmu/hw/misc/pvpanic.o
  CC      x86_64-softmmu/hw/misc/edu.o
  CC      x86_64-softmmu/hw/misc/hyperv_testdev.o
  CC      x86_64-softmmu/hw/net/virtio-net.o
  CC      aarch64-softmmu/exec.o
  CC      x86_64-softmmu/hw/net/vhost-pci-net.o
  CC      x86_64-softmmu/hw/net/vhost_net.o
  CC      x86_64-softmmu/hw/scsi/virtio-scsi.o
  CC      x86_64-softmmu/hw/scsi/virtio-scsi-dataplane.o
  CC      aarch64-softmmu/translate-all.o
  CC      x86_64-softmmu/hw/scsi/vhost-scsi.o
  CC      x86_64-softmmu/hw/timer/mc146818rtc.o
  CC      aarch64-softmmu/cpu-exec.o
  CC      x86_64-softmmu/hw/vfio/common.o
  CC      aarch64-softmmu/translate-common.o
  CC      aarch64-softmmu/cpu-exec-common.o
  CC      aarch64-softmmu/tcg/tcg.o
  CC      x86_64-softmmu/hw/vfio/pci.o
  CC      aarch64-softmmu/tcg/tcg-op.o
  CC      x86_64-softmmu/hw/vfio/pci-quirks.o
  CC      aarch64-softmmu/tcg/optimize.o
  CC      aarch64-softmmu/tcg/tcg-common.o
  CC      x86_64-softmmu/hw/vfio/platform.o
  CC      aarch64-softmmu/fpu/softfloat.o
  CC      aarch64-softmmu/disas.o
  CC      x86_64-softmmu/hw/vfio/calxeda-xgmac.o
  CC      x86_64-softmmu/hw/vfio/amd-xgbe.o
  CC      aarch64-softmmu/tcg-runtime.o
  CC      x86_64-softmmu/hw/vfio/spapr.o
  CC      x86_64-softmmu/hw/virtio/virtio.o
  GEN     aarch64-softmmu/gdbstub-xml.c
  CC      aarch64-softmmu/kvm-stub.o
  CC      x86_64-softmmu/hw/virtio/virtio-balloon.o
  CC      x86_64-softmmu/hw/virtio/vhost.o
  CC      x86_64-softmmu/hw/virtio/vhost-backend.o
  CC      x86_64-softmmu/hw/virtio/vhost-user.o
  CC      x86_64-softmmu/hw/virtio/vhost-vsock.o
  CC      aarch64-softmmu/arch_init.o
  CC      aarch64-softmmu/cpus.o
  CC      aarch64-softmmu/monitor.o
  CC      aarch64-softmmu/gdbstub.o
  CC      aarch64-softmmu/balloon.o
  CC      x86_64-softmmu/hw/virtio/virtio-crypto.o
  CC      aarch64-softmmu/ioport.o
  CC      aarch64-softmmu/numa.o
  CC      aarch64-softmmu/qtest.o
  CC      aarch64-softmmu/bootdevice.o
  CC      x86_64-softmmu/hw/virtio/virtio-crypto-pci.o
  CC      x86_64-softmmu/hw/i386/multiboot.o
  CC      aarch64-softmmu/memory.o
  CC      aarch64-softmmu/cputlb.o
  CC      aarch64-softmmu/memory_mapping.o
  CC      aarch64-softmmu/dump.o
  CC      x86_64-softmmu/hw/i386/pc.o
  CC      aarch64-softmmu/migration/ram.o
  CC      x86_64-softmmu/hw/i386/pc_piix.o
  CC      x86_64-softmmu/hw/i386/pc_q35.o
  CC      aarch64-softmmu/migration/savevm.o
  CC      aarch64-softmmu/xen-common-stub.o
  CC      x86_64-softmmu/hw/i386/pc_sysfw.o
  CC      aarch64-softmmu/xen-hvm-stub.o
  CC      x86_64-softmmu/hw/i386/x86-iommu.o
  CC      aarch64-softmmu/hw/adc/stm32f2xx_adc.o
  CC      x86_64-softmmu/hw/i386/intel_iommu.o
  CC      x86_64-softmmu/hw/i386/amd_iommu.o
  CC      aarch64-softmmu/hw/block/virtio-blk.o
  CC      x86_64-softmmu/hw/i386/kvmvapic.o
  CC      aarch64-softmmu/hw/block/dataplane/virtio-blk.o
  CC      aarch64-softmmu/hw/char/exynos4210_uart.o
/tmp/qemu-test/src/hw/i386/pc_piix.c: In function ‘igd_passthrough_isa_bridge_create’:
/tmp/qemu-test/src/hw/i386/pc_piix.c:1046: warning: ‘pch_rev_id’ may be used uninitialized in this function
  CC      x86_64-softmmu/hw/i386/acpi-build.o
  CC      x86_64-softmmu/hw/i386/pci-assign-load-rom.o
  CC      aarch64-softmmu/hw/char/omap_uart.o
  CC      aarch64-softmmu/hw/char/stm32f2xx_usart.o
  CC      aarch64-softmmu/hw/char/digic-uart.o
  CC      aarch64-softmmu/hw/char/bcm2835_aux.o
  CC      x86_64-softmmu/hw/i386/kvm/clock.o
  CC      aarch64-softmmu/hw/char/virtio-serial-bus.o
/tmp/qemu-test/src/hw/i386/acpi-build.c: In function ‘build_append_pci_bus_devices’:
/tmp/qemu-test/src/hw/i386/acpi-build.c:501: warning: ‘notify_method’ may be used uninitialized in this function
  CC      aarch64-softmmu/hw/core/nmi.o
  CC      aarch64-softmmu/hw/core/generic-loader.o
  CC      aarch64-softmmu/hw/cpu/arm11mpcore.o
  CC      x86_64-softmmu/hw/i386/kvm/apic.o
  CC      x86_64-softmmu/hw/i386/kvm/i8259.o
  CC      x86_64-softmmu/hw/i386/kvm/ioapic.o
  CC      x86_64-softmmu/hw/i386/kvm/i8254.o
  CC      x86_64-softmmu/hw/i386/kvm/pci-assign.o
  CC      aarch64-softmmu/hw/cpu/a9mpcore.o
  CC      aarch64-softmmu/hw/cpu/realview_mpcore.o
  CC      x86_64-softmmu/target-i386/translate.o
  CC      aarch64-softmmu/hw/cpu/a15mpcore.o
  CC      x86_64-softmmu/target-i386/helper.o
  CC      aarch64-softmmu/hw/cpu/core.o
  CC      x86_64-softmmu/target-i386/cpu.o
  CC      aarch64-softmmu/hw/display/omap_dss.o
  CC      aarch64-softmmu/hw/display/omap_lcdc.o
  CC      aarch64-softmmu/hw/display/pxa2xx_lcd.o
  CC      aarch64-softmmu/hw/display/bcm2835_fb.o
  CC      x86_64-softmmu/target-i386/bpt_helper.o
  CC      x86_64-softmmu/target-i386/excp_helper.o
  CC      aarch64-softmmu/hw/display/virtio-gpu.o
  CC      aarch64-softmmu/hw/display/vga.o
  CC      aarch64-softmmu/hw/display/virtio-gpu-3d.o
  CC      aarch64-softmmu/hw/display/virtio-gpu-pci.o
  CC      aarch64-softmmu/hw/display/dpcd.o
  CC      x86_64-softmmu/target-i386/fpu_helper.o
  CC      x86_64-softmmu/target-i386/cc_helper.o
  CC      x86_64-softmmu/target-i386/int_helper.o
  CC      x86_64-softmmu/target-i386/svm_helper.o
  CC      x86_64-softmmu/target-i386/smm_helper.o
  CC      x86_64-softmmu/target-i386/misc_helper.o
  CC      x86_64-softmmu/target-i386/mem_helper.o
  CC      aarch64-softmmu/hw/display/xlnx_dp.o
  CC      x86_64-softmmu/target-i386/seg_helper.o
  CC      x86_64-softmmu/target-i386/mpx_helper.o
  CC      x86_64-softmmu/target-i386/gdbstub.o
  CC      x86_64-softmmu/target-i386/machine.o
  CC      x86_64-softmmu/target-i386/arch_memory_mapping.o
  CC      aarch64-softmmu/hw/dma/xlnx_dpdma.o
  CC      aarch64-softmmu/hw/dma/omap_dma.o
  CC      x86_64-softmmu/target-i386/arch_dump.o
  CC      x86_64-softmmu/target-i386/monitor.o
  CC      x86_64-softmmu/target-i386/kvm.o
  CC      x86_64-softmmu/target-i386/hyperv.o
  CC      aarch64-softmmu/hw/dma/soc_dma.o
  CC      aarch64-softmmu/hw/dma/pxa2xx_dma.o
  GEN     trace/generated-helpers.c
  CC      aarch64-softmmu/hw/gpio/imx_gpio.o
  CC      aarch64-softmmu/hw/i2c/omap_i2c.o
  CC      aarch64-softmmu/hw/dma/bcm2835_dma.o
  CC      aarch64-softmmu/hw/gpio/omap_gpio.o
  CC      x86_64-softmmu/trace/control-target.o
  CC      aarch64-softmmu/hw/input/pxa2xx_keypad.o
  CC      aarch64-softmmu/hw/input/tsc210x.o
  CC      aarch64-softmmu/hw/intc/armv7m_nvic.o
  CC      aarch64-softmmu/hw/intc/exynos4210_gic.o
  CC      aarch64-softmmu/hw/intc/exynos4210_combiner.o
  CC      aarch64-softmmu/hw/intc/omap_intc.o
  CC      aarch64-softmmu/hw/intc/bcm2835_ic.o
  CC      aarch64-softmmu/hw/intc/bcm2836_control.o
  CC      aarch64-softmmu/hw/intc/allwinner-a10-pic.o
  CC      aarch64-softmmu/hw/intc/aspeed_vic.o
  CC      aarch64-softmmu/hw/misc/ivshmem.o
  CC      aarch64-softmmu/hw/intc/arm_gicv3_cpuif.o
  CC      aarch64-softmmu/hw/misc/arm_sysctl.o
  CC      aarch64-softmmu/hw/misc/cbus.o
  CC      aarch64-softmmu/hw/misc/exynos4210_pmu.o
  CC      aarch64-softmmu/hw/misc/imx_ccm.o
  CC      aarch64-softmmu/hw/misc/imx31_ccm.o
  CC      aarch64-softmmu/hw/misc/imx25_ccm.o
  CC      aarch64-softmmu/hw/misc/imx6_ccm.o
  CC      aarch64-softmmu/hw/misc/imx6_src.o
  CC      aarch64-softmmu/hw/misc/mst_fpga.o
  CC      aarch64-softmmu/hw/misc/omap_clk.o
  CC      aarch64-softmmu/hw/misc/omap_gpmc.o
  CC      aarch64-softmmu/hw/misc/omap_l4.o
  CC      aarch64-softmmu/hw/misc/omap_tap.o
  CC      aarch64-softmmu/hw/misc/omap_sdrc.o
  CC      aarch64-softmmu/hw/misc/bcm2835_mbox.o
  CC      aarch64-softmmu/hw/misc/bcm2835_property.o
  CC      aarch64-softmmu/hw/misc/zynq_slcr.o
  CC      aarch64-softmmu/hw/misc/zynq-xadc.o
  CC      aarch64-softmmu/hw/misc/edu.o
  CC      aarch64-softmmu/hw/misc/stm32f2xx_syscfg.o
  CC      aarch64-softmmu/hw/misc/auxbus.o
  CC      aarch64-softmmu/hw/misc/aspeed_scu.o
  CC      aarch64-softmmu/hw/misc/aspeed_sdmc.o
  CC      aarch64-softmmu/hw/net/virtio-net.o
  CC      aarch64-softmmu/hw/net/vhost-pci-net.o
  CC      aarch64-softmmu/hw/net/vhost_net.o
  CC      aarch64-softmmu/hw/pcmcia/pxa2xx.o
  CC      aarch64-softmmu/hw/scsi/virtio-scsi-dataplane.o
  CC      aarch64-softmmu/hw/scsi/virtio-scsi.o
  CC      aarch64-softmmu/hw/sd/omap_mmc.o
  CC      aarch64-softmmu/hw/scsi/vhost-scsi.o
  CC      aarch64-softmmu/hw/ssi/omap_spi.o
  CC      aarch64-softmmu/hw/sd/pxa2xx_mmci.o
  CC      aarch64-softmmu/hw/ssi/imx_spi.o
  CC      aarch64-softmmu/hw/timer/exynos4210_mct.o
  CC      aarch64-softmmu/hw/timer/exynos4210_pwm.o
  CC      aarch64-softmmu/hw/timer/exynos4210_rtc.o
  CC      aarch64-softmmu/hw/timer/omap_gptimer.o
  CC      aarch64-softmmu/hw/timer/omap_synctimer.o
  CC      aarch64-softmmu/hw/timer/digic-timer.o
  CC      aarch64-softmmu/hw/timer/pxa2xx_timer.o
  CC      aarch64-softmmu/hw/timer/allwinner-a10-pit.o
  CC      aarch64-softmmu/hw/usb/tusb6010.o
  CC      aarch64-softmmu/hw/vfio/common.o
  CC      aarch64-softmmu/hw/vfio/pci.o
  CC      aarch64-softmmu/hw/vfio/pci-quirks.o
  CC      aarch64-softmmu/hw/vfio/platform.o
  CC      aarch64-softmmu/hw/vfio/calxeda-xgmac.o
  CC      aarch64-softmmu/hw/vfio/amd-xgbe.o
  CC      aarch64-softmmu/hw/vfio/spapr.o
  CC      aarch64-softmmu/hw/virtio/virtio.o
  CC      x86_64-softmmu/trace/generated-helpers.o
  CC      aarch64-softmmu/hw/virtio/vhost.o
  CC      aarch64-softmmu/hw/virtio/virtio-balloon.o
  CC      aarch64-softmmu/hw/virtio/vhost-user.o
  CC      aarch64-softmmu/hw/virtio/vhost-backend.o
  CC      aarch64-softmmu/hw/virtio/vhost-vsock.o
  CC      aarch64-softmmu/hw/virtio/virtio-crypto.o
  CC      aarch64-softmmu/hw/virtio/virtio-crypto-pci.o
  CC      aarch64-softmmu/hw/arm/boot.o
  CC      aarch64-softmmu/hw/arm/collie.o
  CC      aarch64-softmmu/hw/arm/exynos4_boards.o
  CC      aarch64-softmmu/hw/arm/gumstix.o
  CC      aarch64-softmmu/hw/arm/highbank.o
  CC      aarch64-softmmu/hw/arm/digic_boards.o
  CC      aarch64-softmmu/hw/arm/integratorcp.o
  CC      aarch64-softmmu/hw/arm/mainstone.o
  CC      aarch64-softmmu/hw/arm/nseries.o
  CC      aarch64-softmmu/hw/arm/musicpal.o
  CC      aarch64-softmmu/hw/arm/omap_sx1.o
  CC      aarch64-softmmu/hw/arm/realview.o
  CC      aarch64-softmmu/hw/arm/palm.o
  CC      aarch64-softmmu/hw/arm/spitz.o
  CC      aarch64-softmmu/hw/arm/stellaris.o
  CC      aarch64-softmmu/hw/arm/tosa.o
  CC      aarch64-softmmu/hw/arm/versatilepb.o
  CC      aarch64-softmmu/hw/arm/vexpress.o
  CC      aarch64-softmmu/hw/arm/xilinx_zynq.o
  CC      aarch64-softmmu/hw/arm/virt.o
  CC      aarch64-softmmu/hw/arm/z2.o
  CC      aarch64-softmmu/hw/arm/virt-acpi-build.o
  CC      aarch64-softmmu/hw/arm/netduino2.o
  CC      aarch64-softmmu/hw/arm/sysbus-fdt.o
  CC      aarch64-softmmu/hw/arm/pxa2xx.o
  CC      aarch64-softmmu/hw/arm/armv7m.o
  CC      aarch64-softmmu/hw/arm/exynos4210.o
  CC      aarch64-softmmu/hw/arm/pxa2xx_gpio.o
  CC      aarch64-softmmu/hw/arm/pxa2xx_pic.o
  CC      aarch64-softmmu/hw/arm/digic.o
  CC      aarch64-softmmu/hw/arm/omap1.o
  CC      aarch64-softmmu/hw/arm/strongarm.o
  CC      aarch64-softmmu/hw/arm/omap2.o
  CC      aarch64-softmmu/hw/arm/allwinner-a10.o
  CC      aarch64-softmmu/hw/arm/cubieboard.o
  CC      aarch64-softmmu/hw/arm/bcm2835_peripherals.o
  CC      aarch64-softmmu/hw/arm/raspi.o
  CC      aarch64-softmmu/hw/arm/bcm2836.o
  CC      aarch64-softmmu/hw/arm/stm32f205_soc.o
  CC      aarch64-softmmu/hw/arm/xlnx-zynqmp.o
  CC      aarch64-softmmu/hw/arm/xlnx-ep108.o
  CC      aarch64-softmmu/hw/arm/fsl-imx25.o
  CC      aarch64-softmmu/hw/arm/imx25_pdk.o
  CC      aarch64-softmmu/hw/arm/kzm.o
  CC      aarch64-softmmu/hw/arm/fsl-imx31.o
  CC      aarch64-softmmu/hw/arm/fsl-imx6.o
  CC      aarch64-softmmu/hw/arm/sabrelite.o
  LINK    x86_64-softmmu/qemu-system-x86_64
  CC      aarch64-softmmu/hw/arm/aspeed_soc.o
  CC      aarch64-softmmu/hw/arm/aspeed.o
  CC      aarch64-softmmu/target-arm/arm-semi.o
  CC      aarch64-softmmu/target-arm/machine.o
  CC      aarch64-softmmu/target-arm/psci.o
  CC      aarch64-softmmu/target-arm/arch_dump.o
  CC      aarch64-softmmu/target-arm/monitor.o
  CC      aarch64-softmmu/target-arm/kvm-stub.o
  CC      aarch64-softmmu/target-arm/translate.o
  CC      aarch64-softmmu/target-arm/op_helper.o
  CC      aarch64-softmmu/target-arm/helper.o
  CC      aarch64-softmmu/target-arm/cpu.o
  CC      aarch64-softmmu/target-arm/neon_helper.o
  CC      aarch64-softmmu/target-arm/iwmmxt_helper.o
  CC      aarch64-softmmu/target-arm/gdbstub.o
  CC      aarch64-softmmu/target-arm/cpu64.o
  CC      aarch64-softmmu/target-arm/translate-a64.o
  CC      aarch64-softmmu/target-arm/helper-a64.o
  CC      aarch64-softmmu/target-arm/gdbstub64.o
  CC      aarch64-softmmu/target-arm/crypto_helper.o
  CC      aarch64-softmmu/target-arm/arm-powerctl.o

/tmp/qemu-test/src/target-arm/translate-a64.c: In function ‘handle_shri_with_rndacc’:
/tmp/qemu-test/src/target-arm/translate-a64.c:6391: warning: ‘tcg_src_hi’ may be used uninitialized in this function /tmp/qemu-test/src/target-arm/translate-a64.c: In function ‘disas_simd_scalar_two_reg_misc’:
/tmp/qemu-test/src/target-arm/translate-a64.c:8118: warning: ‘rmode’ may be used uninitialized in this function

  GEN     trace/generated-helpers.c
  CC      aarch64-softmmu/trace/control-target.o
  CC      aarch64-softmmu/gdbstub-xml.o
  CC      aarch64-softmmu/trace/generated-helpers.o
  LINK    aarch64-softmmu/qemu-system-aarch64
  TEST    tests/qapi-schema/alternate-any.out
  TEST    tests/qapi-schema/alternate-base.out
  TEST    tests/qapi-schema/alternate-array.out
  TEST    tests/qapi-schema/alternate-clash.out
  TEST    tests/qapi-schema/alternate-conflict-dict.out
  TEST    tests/qapi-schema/alternate-conflict-string.out
  TEST    tests/qapi-schema/alternate-empty.out
  TEST    tests/qapi-schema/alternate-nested.out
  TEST    tests/qapi-schema/alternate-unknown.out
  TEST    tests/qapi-schema/args-alternate.out
  TEST    tests/qapi-schema/args-any.out
  TEST    tests/qapi-schema/args-array-empty.out
  TEST    tests/qapi-schema/args-array-unknown.out
  TEST    tests/qapi-schema/args-bad-boxed.out
  TEST    tests/qapi-schema/args-boxed-anon.out
  TEST    tests/qapi-schema/args-boxed-empty.out
  TEST    tests/qapi-schema/args-boxed-string.out
  TEST    tests/qapi-schema/args-int.out
  TEST    tests/qapi-schema/args-invalid.out
  TEST    tests/qapi-schema/args-member-array-bad.out
  TEST    tests/qapi-schema/args-member-case.out
  TEST    tests/qapi-schema/args-member-unknown.out
  TEST    tests/qapi-schema/args-name-clash.out
  TEST    tests/qapi-schema/args-union.out
  TEST    tests/qapi-schema/args-unknown.out
  TEST    tests/qapi-schema/bad-base.out
  TEST    tests/qapi-schema/bad-data.out
  TEST    tests/qapi-schema/bad-ident.out
  TEST    tests/qapi-schema/bad-type-bool.out
  TEST    tests/qapi-schema/bad-type-dict.out
  TEST    tests/qapi-schema/bad-type-int.out
  TEST    tests/qapi-schema/base-cycle-direct.out
  TEST    tests/qapi-schema/base-cycle-indirect.out
  TEST    tests/qapi-schema/command-int.out
  TEST    tests/qapi-schema/comments.out
  TEST    tests/qapi-schema/double-data.out
  TEST    tests/qapi-schema/double-type.out
  TEST    tests/qapi-schema/duplicate-key.out
  TEST    tests/qapi-schema/empty.out
  TEST    tests/qapi-schema/enum-bad-name.out
  TEST    tests/qapi-schema/enum-bad-prefix.out
  TEST    tests/qapi-schema/enum-clash-member.out
  TEST    tests/qapi-schema/enum-dict-member.out
  TEST    tests/qapi-schema/enum-int-member.out
  TEST    tests/qapi-schema/enum-member-case.out
  TEST    tests/qapi-schema/enum-missing-data.out
  TEST    tests/qapi-schema/enum-wrong-data.out
  TEST    tests/qapi-schema/escape-outside-string.out
  TEST    tests/qapi-schema/escape-too-big.out
  TEST    tests/qapi-schema/escape-too-short.out
  TEST    tests/qapi-schema/event-boxed-empty.out
  TEST    tests/qapi-schema/event-nest-struct.out
  TEST    tests/qapi-schema/event-case.out
  TEST    tests/qapi-schema/flat-union-array-branch.out
  TEST    tests/qapi-schema/flat-union-bad-base.out
  TEST    tests/qapi-schema/flat-union-base-any.out
  TEST    tests/qapi-schema/flat-union-bad-discriminator.out
  TEST    tests/qapi-schema/flat-union-clash-member.out
  TEST    tests/qapi-schema/flat-union-base-union.out
  TEST    tests/qapi-schema/flat-union-empty.out
  TEST    tests/qapi-schema/flat-union-incomplete-branch.out
  TEST    tests/qapi-schema/flat-union-inline.out
  TEST    tests/qapi-schema/flat-union-int-branch.out
  TEST    tests/qapi-schema/flat-union-invalid-branch-key.out
  TEST    tests/qapi-schema/flat-union-invalid-discriminator.out
  TEST    tests/qapi-schema/flat-union-no-base.out
  TEST    tests/qapi-schema/flat-union-optional-discriminator.out
  TEST    tests/qapi-schema/flat-union-string-discriminator.out
  TEST    tests/qapi-schema/funny-char.out
  TEST    tests/qapi-schema/ident-with-escape.out
  TEST    tests/qapi-schema/include-before-err.out
  TEST    tests/qapi-schema/include-cycle.out
  TEST    tests/qapi-schema/include-format-err.out
  TEST    tests/qapi-schema/include-nested-err.out
  TEST    tests/qapi-schema/include-no-file.out
  TEST    tests/qapi-schema/include-non-file.out
  TEST    tests/qapi-schema/include-relpath.out
  TEST    tests/qapi-schema/include-repetition.out
  TEST    tests/qapi-schema/include-self-cycle.out
  TEST    tests/qapi-schema/include-simple.out
  TEST    tests/qapi-schema/leading-comma-list.out
  TEST    tests/qapi-schema/indented-expr.out
  TEST    tests/qapi-schema/leading-comma-object.out
  TEST    tests/qapi-schema/missing-colon.out
  TEST    tests/qapi-schema/missing-comma-list.out
  TEST    tests/qapi-schema/missing-comma-object.out
  TEST    tests/qapi-schema/missing-type.out
  TEST    tests/qapi-schema/nested-struct-data.out
  TEST    tests/qapi-schema/non-objects.out
  TEST    tests/qapi-schema/qapi-schema-test.out
  TEST    tests/qapi-schema/redefined-builtin.out
  TEST    tests/qapi-schema/quoted-structural-chars.out
  TEST    tests/qapi-schema/redefined-command.out
  TEST    tests/qapi-schema/redefined-event.out
  TEST    tests/qapi-schema/redefined-type.out
  TEST    tests/qapi-schema/reserved-command-q.out
  TEST    tests/qapi-schema/reserved-enum-q.out
  TEST    tests/qapi-schema/reserved-member-has.out
  TEST    tests/qapi-schema/reserved-member-q.out
  TEST    tests/qapi-schema/reserved-member-u.out
  TEST    tests/qapi-schema/reserved-member-underscore.out
  TEST    tests/qapi-schema/reserved-type-kind.out
  TEST    tests/qapi-schema/reserved-type-list.out
  TEST    tests/qapi-schema/returns-alternate.out
  TEST    tests/qapi-schema/returns-array-bad.out
  TEST    tests/qapi-schema/returns-dict.out
  TEST    tests/qapi-schema/returns-whitelist.out
  TEST    tests/qapi-schema/returns-unknown.out
  TEST    tests/qapi-schema/struct-base-clash-deep.out
  TEST    tests/qapi-schema/struct-base-clash.out
  TEST    tests/qapi-schema/struct-data-invalid.out
  TEST    tests/qapi-schema/struct-member-invalid.out
  TEST    tests/qapi-schema/trailing-comma-list.out
  TEST    tests/qapi-schema/trailing-comma-object.out
  TEST    tests/qapi-schema/type-bypass-bad-gen.out
  TEST    tests/qapi-schema/unclosed-list.out
  TEST    tests/qapi-schema/unclosed-object.out
  TEST    tests/qapi-schema/unclosed-string.out
  TEST    tests/qapi-schema/unicode-str.out
  TEST    tests/qapi-schema/union-base-no-discriminator.out
  TEST    tests/qapi-schema/union-branch-case.out
  TEST    tests/qapi-schema/union-clash-branches.out
  TEST    tests/qapi-schema/union-empty.out
  TEST    tests/qapi-schema/union-invalid-base.out
  TEST    tests/qapi-schema/union-optional-branch.out
  TEST    tests/qapi-schema/union-unknown.out
  TEST    tests/qapi-schema/unknown-escape.out
  TEST    tests/qapi-schema/unknown-expr-key.out
  CC      tests/check-qdict.o
  CC      tests/test-char.o
  CC      tests/check-qfloat.o
  CC      tests/check-qlist.o
  CC      tests/check-qint.o
  CC      tests/check-qstring.o
  CC      tests/check-qjson.o
  CC      tests/check-qnull.o
  CC      tests/test-qobject-output-visitor.o
  GEN     tests/test-qapi-visit.c
  GEN     tests/test-qapi-types.c
  GEN     tests/test-qapi-event.c
  GEN     tests/test-qmp-introspect.c
  CC      tests/test-clone-visitor.o
  CC      tests/test-qobject-input-visitor.o
  CC      tests/test-qobject-input-strict.o
  GEN     tests/test-qmp-marshal.c
  CC      tests/test-string-input-visitor.o
  CC      tests/test-qmp-commands.o
  CC      tests/test-string-output-visitor.o
  CC      tests/test-qmp-event.o
  CC      tests/test-opts-visitor.o
  CC      tests/test-coroutine.o
  CC      tests/test-visitor-serialization.o
  CC      tests/test-iov.o
  CC      tests/test-aio.o
  CC      tests/test-throttle.o
  CC      tests/test-thread-pool.o
  CC      tests/test-hbitmap.o
  CC      tests/test-blockjob.o
  CC      tests/test-blockjob-txn.o
  CC      tests/test-xbzrle.o
  CC      tests/test-x86-cpuid.o
  CC      tests/test-vmstate.o
  CC      tests/test-cutils.o
  CC      tests/test-mul64.o
  CC      tests/test-int128.o
  CC      tests/rcutorture.o
  CC      tests/test-rcu-list.o
  CC      tests/test-qdist.o
  CC      tests/test-qht.o
  CC      tests/qht-bench.o
  CC      tests/check-qom-interface.o
  CC      tests/test-qht-par.o
  CC      tests/test-bitops.o
  CC      tests/check-qom-proplist.o
  CC      tests/test-qemu-opts.o
  CC      tests/test-write-threshold.o
  CC      tests/test-crypto-hash.o
  CC      tests/test-crypto-secret.o
  CC      tests/test-crypto-cipher.o
/tmp/qemu-test/src/tests/test-int128.c:180: warning: ‘__noclone__’ attribute directive ignored
  CC      tests/test-qga.o
  CC      tests/libqtest.o
  CC      tests/test-timed-average.o
  CC      tests/test-io-task.o
  CC      tests/io-channel-helpers.o
  CC      tests/test-io-channel-socket.o
  CC      tests/test-io-channel-file.o
  CC      tests/test-io-channel-command.o
  CC      tests/test-io-channel-buffer.o
  CC      tests/test-base64.o
  CC      tests/test-crypto-ivgen.o
  CC      tests/test-crypto-afsplit.o
  CC      tests/test-crypto-xts.o
  CC      tests/test-crypto-block.o
  CC      tests/test-logging.o
  CC      tests/test-replication.o
  CC      tests/test-bufferiszero.o
  CC      tests/test-uuid.o
  CC      tests/ptimer-test.o
  CC      tests/ptimer-test-stubs.o
  CC      tests/vhost-user-test.o
  CC      tests/libqos/pci.o
  CC      tests/libqos/fw_cfg.o
  CC      tests/libqos/malloc.o
  CC      tests/libqos/malloc-spapr.o
  CC      tests/libqos/i2c.o
  CC      tests/libqos/libqos.o
  CC      tests/libqos/libqos-spapr.o
  CC      tests/libqos/rtas.o
  CC      tests/libqos/pci-spapr.o
  CC      tests/libqos/pci-pc.o
  CC      tests/libqos/malloc-pc.o
  CC      tests/libqos/libqos-pc.o
  CC      tests/libqos/ahci.o
  CC      tests/libqos/virtio-mmio.o
  CC      tests/libqos/virtio-pci.o
  CC      tests/libqos/virtio.o
  CC      tests/libqos/malloc-generic.o
  CC      tests/endianness-test.o
  CC      tests/fdc-test.o
  CC      tests/ide-test.o
  CC      tests/ahci-test.o
  CC      tests/hd-geo-test.o
  CC      tests/boot-order-test.o
  CC      tests/boot-sector.o
  CC      tests/bios-tables-test.o
  CC      tests/pxe-test.o
  CC      tests/boot-serial-test.o
  CC      tests/ipmi-kcs-test.o
  CC      tests/ipmi-bt-test.o
  CC      tests/rtc-test.o

/tmp/qemu-test/src/tests/ide-test.c: In function ‘cdrom_pio_impl’:
/tmp/qemu-test/src/tests/ide-test.c:791: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result /tmp/qemu-test/src/tests/ide-test.c: In function ‘test_cdrom_dma’:
/tmp/qemu-test/src/tests/ide-test.c:886: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result

  CC      tests/i440fx-test.o
  CC      tests/fw_cfg-test.o
  CC      tests/drive_del-test.o
  CC      tests/wdt_ib700-test.o
  CC      tests/e1000-test.o
  CC      tests/e1000e-test.o
  CC      tests/tco-test.o
  CC      tests/rtl8139-test.o
  CC      tests/pcnet-test.o
  CC      tests/eepro100-test.o
  CC      tests/ne2000-test.o
  CC      tests/nvme-test.o
  CC      tests/es1370-test.o
  CC      tests/ac97-test.o
  CC      tests/virtio-net-test.o
  CC      tests/virtio-blk-test.o
  CC      tests/virtio-balloon-test.o
  CC      tests/virtio-rng-test.o
  CC      tests/virtio-serial-test.o
  CC      tests/virtio-scsi-test.o
  CC      tests/tpci200-test.o
  CC      tests/virtio-console-test.o
  CC      tests/ipoctal232-test.o
  CC      tests/display-vga-test.o
  CC      tests/intel-hda-test.o
  CC      tests/ivshmem-test.o
  CC      tests/vmxnet3-test.o
  CC      tests/i82801b11-test.o
  CC      tests/pvpanic-test.o
  CC      tests/ioh3420-test.o
  CC      tests/usb-hcd-ohci-test.o
  CC      tests/libqos/usb.o
  CC      tests/usb-hcd-uhci-test.o
  CC      tests/usb-hcd-ehci-test.o
  CC      tests/usb-hcd-xhci-test.o
  CC      tests/pc-cpu-test.o
  CC      tests/q35-test.o
  CC      tests/test-netfilter.o
  CC      tests/test-filter-mirror.o
  CC      tests/test-filter-redirector.o
  CC      tests/postcopy-test.o
  CC      tests/test-x86-cpuid-compat.o
  CC      tests/qom-test.o
  CC      tests/device-introspect-test.o
  LINK    tests/check-qdict
  LINK    tests/test-char
  LINK    tests/check-qfloat
  LINK    tests/check-qint
  LINK    tests/check-qstring
  LINK    tests/check-qlist
  LINK    tests/check-qnull
  LINK    tests/check-qjson
  CC      tests/test-qapi-visit.o
  CC      tests/test-qapi-types.o
  CC      tests/test-qapi-event.o
  CC      tests/test-qmp-introspect.o
  CC      tests/test-qmp-marshal.o
  LINK    tests/test-coroutine
  LINK    tests/test-visitor-serialization
  LINK    tests/test-iov
  LINK    tests/test-aio
  LINK    tests/test-throttle
  LINK    tests/test-thread-pool
  LINK    tests/test-hbitmap
  LINK    tests/test-blockjob
  LINK    tests/test-blockjob-txn
  LINK    tests/test-x86-cpuid
  LINK    tests/test-xbzrle
  LINK    tests/test-vmstate
  LINK    tests/test-cutils
  LINK    tests/test-mul64
  LINK    tests/test-int128
  LINK    tests/rcutorture
  LINK    tests/test-rcu-list
  LINK    tests/test-qdist
  LINK    tests/test-qht
  LINK    tests/qht-bench
  LINK    tests/test-bitops
  LINK    tests/check-qom-interface
  LINK    tests/check-qom-proplist
  LINK    tests/test-qemu-opts
  LINK    tests/test-write-threshold
  LINK    tests/test-crypto-hash
  LINK    tests/test-crypto-cipher
  LINK    tests/test-crypto-secret
  LINK    tests/test-qga
  LINK    tests/test-timed-average
  LINK    tests/test-io-task
  LINK    tests/test-io-channel-socket
  LINK    tests/test-io-channel-file
  LINK    tests/test-io-channel-command
  LINK    tests/test-io-channel-buffer
  LINK    tests/test-base64
  LINK    tests/test-crypto-ivgen
  LINK    tests/test-crypto-afsplit
  LINK    tests/test-crypto-xts
  LINK    tests/test-crypto-block
  LINK    tests/test-logging
  LINK    tests/test-replication
  LINK    tests/test-bufferiszero
  LINK    tests/test-uuid
  LINK    tests/ptimer-test
  LINK    tests/vhost-user-test
  LINK    tests/endianness-test
  LINK    tests/fdc-test
  LINK    tests/ide-test
  LINK    tests/ahci-test
  LINK    tests/hd-geo-test
  LINK    tests/boot-order-test
  LINK    tests/bios-tables-test
  LINK    tests/boot-serial-test
  LINK    tests/pxe-test
  LINK    tests/rtc-test
  LINK    tests/ipmi-kcs-test
  LINK    tests/ipmi-bt-test
  LINK    tests/i440fx-test
  LINK    tests/fw_cfg-test
  LINK    tests/drive_del-test
  LINK    tests/wdt_ib700-test
  LINK    tests/tco-test
  LINK    tests/e1000-test
  LINK    tests/e1000e-test
  LINK    tests/rtl8139-test
  LINK    tests/pcnet-test
  LINK    tests/eepro100-test
  LINK    tests/ne2000-test
  LINK    tests/nvme-test
  LINK    tests/ac97-test
  LINK    tests/es1370-test
  LINK    tests/virtio-net-test
  LINK    tests/virtio-balloon-test
  LINK    tests/virtio-blk-test
  LINK    tests/virtio-rng-test
  LINK    tests/virtio-scsi-test
  LINK    tests/virtio-serial-test
  LINK    tests/virtio-console-test
  LINK    tests/tpci200-test
  LINK    tests/ipoctal232-test
  LINK    tests/display-vga-test
  LINK    tests/intel-hda-test
  LINK    tests/ivshmem-test
  LINK    tests/vmxnet3-test
  LINK    tests/pvpanic-test
  LINK    tests/i82801b11-test
  LINK    tests/ioh3420-test
  LINK    tests/usb-hcd-ohci-test
  LINK    tests/usb-hcd-uhci-test
  LINK    tests/usb-hcd-ehci-test
  LINK    tests/usb-hcd-xhci-test
  LINK    tests/pc-cpu-test
  LINK    tests/q35-test
  LINK    tests/test-netfilter
  LINK    tests/test-filter-mirror
  LINK    tests/test-filter-redirector
  LINK    tests/postcopy-test
  LINK    tests/test-x86-cpuid-compat
  LINK    tests/device-introspect-test
  LINK    tests/qom-test
  GTESTER tests/test-char
  GTESTER tests/check-qdict
  GTESTER tests/check-qfloat
  GTESTER tests/check-qint
  GTESTER tests/check-qlist
  GTESTER tests/check-qstring
  GTESTER tests/check-qnull
  GTESTER tests/check-qjson
  LINK    tests/test-qobject-output-visitor
  LINK    tests/test-clone-visitor
  LINK    tests/test-qobject-input-visitor
  LINK    tests/test-qobject-input-strict
  LINK    tests/test-qmp-commands
  LINK    tests/test-string-input-visitor
  LINK    tests/test-string-output-visitor
  LINK    tests/test-qmp-event

GTESTER tests/test-coroutine
LINK tests/test-opts-visitor
GTESTER tests/test-thread-pool
GTESTER tests/test-visitor-serialization
GTESTER tests/test-iov
GTESTER tests/test-aio
GTESTER tests/test-throttle
GTESTER tests/test-hbitmap
GTESTER tests/test-blockjob-txn
GTESTER tests/test-blockjob
GTESTER tests/test-x86-cpuid
GTESTER tests/test-xbzrle
GTESTER tests/test-vmstate
GTESTER tests/test-cutils
GTESTER tests/test-mul64
GTESTER tests/test-int128
GTESTER tests/rcutorture
Failed to load simple/primitive:b_1
Failed to load simple/primitive:i64_2
Failed to load simple/primitive:i32_1
Failed to load simple/primitive:i32_1
GTESTER tests/test-rcu-list
GTESTER tests/test-qdist
GTESTER tests/test-qht
LINK tests/test-qht-par
GTESTER tests/test-bitops
GTESTER tests/check-qom-interface
GTESTER tests/test-qemu-opts
GTESTER tests/check-qom-proplist
GTESTER tests/test-write-threshold
GTESTER tests/test-crypto-hash
GTESTER tests/test-crypto-cipher
GTESTER tests/test-crypto-secret
GTESTER tests/test-qga
GTESTER tests/test-timed-average
GTESTER tests/test-io-task
GTESTER tests/test-io-channel-socket
GTESTER tests/test-io-channel-file
GTESTER tests/test-io-channel-command
GTESTER tests/test-io-channel-buffer
GTESTER tests/test-base64
GTESTER tests/test-crypto-ivgen
GTESTER tests/test-crypto-xts
GTESTER tests/test-crypto-afsplit
GTESTER tests/test-crypto-block
GTESTER tests/test-logging
GTESTER tests/test-replication
GTESTER tests/test-bufferiszero
GTESTER tests/test-uuid
GTESTER tests/ptimer-test
GTESTER check-qtest-x86_64
GTESTER check-qtest-aarch64
GTESTER tests/test-qobject-output-visitor
GTESTER tests/test-clone-visitor
GTESTER tests/test-qobject-input-visitor
GTESTER tests/test-qobject-input-strict
GTESTER tests/test-qmp-commands
GTESTER tests/test-string-input-visitor
GTESTER tests/test-string-output-visitor
GTESTER tests/test-qmp-event
GTESTER tests/test-opts-visitor
GTESTER tests/test-qht-par
ftruncate: Permission denied
ftruncate: Permission denied
ftruncate: Permission denied
**
ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:668:test_migrate: assertion failed: (qdict_haskey(rsp, "return"))
GTester: last random seed: R02Sff3c958c18a8dce63741542c48630a20
ftruncate: Permission denied
ftruncate: Permission denied
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-w_6waclo/src'
BUILD fedora
make[1]: Entering directory `/var/tmp/patchew-tester-tmp-w_6waclo/src'
ARCHIVE qemu.tgz
ARCHIVE dtc.tgz
COPY RUNNER
RUN test-mingw in qemu:fedora
Packages installed:
PyYAML-3.11-12.fc24.x86_64
SDL-devel-1.2.15-21.fc24.x86_64
bc-1.06.95-16.fc24.x86_64
bison-3.0.4-4.fc24.x86_64
ccache-3.3.2-1.fc24.x86_64
clang-3.8.0-2.fc24.x86_64
findutils-4.6.0-7.fc24.x86_64
flex-2.6.0-2.fc24.x86_64
gcc-6.2.1-2.fc24.x86_64
gcc-c++-6.2.1-2.fc24.x86_64
git-2.7.4-3.fc24.x86_64
glib2-devel-2.48.2-1.fc24.x86_64
libfdt-devel-1.4.2-1.fc24.x86_64
make-4.1-5.fc24.x86_64
mingw32-SDL-1.2.15-7.fc24.noarch
mingw32-bzip2-1.0.6-7.fc24.noarch
mingw32-curl-7.47.0-1.fc24.noarch
mingw32-glib2-2.48.2-1.fc24.noarch
mingw32-gmp-6.1.0-1.fc24.noarch
mingw32-gnutls-3.4.14-1.fc24.noarch
mingw32-gtk2-2.24.31-1.fc24.noarch
mingw32-gtk3-3.20.9-1.fc24.noarch
mingw32-libjpeg-turbo-1.5.0-1.fc24.noarch
mingw32-libpng-1.6.23-1.fc24.noarch
mingw32-libssh2-1.4.3-5.fc24.noarch
mingw32-libtasn1-4.5-2.fc24.noarch
mingw32-nettle-3.2-1.fc24.noarch
mingw32-pixman-0.34.0-1.fc24.noarch
mingw32-pkg-config-0.28-6.fc24.x86_64
mingw64-SDL-1.2.15-7.fc24.noarch
mingw64-bzip2-1.0.6-7.fc24.noarch
mingw64-curl-7.47.0-1.fc24.noarch
mingw64-glib2-2.48.2-1.fc24.noarch
mingw64-gmp-6.1.0-1.fc24.noarch
mingw64-gnutls-3.4.14-1.fc24.noarch
mingw64-gtk2-2.24.31-1.fc24.noarch
mingw64-gtk3-3.20.9-1.fc24.noarch
mingw64-libjpeg-turbo-1.5.0-1.fc24.noarch
mingw64-libpng-1.6.23-1.fc24.noarch
mingw64-libssh2-1.4.3-5.fc24.noarch
mingw64-libtasn1-4.5-2.fc24.noarch
mingw64-nettle-3.2-1.fc24.noarch
mingw64-pixman-0.34.0-1.fc24.noarch
mingw64-pkg-config-0.28-6.fc24.x86_64
perl-5.22.2-362.fc24.x86_64
pixman-devel-0.34.0-2.fc24.x86_64
sparse-0.5.0-7.fc24.x86_64
tar-1.28-7.fc24.x86_64
which-2.20-13.fc24.x86_64
zlib-devel-1.2.8-10.fc24.x86_64

Environment variables:
PACKAGES=ccache git tar PyYAML sparse flex bison glib2-devel pixman-devel zlib-devel SDL-devel libfdt-devel gcc gcc-c++ clang make perl which bc findutils mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL mingw32-pkg-config mingw32-gtk2 mingw32-gtk3 mingw32-gnutls mingw32-nettle mingw32-libtasn1 mingw32-libjpeg-turbo mingw32-libpng mingw32-curl mingw32-libssh2 mingw32-bzip2 mingw64-pixman mingw64-glib2 mingw64-gmp mingw64-SDL mingw64-pkg-config mingw64-gtk2 mingw64-gtk3 mingw64-gnutls mingw64-nettle mingw64-libtasn1 mingw64-libjpeg-turbo mingw64-libpng mingw64-curl mingw64-libssh2 mingw64-bzip2
HOSTNAME=
TERM=xterm
MAKEFLAGS= -j16
HISTSIZE=1000
J=16
USER=root
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES=mingw clang pyyaml dtc
DEBUG=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install --cross-prefix=x86_64-w64-mingw32- --enable-trace-backends=simple --enable-debug --enable-gnutls --enable-nettle --enable-curl --enable-vnc --enable-bzip2 --enable-guest-agent --with-sdlabi=1.2 --with-gtkabi=2.0

Install prefix    /var/tmp/qemu-build/install
BIOS directory    /var/tmp/qemu-build/install
binary directory  /var/tmp/qemu-build/install

library directory /var/tmp/qemu-build/install/lib module directory /var/tmp/qemu-build/install/lib libexec directory /var/tmp/qemu-build/install/libexec include directory /var/tmp/qemu-build/install/include config directory /var/tmp/qemu-build/install
local state directory queried at runtime

Windows SDK       no
Source path       /tmp/qemu-test/src
C compiler        x86_64-w64-mingw32-gcc
Host C compiler   cc
C++ compiler      x86_64-w64-mingw32-g++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -g 
QEMU_CFLAGS       -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/pixman-1  -I$(SRC_PATH)/dtc/libfdt -Werror -mms-bitfields -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/glib-2.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/lib/glib-2.0/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include  -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wno-shift-negative-value -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include  -I/usr/x86_64-w64-mingw32/sys-root/mingw/include   -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 
LDFLAGS           -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase -Wl,--warn-common -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
tcg debug enabled yes
gprof enabled     no
sparse enabled    no
strip binaries    no
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.15)
GTK support       yes (2.24.31)
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    yes
GNUTLS rnd        yes
libgcrypt         no
libgcrypt kdf     no
nettle            yes (3.2)
nettle kdf        yes
libtasn1          yes
curses support    no
virgl support     no
curl support      yes
mingw32 support   yes
Audio drivers     dsound
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               no
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support no
Install blobs     yes
KVM support       no
COLO support      yes
RDMA support      no
TCG interpreter   no
fdt support       yes
preadv support    no
fdatasync         no
madvise           no
posix_madvise     no

libcap-ng support no
vhost-net support no
vhost-scsi support no
vhost-vsock support no
Trace backends simple
Trace output file trace-<pid>

spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no

build guest agent yes
QGA VSS support no
QGA w32 disk info yes
QGA MSI support no
seccomp support no
coroutine backend win32
coroutine pool yes
debug stack usage no
GlusterFS support no
Archipelago support no

gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   yes
TPM passthrough   no
QOM debugging     yes
lzo support       no
snappy support    no
bzip2 support     yes

NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization yes
replication support yes
mkdir -p dtc/libfdt
GEN x86_64-softmmu/config-devices.mak.tmp
mkdir -p dtc/tests

  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     config-host.h
  GEN     qemu-options.def
  GEN     qmp-commands.h
  GEN     qapi-types.h
  GEN     qapi-visit.h
  GEN     qapi-event.h
  GEN     qmp-introspect.h
  GEN     tests/test-qapi-types.h
  GEN     module_block.h
  GEN     tests/test-qapi-visit.h
  GEN     tests/test-qmp-commands.h
  GEN     tests/test-qapi-event.h
  GEN     tests/test-qmp-introspect.h
  GEN     x86_64-softmmu/config-devices.mak
  GEN     aarch64-softmmu/config-devices.mak
  GEN     trace/generated-tracers.h

DEP /tmp/qemu-test/src/dtc/tests/dumptrees.c
DEP /tmp/qemu-test/src/dtc/tests/trees.S
DEP /tmp/qemu-test/src/dtc/tests/testutils.c
GEN trace/generated-tcg-tracers.h
DEP /tmp/qemu-test/src/dtc/tests/value-labels.c DEP /tmp/qemu-test/src/dtc/tests/asm_tree_dump.c
GEN trace/generated-helpers-wrappers.h
GEN trace/generated-helpers.h
DEP /tmp/qemu-test/src/dtc/tests/truncated_property.c DEP /tmp/qemu-test/src/dtc/tests/subnode_iterate.c DEP /tmp/qemu-test/src/dtc/tests/integer-expressions.c
GEN config-all-devices.mak
DEP /tmp/qemu-test/src/dtc/tests/utilfdt_test.c DEP /tmp/qemu-test/src/dtc/tests/path_offset_aliases.c DEP /tmp/qemu-test/src/dtc/tests/add_subnode_with_nops.c DEP /tmp/qemu-test/src/dtc/tests/dtb_reverse.c DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_unordered.c DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_ordered.c DEP /tmp/qemu-test/src/dtc/tests/extra-terminating-null.c DEP /tmp/qemu-test/src/dtc/tests/incbin.c
DEP /tmp/qemu-test/src/dtc/tests/boot-cpuid.c
DEP /tmp/qemu-test/src/dtc/tests/phandle_format.c DEP /tmp/qemu-test/src/dtc/tests/path-references.c DEP /tmp/qemu-test/src/dtc/tests/references.c
DEP /tmp/qemu-test/src/dtc/tests/string_escapes.c DEP /tmp/qemu-test/src/dtc/tests/propname_escapes.c DEP /tmp/qemu-test/src/dtc/tests/appendprop1.c DEP /tmp/qemu-test/src/dtc/tests/del_node.c
DEP /tmp/qemu-test/src/dtc/tests/appendprop2.c DEP /tmp/qemu-test/src/dtc/tests/del_property.c DEP /tmp/qemu-test/src/dtc/tests/setprop.c
DEP /tmp/qemu-test/src/dtc/tests/set_name.c
DEP /tmp/qemu-test/src/dtc/tests/open_pack.c
DEP /tmp/qemu-test/src/dtc/tests/rw_tree1.c
DEP /tmp/qemu-test/src/dtc/tests/nopulate.c
DEP /tmp/qemu-test/src/dtc/tests/mangle-layout.c DEP /tmp/qemu-test/src/dtc/tests/move_and_save.c DEP /tmp/qemu-test/src/dtc/tests/sw_tree1.c
DEP /tmp/qemu-test/src/dtc/tests/nop_node.c
DEP /tmp/qemu-test/src/dtc/tests/nop_property.c DEP /tmp/qemu-test/src/dtc/tests/setprop_inplace.c DEP /tmp/qemu-test/src/dtc/tests/notfound.c
DEP /tmp/qemu-test/src/dtc/tests/sized_cells.c DEP /tmp/qemu-test/src/dtc/tests/char_literal.c DEP /tmp/qemu-test/src/dtc/tests/get_alias.c
DEP /tmp/qemu-test/src/dtc/tests/node_check_compatible.c DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_compatible.c DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_phandle.c DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_prop_value.c DEP /tmp/qemu-test/src/dtc/tests/supernode_atdepth_offset.c DEP /tmp/qemu-test/src/dtc/tests/parent_offset.c DEP /tmp/qemu-test/src/dtc/tests/get_path.c
DEP /tmp/qemu-test/src/dtc/tests/get_phandle.c DEP /tmp/qemu-test/src/dtc/tests/getprop.c
DEP /tmp/qemu-test/src/dtc/tests/get_name.c
DEP /tmp/qemu-test/src/dtc/tests/path_offset.c DEP /tmp/qemu-test/src/dtc/tests/subnode_offset.c DEP /tmp/qemu-test/src/dtc/tests/find_property.c DEP /tmp/qemu-test/src/dtc/tests/root_node.c
DEP /tmp/qemu-test/src/dtc/tests/get_mem_rsv.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_empty_tree.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_strerror.c DEP /tmp/qemu-test/src/dtc/libfdt/fdt_rw.c
DEP /tmp/qemu-test/src/dtc/libfdt/fdt_sw.c
DEP /tmp/qemu-test/src/dtc/libfdt/fdt_wip.c
DEP /tmp/qemu-test/src/dtc/libfdt/fdt_ro.c
DEP /tmp/qemu-test/src/dtc/libfdt/fdt.c
DEP /tmp/qemu-test/src/dtc/util.c
DEP /tmp/qemu-test/src/dtc/fdtput.c
DEP /tmp/qemu-test/src/dtc/fdtget.c
DEP /tmp/qemu-test/src/dtc/fdtdump.c
LEX convert-dtsv0-lexer.lex.c
DEP /tmp/qemu-test/src/dtc/srcpos.c
BISON dtc-parser.tab.c
LEX dtc-lexer.lex.c
DEP /tmp/qemu-test/src/dtc/treesource.c
DEP /tmp/qemu-test/src/dtc/livetree.c
DEP /tmp/qemu-test/src/dtc/fstree.c
DEP /tmp/qemu-test/src/dtc/flattree.c
DEP /tmp/qemu-test/src/dtc/dtc.c
DEP /tmp/qemu-test/src/dtc/data.c
DEP /tmp/qemu-test/src/dtc/checks.c
DEP convert-dtsv0-lexer.lex.c
DEP dtc-parser.tab.c
DEP dtc-lexer.lex.c
CHK version_gen.h
UPD version_gen.h
DEP /tmp/qemu-test/src/dtc/util.c
CC libfdt/fdt.o
CC libfdt/fdt_ro.o
CC libfdt/fdt_wip.o
CC libfdt/fdt_sw.o
CC libfdt/fdt_rw.o
CC libfdt/fdt_strerror.o
CC libfdt/fdt_empty_tree.o
AR libfdt/libfdt.a
x86_64-w64-mingw32-ar: creating libfdt/libfdt.a
a - libfdt/fdt.o
a - libfdt/fdt_ro.o
a - libfdt/fdt_wip.o
a - libfdt/fdt_sw.o
a - libfdt/fdt_rw.o
a - libfdt/fdt_strerror.o
a - libfdt/fdt_empty_tree.o

  RC      version.lo
  RC      version.o
  GEN     qga/qapi-generated/qga-qapi-types.h
  GEN     qga/qapi-generated/qga-qapi-visit.h
  GEN     qga/qapi-generated/qga-qmp-commands.h
  GEN     qga/qapi-generated/qga-qapi-types.c
  GEN     qga/qapi-generated/qga-qapi-visit.c
  GEN     qga/qapi-generated/qga-qmp-marshal.c
  GEN     qmp-introspect.c
  GEN     qapi-types.c
  GEN     qapi-visit.c
  GEN     qapi-event.c
  CC      qapi/qapi-visit-core.o
  CC      qapi/qapi-dealloc-visitor.o
  CC      qapi/qobject-input-visitor.o
  CC      qapi/qobject-output-visitor.o
  CC      qapi/qmp-registry.o
  CC      qapi/qmp-dispatch.o
  CC      qapi/string-input-visitor.o
  CC      qapi/string-output-visitor.o
  CC      qapi/opts-visitor.o
  CC      qapi/qapi-clone-visitor.o
  CC      qapi/qmp-event.o
  CC      qapi/qapi-util.o
  CC      qobject/qnull.o
  CC      qobject/qint.o
  CC      qobject/qstring.o
  CC      qobject/qdict.o
  CC      qobject/qlist.o
  CC      qobject/qfloat.o
  CC      qobject/qbool.o
  CC      qobject/qjson.o
  CC      qobject/qobject.o
  CC      qobject/json-lexer.o
  CC      qobject/json-streamer.o
  CC      qobject/json-parser.o
  GEN     trace/generated-tracers.c
  CC      trace/simple.o
  CC      trace/control.o
  CC      trace/qmp.o
  CC      util/osdep.o
  CC      util/cutils.o
  CC      util/unicode.o
  CC      util/qemu-timer-common.o
  CC      util/bufferiszero.o
  CC      util/event_notifier-win32.o
  CC      util/oslib-win32.o
  CC      util/qemu-thread-win32.o
  CC      util/envlist.o
  CC      util/path.o
  CC      util/module.o
  CC      util/bitmap.o
  CC      util/hbitmap.o
  CC      util/bitops.o
  CC      util/fifo8.o
  CC      util/acl.o
  CC      util/error.o
  CC      util/id.o
  CC      util/qemu-error.o
  CC      util/iov.o
  CC      util/qemu-config.o
  CC      util/qemu-sockets.o
  CC      util/uri.o
  CC      util/notify.o
  CC      util/qemu-option.o
  CC      util/qemu-progress.o
  CC      util/hexdump.o
  CC      util/crc32c.o
  CC      util/uuid.o
  CC      util/throttle.o
  CC      util/readline.o
  CC      util/getauxval.o
  CC      util/rcu.o
  CC      util/qemu-coroutine.o
  CC      util/qemu-coroutine-lock.o
  CC      util/qemu-coroutine-io.o
  CC      util/qemu-coroutine-sleep.o
  CC      util/coroutine-win32.o
  CC      util/buffer.o
  CC      util/timed-average.o
  CC      util/log.o
  CC      util/base64.o
  CC      util/qdist.o
  CC      util/qht.o
  CC      util/range.o
  CC      crypto/pbkdf-stub.o
  CC      stubs/arch-query-cpu-model-expansion.o
  CC      stubs/arch-query-cpu-def.o
  CC      stubs/arch-query-cpu-model-comparison.o
  CC      stubs/arch-query-cpu-model-baseline.o
  CC      stubs/bdrv-next-monitor-owned.o
  CC      stubs/blk-commit-all.o
  CC      stubs/clock-warp.o
  CC      stubs/blockdev-close-all-bdrv-states.o
  CC      stubs/cpu-get-icount.o
  CC      stubs/cpu-get-clock.o
  CC      stubs/dump.o
  CC      stubs/error-printf.o
  CC      stubs/fdset-add-fd.o
  CC      stubs/fdset-find-fd.o
  CC      stubs/fdset-get-fd.o
  CC      stubs/fdset-remove-fd.o
  CC      stubs/gdbstub.o
  CC      stubs/get-fd.o
  CC      stubs/get-next-serial.o
  CC      stubs/get-vm-name.o
  CC      stubs/iothread.o
  CC      stubs/iothread-lock.o
  CC      stubs/is-daemonized.o
  CC      stubs/machine-init-done.o
  CC      stubs/migr-blocker.o
  CC      stubs/mon-is-qmp.o
  CC      stubs/monitor-init.o
  CC      stubs/notify-event.o
  CC      stubs/qtest.o
  CC      stubs/replay.o
  CC      stubs/replay-user.o
  CC      stubs/reset.o
  CC      stubs/runstate-check.o
  CC      stubs/set-fd-handler.o
  CC      stubs/slirp.o
  CC      stubs/sysbus.o
  CC      stubs/trace-control.o
  CC      stubs/uuid.o
  CC      stubs/vm-stop.o
  CC      stubs/vmstate.o
  CC      stubs/fd-register.o
  CC      stubs/cpus.o
  CC      stubs/qmp_pc_dimm_device_list.o
  CC      stubs/kvm.o
  CC      stubs/target-monitor-defs.o
  CC      stubs/target-get-monitor-def.o
  CC      stubs/vhost.o
  CC      stubs/iohandler.o
  CC      stubs/smbios_type_38.o
  CC      stubs/ipmi.o
  CC      stubs/pc_madt_cpu_entry.o
  CC      stubs/migration-colo.o
  GEN     qemu-img-cmds.h
  CC      async.o
  CC      thread-pool.o
  CC      block.o
  CC      blockjob.o
  CC      main-loop.o
  CC      iohandler.o
  CC      qemu-timer.o
  CC      aio-win32.o
  CC      qemu-io-cmds.o
  CC      replication.o
  CC      block/raw_bsd.o
  CC      block/qcow.o
  CC      block/vdi.o
  CC      block/vmdk.o
  CC      block/cloop.o
  CC      block/bochs.o
  CC      block/vpc.o
  CC      block/vvfat.o
  CC      block/qcow2.o
  CC      block/dmg.o
  CC      block/qcow2-refcount.o
  CC      block/qcow2-cluster.o
  CC      block/qcow2-snapshot.o
  CC      block/qcow2-cache.o
  CC      block/qed.o
  CC      block/qed-l2-cache.o
  CC      block/qed-gencb.o
  CC      block/qed-table.o
  CC      block/qed-cluster.o
  CC      block/qed-check.o
  CC      block/vhdx.o
  CC      block/vhdx-endian.o
  CC      block/vhdx-log.o
  CC      block/quorum.o
  CC      block/parallels.o
  CC      block/blkdebug.o
  CC      block/blkverify.o
  CC      block/blkreplay.o
  CC      block/block-backend.o
  CC      block/snapshot.o
  CC      block/qapi.o
  CC      block/raw-win32.o
  CC      block/win32-aio.o
  CC      block/null.o
  CC      block/mirror.o
  CC      block/commit.o
  CC      block/io.o
  CC      block/throttle-groups.o
  CC      block/nbd.o
  CC      block/nbd-client.o
  CC      block/sheepdog.o
  CC      block/accounting.o
  CC      block/dirty-bitmap.o
  CC      block/write-threshold.o
  CC      block/backup.o
  CC      block/replication.o
  CC      block/crypto.o
  CC      nbd/server.o
  CC      nbd/client.o
  CC      nbd/common.o
  CC      block/curl.o
  CC      block/ssh.o
  CC      block/dmg-bz2.o
  CC      crypto/init.o
  CC      crypto/hash.o
  CC      crypto/hash-nettle.o
  CC      crypto/aes.o
  CC      crypto/desrfb.o
  CC      crypto/cipher.o
  CC      crypto/tlscreds.o
  CC      crypto/tlscredsanon.o
  CC      crypto/tlscredsx509.o
  CC      crypto/tlssession.o
  CC      crypto/secret.o
  CC      crypto/random-gnutls.o
  CC      crypto/pbkdf.o
  CC      crypto/pbkdf-nettle.o
  CC      crypto/ivgen.o
  CC      crypto/ivgen-essiv.o
  CC      crypto/ivgen-plain.o
  CC      crypto/ivgen-plain64.o
  CC      crypto/afsplit.o
  CC      crypto/xts.o
  CC      crypto/block.o
  CC      crypto/block-qcow.o
  CC      crypto/block-luks.o
  CC      io/channel.o
  CC      io/channel-buffer.o
  CC      io/channel-command.o
  CC      io/channel-file.o
  CC      io/channel-socket.o
  CC      io/channel-tls.o
  CC      io/channel-watch.o
  CC      io/channel-websock.o
  CC      io/channel-util.o
  CC      io/task.o
  CC      qom/object.o
  CC      qom/container.o
  CC      qom/qom-qobject.o
  CC      qom/object_interfaces.o
  CC      qemu-io.o
  CC      blockdev.o
  CC      blockdev-nbd.o
  CC      iothread.o
  CC      qdev-monitor.o
  CC      device-hotplug.o
  CC      os-win32.o
  CC      qemu-char.o
  CC      page_cache.o
  CC      accel.o
  CC      bt-host.o
  CC      bt-vhci.o
  CC      dma-helpers.o
  CC      vl.o
  CC      tpm.o
  CC      device_tree.o
  GEN     qmp-marshal.c
  CC      hmp.o
  CC      qmp.o
  CC      cpus-common.o
  CC      audio/audio.o
  CC      audio/noaudio.o
  CC      audio/wavaudio.o
  CC      audio/mixeng.o
  CC      audio/sdlaudio.o
  CC      audio/dsoundaudio.o
  CC      audio/audio_win_int.o
  CC      audio/wavcapture.o
  CC      backends/rng.o
  CC      backends/rng-egd.o
  CC      backends/msmouse.o
  CC      backends/testdev.o
  CC      backends/tpm.o
  CC      backends/hostmem.o
  CC      backends/hostmem-ram.o
  CC      backends/cryptodev-builtin.o
  CC      backends/cryptodev.o
  CC      block/stream.o
  CC      disas/arm.o
  CXX     disas/arm-a64.o
  CC      disas/i386.o
  CXX     disas/libvixl/vixl/utils.o
  CXX     disas/libvixl/vixl/compiler-intrinsics.o
  CXX     disas/libvixl/vixl/a64/instructions-a64.o
  CXX     disas/libvixl/vixl/a64/decoder-a64.o
  CXX     disas/libvixl/vixl/a64/disasm-a64.o
  CC      hw/acpi/core.o
  CC      hw/acpi/piix4.o
  CC      hw/acpi/pcihp.o
  CC      hw/acpi/ich9.o
  CC      hw/acpi/tco.o
  CC      hw/acpi/cpu_hotplug.o
  CC      hw/acpi/memory_hotplug.o
  CC      hw/acpi/memory_hotplug_acpi_table.o
  CC      hw/acpi/nvdimm.o
  CC      hw/acpi/cpu.o
  CC      hw/acpi/acpi_interface.o
  CC      hw/acpi/bios-linker-loader.o
  CC      hw/acpi/aml-build.o
  CC      hw/acpi/ipmi.o
  CC      hw/audio/sb16.o
  CC      hw/audio/es1370.o
  CC      hw/audio/ac97.o
  CC      hw/audio/fmopl.o
  CC      hw/audio/adlib.o
  CC      hw/audio/gus.o
  CC      hw/audio/gusemu_hal.o
  CC      hw/audio/gusemu_mixer.o
  CC      hw/audio/cs4231a.o
  CC      hw/audio/intel-hda.o
  CC      hw/audio/hda-codec.o
  CC      hw/audio/pcspk.o
  CC      hw/audio/wm8750.o
  CC      hw/audio/pl041.o
  CC      hw/audio/lm4549.o
  CC      hw/audio/marvell_88w8618.o
  CC      hw/block/block.o
  CC      hw/block/cdrom.o
  CC      hw/block/hd-geometry.o
  CC      hw/block/fdc.o
  CC      hw/block/m25p80.o
  CC      hw/block/nand.o
  CC      hw/block/pflash_cfi01.o
  CC      hw/block/pflash_cfi02.o
  CC      hw/block/ecc.o
  CC      hw/block/onenand.o
  CC      hw/block/nvme.o
  CC      hw/bt/core.o
  CC      hw/bt/l2cap.o
  CC      hw/bt/sdp.o
  CC      hw/bt/hci.o
  CC      hw/bt/hid.o
  CC      hw/bt/hci-csr.o
  CC      hw/char/ipoctal232.o
  CC      hw/char/parallel.o
  CC      hw/char/pl011.o
  CC      hw/char/serial.o
  CC      hw/char/serial-isa.o
  CC      hw/char/serial-pci.o
  CC      hw/char/virtio-console.o
  CC      hw/char/debugcon.o
  CC      hw/char/cadence_uart.o
  CC      hw/char/imx_serial.o
  CC      hw/core/qdev.o
  CC      hw/core/qdev-properties.o
  CC      hw/core/bus.o
  CC      hw/core/fw-path-provider.o
  CC      hw/core/irq.o
  CC      hw/core/hotplug.o
  CC      hw/core/ptimer.o
  CC      hw/core/sysbus.o
  CC      hw/core/machine.o
  CC      hw/core/null-machine.o
  CC      hw/core/loader.o
  CC      hw/core/qdev-properties-system.o
  CC      hw/core/register.o
  CC      hw/core/or-irq.o
  CC      hw/core/platform-bus.o
  CC      hw/display/ads7846.o
  CC      hw/display/cirrus_vga.o
  CC      hw/display/pl110.o
  CC      hw/display/ssd0303.o
  CC      hw/display/ssd0323.o
  CC      hw/display/vga-pci.o
  CC      hw/display/vga-isa.o
  CC      hw/display/vmware_vga.o
  CC      hw/display/blizzard.o
  CC      hw/display/exynos4210_fimd.o
  CC      hw/display/framebuffer.o
  CC      hw/display/tc6393xb.o
  CC      hw/dma/pl080.o
  CC      hw/dma/pl330.o
  CC      hw/dma/i8257.o
  CC      hw/dma/xlnx-zynq-devcfg.o
  CC      hw/gpio/max7310.o
  CC      hw/gpio/pl061.o
  CC      hw/gpio/zaurus.o
  CC      hw/gpio/gpio_key.o
  CC      hw/i2c/core.o
  CC      hw/i2c/smbus.o
  CC      hw/i2c/smbus_eeprom.o
  CC      hw/i2c/i2c-ddc.o
  CC      hw/i2c/versatile_i2c.o
  CC      hw/i2c/smbus_ich9.o
  CC      hw/i2c/pm_smbus.o
  CC      hw/i2c/bitbang_i2c.o
  CC      hw/i2c/exynos4210_i2c.o
  CC      hw/i2c/imx_i2c.o
  CC      hw/i2c/aspeed_i2c.o
  CC      hw/ide/core.o
  CC      hw/ide/atapi.o
  CC      hw/ide/qdev.o
  CC      hw/ide/pci.o
  CC      hw/ide/isa.o
  CC      hw/ide/piix.o
  CC      hw/ide/microdrive.o
In file included from /tmp/qemu-test/src/vl.c:126:0:
/tmp/qemu-test/src/include/hw/virtio/vhost-pci-slave.h:4:25: fatal error: linux/vhost.h: No such file or directory
 #include <linux/vhost.h>
                         ^

compilation terminated.
/tmp/qemu-test/src/rules.mak:60: recipe for target 'vl.o' failed
make: *** [vl.o] Error 1
make: *** Waiting for unfinished jobs....
make[1]: *** [docker-run] Error 2
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-w_6waclo/src'
make: *** [docker-run-test-mingw@fedora] Error 2
=== OUTPUT END ===

Test command exited with code: 2

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#40 lore raw
In reply to Wei Wang

Hi Wei,

Quoted 10 lines · Wei Wang

This patch series implements vhost-pci, which is a point-to-point based inter-vm
communication solution. The QEMU side implementation includes the vhost-user
extension, vhost-pci device emulation and management. The current device part
implementation is based on virtio 1.0, but it can be easily upgraded to support
the upcoming virtio 1.1.

Quoted 6 lines

The current QEMU implementation supports the polling mode driver on both sides
to receive packets. More features, such as interrupt support, live migration
support, protected memory accesses will be added later.

I highly appreciate the effort you put in splitting the patch series and commenting each, although some are probably superfluous. Before going into details, I suppose you have kernel side bits too. I'd suggest before sending individual patches for review, that you send a RFC with links to the various git trees and instructions to test the proposed device. This would really help things and potentially bring more people for testing and comments (think about libvirt side etc). Even better would be to have some tests (with qtest).

High level question, why do you need to create device dynamically? I would rather have the following qemu setup:

-chardev socket,id=chr,path=.. -device vhost-pci-net,chardev=chr

This would also avoid some global state (vp_slave etc)

Regarding the protocol changes to support slave request: I tried to explained that before, apprently I didn't manage to. It is not enough to support bidirectionnal communications to simply add chardev frontend handlers. Until now, qemu's code expects an immediate reply after a request. With your protocol change, it must now also consider that the slave may send a request before the master request reaches the slave handler. So all req/reply write()/read() must now handle in between requests from slave to be race-free (master can read back a request when it expects a reply). That's not really trivial change, that's why I proposed to have a secondary channel for slave->master communications in the past. Not only would this be easier to implement, but the protocol documentation would also be simpler, the cost is simply 1 additional unix socket (that I proposed to setup and pass with ancilliary data on the main channel).

Another question, what are vpnet->rqs used for?

Quoted 2 lines

RESEND change: Fixed some coding style issue

there are some spelling to be fixed, and perhaps some variables/fields to rename (asyn -> async, crq -> ctrlq?) That can be addressed in a detailed review.

Quoted 71 lines

Wei Wang (37):
vhost-pci-net: the fundamental vhost-pci-net device emulation
vhost-pci-net: the fundamental implementation of vhost-pci-net-pci
vhost-user: share the vhost-user protocol related structures
vl: add the vhost-pci-slave command line option
vhost-pci-slave: start the implementation of vhost-pci-slave
vhost-pci-slave: set up the fundamental handlers for the server socket vhost-pci-slave/msg: VHOST_USER_GET_FEATURES vhost-pci-slave/msg: VHOST_USER_SET_FEATURES vhost-pci-slave/msg: VHOST_USER_GET_PROTOCOL_FEATURES vhost-pci-slave/msg: VHOST_USER_SET_PROTOCOL_FEATURES vhost-user/msg: VHOST_USER_PROTOCOL_F_SET_DEVICE_ID vhost-pci-slave/msg: VHOST_USER_SET_DEVICE_ID vhost-pci-slave/msg: VHOST_USER_GET_QUEUE_NUM vhost-pci-slave/msg: VHOST_USER_SET_OWNER vhost-pci-slave/msg: VHOST_USER_SET_MEM_TABLE vhost-pci-slave/msg: VHOST_USER_SET_VRING_NUM vhost-pci-slave/msg: VHOST_USER_SET_VRING_BASE
vhost-user: send guest physical address of virtqueues to the slave vhost-pci-slave/msg: VHOST_USER_SET_VRING_ADDR vhost-pci-slave/msg: VHOST_USER_SET_VRING_KICK vhost-pci-slave/msg: VHOST_USER_SET_VRING_CALL vhost-pci-slave/msg: VHOST_USER_SET_VRING_ENABLE vhost-pci-slave/msg: VHOST_USER_SET_LOG_BASE vhost-pci-slave/msg: VHOST_USER_SET_LOG_FD vhost-pci-slave/msg: VHOST_USER_SEND_RARP vhost-pci-slave/msg: VHOST_USER_GET_VRING_BASE
vhost-pci-net: pass the info collected by vp_slave to the device
vhost-pci-net: pass the mem and vring info to the driver vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (start) vhost-pci-slave/msg: VHOST_USER_SET_VHOST_PCI (stop) vhost-user/msg: send VHOST_USER_SET_VHOST_PCI (start/stop)
vhost-user: add asynchronous read for the vhost-user master
vhost-pci-net: send the negotiated feature bits to the master
vhost-pci-slave: add "peer_reset"
vhost-pci-net: start the vhost-pci-net device vhost-user/msg: handling VHOST_USER_SET_FEATURES
vl: enable vhost-pci-slave

 hw/net/Makefile.objs                           |   2 +-
 hw/net/vhost-pci-net.c                         | 268 ++++++++++++
 hw/net/vhost_net.c                             |  39 ++
 hw/virtio/Makefile.objs                        |   1 +
 hw/virtio/vhost-pci-slave.c                    | 570
+++++++++++++++++++++++++
 hw/virtio/vhost-user.c                         | 187 ++++----
 hw/virtio/vhost.c                              |  64 ++-
 hw/virtio/virtio-pci.c                         |  80 ++++
 hw/virtio/virtio-pci.h                         |  16 +
 include/hw/pci/pci.h                           |   1 +
 include/hw/virtio/vhost-backend.h              |   2 +
 include/hw/virtio/vhost-pci-net.h              |  45 ++
 include/hw/virtio/vhost-pci-slave.h            |  46 ++
 include/hw/virtio/vhost-user.h                 | 109 +++++
 include/hw/virtio/vhost.h                      |   3 +
 include/net/vhost-user.h                       |  22 +-
 include/net/vhost_net.h                        |   2 +
 include/standard-headers/linux/vhost_pci_net.h |  85 ++++
 include/standard-headers/linux/virtio_ids.h    |  29 +-
 net/vhost-user.c                               |  37 +-
 qemu-options.hx                                |   4 +
 vl.c                                           |  43 ++
 22 files changed, 1520 insertions(+), 135 deletions(-)
 create mode 100644 hw/net/vhost-pci-net.c
 create mode 100644 hw/virtio/vhost-pci-slave.c
 create mode 100644 include/hw/virtio/vhost-pci-net.h
 create mode 100644 include/hw/virtio/vhost-pci-slave.h
 create mode 100644 include/hw/virtio/vhost-user.h
 create mode 100644 include/standard-headers/linux/vhost_pci_net.h
Quoted 4 lines

--
2.7.4

--

Marc-André Lureau

author
#41 lore raw

Hi Marc-André, thanks for the comments.

Quoted 22 lines · Marc-André Lureau

Hi Wei,

On Mon, Dec 19, 2016 at 7:00 AM Wei Wang <[email protected] <mailto:[email protected]>> wrote:

This patch series implements vhost-pci, which is a point-to-point based inter-vm
communication solution. The QEMU side implementation includes the vhost-user
extension, vhost-pci device emulation and management. The current device part
implementation is based on virtio 1.0, but it can be easily upgraded to support
the upcoming virtio 1.1.

The current QEMU implementation supports the polling mode driver on both sides
to receive packets. More features, such as interrupt support, live migration
support, protected memory accesses will be added later.

Quoted 1 line

I highly appreciate the effort you put in splitting the patch series and commenting each, although some are probably superfluous.

I will see if I can combine some of the unnecessary splits in the next version.

Quoted 1 line

Before going into details, I suppose you have kernel side bits too. I'd suggest before sending individual patches for review, that you send a RFC with links to the various git trees and instructions to test the proposed device. This would really help things and potentially bring more people for testing and comments (think about libvirt side etc). Even better would be to have some tests (with qtest).

The driver is still in the draft version (functional with simple tests like Ping, but not ready for a robust test yet). If that helps, I can share the draft version and people can use that to verify the correctness of the device part implementation in QEMU.

Quoted 5 lines

High level question, why do you need to create device dynamically? I would rather have the following qemu setup:

-chardev socket,id=chr,path=.. -device vhost-pci-net,chardev=chr

This would also avoid some global state (vp_slave etc)

With the above commands, the slave QEMU will create and plug in the vhost-pci-net device at the QEMU booting time. I think this won't work, because at the slave QEMU booting time, the master, in most cases, hasn't connected to the slave to transmit the info (e.g. memory info) that's required for the device setup - for example, the device bar can't be constructed without the memory info passed from the master, and if the device is created and plugged in the VM without a bar at the beginning, I think we don't have another chance to add a bar on the fly when the device is already driven in the guest. That's the reason that I get a global vp_slave to manage (dynamically create/destroy a device when requested by the master) the vhost-pci device.

Quoted 2 lines

Regarding the protocol changes to support slave request: I tried to explained that before, apprently I didn't manage to. It is not enough to support bidirectionnal communications to simply add chardev frontend handlers. Until now, qemu's code expects an immediate reply after a request. With your protocol change, it must now also consider that the slave may send a request before the master request reaches the slave handler. So all req/reply write()/read() must now handle in between requests from slave to be race-free (master can read back a request when it expects a reply). That's not really trivial change, that's why I proposed to have a secondary channel for slave->master communications in the past. Not only would this be easier to implement, but the protocol documentation would also be simpler, the cost is simply 1 additional unix socket (that I proposed to setup and pass with ancilliary data on the main channel).

I don't disagree with the second channel method. That implementation hasn't been in the upstream QEMU yet, are you planning to get it in first, so that we can upstream vhost-pci based on that?

Quoted 1 line

Another question, what are vpnet->rqs used for?

This should be redundant, I will remove it.

Quoted 6 lines

RESEND change: Fixed some coding style issue

there are some spelling to be fixed, and perhaps some variables/fields to rename (asyn -> async, crq -> ctrlq?) That can be addressed in a detailed review.

Sure, I will fix them.

Best,
Wei

author
#42 lore raw
Quoted 8 lines · Wei Wang

Hi Marc-André, thanks for the comments.

Quoted 1 line · Marc-André Lureau

Another question, what are vpnet->rqs used for?

This should be redundant, I will remove it.

I think I should explain more about this: the rqs field is redundant in the vpnet structure. But the rq is needed for the datapath.

The vhost-pci driver works like this (taking the single queue case as an example):
It has three queues, mirrored tq, mirrored rq (shared from virtio-net, buffers inside them are memory from the master guest) and the rq (buffers inside it are memory allocated by the slave guest itself). The packets grabbed from the mirrored rq, are copied to the buf got from the slave's own rq, and then delivered to the slave network stack. We need the rq because:
1) the buffers from the mirrored rq are from the master guest, so the slave network stack, by default, will free the skb buf that was not allocated;
2) the buffer fetched from the mirrored rq "avail" needs be returned to "used", it causes a problem if the buffer has been freed by the master and re-assigned to other code to use while it hasn't been handled by slave side network stack?
3) Interrupt support: we will need the rq interrupt, so that virtio-net can notify vhost-pci-net to grab packets.

Best,
Wei

author
#43 lore raw
In reply to Wei Wang

Hi Marc-André,

Do you have any comments on the responses? Thanks.

Quoted 43 lines · Wei Wang

Hi Marc-André, thanks for the comments.

Quoted 22 lines · Marc-André Lureau

Hi Wei,

On Mon, Dec 19, 2016 at 7:00 AM Wei Wang <[email protected] <mailto:[email protected]>> wrote:

This patch series implements vhost-pci, which is a point-to-point based inter-vm
communication solution. The QEMU side implementation includes the vhost-user
extension, vhost-pci device emulation and management. The current device part
implementation is based on virtio 1.0, but it can be easily upgraded to support
the upcoming virtio 1.1.

The current QEMU implementation supports the polling mode driver on both sides
to receive packets. More features, such as interrupt support, live migration
support, protected memory accesses will be added later.

Quoted 1 line

I highly appreciate the effort you put in splitting the patch series and commenting each, although some are probably superfluous.

I will see if I can combine some of the unnecessary splits in the next version.

Quoted 5 lines

High level question, why do you need to create device dynamically? I would rather have the following qemu setup:

-chardev socket,id=chr,path=.. -device vhost-pci-net,chardev=chr

This would also avoid some global state (vp_slave etc)

With the above commands, the slave QEMU will create and plug in the vhost-pci-net device at the QEMU booting time. I think this won't work, because at the slave QEMU booting time, the master, in most cases, hasn't connected to the slave to transmit the info (e.g. memory info) that's required for the device setup - for example, the device bar can't be constructed without the memory info passed from the master, and if the device is created and plugged in the VM without a bar at the beginning, I think we don't have another chance to add a bar on the fly when the device is already driven in the guest. That's the reason that I get a global vp_slave to manage (dynamically create/destroy a device when requested by the master) the vhost-pci device.

Quoted 2 lines

Regarding the protocol changes to support slave request: I tried to explained that before, apprently I didn't manage to. It is not enough to support bidirectionnal communications to simply add chardev frontend handlers. Until now, qemu's code expects an immediate reply after a request. With your protocol change, it must now also consider that the slave may send a request before the master request reaches the slave handler. So all req/reply write()/read() must now handle in between requests from slave to be race-free (master can read back a request when it expects a reply). That's not really trivial change, that's why I proposed to have a secondary channel for slave->master communications in the past. Not only would this be easier to implement, but the protocol documentation would also be simpler, the cost is simply 1 additional unix socket (that I proposed to setup and pass with ancilliary data on the main channel).

I don't disagree with the second channel method. That implementation hasn't been in the upstream QEMU yet, are you planning to get it in first, so that we can upstream vhost-pci based on that?

Quoted 1 line
Quoted 7 lines
Quoted 4 lines

RESEND change: Fixed some coding style issue

there are some spelling to be fixed, and perhaps some variables/fields to rename (asyn -> async, crq -> ctrlq?) That can be addressed in a detailed review.

Sure, I will fix them.

Best,
Wei

author
#44 lore raw
In reply to Marc-André Lureau

Hi Marc-André

Quoted 20 lines · Marc-André Lureau

On Mon, Dec 19, 2016 at 7:00 AM Wei Wang <[email protected] <mailto:[email protected]>> wrote:

This patch series implements vhost-pci, which is a point-to-point based inter-vm
communication solution. The QEMU side implementation includes the vhost-user
extension, vhost-pci device emulation and management. The current device part
implementation is based on virtio 1.0, but it can be easily upgraded to support
the upcoming virtio 1.1.

The current QEMU implementation supports the polling mode driver on both sides
to receive packets. More features, such as interrupt support, live migration
support, protected memory accesses will be added later.

Quoted 1 line

I highly appreciate the effort you put in splitting the patch series and commenting each, although some are probably superfluous. Before going into details, I suppose you have kernel side bits too. I'd suggest before sending individual patches for review, that you send a RFC with links to the various git trees and instructions to test the proposed device. This would really help things and potentially bring more people for testing and comments (think about libvirt side etc). Even better would be to have some tests (with qtest).

The code is ready to try. I plan to clean up the driver to upstream when the QEMU device part is finalized.

The QEMU code is available at: git clone https://github.com/wei-w-wang/vhost-pci-device
The driver: git clone https://github.com/wei-w-wang/vhost-pci-driver

I have a README.md under vhost-pci-device/ , which introduces the steps to try the implementation. I will rename the variables/fields that you mentioned in the v2 version. Thanks.

Best,
Wei

author
#45 lore raw
Quoted 25 lines · Wei Wang

Hi Marc-André

Quoted 20 lines · Marc-André Lureau

On Mon, Dec 19, 2016 at 7:00 AM Wei Wang <[email protected] <mailto:[email protected]>> wrote:

This patch series implements vhost-pci, which is a point-to-point based inter-vm
communication solution. The QEMU side implementation includes the vhost-user
extension, vhost-pci device emulation and management. The current device part
implementation is based on virtio 1.0, but it can be easily upgraded to support
the upcoming virtio 1.1.

The current QEMU implementation supports the polling mode driver on both sides
to receive packets. More features, such as interrupt support, live migration
support, protected memory accesses will be added later.

Quoted 1 line

I highly appreciate the effort you put in splitting the patch series and commenting each, although some are probably superfluous. Before going into details, I suppose you have kernel side bits too. I'd suggest before sending individual patches for review, that you send a RFC with links to the various git trees and instructions to test the proposed device. This would really help things and potentially bring more people for testing and comments (think about libvirt side etc). Even better would be to have some tests (with qtest).

Quoted 7 lines

The code is ready to try. I plan to clean up the driver to upstream when the QEMU device part is finalized.

The QEMU code is available at: git clone https://github.com/wei-w-wang/vhost-pci-device
The driver: git clone https://github.com/wei-w-wang/vhost-pci-driver

I have a README.md under vhost-pci-device/ , which introduces the steps to try the implementation. I will rename the variables/fields that you mentioned in the v2 version. Thanks.

README.md is under vhost-pci-driver/

Best,
Wei