[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RESEND v6 30/36] multi-process: perform device reset in the remot
From: |
elena . ufimtseva |
Subject: |
[PATCH RESEND v6 30/36] multi-process: perform device reset in the remote process |
Date: |
Wed, 22 Apr 2020 21:14:05 -0700 |
From: Elena Ufimtseva <address@hidden>
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>
---
hw/proxy/qemu-proxy.c | 25 +++++++++++++++++++++++++
include/io/mpqemu-link.h | 1 +
remote/remote-main.c | 13 +++++++++++++
3 files changed, 39 insertions(+)
diff --git a/hw/proxy/qemu-proxy.c b/hw/proxy/qemu-proxy.c
index 162014353f..cffc227acd 100644
--- a/hw/proxy/qemu-proxy.c
+++ b/hw/proxy/qemu-proxy.c
@@ -291,14 +291,39 @@ static void pci_proxy_dev_exit(PCIDevice *pdev)
stop_hb_timer(dev);
}
+static void proxy_device_reset(DeviceState *dev)
+{
+ PCIProxyDev *pdev = PCI_PROXY_DEV(dev);
+ MPQemuMsg msg;
+ int wait = -1;
+
+ memset(&msg, 0, sizeof(MPQemuMsg));
+
+ msg.bytestream = 0;
+ msg.size = sizeof(msg.data1);
+ msg.cmd = DEVICE_RESET;
+
+ wait = GET_REMOTE_WAIT;
+ msg.num_fds = 1;
+ msg.fds[0] = wait;
+
+ mpqemu_msg_send(&msg, pdev->mpqemu_link->com);
+
+ (void)wait_for_remote(wait);
+
+ PUT_REMOTE_WAIT(wait);
+}
+
static void pci_proxy_dev_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
k->realize = pci_proxy_dev_realize;
k->exit = pci_proxy_dev_exit;
k->config_read = pci_proxy_read_config;
k->config_write = pci_proxy_write_config;
+ dc->reset = proxy_device_reset;
}
static const TypeInfo pci_proxy_dev_type_info = {
diff --git a/include/io/mpqemu-link.h b/include/io/mpqemu-link.h
index 45ea1fcafa..22fb234744 100644
--- a/include/io/mpqemu-link.h
+++ b/include/io/mpqemu-link.h
@@ -51,6 +51,7 @@ typedef enum {
GET_PCI_INFO,
RET_PCI_INFO,
PROXY_PING,
+ DEVICE_RESET,
MAX,
} mpqemu_cmd_t;
diff --git a/remote/remote-main.c b/remote/remote-main.c
index beac591fac..562db4ccc3 100644
--- a/remote/remote-main.c
+++ b/remote/remote-main.c
@@ -39,6 +39,7 @@
#include "exec/address-spaces.h"
#include "remote/iohub.h"
#include "remote-opts.h"
+#include "sysemu/reset.h"
static void process_msg(GIOCondition cond, MPQemuLinkState *link,
MPQemuChannel *chan);
@@ -208,6 +209,15 @@ static void process_get_pci_info_msg(MPQemuLinkState
*link, MPQemuMsg *msg)
mpqemu_msg_send(&ret, link->dev);
}
+static void process_device_reset_msg(MPQemuMsg *msg)
+{
+ qemu_devices_reset();
+
+ if (msg->num_fds == 1) {
+ notify_proxy(msg->fds[0], 0);
+ }
+}
+
static void process_msg(GIOCondition cond, MPQemuLinkState *link,
MPQemuChannel *chan)
{
@@ -274,6 +284,9 @@ static void process_msg(GIOCondition cond, MPQemuLinkState
*link,
wait = msg->fds[0];
notify_proxy(wait, 0);
break;
+ case DEVICE_RESET:
+ process_device_reset_msg(msg);
+ break;
default:
error_setg(&err, "Unknown command in %s", print_pid_exec(pid_exec));
goto finalize_loop;
--
2.25.GIT
- [PATCH RESEND v6 16/36] multi-process: remote process initialization, (continued)
- [PATCH RESEND v6 16/36] multi-process: remote process initialization, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 18/36] multi-process: Initialize Proxy Object's communication channel, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 19/36] multi-process: Connect Proxy Object with device in the remote process, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 21/36] multi-process: PCI BAR read/write handling for proxy & remote endpoints, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 22/36] multi-process: Synchronize remote memory, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 20/36] multi-process: Forward PCI config space acceses to the remote process, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 23/36] multi-process: create IOHUB object to handle irq, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 25/36] multi-process: Introduce build flags to separate remote process code, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 27/36] multi-process: add support to parse device option, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 29/36] multi-process: handle heartbeat messages in remote process, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 30/36] multi-process: perform device reset in the remote process,
elena . ufimtseva <=
- [PATCH RESEND v6 31/36] multi-process/mon: choose HMP commands based on target, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 34/36] multi-process/mon: Initialize QMP module for remote processes, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 32/36] multi-process/mon: stub functions to enable QMP module for remote process, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 35/36] multi-process: add the concept description to docs/devel/qemu-multiprocess, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 02/36] multi-process: Refactor machine_init and exit notifiers, elena . ufimtseva, 2020/04/23
- [PATCH RESEND v6 08/36] multi-process: Add stub functions to facilitate build of multi-process, elena . ufimtseva, 2020/04/23