@@ -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 = {
@@ -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);
+}
@@ -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 */
@@ -76,6 +76,7 @@ typedef enum {
DEVICE_DEL,
PROXY_PING,
MMIO_RETURN,
+ DEVICE_RESET,
MAX,
} proc_cmd_t;
@@ -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;