[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 07/33] qdev: hotplug for buss-less devices
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v4 07/33] qdev: hotplug for buss-less devices |
Date: |
Mon, 2 Jun 2014 15:25:03 +0200 |
Adds get_hotplug_handler() method to machine, and
makes bus-less device to use it during hotplug
as a means to discover hotplug handler controller.
Returned controller is used to permorm a hotplug
action.
Signed-off-by: Igor Mammedov <address@hidden>
Acked-by: Peter Crosthwaite <address@hidden>
---
hw/core/qdev.c | 13 +++++++++++++
include/hw/boards.h | 8 ++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index e65a5aa..fded645 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -34,6 +34,7 @@
#include "qapi/qmp/qjson.h"
#include "monitor/monitor.h"
#include "hw/hotplug.h"
+#include "hw/boards.h"
int qdev_hotplug = 0;
static bool qdev_hot_added = false;
@@ -813,6 +814,18 @@ static void device_set_realized(Object *obj, bool value,
Error **errp)
local_err == NULL) {
hotplug_handler_plug(dev->parent_bus->hotplug_handler,
dev, &local_err);
+ } else if (local_err == NULL &&
+ object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
+ HotplugHandler *hotplug_ctrl;
+ MachineState *machine = MACHINE(qdev_get_machine());
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
+
+ if (mc->get_hotplug_handler) {
+ hotplug_ctrl = mc->get_hotplug_handler(machine, dev);
+ if (hotplug_ctrl) {
+ hotplug_handler_plug(hotplug_ctrl, dev, &local_err);
+ }
+ }
}
if (qdev_get_vmsd(dev) && local_err == NULL) {
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 184d245..429ac43 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -61,6 +61,11 @@ extern MachineState *current_machine;
/**
* MachineClass:
* @qemu_machine: #QEMUMachine
+ * @get_hotplug_handler: this function is called during bus-less
+ * device hotplug. If defined it returns pointer to an instance
+ * of HotplugHandler object, which handles hotplug operation
+ * for a given @dev. It may return NULL if @dev doesn't require
+ * any actions to be performed by hotplug handler.
*/
struct MachineClass {
/*< private >*/
@@ -90,6 +95,9 @@ struct MachineClass {
const char *default_boot_order;
GlobalProperty *compat_props;
const char *hw_version;
+
+ HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
+ DeviceState *dev);
};
/**
--
1.7.1
- [Qemu-devel] [PATCH v4 00/33] pc: ACPI memory hotplug, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 02/33] pc: ACPI BIOS: use enum for defining memory affinity flags, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 03/33] object_add: allow completion handler to get canonical path, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 04/33] vl.c: daemonize before guest memory allocation, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 01/33] pc: create custom generic PC machine type, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 05/33] add memdev backend infrastructure, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 07/33] qdev: hotplug for buss-less devices,
Igor Mammedov <=
- [Qemu-devel] [PATCH v4 09/33] pc: implement pc-dimm device abstraction, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 08/33] qdev: expose DeviceState.hotplugged field as a property, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 06/33] vl.c: extend -m option to support options for memory hotplug, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 11/33] pc-dimm: do not allow to set already used memdev, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 10/33] memory: add memory_region_is_mapped() API, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 12/33] pc: initialize memory hotplug address space, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 13/33] pc: exit QEMU if number of slots more than supported 256, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 14/33] pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 15/33] pc: exit QEMU if compat machine doesn't support memory hotlpug, Igor Mammedov, 2014/06/02
- [Qemu-devel] [PATCH v4 17/33] pc-dimm: add busy address check and address auto-allocation, Igor Mammedov, 2014/06/02