From: elena.ufimtseva@oracle.com
To: qemu-devel@nongnu.org
Cc: elena.ufimtseva@oracle.com, fam@euphon.net,
swapnil.ingle@nutanix.com, john.g.johnson@oracle.com,
kraxel@redhat.com, jag.raman@oracle.com, quintela@redhat.com,
mst@redhat.com, armbru@redhat.com, kanth.ghatraju@oracle.com,
felipe@nutanix.com, thuth@redhat.com, ehabkost@redhat.com,
konrad.wilk@oracle.com, dgilbert@redhat.com,
alex.williamson@redhat.com, stefanha@redhat.com,
thanos.makatos@nutanix.com, kwolf@redhat.com,
berrange@redhat.com, mreitz@redhat.com,
ross.lagerwall@citrix.com, marcandre.lureau@gmail.com,
pbonzini@redhat.com
Subject: [PATCH v14 RESEND 21/21] multi-process: perform device reset in the remote process
Date: Thu, 17 Dec 2020 21:40:51 -0800 [thread overview]
Message-ID: <63fa586cfe575fcac6c6b32e03804f32053886fb.1608263018.git.elena.ufimtseva@oracle.com> (raw)
In-Reply-To: <cover.1608263017.git.elena.ufimtseva@oracle.com>
From: Elena Ufimtseva <elena.ufimtseva@oracle.com>
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 <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
include/hw/remote/mpqemu-link.h | 1 +
hw/remote/message.c | 22 ++++++++++++++++++++++
hw/remote/proxy.c | 19 +++++++++++++++++++
3 files changed, 42 insertions(+)
diff --git a/include/hw/remote/mpqemu-link.h b/include/hw/remote/mpqemu-link.h
index 0de995e044..49dcad96d7 100644
--- a/include/hw/remote/mpqemu-link.h
+++ b/include/hw/remote/mpqemu-link.h
@@ -40,6 +40,7 @@ typedef enum {
MPQEMU_CMD_BAR_WRITE,
MPQEMU_CMD_BAR_READ,
MPQEMU_CMD_SET_IRQFD,
+ MPQEMU_CMD_DEVICE_RESET,
MPQEMU_CMD_MAX,
} MPQemuCmd;
diff --git a/hw/remote/message.c b/hw/remote/message.c
index 96ed11d8c6..97e608e4c1 100644
--- a/hw/remote/message.c
+++ b/hw/remote/message.c
@@ -19,6 +19,7 @@
#include "exec/memattrs.h"
#include "hw/remote/memory.h"
#include "hw/remote/iohub.h"
+#include "sysemu/reset.h"
static void process_config_write(QIOChannel *ioc, PCIDevice *dev,
MPQemuMsg *msg, Error **errp);
@@ -26,6 +27,8 @@ static void process_config_read(QIOChannel *ioc, PCIDevice *dev,
MPQemuMsg *msg, Error **errp);
static void process_bar_write(QIOChannel *ioc, MPQemuMsg *msg, Error **errp);
static void process_bar_read(QIOChannel *ioc, MPQemuMsg *msg, Error **errp);
+static void process_device_reset_msg(QIOChannel *ioc, PCIDevice *dev,
+ Error **errp);
void coroutine_fn mpqemu_remote_msg_loop_co(void *data)
{
@@ -69,6 +72,9 @@ void coroutine_fn mpqemu_remote_msg_loop_co(void *data)
case MPQEMU_CMD_SET_IRQFD:
process_set_irqfd_msg(pci_dev, &msg);
break;
+ case MPQEMU_CMD_DEVICE_RESET:
+ process_device_reset_msg(com->ioc, pci_dev, &local_err);
+ break;
default:
error_setg(&local_err,
"Unknown command (%d) received for device %s"
@@ -206,3 +212,19 @@ fail:
getpid());
}
}
+
+static void process_device_reset_msg(QIOChannel *ioc, PCIDevice *dev,
+ Error **errp)
+{
+ DeviceClass *dc = DEVICE_GET_CLASS(dev);
+ DeviceState *s = DEVICE(dev);
+ MPQemuMsg ret = { 0 };
+
+ if (dc->reset) {
+ dc->reset(s);
+ }
+
+ ret.cmd = MPQEMU_CMD_RET;
+
+ mpqemu_msg_send(&ret, ioc, errp);
+}
diff --git a/hw/remote/proxy.c b/hw/remote/proxy.c
index ac77420b68..7483adf1f1 100644
--- a/hw/remote/proxy.c
+++ b/hw/remote/proxy.c
@@ -25,6 +25,7 @@
#include "util/event_notifier-posix.c"
static void probe_pci_info(PCIDevice *dev, Error **errp);
+static void proxy_device_reset(DeviceState *dev);
static void proxy_intx_update(PCIDevice *pci_dev)
{
@@ -194,6 +195,8 @@ static void pci_proxy_dev_class_init(ObjectClass *klass, void *data)
k->config_read = pci_proxy_read_config;
k->config_write = pci_proxy_write_config;
+ dc->reset = proxy_device_reset;
+
device_class_set_props(dc, proxy_properties);
}
@@ -350,3 +353,19 @@ static void probe_pci_info(PCIDevice *dev, Error **errp)
}
}
}
+
+static void proxy_device_reset(DeviceState *dev)
+{
+ PCIProxyDev *pdev = PCI_PROXY_DEV(dev);
+ MPQemuMsg msg = { 0 };
+ Error *local_err = NULL;
+
+ msg.cmd = MPQEMU_CMD_DEVICE_RESET;
+ msg.size = 0;
+
+ mpqemu_msg_send_and_await_reply(&msg, pdev, &local_err);
+ if (local_err) {
+ error_report_err(local_err);
+ }
+
+}
--
2.25.GIT
next prev parent reply other threads:[~2020-12-18 5:53 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 3:57 [PATCH v14 00/21] Initial support for multi-process Qemu elena.ufimtseva
2020-12-18 3:57 ` [PATCH v14 01/21] multi-process: add the concept description to docs/devel/qemu-multiprocess elena.ufimtseva
2020-12-18 5:20 ` [PATCH v14 RESEND " elena.ufimtseva
2020-12-18 3:57 ` [PATCH v14 02/21] multi-process: add configure and usage information elena.ufimtseva
2020-12-18 5:20 ` [PATCH v14 RESEND " elena.ufimtseva
2020-12-18 3:57 ` [PATCH v14 03/21] memory: alloc RAM from file at offset elena.ufimtseva
2020-12-18 5:20 ` [PATCH v14 RESEND " elena.ufimtseva
2020-12-18 3:57 ` [PATCH v14 04/21] socket: export socket_get_fd() function elena.ufimtseva
2020-12-18 5:20 ` [PATCH v14 RESEND " elena.ufimtseva
2020-12-18 11:39 ` [PATCH v14 " Marc-André Lureau
2020-12-18 5:19 ` [PATCH v14 00/21] Initial support for multi-process Qemu Elena Ufimtseva
2020-12-18 5:20 ` [PATCH v14 RESEND " elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 05/21] multi-process: Add config option for multi-process QEMU elena.ufimtseva
2020-12-22 10:22 ` Stefan Hajnoczi
2020-12-18 5:40 ` [PATCH v14 RESEND 06/21] multi-process: setup PCI host bridge for remote device elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 07/21] multi-process: setup a machine object for remote device process elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 08/21] multi-process: add qio channel write function elena.ufimtseva
2020-12-22 10:24 ` Stefan Hajnoczi
2020-12-18 5:40 ` [PATCH v14 RESEND 09/21] multi-process: add qio channel read function elena.ufimtseva
2020-12-22 10:29 ` Stefan Hajnoczi
2020-12-18 5:40 ` [PATCH v14 RESEND 10/21] multi-process: define MPQemuMsg format and transmission functions elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 11/21] multi-process: Initialize message handler in remote device elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 12/21] multi-process: Associate fd of a PCIDevice with its object elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 13/21] multi-process: setup memory manager for remote device elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 14/21] multi-process: introduce proxy object elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 15/21] multi-process: add proxy communication functions elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 16/21] multi-process: Forward PCI config space acceses to the remote process elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 17/21] multi-process: PCI BAR read/write handling for proxy & remote endpoints elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 18/21] multi-process: Synchronize remote memory elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 19/21] multi-process: create IOHUB object to handle irq elena.ufimtseva
2020-12-18 5:40 ` [PATCH v14 RESEND 20/21] multi-process: Retrieve PCI info from remote process elena.ufimtseva
2020-12-18 5:40 ` elena.ufimtseva [this message]
2020-12-22 10:38 ` [PATCH v14 00/21] Initial support for multi-process Qemu Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=63fa586cfe575fcac6c6b32e03804f32053886fb.1608263018.git.elena.ufimtseva@oracle.com \
--to=elena.ufimtseva@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=felipe@nutanix.com \
--cc=jag.raman@oracle.com \
--cc=john.g.johnson@oracle.com \
--cc=kanth.ghatraju@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=ross.lagerwall@citrix.com \
--cc=stefanha@redhat.com \
--cc=swapnil.ingle@nutanix.com \
--cc=thanos.makatos@nutanix.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).