@@ -50,8 +50,47 @@
#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;
+ 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;
+ if (pdev->dev_id) {
+ msg.id = (uint8_t *)pdev->dev_id;
+ msg.size_id = strlen((char *)pdev->dev_id) + 1;
+ }
+
+ proxy_proc_send(pdev->proxy_link, &msg, pdev->proxy_link->com);
+
+ return;
+}
static int add_argv(char *command_str, char **argv, int argc)
{
@@ -344,7 +383,6 @@ static void init_proxy(PCIDevice *dev, char *command, bool need_spawn, Error **e
pdev->socket);
configure_memory_sync(pdev->sync, pdev->proxy_link);
- setup_irqfd(pdev);
}
static void pci_proxy_dev_realize(PCIDevice *device, Error **errp)
@@ -364,6 +402,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/proxy-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"
@@ -70,6 +70,10 @@ typedef enum {
BAR_WRITE,
BAR_READ,
SET_IRQFD,
+ DEV_OPTS,
+ DRIVE_OPTS,
+ DEVICE_ADD,
+ DEVICE_DEL,
MAX,
} proc_cmd_t;