@@ -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 = {
@@ -51,6 +51,7 @@ typedef enum {
GET_PCI_INFO,
RET_PCI_INFO,
PROXY_PING,
+ DEVICE_RESET,
MAX,
} mpqemu_cmd_t;
@@ -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;