diff mbox

[RESEND,v1,37/37] vl: enable vhost-pci-slave

Message ID 1482127152-84732-38-git-send-email-wei.w.wang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wang, Wei W Dec. 19, 2016, 5:59 a.m. UTC
Enable vhost-pci-slave in vl.c

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
 vl.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox

Patch

diff --git a/vl.c b/vl.c
index deb116e..b8649be 100644
--- a/vl.c
+++ b/vl.c
@@ -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();