* [Qemu-devel] [RFC PATCH v2 19/35] multi-process: store info about the remote process
@ 2019-06-17 18:16 elena.ufimtseva
0 siblings, 0 replies; only message in thread
From: elena.ufimtseva @ 2019-06-17 18:16 UTC (permalink / raw)
To: qemu-devel
Cc: elena.ufimtseva, john.g.johnson, jag.raman, ehabkost, konrad.wilk,
ross.lagerwall, liran.alon, stefanha, kanth.ghatraju
From: Elena Ufimtseva <elena.ufimtseva@oracle.com>
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 <john.g.johnson@oracle.com>
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-17 18:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-17 18:16 [Qemu-devel] [RFC PATCH v2 19/35] multi-process: store info about the remote process elena.ufimtseva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).