[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 024/106] acpi:piix4: add memory hotplug handling
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 024/106] acpi:piix4: add memory hotplug handling |
Date: |
Wed, 18 Jun 2014 19:17:06 +0300 |
From: Igor Mammedov <address@hidden>
Add memory hotplug initialization/handling to PIIX4_PM device
and enable it by default for post 2.0 machine types
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
MST: resolve conflict in pc.h
---
include/hw/acpi/memory_hotplug.h | 1 +
include/hw/i386/pc.h | 8 +++++++-
hw/acpi/piix4.c | 15 ++++++++++++++-
3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index 8f90f72..912c53f 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -15,6 +15,7 @@ typedef struct MemStatus {
} MemStatus;
typedef struct MemHotplugState {
+ bool is_enabled; /* true if memory hotplug is supported */
MemoryRegion io;
uint32_t selector;
uint32_t dev_count;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c3ed858..f6d4172 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -311,10 +311,16 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t
*);
#define PC_COMPAT_2_0 \
{\
+ .driver = "PIIX4_PM",\
+ .property = "memory-hotplug-support",\
+ .value = "off",\
+ },\
+ {\
.driver = "apic",\
.property = "version",\
.value = stringify(0x11),\
- },{\
+ },\
+ {\
.driver = "nec-usb-xhci",\
.property = "superspeed-ports-first",\
.value = "off",\
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index c9c6b8b..5c542b7 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -33,6 +33,8 @@
#include "hw/acpi/pcihp.h"
#include "hw/acpi/cpu_hotplug.h"
#include "hw/hotplug.h"
+#include "hw/mem/pc-dimm.h"
+#include "hw/acpi/memory_hotplug.h"
//#define DEBUG
@@ -81,6 +83,8 @@ typedef struct PIIX4PMState {
AcpiCpuHotplug gpe_cpu;
Notifier cpu_added_notifier;
+
+ MemHotplugState acpi_memory_hotplug;
} PIIX4PMState;
#define TYPE_PIIX4_PM "PIIX4_PM"
@@ -313,7 +317,10 @@ static void piix4_device_plug_cb(HotplugHandler
*hotplug_dev,
{
PIIX4PMState *s = PIIX4_PM(hotplug_dev);
- if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
+ if (s->acpi_memory_hotplug.is_enabled &&
+ object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
+ acpi_memory_plug_cb(&s->ar, s->irq, &s->acpi_memory_hotplug, dev,
errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
acpi_pcihp_device_plug_cb(&s->ar, s->irq, &s->acpi_pci_hotplug, dev,
errp);
} else {
@@ -531,6 +538,10 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion
*parent,
PIIX4_CPU_HOTPLUG_IO_BASE);
s->cpu_added_notifier.notify = piix4_cpu_added_req;
qemu_register_cpu_added_notifier(&s->cpu_added_notifier);
+
+ if (s->acpi_memory_hotplug.is_enabled) {
+ acpi_memory_hotplug_init(parent, OBJECT(s), &s->acpi_memory_hotplug);
+ }
}
static Property piix4_pm_properties[] = {
@@ -540,6 +551,8 @@ static Property piix4_pm_properties[] = {
DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2),
DEFINE_PROP_BOOL("acpi-pci-hotplug-with-bridge-support", PIIX4PMState,
use_acpi_pci_hotplug, true),
+ DEFINE_PROP_BOOL("memory-hotplug-support", PIIX4PMState,
+ acpi_memory_hotplug.is_enabled, true),
DEFINE_PROP_END_OF_LIST(),
};
--
MST
- [Qemu-devel] [PULL v2 009/106] pc: implement pc-dimm device abstraction, (continued)
- [Qemu-devel] [PULL v2 009/106] pc: implement pc-dimm device abstraction, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 011/106] pc-dimm: do not allow setting an in-use memdev, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 010/106] memory: add memory_region_is_mapped() API, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 012/106] pc: initialize memory hotplug address space, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 014/106] pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 018/106] pc-dimm: add busy slot check and slot auto-allocation, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 021/106] trace: add acpi memory hotplug IO region events, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 022/106] trace: pc: add PC_DIMM slot & address allocation, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 023/106] acpi:piix4: allow plug/unlug callbacks handle not only PCI devices, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 025/106] pc: ich9 lpc: make it work with global/compat properties, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] [PULL v2 024/106] acpi:piix4: add memory hotplug handling,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 026/106] acpi:ich9: add memory hotplug handling, Michael S. Tsirkin, 2014/06/18
- [Qemu-devel] per-machine vs per-qemu-version compat_props macros (was Re: acpi:ich9: add memory hotplug handling), Eduardo Habkost, 2014/06/24
- Re: [Qemu-devel] per-machine vs per-qemu-version compat_props macros (was Re: acpi:ich9: add memory hotplug handling), Peter Maydell, 2014/06/24
- Re: [Qemu-devel] per-machine vs per-qemu-version compat_props macros (was Re: acpi:ich9: add memory hotplug handling), Eduardo Habkost, 2014/06/24
- Re: [Qemu-devel] per-machine vs per-qemu-version compat_props macros (was Re: acpi:ich9: add memory hotplug handling), Marcel Apfelbaum, 2014/06/24
- Re: [Qemu-devel] per-machine vs per-qemu-version compat_props macros (was Re: acpi:ich9: add memory hotplug handling), Peter Maydell, 2014/06/24
- Re: [Qemu-devel] per-machine vs per-qemu-version compat_props macros (was Re: acpi:ich9: add memory hotplug handling), Eduardo Habkost, 2014/06/24
- Re: [Qemu-devel] per-machine vs per-qemu-version compat_props macros (was Re: acpi:ich9: add memory hotplug handling), Eduardo Habkost, 2014/06/24
[Qemu-devel] [PULL v2 027/106] pc: migrate piix4 & ich9 MemHotplugState, Michael S. Tsirkin, 2014/06/18
[Qemu-devel] [PULL v2 030/106] pc: ACPI BIOS: implement memory hotplug interface, Michael S. Tsirkin, 2014/06/18