that performs mapping of DIMM into guest's address space Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- 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