diff mbox

[v1,04/37] vl: add the vhost-pci-slave command line option

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

Commit Message

Wang, Wei W Dec. 17, 2016, 10:43 a.m. UTC
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

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
 qemu-options.hx |  4 ++++
 vl.c            | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)
diff mbox

Patch

diff --git a/qemu-options.hx b/qemu-options.hx
index c534a2f..5d60a1d 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -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
diff --git a/vl.c b/vl.c
index d77dd86..10d7f89 100644
--- a/vl.c
+++ b/vl.c
@@ -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,12 @@  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);
             }