diff mbox series

[RFC,v3,18/45] multi-process: support dev id in config read/write

Message ID 74468c1d1d6d7ff7afb08d367edb6979ea5e3a31.1567534653.git.jag.raman@oracle.com (mailing list archive)
State New, archived
Headers show
Series Initial support of multi-process qemu | expand

Commit Message

Jag Raman Sept. 3, 2019, 8:37 p.m. UTC
From: Elena Ufimtseva <elena.ufimtseva@oracle.com>

Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
---
 New patch in v3

 hw/proxy/qemu-proxy.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hw/proxy/qemu-proxy.c b/hw/proxy/qemu-proxy.c
index 1021045..789f39a 100644
--- a/hw/proxy/qemu-proxy.c
+++ b/hw/proxy/qemu-proxy.c
@@ -151,12 +151,16 @@  static void set_proxy_sock(PCIDevice *dev, int socket)
 }
 
 static int config_op_send(PCIProxyDev *dev, uint32_t addr, uint32_t *val, int l,
-                          unsigned int op)
+                          char *id, unsigned int op)
 {
     ProcMsg msg;
     struct conf_data_msg conf_data;
     int wait;
 
+    if (!id) {
+        return -EINVAL;
+    }
+
     memset(&msg, 0, sizeof(ProcMsg));
     conf_data.addr = addr;
     conf_data.val = (op == CONF_WRITE) ? *val : 0;
@@ -171,6 +175,8 @@  static int config_op_send(PCIProxyDev *dev, uint32_t addr, uint32_t *val, int l,
     msg.size = sizeof(conf_data);
     msg.cmd = op;
     msg.bytestream = 1;
+    msg.id = (uint8_t *)g_strdup(dev->dev_id);
+    msg.size_id = strlen(dev->dev_id) + 1;
 
     if (op == CONF_WRITE) {
         msg.num_fds = 0;
@@ -188,6 +194,7 @@  static int config_op_send(PCIProxyDev *dev, uint32_t addr, uint32_t *val, int l,
     }
 
     free(msg.data2);
+    free(msg.id);
 
     return 0;
 }
@@ -198,7 +205,8 @@  static uint32_t pci_proxy_read_config(PCIDevice *d, uint32_t addr, int len)
 
     (void)pci_default_read_config(d, addr, len);
 
-    config_op_send(PCI_PROXY_DEV(d), addr, &val, len, CONF_READ);
+    config_op_send(PCI_PROXY_DEV(d), addr, &val, len,
+                   PCI_PROXY_DEV(d)->dev_id, CONF_READ);
 
     return val;
 }
@@ -208,7 +216,8 @@  static void pci_proxy_write_config(PCIDevice *d, uint32_t addr, uint32_t val,
 {
     pci_default_write_config(d, addr, val, l);
 
-    config_op_send(PCI_PROXY_DEV(d), addr, &val, l, CONF_WRITE);
+    config_op_send(PCI_PROXY_DEV(d), addr, &val, l,
+                   PCI_PROXY_DEV(d)->dev_id, CONF_WRITE);
 }
 
 static void pci_proxy_dev_class_init(ObjectClass *klass, void *data)