[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v3 PATCH 37/45] multi-process: perform device reset in
From: |
Jagannathan Raman |
Subject: |
[Qemu-devel] [RFC v3 PATCH 37/45] multi-process: perform device reset in the remote process |
Date: |
Tue, 3 Sep 2019 16:38:03 -0400 |
Perform device reset in the remote process when QEMU performs
device reset. This is required to reset the internal state
(like registers, etc...) of emulated devices
Signed-off-by: Elena Ufimtseva <address@hidden>
Signed-off-by: John G Johnson <address@hidden>
Signed-off-by: Jagannathan Raman <address@hidden>
---
New patch in v3
hw/proxy/proxy-lsi53c895a.c | 6 ++++++
hw/proxy/qemu-proxy.c | 14 ++++++++++++++
include/hw/proxy/qemu-proxy.h | 2 ++
include/io/proxy-link.h | 1 +
remote/remote-main.c | 11 +++++++++++
5 files changed, 34 insertions(+)
diff --git a/hw/proxy/proxy-lsi53c895a.c b/hw/proxy/proxy-lsi53c895a.c
index e8a8d36..8640749 100644
--- a/hw/proxy/proxy-lsi53c895a.c
+++ b/hw/proxy/proxy-lsi53c895a.c
@@ -128,6 +128,11 @@ static void proxy_lsi_realize(PCIProxyDev *dev, Error
**errp)
pci_register_bar(pci_dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->ram_io);
}
+static void proxy_lsi_reset(DeviceState *dev)
+{
+ proxy_device_reset(dev);
+}
+
static void proxy_lsi_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -145,6 +150,7 @@ static void proxy_lsi_class_init(ObjectClass *klass, void
*data)
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
dc->desc = "LSI Proxy Device";
+ dc->reset = proxy_lsi_reset;
}
static const TypeInfo lsi_proxy_dev_type_info = {
diff --git a/hw/proxy/qemu-proxy.c b/hw/proxy/qemu-proxy.c
index db9a208..c812145 100644
--- a/hw/proxy/qemu-proxy.c
+++ b/hw/proxy/qemu-proxy.c
@@ -588,3 +588,17 @@ uint64_t proxy_default_bar_read(PCIProxyDev *dev,
MemoryRegion *mr, hwaddr addr,
return val;
}
+
+void proxy_device_reset(DeviceState *dev)
+{
+ PCIProxyDev *pdev = PCI_PROXY_DEV(dev);
+ ProcMsg msg;
+
+ memset(&msg, 0, sizeof(ProcMsg));
+
+ msg.bytestream = 0;
+ msg.size = sizeof(msg.data1);
+ msg.cmd = DEVICE_RESET;
+
+ proxy_proc_send(pdev->proxy_link, &msg, pdev->proxy_link->com);
+}
diff --git a/include/hw/proxy/qemu-proxy.h b/include/hw/proxy/qemu-proxy.h
index a03c6cc..d88fbd4 100644
--- a/include/hw/proxy/qemu-proxy.h
+++ b/include/hw/proxy/qemu-proxy.h
@@ -100,4 +100,6 @@ void proxy_default_bar_write(PCIProxyDev *dev, MemoryRegion
*mr, hwaddr addr,
uint64_t proxy_default_bar_read(PCIProxyDev *dev, MemoryRegion *mr, hwaddr
addr,
unsigned size, bool memory);
+void proxy_device_reset(DeviceState *dev);
+
#endif /* QEMU_PROXY_H */
diff --git a/include/io/proxy-link.h b/include/io/proxy-link.h
index 32b2c1a..eb51d29 100644
--- a/include/io/proxy-link.h
+++ b/include/io/proxy-link.h
@@ -76,6 +76,7 @@ typedef enum {
DEVICE_DEL,
PROXY_PING,
MMIO_RETURN,
+ DEVICE_RESET,
MAX,
} proc_cmd_t;
diff --git a/remote/remote-main.c b/remote/remote-main.c
index 2a9ebae..a6ff338 100644
--- a/remote/remote-main.c
+++ b/remote/remote-main.c
@@ -66,6 +66,9 @@
#include "qemu/cutils.h"
#include "remote-opts.h"
+#include "monitor/monitor.h"
+#include "sysemu/reset.h"
+
static ProxyLinkState *proxy_link;
typedef struct remote_pci_devs {
@@ -302,6 +305,11 @@ fail:
del_from_pci_devs_list((const char *)msg->id);
}
+static void process_device_reset_msg(ProcMsg *msg)
+{
+ qemu_devices_reset();
+}
+
static int init_drive(QDict *rqdict, Error **errp)
{
QemuOpts *opts;
@@ -520,6 +528,9 @@ static void process_msg(GIOCondition cond, ProcChannel
*chan)
notify_proxy(wait, (uint32_t)getpid());
PUT_REMOTE_WAIT(wait);
break;
+ case DEVICE_RESET:
+ process_device_reset_msg(msg);
+ break;
default:
error_setg(&err, "Unknown command");
goto finalize_loop;
--
1.8.3.1
- [Qemu-devel] [RFC v3 PATCH 26/45] multi-process: remote: add create_done condition, (continued)
- [Qemu-devel] [RFC v3 PATCH 26/45] multi-process: remote: add create_done condition, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 23/45] multi-process: add qdev_proxy_add to create proxy devices, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 29/45] multi-process: refractor vl.c code to re-use in remote, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 28/45] multi-process: Introduce build flags to separate remote process code, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 30/45] multi-process: add remote option, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 32/45] multi-process: add parse_cmdline in remote process, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 31/45] multi-process: add remote options parser, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 34/45] multi-process: add heartbeat timer and signal handler, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 33/45] multi-process: add support for multiple devices, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 35/45] multi-process: handle heartbeat messages in remote process, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 37/45] multi-process: perform device reset in the remote process,
Jagannathan Raman <=
- [Qemu-devel] [RFC v3 PATCH 38/45] multi-process/mon: stub functions to enable QMP module for remote process, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 39/45] multi-process/mon: build system for QMP module in remote process, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 36/45] multi-process: Use separate MMIO communication channel, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 40/45] multi-process/mon: Refactor monitor/chardev functions out of vl.c, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 42/45] multi-process/mon: Initialize QMP module for remote processes, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 43/45] multi-process: prevent duplicate memory initialization in remote, Jagannathan Raman, 2019/09/03
- [Qemu-devel] [RFC v3 PATCH 01/45] multi-process: memory: alloc RAM from file at offset, Jagannathan Raman, 2019/09/03