to be used by i440fx machine for handling hardware ACPI part of memory hotplug interface with guest.
Signed-off-by: Igor Mammedov <imamm...@redhat.com> --- hw/acpi/piix4.c | 16 ++++++++++++++++ include/hw/acpi/piix4.h | 2 ++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index cf42f13..e0d9270 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -75,6 +75,7 @@ typedef struct PIIX4PMState { MemoryRegion io_gpe; MemoryRegion io_cpu; + MemoryRegion io_mem; ACPIREGS ar; APMState apm; @@ -104,6 +105,8 @@ typedef struct PIIX4PMState { CPUStatus gpe_cpu; Notifier cpu_added_notifier; + + MemHotplugState gpe_mem; } PIIX4PMState; #define TYPE_PIIX4_PM "PIIX4_PM" @@ -741,6 +744,16 @@ static void piix4_cpu_added_req(Notifier *n, void *opaque) piix4_cpu_hotplug_req(s, CPU(opaque), PLUG); } +int piix4_mem_hotplug(DeviceState *hotplug_dev, DeviceState *dev, + HotplugState state) +{ + PIIX4PMState *s = PIIX4_PM(hotplug_dev); + + acpi_memory_hotplug_cb(&s->ar, &s->gpe_mem, dev, state); + acpi_update_sci(&s->ar, s->irq, ACPI_MEMORY_HOTPLUG_STATUS); + return 0; +} + static int piix4_device_hotplug(DeviceState *qdev, DeviceState *dev, HotplugState state); @@ -775,6 +788,9 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, memory_region_add_subregion(parent, PIIX4_PROC_BASE, &s->io_cpu); s->cpu_added_notifier.notify = piix4_cpu_added_req; qemu_register_cpu_added_notifier(&s->cpu_added_notifier); + + acpi_memory_hotplug_init(OBJECT(s), &s->io_mem, &s->gpe_mem); + memory_region_add_subregion(parent, ACPI_MEMORY_HOTPLUG_BASE, &s->io_mem); } static void enable_device(PIIX4PMState *s, int slot) diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h index 65e6fd7..c314ab5 100644 --- a/include/hw/acpi/piix4.h +++ b/include/hw/acpi/piix4.h @@ -4,5 +4,7 @@ #include "qemu/typedefs.h" Object *piix4_pm_find(void); +int piix4_mem_hotplug(DeviceState *hotplug_dev, DeviceState *dev, + HotplugState state); #endif -- 1.7.1