* [Qemu-devel] [RFC PATCH v2 23/35] multi-process: configure remote side devices
@ 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, konrad.wilk, berrange,
ross.lagerwall, liran.alon, stefanha, kanth.ghatraju
From: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Add functions to configure remote devices.
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
hw/proxy/qemu-proxy.c | 38 ++++++++++++++++++++++++++++++++++-
include/hw/proxy/qemu-proxy.h | 2 ++
include/io/proxy-link.h | 2 ++
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/hw/proxy/qemu-proxy.c b/hw/proxy/qemu-proxy.c
index c691a05dac..1666cc546e 100644
--- a/hw/proxy/qemu-proxy.c
+++ b/hw/proxy/qemu-proxy.c
@@ -51,6 +51,7 @@
#include "sysemu/kvm.h"
#include "util/event_notifier-posix.c"
#include "hw/boards.h"
+#include "include/qemu/log.h"
/*
* TODO: kvm_vm_ioctl is only available for per-target objects (NEED_CPU_H).
@@ -60,6 +61,39 @@
int kvm_vm_ioctl(KVMState *s, int type, ...);
static void pci_proxy_dev_realize(PCIDevice *dev, Error **errp);
+static void setup_irqfd(PCIProxyDev *dev);
+
+static void proxy_ready(PCIDevice *dev)
+{
+ PCIProxyDev *pdev = PCI_PROXY_DEV(dev);
+
+ setup_irqfd(pdev);
+}
+
+static void set_remote_opts(PCIDevice *dev, QDict *qdict, unsigned int cmd)
+{
+ QString *qstr;
+ ProcMsg msg;
+ const char *str;
+ PCIProxyDev *pdev;
+
+ pdev = PCI_PROXY_DEV(dev);
+
+ qstr = qobject_to_json(QOBJECT(qdict));
+ str = qstring_get_str(qstr);
+
+ memset(&msg, 0, sizeof(ProcMsg));
+
+ msg.data2 = (uint8_t *)str;
+ msg.cmd = cmd;
+ msg.bytestream = 1;
+ msg.size = qstring_get_length(qstr) + 1;
+ msg.num_fds = 0;
+
+ proxy_proc_send(pdev->proxy_link, &msg);
+
+ return;
+}
int remote_spawn(PCIProxyDev *pdev, const char *command, Error **errp)
{
@@ -292,7 +326,6 @@ static void init_proxy(PCIDevice *dev, char *command, Error **errp)
proxy_link_set_sock(pdev->proxy_link, pdev->rsocket);
configure_memory_sync(pdev->sync, pdev->proxy_link);
- setup_irqfd(pdev);
}
static void pci_proxy_dev_realize(PCIDevice *device, Error **errp)
@@ -319,6 +352,9 @@ static void pci_proxy_dev_realize(PCIDevice *device, Error **errp)
dev->init_proxy = init_proxy;
dev->sync = REMOTE_MEM_SYNC(object_new(TYPE_MEMORY_LISTENER));
+ dev->set_remote_opts = set_remote_opts;
+ dev->proxy_ready = proxy_ready;
+
}
static void send_bar_access_msg(ProxyLinkState *proxy_link, MemoryRegion *mr,
diff --git a/include/hw/proxy/qemu-proxy.h b/include/hw/proxy/qemu-proxy.h
index b73077940c..4e949f778b 100644
--- a/include/hw/proxy/qemu-proxy.h
+++ b/include/hw/proxy/qemu-proxy.h
@@ -29,6 +29,8 @@
#include "hw/proxy/memory-sync.h"
#include "hw/pci/pci.h"
#include "qemu/event_notifier.h"
+#include "hw/pci/pci.h"
+#include "block/qdict.h"
#define TYPE_PCI_PROXY_DEV "pci-proxy-dev"
diff --git a/include/io/proxy-link.h b/include/io/proxy-link.h
index bf2555c97e..38bd80535a 100644
--- a/include/io/proxy-link.h
+++ b/include/io/proxy-link.h
@@ -72,6 +72,8 @@ typedef enum {
BAR_WRITE,
BAR_READ,
SET_IRQFD,
+ DEV_OPTS,
+ DRIVE_OPTS,
DEVICE_ADD,
DEVICE_DEL,
MAX,
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-17 18:31 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 23/35] multi-process: configure remote side devices 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).