@@ -50,8 +50,43 @@
#include "qemu/event_notifier.h"
#include "sysemu/kvm.h"
#include "util/event_notifier-posix.c"
+#include "hw/boards.h"
+#include "include/qemu/log.h"
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;
+ MPQemuMsg 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(MPQemuMsg));
+
+ msg.data2 = (uint8_t *)str;
+ msg.cmd = cmd;
+ msg.bytestream = 1;
+ msg.size = qstring_get_length(qstr) + 1;
+ msg.num_fds = 0;
+
+ mpqemu_msg_send(pdev->mpqemu_link, &msg, pdev->mpqemu_link->com);
+
+ return;
+}
static int add_argv(char *command_str, char **argv, int argc)
{
@@ -325,7 +360,6 @@ static void init_proxy(PCIDevice *dev, char *command, bool need_spawn, Error **e
pdev->socket);
configure_memory_sync(pdev->sync, pdev->mpqemu_link);
- setup_irqfd(pdev);
}
static void pci_proxy_dev_realize(PCIDevice *device, Error **errp)
@@ -357,6 +391,9 @@ static void pci_proxy_dev_realize(PCIDevice *device, Error **errp)
dev->get_proxy_sock = get_proxy_sock;
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(PCIProxyDev *dev, MemoryRegion *mr,
@@ -28,6 +28,8 @@
#include "io/mpqemu-link.h"
#include "hw/proxy/memory-sync.h"
#include "qemu/event_notifier.h"
+#include "hw/pci/pci.h"
+#include "block/qdict.h"
#define TYPE_PCI_PROXY_DEV "pci-proxy-dev"
@@ -68,6 +68,10 @@ typedef enum {
BAR_WRITE,
BAR_READ,
SET_IRQFD,
+ DEV_OPTS,
+ DRIVE_OPTS,
+ DEVICE_ADD,
+ DEVICE_DEL,
MAX,
} mpqemu_cmd_t;