[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 04/19] remote/machine: add HotplugHandler for remote machine
From: |
Jagannathan Raman |
Subject: |
[PATCH v6 04/19] remote/machine: add HotplugHandler for remote machine |
Date: |
Thu, 17 Feb 2022 02:48:51 -0500 |
Allow hotplugging of PCI(e) devices to remote machine
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>
---
hw/remote/machine.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/remote/machine.c b/hw/remote/machine.c
index 952105eab5..0c5bd4f923 100644
--- a/hw/remote/machine.c
+++ b/hw/remote/machine.c
@@ -21,6 +21,7 @@
#include "qapi/error.h"
#include "hw/pci/pci_host.h"
#include "hw/remote/iohub.h"
+#include "hw/qdev-core.h"
static void remote_machine_init(MachineState *machine)
{
@@ -54,14 +55,19 @@ static void remote_machine_init(MachineState *machine)
pci_bus_irqs(pci_host->bus, remote_iohub_set_irq, remote_iohub_map_irq,
&s->iohub, REMOTE_IOHUB_NB_PIRQS);
+
+ qbus_set_hotplug_handler(BUS(pci_host->bus), OBJECT(s));
}
static void remote_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
mc->init = remote_machine_init;
mc->desc = "Experimental remote machine";
+
+ hc->unplug = qdev_simple_device_unplug_cb;
}
static const TypeInfo remote_machine = {
@@ -69,6 +75,10 @@ static const TypeInfo remote_machine = {
.parent = TYPE_MACHINE,
.instance_size = sizeof(RemoteMachineState),
.class_init = remote_machine_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ }
};
static void remote_machine_register_types(void)
--
2.20.1
- [PATCH v6 03/19] qdev: unplug blocker for devices, (continued)
- [PATCH v6 03/19] qdev: unplug blocker for devices, Jagannathan Raman, 2022/02/17
- [PATCH v6 07/19] vfio-user: define vfio-user-server object, Jagannathan Raman, 2022/02/17
- [PATCH v6 02/19] tests/avocado: Specify target VM argument to helper routines, Jagannathan Raman, 2022/02/17
- [PATCH v6 04/19] remote/machine: add HotplugHandler for remote machine,
Jagannathan Raman <=
- [PATCH v6 06/19] vfio-user: build library, Jagannathan Raman, 2022/02/17
- [PATCH v6 10/19] vfio-user: run vfio-user context, Jagannathan Raman, 2022/02/17
- [PATCH v6 08/19] vfio-user: instantiate vfio-user context, Jagannathan Raman, 2022/02/17
- [PATCH v6 12/19] vfio-user: IOMMU support for remote device, Jagannathan Raman, 2022/02/17