multi-process: store info about the remote process
RFC PATCH v2 19/35 multi-process: store info about the remote process
From: Elena Ufimtseva <[email protected]>
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 <[email protected]>
Signed-off-by Elena Ufimtseva <[email protected]>
Signed-off-by Jagannathan Raman <[email protected]>
---
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(+)
hw/core/machine.c +12 -0
@@ -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;
hw/proxy/qemu-proxy.c +7 -0
@@ -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);
include/hw/boards.h +4 -0
@@ -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) \
Signature · 1 line
2.17.1