[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 8/8] pc: make PC_MACHINE memory hotplug controller
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [RFC 8/8] pc: make PC_MACHINE memory hotplug controller |
Date: |
Thu, 20 Mar 2014 16:01:16 +0100 |
that performs mapping of DIMM into guest's address space
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/i386/pc.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 1824c3d..1cef30d 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1445,6 +1445,17 @@ void ioapic_init_gsi(GSIState *gsi_state, const char
*parent_name)
}
}
+static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ DimmDevice *dimm = DIMM(dev);
+ DimmDeviceClass *ddc = DIMM_GET_CLASS(dimm);
+ PCMachineState *pcms = PC_MACHINE(hotplug_dev);
+ MemoryRegion *mr = ddc->get_memory_region(dimm);
+
+ memory_region_add_subregion(&pcms->hotplug_memory, dimm->start, mr);
+}
+
void qemu_register_pc_machine(QEMUMachine *m)
{
TypeInfo ti = {
@@ -1467,9 +1478,12 @@ static char *pc_dimm_hotplug_path(DeviceState *dev)
static void pc_machine_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dimm_dc = DEVICE_CLASS(object_class_by_name(TYPE_DIMM));
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
/* set board specific link path provider for DIMM device */
dimm_dc->hotplug_path = pc_dimm_hotplug_path;
+
+ hc->plug = pc_machine_device_plug_cb;
}
static const TypeInfo pc_machine_info = {
@@ -1478,6 +1492,10 @@ static const TypeInfo pc_machine_info = {
.abstract = true,
.instance_size = sizeof(PCMachineState),
.class_init = pc_machine_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_HOTPLUG_HANDLER },
+ { }
+ },
};
static void pc_machine_register_types(void)
--
1.7.1
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, (continued)
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Paolo Bonzini, 2014/03/20
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Igor Mammedov, 2014/03/20
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Paolo Bonzini, 2014/03/20
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Igor Mammedov, 2014/03/21
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Paolo Bonzini, 2014/03/21
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Igor Mammedov, 2014/03/24
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Andreas Färber, 2014/03/24
- Re: [Qemu-devel] [RFC 4/8] qdev: link based hotplug, Michael S. Tsirkin, 2014/03/24
[Qemu-devel] [RFC 6/8] pc: preallocate hotplug links for DIMMDevices, Igor Mammedov, 2014/03/20
[Qemu-devel] [RFC 7/8] pc: initialize memory hotplug address space, Igor Mammedov, 2014/03/20
[Qemu-devel] [RFC 8/8] pc: make PC_MACHINE memory hotplug controller,
Igor Mammedov <=