[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v4 PATCH 24/49] multi-process: add processing of remote drive and d
From: |
Jagannathan Raman |
Subject: |
[RFC v4 PATCH 24/49] multi-process: add processing of remote drive and device command line |
Date: |
Thu, 24 Oct 2019 05:09:05 -0400 |
From: Elena Ufimtseva <address@hidden>
Add processing of command line options drive and device.
After remote devices are created along with their proxies,
signal the proxies to finish the configuration steps.
Signed-off-by: John G Johnson <address@hidden>
Signed-off-by: Jagannathan Raman <address@hidden>
Signed-off-by: Elena Ufimtseva <address@hidden>
---
v1 -> v2:
- change command line option for remote process drive/device to
use existing -drive/-device options
- process drive and device options only after non-remote devices
and drives are added
vl.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/vl.c b/vl.c
index 4489cfb..b19c57b 100644
--- a/vl.c
+++ b/vl.c
@@ -35,6 +35,11 @@
#include "sysemu/runstate.h"
#include "sysemu/seccomp.h"
#include "sysemu/tcg.h"
+#include "qapi/qmp/qdict.h"
+#include "block/qdict.h"
+#include "qapi/qmp/qstring.h"
+#include "qapi/qmp/qjson.h"
+#include "qapi/qmp/qlist.h"
#ifdef CONFIG_SDL
#if defined(__APPLE__) || defined(main)
@@ -1136,11 +1141,45 @@ static int cleanup_add_fd(void *opaque, QemuOpts *opts,
Error **errp)
#define MTD_OPTS ""
#define SD_OPTS ""
+#if defined(CONFIG_MPQEMU)
+static int rdrive_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+ DeviceState *dev;
+
+ dev = qdev_remote_add(opts, false /* this is drive */, errp);
+ if (!dev) {
+ error_setg(errp, "qdev_remote_add failed for drive.");
+ return -1;
+ }
+ object_unref(OBJECT(dev));
+ return 0;
+}
+#endif
+
+#if defined(CONFIG_MPQEMU)
+static int pass;
+#endif
+
static int drive_init_func(void *opaque, QemuOpts *opts, Error **errp)
{
BlockInterfaceType *block_default_type = opaque;
+#if defined(CONFIG_MPQEMU)
+ const char *remote;
+
+ remote = qemu_opt_get(opts, "remote");
+ if (pass && remote) {
+ return rdrive_init_func(opaque, opts, errp);
+ } else {
+ if (!remote && !pass) {
+ drive_new(opts, *block_default_type, errp);
+ }
+ }
+
+ return 0;
+#else
return drive_new(opts, *block_default_type, errp) == NULL;
+#endif
}
static int drive_enable_snapshot(void *opaque, QemuOpts *opts, Error **errp)
@@ -2199,10 +2238,35 @@ static int device_help_func(void *opaque, QemuOpts
*opts, Error **errp)
return qdev_device_help(opts);
}
+#if defined(CONFIG_MPQEMU)
+static int rdevice_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+ DeviceState *dev;
+
+ dev = qdev_remote_add(opts, true /* this is device */, errp);
+ if (!dev) {
+ error_setg(errp, "qdev_remote_add failed for device.");
+ return -1;
+ }
+ object_unref(OBJECT(dev));
+ return 0;
+}
+#endif
+
static int device_init_func(void *opaque, QemuOpts *opts, Error **errp)
{
DeviceState *dev;
+#if defined(CONFIG_MPQEMU)
+ const char *remote;
+
+ remote = qemu_opt_get(opts, "remote");
+ if (remote) {
+ /* This will be a remote process */
+ return rdevice_init_func(opaque, opts, errp);
+ }
+#endif
+
dev = qdev_device_add(opts, errp);
if (!dev) {
return -1;
@@ -4348,6 +4412,17 @@ int main(int argc, char **argv, char **envp)
/* Check if IGD GFX passthrough. */
igd_gfx_passthru();
+#if defined(CONFIG_MPQEMU)
+ /*
+ * Parse the list for remote drives here as we launch PCIProxyDev here and
+ * need PCI host initialized. As a TODO: could defer init of PCIProxyDev
instead.
+ */
+ if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func,
+ &machine_class->block_default_type, &error_fatal)) {
+ exit(0);
+ }
+#endif
+
/* init generic devices */
rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE);
qemu_opts_foreach(qemu_find_opts("device"),
@@ -4405,6 +4480,9 @@ int main(int argc, char **argv, char **envp)
qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
qemu_run_machine_init_done_notifiers();
+#if defined(CONFIG_MPQEMU)
+ qdev_proxy_fire();
+#endif
if (rom_check_and_register_reset() != 0) {
error_report("rom check and register reset failed");
exit(1);
--
1.8.3.1
- [RFC v4 PATCH 13/49] multi-process: introduce proxy object, (continued)
- [RFC v4 PATCH 13/49] multi-process: introduce proxy object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 14/49] mutli-process: build remote command line args, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 16/49] multi-process: Add LSI device proxy object, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 15/49] multi-process: PCI BAR read/write handling for proxy & remote endpoints, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 19/49] multi-process: configure remote side devices, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 18/49] multi-process: create IOHUB object to handle irq, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 20/49] multi-process: add qdev_proxy_add to create proxy devices, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 21/49] multi-process: remote: add setup_devices and setup_drive msg processing, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 22/49] multi-process: remote: use fd for socket from parent process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 23/49] multi-process: remote: add create_done condition, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 24/49] multi-process: add processing of remote drive and device command line,
Jagannathan Raman <=
- [RFC v4 PATCH 26/49] multi-process: refractor vl.c code to re-use in remote, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 27/49] multi-process: add remote option, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 28/49] multi-process: add remote options parser, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 30/49] multi-process: send heartbeat messages to remote, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 31/49] multi-process: handle heartbeat messages in remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 32/49] multi-process: Use separate MMIO communication channel, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 34/49] multi-process/mon: choose HMP commands based on target, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 35/49] multi-process/mon: stub functions to enable QMP module for remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 36/49] multi-process/mon: enable QMP module support in the remote process, Jagannathan Raman, 2019/10/24
- [RFC v4 PATCH 38/49] multi-process/mon: Initialize QMP module for remote processes, Jagannathan Raman, 2019/10/24