diff mbox

[17/27] acpi: initialize memory hotplug ACPI ICH9 hardware

Message ID 1385001528-12003-18-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Nov. 21, 2013, 2:38 a.m. UTC
to be used by Q35 machine for handling hardware ACPI part of
memory hotplug interface with guest.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/ich9.c         |   15 +++++++++++++++
 include/hw/acpi/ich9.h |    6 ++++++
 2 files changed, 21 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index fb88162..0efb875 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -210,6 +210,10 @@  void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
     qemu_register_reset(pm_reset, pm);
     pm->powerdown_notifier.notify = pm_powerdown_req;
     qemu_register_powerdown_notifier(&pm->powerdown_notifier);
+
+    acpi_memory_hotplug_init(OBJECT(lpc_pci), &pm->io_mem, &pm->gpe_mem);
+    memory_region_add_subregion(pci_address_space_io(lpc_pci),
+                                ACPI_MEMORY_HOTPLUG_BASE, &pm->io_mem);
 }
 
 static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v,
@@ -234,3 +238,14 @@  void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp)
     object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN,
                                    &gpe0_len, errp);
 }
+
+int ich9_mem_hotplug(DeviceState *hotplug_dev, DeviceState *dev,
+                     HotplugState state)
+{
+    ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev);
+    ICH9LPCPMRegs *pm = &lpc->pm;
+
+    acpi_memory_hotplug_cb(&pm->acpi_regs, &pm->gpe_mem, dev, state);
+    acpi_update_sci(&pm->acpi_regs, pm->irq, ACPI_MEMORY_HOTPLUG_STATUS);
+    return 0;
+}
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index 82fcf9f..7e747be 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -34,6 +34,9 @@  typedef struct ICH9LPCPMRegs {
     MemoryRegion io;
     MemoryRegion io_gpe;
     MemoryRegion io_smi;
+    MemoryRegion io_mem;
+
+    MemHotplugState gpe_mem;
 
     uint32_t smi_en;
     uint32_t smi_sts;
@@ -51,4 +54,7 @@  extern const VMStateDescription vmstate_ich9_pm;
 
 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm, Error **errp);
 
+int ich9_mem_hotplug(DeviceState *hotplug_dev, DeviceState *dev,
+                     HotplugState state);
+
 #endif /* HW_ACPI_ICH9_H */