qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v2 19/35] multi-process: store info about the re


From: elena . ufimtseva
Subject: [Qemu-devel] [RFC PATCH v2 19/35] multi-process: store info about the remote process
Date: Mon, 17 Jun 2019 11:16:17 -0700

From: Elena Ufimtseva <address@hidden>

Store info about the remote process in a hash table, so that
it could be used later for QMP/HMP commands.

Signed-off-by: John G Johnson <address@hidden>
Signed-off-by: Elena Ufimtseva <address@hidden>
Signed-off-by: Jagannathan Raman <address@hidden>
---
 Changes in v2:
 - moved the “remote_devs” object from “pcms” (PCMachineState)
 to “ms” (MachineState).
---
 hw/core/machine.c     | 12 ++++++++++++
 hw/proxy/qemu-proxy.c |  7 +++++++
 include/hw/boards.h   |  4 ++++
 3 files changed, 23 insertions(+)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 743fef2898..0e6e6c0829 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -821,6 +821,14 @@ static void machine_class_base_init(ObjectClass *oc, void 
*data)
     }
 }
 
+#ifdef CONFIG_MPQEMU
+static void rem_list_destroy_key(gpointer data)
+{
+    void *key = data;
+    g_free(key);
+}
+#endif
+
 static void machine_initfn(Object *obj)
 {
     MachineState *ms = MACHINE(obj);
@@ -854,6 +862,10 @@ static void machine_initfn(Object *obj)
                                         NULL);
     }
 
+#ifdef CONFIG_MPQEMU
+    ms->remote_devs = g_hash_table_new_full(g_str_hash, g_str_equal,
+                                            rem_list_destroy_key, NULL);
+#endif
 
     /* Register notifier when init is done for sysbus sanity checks */
     ms->sysbus_notifier.notify = machine_init_notify;
diff --git a/hw/proxy/qemu-proxy.c b/hw/proxy/qemu-proxy.c
index 6e65600c45..c691a05dac 100644
--- a/hw/proxy/qemu-proxy.c
+++ b/hw/proxy/qemu-proxy.c
@@ -50,6 +50,7 @@
 #include "qemu/event_notifier.h"
 #include "sysemu/kvm.h"
 #include "util/event_notifier-posix.c"
+#include "hw/boards.h"
 
 /*
  * TODO: kvm_vm_ioctl is only available for per-target objects (NEED_CPU_H).
@@ -299,6 +300,12 @@ static void pci_proxy_dev_realize(PCIDevice *device, Error 
**errp)
     PCIProxyDev *dev = PCI_PROXY_DEV(device);
     PCIProxyDevClass *k = PCI_PROXY_DEV_GET_CLASS(dev);
     Error *local_err = NULL;
+    MachineState *ms = MACHINE(current_machine);
+    DeviceState *d = DEVICE(dev);
+
+
+    (void)g_hash_table_insert(ms->remote_devs, (gpointer)g_strdup(d->id),
+                              (gpointer)dev);
 
     if (k->realize) {
         k->realize(dev, &local_err);
diff --git a/include/hw/boards.h b/include/hw/boards.h
index e231860666..bdc519aba9 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -3,6 +3,8 @@
 #ifndef HW_BOARDS_H
 #define HW_BOARDS_H
 
+#include <gmodule.h>
+
 #include "sysemu/blockdev.h"
 #include "sysemu/accel.h"
 #include "hw/qdev.h"
@@ -274,6 +276,8 @@ struct MachineState {
     AccelState *accelerator;
     CPUArchIdList *possible_cpus;
     struct NVDIMMState *nvdimms_state;
+
+    GHashTable *remote_devs;
 };
 
 #define DEFINE_MACHINE(namestr, machine_initfn) \
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]