multi-process: configure remote side devices
RFC PATCH v2 23/35 multi-process: configure remote side devices
From: Elena Ufimtseva <[email protected]>
Add functions to configure remote devices.
Signed-off-by Elena Ufimtseva <[email protected]>
Signed-off-by John G Johnson <[email protected]>
Signed-off-by Jagannathan Raman <[email protected]>
--- 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(-)
hw/proxy/qemu-proxy.c +37 -1
@@ -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,
include/hw/proxy/qemu-proxy.h +2 -0
@@ -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"
include/io/proxy-link.h +2 -0
@@ -72,6 +72,8 @@ typedef enum {BAR_WRITE ,BAR_READ ,SET_IRQFD , +DEV_OPTS , +DRIVE_OPTS ,DEVICE_ADD ,DEVICE_DEL , MAX,
Signature · 1 line
2.17.1